From e3dba0489437fc732b944743bed2258fc861f95d Mon Sep 17 00:00:00 2001 From: Hardik Kantilal Patel <hkpatel@codeaurora.org> Date: Sun, 2 Mar 2014 09:38:03 -0800 Subject: [PATCH] wcnss: Pronto and IRIS voltage regulator change for 8x16 Set Pronto and IRIS voltage regulator according to 8x16 power grid requirment. Change-Id: I0b3b2dcb3cf82bc23e5d047809fa31a5e6b9b337 CRs-fixed: 567674 Signed-off-by: Hardik Kantilal Patel <hkpatel@codeaurora.org> --- .../devicetree/bindings/wcnss/wcnss-wlan.txt | 4 + arch/arm/boot/dts/qcom/msm8916.dtsi | 1 + drivers/net/wireless/wcnss/wcnss_vreg.c | 84 +++++++++++++++---- drivers/net/wireless/wcnss/wcnss_wlan.c | 5 ++ include/linux/wcnss_wlan.h | 1 + 5 files changed, 79 insertions(+), 16 deletions(-) diff --git a/Documentation/devicetree/bindings/wcnss/wcnss-wlan.txt b/Documentation/devicetree/bindings/wcnss/wcnss-wlan.txt index 615eae840e08..b836da0bb6b1 100644 --- a/Documentation/devicetree/bindings/wcnss/wcnss-wlan.txt +++ b/Documentation/devicetree/bindings/wcnss/wcnss-wlan.txt @@ -34,6 +34,9 @@ Optional properties: should be performed during boot up. - qcom,wlan-rx-buff-count: WLAN RX buffer count is a configurable value, using a smaller count for this buffer will reduce the memory usage. +- qcom,is-pronto-vt: boolean flag to determine the pronto hardware version +in use. subsequently Pronto and IRIS voltage regulator range is configured +according to the ponto HW version Example: @@ -56,6 +59,7 @@ Example: gpios = <&msmgpio 36 0>, <&msmgpio 37 0>, <&msmgpio 38 0>, <&msmgpio 39 0>, <&msmgpio 40 0>; qcom,has-48mhz-xo; + qcom,is-pronto-vt; qcom,has-pronto-hw; qcom,wcnss-adc_tm = <&pm8226_adc_tm>; diff --git a/arch/arm/boot/dts/qcom/msm8916.dtsi b/arch/arm/boot/dts/qcom/msm8916.dtsi index ec04d2d16210..86a4c1677bcf 100644 --- a/arch/arm/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm/boot/dts/qcom/msm8916.dtsi @@ -1155,6 +1155,7 @@ pinctrl-1 = <&wcnss_sleep>; qcom,has-autodetect-xo; + qcom,is-pronto-vt; qcom,has-pronto-hw; }; diff --git a/drivers/net/wireless/wcnss/wcnss_vreg.c b/drivers/net/wireless/wcnss/wcnss_vreg.c index eca1c3900a44..8055dcd7924b 100644 --- a/drivers/net/wireless/wcnss/wcnss_vreg.c +++ b/drivers/net/wireless/wcnss/wcnss_vreg.c @@ -112,6 +112,29 @@ static struct vregs_info pronto_vregs[] = { 1800000, 0, NULL}, }; +/* IRIS regulators for Pronto v2 hardware */ +static struct vregs_info iris_vregs_pronto_v2[] = { + {"qcom,iris-vddxo", VREG_NULL_CONFIG, 1800000, 0, + 1800000, 10000, NULL}, + {"qcom,iris-vddrfa", VREG_NULL_CONFIG, 1300000, 0, + 1300000, 100000, NULL}, + {"qcom,iris-vddpa", VREG_NULL_CONFIG, 3300000, 0, + 3300000, 515000, NULL}, + {"qcom,iris-vdddig", VREG_NULL_CONFIG, 1800000, 0, + 1800000, 10000, NULL}, +}; + +/* WCNSS regulators for Pronto v2 hardware */ +static struct vregs_info pronto_vregs_pronto_v2[] = { + {"qcom,pronto-vddmx", VREG_NULL_CONFIG, 1287500, 0, + 1287500, 0, NULL}, + {"qcom,pronto-vddcx", VREG_NULL_CONFIG, RPM_REGULATOR_CORNER_NORMAL, + RPM_REGULATOR_CORNER_NONE, RPM_REGULATOR_CORNER_SUPER_TURBO, + 0, NULL}, + {"qcom,pronto-vddpx", VREG_NULL_CONFIG, 1800000, 0, + 1800000, 0, NULL}, +}; + struct host_driver { char name[20]; @@ -418,15 +441,21 @@ fail: } -static void wcnss_iris_vregs_off(enum wcnss_hw_type hw_type) +static void wcnss_iris_vregs_off(enum wcnss_hw_type hw_type, + int is_pronto_vt) { switch (hw_type) { case WCNSS_RIVA_HW: wcnss_vregs_off(iris_vregs_riva, ARRAY_SIZE(iris_vregs_riva)); break; case WCNSS_PRONTO_HW: - wcnss_vregs_off(iris_vregs_pronto, + if (is_pronto_vt) { + wcnss_vregs_off(iris_vregs_pronto_v2, + ARRAY_SIZE(iris_vregs_pronto_v2)); + } else { + wcnss_vregs_off(iris_vregs_pronto, ARRAY_SIZE(iris_vregs_pronto)); + } break; default: pr_err("%s invalid hardware %d\n", __func__, hw_type); @@ -434,7 +463,9 @@ static void wcnss_iris_vregs_off(enum wcnss_hw_type hw_type) } } -static int wcnss_iris_vregs_on(struct device *dev, enum wcnss_hw_type hw_type) +static int wcnss_iris_vregs_on(struct device *dev, + enum wcnss_hw_type hw_type, + int is_pronto_vt) { int ret = -1; @@ -444,8 +475,13 @@ static int wcnss_iris_vregs_on(struct device *dev, enum wcnss_hw_type hw_type) ARRAY_SIZE(iris_vregs_riva)); break; case WCNSS_PRONTO_HW: - ret = wcnss_vregs_on(dev, iris_vregs_pronto, - ARRAY_SIZE(iris_vregs_pronto)); + if (is_pronto_vt) { + ret = wcnss_vregs_on(dev, iris_vregs_pronto_v2, + ARRAY_SIZE(iris_vregs_pronto_v2)); + } else { + ret = wcnss_vregs_on(dev, iris_vregs_pronto, + ARRAY_SIZE(iris_vregs_pronto)); + } break; default: pr_err("%s invalid hardware %d\n", __func__, hw_type); @@ -453,14 +489,21 @@ static int wcnss_iris_vregs_on(struct device *dev, enum wcnss_hw_type hw_type) return ret; } -static void wcnss_core_vregs_off(enum wcnss_hw_type hw_type) +static void wcnss_core_vregs_off(enum wcnss_hw_type hw_type, + int is_pronto_vt) { switch (hw_type) { case WCNSS_RIVA_HW: wcnss_vregs_off(riva_vregs, ARRAY_SIZE(riva_vregs)); break; case WCNSS_PRONTO_HW: - wcnss_vregs_off(pronto_vregs, ARRAY_SIZE(pronto_vregs)); + if (is_pronto_vt) { + wcnss_vregs_off(pronto_vregs_pronto_v2, + ARRAY_SIZE(pronto_vregs_pronto_v2)); + } else { + wcnss_vregs_off(pronto_vregs, + ARRAY_SIZE(pronto_vregs)); + } break; default: pr_err("%s invalid hardware %d\n", __func__, hw_type); @@ -468,7 +511,9 @@ static void wcnss_core_vregs_off(enum wcnss_hw_type hw_type) } -static int wcnss_core_vregs_on(struct device *dev, enum wcnss_hw_type hw_type) +static int wcnss_core_vregs_on(struct device *dev, + enum wcnss_hw_type hw_type, + int is_pronto_vt) { int ret = -1; @@ -477,8 +522,13 @@ static int wcnss_core_vregs_on(struct device *dev, enum wcnss_hw_type hw_type) ret = wcnss_vregs_on(dev, riva_vregs, ARRAY_SIZE(riva_vregs)); break; case WCNSS_PRONTO_HW: - ret = wcnss_vregs_on(dev, pronto_vregs, - ARRAY_SIZE(pronto_vregs)); + if (is_pronto_vt) { + ret = wcnss_vregs_on(dev, pronto_vregs_pronto_v2, + ARRAY_SIZE(pronto_vregs_pronto_v2)); + } else { + ret = wcnss_vregs_on(dev, pronto_vregs, + ARRAY_SIZE(pronto_vregs)); + } break; default: pr_err("%s invalid hardware %d\n", __func__, hw_type); @@ -498,12 +548,14 @@ int wcnss_wlan_power(struct device *dev, if (on) { down(&wcnss_power_on_lock); /* RIVA regulator settings */ - rc = wcnss_core_vregs_on(dev, hw_type); + rc = wcnss_core_vregs_on(dev, hw_type, + cfg->is_pronto_vt); if (rc) goto fail_wcnss_on; /* IRIS regulator settings */ - rc = wcnss_iris_vregs_on(dev, hw_type); + rc = wcnss_iris_vregs_on(dev, hw_type, + cfg->is_pronto_vt); if (rc) goto fail_iris_on; @@ -517,17 +569,17 @@ int wcnss_wlan_power(struct device *dev, } else { configure_iris_xo(dev, cfg, WCNSS_WLAN_SWITCH_OFF, NULL); - wcnss_iris_vregs_off(hw_type); - wcnss_core_vregs_off(hw_type); + wcnss_iris_vregs_off(hw_type, cfg->is_pronto_vt); + wcnss_core_vregs_off(hw_type, cfg->is_pronto_vt); } return rc; fail_iris_xo: - wcnss_iris_vregs_off(hw_type); + wcnss_iris_vregs_off(hw_type, cfg->is_pronto_vt); fail_iris_on: - wcnss_core_vregs_off(hw_type); + wcnss_core_vregs_off(hw_type, cfg->is_pronto_vt); fail_wcnss_on: up(&wcnss_power_on_lock); diff --git a/drivers/net/wireless/wcnss/wcnss_wlan.c b/drivers/net/wireless/wcnss/wcnss_wlan.c index c7af923c653b..34d8e5979e1c 100644 --- a/drivers/net/wireless/wcnss/wcnss_wlan.c +++ b/drivers/net/wireless/wcnss/wcnss_wlan.c @@ -2160,10 +2160,14 @@ wcnss_trigger_config(struct platform_device *pdev) int ret; struct qcom_wcnss_opts *pdata; struct resource *res; + int is_pronto_vt; int pil_retry = 0; int has_pronto_hw = of_property_read_bool(pdev->dev.of_node, "qcom,has-pronto-hw"); + is_pronto_vt = of_property_read_bool(pdev->dev.of_node, + "qcom,is-pronto-vt"); + if (of_property_read_u32(pdev->dev.of_node, "qcom,wlan-rx-buff-count", &penv->wlan_rx_buff_count)) { penv->wlan_rx_buff_count = WCNSS_DEF_WLAN_RX_BUFF_COUNT; @@ -2186,6 +2190,7 @@ wcnss_trigger_config(struct platform_device *pdev) } penv->wcnss_hw_type = (has_pronto_hw) ? WCNSS_PRONTO_HW : WCNSS_RIVA_HW; penv->wlan_config.use_48mhz_xo = has_48mhz_xo; + penv->wlan_config.is_pronto_vt = is_pronto_vt; if (WCNSS_CONFIG_UNSPECIFIED == has_autodetect_xo && has_pronto_hw) { has_autodetect_xo = of_property_read_bool(pdev->dev.of_node, diff --git a/include/linux/wcnss_wlan.h b/include/linux/wcnss_wlan.h index 6eb9f9e86809..53d8ca518643 100644 --- a/include/linux/wcnss_wlan.h +++ b/include/linux/wcnss_wlan.h @@ -28,6 +28,7 @@ enum wcnss_hw_type { struct wcnss_wlan_config { int use_48mhz_xo; + int is_pronto_vt; void __iomem *msm_wcnss_base; }; -- GitLab