p9221_charger: configure WLC_RX_SW_EN in WLC driver
Bug: 235152601
Signed-off-by: yihsiangpeng <[email protected]>
Change-Id: Icd9fb31f1cad73d694b9ae8186d00768cf2896ab
diff --git a/gs101_usecase.c b/gs101_usecase.c
index 74b36c6..1ca75dd 100644
--- a/gs101_usecase.c
+++ b/gs101_usecase.c
@@ -556,8 +556,6 @@
/* from WLC-DC to STBY */
if (from_uc == GSU_MODE_WLC_DC) {
- if (uc_data->dc_sw_gpio > 0)
- gpio_set_value_cansleep(uc_data->dc_sw_gpio, 0);
ret = gs101_ext_mode(uc_data, EXT_MODE_OFF);
if (ret < 0) {
pr_debug("%s: cannot change extmode ret:%d\n",
diff --git a/p9221_charger.c b/p9221_charger.c
index bf89b89..acc62fa 100644
--- a/p9221_charger.c
+++ b/p9221_charger.c
@@ -597,6 +597,7 @@
#define EPP_MODE_REQ_PWR 15
static int p9221_reset_wlc_dc(struct p9221_charger_data *charger)
{
+ const int dc_sw_gpio = charger->pdata->dc_switch_gpio;
const int extben_gpio = charger->pdata->ext_ben_gpio;
const int req_pwr = EPP_MODE_REQ_PWR;
int ret, i;
@@ -606,6 +607,8 @@
return 0;
charger->wlc_dc_enabled = false;
+ if (dc_sw_gpio >= 0)
+ gpio_set_value_cansleep(dc_sw_gpio, 0);
if (extben_gpio)
gpio_set_value_cansleep(extben_gpio, 0);
diff --git a/p9221_chip.c b/p9221_chip.c
index 5fce912..0b579e5 100644
--- a/p9221_chip.c
+++ b/p9221_chip.c
@@ -26,6 +26,7 @@
#define P9XXX_GPIO_CPOUT_EN 1
#define P9412_GPIO_CPOUT21_EN 2
#define P9XXX_GPIO_CPOUT_CTL_EN 3
+#define P9XXX_GPIO_DC_SW_EN 4
#define P9XXX_GPIO_VBUS_EN 15
/* Simple Chip Specific Accessors */
@@ -1901,6 +1902,10 @@
value = (!!value) ^ charger->pdata->wlc_en_act_low;
gpio_direction_output(charger->pdata->wlc_en, value);
break;
+ case P9XXX_GPIO_DC_SW_EN:
+ if (charger->pdata->dc_switch_gpio < 0)
+ break;
+ gpio_set_value_cansleep(charger->pdata->dc_switch_gpio, value);
default:
ret = -EINVAL;
break;