summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Shyti <andi.shyti@samsung.com>2017-02-17 17:25:51 +0900
committerAndi Shyti <andi.shyti@samsung.com>2017-02-17 17:46:40 +0900
commit103a229abc932c2d32f3b0ed6a257664a05c9bb1 (patch)
treeb73203774d9f0111b8a226aa7917509374e409b8
parent2582e4d639d7c4712e4d45422f0180888516c91d (diff)
extcon: max77843: define USB device ADC state
The ADC state defines the resistance that a USB device has in order to distinguish between devices. Define the 10001 (0x11) value as USB generic device and set the device as usb host. Change-Id: Ic1df48cd988ffb319f4c79f12c63791afcc6e6e2 Sigend-off-by: Woochang Kim <wchang.kim@samsung.com> Sigend-off-by: Andi Shyti <andi.shyti@samsung.com>
-rw-r--r--drivers/extcon/extcon-max77843.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
index f6fcaeb4b067..f73d3008a277 100644
--- a/drivers/extcon/extcon-max77843.c
+++ b/drivers/extcon/extcon-max77843.c
@@ -81,7 +81,7 @@ enum max77843_muic_accessory_type {
MAX77843_MUIC_ADC_RESERVED_ACC_1,
MAX77843_MUIC_ADC_RESERVED_ACC_2,
MAX77843_MUIC_ADC_RESERVED_ACC_3,
- MAX77843_MUIC_ADC_RESERVED_ACC_4,
+ MAX77843_MUIC_ADC_GENERIC_DEVICE,
MAX77843_MUIC_ADC_RESERVED_ACC_5,
MAX77843_MUIC_ADC_AUDIO_DEVICE_TYPE2,
MAX77843_MUIC_ADC_PHONE_POWERED_DEV,
@@ -302,6 +302,18 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
break;
}
+ if (adc == MAX77843_MUIC_ADC_GENERIC_DEVICE) {
+ if (chg_type == MAX77843_MUIC_CHG_NONE) {
+ *attached = false;
+ cable_type = info->prev_chg_type;
+ info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
+ } else {
+ *attached = true;
+ cable_type = info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
+ }
+ break;
+ }
+
if (chg_type == MAX77843_MUIC_CHG_NONE) {
*attached = false;
cable_type = info->prev_chg_type;
@@ -446,6 +458,12 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
if (ret < 0)
return ret;
break;
+ case MAX77843_MUIC_ADC_GENERIC_DEVICE:
+ ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
+ if (ret < 0)
+ return ret;
+ extcon_set_cable_state(info->edev, "USB-HOST", attached);
+ break;
case MAX77843_MUIC_ADC_SEND_END_BUTTON:
case MAX77843_MUIC_ADC_REMOTE_S1_BUTTON:
case MAX77843_MUIC_ADC_REMOTE_S2_BUTTON:
@@ -462,7 +480,6 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
case MAX77843_MUIC_ADC_RESERVED_ACC_1:
case MAX77843_MUIC_ADC_RESERVED_ACC_2:
case MAX77843_MUIC_ADC_RESERVED_ACC_3:
- case MAX77843_MUIC_ADC_RESERVED_ACC_4:
case MAX77843_MUIC_ADC_RESERVED_ACC_5:
case MAX77843_MUIC_ADC_AUDIO_DEVICE_TYPE2:
case MAX77843_MUIC_ADC_PHONE_POWERED_DEV: