Merge "msm: clock-8974: Add the q6ss_ahbm_clk required by LPASS PIL" into msm-3.4
diff --git a/Documentation/devicetree/bindings/gpio/gpio-msm.txt b/Documentation/devicetree/bindings/gpio/gpio-msm.txt
new file mode 100644
index 0000000..359d700
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-msm.txt
@@ -0,0 +1,39 @@
+MSM GPIO controller bindings
+
+Required properties:
+- compatible:
+ - "qcom,msm-gpio" for MSM controllers
+- #gpio-cells : Should be two.
+ - first cell is the pin number
+ - second cell is used to specify optional parameters (unused)
+- gpio-controller : Marks the device node as a GPIO controller.
+- #interrupt-cells : Should be 2.
+- interrupt-controller: Mark the device node as an interrupt controller
+
+Example:
+
+ msmgpio: gpio@fd510000 {
+ compatible = "qcom,msm-gpio";
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ reg = <0xfd510000 0x4000>;
+ };
+
+To specify gpios for a device:
+
+ device1@f991f000 {
+ compatible = "qcom,msm-device-v1";
+ reg = <0xf991f000 0x1000>;
+ gpios = <&msmgpio 45 0>;
+ cs-gpios = <&msmgpio 46 0>;
+ };
+
+45, 46 - gpio numbers.
+The driver for device1 can call of_get_gpio() to extract the
+gpio45. In order to extract gpio46, the driver needs to call
+of_get_named_gpio with "cs-gpios" as the name parameter.
+Please refer to the file: include/linux/of_gpio.h for the
+complete list of APIs the driver can use to extract gpio
+information from the device tree.
diff --git a/Documentation/devicetree/bindings/sound/taiko_codec.txt b/Documentation/devicetree/bindings/sound/taiko_codec.txt
new file mode 100644
index 0000000..9f3719b
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/taiko_codec.txt
@@ -0,0 +1,82 @@
+taiko audio CODEC
+
+Required properties:
+
+ - compatible : "qcom,taiko-slim-pgd"
+ - elemental-addr: codec slimbus slave PGD enumeration address.(48 bits)
+
+ - qcom,cdc-reset-gpio: gpio used for codec SOC reset.
+
+ - <supply-name>-supply: phandle to the regulator device tree node
+ - qcom,<supply-name>-voltage - specifies voltage levels for supply. Should be
+ specified in pairs (min, max), units mV.
+ - qcom,<supply-name>-current - specifies max current in mA that can drawn
+ from the <supply-name>.
+
+ above three properties with "supply-name" set to "qcom,cdc-vdd-buck", "qcom,cdc-vdd-tx-h",
+ "qcom,cdc-vdd-rx-h", "qcom,cdc-vddpx-1", "qcom,cdc-vdd-a-1p2v", "qcom,cdc-vddcx-1",
+ "qcom,cdc-vddcx-2" should be present.
+
+ - qcom,cdc-micbias-ldoh-v - LDOH output in volts ( should be 1.95 V and 3.00 V).
+
+ - qcom,cdc-micbias-cfilt1-mv - cfilt1 output voltage in milli volts.
+ - qcom,cdc-micbias-cfilt2-mv - cfilt2 output voltage in milli volts.
+ - qcom,cdc-micbias-cfilt3-mv - cfilt3 output voltage in milli volts.
+ cfilt volatge can be set to max of qcom,cdc-micbias-ldoh-v - 0.15V.
+
+ - qcom,cdc-micbias1-cfilt-sel = cfilt to use for micbias1 (should be from 1 to 3).
+ - qcom,cdc-micbias2-cfilt-sel = cfilt to use for micbias2 (should be from 1 to 3).
+ - qcom,cdc-micbias3-cfilt-sel = cfilt to use for micbias3 (should be from 1 to 3).
+ - qcom,cdc-micbias4-cfilt-sel = cfilt to use for micbias4 (should be from 1 to 3).
+
+ - qcom,cdc-slim-ifd-dev - namme of the codec slim interface device.
+ - qcom,cdc-slim-ifd-elemental-addr - codec slimbus slave interface device
+ enumeration address.
+Example:
+
+taiko_codec {
+ compatible = "qcom,taiko-slim-pgd";
+ elemental-addr = [00 01 A0 00 17 02];
+
+ qcom,cdc-reset-gpio = <&msmgpio 63 0>;
+
+ cdc-vdd-buck-supply = <&pm8941_s2>;
+ qcom,cdc-vdd-buck-voltage = <2150000 2150000>;
+ qcom,cdc-vdd-buck-current = <500000>;
+
+ cdc-vdd-tx-h-supply = <&pm8941_s3>;
+ qcom,cdc-vdd-tx-h-voltage = <1800000 1800000>;
+ qcom,cdc-vdd-tx-h-current = <200000>;
+
+ cdc-vdd-rx-h-supply = <&pm8941_s3>;
+ qcom,cdc-vdd-rx-h-voltage = <1800000 1800000>;
+ qcom,cdc-vdd-rx-h-current = <200000>;
+
+ cdc-vddpx-1-supply = <&pm8941_s3>;
+ qcom,cdc-vddpx-1-voltage = <1800000 1800000>;
+ qcom,cdc-vddpx-1-current = <5000>;
+
+ cdc-vdd-a-1p2v-supply = <&pm8941_l1>;
+ qcom,cdc-vdd-a-1p2v-voltage = <1225000 1225000>;
+ qcom,cdc-vdd-a-1p2v-current = <5000>;
+
+ cdc-vddcx-1-supply = <&pm8941_l1>;
+ qcom,cdc-vddcx-1-voltage = <1225000 1225000>;
+ qcom,cdc-vddcx-1-current = <5000>;
+
+ cdc-vddcx-2-supply = <&pm8941_l1>;
+ qcom,cdc-vddcx-2-voltage = <1225000 1225000>;
+ qcom,cdc-vddcx-2-current = <5000>;
+
+ qcom,cdc-micbias-ldoh-v = <0x3>;
+ qcom,cdc-micbias-cfilt1-mv = <1800>;
+ qcom,cdc-micbias-cfilt2-mv = <2700>;
+ qcom,cdc-micbias-cfilt3-mv = <1800>;
+ qcom,cdc-micbias1-cfilt-sel = <0x0>;
+ qcom,cdc-micbias2-cfilt-sel = <0x1>;
+ qcom,cdc-micbias3-cfilt-sel = <0x2>;
+ qcom,cdc-micbias4-cfilt-sel = <0x2>;
+
+ qcom,cdc-slim-ifd = "taiko-slim-ifd";
+ qcom,cdc-slim-ifd-elemental-addr = [00 00 A0 00 17 02];
+};
diff --git a/arch/arm/boot/dts/msm-pm8941.dtsi b/arch/arm/boot/dts/msm-pm8941.dtsi
index cb1ac34..67adcd6 100644
--- a/arch/arm/boot/dts/msm-pm8941.dtsi
+++ b/arch/arm/boot/dts/msm-pm8941.dtsi
@@ -425,7 +425,7 @@
#address-cells = <1>;
#size-cells = <1>;
compatible = "qcom,qpnp-regulator";
- reg = <0x1400 0x300>;
+ reg = <0x1a00 0x300>;
status = "disabled";
qcom,ctl@1a00 {
diff --git a/arch/arm/boot/dts/msm8974.dtsi b/arch/arm/boot/dts/msm8974.dtsi
index e3dad4f..446f310 100644
--- a/arch/arm/boot/dts/msm8974.dtsi
+++ b/arch/arm/boot/dts/msm8974.dtsi
@@ -33,10 +33,11 @@
msmgpio: gpio@fd510000 {
compatible = "qcom,msm-gpio";
+ gpio-controller;
+ #gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
reg = <0xfd510000 0x4000>;
- #gpio-cells = <2>;
};
timer {
diff --git a/arch/arm/boot/dts/msm9625.dts b/arch/arm/boot/dts/msm9625.dts
index deddc5f..42425ed 100644
--- a/arch/arm/boot/dts/msm9625.dts
+++ b/arch/arm/boot/dts/msm9625.dts
@@ -37,6 +37,8 @@
msmgpio: gpio@fd510000 {
compatible = "qcom,msm-gpio";
+ gpio-controller;
+ #gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
reg = <0xfd510000 0x4000>;
diff --git a/arch/arm/configs/msm8974_defconfig b/arch/arm/configs/msm8974_defconfig
index 1a6c134..da7bfd4 100644
--- a/arch/arm/configs/msm8974_defconfig
+++ b/arch/arm/configs/msm8974_defconfig
@@ -67,7 +67,6 @@
CONFIG_HIGHMEM=y
CONFIG_VMALLOC_RESERVE=0x19000000
CONFIG_USE_OF=y
-CONFIG_ARM_APPENDED_DTB=y
CONFIG_ARM_ATAG_DTB_COMPAT=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
diff --git a/arch/arm/mach-msm/board-8064.c b/arch/arm/mach-msm/board-8064.c
index 4b4e006..665b861 100644
--- a/arch/arm/mach-msm/board-8064.c
+++ b/arch/arm/mach-msm/board-8064.c
@@ -2913,6 +2913,7 @@
static void __init apq8064_common_init(void)
{
u32 platform_version;
+ platform_device_register(&msm_gpio_device);
msm_tsens_early_init(&apq_tsens_pdata);
msm_thermal_init(&msm_thermal_pdata);
if (socinfo_init() < 0)
diff --git a/arch/arm/mach-msm/board-8930.c b/arch/arm/mach-msm/board-8930.c
index 444580f..b80d62d 100644
--- a/arch/arm/mach-msm/board-8930.c
+++ b/arch/arm/mach-msm/board-8930.c
@@ -2572,6 +2572,7 @@
if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
pr_err("meminfo_init() failed!\n");
+ platform_device_register(&msm_gpio_device);
msm_tsens_early_init(&msm_tsens_pdata);
msm_thermal_init(&msm_thermal_pdata);
BUG_ON(msm_rpm_init(&msm8930_rpm_data));
diff --git a/arch/arm/mach-msm/board-8960.c b/arch/arm/mach-msm/board-8960.c
index 7d88ea6..ad788bc 100644
--- a/arch/arm/mach-msm/board-8960.c
+++ b/arch/arm/mach-msm/board-8960.c
@@ -3082,6 +3082,7 @@
if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
pr_err("meminfo_init() failed!\n");
+ platform_device_register(&msm_gpio_device);
msm_tsens_early_init(&msm_tsens_pdata);
msm_thermal_init(&msm_thermal_pdata);
BUG_ON(msm_rpm_init(&msm8960_rpm_data));
diff --git a/arch/arm/mach-msm/board-8974.c b/arch/arm/mach-msm/board-8974.c
index 1049bcb..1b75a0a 100644
--- a/arch/arm/mach-msm/board-8974.c
+++ b/arch/arm/mach-msm/board-8974.c
@@ -487,6 +487,34 @@
OF_DEV_AUXDATA("qcom,pil-mba", 0xFC820000, "pil-mba", NULL),
OF_DEV_AUXDATA("qcom,pil-pronto", 0xFB21B000, \
"pil_pronto", NULL),
+ OF_DEV_AUXDATA("arm,coresight-tmc", 0xFC322000, \
+ "coresight-tmc-etr", NULL),
+ OF_DEV_AUXDATA("arm,coresight-tpiu", 0xFC318000, \
+ "coresight-tpiu", NULL),
+ OF_DEV_AUXDATA("qcom,coresight-replicator", 0xFC31C000, \
+ "coresight-replicator", NULL),
+ OF_DEV_AUXDATA("arm,coresight-tmc", 0xFC307000, \
+ "coresight-tmc-etf", NULL),
+ OF_DEV_AUXDATA("arm,coresight-funnel", 0xFC31B000, \
+ "coresight-funnel-merg", NULL),
+ OF_DEV_AUXDATA("arm,coresight-funnel", 0xFC319000, \
+ "coresight-funnel-in0", NULL),
+ OF_DEV_AUXDATA("arm,coresight-funnel", 0xFC31A000, \
+ "coresight-funnel-in1", NULL),
+ OF_DEV_AUXDATA("arm,coresight-funnel", 0xFC345000, \
+ "coresight-funnel-kpss", NULL),
+ OF_DEV_AUXDATA("arm,coresight-funnel", 0xFC364000, \
+ "coresight-funnel-mmss", NULL),
+ OF_DEV_AUXDATA("arm,coresight-stm", 0xFC321000, \
+ "coresight-stm", NULL),
+ OF_DEV_AUXDATA("arm,coresight-etm", 0xFC33C000, \
+ "coresight-etm0", NULL),
+ OF_DEV_AUXDATA("arm,coresight-etm", 0xFC33D000, \
+ "coresight-etm1", NULL),
+ OF_DEV_AUXDATA("arm,coresight-etm", 0xFC33E000, \
+ "coresight-etm2", NULL),
+ OF_DEV_AUXDATA("arm,coresight-etm", 0xFC33F000, \
+ "coresight-etm3", NULL),
OF_DEV_AUXDATA("qcom,msm-rng", 0xF9BFF000, \
"msm_rng", NULL),
OF_DEV_AUXDATA("qcom,qseecom", 0xFE806000, \
diff --git a/arch/arm/mach-msm/board-9615.c b/arch/arm/mach-msm/board-9615.c
index a312e2b..f885774 100644
--- a/arch/arm/mach-msm/board-9615.c
+++ b/arch/arm/mach-msm/board-9615.c
@@ -976,6 +976,7 @@
msm_android_usb_hsic_device.dev.platform_data;
msm9615_device_init();
+ platform_device_register(&msm_gpio_device);
msm9615_init_gpiomux();
msm9615_i2c_init();
regulator_suppress_info_printing();
diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c
index 50b1ac5..38f1170 100644
--- a/arch/arm/mach-msm/board-msm8x60.c
+++ b/arch/arm/mach-msm/board-msm8x60.c
@@ -10213,6 +10213,7 @@
#endif
pmic_reset_irq = PM8058_IRQ_BASE + PM8058_RESOUT_IRQ;
+ platform_device_register(&msm_gpio_device);
/*
* Initialize RPM first as other drivers and devices may need
* it for their initialization.
diff --git a/arch/arm/mach-msm/devices-8960.c b/arch/arm/mach-msm/devices-8960.c
index e07301a..680770e 100644
--- a/arch/arm/mach-msm/devices-8960.c
+++ b/arch/arm/mach-msm/devices-8960.c
@@ -4017,6 +4017,11 @@
},
};
+struct platform_device msm_gpio_device = {
+ .name = "msmgpio",
+ .id = -1,
+};
+
struct platform_device mdm_sglte_device = {
.name = "mdm2_modem",
.id = -1,
diff --git a/arch/arm/mach-msm/devices-9615.c b/arch/arm/mach-msm/devices-9615.c
index 9f03878..fff8e0d 100644
--- a/arch/arm/mach-msm/devices-9615.c
+++ b/arch/arm/mach-msm/devices-9615.c
@@ -1372,6 +1372,10 @@
},
};
+struct platform_device msm_gpio_device = {
+ .name = "msmgpio",
+ .id = -1,
+};
void __init msm9615_device_init(void)
{
@@ -1382,7 +1386,6 @@
msm_rpmrs_levels[0].latency_us;
msm_android_usb_hsic_pdata.swfi_latency =
msm_rpmrs_levels[0].latency_us;
-
}
#define MSM_SHARED_RAM_PHYS 0x40000000
diff --git a/arch/arm/mach-msm/devices-msm8x60.c b/arch/arm/mach-msm/devices-msm8x60.c
index 9ea817f..5402251 100644
--- a/arch/arm/mach-msm/devices-msm8x60.c
+++ b/arch/arm/mach-msm/devices-msm8x60.c
@@ -100,6 +100,11 @@
#define MSM_UART9DM_PHYS (MSM_GSBI9_PHYS + 0x40000)
#define INT_UART9DM_IRQ GSBI9_UARTDM_IRQ
+struct platform_device msm_gpio_device = {
+ .name = "msmgpio",
+ .id = -1,
+};
+
static void charm_ap2mdm_kpdpwr_on(void)
{
gpio_direction_output(AP2MDM_PMIC_RESET_N, 0);
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h
index 6726e60..8e2ab7d 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -436,3 +436,5 @@
extern struct platform_device msm8930aa_device_acpuclk;
extern struct platform_device msm8960_device_acpuclk;
extern struct platform_device msm9615_device_acpuclk;
+
+extern struct platform_device msm_gpio_device;
diff --git a/drivers/coresight/Makefile b/drivers/coresight/Makefile
index 2ee2093..76aef4c 100644
--- a/drivers/coresight/Makefile
+++ b/drivers/coresight/Makefile
@@ -1,2 +1,2 @@
-obj-$(CONFIG_MSM_QDSS) += coresight.o coresight-etb.o coresight-tpiu.o coresight-funnel.o coresight-stm.o coresight-etm.o
+obj-$(CONFIG_MSM_QDSS) += coresight.o coresight-tpiu.o coresight-etb.o coresight-funnel.o coresight-replicator.o coresight-stm.o coresight-etm.o
diff --git a/drivers/coresight/coresight-etb.c b/drivers/coresight/coresight-etb.c
index 30f4d0c..a9283ee2 100644
--- a/drivers/coresight/coresight-etb.c
+++ b/drivers/coresight/coresight-etb.c
@@ -343,58 +343,41 @@
static int __devinit etb_probe(struct platform_device *pdev)
{
int ret;
+ struct device *dev = &pdev->dev;
struct etb_drvdata *drvdata;
struct resource *res;
struct coresight_desc *desc;
- drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
- if (!drvdata) {
- ret = -ENOMEM;
- goto err_kzalloc_drvdata;
- }
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- ret = -EINVAL;
- goto err_res;
- }
- drvdata->base = ioremap_nocache(res->start, resource_size(res));
- if (!drvdata->base) {
- ret = -EINVAL;
- goto err_ioremap;
- }
+ drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
drvdata->dev = &pdev->dev;
platform_set_drvdata(pdev, drvdata);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENODEV;
+ drvdata->base = devm_ioremap(dev, res->start, resource_size(res));
+ if (!drvdata->base)
+ return -ENOMEM;
+
spin_lock_init(&drvdata->spinlock);
- drvdata->clk = clk_get(drvdata->dev, "core_clk");
- if (IS_ERR(drvdata->clk)) {
- ret = PTR_ERR(drvdata->clk);
- goto err_clk_get;
- }
-
+ drvdata->clk = devm_clk_get(dev, "core_clk");
+ if (IS_ERR(drvdata->clk))
+ return PTR_ERR(drvdata->clk);
ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE);
if (ret)
- goto err_clk_rate;
+ return ret;
- drvdata->buf = kzalloc(ETB_SIZE_WORDS * BYTES_PER_WORD, GFP_KERNEL);
- if (!drvdata->buf) {
- ret = -ENOMEM;
- goto err_kzalloc_buf;
- }
- drvdata->miscdev.name = ((struct coresight_platform_data *)
- (pdev->dev.platform_data))->name;
- drvdata->miscdev.minor = MISC_DYNAMIC_MINOR;
- drvdata->miscdev.fops = &etb_fops;
- ret = misc_register(&drvdata->miscdev);
- if (ret)
- goto err_misc_register;
+ drvdata->buf = devm_kzalloc(dev, ETB_SIZE_WORDS * BYTES_PER_WORD,
+ GFP_KERNEL);
+ if (!drvdata->buf)
+ return -ENOMEM;
- desc = kzalloc(sizeof(*desc), GFP_KERNEL);
- if (!desc) {
- ret = -ENOMEM;
- goto err_kzalloc_desc;
- }
+ desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
+ if (!desc)
+ return -ENOMEM;
desc->type = CORESIGHT_DEV_TYPE_SINK;
desc->subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER;
desc->ops = &etb_cs_ops;
@@ -403,30 +386,21 @@
desc->groups = etb_attr_grps;
desc->owner = THIS_MODULE;
drvdata->csdev = coresight_register(desc);
- if (IS_ERR(drvdata->csdev)) {
- ret = PTR_ERR(drvdata->csdev);
- goto err_coresight_register;
- }
- kfree(desc);
+ if (IS_ERR(drvdata->csdev))
+ return PTR_ERR(drvdata->csdev);
- dev_info(drvdata->dev, "ETB initialized\n");
+ drvdata->miscdev.name = ((struct coresight_platform_data *)
+ (pdev->dev.platform_data))->name;
+ drvdata->miscdev.minor = MISC_DYNAMIC_MINOR;
+ drvdata->miscdev.fops = &etb_fops;
+ ret = misc_register(&drvdata->miscdev);
+ if (ret)
+ goto err;
+
+ dev_info(dev, "ETB initialized\n");
return 0;
-err_coresight_register:
- kfree(desc);
-err_kzalloc_desc:
- misc_deregister(&drvdata->miscdev);
-err_misc_register:
- kfree(drvdata->buf);
-err_kzalloc_buf:
-err_clk_rate:
- clk_put(drvdata->clk);
-err_clk_get:
- iounmap(drvdata->base);
-err_ioremap:
-err_res:
- kfree(drvdata);
-err_kzalloc_drvdata:
- dev_err(drvdata->dev, "ETB init failed\n");
+err:
+ coresight_unregister(drvdata->csdev);
return ret;
}
@@ -434,12 +408,8 @@
{
struct etb_drvdata *drvdata = platform_get_drvdata(pdev);
- coresight_unregister(drvdata->csdev);
misc_deregister(&drvdata->miscdev);
- kfree(drvdata->buf);
- clk_put(drvdata->clk);
- iounmap(drvdata->base);
- kfree(drvdata);
+ coresight_unregister(drvdata->csdev);
return 0;
}
diff --git a/drivers/coresight/coresight-etm.c b/drivers/coresight/coresight-etm.c
index 020e542..d7f657d 100644
--- a/drivers/coresight/coresight-etm.c
+++ b/drivers/coresight/coresight-etm.c
@@ -1505,59 +1505,54 @@
static int __devinit etm_probe(struct platform_device *pdev)
{
int ret;
+ struct device *dev = &pdev->dev;
struct etm_drvdata *drvdata;
struct resource *res;
static int etm_count;
struct coresight_desc *desc;
- drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
- if (!drvdata) {
- ret = -ENOMEM;
- goto err_kzalloc_drvdata;
- }
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- ret = -EINVAL;
- goto err_res;
- }
- drvdata->base = ioremap_nocache(res->start, resource_size(res));
- if (!drvdata->base) {
- ret = -EINVAL;
- goto err_ioremap;
- }
+ drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
drvdata->dev = &pdev->dev;
platform_set_drvdata(pdev, drvdata);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENODEV;
+ drvdata->base = devm_ioremap(dev, res->start, resource_size(res));
+ if (!drvdata->base)
+ return -ENOMEM;
+
mutex_init(&drvdata->mutex);
wake_lock_init(&drvdata->wake_lock, WAKE_LOCK_SUSPEND, "coresight-etm");
pm_qos_add_request(&drvdata->qos_req, PM_QOS_CPU_DMA_LATENCY,
PM_QOS_DEFAULT_VALUE);
- drvdata->cpu = etm_count++;
- drvdata->clk = clk_get(drvdata->dev, "core_clk");
+ drvdata->clk = devm_clk_get(dev, "core_clk");
if (IS_ERR(drvdata->clk)) {
ret = PTR_ERR(drvdata->clk);
- goto err_clk_get;
+ goto err0;
}
-
ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE);
if (ret)
- goto err_clk_rate;
+ goto err0;
+
+ drvdata->cpu = etm_count++;
+
ret = clk_prepare_enable(drvdata->clk);
if (ret)
- goto err_clk_enable;
-
+ goto err0;
ret = etm_init_arch_data(drvdata);
if (ret)
- goto err_arch;
+ goto err1;
etm_init_default_data(drvdata);
-
clk_disable_unprepare(drvdata->clk);
- desc = kzalloc(sizeof(*desc), GFP_KERNEL);
+ desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
if (!desc) {
ret = -ENOMEM;
- goto err_kzalloc_desc;
+ goto err0;
}
desc->type = CORESIGHT_DEV_TYPE_SOURCE;
desc->subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_PROC;
@@ -1569,34 +1564,21 @@
drvdata->csdev = coresight_register(desc);
if (IS_ERR(drvdata->csdev)) {
ret = PTR_ERR(drvdata->csdev);
- goto err_coresight_register;
+ goto err0;
}
- kfree(desc);
- dev_info(drvdata->dev, "ETM initialized\n");
+ dev_info(dev, "ETM initialized\n");
if (boot_enable)
coresight_enable(drvdata->csdev);
return 0;
-err_coresight_register:
- kfree(desc);
-err_kzalloc_desc:
-err_arch:
+err1:
clk_disable_unprepare(drvdata->clk);
-err_clk_enable:
-err_clk_rate:
- clk_put(drvdata->clk);
-err_clk_get:
+err0:
pm_qos_remove_request(&drvdata->qos_req);
wake_lock_destroy(&drvdata->wake_lock);
mutex_destroy(&drvdata->mutex);
- iounmap(drvdata->base);
-err_ioremap:
-err_res:
- kfree(drvdata);
-err_kzalloc_drvdata:
- dev_err(drvdata->dev, "ETM init failed\n");
return ret;
}
@@ -1605,12 +1587,9 @@
struct etm_drvdata *drvdata = platform_get_drvdata(pdev);
coresight_unregister(drvdata->csdev);
- clk_put(drvdata->clk);
pm_qos_remove_request(&drvdata->qos_req);
wake_lock_destroy(&drvdata->wake_lock);
mutex_destroy(&drvdata->mutex);
- iounmap(drvdata->base);
- kfree(drvdata);
return 0;
}
diff --git a/drivers/coresight/coresight-funnel.c b/drivers/coresight/coresight-funnel.c
index 333a07c..5072f7a 100644
--- a/drivers/coresight/coresight-funnel.c
+++ b/drivers/coresight/coresight-funnel.c
@@ -172,43 +172,34 @@
static int __devinit funnel_probe(struct platform_device *pdev)
{
int ret;
+ struct device *dev = &pdev->dev;
struct funnel_drvdata *drvdata;
struct resource *res;
struct coresight_desc *desc;
- drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
- if (!drvdata) {
- ret = -ENOMEM;
- goto err_kzalloc_drvdata;
- }
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- ret = -EINVAL;
- goto err_res;
- }
- drvdata->base = ioremap_nocache(res->start, resource_size(res));
- if (!drvdata->base) {
- ret = -EINVAL;
- goto err_ioremap;
- }
+ drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
drvdata->dev = &pdev->dev;
platform_set_drvdata(pdev, drvdata);
- drvdata->clk = clk_get(drvdata->dev, "core_clk");
- if (IS_ERR(drvdata->clk)) {
- ret = PTR_ERR(drvdata->clk);
- goto err_clk_get;
- }
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENODEV;
+ drvdata->base = devm_ioremap(dev, res->start, resource_size(res));
+ if (!drvdata->base)
+ return -ENOMEM;
+ drvdata->clk = devm_clk_get(dev, "core_clk");
+ if (IS_ERR(drvdata->clk))
+ return PTR_ERR(drvdata->clk);
ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE);
if (ret)
- goto err_clk_rate;
+ return ret;
- desc = kzalloc(sizeof(*desc), GFP_KERNEL);
- if (!desc) {
- ret = -ENOMEM;
- goto err_kzalloc_desc;
- }
+ desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
+ if (!desc)
+ return -ENOMEM;
desc->type = CORESIGHT_DEV_TYPE_LINK;
desc->subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_MERG;
desc->ops = &funnel_cs_ops;
@@ -217,27 +208,11 @@
desc->groups = funnel_attr_grps;
desc->owner = THIS_MODULE;
drvdata->csdev = coresight_register(desc);
- if (IS_ERR(drvdata->csdev)) {
- ret = PTR_ERR(drvdata->csdev);
- goto err_coresight_register;
- }
- kfree(desc);
+ if (IS_ERR(drvdata->csdev))
+ return PTR_ERR(drvdata->csdev);
- dev_info(drvdata->dev, "FUNNEL initialized\n");
+ dev_info(dev, "FUNNEL initialized\n");
return 0;
-err_coresight_register:
- kfree(desc);
-err_kzalloc_desc:
-err_clk_rate:
- clk_put(drvdata->clk);
-err_clk_get:
- iounmap(drvdata->base);
-err_ioremap:
-err_res:
- kfree(drvdata);
-err_kzalloc_drvdata:
- dev_err(drvdata->dev, "FUNNEL init failed\n");
- return ret;
}
static int __devexit funnel_remove(struct platform_device *pdev)
@@ -245,9 +220,6 @@
struct funnel_drvdata *drvdata = platform_get_drvdata(pdev);
coresight_unregister(drvdata->csdev);
- clk_put(drvdata->clk);
- iounmap(drvdata->base);
- kfree(drvdata);
return 0;
}
diff --git a/drivers/coresight/coresight-replicator.c b/drivers/coresight/coresight-replicator.c
new file mode 100644
index 0000000..7fe355d
--- /dev/null
+++ b/drivers/coresight/coresight-replicator.c
@@ -0,0 +1,204 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. 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/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/err.h>
+#include <linux/slab.h>
+#include <linux/clk.h>
+#include <linux/coresight.h>
+
+#include "coresight-priv.h"
+
+
+#define replicator_writel(drvdata, val, off) \
+ __raw_writel((val), drvdata->base + off)
+#define replicator_readl(drvdata, off) \
+ __raw_readl(drvdata->base + off)
+
+#define REPLICATOR_LOCK(drvdata) \
+do { \
+ mb(); \
+ replicator_writel(drvdata, 0x0, CORESIGHT_LAR); \
+} while (0)
+#define REPLICATOR_UNLOCK(drvdata) \
+do { \
+ replicator_writel(drvdata, CORESIGHT_UNLOCK, CORESIGHT_LAR); \
+ mb(); \
+} while (0)
+
+
+#define REPLICATOR_IDFILTER0 (0x000)
+#define REPLICATOR_IDFILTER1 (0x004)
+#define REPLICATOR_ITATBCTR0 (0xEFC)
+#define REPLICATOR_ITATBCTR1 (0xEF8)
+
+
+struct replicator_drvdata {
+ void __iomem *base;
+ struct device *dev;
+ struct coresight_device *csdev;
+ struct clk *clk;
+};
+
+
+static void __replicator_enable(struct replicator_drvdata *drvdata, int outport)
+{
+ REPLICATOR_UNLOCK(drvdata);
+
+ if (outport == 0) {
+ replicator_writel(drvdata, 0x0, REPLICATOR_IDFILTER0);
+ replicator_writel(drvdata, 0xFF, REPLICATOR_IDFILTER1);
+ } else {
+ replicator_writel(drvdata, 0x0, REPLICATOR_IDFILTER1);
+ replicator_writel(drvdata, 0xFF, REPLICATOR_IDFILTER0);
+ }
+
+ REPLICATOR_LOCK(drvdata);
+}
+
+static int replicator_enable(struct coresight_device *csdev, int inport,
+ int outport)
+{
+ struct replicator_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
+ int ret;
+
+ ret = clk_prepare_enable(drvdata->clk);
+ if (ret)
+ return ret;
+
+ __replicator_enable(drvdata, outport);
+
+ dev_info(drvdata->dev, "REPLICATOR enabled\n");
+ return 0;
+}
+
+static void __replicator_disable(struct replicator_drvdata *drvdata,
+ int outport)
+{
+ REPLICATOR_UNLOCK(drvdata);
+
+ if (outport == 0)
+ replicator_writel(drvdata, 0xFF, REPLICATOR_IDFILTER0);
+ else
+ replicator_writel(drvdata, 0xFF, REPLICATOR_IDFILTER1);
+
+ REPLICATOR_LOCK(drvdata);
+}
+
+static void replicator_disable(struct coresight_device *csdev, int inport,
+ int outport)
+{
+ struct replicator_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
+
+ __replicator_disable(drvdata, outport);
+
+ clk_disable_unprepare(drvdata->clk);
+
+ dev_info(drvdata->dev, "REPLICATOR disabled\n");
+}
+
+static const struct coresight_ops_link replicator_link_ops = {
+ .enable = replicator_enable,
+ .disable = replicator_disable,
+};
+
+static const struct coresight_ops replicator_cs_ops = {
+ .link_ops = &replicator_link_ops,
+};
+
+static int __devinit replicator_probe(struct platform_device *pdev)
+{
+ int ret;
+ struct device *dev = &pdev->dev;
+ struct replicator_drvdata *drvdata;
+ struct resource *res;
+ struct coresight_desc *desc;
+
+ drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
+ drvdata->dev = &pdev->dev;
+ platform_set_drvdata(pdev, drvdata);
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENODEV;
+ drvdata->base = devm_ioremap(dev, res->start, resource_size(res));
+ if (!drvdata->base)
+ return -ENOMEM;
+
+ drvdata->clk = devm_clk_get(dev, "core_clk");
+ if (IS_ERR(drvdata->clk))
+ return PTR_ERR(drvdata->clk);
+ ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE);
+ if (ret)
+ return ret;
+
+ desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
+ if (!desc)
+ return -ENOMEM;
+ desc->type = CORESIGHT_DEV_TYPE_LINK;
+ desc->subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT;
+ desc->ops = &replicator_cs_ops;
+ desc->pdata = pdev->dev.platform_data;
+ desc->dev = &pdev->dev;
+ desc->owner = THIS_MODULE;
+ drvdata->csdev = coresight_register(desc);
+ if (IS_ERR(drvdata->csdev))
+ return PTR_ERR(drvdata->csdev);
+
+ dev_info(dev, "REPLICATOR initialized\n");
+ return 0;
+}
+
+static int __devexit replicator_remove(struct platform_device *pdev)
+{
+ struct replicator_drvdata *drvdata = platform_get_drvdata(pdev);
+
+ coresight_unregister(drvdata->csdev);
+ return 0;
+}
+
+static struct of_device_id replicator_match[] = {
+ {.compatible = "coresight-replicator"},
+ {}
+};
+
+static struct platform_driver replicator_driver = {
+ .probe = replicator_probe,
+ .remove = __devexit_p(replicator_remove),
+ .driver = {
+ .name = "coresight-replicator",
+ .owner = THIS_MODULE,
+ .of_match_table = replicator_match,
+ },
+};
+
+static int __init replicator_init(void)
+{
+ return platform_driver_register(&replicator_driver);
+}
+module_init(replicator_init);
+
+static void __exit replicator_exit(void)
+{
+ platform_driver_unregister(&replicator_driver);
+}
+module_exit(replicator_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("CoreSight Replicator driver");
diff --git a/drivers/coresight/coresight-stm.c b/drivers/coresight/coresight-stm.c
index 22928aa..242418c 100644
--- a/drivers/coresight/coresight-stm.c
+++ b/drivers/coresight/coresight-stm.c
@@ -426,34 +426,30 @@
static int __devinit stm_probe(struct platform_device *pdev)
{
int ret;
+ struct device *dev = &pdev->dev;
struct stm_drvdata *drvdata;
struct resource *res;
size_t res_size, bitmap_size;
struct coresight_desc *desc;
- drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
- if (!drvdata) {
- ret = -ENOMEM;
- goto err_kzalloc_drvdata;
- }
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- ret = -EINVAL;
- goto err_res0;
- }
- drvdata->base = ioremap_nocache(res->start, resource_size(res));
- if (!drvdata->base) {
- ret = -EINVAL;
- goto err_ioremap0;
- }
+ drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
+ /* Store the driver data pointer for use in exported functions */
+ stmdrvdata = drvdata;
drvdata->dev = &pdev->dev;
platform_set_drvdata(pdev, drvdata);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENODEV;
+ drvdata->base = devm_ioremap(dev, res->start, resource_size(res));
+ if (!drvdata->base)
+ return -ENOMEM;
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!res) {
- ret = -EINVAL;
- goto err_res1;
- }
+ if (!res)
+ return -ENODEV;
if (boot_nr_channel) {
res_size = min((resource_size_t)(boot_nr_channel *
BYTES_PER_CHANNEL), resource_size(res));
@@ -463,44 +459,25 @@
BYTES_PER_CHANNEL), resource_size(res));
bitmap_size = NR_STM_CHANNEL * sizeof(long);
}
- drvdata->chs.bitmap = kzalloc(bitmap_size, GFP_KERNEL);
- if (!drvdata->chs.bitmap) {
- ret = -ENOMEM;
- goto err_kzalloc_bitmap;
- }
- drvdata->chs.base = ioremap_nocache(res->start, res_size);
- if (!drvdata->chs.base) {
- ret = -EINVAL;
- goto err_ioremap1;
- }
- /* Store the driver data pointer for use in exported functions */
- stmdrvdata = drvdata;
+ drvdata->chs.base = devm_ioremap(dev, res->start, res_size);
+ if (!drvdata->chs.base)
+ return -ENOMEM;
+ drvdata->chs.bitmap = devm_kzalloc(dev, bitmap_size, GFP_KERNEL);
+ if (!drvdata->chs.bitmap)
+ return -ENOMEM;
- drvdata->clk = clk_get(drvdata->dev, "core_clk");
- if (IS_ERR(drvdata->clk)) {
- ret = PTR_ERR(drvdata->clk);
- goto err_clk_get;
- }
-
+ drvdata->clk = devm_clk_get(dev, "core_clk");
+ if (IS_ERR(drvdata->clk))
+ return PTR_ERR(drvdata->clk);
ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE);
if (ret)
- goto err_clk_rate;
-
- drvdata->miscdev.name = ((struct coresight_platform_data *)
- (pdev->dev.platform_data))->name;
- drvdata->miscdev.minor = MISC_DYNAMIC_MINOR;
- drvdata->miscdev.fops = &stm_fops;
- ret = misc_register(&drvdata->miscdev);
- if (ret)
- goto err_misc_register;
+ return ret;
drvdata->entity = OST_ENTITY_ALL;
- desc = kzalloc(sizeof(*desc), GFP_KERNEL);
- if (!desc) {
- ret = -ENOMEM;
- goto err_kzalloc_desc;
- }
+ desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
+ if (!desc)
+ return -ENOMEM;
desc->type = CORESIGHT_DEV_TYPE_SOURCE;
desc->subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE;
desc->ops = &stm_cs_ops;
@@ -509,11 +486,16 @@
desc->groups = stm_attr_grps;
desc->owner = THIS_MODULE;
drvdata->csdev = coresight_register(desc);
- if (IS_ERR(drvdata->csdev)) {
- ret = PTR_ERR(drvdata->csdev);
- goto err_coresight_register;
- }
- kfree(desc);
+ if (IS_ERR(drvdata->csdev))
+ return PTR_ERR(drvdata->csdev);
+
+ drvdata->miscdev.name = ((struct coresight_platform_data *)
+ (pdev->dev.platform_data))->name;
+ drvdata->miscdev.minor = MISC_DYNAMIC_MINOR;
+ drvdata->miscdev.fops = &stm_fops;
+ ret = misc_register(&drvdata->miscdev);
+ if (ret)
+ goto err;
dev_info(drvdata->dev, "STM initialized\n");
@@ -521,25 +503,8 @@
coresight_enable(drvdata->csdev);
return 0;
-err_coresight_register:
- kfree(desc);
-err_kzalloc_desc:
- misc_deregister(&drvdata->miscdev);
-err_misc_register:
-err_clk_rate:
- clk_put(drvdata->clk);
-err_clk_get:
- iounmap(drvdata->chs.base);
-err_ioremap1:
- kfree(drvdata->chs.bitmap);
-err_kzalloc_bitmap:
-err_res1:
- iounmap(drvdata->base);
-err_ioremap0:
-err_res0:
- kfree(drvdata);
-err_kzalloc_drvdata:
- dev_err(drvdata->dev, "STM init failed\n");
+err:
+ coresight_unregister(drvdata->csdev);
return ret;
}
@@ -547,13 +512,8 @@
{
struct stm_drvdata *drvdata = platform_get_drvdata(pdev);
- coresight_unregister(drvdata->csdev);
misc_deregister(&drvdata->miscdev);
- clk_put(drvdata->clk);
- iounmap(drvdata->chs.base);
- kfree(drvdata->chs.bitmap);
- iounmap(drvdata->base);
- kfree(drvdata);
+ coresight_unregister(drvdata->csdev);
return 0;
}
diff --git a/drivers/coresight/coresight-tpiu.c b/drivers/coresight/coresight-tpiu.c
index 570eeb2..fc00ff2 100644
--- a/drivers/coresight/coresight-tpiu.c
+++ b/drivers/coresight/coresight-tpiu.c
@@ -125,50 +125,41 @@
static int __devinit tpiu_probe(struct platform_device *pdev)
{
int ret;
+ struct device *dev = &pdev->dev;
struct tpiu_drvdata *drvdata;
struct resource *res;
struct coresight_desc *desc;
- drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
- if (!drvdata) {
- ret = -ENOMEM;
- goto err_kzalloc_drvdata;
- }
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- ret = -EINVAL;
- goto err_res;
- }
- drvdata->base = ioremap_nocache(res->start, resource_size(res));
- if (!drvdata->base) {
- ret = -EINVAL;
- goto err_ioremap;
- }
+ drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
drvdata->dev = &pdev->dev;
platform_set_drvdata(pdev, drvdata);
- drvdata->clk = clk_get(drvdata->dev, "core_clk");
- if (IS_ERR(drvdata->clk)) {
- ret = PTR_ERR(drvdata->clk);
- goto err_clk_get;
- }
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENODEV;
+ drvdata->base = devm_ioremap(dev, res->start, resource_size(res));
+ if (!drvdata->base)
+ return -ENOMEM;
+ drvdata->clk = devm_clk_get(dev, "core_clk");
+ if (IS_ERR(drvdata->clk))
+ return PTR_ERR(drvdata->clk);
ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE);
if (ret)
- goto err_clk_rate;
+ return ret;
/* Disable tpiu to support older targets that need this */
ret = clk_prepare_enable(drvdata->clk);
if (ret)
- goto err_clk_enable;
+ return ret;
__tpiu_disable(drvdata);
clk_disable_unprepare(drvdata->clk);
- desc = kzalloc(sizeof(*desc), GFP_KERNEL);
- if (!desc) {
- ret = -ENOMEM;
- goto err_kzalloc_desc;
- }
+ desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
+ if (!desc)
+ return -ENOMEM;
desc->type = CORESIGHT_DEV_TYPE_SINK;
desc->subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_PORT;
desc->ops = &tpiu_cs_ops;
@@ -176,28 +167,11 @@
desc->dev = &pdev->dev;
desc->owner = THIS_MODULE;
drvdata->csdev = coresight_register(desc);
- if (IS_ERR(drvdata->csdev)) {
- ret = PTR_ERR(drvdata->csdev);
- goto err_coresight_register;
- }
- kfree(desc);
+ if (IS_ERR(drvdata->csdev))
+ return PTR_ERR(drvdata->csdev);
- dev_info(drvdata->dev, "TPIU initialized\n");
+ dev_info(dev, "TPIU initialized\n");
return 0;
-err_coresight_register:
- kfree(desc);
-err_kzalloc_desc:
-err_clk_enable:
-err_clk_rate:
- clk_put(drvdata->clk);
-err_clk_get:
- iounmap(drvdata->base);
-err_ioremap:
-err_res:
- kfree(drvdata);
-err_kzalloc_drvdata:
- dev_err(drvdata->dev, "TPIU init failed\n");
- return ret;
}
static int __devexit tpiu_remove(struct platform_device *pdev)
@@ -205,9 +179,6 @@
struct tpiu_drvdata *drvdata = platform_get_drvdata(pdev);
coresight_unregister(drvdata->csdev);
- clk_put(drvdata->clk);
- iounmap(drvdata->base);
- kfree(drvdata);
return 0;
}
diff --git a/drivers/gpio/gpio-msm-common.c b/drivers/gpio/gpio-msm-common.c
index bdb8171..46f6460 100644
--- a/drivers/gpio/gpio-msm-common.c
+++ b/drivers/gpio/gpio-msm-common.c
@@ -23,6 +23,7 @@
#include <linux/irqdomain.h>
#include <linux/of.h>
#include <linux/err.h>
+#include <linux/platform_device.h>
#include <asm/mach/irq.h>
@@ -402,59 +403,6 @@
.irq_disable = msm_gpio_irq_disable,
};
-/*
- * This lock class tells lockdep that GPIO irqs are in a different
- * category than their parent, so it won't report false recursion.
- */
-static struct lock_class_key msm_gpio_lock_class;
-
-/* TODO: This should be a real platform_driver */
-static int __devinit msm_gpio_probe(void)
-{
- int ret;
-#ifndef CONFIG_OF
- int irq, i;
-#endif
-
- spin_lock_init(&tlmm_lock);
- bitmap_zero(msm_gpio.enabled_irqs, NR_MSM_GPIOS);
- bitmap_zero(msm_gpio.wake_irqs, NR_MSM_GPIOS);
- bitmap_zero(msm_gpio.dual_edge_irqs, NR_MSM_GPIOS);
- ret = gpiochip_add(&msm_gpio.gpio_chip);
- if (ret < 0)
- return ret;
-
-#ifndef CONFIG_OF
- for (i = 0; i < msm_gpio.gpio_chip.ngpio; ++i) {
- irq = msm_gpio_to_irq(&msm_gpio.gpio_chip, i);
- irq_set_lockdep_class(irq, &msm_gpio_lock_class);
- irq_set_chip_and_handler(irq, &msm_gpio_irq_chip,
- handle_level_irq);
- set_irq_flags(irq, IRQF_VALID);
- }
-#endif
- ret = request_irq(TLMM_MSM_SUMMARY_IRQ, msm_summary_irq_handler,
- IRQF_TRIGGER_HIGH, "msmgpio", NULL);
- if (ret) {
- pr_err("Request_irq failed for TLMM_MSM_SUMMARY_IRQ - %d\n",
- ret);
- return ret;
- }
- return 0;
-}
-
-static int __devexit msm_gpio_remove(void)
-{
- int ret = gpiochip_remove(&msm_gpio.gpio_chip);
-
- if (ret < 0)
- return ret;
-
- irq_set_handler(TLMM_MSM_SUMMARY_IRQ, NULL);
-
- return 0;
-}
-
#ifdef CONFIG_PM
static int msm_gpio_suspend(void)
{
@@ -518,22 +466,6 @@
.resume = msm_gpio_resume,
};
-static int __init msm_gpio_init(void)
-{
- msm_gpio_probe();
- register_syscore_ops(&msm_gpio_syscore_ops);
- return 0;
-}
-
-static void __exit msm_gpio_exit(void)
-{
- unregister_syscore_ops(&msm_gpio_syscore_ops);
- msm_gpio_remove();
-}
-
-postcore_initcall(msm_gpio_init);
-module_exit(msm_gpio_exit);
-
static void msm_tlmm_set_field(const struct tlmm_field_cfg *configs,
unsigned id, unsigned width, unsigned val)
{
@@ -594,6 +526,89 @@
}
EXPORT_SYMBOL(msm_gpio_install_direct_irq);
+/*
+ * This lock class tells lockdep that GPIO irqs are in a different
+ * category than their parent, so it won't report false recursion.
+ */
+static struct lock_class_key msm_gpio_lock_class;
+
+static int __devinit msm_gpio_probe(struct platform_device *pdev)
+{
+ int ret;
+#ifndef CONFIG_OF
+ int irq, i;
+#endif
+ msm_gpio.gpio_chip.dev = &pdev->dev;
+ spin_lock_init(&tlmm_lock);
+ bitmap_zero(msm_gpio.enabled_irqs, NR_MSM_GPIOS);
+ bitmap_zero(msm_gpio.wake_irqs, NR_MSM_GPIOS);
+ bitmap_zero(msm_gpio.dual_edge_irqs, NR_MSM_GPIOS);
+ ret = gpiochip_add(&msm_gpio.gpio_chip);
+ if (ret < 0)
+ return ret;
+
+#ifndef CONFIG_OF
+ for (i = 0; i < msm_gpio.gpio_chip.ngpio; ++i) {
+ irq = msm_gpio_to_irq(&msm_gpio.gpio_chip, i);
+ irq_set_lockdep_class(irq, &msm_gpio_lock_class);
+ irq_set_chip_and_handler(irq, &msm_gpio_irq_chip,
+ handle_level_irq);
+ set_irq_flags(irq, IRQF_VALID);
+ }
+#endif
+ ret = request_irq(TLMM_MSM_SUMMARY_IRQ, msm_summary_irq_handler,
+ IRQF_TRIGGER_HIGH, "msmgpio", NULL);
+ if (ret) {
+ pr_err("Request_irq failed for TLMM_MSM_SUMMARY_IRQ - %d\n",
+ ret);
+ return ret;
+ }
+ register_syscore_ops(&msm_gpio_syscore_ops);
+ return 0;
+}
+
+#ifdef CONFIG_OF
+static struct of_device_id msm_gpio_of_match[] __devinitdata = {
+ {.compatible = "qcom,msm-gpio", },
+ { },
+};
+#endif
+
+static int __devexit msm_gpio_remove(struct platform_device *pdev)
+{
+ int ret;
+
+ unregister_syscore_ops(&msm_gpio_syscore_ops);
+ ret = gpiochip_remove(&msm_gpio.gpio_chip);
+ if (ret < 0)
+ return ret;
+ irq_set_handler(TLMM_MSM_SUMMARY_IRQ, NULL);
+
+ return 0;
+}
+
+static struct platform_driver msm_gpio_driver = {
+ .probe = msm_gpio_probe,
+ .remove = __devexit_p(msm_gpio_remove),
+ .driver = {
+ .name = "msmgpio",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(msm_gpio_of_match),
+ },
+};
+
+static void __exit msm_gpio_exit(void)
+{
+ platform_driver_unregister(&msm_gpio_driver);
+}
+module_exit(msm_gpio_exit);
+
+static int __init msm_gpio_init(void)
+{
+ return platform_driver_register(&msm_gpio_driver);
+}
+postcore_initcall(msm_gpio_init);
+
#ifdef CONFIG_OF
static int msm_gpio_irq_domain_xlate(struct irq_domain *d,
struct device_node *controller,
diff --git a/drivers/media/video/msm_vidc/msm_smem.c b/drivers/media/video/msm_vidc/msm_smem.c
index 76e3592..ff12a5c 100644
--- a/drivers/media/video/msm_vidc/msm_smem.c
+++ b/drivers/media/video/msm_vidc/msm_smem.c
@@ -108,8 +108,6 @@
unsigned long iova = 0;
unsigned long buffer_size = 0;
int rc = 0;
- if (size == 0)
- goto skip_mem_alloc;
flags = flags | ION_HEAP(ION_CP_MM_HEAP_ID);
if (align < 4096)
align = 4096;
@@ -147,7 +145,6 @@
fail_map:
ion_free(client->clnt, hndl);
fail_shared_mem_alloc:
-skip_mem_alloc:
return rc;
}
@@ -236,12 +233,15 @@
struct smem_client *client;
int rc = 0;
struct msm_smem *mem;
-
client = clt;
if (!client) {
pr_err("Invalid client passed\n");
return NULL;
}
+ if (!size) {
+ pr_err("No need to allocate memory of size: %d\n", size);
+ return NULL;
+ }
mem = kzalloc(sizeof(*mem), GFP_KERNEL);
if (!mem) {
pr_err("Failed to allocate shared mem\n");
diff --git a/drivers/media/video/msm_vidc/msm_vidc_common.c b/drivers/media/video/msm_vidc/msm_vidc_common.c
index 58dee31..b07c63b 100644
--- a/drivers/media/video/msm_vidc/msm_vidc_common.c
+++ b/drivers/media/video/msm_vidc/msm_vidc_common.c
@@ -1490,10 +1490,13 @@
struct list_head *ptr, *next;
struct vidc_buffer_addr_info buffer_info;
unsigned long flags;
+ struct hal_buffer_requirements *scratch_buf =
+ &inst->buff_req.buffer[HAL_BUFFER_INTERNAL_SCRATCH];
int i;
+
pr_debug("scratch: num = %d, size = %d\n",
- inst->buff_req.buffer[6].buffer_count_actual,
- inst->buff_req.buffer[6].buffer_size);
+ scratch_buf->buffer_count_actual,
+ scratch_buf->buffer_size);
spin_lock_irqsave(&inst->lock, flags);
if (!list_empty(&inst->internalbufs)) {
list_for_each_safe(ptr, next, &inst->internalbufs) {
@@ -1505,40 +1508,44 @@
}
}
spin_unlock_irqrestore(&inst->lock, flags);
-
-
- for (i = 0; i < inst->buff_req.buffer[6].buffer_count_actual;
+ if (scratch_buf->buffer_size) {
+ for (i = 0; i < scratch_buf->buffer_count_actual;
i++) {
- handle = msm_smem_alloc(inst->mem_client,
- inst->buff_req.buffer[6].buffer_size, 1, 0,
+ handle = msm_smem_alloc(inst->mem_client,
+ scratch_buf->buffer_size, 1, 0,
inst->core->resources.io_map[NS_MAP].domain, 0);
- if (!handle) {
- pr_err("Failed to allocate scratch memory\n");
- rc = -ENOMEM;
- goto err_no_mem;
- }
- binfo = kzalloc(sizeof(*binfo), GFP_KERNEL);
- if (!binfo) {
- pr_err("Out of memory\n");
- rc = -ENOMEM;
- goto err_no_mem;
- }
- binfo->handle = handle;
- spin_lock_irqsave(&inst->lock, flags);
- list_add_tail(&binfo->list, &inst->internalbufs);
- spin_unlock_irqrestore(&inst->lock, flags);
- buffer_info.buffer_size =
- inst->buff_req.buffer[6].buffer_size;
- buffer_info.buffer_type = HAL_BUFFER_INTERNAL_SCRATCH;
- buffer_info.num_buffers = 1;
- buffer_info.align_device_addr = handle->device_addr;
- rc = vidc_hal_session_set_buffers((void *) inst->session,
- &buffer_info);
- if (rc) {
- pr_err("vidc_hal_session_set_buffers failed");
- break;
+ if (!handle) {
+ pr_err("Failed to allocate scratch memory\n");
+ rc = -ENOMEM;
+ goto err_no_mem;
+ }
+ binfo = kzalloc(sizeof(*binfo), GFP_KERNEL);
+ if (!binfo) {
+ pr_err("Out of memory\n");
+ rc = -ENOMEM;
+ goto fail_kzalloc;
+ }
+ binfo->handle = handle;
+ buffer_info.buffer_size = scratch_buf->buffer_size;
+ buffer_info.buffer_type = HAL_BUFFER_INTERNAL_SCRATCH;
+ buffer_info.num_buffers = 1;
+ buffer_info.align_device_addr = handle->device_addr;
+ rc = vidc_hal_session_set_buffers(
+ (void *) inst->session, &buffer_info);
+ if (rc) {
+ pr_err("vidc_hal_session_set_buffers failed");
+ goto fail_set_buffers;
+ }
+ spin_lock_irqsave(&inst->lock, flags);
+ list_add_tail(&binfo->list, &inst->internalbufs);
+ spin_unlock_irqrestore(&inst->lock, flags);
}
}
+ return rc;
+fail_set_buffers:
+ kfree(binfo);
+fail_kzalloc:
+ msm_smem_free(inst->mem_client, handle);
err_no_mem:
return rc;
}
diff --git a/drivers/mfd/wcd9xxx-core.c b/drivers/mfd/wcd9xxx-core.c
index 6d82e11..05707fd 100644
--- a/drivers/mfd/wcd9xxx-core.c
+++ b/drivers/mfd/wcd9xxx-core.c
@@ -12,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of_gpio.h>
#include <linux/slab.h>
#include <linux/mfd/core.h>
#include <linux/mfd/wcd9xxx/wcd9xxx-slimslave.h>
@@ -320,10 +321,12 @@
wcd9xxx_bring_up(wcd9xxx);
- ret = wcd9xxx_irq_init(wcd9xxx);
- if (ret) {
- pr_err("IRQ initialization failed\n");
- goto err;
+ if (wcd9xxx->irq != -1) {
+ ret = wcd9xxx_irq_init(wcd9xxx);
+ if (ret) {
+ pr_err("IRQ initialization failed\n");
+ goto err;
+ }
}
wcd9xxx->idbyte_0 = wcd9xxx_reg_read(wcd9xxx, WCD9XXX_A_CHIP_ID_BYTE_0);
@@ -497,10 +500,15 @@
goto err;
}
- for (i = 0; i < ARRAY_SIZE(pdata->regulator); i++)
- wcd9xxx->supplies[i].supply = pdata->regulator[i].name;
+ wcd9xxx->num_of_supplies = 0;
+ for (i = 0; i < ARRAY_SIZE(pdata->regulator); i++) {
+ if (pdata->regulator[i].name) {
+ wcd9xxx->supplies[i].supply = pdata->regulator[i].name;
+ wcd9xxx->num_of_supplies++;
+ }
+ }
- ret = regulator_bulk_get(wcd9xxx->dev, ARRAY_SIZE(pdata->regulator),
+ ret = regulator_bulk_get(wcd9xxx->dev, wcd9xxx->num_of_supplies,
wcd9xxx->supplies);
if (ret != 0) {
dev_err(wcd9xxx->dev, "Failed to get supplies: err = %d\n",
@@ -508,7 +516,7 @@
goto err_supplies;
}
- for (i = 0; i < ARRAY_SIZE(pdata->regulator); i++) {
+ for (i = 0; i < wcd9xxx->num_of_supplies; i++) {
ret = regulator_set_voltage(wcd9xxx->supplies[i].consumer,
pdata->regulator[i].min_uV, pdata->regulator[i].max_uV);
if (ret) {
@@ -528,7 +536,7 @@
}
}
- ret = regulator_bulk_enable(ARRAY_SIZE(pdata->regulator),
+ ret = regulator_bulk_enable(wcd9xxx->num_of_supplies,
wcd9xxx->supplies);
if (ret != 0) {
dev_err(wcd9xxx->dev, "Failed to enable supplies: err = %d\n",
@@ -538,13 +546,13 @@
return ret;
err_configure:
- for (i = 0; i < ARRAY_SIZE(pdata->regulator); i++) {
+ for (i = 0; i < wcd9xxx->num_of_supplies; i++) {
regulator_set_voltage(wcd9xxx->supplies[i].consumer, 0,
pdata->regulator[i].max_uV);
regulator_set_optimum_mode(wcd9xxx->supplies[i].consumer, 0);
}
err_get:
- regulator_bulk_free(ARRAY_SIZE(pdata->regulator), wcd9xxx->supplies);
+ regulator_bulk_free(wcd9xxx->num_of_supplies, wcd9xxx->supplies);
err_supplies:
kfree(wcd9xxx->supplies);
err:
@@ -556,14 +564,14 @@
{
int i;
- regulator_bulk_disable(ARRAY_SIZE(pdata->regulator),
+ regulator_bulk_disable(wcd9xxx->num_of_supplies,
wcd9xxx->supplies);
- for (i = 0; i < ARRAY_SIZE(pdata->regulator); i++) {
+ for (i = 0; i < wcd9xxx->num_of_supplies; i++) {
regulator_set_voltage(wcd9xxx->supplies[i].consumer, 0,
pdata->regulator[i].max_uV);
regulator_set_optimum_mode(wcd9xxx->supplies[i].consumer, 0);
}
- regulator_bulk_free(ARRAY_SIZE(pdata->regulator), wcd9xxx->supplies);
+ regulator_bulk_free(wcd9xxx->num_of_supplies, wcd9xxx->supplies);
kfree(wcd9xxx->supplies);
}
@@ -792,6 +800,252 @@
return 0;
}
+#define CODEC_DT_MAX_PROP_SIZE 40
+static int wcd9xxx_dt_parse_vreg_info(struct device *dev,
+ struct wcd9xxx_regulator *vreg, const char *vreg_name)
+{
+ int len, ret = 0;
+ const __be32 *prop;
+ char prop_name[CODEC_DT_MAX_PROP_SIZE];
+ struct device_node *regnode = NULL;
+ u32 prop_val;
+
+ snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE, "%s-supply",
+ vreg_name);
+ regnode = of_parse_phandle(dev->of_node, prop_name, 0);
+
+ if (!regnode) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ prop_name, dev->of_node->full_name);
+ return -ENODEV;
+ }
+ vreg->name = vreg_name;
+
+ snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
+ "qcom,%s-voltage", vreg_name);
+ prop = of_get_property(dev->of_node, prop_name, &len);
+
+ if (!prop || (len != (2 * sizeof(__be32)))) {
+ dev_err(dev, "%s %s property\n",
+ prop ? "invalid format" : "no", prop_name);
+ return -ENODEV;
+ } else {
+ vreg->min_uV = be32_to_cpup(&prop[0]);
+ vreg->max_uV = be32_to_cpup(&prop[1]);
+ }
+
+ snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
+ "qcom,%s-current", vreg_name);
+
+ ret = of_property_read_u32(dev->of_node, prop_name, &prop_val);
+ if (ret) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ prop_name, dev->of_node->full_name);
+ return -ENODEV;
+ }
+ vreg->optimum_uA = prop_val;
+
+ dev_info(dev, "%s: vol=[%d %d]uV, curr=[%d]uA\n", vreg->name,
+ vreg->min_uV, vreg->max_uV, vreg->optimum_uA);
+ return 0;
+}
+
+static int wcd9xxx_dt_parse_micbias_info(struct device *dev,
+ struct wcd9xxx_micbias_setting *micbias)
+{
+ int ret = 0;
+ char prop_name[CODEC_DT_MAX_PROP_SIZE];
+ u32 prop_val;
+
+ snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
+ "qcom,cdc-micbias-ldoh-v");
+ ret = of_property_read_u32(dev->of_node, prop_name, &prop_val);
+ if (ret) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ prop_name, dev->of_node->full_name);
+ return -ENODEV;
+ }
+ micbias->ldoh_v = (u8)prop_val;
+
+ snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
+ "qcom,cdc-micbias-cfilt1-mv");
+ ret = of_property_read_u32(dev->of_node, prop_name,
+ &micbias->cfilt1_mv);
+ if (ret) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ prop_name, dev->of_node->full_name);
+ return -ENODEV;
+ }
+
+ snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
+ "qcom,cdc-micbias-cfilt2-mv");
+ ret = of_property_read_u32(dev->of_node, prop_name,
+ &micbias->cfilt2_mv);
+ if (ret) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ prop_name, dev->of_node->full_name);
+ return -ENODEV;
+ }
+
+ snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
+ "qcom,cdc-micbias-cfilt3-mv");
+ ret = of_property_read_u32(dev->of_node, prop_name,
+ &micbias->cfilt3_mv);
+ if (ret) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ prop_name, dev->of_node->full_name);
+ return -ENODEV;
+ }
+
+ snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
+ "qcom,cdc-micbias1-cfilt-sel");
+ ret = of_property_read_u32(dev->of_node, prop_name, &prop_val);
+ if (ret) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ prop_name, dev->of_node->full_name);
+ return -ENODEV;
+ }
+ micbias->bias1_cfilt_sel = (u8)prop_val;
+
+ snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
+ "qcom,cdc-micbias2-cfilt-sel");
+ ret = of_property_read_u32(dev->of_node, prop_name, &prop_val);
+ if (ret) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ prop_name, dev->of_node->full_name);
+ return -ENODEV;
+ }
+ micbias->bias2_cfilt_sel = (u8)prop_val;
+
+ snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
+ "qcom,cdc-micbias3-cfilt-sel");
+ ret = of_property_read_u32(dev->of_node, prop_name, &prop_val);
+ if (ret) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ prop_name, dev->of_node->full_name);
+ return -ENODEV;
+ }
+ micbias->bias3_cfilt_sel = (u8)prop_val;
+
+ snprintf(prop_name, CODEC_DT_MAX_PROP_SIZE,
+ "qcom,cdc-micbias4-cfilt-sel");
+ ret = of_property_read_u32(dev->of_node, prop_name, &prop_val);
+ if (ret) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ prop_name, dev->of_node->full_name);
+ return -ENODEV;
+ }
+ micbias->bias4_cfilt_sel = (u8)prop_val;
+
+ dev_dbg(dev, "ldoh_v %u cfilt1_mv %u cfilt2_mv %u cfilt3_mv %u",
+ (u32)micbias->ldoh_v, (u32)micbias->cfilt1_mv,
+ (u32)micbias->cfilt2_mv, (u32)micbias->cfilt3_mv);
+
+ dev_dbg(dev, "bias1_cfilt_sel %u bias2_cfilt_sel %u\n",
+ (u32)micbias->bias1_cfilt_sel, (u32)micbias->bias2_cfilt_sel);
+
+ dev_dbg(dev, "bias3_cfilt_sel %u bias4_cfilt_sel %u\n",
+ (u32)micbias->bias3_cfilt_sel, (u32)micbias->bias4_cfilt_sel);
+
+ return 0;
+}
+
+static int wcd9xxx_dt_parse_slim_interface_dev_info(struct device *dev,
+ struct slim_device *slim_ifd)
+{
+ int ret = 0;
+ struct property *prop;
+
+ ret = of_property_read_string(dev->of_node, "qcom,cdc-slim-ifd",
+ &slim_ifd->name);
+ if (ret) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ "qcom,cdc-slim-ifd-dev", dev->of_node->full_name);
+ return -ENODEV;
+ }
+ prop = of_find_property(dev->of_node,
+ "qcom,cdc-slim-ifd-elemental-addr", NULL);
+ if (!prop) {
+ dev_err(dev, "Looking up %s property in node %s failed",
+ "qcom,cdc-slim-ifd-elemental-addr",
+ dev->of_node->full_name);
+ return -ENODEV;
+ } else if (prop->length != 6) {
+ dev_err(dev, "invalid codec slim ifd addr. addr length = %d\n",
+ prop->length);
+ return -ENODEV;
+ }
+ memcpy(slim_ifd->e_addr, prop->value, 6);
+
+ return 0;
+}
+
+static char *taiko_supplies[] = {
+ "cdc-vdd-buck", "cdc-vdd-tx-h", "cdc-vdd-rx-h", "cdc-vddpx-1",
+ "cdc-vdd-a-1p2v", "cdc-vddcx-1", "cdc-vddcx-2",
+};
+
+static struct wcd9xxx_pdata *wcd9xxx_populate_dt_pdata(struct device *dev)
+{
+ struct wcd9xxx_pdata *pdata;
+ int ret, i;
+ char **codec_supplies;
+ u32 num_of_supplies = 0;
+
+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata) {
+ dev_err(dev,
+ "could not allocate memory for platform data\n");
+ return NULL;
+ }
+
+ if (!strcmp(dev_name(dev), "taiko-slim-pgd")) {
+ codec_supplies = taiko_supplies;
+ num_of_supplies = ARRAY_SIZE(taiko_supplies);
+ } else {
+ dev_err(dev, "%s unsupported device %s\n",
+ __func__, dev_name(dev));
+ goto err;
+ }
+
+ if (num_of_supplies > ARRAY_SIZE(pdata->regulator)) {
+ dev_err(dev, "%s: Num of supplies %u > max supported %u\n",
+ __func__, num_of_supplies, ARRAY_SIZE(pdata->regulator));
+
+ goto err;
+ }
+
+ for (i = 0; i < num_of_supplies; i++) {
+ ret = wcd9xxx_dt_parse_vreg_info(dev, &pdata->regulator[i],
+ codec_supplies[i]);
+ if (ret)
+ goto err;
+ }
+
+ ret = wcd9xxx_dt_parse_micbias_info(dev, &pdata->micbias);
+ if (ret)
+ goto err;
+
+ pdata->reset_gpio = of_get_named_gpio(dev->of_node,
+ "qcom,cdc-reset-gpio", 0);
+ if (pdata->reset_gpio < 0) {
+ dev_err(dev, "Looking up %s property in node %s failed %d\n",
+ "qcom, cdc-reset-gpio", dev->of_node->full_name,
+ pdata->reset_gpio);
+ goto err;
+ }
+ pdata->irq = -1;
+
+ ret = wcd9xxx_dt_parse_slim_interface_dev_info(dev,
+ &pdata->slimbus_slave_device);
+ if (ret)
+ goto err;
+ return pdata;
+err:
+ devm_kfree(dev, pdata);
+ return NULL;
+}
+
static int wcd9xxx_slim_probe(struct slim_device *slim)
{
struct wcd9xxx *wcd9xxx;
@@ -799,8 +1053,15 @@
int ret = 0;
int sgla_retry_cnt;
- dev_info(&slim->dev, "Initialized slim device %s\n", slim->name);
- pdata = slim->dev.platform_data;
+ if (slim->dev.of_node) {
+ dev_info(&slim->dev, "Platform data from device tree\n");
+ pdata = wcd9xxx_populate_dt_pdata(&slim->dev);
+ slim->dev.platform_data = pdata;
+
+ } else {
+ dev_info(&slim->dev, "Platform data from board file\n");
+ pdata = slim->dev.platform_data;
+ }
if (!pdata) {
dev_err(&slim->dev, "Error, no platform data\n");
@@ -1103,7 +1364,7 @@
};
static const struct slim_device_id taiko_slimtest_id[] = {
- {"taiko-slim", 0},
+ {"taiko-slim-pgd", 0},
{}
};
diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c
index 9614a2d..c2a110c 100644
--- a/drivers/video/msm/mdp.c
+++ b/drivers/video/msm/mdp.c
@@ -1510,10 +1510,13 @@
#ifdef CONFIG_FB_MSM_NO_MDP_PIPE_CTRL
-static void mdp_clk_off(void)
+/*
+ * mdp_clk_disable_unprepare(void) called from thread context
+ */
+static void mdp_clk_disable_unprepare(void)
{
mb();
- vsync_clk_disable();
+ vsync_clk_disable_unprepare();
if (mdp_clk != NULL)
clk_disable_unprepare(mdp_clk);
@@ -1525,8 +1528,10 @@
clk_disable_unprepare(mdp_lut_clk);
}
-
-static void mdp_clk_on(void)
+/*
+ * mdp_clk_prepare_enable(void) called from thread context
+ */
+static void mdp_clk_prepare_enable(void)
{
if (mdp_clk != NULL)
clk_prepare_enable(mdp_clk);
@@ -1537,9 +1542,12 @@
if (mdp_lut_clk != NULL)
clk_prepare_enable(mdp_lut_clk);
- vsync_clk_enable();
+ vsync_clk_prepare_enable();
}
+/*
+ * mdp_clk_ctrl: called from thread context
+ */
void mdp_clk_ctrl(int on)
{
static int mdp_clk_cnt;
@@ -1547,13 +1555,13 @@
mutex_lock(&mdp_suspend_mutex);
if (on) {
if (mdp_clk_cnt == 0)
- mdp_clk_on();
+ mdp_clk_prepare_enable();
mdp_clk_cnt++;
} else {
if (mdp_clk_cnt) {
mdp_clk_cnt--;
if (mdp_clk_cnt == 0)
- mdp_clk_off();
+ mdp_clk_disable_unprepare();
}
}
mutex_unlock(&mdp_suspend_mutex);
diff --git a/drivers/video/msm/mdp.h b/drivers/video/msm/mdp.h
index 12bd1d4..76d06a0 100644
--- a/drivers/video/msm/mdp.h
+++ b/drivers/video/msm/mdp.h
@@ -831,8 +831,8 @@
void mdp3_vsync_irq_disable(int intr, int term);
#ifdef MDP_HW_VSYNC
-void vsync_clk_enable(void);
-void vsync_clk_disable(void);
+void vsync_clk_prepare_enable(void);
+void vsync_clk_disable_unprepare(void);
void mdp_hw_vsync_clk_enable(struct msm_fb_data_type *mfd);
void mdp_hw_vsync_clk_disable(struct msm_fb_data_type *mfd);
void mdp_vsync_clk_disable(void);
diff --git a/drivers/video/msm/mdp4.h b/drivers/video/msm/mdp4.h
index 72e7c8f..767332a 100644
--- a/drivers/video/msm/mdp4.h
+++ b/drivers/video/msm/mdp4.h
@@ -665,24 +665,17 @@
uint32 mdp4_rgb_igc_lut_cvt(uint32 ndx);
void mdp4_vg_qseed_init(int);
int mdp4_overlay_blt(struct fb_info *info, struct msmfb_overlay_blt *req);
-int mdp4_overlay_blt_offset(struct fb_info *info,
- struct msmfb_overlay_blt *req);
-
#ifdef CONFIG_FB_MSM_MIPI_DSI
-int mdp4_dsi_overlay_blt_start(struct msm_fb_data_type *mfd);
-int mdp4_dsi_overlay_blt_stop(struct msm_fb_data_type *mfd);
+void mdp4_dsi_cmd_blt_start(struct msm_fb_data_type *mfd);
+void mdp4_dsi_cmd_blt_stop(struct msm_fb_data_type *mfd);
void mdp4_dsi_video_blt_start(struct msm_fb_data_type *mfd);
void mdp4_dsi_video_blt_stop(struct msm_fb_data_type *mfd);
-void mdp4_dsi_overlay_blt(struct msm_fb_data_type *mfd,
- struct msmfb_overlay_blt *req);
-int mdp4_dsi_overlay_blt_offset(struct msm_fb_data_type *mfd,
+void mdp4_dsi_cmd_overlay_blt(struct msm_fb_data_type *mfd,
struct msmfb_overlay_blt *req);
void mdp4_dsi_video_overlay_blt(struct msm_fb_data_type *mfd,
struct msmfb_overlay_blt *req);
-int mdp4_dsi_video_overlay_blt_offset(struct msm_fb_data_type *mfd,
- struct msmfb_overlay_blt *req);
void mdp4_dsi_video_base_swap(int cndx, struct mdp4_overlay_pipe *pipe);
#ifdef CONFIG_FB_MSM_MDP40
@@ -726,10 +719,9 @@
struct msm_fb_data_type *mfd, struct msmfb_overlay_blt *req)
{
}
-static inline int mdp4_dsi_video_overlay_blt_offset(
+static inline void mdp4_dsi_cmd_overlay_blt(
struct msm_fb_data_type *mfd, struct msmfb_overlay_blt *req)
{
- return -ENODEV;
}
static inline void mdp4_dsi_video_base_swap(int cndx,
struct mdp4_overlay_pipe *pipe)
diff --git a/drivers/video/msm/mdp4_overlay.c b/drivers/video/msm/mdp4_overlay.c
index b3f0b81..9454dfe 100644
--- a/drivers/video/msm/mdp4_overlay.c
+++ b/drivers/video/msm/mdp4_overlay.c
@@ -2522,7 +2522,7 @@
return -EINTR;
if (ctrl->panel_mode & MDP4_PANEL_DSI_CMD)
- mdp4_dsi_overlay_blt(mfd, req);
+ mdp4_dsi_cmd_overlay_blt(mfd, req);
else if (ctrl->panel_mode & MDP4_PANEL_DSI_VIDEO)
mdp4_dsi_video_overlay_blt(mfd, req);
else if (ctrl->panel_mode & MDP4_PANEL_LCDC)
@@ -2650,49 +2650,6 @@
}
}
-static void mdp4_overlay_update_blt_mode(struct msm_fb_data_type *mfd)
-{
- if (mfd->use_ov0_blt == mfd->ov0_blt_state)
- return;
-
- if (mfd->use_ov0_blt) {
- if (mfd->panel_info.type == LCDC_PANEL ||
- mfd->panel_info.type == LVDS_PANEL)
- mdp4_lcdc_overlay_blt_start(mfd);
- else if (mfd->panel_info.type == MIPI_VIDEO_PANEL)
- mdp4_dsi_video_blt_start(mfd);
- else if (ctrl->panel_mode & MDP4_PANEL_DSI_CMD)
- mdp4_dsi_overlay_blt_start(mfd);
- else if (ctrl->panel_mode & MDP4_PANEL_MDDI)
- mdp4_mddi_overlay_blt_start(mfd);
- } else {
- if (mfd->panel_info.type == LCDC_PANEL ||
- mfd->panel_info.type == LVDS_PANEL)
- mdp4_lcdc_overlay_blt_stop(mfd);
- else if (mfd->panel_info.type == MIPI_VIDEO_PANEL)
- mdp4_dsi_video_blt_stop(mfd);
- else if (ctrl->panel_mode & MDP4_PANEL_DSI_CMD)
- mdp4_dsi_overlay_blt_stop(mfd);
- else if (ctrl->panel_mode & MDP4_PANEL_MDDI)
- mdp4_mddi_overlay_blt_stop(mfd);
- }
- mfd->ov0_blt_state = mfd->use_ov0_blt;
-}
-
-static void mdp4_overlay1_update_blt_mode(struct msm_fb_data_type *mfd)
-{
- if (mfd->ov1_blt_state == mfd->use_ov1_blt)
- return;
- if (mfd->use_ov1_blt) {
- mdp4_dtv_overlay_blt_start(mfd);
- pr_debug("%s overlay1 writeback is enabled\n", __func__);
- } else {
- mdp4_dtv_overlay_blt_stop(mfd);
- pr_debug("%s overlay1 writeback is disabled\n", __func__);
- }
- mfd->ov1_blt_state = mfd->use_ov1_blt;
-}
-
static u32 mdp4_overlay_blt_enable(struct mdp_overlay *req,
struct msm_fb_data_type *mfd, uint32 perf_level)
{
@@ -2920,12 +2877,10 @@
}
mfd->use_ov0_blt &= ~(1 << (pipe->pipe_ndx-1));
- mdp4_overlay_update_blt_mode(mfd);
} else { /* mixer1, DTV, ATV */
if (ctrl->panel_mode & MDP4_PANEL_DTV) {
mdp4_overlay_dtv_unset(mfd, pipe);
mfd->use_ov1_blt &= ~(1 << (pipe->pipe_ndx-1));
- mdp4_overlay1_update_blt_mode(mfd);
}
}
@@ -2956,16 +2911,22 @@
int mdp4_overlay_vsync_ctrl(struct fb_info *info, int enable)
{
+ int cmd;
+
+ if (enable)
+ cmd = 1;
+ else
+ cmd = 0;
+
if (!hdmi_prim_display && info->node == 0) {
if (ctrl->panel_mode & MDP4_PANEL_DSI_VIDEO)
- mdp4_dsi_video_vsync_ctrl(0, enable);
+ mdp4_dsi_video_vsync_ctrl(0, cmd);
else if (ctrl->panel_mode & MDP4_PANEL_DSI_CMD)
- mdp4_dsi_cmd_vsync_ctrl(0, enable);
+ mdp4_dsi_cmd_vsync_ctrl(0, cmd);
else if (ctrl->panel_mode & MDP4_PANEL_LCDC)
- mdp4_lcdc_vsync_ctrl(0, enable);
- } else if (hdmi_prim_display || info->node == 1) {
- mdp4_dtv_vsync_ctrl(0, enable);
- }
+ mdp4_lcdc_vsync_ctrl(0, cmd);
+ } else if (hdmi_prim_display || info->node == 1)
+ mdp4_dtv_vsync_ctrl(0, cmd);
return 0;
}
@@ -3182,12 +3143,6 @@
}
}
- if (mfd->use_ov0_blt)
- mdp4_overlay_update_blt_mode(mfd);
-
- if (mfd->use_ov1_blt)
- mdp4_overlay1_update_blt_mode(mfd);
-
if (ctrl->panel_mode & MDP4_PANEL_MDDI)
goto mddi;
diff --git a/drivers/video/msm/mdp4_overlay_dsi_cmd.c b/drivers/video/msm/mdp4_overlay_dsi_cmd.c
index 1781344..e1fa02e 100644
--- a/drivers/video/msm/mdp4_overlay_dsi_cmd.c
+++ b/drivers/video/msm/mdp4_overlay_dsi_cmd.c
@@ -39,7 +39,7 @@
static int vsync_start_y_adjust = 4;
#define MAX_CONTROLLER 1
-#define VSYNC_EXPIRE_TICK 2
+#define VSYNC_EXPIRE_TICK 4
#define BACKLIGHT_MAX 4
struct backlight {
@@ -54,24 +54,34 @@
int inited;
int update_ndx;
int expire_tick;
- uint32 dmap_intr_tot;
+ int blt_wait;
+ u32 ov_koff;
+ u32 ov_done;
+ u32 dmap_koff;
+ u32 dmap_done;
uint32 rdptr_intr_tot;
uint32 rdptr_sirq_tot;
atomic_t suspend;
- int dmap_wait_cnt;
int wait_vsync_cnt;
- int commit_cnt;
+ int blt_change;
+ int blt_free;
+ int blt_end;
+ int fake_vsync;
struct mutex update_lock;
+ struct completion ov_comp;
struct completion dmap_comp;
struct completion vsync_comp;
- spinlock_t dmap_spin_lock;
spinlock_t spin_lock;
+ struct msm_fb_data_type *mfd;
struct mdp4_overlay_pipe *base_pipe;
struct vsync_update vlist[2];
struct backlight blight;
- int vsync_irq_enabled;
+ int vsync_enabled;
+ int clk_enabled;
+ int clk_control;
ktime_t vsync_time;
struct work_struct vsync_work;
+ struct work_struct clk_work;
} vsync_ctrl_db[MAX_CONTROLLER];
static void vsync_irq_enable(int intr, int term)
@@ -80,7 +90,6 @@
spin_lock_irqsave(&mdp_spin_lock, flag);
/* no need to clrear other interrupts for comamnd mode */
- outp32(MDP_INTR_CLEAR, INTR_PRIMARY_RDPTR);
mdp_intr_mask |= intr;
outp32(MDP_INTR_ENABLE, mdp_intr_mask);
mdp_enable_irq(term);
@@ -161,30 +170,7 @@
return cnt;
}
-void mdp4_blt_dmap_cfg(struct mdp4_overlay_pipe *pipe)
-{
- uint32 off, addr;
- int bpp;
-
- if (pipe->ov_blt_addr == 0)
- return;
-
-#ifdef BLT_RGB565
- bpp = 2; /* overlay ouput is RGB565 */
-#else
- bpp = 3; /* overlay ouput is RGB888 */
-#endif
- off = 0;
- if (pipe->blt_dmap_done & 0x01)
- off = pipe->src_height * pipe->src_width * bpp;
- addr = pipe->dma_blt_addr + off;
-
- /* dmap */
- MDP_OUTP(MDP_BASE + 0x90008, addr);
-}
-
-
-void mdp4_blt_overlay0_cfg(struct mdp4_overlay_pipe *pipe)
+static void mdp4_dsi_cmd_blt_ov_update(struct mdp4_overlay_pipe *pipe)
{
uint32 off, addr;
int bpp;
@@ -199,7 +185,7 @@
bpp = 3; /* overlay ouput is RGB888 */
#endif
off = 0;
- if (pipe->blt_ov_done & 0x01)
+ if (pipe->ov_cnt & 0x01)
off = pipe->src_height * pipe->src_width * bpp;
addr = pipe->ov_blt_addr + off;
/* overlay 0 */
@@ -208,32 +194,91 @@
outpdw(overlay_base + 0x001c, addr);
}
-static void vsync_commit_kickoff_dmap(struct mdp4_overlay_pipe *pipe)
+static void mdp4_dsi_cmd_blt_dmap_update(struct mdp4_overlay_pipe *pipe)
{
- if (mipi_dsi_ctrl_lock(1)) {
- mdp4_stat.kickoff_dmap++;
- pipe->blt_dmap_koff++;
- vsync_irq_enable(INTR_DMA_P_DONE, MDP_DMAP_TERM);
- outpdw(MDP_BASE + 0x000c, 0); /* kickoff dmap engine */
- mb();
- }
+ uint32 off, addr;
+ int bpp;
+
+ if (pipe->ov_blt_addr == 0)
+ return;
+
+#ifdef BLT_RGB565
+ bpp = 2; /* overlay ouput is RGB565 */
+#else
+ bpp = 3; /* overlay ouput is RGB888 */
+#endif
+ off = 0;
+ if (pipe->dmap_cnt & 0x01)
+ off = pipe->src_height * pipe->src_width * bpp;
+ addr = pipe->dma_blt_addr + off;
+
+ /* dmap */
+ MDP_OUTP(MDP_BASE + 0x90008, addr);
}
-static void vsync_commit_kickoff_ov0(struct mdp4_overlay_pipe *pipe, int blt)
+static void mdp4_dsi_cmd_wait4dmap(int cndx);
+static void mdp4_dsi_cmd_wait4ov(int cndx);
+
+static void mdp4_dsi_cmd_do_blt(struct msm_fb_data_type *mfd, int enable)
{
- int locked = 1;
+ unsigned long flags;
+ int cndx = 0;
+ struct vsycn_ctrl *vctrl;
+ struct mdp4_overlay_pipe *pipe;
+ int need_wait;
- if (blt)
- vsync_irq_enable(INTR_OVERLAY0_DONE, MDP_OVERLAY0_TERM);
- else
- locked = mipi_dsi_ctrl_lock(1);
+ vctrl = &vsync_ctrl_db[cndx];
+ pipe = vctrl->base_pipe;
- if (locked) {
- mdp4_stat.kickoff_ov0++;
- pipe->blt_ov_koff++;
- outpdw(MDP_BASE + 0x0004, 0); /* kickoff overlay engine */
- mb();
+ mdp4_allocate_writeback_buf(mfd, MDP4_MIXER0);
+
+ if (mfd->ov0_wb_buf->write_addr == 0) {
+ pr_err("%s: no blt_base assigned\n", __func__);
+ return;
}
+
+ spin_lock_irqsave(&vctrl->spin_lock, flags);
+ if (enable && pipe->ov_blt_addr == 0) {
+ vctrl->blt_change++;
+ if (vctrl->dmap_koff != vctrl->dmap_done) {
+ INIT_COMPLETION(vctrl->dmap_comp);
+ need_wait = 1;
+ }
+ } else if (enable == 0 && pipe->ov_blt_addr) {
+ vctrl->blt_change++;
+ if (vctrl->ov_koff != vctrl->dmap_done) {
+ INIT_COMPLETION(vctrl->dmap_comp);
+ need_wait = 1;
+ }
+ }
+ spin_unlock_irqrestore(&vctrl->spin_lock, flags);
+
+ if (need_wait)
+ mdp4_dsi_cmd_wait4dmap(0);
+
+ spin_lock_irqsave(&vctrl->spin_lock, flags);
+ if (enable && pipe->ov_blt_addr == 0) {
+ pipe->ov_blt_addr = mfd->ov0_wb_buf->write_addr;
+ pipe->dma_blt_addr = mfd->ov0_wb_buf->read_addr;
+ pipe->ov_cnt = 0;
+ pipe->dmap_cnt = 0;
+ vctrl->ov_koff = vctrl->dmap_koff;
+ vctrl->ov_done = vctrl->dmap_done;
+ vctrl->blt_free = 0;
+ vctrl->blt_wait = 0;
+ vctrl->blt_end = 0;
+ mdp4_stat.blt_dsi_video++;
+ } else if (enable == 0 && pipe->ov_blt_addr) {
+ pipe->ov_blt_addr = 0;
+ pipe->dma_blt_addr = 0;
+ vctrl->blt_end = 1;
+ vctrl->blt_free = 4; /* 4 commits to free wb buf */
+ }
+
+ pr_debug("%s: changed=%d enable=%d ov_blt_addr=%x\n", __func__,
+ vctrl->blt_change, enable, (int)pipe->ov_blt_addr);
+
+ spin_unlock_irqrestore(&vctrl->spin_lock, flags);
}
/*
@@ -266,95 +311,137 @@
pr_debug("%s: vndx=%d pipe_ndx=%d expire=%x pid=%d\n", __func__,
undx, pipe->pipe_ndx, vctrl->expire_tick, current->pid);
- *pp = *pipe; /* keep it */
+ *pp = *pipe; /* clone it */
vp->update_cnt++;
- if (vctrl->expire_tick == 0) {
- mipi_dsi_clk_cfg(1);
- mdp_clk_ctrl(1);
- vsync_irq_enable(INTR_PRIMARY_RDPTR, MDP_PRIM_RDPTR_TERM);
- }
- vctrl->expire_tick = VSYNC_EXPIRE_TICK;
mutex_unlock(&vctrl->update_lock);
+ mdp4_stat.overlay_play[pipe->mixer_num]++;
}
+static void mdp4_dsi_cmd_blt_ov_update(struct mdp4_overlay_pipe *pipe);
+
int mdp4_dsi_cmd_pipe_commit(void)
{
-
- int i, undx, cnt;
+ int i, undx;
int mixer = 0;
struct vsycn_ctrl *vctrl;
struct vsync_update *vp;
struct mdp4_overlay_pipe *pipe;
unsigned long flags;
- int diff;
+ int need_dmap_wait = 0;
+ int need_ov_wait = 0;
+ int cnt = 0;
vctrl = &vsync_ctrl_db[0];
+
mutex_lock(&vctrl->update_lock);
undx = vctrl->update_ndx;
vp = &vctrl->vlist[undx];
pipe = vctrl->base_pipe;
mixer = pipe->mixer_num;
- pr_debug("%s: vndx=%d cnt=%d expire=%x pid=%d\n", __func__,
- undx, vp->update_cnt, vctrl->expire_tick, current->pid);
-
- cnt = 0;
if (vp->update_cnt == 0) {
mutex_unlock(&vctrl->update_lock);
return cnt;
}
+
vctrl->update_ndx++;
vctrl->update_ndx &= 0x01;
- vctrl->commit_cnt++;
- vp->update_cnt = 0; /* reset */
+ vp->update_cnt = 0; /* reset */
+ if (vctrl->blt_free) {
+ vctrl->blt_free--;
+ if (vctrl->blt_free == 0)
+ mdp4_free_writeback_buf(vctrl->mfd, mixer);
+ }
mutex_unlock(&vctrl->update_lock);
+
mdp4_backlight_commit_level(vctrl);
/* free previous committed iommu back to pool */
mdp4_overlay_iommu_unmap_freelist(mixer);
+ spin_lock_irqsave(&vctrl->spin_lock, flags);
+ if (pipe->ov_blt_addr) {
+ /* Blt */
+ if (vctrl->blt_wait)
+ need_dmap_wait = 1;
+ else if (vctrl->ov_koff != vctrl->ov_done) {
+ INIT_COMPLETION(vctrl->ov_comp);
+ need_ov_wait = 1;
+ }
+ } else {
+ /* direct out */
+ if (vctrl->dmap_koff != vctrl->dmap_done) {
+ INIT_COMPLETION(vctrl->dmap_comp);
+ pr_debug("%s: wait, ok=%d od=%d dk=%d dd=%d cpu=%d\n",
+ __func__, vctrl->ov_koff, vctrl->ov_done,
+ vctrl->dmap_koff, vctrl->dmap_done, smp_processor_id());
+ need_dmap_wait = 1;
+ }
+ }
+ spin_unlock_irqrestore(&vctrl->spin_lock, flags);
+
+ if (need_dmap_wait) {
+ pr_debug("%s: wait4dmap\n", __func__);
+ mdp4_dsi_cmd_wait4dmap(0);
+ }
+
+ if (need_ov_wait) {
+ pr_debug("%s: wait4ov\n", __func__);
+ mdp4_dsi_cmd_wait4ov(0);
+ }
+
+ if (pipe->ov_blt_addr) {
+ if (vctrl->blt_end) {
+ vctrl->blt_end = 0;
+ pipe->ov_blt_addr = 0;
+ pipe->dma_blt_addr = 0;
+ }
+ }
+
+ if (vctrl->blt_change) {
+ mdp4_overlayproc_cfg(pipe);
+ mdp4_overlay_dmap_xy(pipe);
+ vctrl->blt_change = 0;
+ }
+
pipe = vp->plist;
for (i = 0; i < OVERLAY_PIPE_MAX; i++, pipe++) {
if (pipe->pipe_used) {
cnt++;
mdp4_overlay_vsync_commit(pipe);
/* free previous iommu to freelist
- * which will be freed at next
- * pipe_commit
- */
+ * which will be freed at next
+ * pipe_commit
+ */
mdp4_overlay_iommu_pipe_free(pipe->pipe_ndx, 0);
pipe->pipe_used = 0; /* clear */
}
}
+
mdp4_mixer_stage_commit(mixer);
-
- pr_debug("%s: intr=%d expire=%d cpu=%d\n", __func__,
- vctrl->rdptr_intr_tot, vctrl->expire_tick, smp_processor_id());
-
- spin_lock_irqsave(&vctrl->spin_lock, flags);
pipe = vctrl->base_pipe;
- if (pipe->blt_changed) {
- /* blt configurtion changed */
- pipe->blt_changed = 0;
- mdp4_overlayproc_cfg(pipe);
- mdp4_overlay_dmap_xy(pipe);
- }
-
+ spin_lock_irqsave(&vctrl->spin_lock, flags);
if (pipe->ov_blt_addr) {
- diff = pipe->blt_ov_koff - pipe->blt_ov_done;
- if (diff < 1) {
- mdp4_blt_overlay0_cfg(pipe);
- vsync_commit_kickoff_ov0(pipe, 1);
- }
+ mdp4_dsi_cmd_blt_ov_update(pipe);
+ pipe->ov_cnt++;
+ vctrl->ov_koff++;
+ vsync_irq_enable(INTR_OVERLAY0_DONE, MDP_OVERLAY0_TERM);
} else {
- vsync_commit_kickoff_ov0(pipe, 0);
+ vsync_irq_enable(INTR_DMA_P_DONE, MDP_DMAP_TERM);
+ vctrl->dmap_koff++;
}
-
+ pr_debug("%s: kickoff\n", __func__);
+ /* kickoff overlay engine */
+ mdp4_stat.kickoff_ov0++;
+ outpdw(MDP_BASE + 0x0004, 0);
+ mb(); /* make sure kickoff ececuted */
spin_unlock_irqrestore(&vctrl->spin_lock, flags);
+ mdp4_stat.overlay_commit[pipe->mixer_num]++;
+
return cnt;
}
@@ -369,23 +456,15 @@
vctrl = &vsync_ctrl_db[cndx];
- if (vctrl->vsync_irq_enabled == enable)
+ if (enable && vctrl->fake_vsync) {
+ vctrl->fake_vsync = 0;
+ schedule_work(&vctrl->vsync_work);
+ }
+
+ if (vctrl->vsync_enabled == enable)
return;
- vctrl->vsync_irq_enabled = enable;
-
- mutex_lock(&vctrl->update_lock);
- if (enable) {
- mipi_dsi_clk_cfg(1);
- mdp_clk_ctrl(1);
- vsync_irq_enable(INTR_PRIMARY_RDPTR, MDP_PRIM_RDPTR_TERM);
- } else {
- mipi_dsi_clk_cfg(0);
- mdp_clk_ctrl(0);
- vsync_irq_disable(INTR_PRIMARY_RDPTR, MDP_PRIM_RDPTR_TERM);
- vctrl->expire_tick = 0;
- }
- mutex_unlock(&vctrl->update_lock);
+ vctrl->vsync_enabled = enable;
}
void mdp4_dsi_cmd_wait4vsync(int cndx, long long *vtime)
@@ -402,8 +481,10 @@
vctrl = &vsync_ctrl_db[cndx];
pipe = vctrl->base_pipe;
- if (atomic_read(&vctrl->suspend) > 0)
+ if (atomic_read(&vctrl->suspend) > 0) {
+ *vtime = -1;
return;
+ }
spin_lock_irqsave(&vctrl->spin_lock, flags);
if (vctrl->wait_vsync_cnt == 0)
@@ -412,10 +493,44 @@
spin_unlock_irqrestore(&vctrl->spin_lock, flags);
wait_for_completion(&vctrl->vsync_comp);
+ mdp4_stat.wait4vsync0++;
*vtime = ktime_to_ns(vctrl->vsync_time);
}
+static void mdp4_dsi_cmd_wait4dmap(int cndx)
+{
+ struct vsycn_ctrl *vctrl;
+
+ if (cndx >= MAX_CONTROLLER) {
+ pr_err("%s: out or range: cndx=%d\n", __func__, cndx);
+ return;
+ }
+
+ vctrl = &vsync_ctrl_db[cndx];
+
+ if (atomic_read(&vctrl->suspend) > 0)
+ return;
+
+ wait_for_completion(&vctrl->dmap_comp);
+}
+
+static void mdp4_dsi_cmd_wait4ov(int cndx)
+{
+ struct vsycn_ctrl *vctrl;
+
+ if (cndx >= MAX_CONTROLLER) {
+ pr_err("%s: out or range: cndx=%d\n", __func__, cndx);
+ return;
+ }
+
+ vctrl = &vsync_ctrl_db[cndx];
+
+ if (atomic_read(&vctrl->suspend) > 0)
+ return;
+
+ wait_for_completion(&vctrl->ov_comp);
+}
/*
* primary_rdptr_isr:
@@ -427,10 +542,17 @@
struct vsycn_ctrl *vctrl;
vctrl = &vsync_ctrl_db[cndx];
- pr_debug("%s: cpu=%d\n", __func__, smp_processor_id());
+ pr_debug("%s: ISR, cpu=%d\n", __func__, smp_processor_id());
vctrl->rdptr_intr_tot++;
vctrl->vsync_time = ktime_get();
schedule_work(&vctrl->vsync_work);
+
+ spin_lock(&vctrl->spin_lock);
+ if (vctrl->wait_vsync_cnt) {
+ complete(&vctrl->vsync_comp);
+ vctrl->wait_vsync_cnt = 0;
+ }
+ spin_unlock(&vctrl->spin_lock);
}
void mdp4_dmap_done_dsi_cmd(int cndx)
@@ -439,35 +561,34 @@
struct mdp4_overlay_pipe *pipe;
int diff;
- vsync_irq_disable(INTR_DMA_P_DONE, MDP_DMAP_TERM);
-
vctrl = &vsync_ctrl_db[cndx];
- vctrl->dmap_intr_tot++;
pipe = vctrl->base_pipe;
- if (pipe->ov_blt_addr == 0) {
- mdp4_overlay_dma_commit(cndx);
- return;
- }
-
/* blt enabled */
spin_lock(&vctrl->spin_lock);
- pipe->blt_dmap_done++;
- diff = pipe->blt_ov_done - pipe->blt_dmap_done;
- spin_unlock(&vctrl->spin_lock);
- pr_debug("%s: ov_done=%d dmap_done=%d ov_koff=%d dmap_koff=%d\n",
- __func__, pipe->blt_ov_done, pipe->blt_dmap_done,
- pipe->blt_ov_koff, pipe->blt_dmap_koff);
+ vsync_irq_disable(INTR_DMA_P_DONE, MDP_DMAP_TERM);
+ vctrl->dmap_done++;
+ diff = vctrl->ov_done - vctrl->dmap_done;
+ pr_debug("%s: ov_koff=%d ov_done=%d dmap_koff=%d dmap_done=%d cpu=%d\n",
+ __func__, vctrl->ov_koff, vctrl->ov_done, vctrl->dmap_koff,
+ vctrl->dmap_done, smp_processor_id());
+ complete_all(&vctrl->dmap_comp);
if (diff <= 0) {
- if (pipe->blt_end) {
- pipe->blt_end = 0;
- pipe->ov_blt_addr = 0;
- pipe->dma_blt_addr = 0;
- pipe->blt_changed = 1;
- pr_info("%s: BLT-END\n", __func__);
- }
+ if (vctrl->blt_wait)
+ vctrl->blt_wait = 0;
+ spin_unlock(&vctrl->spin_lock);
+ return;
}
- spin_unlock(&dsi_clk_lock);
+
+ /* kick dmap */
+ mdp4_dsi_cmd_blt_dmap_update(pipe);
+ pipe->dmap_cnt++;
+ mdp4_stat.kickoff_dmap++;
+ vctrl->dmap_koff++;
+ vsync_irq_enable(INTR_DMA_P_DONE, MDP_DMAP_TERM);
+ outpdw(MDP_BASE + 0x000c, 0); /* kickoff dmap engine */
+ mb(); /* make sure kickoff executed */
+ spin_unlock(&vctrl->spin_lock);
}
/*
@@ -479,30 +600,61 @@
struct mdp4_overlay_pipe *pipe;
int diff;
- vsync_irq_disable(INTR_OVERLAY0_DONE, MDP_OVERLAY0_TERM);
-
vctrl = &vsync_ctrl_db[cndx];
pipe = vctrl->base_pipe;
spin_lock(&vctrl->spin_lock);
- pipe->blt_ov_done++;
- diff = pipe->blt_ov_done - pipe->blt_dmap_done;
- spin_unlock(&vctrl->spin_lock);
+ vsync_irq_disable(INTR_OVERLAY0_DONE, MDP_OVERLAY0_TERM);
+ vctrl->ov_done++;
+ complete_all(&vctrl->ov_comp);
+ diff = vctrl->ov_done - vctrl->dmap_done;
- pr_debug("%s: ov_done=%d dmap_done=%d ov_koff=%d dmap_koff=%d diff=%d\n",
- __func__, pipe->blt_ov_done, pipe->blt_dmap_done,
- pipe->blt_ov_koff, pipe->blt_dmap_koff, diff);
+ pr_debug("%s: ov_koff=%d ov_done=%d dmap_koff=%d dmap_done=%d cpu=%d\n",
+ __func__, vctrl->ov_koff, vctrl->ov_done, vctrl->dmap_koff,
+ vctrl->dmap_done, smp_processor_id());
if (pipe->ov_blt_addr == 0) {
/* blt disabled */
- pr_debug("%s: NON-BLT\n", __func__);
+ spin_unlock(&vctrl->spin_lock);
return;
}
- if (diff == 1) {
- mdp4_blt_dmap_cfg(pipe);
- vsync_commit_kickoff_dmap(pipe);
+ if (diff > 1) {
+ /*
+ * two overlay_done and none dmap_done yet
+ * let dmap_done kickoff dmap
+ * and put pipe_commit to wait
+ */
+ vctrl->blt_wait = 1;
+ pr_debug("%s: blt_wait set\n", __func__);
+ spin_unlock(&vctrl->spin_lock);
+ return;
}
+ mdp4_dsi_cmd_blt_dmap_update(pipe);
+ pipe->dmap_cnt++;
+ mdp4_stat.kickoff_dmap++;
+ vctrl->dmap_koff++;
+ vsync_irq_enable(INTR_DMA_P_DONE, MDP_DMAP_TERM);
+ outpdw(MDP_BASE + 0x000c, 0); /* kickoff dmap engine */
+ mb(); /* make sure kickoff executed */
+ spin_unlock(&vctrl->spin_lock);
+}
+
+static void clk_ctrl_work(struct work_struct *work)
+{
+ struct vsycn_ctrl *vctrl =
+ container_of(work, typeof(*vctrl), clk_work);
+
+ mutex_lock(&vctrl->update_lock);
+ if (vctrl->clk_control) {
+ if (vctrl->clk_enabled) {
+ mdp_clk_ctrl(0);
+ vctrl->clk_enabled = 0;
+ vctrl->fake_vsync = 1;
+ }
+ }
+
+ mutex_unlock(&vctrl->update_lock);
}
static void send_vsync_work(struct work_struct *work)
@@ -539,11 +691,12 @@
vctrl->blight.get = 0;
vctrl->blight.tot = 0;
mutex_init(&vctrl->update_lock);
- init_completion(&vctrl->vsync_comp);
+ init_completion(&vctrl->ov_comp);
init_completion(&vctrl->dmap_comp);
+ init_completion(&vctrl->vsync_comp);
spin_lock_init(&vctrl->spin_lock);
- spin_lock_init(&vctrl->dmap_spin_lock);
INIT_WORK(&vctrl->vsync_work, send_vsync_work);
+ INIT_WORK(&vctrl->clk_work, clk_ctrl_work);
}
void mdp4_primary_rdptr(void)
@@ -701,7 +854,7 @@
pipe->ov_blt_addr = 0;
pipe->dma_blt_addr = 0;
- MDP_OUTP(MDP_BASE + 0x021c, 0x10); /* read pointer */
+ MDP_OUTP(MDP_BASE + 0x021c, 10); /* read pointer */
/*
* configure dsi stream id
@@ -727,8 +880,6 @@
/* MDP cmd block disable */
mdp_clk_ctrl(0);
-
- wmb();
}
/* 3D side by side */
@@ -808,78 +959,20 @@
mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_OFF, FALSE);
}
-int mdp4_dsi_overlay_blt_start(struct msm_fb_data_type *mfd)
+void mdp4_dsi_cmd_blt_start(struct msm_fb_data_type *mfd)
{
- unsigned long flag;
- int cndx = 0;
- struct vsycn_ctrl *vctrl;
- struct mdp4_overlay_pipe *pipe;
-
- vctrl = &vsync_ctrl_db[cndx];
- pipe = vctrl->base_pipe;
-
- pr_debug("%s: blt_end=%d blt_addr=%x pid=%d\n",
- __func__, pipe->blt_end, (int)pipe->ov_blt_addr, current->pid);
-
- mdp4_allocate_writeback_buf(mfd, MDP4_MIXER0);
-
- if (mfd->ov0_wb_buf->write_addr == 0) {
- pr_err("%s: no blt_base assigned\n", __func__);
- return -EBUSY;
- }
-
- if (pipe->ov_blt_addr == 0) {
- spin_lock_irqsave(&vctrl->spin_lock, flag);
- pipe->blt_end = 0;
- pipe->blt_cnt = 0;
- pipe->blt_changed = 1;
- pipe->ov_cnt = 0;
- pipe->dmap_cnt = 0;
- pipe->blt_ov_koff = 0;
- pipe->blt_dmap_koff = 0;
- pipe->blt_ov_done = 0;
- pipe->blt_dmap_done = 0;
- pipe->ov_blt_addr = mfd->ov0_wb_buf->write_addr;
- pipe->dma_blt_addr = mfd->ov0_wb_buf->read_addr;
- mdp4_stat.blt_dsi_cmd++;
- spin_unlock_irqrestore(&vctrl->spin_lock, flag);
- return 0;
- }
-
- return -EBUSY;
+ mdp4_dsi_cmd_do_blt(mfd, 1);
}
-int mdp4_dsi_overlay_blt_stop(struct msm_fb_data_type *mfd)
+void mdp4_dsi_cmd_blt_stop(struct msm_fb_data_type *mfd)
{
- unsigned long flag;
- int cndx = 0;
- struct vsycn_ctrl *vctrl;
- struct mdp4_overlay_pipe *pipe;
-
- vctrl = &vsync_ctrl_db[cndx];
- pipe = vctrl->base_pipe;
-
- pr_info("%s: blt_end=%d blt_addr=%x pid=%d\n",
- __func__, pipe->blt_end, (int)pipe->ov_blt_addr, current->pid);
-
- if ((pipe->blt_end == 0) && pipe->ov_blt_addr) {
- spin_lock_irqsave(&vctrl->spin_lock, flag);
- pipe->blt_end = 1; /* mark as end */
- spin_unlock_irqrestore(&vctrl->spin_lock, flag);
- return 0;
- }
-
- return -EBUSY;
+ mdp4_dsi_cmd_do_blt(mfd, 0);
}
-void mdp4_dsi_overlay_blt(struct msm_fb_data_type *mfd,
+void mdp4_dsi_cmd_overlay_blt(struct msm_fb_data_type *mfd,
struct msmfb_overlay_blt *req)
{
- if (req->enable)
- mdp4_dsi_overlay_blt_start(mfd);
- else if (req->enable == 0)
- mdp4_dsi_overlay_blt_stop(mfd);
-
+ mdp4_dsi_cmd_do_blt(mfd, req->enable);
}
int mdp4_dsi_cmd_on(struct platform_device *pdev)
@@ -894,9 +987,11 @@
mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev);
vctrl = &vsync_ctrl_db[cndx];
+ vctrl->mfd = mfd;
vctrl->dev = mfd->fbi->dev;
mdp_clk_ctrl(1);
+ vsync_irq_enable(INTR_PRIMARY_RDPTR, MDP_PRIM_RDPTR_TERM);
if (vctrl->base_pipe == NULL)
mdp4_overlay_update_dsi_cmd(mfd);
@@ -931,16 +1026,16 @@
atomic_set(&vctrl->suspend, 1);
- /* make sure dsi clk is on so that
- * at panel_next_off() dsi panel can be shut off
- */
- mipi_dsi_ahb_ctrl(1);
- mipi_dsi_clk_enable();
+ mipi_dsi_cmd_backlight_tx(150);
mdp4_mixer_stage_down(pipe);
mdp4_overlay_pipe_free(pipe);
vctrl->base_pipe = NULL;
+ vctrl->fake_vsync = 1;
+
+ vsync_irq_disable(INTR_PRIMARY_RDPTR, MDP_PRIM_RDPTR_TERM);
+
pr_info("%s-:\n", __func__);
/*
@@ -983,12 +1078,14 @@
int cndx = 0;
struct vsycn_ctrl *vctrl;
struct mdp4_overlay_pipe *pipe;
+ long long xx;
vctrl = &vsync_ctrl_db[cndx];
if (!mfd->panel_power_on)
return;
+ vctrl->clk_control = 0;
pipe = vctrl->base_pipe;
if (pipe == NULL) {
pr_err("%s: NO base pipe\n", __func__);
@@ -1000,5 +1097,19 @@
mdp4_overlay_setup_pipe_addr(mfd, pipe);
mdp4_dsi_cmd_pipe_queue(0, pipe);
}
+
+ if (mfd->use_ov0_blt != mfd->ov0_blt_state) {
+
+ if (mfd->use_ov0_blt)
+ mdp4_dsi_cmd_do_blt(mfd, 1);
+ else
+ mdp4_dsi_cmd_do_blt(mfd, 0);
+
+ mfd->ov0_blt_state = mfd->use_ov0_blt;
+ }
+
mdp4_dsi_cmd_pipe_commit();
+ mdp4_dsi_cmd_wait4vsync(0, &xx);
+ vctrl->expire_tick = VSYNC_EXPIRE_TICK;
+ vctrl->clk_control = 1;
}
diff --git a/drivers/video/msm/mdp4_overlay_dsi_video.c b/drivers/video/msm/mdp4_overlay_dsi_video.c
index 9f1bfda..340faa2 100644
--- a/drivers/video/msm/mdp4_overlay_dsi_video.c
+++ b/drivers/video/msm/mdp4_overlay_dsi_video.c
@@ -997,6 +997,16 @@
mdp4_dsi_video_pipe_queue(0, pipe);
}
+ if (mfd->use_ov0_blt != mfd->ov0_blt_state) {
+
+ if (mfd->use_ov0_blt)
+ mdp4_dsi_video_do_blt(mfd, 1);
+ else
+ mdp4_dsi_video_do_blt(mfd, 0);
+
+ mfd->ov0_blt_state = mfd->use_ov0_blt;
+ }
+
mdp4_dsi_video_pipe_commit();
if (pipe->ov_blt_addr)
diff --git a/drivers/video/msm/mdp4_overlay_lcdc.c b/drivers/video/msm/mdp4_overlay_lcdc.c
index cae523f..feba8b8 100644
--- a/drivers/video/msm/mdp4_overlay_lcdc.c
+++ b/drivers/video/msm/mdp4_overlay_lcdc.c
@@ -900,6 +900,16 @@
mdp4_lcdc_pipe_queue(0, pipe);
}
+ if (mfd->use_ov0_blt != mfd->ov0_blt_state) {
+
+ if (mfd->use_ov0_blt)
+ mdp4_lcdc_do_blt(mfd, 1);
+ else
+ mdp4_lcdc_do_blt(mfd, 0);
+
+ mfd->ov0_blt_state = mfd->use_ov0_blt;
+ }
+
mdp4_lcdc_pipe_commit();
if (pipe->ov_blt_addr)
diff --git a/drivers/video/msm/mdp_vsync.c b/drivers/video/msm/mdp_vsync.c
index 966b40d..cc350d3 100644
--- a/drivers/video/msm/mdp_vsync.c
+++ b/drivers/video/msm/mdp_vsync.c
@@ -74,14 +74,13 @@
static uint32 vsync_cnt_cfg;
-
-void vsync_clk_enable()
+void vsync_clk_prepare_enable(void)
{
if (mdp_vsync_clk)
clk_prepare_enable(mdp_vsync_clk);
}
-void vsync_clk_disable()
+void vsync_clk_disable_unprepare(void)
{
if (mdp_vsync_clk)
clk_disable_unprepare(mdp_vsync_clk);
diff --git a/drivers/video/msm/mipi_dsi_host.c b/drivers/video/msm/mipi_dsi_host.c
index 4afffb0..39e2d6d 100644
--- a/drivers/video/msm/mipi_dsi_host.c
+++ b/drivers/video/msm/mipi_dsi_host.c
@@ -1151,15 +1151,11 @@
spin_lock_irqsave(&dsi_mdp_lock, flag);
dsi_mdp_busy = TRUE;
- spin_unlock_irqrestore(&dsi_mdp_lock, flag);
-
led_pwm1[1] = (unsigned char)(level);
tp = &dsi_tx_buf;
cmd = &backlight_cmd;
mipi_dsi_buf_init(&dsi_tx_buf);
-
-
if (tp->dmap) {
dma_unmap_single(&dsi_dev, tp->dmap, tp->len, DMA_TO_DEVICE);
tp->dmap = 0;
@@ -1180,10 +1176,6 @@
wmb();
MIPI_OUTP(MIPI_DSI_BASE + 0x08c, 0x01); /* trigger */
wmb();
-
- spin_lock_irqsave(&dsi_mdp_lock, flag);
- dsi_mdp_busy = FALSE;
- complete(&dsi_mdp_comp);
spin_unlock_irqrestore(&dsi_mdp_lock, flag);
}
@@ -1383,6 +1375,8 @@
int mipi_dsi_cmd_dma_tx(struct dsi_buf *tp)
{
+ unsigned long flags;
+
#ifdef DSI_HOST_DEBUG
int i;
char *bp;
@@ -1396,6 +1390,7 @@
pr_debug("\n");
#endif
+ spin_lock_irqsave(&dsi_mdp_lock, flags);
tp->len += 3;
tp->len &= ~0x03; /* multipled by 4 */
@@ -1410,6 +1405,7 @@
wmb();
MIPI_OUTP(MIPI_DSI_BASE + 0x08c, 0x01); /* trigger */
wmb();
+ spin_unlock_irqrestore(&dsi_mdp_lock, flags);
wait_for_completion(&dsi_dma_comp);
@@ -1549,8 +1545,8 @@
if (isr & DSI_INTR_CMD_DMA_DONE) {
mipi_dsi_mdp_stat_inc(STAT_DSI_CMD);
- complete(&dsi_dma_comp);
spin_lock(&dsi_mdp_lock);
+ complete(&dsi_dma_comp);
dsi_ctrl_lock = FALSE;
mipi_dsi_disable_irq_nosync();
spin_unlock(&dsi_mdp_lock);
diff --git a/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_metadata.c b/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_metadata.c
index 267e924..fade821 100644
--- a/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_metadata.c
+++ b/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_metadata.c
@@ -217,6 +217,7 @@
DDL_METADATA_ALIGNSIZE(suffix);
decoder->suffix = suffix;
output_buf_req->sz += suffix;
+ decoder->meta_data_offset = 0;
DDL_MSG_LOW("metadata output buf size : %d", suffix);
}
diff --git a/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_properties.c b/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_properties.c
index 2d3bee3..033457d 100644
--- a/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_properties.c
+++ b/drivers/video/msm/vidc/1080p/ddl/vcd_ddl_properties.c
@@ -1953,11 +1953,7 @@
DDL_TILE_MULTIPLY_FACTOR);
total_memory_size += component_mem_size;
} else {
- if (decoding)
- total_memory_size = frame_sz.scan_lines *
- frame_sz.stride;
- else
- total_memory_size = frame_sz.height * frame_sz.stride;
+ total_memory_size = frame_sz.scan_lines * frame_sz.stride;
c_offset = DDL_ALIGN(total_memory_size,
DDL_LINEAR_MULTIPLY_FACTOR);
total_memory_size = c_offset + DDL_ALIGN(
diff --git a/include/linux/mfd/wcd9xxx/core.h b/include/linux/mfd/wcd9xxx/core.h
index 17be2cb..105c2cb 100644
--- a/include/linux/mfd/wcd9xxx/core.h
+++ b/include/linux/mfd/wcd9xxx/core.h
@@ -144,6 +144,7 @@
int (*write_dev)(struct wcd9xxx *wcd9xxx, unsigned short reg,
int bytes, void *src, bool interface_reg);
+ u32 num_of_supplies;
struct regulator_bulk_data *supplies;
enum wcd9xxx_pm_state pm_state;
diff --git a/include/linux/mfd/wcd9xxx/pdata.h b/include/linux/mfd/wcd9xxx/pdata.h
index 1b7706b..e831f0b 100644
--- a/include/linux/mfd/wcd9xxx/pdata.h
+++ b/include/linux/mfd/wcd9xxx/pdata.h
@@ -125,7 +125,7 @@
unsigned int hph_ocp_limit:3; /* Headphone OCP current limit */
};
-#define MAX_REGULATOR 6
+#define MAX_REGULATOR 7
/*
* format : TABLA_<POWER_SUPPLY_PIN_NAME>_CUR_MAX
*
diff --git a/sound/soc/codecs/wcd9320.c b/sound/soc/codecs/wcd9320.c
index 6da9166..01820eb 100644
--- a/sound/soc/codecs/wcd9320.c
+++ b/sound/soc/codecs/wcd9320.c
@@ -6817,18 +6817,21 @@
struct snd_soc_codec *codec = taiko->codec;
struct wcd9xxx_pdata *pdata = taiko->pdata;
int k1, k2, k3, rc = 0;
- u8 leg_mode = pdata->amic_settings.legacy_mode;
- u8 txfe_bypass = pdata->amic_settings.txfe_enable;
- u8 txfe_buff = pdata->amic_settings.txfe_buff;
- u8 flag = pdata->amic_settings.use_pdata;
+ u8 leg_mode, txfe_bypass, txfe_buff, flag;
u8 i = 0, j = 0;
u8 val_txfe = 0, value = 0;
if (!pdata) {
+ pr_err("%s: NULL pdata\n", __func__);
rc = -ENODEV;
goto done;
}
+ leg_mode = pdata->amic_settings.legacy_mode;
+ txfe_bypass = pdata->amic_settings.txfe_enable;
+ txfe_buff = pdata->amic_settings.txfe_buff;
+ flag = pdata->amic_settings.use_pdata;
+
/* Make sure settings are correct */
if ((pdata->micbias.ldoh_v > TAIKO_LDOH_2P85_V) ||
(pdata->micbias.bias1_cfilt_sel > TAIKO_CFILT3_SEL) ||