From ec3266a99de0a98b90781dc11de956152e478831 Mon Sep 17 00:00:00 2001 From: Sarada Prasanna Garnayak Date: Thu, 22 Mar 2018 20:52:40 +0530 Subject: [PATCH 1/2] wcnss: fix the wcnss power up sequence after ssr Update the voltage regulator enable/disable status during proxy vote and unvote request by wcnss wlan module. CRs-Fixed: 2211050 Change-Id: I334df98612b0915fe00d5390fbcd37c95e9f6509 Signed-off-by: Sarada Prasanna Garnayak --- drivers/net/wireless/wcnss/wcnss_vreg.c | 10 ++-------- drivers/net/wireless/wcnss/wcnss_wlan.c | 9 +++++---- include/linux/wcnss_wlan.h | 3 ++- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/wcnss/wcnss_vreg.c b/drivers/net/wireless/wcnss/wcnss_vreg.c index d94bd90f64da..28cf4b7321e2 100644 --- a/drivers/net/wireless/wcnss/wcnss_vreg.c +++ b/drivers/net/wireless/wcnss/wcnss_vreg.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, 2017 The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2015, 2018 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -194,7 +194,7 @@ int validate_iris_chip_id(u32 reg) } } -static void wcnss_free_regulator(void) +void wcnss_free_regulator(void) { int vreg_i; @@ -586,12 +586,6 @@ static void wcnss_vregs_off(struct vregs_info regulators[], uint size, pr_err("vreg %s disable failed (%d)\n", regulators[i].name, rc); } - - /* Free the regulator source */ - if (regulators[i].state & VREG_GET_REGULATOR_MASK) - regulator_put(regulators[i].regulator); - - regulators[i].state = VREG_NULL_CONFIG; } } diff --git a/drivers/net/wireless/wcnss/wcnss_wlan.c b/drivers/net/wireless/wcnss/wcnss_wlan.c index 04d6b2e6fec1..0aa7ba0cc3a0 100644 --- a/drivers/net/wireless/wcnss/wcnss_wlan.c +++ b/drivers/net/wireless/wcnss/wcnss_wlan.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -2163,7 +2163,7 @@ static void wcnssctrl_rx_handler(struct work_struct *worker) return; } if (len < sizeof(struct smd_msg_hdr)) { - pr_err("wcnss: incomplete header available len = %d\n", len); + pr_debug("wcnss: incomplete header available len = %d\n", len); return; } @@ -3336,8 +3336,8 @@ static int wcnss_notif_cb(struct notifier_block *this, unsigned long code, return NOTIFY_DONE; } - pr_debug("%s: wcnss notification event: %lu : %s\n", - __func__, code, wcnss_subsys_notif_type[code]); + pr_info("%s: wcnss notification event: %lu : %s\n", + __func__, code, wcnss_subsys_notif_type[code]); if (code == SUBSYS_PROXY_VOTE) { if (pdev && pwlanconfig) { @@ -3465,6 +3465,7 @@ wcnss_wlan_probe(struct platform_device *pdev) static int wcnss_wlan_remove(struct platform_device *pdev) { + wcnss_free_regulator(); if (penv->wcnss_notif_hdle) subsys_notif_unregister_notifier(penv->wcnss_notif_hdle, &wnb); wcnss_remove_sysfs(&pdev->dev); diff --git a/include/linux/wcnss_wlan.h b/include/linux/wcnss_wlan.h index bc838936d2c9..6cb6be78404c 100644 --- a/include/linux/wcnss_wlan.h +++ b/include/linux/wcnss_wlan.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -130,6 +130,7 @@ int wcnss_is_hw_pronto_ver3(void); int wcnss_device_ready(void); bool wcnss_cbc_complete(void); int wcnss_device_is_shutdown(void); +void wcnss_free_regulator(void); void wcnss_riva_dump_pmic_regs(void); int wcnss_xo_auto_detect_enabled(void); u32 wcnss_get_wlan_rx_buff_count(void); From 93a468587d49a8e21c815b80055c17125c9a9e51 Mon Sep 17 00:00:00 2001 From: Sarada Prasanna Garnayak Date: Tue, 3 Apr 2018 16:40:49 +0530 Subject: [PATCH 2/2] wcnss: update the regulator parsing and config method Use the resource managed regulator API for the wcnss regulator parsing and configuration. CRs-Fixed: 2214888 Change-Id: Ib376893c26bb9aa797e7e9df25cc7302a84a3726 Signed-off-by: Sarada Prasanna Garnayak --- drivers/net/wireless/wcnss/wcnss_vreg.c | 43 ++++++------------------- drivers/net/wireless/wcnss/wcnss_wlan.c | 1 - include/linux/wcnss_wlan.h | 1 - 3 files changed, 10 insertions(+), 35 deletions(-) diff --git a/drivers/net/wireless/wcnss/wcnss_vreg.c b/drivers/net/wireless/wcnss/wcnss_vreg.c index 28cf4b7321e2..1be4c652f465 100644 --- a/drivers/net/wireless/wcnss/wcnss_vreg.c +++ b/drivers/net/wireless/wcnss/wcnss_vreg.c @@ -194,27 +194,6 @@ int validate_iris_chip_id(u32 reg) } } -void wcnss_free_regulator(void) -{ - int vreg_i; - - /* Free pronto voltage regulators from device node */ - for (vreg_i = 0; vreg_i < PRONTO_REGULATORS; vreg_i++) { - if (pronto_vregs[vreg_i].state) { - regulator_put(pronto_vregs[vreg_i].regulator); - pronto_vregs[vreg_i].state = VREG_NULL_CONFIG; - } - } - - /* Free IRIS voltage regulators from device node */ - for (vreg_i = 0; vreg_i < IRIS_REGULATORS; vreg_i++) { - if (iris_vregs[vreg_i].state) { - regulator_put(iris_vregs[vreg_i].regulator); - iris_vregs[vreg_i].state = VREG_NULL_CONFIG; - } - } -} - static int wcnss_dt_parse_vreg_level(struct device *dev, int index, const char *current_vreg_name, const char *vreg_name, @@ -257,13 +236,14 @@ wcnss_parse_voltage_regulator(struct wcnss_wlan_config *wlan_config, /* Parse pronto voltage regulators from device node */ for (vreg_i = 0; vreg_i < PRONTO_REGULATORS; vreg_i++) { pronto_vregs[vreg_i].regulator = - regulator_get(dev, pronto_vregs[vreg_i].name); + devm_regulator_get_optional(dev, + pronto_vregs[vreg_i].name); if (IS_ERR(pronto_vregs[vreg_i].regulator)) { if (pronto_vregs[vreg_i].required) { rc = PTR_ERR(pronto_vregs[vreg_i].regulator); dev_err(dev, "regulator get of %s failed (%d)\n", pronto_vregs[vreg_i].name, rc); - goto wcnss_vreg_get_err; + return rc; } else { dev_dbg(dev, "Skip optional regulator configuration: %s\n", pronto_vregs[vreg_i].name); @@ -271,27 +251,28 @@ wcnss_parse_voltage_regulator(struct wcnss_wlan_config *wlan_config, } } - pronto_vregs[vreg_i].state |= VREG_GET_REGULATOR_MASK; rc = wcnss_dt_parse_vreg_level(dev, vreg_i, pronto_vregs[vreg_i].curr, pronto_vregs[vreg_i].volt, wlan_config->pronto_vlevel); if (rc) { dev_err(dev, "error reading voltage-level property\n"); - goto wcnss_vreg_get_err; + return rc; } + pronto_vregs[vreg_i].state |= VREG_GET_REGULATOR_MASK; } /* Parse iris voltage regulators from device node */ for (vreg_i = 0; vreg_i < IRIS_REGULATORS; vreg_i++) { iris_vregs[vreg_i].regulator = - regulator_get(dev, iris_vregs[vreg_i].name); + devm_regulator_get_optional(dev, + iris_vregs[vreg_i].name); if (IS_ERR(iris_vregs[vreg_i].regulator)) { if (iris_vregs[vreg_i].required) { rc = PTR_ERR(iris_vregs[vreg_i].regulator); dev_err(dev, "regulator get of %s failed (%d)\n", iris_vregs[vreg_i].name, rc); - goto wcnss_vreg_get_err; + return rc; } else { dev_dbg(dev, "Skip optional regulator configuration: %s\n", iris_vregs[vreg_i].name); @@ -299,22 +280,18 @@ wcnss_parse_voltage_regulator(struct wcnss_wlan_config *wlan_config, } } - iris_vregs[vreg_i].state |= VREG_GET_REGULATOR_MASK; rc = wcnss_dt_parse_vreg_level(dev, vreg_i, iris_vregs[vreg_i].curr, iris_vregs[vreg_i].volt, wlan_config->iris_vlevel); if (rc) { dev_err(dev, "error reading voltage-level property\n"); - goto wcnss_vreg_get_err; + return rc; } + iris_vregs[vreg_i].state |= VREG_GET_REGULATOR_MASK; } return 0; - -wcnss_vreg_get_err: - wcnss_free_regulator(); - return rc; } void wcnss_iris_reset(u32 reg, void __iomem *pmu_conf_reg) diff --git a/drivers/net/wireless/wcnss/wcnss_wlan.c b/drivers/net/wireless/wcnss/wcnss_wlan.c index 0aa7ba0cc3a0..13ae5c3c2471 100644 --- a/drivers/net/wireless/wcnss/wcnss_wlan.c +++ b/drivers/net/wireless/wcnss/wcnss_wlan.c @@ -3465,7 +3465,6 @@ wcnss_wlan_probe(struct platform_device *pdev) static int wcnss_wlan_remove(struct platform_device *pdev) { - wcnss_free_regulator(); if (penv->wcnss_notif_hdle) subsys_notif_unregister_notifier(penv->wcnss_notif_hdle, &wnb); wcnss_remove_sysfs(&pdev->dev); diff --git a/include/linux/wcnss_wlan.h b/include/linux/wcnss_wlan.h index 6cb6be78404c..7389fff7da51 100644 --- a/include/linux/wcnss_wlan.h +++ b/include/linux/wcnss_wlan.h @@ -130,7 +130,6 @@ int wcnss_is_hw_pronto_ver3(void); int wcnss_device_ready(void); bool wcnss_cbc_complete(void); int wcnss_device_is_shutdown(void); -void wcnss_free_regulator(void); void wcnss_riva_dump_pmic_regs(void); int wcnss_xo_auto_detect_enabled(void); u32 wcnss_get_wlan_rx_buff_count(void);