summaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-intel-cht-wc.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-02-19 08:20:46 -0500
committerChanwoo Choi <cw00.choi@samsung.com>2018-03-21 00:57:52 -0400
commitad49aee401dd1997ec71360df6e51a91ad3cf516 (patch)
tree990250b50cc4fefbf854ac62e2e6a8184b8c4a25 /drivers/extcon/extcon-intel-cht-wc.c
parent4a3928c6f8a53fa1aed28ccba227742486e8ddcb (diff)
extcon: intel-cht-wc: Set direction and drv flags for V5 boost GPIO
Sometimes (firmware bug?) the V5 boost GPIO is not configured as output by the BIOS, leading to the 5V boost convertor being permanently on, Explicitly set the direction and drv flags rather then inheriting them from the firmware to fix this. Fixes: 585cb239f4de ("extcon: intel-cht-wc: Disable external 5v boost ...") Cc: stable@vger.kernel.org Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon-intel-cht-wc.c')
-rw-r--r--drivers/extcon/extcon-intel-cht-wc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c
index 7c4bc8c44c3f..b7e9ea377d70 100644
--- a/drivers/extcon/extcon-intel-cht-wc.c
+++ b/drivers/extcon/extcon-intel-cht-wc.c
@@ -66,6 +66,8 @@
66 66
67#define CHT_WC_VBUS_GPIO_CTLO 0x6e2d 67#define CHT_WC_VBUS_GPIO_CTLO 0x6e2d
68#define CHT_WC_VBUS_GPIO_CTLO_OUTPUT BIT(0) 68#define CHT_WC_VBUS_GPIO_CTLO_OUTPUT BIT(0)
69#define CHT_WC_VBUS_GPIO_CTLO_DRV_OD BIT(4)
70#define CHT_WC_VBUS_GPIO_CTLO_DIR_OUT BIT(5)
69 71
70enum cht_wc_usb_id { 72enum cht_wc_usb_id {
71 USB_ID_OTG, 73 USB_ID_OTG,
@@ -183,14 +185,15 @@ static void cht_wc_extcon_set_5v_boost(struct cht_wc_extcon_data *ext,
183{ 185{
184 int ret, val; 186 int ret, val;
185 187
186 val = enable ? CHT_WC_VBUS_GPIO_CTLO_OUTPUT : 0;
187
188 /* 188 /*
189 * The 5V boost converter is enabled through a gpio on the PMIC, since 189 * The 5V boost converter is enabled through a gpio on the PMIC, since
190 * there currently is no gpio driver we access the gpio reg directly. 190 * there currently is no gpio driver we access the gpio reg directly.
191 */ 191 */
192 ret = regmap_update_bits(ext->regmap, CHT_WC_VBUS_GPIO_CTLO, 192 val = CHT_WC_VBUS_GPIO_CTLO_DRV_OD | CHT_WC_VBUS_GPIO_CTLO_DIR_OUT;
193 CHT_WC_VBUS_GPIO_CTLO_OUTPUT, val); 193 if (enable)
194 val |= CHT_WC_VBUS_GPIO_CTLO_OUTPUT;
195
196 ret = regmap_write(ext->regmap, CHT_WC_VBUS_GPIO_CTLO, val);
194 if (ret) 197 if (ret)
195 dev_err(ext->dev, "Error writing Vbus GPIO CTLO: %d\n", ret); 198 dev_err(ext->dev, "Error writing Vbus GPIO CTLO: %d\n", ret);
196} 199}