Commit 41b3c015 authored by Chanwoo Choi's avatar Chanwoo Choi

extcon: Unify the jig cable names on rt8973 and max14577/77693/77843

This patch change the name of various jig cables as 'JIG' because the name of
various jig cables are strange and ambiguous on user-space aspect. They include
the different information of either USB and UART state. It is never important
for user-space process. This patch unifies the name of jig cables as following:
- JIG-USB-ON   -->|--> JIG
- JIG-USB-OFF  -->|
- JIG-UART-ON  -->|
- JIG-UART-OFF -->|
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
parent 9bf63cf8
...@@ -155,10 +155,7 @@ enum { ...@@ -155,10 +155,7 @@ enum {
EXTCON_CABLE_FAST_CHARGER, EXTCON_CABLE_FAST_CHARGER,
EXTCON_CABLE_SLOW_CHARGER, EXTCON_CABLE_SLOW_CHARGER,
EXTCON_CABLE_CHARGE_DOWNSTREAM, EXTCON_CABLE_CHARGE_DOWNSTREAM,
EXTCON_CABLE_JIG_USB_ON, EXTCON_CABLE_JIG,
EXTCON_CABLE_JIG_USB_OFF,
EXTCON_CABLE_JIG_UART_OFF,
EXTCON_CABLE_JIG_UART_ON,
_EXTCON_CABLE_NUM, _EXTCON_CABLE_NUM,
}; };
...@@ -169,10 +166,7 @@ static const char *max14577_extcon_cable[] = { ...@@ -169,10 +166,7 @@ static const char *max14577_extcon_cable[] = {
[EXTCON_CABLE_FAST_CHARGER] = "Fast-charger", [EXTCON_CABLE_FAST_CHARGER] = "Fast-charger",
[EXTCON_CABLE_SLOW_CHARGER] = "Slow-charger", [EXTCON_CABLE_SLOW_CHARGER] = "Slow-charger",
[EXTCON_CABLE_CHARGE_DOWNSTREAM] = "Charge-downstream", [EXTCON_CABLE_CHARGE_DOWNSTREAM] = "Charge-downstream",
[EXTCON_CABLE_JIG_USB_ON] = "JIG-USB-ON", [EXTCON_CABLE_JIG] = "JIG",
[EXTCON_CABLE_JIG_USB_OFF] = "JIG-USB-OFF",
[EXTCON_CABLE_JIG_UART_OFF] = "JIG-UART-OFF",
[EXTCON_CABLE_JIG_UART_ON] = "JIG-UART-ON",
NULL, NULL,
}; };
...@@ -348,7 +342,6 @@ static int max14577_muic_get_cable_type(struct max14577_muic_info *info, ...@@ -348,7 +342,6 @@ static int max14577_muic_get_cable_type(struct max14577_muic_info *info,
static int max14577_muic_jig_handler(struct max14577_muic_info *info, static int max14577_muic_jig_handler(struct max14577_muic_info *info,
int cable_type, bool attached) int cable_type, bool attached)
{ {
char cable_name[32];
int ret = 0; int ret = 0;
u8 path = CTRL1_SW_OPEN; u8 path = CTRL1_SW_OPEN;
...@@ -358,18 +351,12 @@ static int max14577_muic_jig_handler(struct max14577_muic_info *info, ...@@ -358,18 +351,12 @@ static int max14577_muic_jig_handler(struct max14577_muic_info *info,
switch (cable_type) { switch (cable_type) {
case MAX14577_MUIC_ADC_FACTORY_MODE_USB_OFF: /* ADC_JIG_USB_OFF */ case MAX14577_MUIC_ADC_FACTORY_MODE_USB_OFF: /* ADC_JIG_USB_OFF */
/* PATH:AP_USB */
strcpy(cable_name, "JIG-USB-OFF");
path = CTRL1_SW_USB;
break;
case MAX14577_MUIC_ADC_FACTORY_MODE_USB_ON: /* ADC_JIG_USB_ON */ case MAX14577_MUIC_ADC_FACTORY_MODE_USB_ON: /* ADC_JIG_USB_ON */
/* PATH:AP_USB */ /* PATH:AP_USB */
strcpy(cable_name, "JIG-USB-ON");
path = CTRL1_SW_USB; path = CTRL1_SW_USB;
break; break;
case MAX14577_MUIC_ADC_FACTORY_MODE_UART_OFF: /* ADC_JIG_UART_OFF */ case MAX14577_MUIC_ADC_FACTORY_MODE_UART_OFF: /* ADC_JIG_UART_OFF */
/* PATH:AP_UART */ /* PATH:AP_UART */
strcpy(cable_name, "JIG-UART-OFF");
path = CTRL1_SW_UART; path = CTRL1_SW_UART;
break; break;
default: default:
...@@ -382,7 +369,7 @@ static int max14577_muic_jig_handler(struct max14577_muic_info *info, ...@@ -382,7 +369,7 @@ static int max14577_muic_jig_handler(struct max14577_muic_info *info,
if (ret < 0) if (ret < 0)
return ret; return ret;
extcon_set_cable_state(info->edev, cable_name, attached); extcon_set_cable_state(info->edev, "JIG", attached);
return 0; return 0;
} }
......
...@@ -209,10 +209,7 @@ enum { ...@@ -209,10 +209,7 @@ enum {
EXTCON_CABLE_CHARGE_DOWNSTREAM, EXTCON_CABLE_CHARGE_DOWNSTREAM,
EXTCON_CABLE_MHL, EXTCON_CABLE_MHL,
EXTCON_CABLE_MHL_TA, EXTCON_CABLE_MHL_TA,
EXTCON_CABLE_JIG_USB_ON, EXTCON_CABLE_JIG,
EXTCON_CABLE_JIG_USB_OFF,
EXTCON_CABLE_JIG_UART_OFF,
EXTCON_CABLE_JIG_UART_ON,
EXTCON_CABLE_DOCK_SMART, EXTCON_CABLE_DOCK_SMART,
EXTCON_CABLE_DOCK_DESK, EXTCON_CABLE_DOCK_DESK,
EXTCON_CABLE_DOCK_AUDIO, EXTCON_CABLE_DOCK_AUDIO,
...@@ -229,10 +226,7 @@ static const char *max77693_extcon_cable[] = { ...@@ -229,10 +226,7 @@ static const char *max77693_extcon_cable[] = {
[EXTCON_CABLE_CHARGE_DOWNSTREAM] = "Charge-downstream", [EXTCON_CABLE_CHARGE_DOWNSTREAM] = "Charge-downstream",
[EXTCON_CABLE_MHL] = "MHL", [EXTCON_CABLE_MHL] = "MHL",
[EXTCON_CABLE_MHL_TA] = "MHL-TA", [EXTCON_CABLE_MHL_TA] = "MHL-TA",
[EXTCON_CABLE_JIG_USB_ON] = "JIG-USB-ON", [EXTCON_CABLE_JIG] = "JIG",
[EXTCON_CABLE_JIG_USB_OFF] = "JIG-USB-OFF",
[EXTCON_CABLE_JIG_UART_OFF] = "JIG-UART-OFF",
[EXTCON_CABLE_JIG_UART_ON] = "JIG-UART-ON",
[EXTCON_CABLE_DOCK_SMART] = "Dock-Smart", [EXTCON_CABLE_DOCK_SMART] = "Dock-Smart",
[EXTCON_CABLE_DOCK_DESK] = "Dock-Desk", [EXTCON_CABLE_DOCK_DESK] = "Dock-Desk",
[EXTCON_CABLE_DOCK_AUDIO] = "Dock-Audio", [EXTCON_CABLE_DOCK_AUDIO] = "Dock-Audio",
...@@ -642,7 +636,6 @@ static int max77693_muic_adc_ground_handler(struct max77693_muic_info *info) ...@@ -642,7 +636,6 @@ static int max77693_muic_adc_ground_handler(struct max77693_muic_info *info)
static int max77693_muic_jig_handler(struct max77693_muic_info *info, static int max77693_muic_jig_handler(struct max77693_muic_info *info,
int cable_type, bool attached) int cable_type, bool attached)
{ {
char cable_name[32];
int ret = 0; int ret = 0;
u8 path = CONTROL1_SW_OPEN; u8 path = CONTROL1_SW_OPEN;
...@@ -652,23 +645,13 @@ static int max77693_muic_jig_handler(struct max77693_muic_info *info, ...@@ -652,23 +645,13 @@ static int max77693_muic_jig_handler(struct max77693_muic_info *info,
switch (cable_type) { switch (cable_type) {
case MAX77693_MUIC_ADC_FACTORY_MODE_USB_OFF: /* ADC_JIG_USB_OFF */ case MAX77693_MUIC_ADC_FACTORY_MODE_USB_OFF: /* ADC_JIG_USB_OFF */
/* PATH:AP_USB */
strcpy(cable_name, "JIG-USB-OFF");
path = CONTROL1_SW_USB;
break;
case MAX77693_MUIC_ADC_FACTORY_MODE_USB_ON: /* ADC_JIG_USB_ON */ case MAX77693_MUIC_ADC_FACTORY_MODE_USB_ON: /* ADC_JIG_USB_ON */
/* PATH:AP_USB */ /* PATH:AP_USB */
strcpy(cable_name, "JIG-USB-ON");
path = CONTROL1_SW_USB; path = CONTROL1_SW_USB;
break; break;
case MAX77693_MUIC_ADC_FACTORY_MODE_UART_OFF: /* ADC_JIG_UART_OFF */ case MAX77693_MUIC_ADC_FACTORY_MODE_UART_OFF: /* ADC_JIG_UART_OFF */
/* PATH:AP_UART */
strcpy(cable_name, "JIG-UART-OFF");
path = CONTROL1_SW_UART;
break;
case MAX77693_MUIC_ADC_FACTORY_MODE_UART_ON: /* ADC_JIG_UART_ON */ case MAX77693_MUIC_ADC_FACTORY_MODE_UART_ON: /* ADC_JIG_UART_ON */
/* PATH:AP_UART */ /* PATH:AP_UART */
strcpy(cable_name, "JIG-UART-ON");
path = CONTROL1_SW_UART; path = CONTROL1_SW_UART;
break; break;
default: default:
...@@ -681,7 +664,7 @@ static int max77693_muic_jig_handler(struct max77693_muic_info *info, ...@@ -681,7 +664,7 @@ static int max77693_muic_jig_handler(struct max77693_muic_info *info,
if (ret < 0) if (ret < 0)
return ret; return ret;
extcon_set_cable_state(info->edev, cable_name, attached); extcon_set_cable_state(info->edev, "JIG", attached);
return 0; return 0;
} }
......
...@@ -127,10 +127,7 @@ enum { ...@@ -127,10 +127,7 @@ enum {
MAX77843_CABLE_SLOW_CHARGER, MAX77843_CABLE_SLOW_CHARGER,
MAX77843_CABLE_MHL, MAX77843_CABLE_MHL,
MAX77843_CABLE_MHL_TA, MAX77843_CABLE_MHL_TA,
MAX77843_CABLE_JIG_USB_ON, MAX77843_CABLE_JIG,
MAX77843_CABLE_JIG_USB_OFF,
MAX77843_CABLE_JIG_UART_ON,
MAX77843_CABLE_JIG_UART_OFF,
MAX77843_CABLE_NUM, MAX77843_CABLE_NUM,
}; };
...@@ -144,10 +141,7 @@ static const char *max77843_extcon_cable[] = { ...@@ -144,10 +141,7 @@ static const char *max77843_extcon_cable[] = {
[MAX77843_CABLE_SLOW_CHARGER] = "SLOW-CHARGER", [MAX77843_CABLE_SLOW_CHARGER] = "SLOW-CHARGER",
[MAX77843_CABLE_MHL] = "MHL", [MAX77843_CABLE_MHL] = "MHL",
[MAX77843_CABLE_MHL_TA] = "MHL-TA", [MAX77843_CABLE_MHL_TA] = "MHL-TA",
[MAX77843_CABLE_JIG_USB_ON] = "JIG-USB-ON", [MAX77843_CABLE_JIG] = "JIG",
[MAX77843_CABLE_JIG_USB_OFF] = "JIG-USB-OFF",
[MAX77843_CABLE_JIG_UART_ON] = "JIG-UART-ON",
[MAX77843_CABLE_JIG_UART_OFF] = "JIG-UART-OFF",
}; };
struct max77843_muic_irq { struct max77843_muic_irq {
...@@ -385,36 +379,29 @@ static int max77843_muic_jig_handler(struct max77843_muic_info *info, ...@@ -385,36 +379,29 @@ static int max77843_muic_jig_handler(struct max77843_muic_info *info,
int cable_type, bool attached) int cable_type, bool attached)
{ {
int ret; int ret;
u8 path = CONTROL1_SW_OPEN;
dev_dbg(info->dev, "external connector is %s (adc:0x%02x)\n", dev_dbg(info->dev, "external connector is %s (adc:0x%02x)\n",
attached ? "attached" : "detached", cable_type); attached ? "attached" : "detached", cable_type);
switch (cable_type) { switch (cable_type) {
case MAX77843_MUIC_ADC_FACTORY_MODE_USB_OFF: case MAX77843_MUIC_ADC_FACTORY_MODE_USB_OFF:
ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
if (ret < 0)
return ret;
extcon_set_cable_state(info->edev, "JIG-USB-OFF", attached);
break;
case MAX77843_MUIC_ADC_FACTORY_MODE_USB_ON: case MAX77843_MUIC_ADC_FACTORY_MODE_USB_ON:
ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached); path = CONTROL1_SW_USB;
if (ret < 0)
return ret;
extcon_set_cable_state(info->edev, "JIG-USB-ON", attached);
break; break;
case MAX77843_MUIC_ADC_FACTORY_MODE_UART_OFF: case MAX77843_MUIC_ADC_FACTORY_MODE_UART_OFF:
ret = max77843_muic_set_path(info, CONTROL1_SW_UART, attached); path = CONTROL1_SW_UART;
if (ret < 0)
return ret;
extcon_set_cable_state(info->edev, "JIG-UART-OFF", attached);
break; break;
default: default:
ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached); return -EINVAL;
if (ret < 0)
return ret;
break;
} }
ret = max77843_muic_set_path(info, path, attached);
if (ret < 0)
return ret;
extcon_set_cable_state(info->edev, "JIG", attached);
return 0; return 0;
} }
......
...@@ -94,10 +94,7 @@ enum { ...@@ -94,10 +94,7 @@ enum {
EXTCON_CABLE_USB = 0, EXTCON_CABLE_USB = 0,
EXTCON_CABLE_USB_HOST, EXTCON_CABLE_USB_HOST,
EXTCON_CABLE_TA, EXTCON_CABLE_TA,
EXTCON_CABLE_JIG_OFF_USB, EXTCON_CABLE_JIG,
EXTCON_CABLE_JIG_ON_USB,
EXTCON_CABLE_JIG_OFF_UART,
EXTCON_CABLE_JIG_ON_UART,
EXTCON_CABLE_END, EXTCON_CABLE_END,
}; };
...@@ -106,10 +103,7 @@ static const char *rt8973a_extcon_cable[] = { ...@@ -106,10 +103,7 @@ static const char *rt8973a_extcon_cable[] = {
[EXTCON_CABLE_USB] = "USB", [EXTCON_CABLE_USB] = "USB",
[EXTCON_CABLE_USB_HOST] = "USB-Host", [EXTCON_CABLE_USB_HOST] = "USB-Host",
[EXTCON_CABLE_TA] = "TA", [EXTCON_CABLE_TA] = "TA",
[EXTCON_CABLE_JIG_OFF_USB] = "JIG-USB-OFF", [EXTCON_CABLE_JIG] = "JIG",
[EXTCON_CABLE_JIG_ON_USB] = "JIG-USB-ON",
[EXTCON_CABLE_JIG_OFF_UART] = "JIG-UART-OFF",
[EXTCON_CABLE_JIG_ON_UART] = "JIG-UART-ON",
NULL, NULL,
}; };
...@@ -355,19 +349,13 @@ static int rt8973a_muic_cable_handler(struct rt8973a_muic_info *info, ...@@ -355,19 +349,13 @@ static int rt8973a_muic_cable_handler(struct rt8973a_muic_info *info,
con_sw = DM_DP_SWITCH_OPEN; con_sw = DM_DP_SWITCH_OPEN;
break; break;
case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_OFF_USB: case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_OFF_USB:
idx = EXTCON_CABLE_JIG_OFF_USB;
con_sw = DM_DP_SWITCH_UART;
break;
case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_ON_USB: case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_ON_USB:
idx = EXTCON_CABLE_JIG_ON_USB; idx = EXTCON_CABLE_JIG;
con_sw = DM_DP_SWITCH_UART; con_sw = DM_DP_SWITCH_USB;
break; break;
case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_OFF_UART: case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_OFF_UART:
idx = EXTCON_CABLE_JIG_OFF_UART;
con_sw = DM_DP_SWITCH_UART;
break;
case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_ON_UART: case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_ON_UART:
idx = EXTCON_CABLE_JIG_ON_UART; idx = EXTCON_CABLE_JIG;
con_sw = DM_DP_SWITCH_UART; con_sw = DM_DP_SWITCH_UART;
break; break;
case RT8973A_MUIC_ADC_USB: case RT8973A_MUIC_ADC_USB:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment