Merge "mmc: card: quirk: disable HPI for Kingston card"
diff --git a/arch/arm/boot/dts/msm8226-v2.dtsi b/arch/arm/boot/dts/msm8226-v2.dtsi
index 14fe237..787c9fb 100644
--- a/arch/arm/boot/dts/msm8226-v2.dtsi
+++ b/arch/arm/boot/dts/msm8226-v2.dtsi
@@ -80,11 +80,18 @@
< 0 0>,
< 384000000 2>,
< 787200000 4>,
+ < 998400000 5>,
+ <1094400000 6>,
<1190400000 7>;
qcom,speed2-bin-v2 =
< 0 0>,
< 384000000 2>,
< 787200000 4>,
+ < 998400000 5>,
+ <1094400000 6>,
+ <1190400000 7>,
+ <1305600000 8>,
+ <1344000000 9>,
<1401600000 10>;
qcom,speed1-bin-v2 =
< 0 0>,
diff --git a/arch/arm/boot/dts/msm8926.dtsi b/arch/arm/boot/dts/msm8926.dtsi
index 394f4a9..1919022 100644
--- a/arch/arm/boot/dts/msm8926.dtsi
+++ b/arch/arm/boot/dts/msm8926.dtsi
@@ -53,11 +53,18 @@
< 0 0>,
< 384000000 2>,
< 787200000 4>,
+ < 998400000 5>,
+ <1094400000 6>,
<1190400000 7>;
qcom,speed2-bin-v1 =
< 0 0>,
< 384000000 2>,
< 787200000 4>,
+ < 998400000 5>,
+ <1094400000 6>,
+ <1190400000 7>,
+ <1305600000 8>,
+ <1344000000 9>,
<1401600000 10>;
qcom,speed1-bin-v1 =
< 0 0>,
diff --git a/arch/arm/boot/dts/msm8974pro-ab-pm8941-cdp.dts b/arch/arm/boot/dts/msm8974pro-ab-pm8941-cdp.dts
index 5a01945..b9f2574 100644
--- a/arch/arm/boot/dts/msm8974pro-ab-pm8941-cdp.dts
+++ b/arch/arm/boot/dts/msm8974pro-ab-pm8941-cdp.dts
@@ -25,3 +25,8 @@
qcom,pad-pull-on = <0x0 0x3 0x3 0x1>; /* no-pull, pull-up, pull-up, pull-down */
qcom,pad-pull-off = <0x0 0x3 0x3 0x1>; /* no-pull, pull-up, pull-up, pull-down */
};
+
+&ehci {
+ hsusb_vdd_dig-supply = <&pm8841_s2_corner>;
+ qcom,vdd-voltage-level = <1 2 3 5 7>;
+};
diff --git a/arch/arm/boot/dts/msm8974pro-ab-pm8941-mtp.dts b/arch/arm/boot/dts/msm8974pro-ab-pm8941-mtp.dts
index f80551e..99c4ec7 100644
--- a/arch/arm/boot/dts/msm8974pro-ab-pm8941-mtp.dts
+++ b/arch/arm/boot/dts/msm8974pro-ab-pm8941-mtp.dts
@@ -26,3 +26,10 @@
qcom,pad-pull-off = <0x0 0x3 0x3 0x1>; /* no-pull, pull-up, pull-up, pull-down */
qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
};
+
+&ehci {
+ status = "ok";
+ qcom,usb2-enable-uicc;
+ hsusb_vdd_dig-supply = <&pm8841_s2_corner>;
+ qcom,vdd-voltage-level = <1 2 3 5 7>;
+};
diff --git a/arch/arm/boot/dts/msm8974pro-ac-pm8941-mtp.dts b/arch/arm/boot/dts/msm8974pro-ac-pm8941-mtp.dts
index 76d0121..a25b8ca 100644
--- a/arch/arm/boot/dts/msm8974pro-ac-pm8941-mtp.dts
+++ b/arch/arm/boot/dts/msm8974pro-ac-pm8941-mtp.dts
@@ -25,3 +25,8 @@
qcom,pad-pull-on = <0x0 0x3 0x3 0x1>; /* no-pull, pull-up, pull-up, pull-down */
qcom,pad-pull-off = <0x0 0x3 0x3 0x1>; /* no-pull, pull-up, pull-up, pull-down */
};
+
+&ehci {
+ status = "ok";
+ qcom,usb2-enable-uicc;
+};
diff --git a/arch/arm/boot/dts/msm8974pro-ac-pma8084-pm8941-mtp.dts b/arch/arm/boot/dts/msm8974pro-ac-pma8084-pm8941-mtp.dts
index 8a4ad45..0fe8813 100644
--- a/arch/arm/boot/dts/msm8974pro-ac-pma8084-pm8941-mtp.dts
+++ b/arch/arm/boot/dts/msm8974pro-ac-pma8084-pm8941-mtp.dts
@@ -120,3 +120,8 @@
qcom,thermal-node;
};
};
+
+&ehci {
+ status = "ok";
+ qcom,usb2-enable-uicc;
+};
diff --git a/arch/arm/boot/dts/msm8974pro-pm8941.dtsi b/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
index 89939e6..b502078 100644
--- a/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
+++ b/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
@@ -71,6 +71,11 @@
qcom,utmi-clk-rate = <24000000>;
};
+&ehci {
+ hsusb_vdd_dig-supply = <&pm8841_s2_corner>;
+ qcom,vdd-voltage-level = <1 2 3 5 7>;
+};
+
&krait_regulator_pmic {
status = "ok";
diff --git a/arch/arm/boot/dts/msm8974pro-pma8084.dtsi b/arch/arm/boot/dts/msm8974pro-pma8084.dtsi
index ab4ffb5..28ddda2 100644
--- a/arch/arm/boot/dts/msm8974pro-pma8084.dtsi
+++ b/arch/arm/boot/dts/msm8974pro-pma8084.dtsi
@@ -118,6 +118,8 @@
HSUSB_VDDCX-supply = <&pma8084_s2>;
HSUSB_1p8-supply = <&pma8084_l6>;
HSUSB_3p3-supply = <&pma8084_l24>;
+ hsusb_vdd_dig-supply = <&pma8084_s2_corner>;
+ qcom,vdd-voltage-level = <1 2 3 5 7>;
};
qcom,gdsc@fd8c4024 {
diff --git a/arch/arm/mach-msm/board-8974.c b/arch/arm/mach-msm/board-8974.c
index 7b13bbc..a923846 100644
--- a/arch/arm/mach-msm/board-8974.c
+++ b/arch/arm/mach-msm/board-8974.c
@@ -149,8 +149,6 @@
"msm-tsens", NULL),
OF_DEV_AUXDATA("qcom,qcedev", 0xFD440000, \
"qcedev.0", NULL),
- OF_DEV_AUXDATA("qcom,qcrypto", 0xFD440000, \
- "qcrypto.0", NULL),
OF_DEV_AUXDATA("qcom,hsic-host", 0xF9A00000, \
"msm_hsic_host", NULL),
OF_DEV_AUXDATA("qcom,hsic-smsc-hub", 0, "msm_smsc_hub",
diff --git a/arch/arm/mach-msm/clock-8974.c b/arch/arm/mach-msm/clock-8974.c
index b730091..1847bf4 100644
--- a/arch/arm/mach-msm/clock-8974.c
+++ b/arch/arm/mach-msm/clock-8974.c
@@ -4976,10 +4976,16 @@
CLK_LOOKUP("bus_clk", gcc_ce2_axi_clk.c, "qcedev.0"),
CLK_LOOKUP("core_clk_src", ce2_clk_src.c, "qcedev.0"),
- CLK_LOOKUP("core_clk", gcc_ce2_clk.c, "qcrypto.0"),
- CLK_LOOKUP("iface_clk", gcc_ce2_ahb_clk.c, "qcrypto.0"),
- CLK_LOOKUP("bus_clk", gcc_ce2_axi_clk.c, "qcrypto.0"),
- CLK_LOOKUP("core_clk_src", ce2_clk_src.c, "qcrypto.0"),
+
+ CLK_LOOKUP("core_clk", gcc_ce2_clk.c, "fd440000.qcom,qcrypto"),
+ CLK_LOOKUP("iface_clk", gcc_ce2_ahb_clk.c, "fd440000.qcom,qcrypto"),
+ CLK_LOOKUP("bus_clk", gcc_ce2_axi_clk.c, "fd440000.qcom,qcrypto"),
+ CLK_LOOKUP("core_clk_src", ce2_clk_src.c, "fd440000.qcom,qcrypto"),
+
+ CLK_LOOKUP("core_clk", gcc_ce2_clk.c, "fd440000.qcom,qcrypto1"),
+ CLK_LOOKUP("iface_clk", gcc_ce2_ahb_clk.c, "fd440000.qcom,qcrypto1"),
+ CLK_LOOKUP("bus_clk", gcc_ce2_axi_clk.c, "fd440000.qcom,qcrypto1"),
+ CLK_LOOKUP("core_clk_src", ce2_clk_src.c, "fd440000.qcom,qcrypto1"),
CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "qseecom"),
CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "qseecom"),
diff --git a/arch/arm/mach-msm/pil-pronto.c b/arch/arm/mach-msm/pil-pronto.c
index a7fc204..a91331e 100644
--- a/arch/arm/mach-msm/pil-pronto.c
+++ b/arch/arm/mach-msm/pil-pronto.c
@@ -62,6 +62,9 @@
#define PRONTO_PMU_CCPU_BOOT_REMAP_ADDR 0x2004
+#define PRONTO_PMU_SPARE 0x1088
+#define PRONTO_PMU_SPARE_SSR_BIT BIT(23)
+
#define CLK_CTL_WCNSS_RESTART_BIT BIT(0)
#define AXI_HALTREQ 0x0
@@ -376,7 +379,15 @@
struct pronto_data *drv = subsys_to_drv(subsys);
struct platform_device *pdev = wcnss_get_platform_device();
struct wcnss_wlan_config *pwlanconfig = wcnss_get_wlan_config();
- int ret = -1;
+ void __iomem *base = drv->base;
+ u32 reg;
+ int ret = -1;
+
+ if (base) {
+ reg = readl_relaxed(base + PRONTO_PMU_SPARE);
+ reg |= PRONTO_PMU_SPARE_SSR_BIT;
+ writel_relaxed(reg, base + PRONTO_PMU_SPARE);
+ }
if (pdev && pwlanconfig)
ret = wcnss_wlan_power(&pdev->dev, pwlanconfig,
diff --git a/drivers/media/platform/msm/vidc/hfi_packetization.c b/drivers/media/platform/msm/vidc/hfi_packetization.c
index 1ca85bd..a563f68 100644
--- a/drivers/media/platform/msm/vidc/hfi_packetization.c
+++ b/drivers/media/platform/msm/vidc/hfi_packetization.c
@@ -342,12 +342,6 @@
case HAL_EXTRADATA_RECOVERY_POINT_SEI:
ret = HFI_PROPERTY_PARAM_VDEC_RECOVERY_POINT_SEI_EXTRADATA;
break;
- case HAL_EXTRADATA_CLOSED_CAPTION_UD:
- ret = HFI_PROPERTY_PARAM_VDEC_CLOSED_CAPTION_EXTRADATA;
- break;
- case HAL_EXTRADATA_AFD_UD:
- ret = HFI_PROPERTY_PARAM_VDEC_AFD_EXTRADATA;
- break;
case HAL_EXTRADATA_MULTISLICE_INFO:
ret = HFI_PROPERTY_PARAM_VENC_MULTI_SLICE_INFO;
break;
@@ -372,6 +366,9 @@
case HAL_EXTRADATA_METADATA_MBI:
ret = HFI_PROPERTY_PARAM_VENC_MBI_DUMPING;
break;
+ case HAL_EXTRADATA_STREAM_USERDATA:
+ ret = HFI_PROPERTY_PARAM_VDEC_STREAM_USERDATA_EXTRADATA;
+ break;
default:
dprintk(VIDC_WARN, "Extradata index not found: %d\n", index);
break;
diff --git a/drivers/media/platform/msm/vidc/msm_vdec.c b/drivers/media/platform/msm/vidc/msm_vdec.c
index 8a0dfc2..7d27cea 100644
--- a/drivers/media/platform/msm/vidc/msm_vdec.c
+++ b/drivers/media/platform/msm/vidc/msm_vdec.c
@@ -211,7 +211,7 @@
.name = "Extradata Type",
.type = V4L2_CTRL_TYPE_MENU,
.minimum = V4L2_MPEG_VIDC_EXTRADATA_NONE,
- .maximum = V4L2_MPEG_VIDC_EXTRADATA_FRAME_BITS_INFO,
+ .maximum = V4L2_MPEG_VIDC_EXTRADATA_STREAM_USERDATA,
.default_value = V4L2_MPEG_VIDC_EXTRADATA_NONE,
.menu_skip_mask = ~(
(1 << V4L2_MPEG_VIDC_EXTRADATA_NONE) |
@@ -224,8 +224,6 @@
(1 << V4L2_MPEG_VIDC_EXTRADATA_FRAME_RATE) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_PANSCAN_WINDOW) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_RECOVERY_POINT_SEI) |
- (1 << V4L2_MPEG_VIDC_EXTRADATA_CLOSED_CAPTION_UD) |
- (1 << V4L2_MPEG_VIDC_EXTRADATA_AFD_UD) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_MULTISLICE_INFO) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_NUM_CONCEALED_MB) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_METADATA_FILLER) |
@@ -234,7 +232,8 @@
(1 << V4L2_MPEG_VIDC_INDEX_EXTRADATA_ASPECT_RATIO) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_MPEG2_SEQDISP) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_FRAME_QP) |
- (1 << V4L2_MPEG_VIDC_EXTRADATA_FRAME_BITS_INFO)
+ (1 << V4L2_MPEG_VIDC_EXTRADATA_FRAME_BITS_INFO) |
+ (1 << V4L2_MPEG_VIDC_EXTRADATA_STREAM_USERDATA)
),
.qmenu = mpeg_video_vidc_extradata,
.step = 0,
diff --git a/drivers/media/platform/msm/vidc/msm_venc.c b/drivers/media/platform/msm/vidc/msm_venc.c
index 1ba5fcc..9504817 100644
--- a/drivers/media/platform/msm/vidc/msm_venc.c
+++ b/drivers/media/platform/msm/vidc/msm_venc.c
@@ -657,8 +657,6 @@
(1 << V4L2_MPEG_VIDC_EXTRADATA_FRAME_RATE) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_PANSCAN_WINDOW) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_RECOVERY_POINT_SEI) |
- (1 << V4L2_MPEG_VIDC_EXTRADATA_CLOSED_CAPTION_UD) |
- (1 << V4L2_MPEG_VIDC_EXTRADATA_AFD_UD) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_MULTISLICE_INFO) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_NUM_CONCEALED_MB) |
(1 << V4L2_MPEG_VIDC_EXTRADATA_METADATA_FILLER) |
diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.c b/drivers/media/platform/msm/vidc/msm_vidc_common.c
index c8cd75e..7fa7f9e 100644
--- a/drivers/media/platform/msm/vidc/msm_vidc_common.c
+++ b/drivers/media/platform/msm/vidc/msm_vidc_common.c
@@ -3240,12 +3240,6 @@
case V4L2_MPEG_VIDC_EXTRADATA_RECOVERY_POINT_SEI:
ret = HAL_EXTRADATA_RECOVERY_POINT_SEI;
break;
- case V4L2_MPEG_VIDC_EXTRADATA_CLOSED_CAPTION_UD:
- ret = HAL_EXTRADATA_CLOSED_CAPTION_UD;
- break;
- case V4L2_MPEG_VIDC_EXTRADATA_AFD_UD:
- ret = HAL_EXTRADATA_AFD_UD;
- break;
case V4L2_MPEG_VIDC_EXTRADATA_MULTISLICE_INFO:
ret = HAL_EXTRADATA_MULTISLICE_INFO;
break;
@@ -3273,6 +3267,9 @@
case V4L2_MPEG_VIDC_EXTRADATA_METADATA_MBI:
ret = HAL_EXTRADATA_METADATA_MBI;
break;
+ case V4L2_MPEG_VIDC_EXTRADATA_STREAM_USERDATA:
+ ret = HAL_EXTRADATA_STREAM_USERDATA;
+ break;
default:
dprintk(VIDC_WARN, "Extradata not found: %d\n", index);
break;
@@ -3447,19 +3444,25 @@
capability->height.min);
rc = -ENOTSUPP;
}
- if (!rc) {
- rc = call_hfi_op(hdev, capability_check,
- inst->fmts[OUTPUT_PORT]->fourcc,
+ if (msm_vp8_low_tier &&
+ inst->fmts[OUTPUT_PORT]->fourcc == V4L2_PIX_FMT_VP8) {
+ capability->width.max = DEFAULT_WIDTH;
+ capability->width.max = DEFAULT_HEIGHT;
+ }
+ if (!rc && (inst->prop.width[CAPTURE_PORT] >
+ capability->width.max)) {
+ dprintk(VIDC_ERR,
+ "Unsupported width = %u supported max width = %u\n",
inst->prop.width[CAPTURE_PORT],
- &capability->width.max,
- &capability->height.max);
+ capability->width.max);
+ rc = -ENOTSUPP;
}
if (!rc && (inst->prop.height[CAPTURE_PORT]
* inst->prop.width[CAPTURE_PORT] >
capability->width.max * capability->height.max)) {
dprintk(VIDC_ERR,
- "Unsupported WxH = (%u)x(%u), Max supported is - (%u)x(%u)",
+ "Unsupported WxH = (%u)x(%u), Max supported is - (%u)x(%u)\n",
inst->prop.width[CAPTURE_PORT],
inst->prop.height[CAPTURE_PORT],
capability->width.max, capability->height.max);
diff --git a/drivers/media/platform/msm/vidc/venus_hfi.c b/drivers/media/platform/msm/vidc/venus_hfi.c
index 0092bcb..37b1e72 100644
--- a/drivers/media/platform/msm/vidc/venus_hfi.c
+++ b/drivers/media/platform/msm/vidc/venus_hfi.c
@@ -96,6 +96,12 @@
static int venus_hfi_power_enable(void *dev);
+static inline int venus_hfi_prepare_enable_clks(
+ struct venus_hfi_device *device);
+
+static inline void venus_hfi_disable_unprepare_clks(
+ struct venus_hfi_device *device);
+
static unsigned long venus_hfi_get_clock_rate(struct venus_core_clock *clock,
int num_mbs_per_sec);
@@ -488,7 +494,7 @@
}
base_addr = device->hal_data->register_base_addr;
- if (!device->clocks_enabled) {
+ if (device->clk_state != ENABLED_PREPARED) {
dprintk(VIDC_WARN,
"HFI Write register failed : Clocks are OFF\n");
return;
@@ -528,7 +534,7 @@
}
base_addr = device->hal_data->register_base_addr;
- if (!device->clocks_enabled) {
+ if (device->clk_state != ENABLED_PREPARED) {
dprintk(VIDC_WARN,
"HFI Read register failed : Clocks are OFF\n");
return -EINVAL;
@@ -1062,7 +1068,7 @@
}
WARN(!mutex_is_locked(&device->clk_pwr_lock),
"Clock/power lock must be acquired");
- if (device->clocks_enabled) {
+ if (device->clk_state == ENABLED_PREPARED) {
dprintk(VIDC_DBG, "Clocks already enabled");
return 0;
}
@@ -1077,7 +1083,7 @@
dprintk(VIDC_DBG, "Clock: %s enabled\n", cl->name);
}
}
- device->clocks_enabled = 1;
+ device->clk_state = ENABLED_PREPARED;
++device->clk_cnt;
return 0;
fail_clk_enable:
@@ -1086,6 +1092,7 @@
usleep(100);
clk_disable(cl->clk);
}
+ device->clk_state = DISABLED_PREPARED;
return rc;
}
@@ -1100,7 +1107,7 @@
}
WARN(!mutex_is_locked(&device->clk_pwr_lock),
"Clock/power lock must be acquired");
- if (!device->clocks_enabled) {
+ if (device->clk_state != ENABLED_PREPARED) {
dprintk(VIDC_DBG, "Clocks already disabled");
return;
}
@@ -1118,7 +1125,7 @@
usleep(100);
clk_disable(cl->clk);
}
- device->clocks_enabled = 0;
+ device->clk_state = DISABLED_PREPARED;
--device->clk_cnt;
}
@@ -1133,9 +1140,11 @@
dprintk(VIDC_ERR, "Invalid input: %p\n", device);
return -EINVAL;
}
+ mutex_lock(&device->clk_pwr_lock);
if (venus_hfi_clk_gating_off(device)) {
dprintk(VIDC_ERR, "Failed to turn off clk gating\n");
- return -EIO;
+ rc = -EIO;
+ goto err_clk_gating_off;
}
/* Halt AXI and AXI OCMEM VBIF Access */
reg = venus_hfi_read_register(device, VENUS_VBIF_AXI_HALT_CTRL0);
@@ -1150,6 +1159,8 @@
VENUS_VBIF_AXI_HALT_ACK_TIMEOUT_US);
if (rc)
dprintk(VIDC_WARN, "AXI bus port halt timeout\n");
+err_clk_gating_off:
+ mutex_unlock(&device->clk_pwr_lock);
return rc;
}
@@ -1177,7 +1188,7 @@
venus_hfi_clk_disable(device);
return rc;
}
- venus_hfi_clk_disable(device);
+ venus_hfi_disable_unprepare_clks(device);
venus_hfi_iommu_detach(device);
rc = regulator_disable(device->gdsc);
if (rc) {
@@ -1189,7 +1200,7 @@
else
venus_hfi_unvote_buses(device, DDR_MEM);
- device->power_enabled = 0;
+ device->power_enabled = false;
--device->pwr_cnt;
dprintk(VIDC_INFO, "entering power collapse\n");
already_disabled:
@@ -1225,7 +1236,11 @@
goto err_iommu_attach;
}
- rc = venus_hfi_clk_enable(device);
+ if (device->clk_state == DISABLED_UNPREPARED)
+ rc = venus_hfi_prepare_enable_clks(device);
+ else if (device->clk_state == DISABLED_PREPARED)
+ rc = venus_hfi_clk_enable(device);
+
if (rc) {
dprintk(VIDC_ERR, "Failed to enable clocks");
goto err_enable_clk;
@@ -1277,7 +1292,7 @@
dprintk(VIDC_ERR, "Failed to allocate OCMEM");
goto err_alloc_ocmem;
}
- device->power_enabled = 1;
+ device->power_enabled = true;
++device->pwr_cnt;
dprintk(VIDC_INFO, "resuming from power collapse\n");
return rc;
@@ -1307,11 +1322,21 @@
dprintk(VIDC_ERR, "Invalid params: %p\n", device);
return -EINVAL;
}
- mutex_lock(&device->clk_pwr_lock);
- if (!device->power_enabled)
- rc = venus_hfi_power_on(device);
- mutex_unlock(&device->clk_pwr_lock);
+ mutex_lock(&device->clk_pwr_lock);
+ if (!device->power_enabled) {
+ rc = venus_hfi_power_on(device);
+ if (rc) {
+ dprintk(VIDC_ERR, "Failed venus power on");
+ goto fail_power_on;
+ }
+ }
+ rc = venus_hfi_clk_gating_off(device);
+ if (rc)
+ dprintk(VIDC_ERR, "%s : Clock enable failed\n", __func__);
+
+fail_power_on:
+ mutex_unlock(&device->clk_pwr_lock);
return rc;
}
@@ -1325,7 +1350,7 @@
dprintk(VIDC_ERR, "Invalid params: %p\n", device);
return -EINVAL;
}
- if (device->clocks_enabled) {
+ if (device->clk_state == ENABLED_PREPARED) {
dprintk(VIDC_DBG, "Clocks are already enabled");
goto already_enabled;
}
@@ -1347,7 +1372,7 @@
VIDC_WRAPPER_INTR_MASK, VIDC_WRAPPER_INTR_MASK_A2HVCODEC_BMSK, 0);
}
already_enabled:
- device->clocks_enabled = 1;
+ device->clk_state = ENABLED_PREPARED;
fail_clk_power_on:
return rc;
}
@@ -1963,7 +1988,7 @@
dprintk(VIDC_ERR, "Invalid params: %p\n", device);
return;
}
- if (!device->clocks_enabled) {
+ if (device->clk_state != ENABLED_PREPARED) {
dprintk(VIDC_DBG, "Clocks are already disabled");
goto already_disabled;
}
@@ -1980,7 +2005,7 @@
msecs_to_jiffies(msm_vidc_pwr_collapse_delay)))
dprintk(VIDC_DBG, "PM work already scheduled\n");
already_disabled:
- device->clocks_enabled = 0;
+ device->clk_state = DISABLED_PREPARED;
}
static void venus_hfi_core_clear_interrupt(struct venus_hfi_device *device)
@@ -2781,10 +2806,10 @@
struct venus_hfi_device *device = list_first_entry(
&hal_ctxt.dev_head, struct venus_hfi_device, list);
mutex_lock(&device->clk_pwr_lock);
- if (device->clocks_enabled || !device->power_enabled) {
+ if (device->clk_state == ENABLED_PREPARED || !device->power_enabled) {
dprintk(VIDC_DBG,
"Clocks status: %d, Power status: %d, ignore power off\n",
- device->clocks_enabled, device->power_enabled);
+ device->clk_state, device->power_enabled);
goto clks_enabled;
}
mutex_unlock(&device->clk_pwr_lock);
@@ -2805,7 +2830,7 @@
}
mutex_lock(&device->clk_pwr_lock);
- if (device->clocks_enabled) {
+ if (device->clk_state == ENABLED_PREPARED) {
dprintk(VIDC_ERR,
"Clocks are still enabled after PC_PREP_DONE, ignore power off");
goto clks_enabled;
@@ -3091,7 +3116,9 @@
clk_put(device->resources.clock[i].clk);
}
}
-static inline void venus_hfi_disable_clks(struct venus_hfi_device *device)
+
+static inline void venus_hfi_disable_unprepare_clks(
+ struct venus_hfi_device *device)
{
int i;
struct venus_core_clock *cl;
@@ -3099,8 +3126,9 @@
dprintk(VIDC_ERR, "Invalid params: %p\n", device);
return;
}
- mutex_lock(&device->clk_pwr_lock);
- if (device->clocks_enabled) {
+
+ WARN_ON(!mutex_is_locked(&device->clk_pwr_lock));
+ if (device->clk_state == ENABLED_PREPARED) {
for (i = VCODEC_CLK; i < VCODEC_MAX_CLKS; i++) {
if (i == VCODEC_OCMEM_CLK && !device->res->has_ocmem)
continue;
@@ -3122,11 +3150,11 @@
cl = &device->resources.clock[i];
clk_unprepare(cl->clk);
}
- device->clocks_enabled = 0;
+ device->clk_state = DISABLED_UNPREPARED;
--device->clk_cnt;
- mutex_unlock(&device->clk_pwr_lock);
}
-static inline int venus_hfi_enable_clks(struct venus_hfi_device *device)
+
+static inline int venus_hfi_prepare_enable_clks(struct venus_hfi_device *device)
{
int i = 0;
struct venus_core_clock *cl;
@@ -3135,7 +3163,12 @@
dprintk(VIDC_ERR, "Invalid params: %p\n", device);
return -EINVAL;
}
- mutex_lock(&device->clk_pwr_lock);
+ WARN_ON(!mutex_is_locked(&device->clk_pwr_lock));
+
+ if (device->clk_state == ENABLED_PREPARED) {
+ dprintk(VIDC_DBG, "Clocks already prepared and enabled\n");
+ return 0;
+ }
for (i = VCODEC_CLK; i < VCODEC_MAX_CLKS; i++) {
if (i == VCODEC_OCMEM_CLK && !device->res->has_ocmem)
continue;
@@ -3148,9 +3181,8 @@
dprintk(VIDC_DBG, "Clock: %s enabled\n", cl->name);
}
}
- device->clocks_enabled = 1;
+ device->clk_state = ENABLED_PREPARED;
++device->clk_cnt;
- mutex_unlock(&device->clk_pwr_lock);
return rc;
fail_clk_enable:
for (; i >= 0; i--) {
@@ -3158,9 +3190,10 @@
usleep(100);
clk_disable_unprepare(cl->clk);
}
- mutex_unlock(&device->clk_pwr_lock);
+ device->clk_state = DISABLED_UNPREPARED;
return rc;
}
+
static int venus_hfi_register_iommu_domains(struct venus_hfi_device *device,
struct msm_vidc_platform_resources *res)
{
@@ -3519,17 +3552,16 @@
mutex_unlock(&device->clk_pwr_lock);
goto fail_load_fw;
}
- device->power_enabled = 1;
+ device->power_enabled = true;
++device->pwr_cnt;
- mutex_unlock(&device->clk_pwr_lock);
/*Clocks can be enabled only after pil_get since
* gdsc is turned-on in pil_get*/
- rc = venus_hfi_enable_clks(device);
+ rc = venus_hfi_prepare_enable_clks(device);
+ mutex_unlock(&device->clk_pwr_lock);
if (rc) {
dprintk(VIDC_ERR, "Failed to enable clocks: %d\n", rc);
goto fail_enable_clks;
}
-
rc = protect_cp_mem(device);
if (rc) {
dprintk(VIDC_ERR, "Failed to protect memory\n");
@@ -3538,14 +3570,16 @@
return rc;
fail_protect_mem:
- venus_hfi_disable_clks(device);
+ mutex_lock(&device->clk_pwr_lock);
+ venus_hfi_disable_unprepare_clks(device);
+ mutex_unlock(&device->clk_pwr_lock);
fail_enable_clks:
subsystem_put(device->resources.fw.cookie);
fail_load_fw:
mutex_lock(&device->clk_pwr_lock);
device->resources.fw.cookie = NULL;
regulator_disable(device->gdsc);
- device->power_enabled = 0;
+ device->power_enabled = false;
--device->pwr_cnt;
mutex_unlock(&device->clk_pwr_lock);
fail_enable_gdsc:
@@ -3574,10 +3608,10 @@
*/
if(venus_hfi_halt_axi(device))
dprintk(VIDC_WARN, "Failed to halt AXI\n");
- venus_hfi_disable_clks(device);
mutex_lock(&device->clk_pwr_lock);
+ venus_hfi_disable_unprepare_clks(device);
regulator_disable(device->gdsc);
- device->power_enabled = 0;
+ device->power_enabled = false;
--device->pwr_cnt;
mutex_unlock(&device->clk_pwr_lock);
device->resources.fw.cookie = NULL;
@@ -3678,7 +3712,10 @@
rc = device->clk_cnt;
break;
case DEV_CLOCK_ENABLED:
- rc = device->clocks_enabled;
+ if (device->clk_state == ENABLED_PREPARED)
+ rc = 1;
+ else
+ rc = 0;
break;
case DEV_PWR_COUNT:
rc = device->pwr_cnt;
@@ -3744,28 +3781,6 @@
return rc;
}
-int venus_hfi_capability_check(u32 fourcc, u32 width,
- u32 *max_width, u32 *max_height)
-{
- int rc = 0;
- if (!max_width || !max_height) {
- dprintk(VIDC_ERR, "%s - invalid parameter\n", __func__);
- return -EINVAL;
- }
-
- if (msm_vp8_low_tier && fourcc == V4L2_PIX_FMT_VP8) {
- *max_width = DEFAULT_WIDTH;
- *max_height = DEFAULT_HEIGHT;
- }
- if (width > *max_width) {
- dprintk(VIDC_ERR,
- "Unsupported width = %u supported max width = %u",
- width, *max_width);
- rc = -ENOTSUPP;
- }
- return rc;
-}
-
static void *venus_hfi_add_device(u32 device_id,
struct msm_vidc_platform_resources *res,
hfi_cmd_response_callback callback)
@@ -3793,9 +3808,9 @@
hdevice->device_id = device_id;
hdevice->callback = callback;
- hdevice->clocks_enabled = 0;
+ hdevice->clk_state = DISABLED_UNPREPARED;
hdevice->clk_cnt = 0;
- hdevice->power_enabled = 0;
+ hdevice->power_enabled = false;
hdevice->pwr_cnt = 0;
hdevice->vidc_workq = create_singlethread_workqueue(
@@ -3927,7 +3942,6 @@
hdev->get_fw_info = venus_hfi_get_fw_info;
hdev->get_info = venus_hfi_get_info;
hdev->get_stride_scanline = venus_hfi_get_stride_scanline;
- hdev->capability_check = venus_hfi_capability_check;
hdev->get_core_capabilities = venus_hfi_get_core_capabilities;
hdev->power_enable = venus_hfi_power_enable;
}
diff --git a/drivers/media/platform/msm/vidc/venus_hfi.h b/drivers/media/platform/msm/vidc/venus_hfi.h
index 1c1ee59..23a51ba 100644
--- a/drivers/media/platform/msm/vidc/venus_hfi.h
+++ b/drivers/media/platform/msm/vidc/venus_hfi.h
@@ -124,6 +124,12 @@
BUS_IDX_MAX
};
+enum clock_state {
+ DISABLED_UNPREPARED,
+ ENABLED_PREPARED,
+ DISABLED_PREPARED
+};
+
struct vidc_mem_addr {
u8 *align_device_addr;
u8 *align_virtual_addr;
@@ -190,8 +196,8 @@
u32 clk_load;
u32 bus_load[MSM_VIDC_MAX_DEVICES];
unsigned long ocmem_size;
- u32 clocks_enabled;
- u32 power_enabled;
+ enum clock_state clk_state;
+ bool power_enabled;
enum vidc_clocks clk_gating_level;
struct mutex read_lock;
struct mutex write_lock;
diff --git a/drivers/media/platform/msm/vidc/vidc_hfi.h b/drivers/media/platform/msm/vidc/vidc_hfi.h
index 75f583f..5566338 100644
--- a/drivers/media/platform/msm/vidc/vidc_hfi.h
+++ b/drivers/media/platform/msm/vidc/vidc_hfi.h
@@ -79,9 +79,8 @@
#define HFI_EXTRADATA_FRAME_RATE 0x00000007
#define HFI_EXTRADATA_PANSCAN_WINDOW 0x00000008
#define HFI_EXTRADATA_RECOVERY_POINT_SEI 0x00000009
-#define HFI_EXTRADATA_CLOSED_CAPTION_UD 0x0000000A
-#define HFI_EXTRADATA_AFD_UD 0x0000000B
#define HFI_EXTRADATA_MPEG2_SEQDISP 0x0000000D
+#define HFI_EXTRADATA_STREAM_USERDATA 0x0000000E
#define HFI_EXTRADATA_FRAME_QP 0x0000000F
#define HFI_EXTRADATA_FRAME_BITS_INFO 0x00000010
#define HFI_EXTRADATA_MULTISLICE_INFO 0x7F100000
@@ -190,10 +189,6 @@
#define HFI_PROPERTY_PARAM_VDEC_FRAME_ASSEMBLY \
(HFI_PROPERTY_PARAM_VDEC_OX_START + 0x00E)
-#define HFI_PROPERTY_PARAM_VDEC_CLOSED_CAPTION_EXTRADATA \
- (HFI_PROPERTY_PARAM_VDEC_OX_START + 0x00F)
-#define HFI_PROPERTY_PARAM_VDEC_AFD_EXTRADATA \
- (HFI_PROPERTY_PARAM_VDEC_OX_START + 0x010)
#define HFI_PROPERTY_PARAM_VDEC_VC1_FRAMEDISP_EXTRADATA \
(HFI_PROPERTY_PARAM_VDEC_OX_START + 0x011)
#define HFI_PROPERTY_PARAM_VDEC_VC1_SEQDISP_EXTRADATA \
@@ -206,6 +201,8 @@
(HFI_PROPERTY_PARAM_VDEC_OX_START + 0x015)
#define HFI_PROPERTY_PARAM_VDEC_MPEG2_SEQDISP_EXTRADATA \
(HFI_PROPERTY_PARAM_VDEC_OX_START + 0x016)
+#define HFI_PROPERTY_PARAM_VDEC_STREAM_USERDATA_EXTRADATA \
+ (HFI_PROPERTY_PARAM_VDEC_OX_START + 0x017)
#define HFI_PROPERTY_PARAM_VDEC_FRAME_QP_EXTRADATA \
(HFI_PROPERTY_PARAM_VDEC_OX_START + 0x018)
#define HFI_PROPERTY_PARAM_VDEC_FRAME_BITS_INFO_EXTRADATA \
diff --git a/drivers/media/platform/msm/vidc/vidc_hfi_api.h b/drivers/media/platform/msm/vidc/vidc_hfi_api.h
index 309164a..a1742ce 100644
--- a/drivers/media/platform/msm/vidc/vidc_hfi_api.h
+++ b/drivers/media/platform/msm/vidc/vidc_hfi_api.h
@@ -91,8 +91,6 @@
HAL_EXTRADATA_FRAME_RATE,
HAL_EXTRADATA_PANSCAN_WINDOW,
HAL_EXTRADATA_RECOVERY_POINT_SEI,
- HAL_EXTRADATA_CLOSED_CAPTION_UD,
- HAL_EXTRADATA_AFD_UD,
HAL_EXTRADATA_MULTISLICE_INFO,
HAL_EXTRADATA_INDEX,
HAL_EXTRADATA_NUM_CONCEALED_MB,
@@ -103,6 +101,7 @@
HAL_EXTRADATA_FRAME_BITS_INFO,
HAL_EXTRADATA_LTR_INFO,
HAL_EXTRADATA_METADATA_MBI,
+ HAL_EXTRADATA_STREAM_USERDATA,
};
enum hal_property {
@@ -1169,8 +1168,6 @@
int (*get_info) (void *dev, enum dev_info info);
int (*get_stride_scanline)(int color_fmt, int width,
int height, int *stride, int *scanlines);
- int (*capability_check)(u32 fourcc, u32 width,
- u32 *max_width, u32 *max_height);
int (*session_clean)(void *sess);
int (*get_core_capabilities)(void);
int (*power_enable)(void *dev);
diff --git a/drivers/media/radio/radio-iris.c b/drivers/media/radio/radio-iris.c
index 02441ec..07d3fde 100644
--- a/drivers/media/radio/radio-iris.c
+++ b/drivers/media/radio/radio-iris.c
@@ -3721,7 +3721,6 @@
}
saved_val = radio->mute_mode.hard_mute;
radio->mute_mode.hard_mute = ctrl->value;
- radio->mute_mode.soft_mute = IOC_SFT_MUTE;
retval = hci_set_fm_mute_mode(
&radio->mute_mode,
radio->fm_hdev);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 3e87392..1e53c1e 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -78,6 +78,9 @@
MMC_FIXUP("H8G2d", CID_MANFID_HYNIX, CID_OEMID_ANY, add_quirk_mmc,
MMC_QUIRK_CACHE_DISABLE),
+ MMC_FIXUP("MMC16G", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
+ MMC_QUIRK_CACHE_DISABLE),
+
END_FIXUP
};
diff --git a/drivers/net/wireless/wcnss/wcnss_wlan.c b/drivers/net/wireless/wcnss/wcnss_wlan.c
index b4a2493..e03d5be 100644
--- a/drivers/net/wireless/wcnss/wcnss_wlan.c
+++ b/drivers/net/wireless/wcnss/wcnss_wlan.c
@@ -242,6 +242,13 @@
{"LVS1", 0x060},
};
+static int wcnss_notif_cb(struct notifier_block *this, unsigned long code,
+ void *ss_handle);
+
+static struct notifier_block wnb = {
+ .notifier_call = wcnss_notif_cb,
+};
+
#define NVBIN_FILE "wlan/prima/WCNSS_qcom_wlan_nv.bin"
/*
@@ -2359,6 +2366,9 @@
if (pil_retry >= WCNSS_MAX_PIL_RETRY) {
wcnss_reset_intr();
+ if (penv->wcnss_notif_hdle)
+ subsys_notif_unregister_notifier(penv->wcnss_notif_hdle,
+ &wnb);
penv->pil = NULL;
goto fail_pil;
}
@@ -2552,11 +2562,6 @@
return NOTIFY_DONE;
}
-static struct notifier_block wnb = {
- .notifier_call = wcnss_notif_cb,
-};
-
-
static const struct file_operations wcnss_node_fops = {
.owner = THIS_MODULE,
.open = wcnss_node_open,
diff --git a/drivers/thermal/msm_thermal.c b/drivers/thermal/msm_thermal.c
index 6e6457c..b4a56ec 100644
--- a/drivers/thermal/msm_thermal.c
+++ b/drivers/thermal/msm_thermal.c
@@ -40,6 +40,7 @@
#define MAX_CURRENT_UA 1000000
#define MAX_RAILS 5
#define MAX_THRESHOLD 2
+#define MONITOR_ALL_TSENS -1
static struct msm_thermal_data msm_thermal_info;
static struct delayed_work check_temp_work;
@@ -53,10 +54,13 @@
static struct work_struct timer_work;
static struct task_struct *hotplug_task;
static struct task_struct *freq_mitigation_task;
+static struct task_struct *thermal_monitor_task;
static struct completion hotplug_notify_complete;
static struct completion freq_mitigation_complete;
+static struct completion thermal_monitor_complete;
static int enabled;
+static int polling_enabled;
static int rails_cnt;
static int psm_rails_cnt;
static int ocr_rail_cnt;
@@ -78,6 +82,8 @@
static bool ocr_enabled;
static bool ocr_nodes_called;
static bool ocr_probed;
+static bool interrupt_mode_enable;
+static bool msm_thermal_probed;
static int *tsens_id_map;
static DEFINE_MUTEX(vdd_rstr_mutex);
static DEFINE_MUTEX(psm_mutex);
@@ -115,6 +121,21 @@
bool freq_thresh_clear;
};
+struct threshold_info;
+struct therm_threshold {
+ int32_t sensor_id;
+ struct sensor_threshold threshold[MAX_THRESHOLD];
+ int32_t trip_triggered;
+ void (*notify)(struct therm_threshold *);
+ struct threshold_info *parent;
+};
+
+struct threshold_info {
+ uint32_t thresh_ct;
+ bool thresh_triggered;
+ struct therm_threshold *thresh_list;
+};
+
struct rail {
const char *name;
uint32_t freq_req;
@@ -138,10 +159,16 @@
struct attribute_group attr_gp;
};
+enum msm_thresh_list {
+ MSM_VDD_RESTRICTION,
+ MSM_LIST_MAX_NR,
+};
+
static struct psm_rail *psm_rails;
static struct psm_rail *ocr_rails;
static struct rail *rails;
static struct cpu_info cpus[NR_CPUS];
+static struct threshold_info *thresh;
struct vdd_rstr_enable {
struct kobj_attribute ko_attr;
@@ -1195,7 +1222,7 @@
do_freq_control(temp);
reschedule:
- if (enabled)
+ if (polling_enabled)
schedule_delayed_work(&check_temp_work,
msecs_to_jiffies(msm_thermal_info.poll_ms));
}
@@ -1532,6 +1559,215 @@
return ret;
}
+int therm_set_threshold(struct threshold_info *thresh_inp)
+{
+ int ret = 0, i = 0, err = 0;
+ struct therm_threshold *thresh_ptr;
+
+ if (!thresh_inp) {
+ pr_err("%s: %s: Invalid input\n",
+ KBUILD_MODNAME, __func__);
+ ret = -EINVAL;
+ goto therm_set_exit;
+ }
+
+ thresh_inp->thresh_triggered = false;
+ for (i = 0; i < thresh_inp->thresh_ct; i++) {
+ thresh_ptr = &thresh_inp->thresh_list[i];
+ thresh_ptr->trip_triggered = -1;
+ err = set_threshold(thresh_ptr->sensor_id,
+ thresh_ptr->threshold);
+ if (err) {
+ ret = err;
+ err = 0;
+ }
+ }
+
+therm_set_exit:
+ return ret;
+}
+
+static void vdd_restriction_notify(struct therm_threshold *trig_thresh)
+{
+ int ret = 0;
+ static uint32_t vdd_sens_status;
+
+ if (!vdd_rstr_enabled)
+ return;
+ if (!trig_thresh) {
+ pr_err("%s:%s Invalid input\n", KBUILD_MODNAME, __func__);
+ return;
+ }
+ if (trig_thresh->trip_triggered < 0)
+ goto set_and_exit;
+
+ mutex_lock(&vdd_rstr_mutex);
+ pr_debug("%s: sensor%d reached %d thresh for Vdd restriction\n",
+ KBUILD_MODNAME, trig_thresh->sensor_id,
+ trig_thresh->trip_triggered);
+ switch (trig_thresh->trip_triggered) {
+ case THERMAL_TRIP_CONFIGURABLE_HI:
+ if (vdd_sens_status & BIT(trig_thresh->sensor_id))
+ vdd_sens_status ^= BIT(trig_thresh->sensor_id);
+ break;
+ case THERMAL_TRIP_CONFIGURABLE_LOW:
+ vdd_sens_status |= BIT(trig_thresh->sensor_id);
+ break;
+ default:
+ pr_err("%s:%s: Unsupported trip type\n",
+ KBUILD_MODNAME, __func__);
+ goto unlock_and_exit;
+ break;
+ }
+
+ ret = vdd_restriction_apply_all((vdd_sens_status) ? 1 : 0);
+ if (ret) {
+ pr_err("%s vdd rstr votlage for all failed\n",
+ (vdd_sens_status) ?
+ "Enable" : "Disable");
+ goto unlock_and_exit;
+ }
+
+unlock_and_exit:
+ mutex_unlock(&vdd_rstr_mutex);
+set_and_exit:
+ set_threshold(trig_thresh->sensor_id, trig_thresh->threshold);
+ return;
+}
+
+static __ref int do_thermal_monitor(void *data)
+{
+ int ret = 0, i, j;
+ struct therm_threshold *sensor_list;
+
+ while (!kthread_should_stop()) {
+ wait_for_completion(&thermal_monitor_complete);
+ INIT_COMPLETION(thermal_monitor_complete);
+
+ for (i = 0; i < MSM_LIST_MAX_NR; i++) {
+ if (!thresh[i].thresh_triggered)
+ continue;
+ thresh[i].thresh_triggered = false;
+ for (j = 0; j < thresh[i].thresh_ct; j++) {
+ sensor_list = &thresh[i].thresh_list[j];
+ if (sensor_list->trip_triggered < 0)
+ continue;
+ sensor_list->notify(sensor_list);
+ sensor_list->trip_triggered = -1;
+ }
+ }
+ }
+ return ret;
+}
+
+static void thermal_monitor_init(void)
+{
+ if (thermal_monitor_task)
+ return;
+
+ init_completion(&thermal_monitor_complete);
+ thermal_monitor_task = kthread_run(do_thermal_monitor, NULL,
+ "msm_thermal:therm_monitor");
+ if (IS_ERR(thermal_monitor_task)) {
+ pr_err("%s: Failed to create thermal monitor thread\n",
+ KBUILD_MODNAME);
+ goto init_exit;
+ }
+
+ if (vdd_rstr_enabled)
+ therm_set_threshold(&thresh[MSM_VDD_RESTRICTION]);
+
+init_exit:
+ return;
+}
+
+static int msm_thermal_notify(enum thermal_trip_type type, int temp, void *data)
+{
+ struct therm_threshold *thresh_data = (struct therm_threshold *)data;
+
+ if (thermal_monitor_task) {
+ thresh_data->trip_triggered = type;
+ thresh_data->parent->thresh_triggered = true;
+ complete(&thermal_monitor_complete);
+ } else {
+ pr_err("%s: Thermal monitor task is not initialized\n",
+ KBUILD_MODNAME);
+ }
+ return 0;
+}
+
+static int init_threshold(enum msm_thresh_list index,
+ int sensor_id, int32_t hi_temp, int32_t low_temp,
+ void (*callback)(struct therm_threshold *))
+{
+ int ret = 0, i;
+ struct therm_threshold *thresh_ptr;
+
+ if (!callback || index >= MSM_LIST_MAX_NR || index < 0
+ || sensor_id == -ENODEV) {
+ pr_err("%s: Invalid input to init_threshold\n",
+ KBUILD_MODNAME);
+ ret = -EINVAL;
+ goto init_thresh_exit;
+ }
+ if (thresh[index].thresh_list) {
+ pr_err("%s: threshold already initialized\n",
+ KBUILD_MODNAME);
+ ret = -EEXIST;
+ goto init_thresh_exit;
+ }
+
+ thresh[index].thresh_ct = (sensor_id == MONITOR_ALL_TSENS) ?
+ max_tsens_num : 1;
+ thresh[index].thresh_triggered = false;
+ thresh[index].thresh_list = kzalloc(sizeof(struct therm_threshold) *
+ thresh[index].thresh_ct, GFP_KERNEL);
+ if (!thresh[index].thresh_list) {
+ pr_err("%s: kzalloc failed\n", KBUILD_MODNAME);
+ ret = -ENOMEM;
+ goto init_thresh_exit;
+ }
+
+ thresh_ptr = thresh[index].thresh_list;
+ if (sensor_id == MONITOR_ALL_TSENS) {
+ for (i = 0; i < max_tsens_num; i++) {
+ thresh_ptr[i].sensor_id = tsens_id_map[i];
+ thresh_ptr[i].notify = callback;
+ thresh_ptr[i].trip_triggered = -1;
+ thresh_ptr[i].parent = &thresh[index];
+ thresh_ptr[i].threshold[0].temp = hi_temp;
+ thresh_ptr[i].threshold[0].trip =
+ THERMAL_TRIP_CONFIGURABLE_HI;
+ thresh_ptr[i].threshold[1].temp = low_temp;
+ thresh_ptr[i].threshold[1].trip =
+ THERMAL_TRIP_CONFIGURABLE_LOW;
+ thresh_ptr[i].threshold[0].notify =
+ thresh_ptr[i].threshold[1].notify = msm_thermal_notify;
+ thresh_ptr[i].threshold[0].data =
+ thresh_ptr[i].threshold[1].data =
+ (void *)&thresh_ptr[i];
+ }
+ } else {
+ thresh_ptr->sensor_id = sensor_id;
+ thresh_ptr->notify = callback;
+ thresh_ptr->trip_triggered = -1;
+ thresh_ptr->parent = &thresh[index];
+ thresh_ptr->threshold[0].temp = hi_temp;
+ thresh_ptr->threshold[0].trip =
+ THERMAL_TRIP_CONFIGURABLE_HI;
+ thresh_ptr->threshold[1].temp = low_temp;
+ thresh_ptr->threshold[1].trip =
+ THERMAL_TRIP_CONFIGURABLE_LOW;
+ thresh_ptr->threshold[0].notify =
+ thresh_ptr->threshold[1].notify = msm_thermal_notify;
+ thresh_ptr->threshold[0].data =
+ thresh_ptr->threshold[1].data = (void *)thresh_ptr;
+ }
+
+init_thresh_exit:
+ return ret;
+}
+
/*
* We will reset the cpu frequencies limits here. The core online/offline
* status will be carried over to the process stopping the msm_thermal, as
@@ -1542,8 +1778,7 @@
uint32_t cpu = 0;
/* make sure check_temp is no longer running */
- cancel_delayed_work(&check_temp_work);
- flush_scheduled_work();
+ cancel_delayed_work_sync(&check_temp_work);
get_online_cpus();
for_each_possible_cpu(cpu) {
@@ -1557,16 +1792,30 @@
put_online_cpus();
}
+static void interrupt_mode_init(void)
+{
+ if (!msm_thermal_probed) {
+ interrupt_mode_enable = true;
+ return;
+ }
+ if (polling_enabled) {
+ pr_info("%s: Interrupt mode init\n", KBUILD_MODNAME);
+ polling_enabled = 0;
+ disable_msm_thermal();
+ hotplug_init();
+ freq_mitigation_init();
+ thermal_monitor_init();
+ }
+}
+
static int __ref set_enabled(const char *val, const struct kernel_param *kp)
{
int ret = 0;
ret = param_set_bool(val, kp);
- if (!enabled) {
- disable_msm_thermal();
- hotplug_init();
- freq_mitigation_init();
- } else
+ if (!enabled)
+ interrupt_mode_init();
+ else
pr_info("%s: no action for enabled = %d\n",
KBUILD_MODNAME, enabled);
@@ -1642,7 +1891,7 @@
goto done_cc;
}
- if (enabled) {
+ if (polling_enabled) {
pr_err("%s: Ignoring request; polling thread is enabled.\n",
KBUILD_MODNAME);
goto done_cc;
@@ -1795,7 +2044,34 @@
return ret;
}
-int __devinit msm_thermal_init(struct msm_thermal_data *pdata)
+int msm_thermal_pre_init(void)
+{
+ int ret = 0;
+
+ tsens_get_max_sensor_num(&max_tsens_num);
+ if (create_sensor_id_map()) {
+ ret = -EINVAL;
+ goto pre_init_exit;
+ }
+
+ if (!thresh) {
+ thresh = kzalloc(
+ sizeof(struct threshold_info) * MSM_LIST_MAX_NR,
+ GFP_KERNEL);
+ if (!thresh) {
+ pr_err("%s:%s: kzalloc failed\n",
+ KBUILD_MODNAME, __func__);
+ ret = -ENOMEM;
+ goto pre_init_exit;
+ }
+ memset(thresh, 0, sizeof(struct threshold_info) *
+ MSM_LIST_MAX_NR);
+ }
+pre_init_exit:
+ return ret;
+}
+
+int msm_thermal_init(struct msm_thermal_data *pdata)
{
int ret = 0;
uint32_t cpu;
@@ -1813,15 +2089,13 @@
cpus[cpu].freq_thresh_clear = false;
}
BUG_ON(!pdata);
- tsens_get_max_sensor_num(&max_tsens_num);
memcpy(&msm_thermal_info, pdata, sizeof(struct msm_thermal_data));
- if (create_sensor_id_map())
- return -EINVAL;
if (check_sensor_id(msm_thermal_info.sensor_id))
return -EINVAL;
enabled = 1;
+ polling_enabled = 1;
ret = cpufreq_register_notifier(&msm_thermal_cpufreq_notifier,
CPUFREQ_POLICY_NOTIFIER);
if (ret)
@@ -2271,6 +2545,11 @@
__func__);
goto read_node_fail;
}
+ ret = init_threshold(MSM_VDD_RESTRICTION, MONITOR_ALL_TSENS,
+ data->vdd_rstr_temp_hyst_degC, data->vdd_rstr_temp_degC,
+ vdd_restriction_notify);
+ if (ret)
+ goto read_node_fail;
vdd_rstr_enabled = true;
}
read_node_fail:
@@ -2547,6 +2826,9 @@
struct msm_thermal_data data;
memset(&data, 0, sizeof(struct msm_thermal_data));
+ ret = msm_thermal_pre_init();
+ if (ret)
+ goto fail;
key = "qcom,sensor-id";
ret = of_property_read_u32(node, key, &data.sensor_id);
@@ -2615,6 +2897,12 @@
}
msm_thermal_ioctl_init();
ret = msm_thermal_init(&data);
+ msm_thermal_probed = true;
+
+ if (interrupt_mode_enable) {
+ interrupt_mode_init();
+ interrupt_mode_enable = false;
+ }
return ret;
fail:
@@ -2628,6 +2916,12 @@
static int msm_thermal_dev_exit(struct platform_device *inp_dev)
{
msm_thermal_ioctl_cleanup();
+ if (thresh) {
+ if (vdd_rstr_enabled)
+ kfree(thresh[MSM_VDD_RESTRICTION].thresh_list);
+ kfree(thresh);
+ thresh = NULL;
+ }
return 0;
}
@@ -2663,6 +2957,7 @@
INIT_WORK(&timer_work, timer_work_fn);
msm_thermal_add_timer_nodes();
+ interrupt_mode_init();
return 0;
}
late_initcall(msm_thermal_late_init);
diff --git a/drivers/video/msm/mdss/Makefile b/drivers/video/msm/mdss/Makefile
index cba7c22b..ddea735 100644
--- a/drivers/video/msm/mdss/Makefile
+++ b/drivers/video/msm/mdss/Makefile
@@ -1,8 +1,8 @@
-mdss-mdp3-objs = mdp3.o mdp3_dma.o mdp3_ctrl.o
+mdss-mdp3-objs = mdp3.o mdp3_dma.o mdp3_ctrl.o dsi_status_v2.o
mdss-mdp3-objs += mdp3_ppp.o mdp3_ppp_hwio.o mdp3_ppp_data.o
obj-$(CONFIG_FB_MSM_MDSS_MDP3) += mdss-mdp3.o
-mdss-mdp-objs := mdss_mdp.o mdss_mdp_ctl.o mdss_mdp_pipe.o mdss_mdp_util.o
+mdss-mdp-objs := mdss_mdp.o mdss_mdp_ctl.o mdss_mdp_pipe.o mdss_mdp_util.o dsi_status_6g.o
mdss-mdp-objs += mdss_mdp_pp.o
mdss-mdp-objs += mdss_mdp_intf_video.o
mdss-mdp-objs += mdss_mdp_intf_cmd.o
@@ -42,8 +42,4 @@
obj-$(CONFIG_FB_MSM_MDSS) += mdss_fb.o
-ifeq ($(CONFIG_FB_MSM_MDSS_MDP3),y)
-obj-$(CONFIG_FB_MSM_MDSS_DSI_CTRL_STATUS) += dsi_status_v2.o
-else
obj-$(CONFIG_FB_MSM_MDSS_DSI_CTRL_STATUS) += mdss_dsi_status.o
-endif
diff --git a/drivers/video/msm/mdss/dsi_status_6g.c b/drivers/video/msm/mdss/dsi_status_6g.c
new file mode 100644
index 0000000..31c9022
--- /dev/null
+++ b/drivers/video/msm/mdss/dsi_status_6g.c
@@ -0,0 +1,109 @@
+/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/workqueue.h>
+#include <linux/delay.h>
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
+
+#include "mdss_dsi.h"
+#include "mdss_mdp.h"
+
+/*
+ * mdss_check_dsi_ctrl_status() - Check MDP5 DSI controller status periodically.
+ * @work : dsi controller status data
+ * @interval : duration in milliseconds to schedule work queue
+ *
+ * This function calls check_status API on DSI controller to send the BTA
+ * command. If DSI controller fails to acknowledge the BTA command, it sends
+ * the PANEL_ALIVE=0 status to HAL layer.
+ */
+void mdss_check_dsi_ctrl_status(struct work_struct *work, uint32_t interval)
+{
+ struct dsi_status_data *pstatus_data = NULL;
+ struct mdss_panel_data *pdata = NULL;
+ struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL;
+ struct mdss_overlay_private *mdp5_data = NULL;
+ struct mdss_mdp_ctl *ctl = NULL;
+ int ret = 0;
+
+ pstatus_data = container_of(to_delayed_work(work),
+ struct dsi_status_data, check_status);
+
+ pdata = dev_get_platdata(&pstatus_data->mfd->pdev->dev);
+ if (!pdata) {
+ pr_err("%s: Panel data not available\n", __func__);
+ return;
+ }
+
+ ctrl_pdata = container_of(pdata, struct mdss_dsi_ctrl_pdata,
+ panel_data);
+ if (!ctrl_pdata || !ctrl_pdata->check_status) {
+ pr_err("%s: DSI ctrl or status_check callback not available\n",
+ __func__);
+ return;
+ }
+
+ mdp5_data = mfd_to_mdp5_data(pstatus_data->mfd);
+ ctl = mfd_to_ctl(pstatus_data->mfd);
+
+ if (ctl->shared_lock)
+ mutex_lock(ctl->shared_lock);
+ mutex_lock(&mdp5_data->ov_lock);
+
+ if (pstatus_data->mfd->shutdown_pending) {
+ mutex_unlock(&mdp5_data->ov_lock);
+ if (ctl->shared_lock)
+ mutex_unlock(ctl->shared_lock);
+ pr_err("%s: DSI turning off, avoiding BTA status check\n",
+ __func__);
+ return;
+ }
+
+ /*
+ * For the command mode panels, we return pan display
+ * IOCTL on vsync interrupt. So, after vsync interrupt comes
+ * and when DMA_P is in progress, if the panel stops responding
+ * and if we trigger BTA before DMA_P finishes, then the DSI
+ * FIFO will not be cleared since the DSI data bus control
+ * doesn't come back to the host after BTA. This may cause the
+ * display reset not to be proper. Hence, wait for DMA_P done
+ * for command mode panels before triggering BTA.
+ */
+ if (ctl->wait_pingpong)
+ ctl->wait_pingpong(ctl, NULL);
+
+ pr_debug("%s: DSI ctrl wait for ping pong done\n", __func__);
+
+ mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON, false);
+ ret = ctrl_pdata->check_status(ctrl_pdata);
+ mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF, false);
+
+ mutex_unlock(&mdp5_data->ov_lock);
+ if (ctl->shared_lock)
+ mutex_unlock(ctl->shared_lock);
+
+ if ((pstatus_data->mfd->panel_power_on)) {
+ if (ret > 0) {
+ schedule_delayed_work(&pstatus_data->check_status,
+ msecs_to_jiffies(interval));
+ } else {
+ char *envp[2] = {"PANEL_ALIVE=0", NULL};
+ pdata->panel_info.panel_dead = true;
+ ret = kobject_uevent_env(
+ &pstatus_data->mfd->fbi->dev->kobj,
+ KOBJ_CHANGE, envp);
+ pr_err("%s: Panel has gone bad, sending uevent - %s\n",
+ __func__, envp[0]);
+ }
+ }
+}
diff --git a/drivers/video/msm/mdss/dsi_status_v2.c b/drivers/video/msm/mdss/dsi_status_v2.c
index 565401d..c8915e6 100644
--- a/drivers/video/msm/mdss/dsi_status_v2.c
+++ b/drivers/video/msm/mdss/dsi_status_v2.c
@@ -10,49 +10,26 @@
* GNU General Public License for more details.
*/
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/fb.h>
-#include <linux/notifier.h>
#include <linux/workqueue.h>
#include <linux/delay.h>
-#include <linux/debugfs.h>
-#include <linux/slab.h>
-#include <linux/uaccess.h>
-#include <linux/iopoll.h>
#include <linux/kobject.h>
#include <linux/string.h>
#include <linux/sysfs.h>
-#include "mdss_fb.h"
#include "mdss_dsi.h"
-#include "mdss_panel.h"
#include "mdp3_ctrl.h"
-#define STATUS_CHECK_INTERVAL 5000
-
-/**
- * dsi_status_data - Stores all the data necessary for this module
- * @fb_notif: Used to egister for the fb events
- * @live_status: Delayed worker structure, used to associate the
- * delayed worker function
- * @mfd: Used to store the msm_fb_data_type received when the notifier
- * call back happens
- * @root: Stores the dir created by debuugfs
- * @debugfs_reset_panel: The debugfs variable used to inject errors
+/*
+ * mdp3_check_dsi_ctrl_status() - Check MDP3 DSI controller status periodically.
+ * @work : dsi controller status data
+ * @interval : duration in milliseconds to schedule work queue
+ *
+ * This function calls check_status API on DSI controller to send the BTA
+ * command. If DSI controller fails to acknowledge the BTA command, it sends
+ * the PANEL_ALIVE=0 status to HAL layer.
*/
-
-struct dsi_status_data {
- struct notifier_block fb_notifier;
- struct delayed_work check_status;
- struct msm_fb_data_type *mfd;
- uint32_t check_interval;
-};
-struct dsi_status_data *pstatus_data;
-static uint32_t interval = STATUS_CHECK_INTERVAL;
-
-void check_dsi_ctrl_status(struct work_struct *work)
+void mdp3_check_dsi_ctrl_status(struct work_struct *work,
+ uint32_t interval)
{
struct dsi_status_data *pdsi_status = NULL;
struct mdss_panel_data *pdata = NULL;
@@ -61,27 +38,25 @@
int ret = 0;
pdsi_status = container_of(to_delayed_work(work),
- struct dsi_status_data, check_status);
- if (!pdsi_status) {
- pr_err("%s: DSI status data not available\n", __func__);
- return;
- }
+ struct dsi_status_data, check_status);
pdata = dev_get_platdata(&pdsi_status->mfd->pdev->dev);
if (!pdata) {
pr_err("%s: Panel data not available\n", __func__);
return;
}
+
ctrl_pdata = container_of(pdata, struct mdss_dsi_ctrl_pdata,
panel_data);
+
if (!ctrl_pdata || !ctrl_pdata->check_status) {
- pr_err("%s: DSI ctrl or status_check callback not avilable\n",
+ pr_err("%s: DSI ctrl or status_check callback not available\n",
__func__);
return;
}
+
mdp3_session = pdsi_status->mfd->mdp.private1;
mutex_lock(&mdp3_session->lock);
-
if (!mdp3_session->status) {
pr_info("display off already\n");
mutex_unlock(&mdp3_session->lock);
@@ -94,107 +69,22 @@
if (!ret)
ret = ctrl_pdata->check_status(ctrl_pdata);
else
- pr_err("wait_for_dma_done error\n");
-
+ pr_err("%s: wait_for_dma_done error\n", __func__);
mutex_unlock(&mdp3_session->lock);
if ((pdsi_status->mfd->panel_power_on)) {
if (ret > 0) {
schedule_delayed_work(&pdsi_status->check_status,
- msecs_to_jiffies(pdsi_status->check_interval));
+ msecs_to_jiffies(interval));
} else {
char *envp[2] = {"PANEL_ALIVE=0", NULL};
pdata->panel_info.panel_dead = true;
ret = kobject_uevent_env(
- &pdsi_status->mfd->fbi->dev->kobj,
- KOBJ_CHANGE, envp);
+ &pdsi_status->mfd->fbi->dev->kobj,
+ KOBJ_CHANGE, envp);
pr_err("%s: Panel has gone bad, sending uevent - %s\n",
__func__, envp[0]);
}
}
}
-/**
- * fb_notifier_callback() - Call back function for the fb_register_client()
- * notifying events
- * @self : notifier block
- * @event : The event that was triggered
- * @data : Of type struct fb_event
- *
- * - This function listens for FB_BLANK_UNBLANK and FB_BLANK_POWERDOWN events
- * - Based on the event the delayed work is either scheduled again after
- * PANEL_STATUS_CHECK_INTERVAL or cancelled
- */
-static int fb_event_callback(struct notifier_block *self,
- unsigned long event, void *data)
-{
- struct fb_event *evdata = (struct fb_event *)data;
- struct dsi_status_data *pdata = container_of(self,
- struct dsi_status_data, fb_notifier);
- pdata->mfd = (struct msm_fb_data_type *)evdata->info->par;
-
- if (event == FB_EVENT_BLANK && evdata) {
- int *blank = evdata->data;
- switch (*blank) {
- case FB_BLANK_UNBLANK:
- schedule_delayed_work(&pdata->check_status,
- msecs_to_jiffies(STATUS_CHECK_INTERVAL));
- break;
- case FB_BLANK_POWERDOWN:
- cancel_delayed_work(&pdata->check_status);
- break;
- }
- }
- return 0;
-}
-
-int __init mdss_dsi_status_init(void)
-{
- int rc;
-
- pstatus_data = kzalloc(sizeof(struct dsi_status_data), GFP_KERNEL);
- if (!pstatus_data) {
- pr_err("%s: can't alloc mem\n", __func__);
- rc = -ENOMEM;
- return rc;
- }
-
- memset(pstatus_data, 0, sizeof(struct dsi_status_data));
-
- pstatus_data->fb_notifier.notifier_call = fb_event_callback;
-
- rc = fb_register_client(&pstatus_data->fb_notifier);
- if (rc < 0) {
- pr_err("%s: fb_register_client failed, returned with rc=%d\n",
- __func__, rc);
- kfree(pstatus_data);
- return -EPERM;
- }
-
- pstatus_data->check_interval = interval;
- pr_info("%s: DSI status check interval:%d\n", __func__, interval);
-
- INIT_DELAYED_WORK(&pstatus_data->check_status, check_dsi_ctrl_status);
-
- pr_debug("%s: DSI ctrl status thread initialized\n", __func__);
-
- return rc;
-}
-
-void __exit mdss_dsi_status_exit(void)
-{
- fb_unregister_client(&pstatus_data->fb_notifier);
- cancel_delayed_work_sync(&pstatus_data->check_status);
- kfree(pstatus_data);
- pr_debug("%s: DSI ctrl status thread removed\n", __func__);
-}
-
-module_param(interval, uint, 0);
-MODULE_PARM_DESC(interval,
- "Duration in milliseconds to send BTA command for checking"
- "DSI status periodically");
-
-module_init(mdss_dsi_status_init);
-module_exit(mdss_dsi_status_exit);
-
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/video/msm/mdss/mdp3.c b/drivers/video/msm/mdss/mdp3.c
index ad7cb81..8e2ae4d 100644
--- a/drivers/video/msm/mdss/mdp3.c
+++ b/drivers/video/msm/mdss/mdp3.c
@@ -2266,6 +2266,7 @@
.panel_register_done = mdp3_panel_register_done,
.fb_stride = mdp3_fb_stride,
.fb_mem_alloc_fnc = mdp3_alloc,
+ .check_dsi_status = mdp3_check_dsi_ctrl_status,
};
struct mdp3_intr_cb underrun_cb = {
diff --git a/drivers/video/msm/mdss/mdp3.h b/drivers/video/msm/mdss/mdp3.h
index 15aab59..137a1b8 100644
--- a/drivers/video/msm/mdss/mdp3.h
+++ b/drivers/video/msm/mdss/mdp3.h
@@ -209,6 +209,8 @@
int mdp3_misr_set(struct mdp_misr *misr_req);
int mdp3_misr_get(struct mdp_misr *misr_resp);
void mdp3_enable_regulator(int enable);
+void mdp3_check_dsi_ctrl_status(struct work_struct *work,
+ uint32_t interval);
#define MDP3_REG_WRITE(addr, val) writel_relaxed(val, mdp3_res->mdp_base + addr)
#define MDP3_REG_READ(addr) readl_relaxed(mdp3_res->mdp_base + addr)
diff --git a/drivers/video/msm/mdss/mdss_dsi.h b/drivers/video/msm/mdss/mdss_dsi.h
index f6f6cd4..962599d 100644
--- a/drivers/video/msm/mdss/mdss_dsi.h
+++ b/drivers/video/msm/mdss/mdss_dsi.h
@@ -302,6 +302,12 @@
struct dsi_buf rx_buf;
};
+struct dsi_status_data {
+ struct notifier_block fb_notifier;
+ struct delayed_work check_status;
+ struct msm_fb_data_type *mfd;
+};
+
int dsi_panel_device_register(struct device_node *pan_node,
struct mdss_dsi_ctrl_pdata *ctrl_pdata);
diff --git a/drivers/video/msm/mdss/mdss_dsi_host.c b/drivers/video/msm/mdss/mdss_dsi_host.c
index 3cd014c..95e7c6e 100644
--- a/drivers/video/msm/mdss/mdss_dsi_host.c
+++ b/drivers/video/msm/mdss/mdss_dsi_host.c
@@ -878,7 +878,7 @@
ctrl_restore = __mdss_dsi_cmd_mode_config(ctrl, 1);
- if (rlen == 0) {
+ if (rlen <= 2) {
short_response = 1;
rx_byte = 4;
} else {
@@ -1381,11 +1381,11 @@
}
if (todo & DSI_EV_MDP_BUSY_RELEASE) {
- spin_lock(&ctrl->mdp_lock);
+ spin_lock_irqsave(&ctrl->mdp_lock, flag);
ctrl->mdp_busy = false;
mdss_dsi_disable_irq_nosync(ctrl, DSI_MDP_TERM);
complete(&ctrl->mdp_comp);
- spin_unlock(&ctrl->mdp_lock);
+ spin_unlock_irqrestore(&ctrl->mdp_lock, flag);
/* enable dsi error interrupt */
mdss_dsi_err_intr_ctrl(ctrl, DSI_INTR_ERROR_MASK, 1);
diff --git a/drivers/video/msm/mdss/mdss_dsi_status.c b/drivers/video/msm/mdss/mdss_dsi_status.c
index 1dca08e..116b778 100644
--- a/drivers/video/msm/mdss/mdss_dsi_status.c
+++ b/drivers/video/msm/mdss/mdss_dsi_status.c
@@ -30,36 +30,26 @@
#include "mdss_panel.h"
#include "mdss_mdp.h"
-#define STATUS_CHECK_INTERVAL 5000
+#define STATUS_CHECK_INTERVAL_MS 5000
+#define STATUS_CHECK_INTERVAL_MIN_MS 200
+#define DSI_STATUS_CHECK_DISABLE 1
-struct dsi_status_data {
- struct notifier_block fb_notifier;
- struct delayed_work check_status;
- struct msm_fb_data_type *mfd;
- uint32_t check_interval;
-};
+static uint32_t interval = STATUS_CHECK_INTERVAL_MS;
+static uint32_t dsi_status_disable = DSI_STATUS_CHECK_DISABLE;
struct dsi_status_data *pstatus_data;
-static uint32_t interval = STATUS_CHECK_INTERVAL;
/*
- * check_dsi_ctrl_status() - Check DSI controller status periodically.
+ * check_dsi_ctrl_status() - Reads MFD structure and
+ * calls platform specific DSI ctrl Status function.
* @work : dsi controller status data
- *
- * This function calls check_status API on DSI controller to send the BTA
- * command. If DSI controller fails to acknowledge the BTA command, it sends
- * the PANEL_ALIVE=0 status to HAL layer.
*/
static void check_dsi_ctrl_status(struct work_struct *work)
{
struct dsi_status_data *pdsi_status = NULL;
- struct mdss_panel_data *pdata = NULL;
- struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL;
- struct mdss_overlay_private *mdp5_data = NULL;
- struct mdss_mdp_ctl *ctl = NULL;
- int ret = 0;
pdsi_status = container_of(to_delayed_work(work),
struct dsi_status_data, check_status);
+
if (!pdsi_status) {
pr_err("%s: DSI status data not available\n", __func__);
return;
@@ -70,73 +60,7 @@
return;
}
- pdata = dev_get_platdata(&pdsi_status->mfd->pdev->dev);
- if (!pdata) {
- pr_err("%s: Panel data not available\n", __func__);
- return;
- }
-
- ctrl_pdata = container_of(pdata, struct mdss_dsi_ctrl_pdata,
- panel_data);
- if (!ctrl_pdata || !ctrl_pdata->check_status) {
- pr_err("%s: DSI ctrl or status_check callback not available\n",
- __func__);
- return;
- }
-
- mdp5_data = mfd_to_mdp5_data(pdsi_status->mfd);
- ctl = mfd_to_ctl(pdsi_status->mfd);
-
- if (ctl->shared_lock)
- mutex_lock(ctl->shared_lock);
- mutex_lock(&mdp5_data->ov_lock);
-
- if (pdsi_status->mfd->shutdown_pending) {
- mutex_unlock(&mdp5_data->ov_lock);
- if (ctl->shared_lock)
- mutex_unlock(ctl->shared_lock);
- pr_err("%s: DSI turning off, avoiding BTA status check\n",
- __func__);
- return;
- }
-
- /*
- * For the command mode panels, we return pan display
- * IOCTL on vsync interrupt. So, after vsync interrupt comes
- * and when DMA_P is in progress, if the panel stops responding
- * and if we trigger BTA before DMA_P finishes, then the DSI
- * FIFO will not be cleared since the DSI data bus control
- * doesn't come back to the host after BTA. This may cause the
- * display reset not to be proper. Hence, wait for DMA_P done
- * for command mode panels before triggering BTA.
- */
- if (ctl->wait_pingpong)
- ctl->wait_pingpong(ctl, NULL);
-
- pr_debug("%s: DSI ctrl wait for ping pong done\n", __func__);
-
- mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON, false);
- ret = ctrl_pdata->check_status(ctrl_pdata);
- mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF, false);
-
- mutex_unlock(&mdp5_data->ov_lock);
- if (ctl->shared_lock)
- mutex_unlock(ctl->shared_lock);
-
- if ((pdsi_status->mfd->panel_power_on)) {
- if (ret > 0) {
- schedule_delayed_work(&pdsi_status->check_status,
- msecs_to_jiffies(pdsi_status->check_interval));
- } else {
- char *envp[2] = {"PANEL_ALIVE=0", NULL};
- pdata->panel_info.panel_dead = true;
- ret = kobject_uevent_env(
- &pdsi_status->mfd->fbi->dev->kobj,
- KOBJ_CHANGE, envp);
- pr_err("%s: Panel has gone bad, sending uevent - %s\n",
- __func__, envp[0]);
- }
- }
+ pdsi_status->mfd->mdp.check_dsi_status(work, interval);
}
/*
@@ -156,6 +80,19 @@
struct fb_event *evdata = data;
struct dsi_status_data *pdata = container_of(self,
struct dsi_status_data, fb_notifier);
+ struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL;
+
+ pdata->mfd = evdata->info->par;
+ ctrl_pdata = container_of(dev_get_platdata(&pdata->mfd->pdev->dev),
+ struct mdss_dsi_ctrl_pdata, panel_data);
+ if (!ctrl_pdata) {
+ pr_err("%s: DSI ctrl not available\n", __func__);
+ return NOTIFY_BAD;
+ }
+ if (dsi_status_disable) {
+ pr_debug("%s: DSI status disabled\n", __func__);
+ return NOTIFY_DONE;
+ }
if (event == FB_EVENT_BLANK && evdata) {
int *blank = evdata->data;
@@ -166,7 +103,7 @@
switch (*blank) {
case FB_BLANK_UNBLANK:
schedule_delayed_work(&pdata->check_status,
- msecs_to_jiffies(pdata->check_interval));
+ msecs_to_jiffies(interval));
break;
case FB_BLANK_POWERDOWN:
cancel_delayed_work(&pdata->check_status);
@@ -176,6 +113,41 @@
return 0;
}
+static int param_dsi_status_disable(const char *val, struct kernel_param *kp)
+{
+ int ret = 0;
+ int int_val;
+
+ ret = kstrtos32(val, 0, &int_val);
+ if (ret)
+ return ret;
+
+ pr_info("%s: Set DSI status disable to %d\n",
+ __func__, int_val);
+ *((int *)kp->arg) = int_val;
+ return ret;
+}
+
+static int param_set_interval(const char *val, struct kernel_param *kp)
+{
+ int ret = 0;
+ int int_val;
+
+ ret = kstrtos32(val, 0, &int_val);
+ if (ret)
+ return ret;
+ if (int_val < STATUS_CHECK_INTERVAL_MIN_MS) {
+ pr_err("%s: Invalid value %d used, ignoring\n",
+ __func__, int_val);
+ ret = -EINVAL;
+ } else {
+ pr_info("%s: Set check interval to %d msecs\n",
+ __func__, int_val);
+ *((int *)kp->arg) = int_val;
+ }
+ return ret;
+}
+
int __init mdss_dsi_status_init(void)
{
int rc = 0;
@@ -196,7 +168,6 @@
return -EPERM;
}
- pstatus_data->check_interval = interval;
pr_info("%s: DSI status check interval:%d\n", __func__, interval);
INIT_DELAYED_WORK(&pstatus_data->check_status, check_dsi_ctrl_status);
@@ -214,11 +185,17 @@
pr_debug("%s: DSI ctrl status work queue removed\n", __func__);
}
-module_param(interval, uint, 0);
+module_param_call(interval, param_set_interval, param_get_uint,
+ &interval, 0644);
MODULE_PARM_DESC(interval,
"Duration in milliseconds to send BTA command for checking"
"DSI status periodically");
+module_param_call(dsi_status_disable, param_dsi_status_disable, param_get_uint,
+ &dsi_status_disable, 0644);
+MODULE_PARM_DESC(dsi_status_disable,
+ "Disable DSI status check");
+
module_init(mdss_dsi_status_init);
module_exit(mdss_dsi_status_exit);
diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c
index b769dcb..1927fe2 100644
--- a/drivers/video/msm/mdss/mdss_fb.c
+++ b/drivers/video/msm/mdss/mdss_fb.c
@@ -1288,6 +1288,7 @@
atomic_set(&mfd->mdp_sync_pt_data.commit_cnt, 0);
atomic_set(&mfd->commits_pending, 0);
atomic_set(&mfd->ioctl_ref_cnt, 0);
+ atomic_set(&mfd->kickoff_pending, 0);
init_timer(&mfd->no_update.timer);
mfd->no_update.timer.function = mdss_fb_no_update_notify_timer_cb;
@@ -1301,6 +1302,7 @@
init_waitqueue_head(&mfd->commit_wait_q);
init_waitqueue_head(&mfd->idle_wait_q);
init_waitqueue_head(&mfd->ioctl_q);
+ init_waitqueue_head(&mfd->kickoff_wait_q);
ret = fb_alloc_cmap(&fbi->cmap, 256, 0);
if (ret)
@@ -1703,6 +1705,25 @@
return 0;
}
+static int mdss_fb_wait_for_kickoff(struct msm_fb_data_type *mfd)
+{
+ int ret = 0;
+
+ ret = wait_event_timeout(mfd->kickoff_wait_q,
+ (!atomic_read(&mfd->kickoff_pending) ||
+ mfd->shutdown_pending),
+ msecs_to_jiffies(WAIT_DISP_OP_TIMEOUT / 2));
+ if (!ret) {
+ pr_err("wait for kickoff timeout %d pending=%d\n",
+ ret, atomic_read(&mfd->kickoff_pending));
+
+ } else if (mfd->shutdown_pending) {
+ pr_debug("Shutdown signalled\n");
+ return -EPERM;
+ }
+
+ return 0;
+}
static int mdss_fb_pan_display_ex(struct fb_info *info,
struct mdp_display_commit *disp_commit)
@@ -1741,6 +1762,7 @@
atomic_inc(&mfd->mdp_sync_pt_data.commit_cnt);
atomic_inc(&mfd->commits_pending);
+ atomic_inc(&mfd->kickoff_pending);
wake_up_all(&mfd->commit_wait_q);
mutex_unlock(&mfd->mdp_sync_pt_data.sync_mutex);
if (wait_for_finish)
@@ -1833,6 +1855,8 @@
if (ret)
pr_err("pan display failed %x on fb%d\n", ret,
mfd->index);
+ atomic_set(&mfd->kickoff_pending, 0);
+ wake_up_all(&mfd->kickoff_wait_q);
}
if (!ret)
mdss_fb_update_backlight(mfd);
@@ -1869,6 +1893,7 @@
}
atomic_set(&mfd->commits_pending, 0);
+ atomic_set(&mfd->kickoff_pending, 0);
wake_up_all(&mfd->idle_wait_q);
return ret;
@@ -2328,6 +2353,27 @@
return ret;
}
+static int __ioctl_wait_idle(struct msm_fb_data_type *mfd, u32 cmd)
+{
+ int ret = 0;
+
+ if (mfd->wait_for_kickoff &&
+ ((cmd == MSMFB_OVERLAY_PREPARE) ||
+ (cmd == MSMFB_BUFFER_SYNC) ||
+ (cmd == MSMFB_OVERLAY_SET))) {
+ ret = mdss_fb_wait_for_kickoff(mfd);
+ } else if ((cmd != MSMFB_VSYNC_CTRL) &&
+ (cmd != MSMFB_OVERLAY_VSYNC_CTRL) &&
+ (cmd != MSMFB_ASYNC_BLIT) &&
+ (cmd != MSMFB_BLIT) &&
+ (cmd != MSMFB_NOTIFY_UPDATE)) {
+ ret = mdss_fb_pan_idle(mfd);
+ }
+
+ if (ret)
+ pr_debug("Shutdown pending. Aborting operation %x\n", cmd);
+ return ret;
+}
static int mdss_fb_ioctl(struct fb_info *info, unsigned int cmd,
unsigned long arg)
@@ -2353,17 +2399,9 @@
mdss_fb_power_setting_idle(mfd);
- if ((cmd != MSMFB_VSYNC_CTRL) && (cmd != MSMFB_OVERLAY_VSYNC_CTRL) &&
- (cmd != MSMFB_ASYNC_BLIT) && (cmd != MSMFB_BLIT) &&
- (cmd != MSMFB_NOTIFY_UPDATE) &&
- (cmd != MSMFB_OVERLAY_PREPARE)) {
- ret = mdss_fb_pan_idle(mfd);
- if (ret) {
- pr_debug("Shutdown pending. Aborting operation %x\n",
- cmd);
- goto exit;
- }
- }
+ ret = __ioctl_wait_idle(mfd, cmd);
+ if (ret)
+ goto exit;
switch (cmd) {
case MSMFB_CURSOR:
diff --git a/drivers/video/msm/mdss/mdss_fb.h b/drivers/video/msm/mdss/mdss_fb.h
index 7c47a3e..894dbbc 100644
--- a/drivers/video/msm/mdss/mdss_fb.h
+++ b/drivers/video/msm/mdss/mdss_fb.h
@@ -135,6 +135,7 @@
int (*splash_fnc) (struct msm_fb_data_type *mfd, int *index, int req);
struct msm_sync_pt_data *(*get_sync_fnc)(struct msm_fb_data_type *mfd,
const struct mdp_buf_sync *buf_sync);
+ void (*check_dsi_status)(struct work_struct *work, uint32_t interval);
void *private1;
};
@@ -214,8 +215,10 @@
/* for non-blocking */
struct task_struct *disp_thread;
atomic_t commits_pending;
+ atomic_t kickoff_pending;
wait_queue_head_t commit_wait_q;
wait_queue_head_t idle_wait_q;
+ wait_queue_head_t kickoff_wait_q;
bool shutdown_pending;
struct task_struct *splash_thread;
@@ -230,6 +233,7 @@
u32 dcm_state;
struct list_head proc_list;
+ u32 wait_for_kickoff;
};
static inline void mdss_fb_update_notify_update(struct msm_fb_data_type *mfd)
diff --git a/drivers/video/msm/mdss/mdss_mdp.c b/drivers/video/msm/mdss/mdss_mdp.c
index 667e4b7..97d4dc9 100644
--- a/drivers/video/msm/mdss/mdss_mdp.c
+++ b/drivers/video/msm/mdss/mdss_mdp.c
@@ -68,6 +68,7 @@
.fb_mem_get_iommu_domain = mdss_fb_mem_get_iommu_domain,
.panel_register_done = mdss_panel_register_done,
.fb_stride = mdss_mdp_fb_stride,
+ .check_dsi_status = mdss_check_dsi_ctrl_status,
};
#define DEFAULT_TOTAL_RGB_PIPES 3
diff --git a/drivers/video/msm/mdss/mdss_mdp.h b/drivers/video/msm/mdss/mdss_mdp.h
index e528219..ebdc2b8 100644
--- a/drivers/video/msm/mdss/mdss_mdp.h
+++ b/drivers/video/msm/mdss/mdss_mdp.h
@@ -19,6 +19,7 @@
#include <linux/msm_mdp.h>
#include <linux/platform_device.h>
#include <linux/notifier.h>
+#include <linux/kref.h>
#include "mdss.h"
#include "mdss_mdp_hwio.h"
@@ -375,7 +376,8 @@
struct mdss_mdp_shared_reg_ctrl clk_ctrl;
struct mdss_mdp_shared_reg_ctrl clk_status;
- atomic_t ref_cnt;
+ struct kref kref;
+
u32 play_cnt;
int pid;
bool is_handed_off;
@@ -692,6 +694,7 @@
int mdss_mdp_get_ctl_mixers(u32 fb_num, u32 *mixer_id);
u32 mdss_mdp_fb_stride(u32 fb_index, u32 xres, int bpp);
+void mdss_check_dsi_ctrl_status(struct work_struct *work, uint32_t interval);
int mdss_panel_register_done(struct mdss_panel_data *pdata);
int mdss_mdp_limited_lut_igc_config(struct mdss_mdp_ctl *ctl);
diff --git a/drivers/video/msm/mdss/mdss_mdp_ctl.c b/drivers/video/msm/mdss/mdss_mdp_ctl.c
index 9cf745e..65d28a0 100644
--- a/drivers/video/msm/mdss/mdss_mdp_ctl.c
+++ b/drivers/video/msm/mdss/mdss_mdp_ctl.c
@@ -2575,7 +2575,8 @@
}
}
- mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_READY);
+ if (!ctl->shared_lock)
+ mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_READY);
if (ctl->wait_pingpong)
ctl->wait_pingpong(ctl, NULL);
diff --git a/drivers/video/msm/mdss/mdss_mdp_intf_video.c b/drivers/video/msm/mdss/mdss_mdp_intf_video.c
index a9595a1..e41bd49 100644
--- a/drivers/video/msm/mdss/mdss_mdp_intf_video.c
+++ b/drivers/video/msm/mdss/mdss_mdp_intf_video.c
@@ -446,8 +446,10 @@
if (ctx->polling_en) {
rc = mdss_mdp_video_pollwait(ctl);
} else {
+ mutex_unlock(&ctl->lock);
rc = wait_for_completion_timeout(&ctx->vsync_comp,
usecs_to_jiffies(VSYNC_TIMEOUT_US));
+ mutex_lock(&ctl->lock);
if (rc == 0) {
pr_warn("vsync wait timeout %d, fallback to poll mode\n",
ctl->num);
diff --git a/drivers/video/msm/mdss/mdss_mdp_overlay.c b/drivers/video/msm/mdss/mdss_mdp_overlay.c
index 70b266d..4a5022e 100644
--- a/drivers/video/msm/mdss/mdss_mdp_overlay.c
+++ b/drivers/video/msm/mdss/mdss_mdp_overlay.c
@@ -1099,8 +1099,11 @@
int ret = 0;
int sd_in_pipe = 0;
- if (ctl->shared_lock)
+ if (ctl->shared_lock) {
+ mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_BEGIN);
+ mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_READY);
mutex_lock(ctl->shared_lock);
+ }
mutex_lock(&mdp5_data->ov_lock);
mutex_lock(&mfd->lock);
@@ -1124,7 +1127,9 @@
mdp5_data->sd_enabled = 0;
}
- mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_BEGIN);
+ if (!ctl->shared_lock)
+ mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_BEGIN);
+
mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON, false);
if (data)
@@ -1146,14 +1151,18 @@
else
ret = mdss_mdp_display_commit(mdp5_data->ctl, NULL);
+ atomic_set(&mfd->kickoff_pending, 0);
+ wake_up_all(&mfd->kickoff_wait_q);
mutex_unlock(&mfd->lock);
if (IS_ERR_VALUE(ret))
goto commit_fail;
+ mutex_unlock(&mdp5_data->ov_lock);
mdss_mdp_overlay_update_pm(mdp5_data);
ret = mdss_mdp_display_wait4comp(mdp5_data->ctl);
+ mutex_lock(&mdp5_data->ov_lock);
if (ret == 0) {
mutex_lock(&mfd->lock);
@@ -1402,8 +1411,13 @@
for (i = 0; i < mdata->ndma_pipes; i++) {
pipe = mdata->dma_pipes + i;
- if (atomic_read(&pipe->ref_cnt) && pipe->mfd)
- mdss_mdp_overlay_force_cleanup(pipe->mfd);
+
+ if (!mdss_mdp_pipe_map(pipe)) {
+ struct msm_fb_data_type *mfd = pipe->mfd;
+ mdss_mdp_pipe_unmap(pipe);
+ if (mfd)
+ mdss_mdp_overlay_force_cleanup(mfd);
+ }
}
}
@@ -3140,6 +3154,7 @@
goto init_fail;
}
mfd->mdp.private1 = mdp5_data;
+ mfd->wait_for_kickoff = true;
rc = mdss_mdp_overlay_fb_parse_dt(mfd);
if (rc)
diff --git a/drivers/video/msm/mdss/mdss_mdp_pipe.c b/drivers/video/msm/mdss/mdss_mdp_pipe.c
index 50bee17..c522857 100644
--- a/drivers/video/msm/mdss/mdss_mdp_pipe.c
+++ b/drivers/video/msm/mdss/mdss_mdp_pipe.c
@@ -37,7 +37,7 @@
static DEFINE_MUTEX(mdss_mdp_sspp_lock);
static DEFINE_MUTEX(mdss_mdp_smp_lock);
-static int mdss_mdp_pipe_free(struct mdss_mdp_pipe *pipe);
+static void mdss_mdp_pipe_free(struct kref *kref);
static int mdss_mdp_smp_mmb_set(int client_id, unsigned long *smp);
static void mdss_mdp_smp_mmb_free(unsigned long *smp, bool write);
static struct mdss_mdp_pipe *mdss_mdp_pipe_search_by_client_id(
@@ -481,21 +481,17 @@
void mdss_mdp_pipe_unmap(struct mdss_mdp_pipe *pipe)
{
- int tmp;
-
- tmp = atomic_dec_return(&pipe->ref_cnt);
-
- WARN(tmp < 0, "Invalid unmap with ref_cnt=%d", tmp);
- if (tmp == 0)
- mdss_mdp_pipe_free(pipe);
+ if (kref_put_mutex(&pipe->kref, mdss_mdp_pipe_free,
+ &mdss_mdp_sspp_lock)) {
+ WARN(1, "Unexpected free pipe during unmap");
+ mutex_unlock(&mdss_mdp_sspp_lock);
+ }
}
int mdss_mdp_pipe_map(struct mdss_mdp_pipe *pipe)
{
- if (!atomic_inc_not_zero(&pipe->ref_cnt)) {
- pr_err("attempting to map unallocated pipe (%d)", pipe->num);
+ if (!kref_get_unless_zero(&pipe->kref))
return -EINVAL;
- }
return 0;
}
@@ -541,7 +537,7 @@
for (i = off; i < npipes; i++) {
pipe = pipe_pool + i;
- if (atomic_cmpxchg(&pipe->ref_cnt, 0, 1) == 0) {
+ if (atomic_read(&pipe->kref.refcount) == 0) {
pipe->mixer = mixer;
break;
}
@@ -551,7 +547,6 @@
if (pipe && mdss_mdp_pipe_fetch_halt(pipe)) {
pr_err("%d failed because pipe is in bad state\n",
pipe->num);
- atomic_dec(&pipe->ref_cnt);
return NULL;
}
@@ -559,13 +554,14 @@
pr_debug("type=%x pnum=%d\n", pipe->type, pipe->num);
mutex_init(&pipe->pp_res.hist.hist_mutex);
spin_lock_init(&pipe->pp_res.hist.hist_lock);
+ kref_init(&pipe->kref);
} else if (pipe_share) {
/*
* when there is no dedicated wfd blk, DMA pipe can be
* shared as long as its attached to a writeback mixer
*/
pipe = mdata->dma_pipes + mixer->num;
- atomic_inc(&pipe->ref_cnt);
+ kref_get(&pipe->kref);
pr_debug("pipe sharing for pipe=%d\n", pipe->num);
} else {
pr_err("no %d type pipes available\n", type);
@@ -587,7 +583,7 @@
} else if (pipe != &mdata->dma_pipes[mixer->num]) {
pr_err("Requested DMA pnum=%d not available\n",
mdata->dma_pipes[mixer->num].num);
- mdss_mdp_pipe_unmap(pipe);
+ kref_put(&pipe->kref, mdss_mdp_pipe_free);
pipe = NULL;
} else {
pipe->mixer = mixer;
@@ -674,10 +670,13 @@
return NULL;
}
-static int mdss_mdp_pipe_free(struct mdss_mdp_pipe *pipe)
+static void mdss_mdp_pipe_free(struct kref *kref)
{
- pr_debug("ndx=%x pnum=%d ref_cnt=%d\n", pipe->ndx, pipe->num,
- atomic_read(&pipe->ref_cnt));
+ struct mdss_mdp_pipe *pipe;
+
+ pipe = container_of(kref, struct mdss_mdp_pipe, kref);
+
+ pr_debug("ndx=%x pnum=%d\n", pipe->ndx, pipe->num);
if (pipe->play_cnt) {
mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON, false);
@@ -693,8 +692,6 @@
pipe->bwc_mode = 0;
pipe->mfd = NULL;
memset(&pipe->scale, 0, sizeof(struct mdp_scale_data));
-
- return 0;
}
static int mdss_mdp_is_pipe_idle(struct mdss_mdp_pipe *pipe,
@@ -802,19 +799,16 @@
int mdss_mdp_pipe_destroy(struct mdss_mdp_pipe *pipe)
{
- int tmp;
-
- tmp = atomic_dec_return(&pipe->ref_cnt);
-
- if (tmp != 0) {
- pr_err("unable to free pipe %d while still in use (%d)\n",
- pipe->num, tmp);
+ if (!kref_put_mutex(&pipe->kref, mdss_mdp_pipe_free,
+ &mdss_mdp_sspp_lock)) {
+ pr_err("unable to free pipe %d while still in use\n",
+ pipe->num);
return -EBUSY;
}
- mdss_mdp_pipe_free(pipe);
+
+ mutex_unlock(&mdss_mdp_sspp_lock);
return 0;
-
}
/**
@@ -873,7 +867,7 @@
pipe->is_handed_off = true;
pipe->play_cnt = 1;
- atomic_inc(&pipe->ref_cnt);
+ kref_init(&pipe->kref);
error:
return rc;
@@ -1136,6 +1130,13 @@
pipe->bg_color);
mdss_mdp_pipe_write(pipe, MDSS_MDP_REG_SSPP_SRC_UNPACK_PATTERN, unpack);
mdss_mdp_pipe_write(pipe, MDSS_MDP_REG_SSPP_SRC_ADDR_SW_STATUS, secure);
+ mdss_mdp_pipe_write(pipe, MDSS_MDP_REG_SSPP_SRC_OP_MODE, 0);
+
+ if (pipe->type != MDSS_MDP_PIPE_TYPE_DMA) {
+ mdss_mdp_pipe_write(pipe, MDSS_MDP_REG_SCALE_CONFIG, 0);
+ if (pipe->type == MDSS_MDP_PIPE_TYPE_VIG)
+ mdss_mdp_pipe_write(pipe, MDSS_MDP_REG_VIG_OP_MODE, 0);
+ }
return 0;
}
diff --git a/drivers/video/msm/mdss/mdss_mdp_rotator.c b/drivers/video/msm/mdss/mdss_mdp_rotator.c
index 8d6d41d..ee892e2 100755
--- a/drivers/video/msm/mdss/mdss_mdp_rotator.c
+++ b/drivers/video/msm/mdss/mdss_mdp_rotator.c
@@ -642,7 +642,7 @@
if (rot_pipe) {
struct mdss_mdp_mixer *mixer = rot_pipe->mixer;
- mdss_mdp_pipe_unmap(rot_pipe);
+ mdss_mdp_pipe_destroy(rot_pipe);
tmp = mdss_mdp_ctl_mixer_switch(mixer->ctl,
MDSS_MDP_WB_CTL_TYPE_BLOCK);
if (!tmp)
diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index b882fe2..d085e03 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -17,7 +17,7 @@
#include <linux/kernel.h>
#include <linux/types.h>
-#include <linux/jiffies.h>
+#include <linux/hrtimer.h>
#include <linux/delay.h>
#include <asm-generic/errno.h>
#include <asm/io.h>
@@ -36,13 +36,13 @@
*/
#define readl_poll_timeout(addr, val, cond, sleep_us, timeout_us) \
({ \
- unsigned long timeout = jiffies + usecs_to_jiffies(timeout_us); \
+ ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
might_sleep_if(timeout_us); \
for (;;) { \
(val) = readl(addr); \
if (cond) \
break; \
- if (timeout_us && time_after(jiffies, timeout)) { \
+ if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
(val) = readl(addr); \
break; \
} \
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 603bec2..04ad123 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -289,6 +289,25 @@
return cmp1.tv64 == cmp2.tv64;
}
+/**
+ * ktime_compare - Compares two ktime_t variables for less, greater or equal
+ * @cmp1: comparable1
+ * @cmp2: comparable2
+ *
+ * Returns ...
+ * cmp1 < cmp2: return <0
+ * cmp1 == cmp2: return 0
+ * cmp1 > cmp2: return >0
+ */
+static inline int ktime_compare(const ktime_t cmp1, const ktime_t cmp2)
+{
+ if (cmp1.tv64 < cmp2.tv64)
+ return -1;
+ if (cmp1.tv64 > cmp2.tv64)
+ return 1;
+ return 0;
+}
+
static inline s64 ktime_to_us(const ktime_t kt)
{
struct timeval tv = ktime_to_timeval(kt);
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 1531aa4..174a575 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1824,29 +1824,30 @@
#define V4L2_CID_MPEG_VIDC_VIDEO_EXTRADATA \
(V4L2_CID_MPEG_MSM_VIDC_BASE + 25)
enum v4l2_mpeg_vidc_extradata {
- V4L2_MPEG_VIDC_EXTRADATA_NONE,
- V4L2_MPEG_VIDC_EXTRADATA_MB_QUANTIZATION,
- V4L2_MPEG_VIDC_EXTRADATA_INTERLACE_VIDEO,
- V4L2_MPEG_VIDC_EXTRADATA_VC1_FRAMEDISP,
- V4L2_MPEG_VIDC_EXTRADATA_VC1_SEQDISP,
- V4L2_MPEG_VIDC_EXTRADATA_TIMESTAMP,
- V4L2_MPEG_VIDC_EXTRADATA_S3D_FRAME_PACKING,
- V4L2_MPEG_VIDC_EXTRADATA_FRAME_RATE,
- V4L2_MPEG_VIDC_EXTRADATA_PANSCAN_WINDOW,
- V4L2_MPEG_VIDC_EXTRADATA_RECOVERY_POINT_SEI,
- V4L2_MPEG_VIDC_EXTRADATA_CLOSED_CAPTION_UD,
- V4L2_MPEG_VIDC_EXTRADATA_AFD_UD,
- V4L2_MPEG_VIDC_EXTRADATA_MULTISLICE_INFO,
- V4L2_MPEG_VIDC_EXTRADATA_NUM_CONCEALED_MB,
- V4L2_MPEG_VIDC_EXTRADATA_METADATA_FILLER,
- V4L2_MPEG_VIDC_INDEX_EXTRADATA_INPUT_CROP,
- V4L2_MPEG_VIDC_INDEX_EXTRADATA_DIGITAL_ZOOM,
- V4L2_MPEG_VIDC_INDEX_EXTRADATA_ASPECT_RATIO,
- V4L2_MPEG_VIDC_EXTRADATA_MPEG2_SEQDISP,
- V4L2_MPEG_VIDC_EXTRADATA_FRAME_QP,
- V4L2_MPEG_VIDC_EXTRADATA_FRAME_BITS_INFO,
- V4L2_MPEG_VIDC_EXTRADATA_LTR,
- V4L2_MPEG_VIDC_EXTRADATA_METADATA_MBI,
+ V4L2_MPEG_VIDC_EXTRADATA_NONE = 0,
+ V4L2_MPEG_VIDC_EXTRADATA_MB_QUANTIZATION = 1,
+ V4L2_MPEG_VIDC_EXTRADATA_INTERLACE_VIDEO = 2,
+ V4L2_MPEG_VIDC_EXTRADATA_VC1_FRAMEDISP = 3,
+ V4L2_MPEG_VIDC_EXTRADATA_VC1_SEQDISP = 4,
+ V4L2_MPEG_VIDC_EXTRADATA_TIMESTAMP = 5,
+ V4L2_MPEG_VIDC_EXTRADATA_S3D_FRAME_PACKING = 6,
+ V4L2_MPEG_VIDC_EXTRADATA_FRAME_RATE = 7,
+ V4L2_MPEG_VIDC_EXTRADATA_PANSCAN_WINDOW = 8,
+ V4L2_MPEG_VIDC_EXTRADATA_RECOVERY_POINT_SEI = 9,
+ V4L2_MPEG_VIDC_EXTRADATA_CLOSED_CAPTION_UD = 10,
+ V4L2_MPEG_VIDC_EXTRADATA_AFD_UD = 11,
+ V4L2_MPEG_VIDC_EXTRADATA_MULTISLICE_INFO = 12,
+ V4L2_MPEG_VIDC_EXTRADATA_NUM_CONCEALED_MB = 13,
+ V4L2_MPEG_VIDC_EXTRADATA_METADATA_FILLER = 14,
+ V4L2_MPEG_VIDC_INDEX_EXTRADATA_INPUT_CROP = 15,
+ V4L2_MPEG_VIDC_INDEX_EXTRADATA_DIGITAL_ZOOM = 16,
+ V4L2_MPEG_VIDC_INDEX_EXTRADATA_ASPECT_RATIO = 17,
+ V4L2_MPEG_VIDC_EXTRADATA_MPEG2_SEQDISP = 18,
+ V4L2_MPEG_VIDC_EXTRADATA_FRAME_QP = 19,
+ V4L2_MPEG_VIDC_EXTRADATA_FRAME_BITS_INFO = 20,
+ V4L2_MPEG_VIDC_EXTRADATA_LTR = 21,
+ V4L2_MPEG_VIDC_EXTRADATA_METADATA_MBI = 22,
+ V4L2_MPEG_VIDC_EXTRADATA_STREAM_USERDATA = 23,
};
#define V4L2_CID_MPEG_VIDC_SET_PERF_LEVEL (V4L2_CID_MPEG_MSM_VIDC_BASE + 26)
diff --git a/include/media/msm_cam_sensor.h b/include/media/msm_cam_sensor.h
index a164705..46cec76 100644
--- a/include/media/msm_cam_sensor.h
+++ b/include/media/msm_cam_sensor.h
@@ -480,8 +480,8 @@
CFG_GET_ACTUATOR_INFO,
CFG_SET_ACTUATOR_INFO,
CFG_SET_DEFAULT_FOCUS,
- CFG_SET_POSITION,
CFG_MOVE_FOCUS,
+ CFG_SET_POSITION,
};
enum actuator_type {
diff --git a/include/media/msm_media_info.h b/include/media/msm_media_info.h
index ddf9c8e..663809e 100644
--- a/include/media/msm_media_info.h
+++ b/include/media/msm_media_info.h
@@ -158,8 +158,8 @@
static inline unsigned int VENUS_BUFFER_SIZE(
int color_fmt, int width, int height)
{
- unsigned int uv_alignment;
- unsigned int size = 0;
+ const unsigned int extra_size = 8*1024;
+ unsigned int uv_alignment = 0, size = 0;
unsigned int y_plane, uv_plane, y_stride,
uv_stride, y_sclines, uv_sclines;
if (!width || !height)
@@ -175,7 +175,7 @@
uv_alignment = 4096;
y_plane = y_stride * y_sclines;
uv_plane = uv_stride * uv_sclines + uv_alignment;
- size = y_plane + uv_plane;
+ size = y_plane + uv_plane + extra_size;
size = MSM_MEDIA_ALIGN(size, 4096);
break;
default:
diff --git a/include/media/msm_vidc.h b/include/media/msm_vidc.h
index 9028b1a..bbde6ef 100644
--- a/include/media/msm_vidc.h
+++ b/include/media/msm_vidc.h
@@ -179,6 +179,11 @@
unsigned int header_bits;
};
+struct msm_vidc_stream_userdata_payload {
+ unsigned int type;
+ unsigned int data[1];
+};
+
enum msm_vidc_extradata_type {
EXTRADATA_NONE = 0x00000000,
EXTRADATA_MB_QUANTIZATION = 0x00000001,
@@ -191,6 +196,7 @@
EXTRADATA_PANSCAN_WINDOW = 0x00000008,
EXTRADATA_RECOVERY_POINT_SEI = 0x00000009,
EXTRADATA_MPEG2_SEQDISP = 0x0000000D,
+ EXTRADATA_STREAM_USERDATA = 0x0000000E,
EXTRADATA_FRAME_QP = 0x0000000F,
EXTRADATA_FRAME_BITS_INFO = 0x00000010,
EXTRADATA_MULTISLICE_INFO = 0x7F100000,
@@ -214,4 +220,9 @@
FRAME_RECONSTRUCTION_APPROXIMATELY_CORRECT = 0x02,
};
+enum msm_vidc_userdata_type {
+ MSM_VIDC_USERDATA_TYPE_FRAME = 0x1,
+ MSM_VIDC_USERDATA_TYPE_TOP_FIELD = 0x2,
+ MSM_VIDC_USERDATA_TYPE_BOTTOM_FIELD = 0x3,
+};
#endif
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f6e37c4..8b833dd 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3799,6 +3799,15 @@
* @gfp: context flags
*/
void cfg80211_ap_stopped(struct net_device *netdev, gfp_t gfp);
+/**
+ * cfg80211_is_gratuitous_arp_unsolicited_na - packet is grat. ARP/unsol. NA
+ * @skb: the input packet, must be an ethernet frame already
+ *
+ * Return: %true if the packet is a gratuitous ARP or unsolicited NA packet.
+ * This is used to drop packets that shouldn't occur because the AP implements
+ * a proxy service.
+ */
+bool cfg80211_is_gratuitous_arp_unsolicited_na(struct sk_buff *skb);
/* Logging, debugging and troubleshooting/diagnostic helpers. */
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 4e316e1..8715a79 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -141,6 +141,23 @@
}
KERNEL_ATTR_RO(fscaps);
+int rcu_expedited;
+static ssize_t rcu_expedited_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%d\n", rcu_expedited);
+}
+static ssize_t rcu_expedited_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t count)
+{
+ if (kstrtoint(buf, 0, &rcu_expedited))
+ return -EINVAL;
+
+ return count;
+}
+KERNEL_ATTR_RW(rcu_expedited);
+
/*
* Make /sys/kernel/notes give the raw contents of our kernel .notes section.
*/
@@ -182,6 +199,7 @@
&kexec_crash_size_attr.attr,
&vmcoreinfo_attr.attr,
#endif
+ &rcu_expedited_attr.attr,
NULL
};
diff --git a/kernel/rcu.h b/kernel/rcu.h
index 8ba99cd..20dfba5 100644
--- a/kernel/rcu.h
+++ b/kernel/rcu.h
@@ -109,4 +109,6 @@
}
}
+extern int rcu_expedited;
+
#endif /* __LINUX_RCU_H */
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index a86f174..5746f18 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -45,12 +45,15 @@
#include <linux/mutex.h>
#include <linux/export.h>
#include <linux/hardirq.h>
+#include <linux/module.h>
#define CREATE_TRACE_POINTS
#include <trace/events/rcu.h>
#include "rcu.h"
+module_param(rcu_expedited, int, 0);
+
#ifdef CONFIG_DEBUG_LOCK_ALLOC
static struct lock_class_key rcu_lock_key;
struct lockdep_map rcu_lock_map =
diff --git a/kernel/rcutiny_plugin.h b/kernel/rcutiny_plugin.h
index 22ecea0..5a0f324 100644
--- a/kernel/rcutiny_plugin.h
+++ b/kernel/rcutiny_plugin.h
@@ -750,7 +750,10 @@
return;
/* Once we get past the fastpath checks, same code as rcu_barrier(). */
- rcu_barrier();
+ if (rcu_expedited)
+ synchronize_rcu_expedited();
+ else
+ rcu_barrier();
}
EXPORT_SYMBOL_GPL(synchronize_rcu);
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 4eec66e..e269782 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1926,7 +1926,10 @@
"Illegal synchronize_sched() in RCU-sched read-side critical section");
if (rcu_blocking_is_gp())
return;
- wait_rcu_gp(call_rcu_sched);
+ if (rcu_expedited)
+ synchronize_sched_expedited();
+ else
+ wait_rcu_gp(call_rcu_sched);
}
EXPORT_SYMBOL_GPL(synchronize_sched);
@@ -1947,7 +1950,10 @@
"Illegal synchronize_rcu_bh() in RCU-bh read-side critical section");
if (rcu_blocking_is_gp())
return;
- wait_rcu_gp(call_rcu_bh);
+ if (rcu_expedited)
+ synchronize_rcu_bh_expedited();
+ else
+ wait_rcu_gp(call_rcu_bh);
}
EXPORT_SYMBOL_GPL(synchronize_rcu_bh);
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index c023464..beafb9c 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -737,7 +737,10 @@
"Illegal synchronize_rcu() in RCU read-side critical section");
if (!rcu_scheduler_active)
return;
- wait_rcu_gp(call_rcu);
+ if (rcu_expedited)
+ synchronize_rcu_expedited();
+ else
+ wait_rcu_gp(call_rcu);
}
EXPORT_SYMBOL_GPL(synchronize_rcu);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index b81369b..f6c785c 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -419,20 +419,6 @@
#define REMOVE 1
#define FIND 0
-static inline ktime_t ktime_now(void)
-{
- struct timespec ts;
- ktime_get_ts(&ts);
-
- return timespec_to_ktime(ts);
-}
-
-/* This works even if 32 bit because of careful byte order choice */
-static inline int ktime_lt(const ktime_t cmp1, const ktime_t cmp2)
-{
- return cmp1.tv64 < cmp2.tv64;
-}
-
static const char version[] =
"Packet Generator for packet performance testing. "
"Version: " VERSION "\n";
@@ -677,7 +663,7 @@
seq_puts(seq, "\n");
/* not really stopped, more like last-running-at */
- stopped = pkt_dev->running ? ktime_now() : pkt_dev->stopped_at;
+ stopped = pkt_dev->running ? ktime_get() : pkt_dev->stopped_at;
idle = pkt_dev->idle_acc;
do_div(idle, NSEC_PER_USEC);
@@ -2141,12 +2127,12 @@
return;
}
- start_time = ktime_now();
+ start_time = ktime_get();
if (remaining < 100000) {
/* for small delays (<100us), just loop until limit is reached */
do {
- end_time = ktime_now();
- } while (ktime_lt(end_time, spin_until));
+ end_time = ktime_get();
+ } while (ktime_compare(end_time, spin_until) < 0);
} else {
/* see do_nanosleep */
hrtimer_init_sleeper(&t, current);
@@ -2162,7 +2148,7 @@
hrtimer_cancel(&t.timer);
} while (t.task && pkt_dev->running && !signal_pending(current));
__set_current_state(TASK_RUNNING);
- end_time = ktime_now();
+ end_time = ktime_get();
}
pkt_dev->idle_acc += ktime_to_ns(ktime_sub(end_time, start_time));
@@ -3008,8 +2994,7 @@
pktgen_clear_counters(pkt_dev);
pkt_dev->running = 1; /* Cranke yeself! */
pkt_dev->skb = NULL;
- pkt_dev->started_at =
- pkt_dev->next_tx = ktime_now();
+ pkt_dev->started_at = pkt_dev->next_tx = ktime_get();
set_pkt_overhead(pkt_dev);
@@ -3168,7 +3153,7 @@
kfree_skb(pkt_dev->skb);
pkt_dev->skb = NULL;
- pkt_dev->stopped_at = ktime_now();
+ pkt_dev->stopped_at = ktime_get();
pkt_dev->running = 0;
show_results(pkt_dev, nr_frags);
@@ -3187,7 +3172,7 @@
continue;
if (best == NULL)
best = pkt_dev;
- else if (ktime_lt(pkt_dev->next_tx, best->next_tx))
+ else if (ktime_compare(pkt_dev->next_tx, best->next_tx) < 0)
best = pkt_dev;
}
if_unlock(t);
@@ -3272,14 +3257,14 @@
static void pktgen_resched(struct pktgen_dev *pkt_dev)
{
- ktime_t idle_start = ktime_now();
+ ktime_t idle_start = ktime_get();
schedule();
- pkt_dev->idle_acc += ktime_to_ns(ktime_sub(ktime_now(), idle_start));
+ pkt_dev->idle_acc += ktime_to_ns(ktime_sub(ktime_get(), idle_start));
}
static void pktgen_wait_for_skb(struct pktgen_dev *pkt_dev)
{
- ktime_t idle_start = ktime_now();
+ ktime_t idle_start = ktime_get();
while (atomic_read(&(pkt_dev->skb->users)) != 1) {
if (signal_pending(current))
@@ -3290,7 +3275,7 @@
else
cpu_relax();
}
- pkt_dev->idle_acc += ktime_to_ns(ktime_sub(ktime_now(), idle_start));
+ pkt_dev->idle_acc += ktime_to_ns(ktime_sub(ktime_get(), idle_start));
}
static void pktgen_xmit(struct pktgen_dev *pkt_dev)
@@ -3312,7 +3297,7 @@
* "never transmit"
*/
if (unlikely(pkt_dev->delay == ULLONG_MAX)) {
- pkt_dev->next_tx = ktime_add_ns(ktime_now(), ULONG_MAX);
+ pkt_dev->next_tx = ktime_add_ns(ktime_get(), ULONG_MAX);
return;
}
diff --git a/net/wireless/db.txt b/net/wireless/db.txt
index 5e59f2d..6a77ffc 100644
--- a/net/wireless/db.txt
+++ b/net/wireless/db.txt
@@ -266,6 +266,9 @@
country DZ:
(2402 - 2482 @ 40), (N/A, 20)
+ (5150 - 5250 @ 80), (N/A, 23)
+ (5250 - 5350 @ 80), (N/A,23), DFS
+ (5470 - 5670 @ 80), (N/A, 20), DFS
country EC:
(2402 - 2482 @ 40), (N/A, 20)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 1924758..1f547f9 100755
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -345,6 +345,9 @@
struct reg_regdb_search_request *request;
const struct ieee80211_regdomain *curdom, *regdom;
int i, r;
+ bool set_reg = false;
+
+ mutex_lock(&cfg80211_mutex);
mutex_lock(®_regdb_search_mutex);
while (!list_empty(®_regdb_search_list)) {
@@ -360,9 +363,7 @@
r = reg_copy_regd(®dom, curdom);
if (r)
break;
- mutex_lock(&cfg80211_mutex);
- set_regdom(regdom);
- mutex_unlock(&cfg80211_mutex);
+ set_reg = true;
break;
}
}
@@ -370,6 +371,11 @@
kfree(request);
}
mutex_unlock(®_regdb_search_mutex);
+
+ if (set_reg)
+ set_regdom(regdom);
+
+ mutex_unlock(&cfg80211_mutex);
}
static DECLARE_WORK(reg_regdb_work, reg_regdb_search);
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 1ba7232..b83c5b2 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -10,6 +10,8 @@
#include <net/cfg80211.h>
#include <net/ip.h>
#include <net/dsfield.h>
+#include <net/ndisc.h>
+#include <linux/if_arp.h>
#include "core.h"
struct ieee80211_rate *
@@ -1150,3 +1152,54 @@
const unsigned char bridge_tunnel_header[] __aligned(2) =
{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
EXPORT_SYMBOL(bridge_tunnel_header);
+
+bool cfg80211_is_gratuitous_arp_unsolicited_na(struct sk_buff *skb)
+{
+ const struct ethhdr *eth = (void *)skb->data;
+ const struct {
+ struct arphdr hdr;
+ u8 ar_sha[ETH_ALEN];
+ u8 ar_sip[4];
+ u8 ar_tha[ETH_ALEN];
+ u8 ar_tip[4];
+ } __packed *arp;
+ const struct ipv6hdr *ipv6;
+ const struct icmp6hdr *icmpv6;
+
+ switch (eth->h_proto) {
+ case cpu_to_be16(ETH_P_ARP):
+ /* can't say - but will probably be dropped later anyway */
+ if (!pskb_may_pull(skb, sizeof(*eth) + sizeof(*arp)))
+ return false;
+
+ arp = (void *)(eth + 1);
+
+ if ((arp->hdr.ar_op == cpu_to_be16(ARPOP_REPLY) ||
+ arp->hdr.ar_op == cpu_to_be16(ARPOP_REQUEST)) &&
+ !memcmp(arp->ar_sip, arp->ar_tip, sizeof(arp->ar_sip)))
+ return true;
+ break;
+ case cpu_to_be16(ETH_P_IPV6):
+ /* can't say - but will probably be dropped later anyway */
+ if (!pskb_may_pull(skb, sizeof(*eth) + sizeof(*ipv6) +
+ sizeof(*icmpv6)))
+ return false;
+
+ ipv6 = (void *)(eth + 1);
+ icmpv6 = (void *)(ipv6 + 1);
+
+ if (icmpv6->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT &&
+ !memcmp(&ipv6->saddr, &ipv6->daddr, sizeof(ipv6->saddr)))
+ return true;
+ break;
+ default:
+ /*
+ * no need to support other protocols, proxy service isn't
+ * specified for any others
+ */
+ break;
+ }
+
+ return false;
+}
+EXPORT_SYMBOL(cfg80211_is_gratuitous_arp_unsolicited_na);
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c
index c2cc499..a5c8f8d 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c
@@ -73,7 +73,7 @@
static int srs_alsa_ctrl_ever_called;
static int lsm_mux_slim_port;
static int slim0_rx_aanc_fb_port;
-static int msm_route_ec_ref_rx = 4; /* NONE */
+static int msm_route_ec_ref_rx = 7; /* NONE */
static uint32_t voc_session_id = ALL_SESSION_VSID;
static int msm_route_ext_ec_ref = AFE_PORT_INVALID;
@@ -1431,11 +1431,23 @@
break;
case 2:
msm_route_ec_ref_rx = 2;
- ec_ref_port_id = AFE_PORT_ID_SECONDARY_MI2S_RX;
+ ec_ref_port_id = AFE_PORT_ID_PRIMARY_MI2S_TX;
+ break;
+ case 3:
+ msm_route_ec_ref_rx = 3;
+ ec_ref_port_id = AFE_PORT_ID_SECONDARY_MI2S_TX;
+ break;
+ case 4:
+ msm_route_ec_ref_rx = 4;
+ ec_ref_port_id = AFE_PORT_ID_TERTIARY_MI2S_TX;
+ break;
+ case 5:
+ msm_route_ec_ref_rx = 5;
+ ec_ref_port_id = AFE_PORT_ID_QUATERNARY_MI2S_TX;
break;
default:
- msm_route_ec_ref_rx = 3; /* NONE */
- ec_ref_port_id = -1;
+ msm_route_ec_ref_rx = 6; /* NONE */
+ ec_ref_port_id = AFE_PORT_INVALID;
break;
}
adm_ec_ref_rx_id(ec_ref_port_id);
@@ -1445,16 +1457,46 @@
return 0;
}
-static const char *const ec_ref_rx[] = { "SLIM_RX", "I2S_RX", "SEC_I2S_RX",
- "PROXY_RX", "NONE" };
+static const char *const ec_ref_rx[] = { "SLIM_RX", "I2S_RX", "PRI_MI2S_TX",
+ "SEC_MI2S_TX", "TERT_MI2S_TX", "QUAT_MI2S_TX", "PROXY_RX", "NONE"};
static const struct soc_enum msm_route_ec_ref_rx_enum[] = {
- SOC_ENUM_SINGLE_EXT(5, ec_ref_rx),
+ SOC_ENUM_SINGLE_EXT(8, ec_ref_rx),
};
-static const struct snd_kcontrol_new ec_ref_rx_mixer_controls[] = {
- SOC_ENUM_EXT("EC_REF_RX", msm_route_ec_ref_rx_enum[0],
- msm_routing_ec_ref_rx_get, msm_routing_ec_ref_rx_put),
-};
+static const struct snd_kcontrol_new ext_ec_ref_mux_ul1 =
+ SOC_DAPM_ENUM_EXT("AUDIO_REF_EC_UL1 MUX Mux",
+ msm_route_ec_ref_rx_enum[0],
+ msm_routing_ec_ref_rx_get, msm_routing_ec_ref_rx_put);
+
+static const struct snd_kcontrol_new ext_ec_ref_mux_ul2 =
+ SOC_DAPM_ENUM_EXT("AUDIO_REF_EC_UL2 MUX Mux",
+ msm_route_ec_ref_rx_enum[0],
+ msm_routing_ec_ref_rx_get, msm_routing_ec_ref_rx_put);
+
+static const struct snd_kcontrol_new ext_ec_ref_mux_ul4 =
+ SOC_DAPM_ENUM_EXT("AUDIO_REF_EC_UL4 MUX Mux",
+ msm_route_ec_ref_rx_enum[0],
+ msm_routing_ec_ref_rx_get, msm_routing_ec_ref_rx_put);
+
+static const struct snd_kcontrol_new ext_ec_ref_mux_ul5 =
+ SOC_DAPM_ENUM_EXT("AUDIO_REF_EC_UL5 MUX Mux",
+ msm_route_ec_ref_rx_enum[0],
+ msm_routing_ec_ref_rx_get, msm_routing_ec_ref_rx_put);
+
+static const struct snd_kcontrol_new ext_ec_ref_mux_ul6 =
+ SOC_DAPM_ENUM_EXT("AUDIO_REF_EC_UL6 MUX Mux",
+ msm_route_ec_ref_rx_enum[0],
+ msm_routing_ec_ref_rx_get, msm_routing_ec_ref_rx_put);
+
+static const struct snd_kcontrol_new ext_ec_ref_mux_ul8 =
+ SOC_DAPM_ENUM_EXT("AUDIO_REF_EC_UL8 MUX Mux",
+ msm_route_ec_ref_rx_enum[0],
+ msm_routing_ec_ref_rx_get, msm_routing_ec_ref_rx_put);
+
+static const struct snd_kcontrol_new ext_ec_ref_mux_ul9 =
+ SOC_DAPM_ENUM_EXT("AUDIO_REF_EC_UL9 MUX Mux",
+ msm_route_ec_ref_rx_enum[0],
+ msm_routing_ec_ref_rx_get, msm_routing_ec_ref_rx_put);
static int msm_routing_ext_ec_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
@@ -3577,7 +3619,20 @@
&slim0_rx_vi_fb_lch_mux),
SND_SOC_DAPM_MUX("VOC_EXT_EC MUX", SND_SOC_NOPM, 0, 0,
&voc_ext_ec_mux),
-
+ SND_SOC_DAPM_MUX("AUDIO_REF_EC_UL1 MUX", SND_SOC_NOPM, 0, 0,
+ &ext_ec_ref_mux_ul1),
+ SND_SOC_DAPM_MUX("AUDIO_REF_EC_UL2 MUX", SND_SOC_NOPM, 0, 0,
+ &ext_ec_ref_mux_ul2),
+ SND_SOC_DAPM_MUX("AUDIO_REF_EC_UL4 MUX", SND_SOC_NOPM, 0, 0,
+ &ext_ec_ref_mux_ul4),
+ SND_SOC_DAPM_MUX("AUDIO_REF_EC_UL5 MUX", SND_SOC_NOPM, 0, 0,
+ &ext_ec_ref_mux_ul5),
+ SND_SOC_DAPM_MUX("AUDIO_REF_EC_UL6 MUX", SND_SOC_NOPM, 0, 0,
+ &ext_ec_ref_mux_ul6),
+ SND_SOC_DAPM_MUX("AUDIO_REF_EC_UL8 MUX", SND_SOC_NOPM, 0, 0,
+ &ext_ec_ref_mux_ul8),
+ SND_SOC_DAPM_MUX("AUDIO_REF_EC_UL9 MUX", SND_SOC_NOPM, 0, 0,
+ &ext_ec_ref_mux_ul9),
};
static const struct snd_soc_dapm_route intercon[] = {
@@ -3899,6 +3954,63 @@
{"VOIP_UL", NULL, "VOC_EXT_EC MUX"},
{"VoLTE_UL", NULL, "VOC_EXT_EC MUX"},
+ {"AUDIO_REF_EC_UL1 MUX", "PRI_MI2S_TX" , "PRI_MI2S_TX"},
+ {"AUDIO_REF_EC_UL1 MUX", "SEC_MI2S_TX" , "SEC_MI2S_TX"},
+ {"AUDIO_REF_EC_UL1 MUX", "TERT_MI2S_TX" , "TERT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL1 MUX", "QUAT_MI2S_TX" , "QUAT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL1 MUX", "I2S_RX" , "PRI_I2S_TX"},
+ {"AUDIO_REF_EC_UL1 MUX", "SLIM_RX" , "SLIMBUS_0_TX"},
+
+ {"AUDIO_REF_EC_UL2 MUX", "PRI_MI2S_TX" , "PRI_MI2S_TX"},
+ {"AUDIO_REF_EC_UL2 MUX", "SEC_MI2S_TX" , "SEC_MI2S_TX"},
+ {"AUDIO_REF_EC_UL2 MUX", "TERT_MI2S_TX" , "TERT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL2 MUX", "QUAT_MI2S_TX" , "QUAT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL2 MUX", "I2S_RX" , "PRI_I2S_TX"},
+ {"AUDIO_REF_EC_UL2 MUX", "SLIM_RX" , "SLIMBUS_0_TX"},
+
+ {"AUDIO_REF_EC_UL4 MUX", "PRI_MI2S_TX" , "PRI_MI2S_TX"},
+ {"AUDIO_REF_EC_UL4 MUX", "SEC_MI2S_TX" , "SEC_MI2S_TX"},
+ {"AUDIO_REF_EC_UL4 MUX", "TERT_MI2S_TX" , "TERT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL4 MUX", "QUAT_MI2S_TX" , "QUAT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL4 MUX", "I2S_RX" , "PRI_I2S_TX"},
+ {"AUDIO_REF_EC_UL4 MUX", "SLIM_RX" , "SLIMBUS_0_TX"},
+
+ {"AUDIO_REF_EC_UL5 MUX", "PRI_MI2S_TX" , "PRI_MI2S_TX"},
+ {"AUDIO_REF_EC_UL5 MUX", "SEC_MI2S_TX" , "SEC_MI2S_TX"},
+ {"AUDIO_REF_EC_UL5 MUX", "TERT_MI2S_TX" , "TERT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL5 MUX", "QUAT_MI2S_TX" , "QUAT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL5 MUX", "I2S_RX" , "PRI_I2S_TX"},
+ {"AUDIO_REF_EC_UL5 MUX", "SLIM_RX" , "SLIMBUS_0_TX"},
+
+ {"AUDIO_REF_EC_UL6 MUX", "PRI_MI2S_TX" , "PRI_MI2S_TX"},
+ {"AUDIO_REF_EC_UL6 MUX", "SEC_MI2S_TX" , "SEC_MI2S_TX"},
+ {"AUDIO_REF_EC_UL6 MUX", "TERT_MI2S_TX" , "TERT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL6 MUX", "QUAT_MI2S_TX" , "QUAT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL6 MUX", "I2S_RX" , "PRI_I2S_TX"},
+ {"AUDIO_REF_EC_UL6 MUX", "SLIM_RX" , "SLIMBUS_0_TX"},
+
+ {"AUDIO_REF_EC_UL8 MUX", "PRI_MI2S_TX" , "PRI_MI2S_TX"},
+ {"AUDIO_REF_EC_UL8 MUX", "SEC_MI2S_TX" , "SEC_MI2S_TX"},
+ {"AUDIO_REF_EC_UL8 MUX", "TERT_MI2S_TX" , "TERT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL8 MUX", "QUAT_MI2S_TX" , "QUAT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL8 MUX", "I2S_RX" , "PRI_I2S_TX"},
+ {"AUDIO_REF_EC_UL8 MUX", "SLIM_RX" , "SLIMBUS_0_TX"},
+
+ {"AUDIO_REF_EC_UL9 MUX", "PRI_MI2S_TX" , "PRI_MI2S_TX"},
+ {"AUDIO_REF_EC_UL9 MUX", "SEC_MI2S_TX" , "SEC_MI2S_TX"},
+ {"AUDIO_REF_EC_UL9 MUX", "TERT_MI2S_TX" , "TERT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL9 MUX", "QUAT_MI2S_TX" , "QUAT_MI2S_TX"},
+ {"AUDIO_REF_EC_UL9 MUX", "I2S_RX" , "PRI_I2S_TX"},
+ {"AUDIO_REF_EC_UL9 MUX", "SLIM_RX" , "SLIMBUS_0_TX"},
+
+ {"MM_UL1", NULL, "AUDIO_REF_EC_UL1 MUX"},
+ {"MM_UL2", NULL, "AUDIO_REF_EC_UL2 MUX"},
+ {"MM_UL4", NULL, "AUDIO_REF_EC_UL4 MUX"},
+ {"MM_UL5", NULL, "AUDIO_REF_EC_UL5 MUX"},
+ {"MM_UL6", NULL, "AUDIO_REF_EC_UL6 MUX"},
+ {"MM_UL8", NULL, "AUDIO_REF_EC_UL8 MUX"},
+ {"MM_UL9", NULL, "AUDIO_REF_EC_UL9 MUX"},
+
{"Voice_Tx Mixer", "PRI_TX_Voice", "PRI_I2S_TX"},
{"Voice_Tx Mixer", "PRI_MI2S_TX_Voice", "PRI_MI2S_TX"},
{"Voice_Tx Mixer", "MI2S_TX_Voice", "MI2S_TX"},
@@ -4427,10 +4539,6 @@
ARRAY_SIZE(dolby_dap_param_end_point_controls));
snd_soc_add_platform_controls(platform,
- ec_ref_rx_mixer_controls,
- ARRAY_SIZE(ec_ref_rx_mixer_controls));
-
- snd_soc_add_platform_controls(platform,
get_rms_controls,
ARRAY_SIZE(get_rms_controls));