aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2017-10-18 05:56:21 -0400
committerChanwoo Choi <cw00.choi@samsung.com>2017-10-23 20:48:40 -0400
commit7b9651103b64c8a55eb6cec4c2240584e968354c (patch)
treef2b0b65bba4fbcf6999a27b1554e6e632d95c0ec /drivers/extcon
parentb743483bd4b1d9e0ac093fe184aefdd9f59264d4 (diff)
extcon: max77843: Add OTG power control to the MUIC driver
Enabling power on VBUS micro-usb pin is required only when passive OTG cable is connected. Initially OTG VBUS power control was planned to be done in charger driver. However such information is not really available from the extcon notifications, so VBUS power control has to be done directly in MUIC driver, which has all information about the attached accessory. For example SmartDock is externally powered accessory, provides OTG (USB HOST) functionality and use VBUS pin for charging a device battery, so the VBUS charging pump should be disabled in such case. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon-max77843.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
index 28f251ff0fa2..17d6bd76edb4 100644
--- a/drivers/extcon/extcon-max77843.c
+++ b/drivers/extcon/extcon-max77843.c
@@ -240,6 +240,21 @@ static int max77843_muic_set_path(struct max77843_muic_info *info,
240 return 0; 240 return 0;
241} 241}
242 242
243static void max77843_charger_set_otg_vbus(struct max77843_muic_info *info,
244 bool on)
245{
246 struct max77693_dev *max77843 = info->max77843;
247 unsigned int cnfg00;
248
249 if (on)
250 cnfg00 = MAX77843_CHG_OTG_MASK | MAX77843_CHG_BOOST_MASK;
251 else
252 cnfg00 = MAX77843_CHG_ENABLE | MAX77843_CHG_BUCK_MASK;
253
254 regmap_update_bits(max77843->regmap_chg, MAX77843_CHG_REG_CHG_CNFG_00,
255 MAX77843_CHG_MODE_MASK, cnfg00);
256}
257
243static int max77843_muic_get_cable_type(struct max77843_muic_info *info, 258static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
244 enum max77843_muic_cable_group group, bool *attached) 259 enum max77843_muic_cable_group group, bool *attached)
245{ 260{
@@ -355,6 +370,7 @@ static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info)
355 return ret; 370 return ret;
356 371
357 extcon_set_state_sync(info->edev, EXTCON_USB_HOST, attached); 372 extcon_set_state_sync(info->edev, EXTCON_USB_HOST, attached);
373 max77843_charger_set_otg_vbus(info, attached);
358 break; 374 break;
359 case MAX77843_MUIC_GND_MHL_VB: 375 case MAX77843_MUIC_GND_MHL_VB:
360 case MAX77843_MUIC_GND_MHL: 376 case MAX77843_MUIC_GND_MHL: