Re: [PATCH 1/4] extcon: Unify the jig cable names on RT8963 and MAX14577/77693/77843

2015-04-29 Thread Chanwoo Choi
On 04/30/2015 11:00 AM, Krzysztof Kozlowski wrote:
> On 27.04.2015 21:31, Chanwoo Choi wrote:
>> 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 -->|
>>
>> Cc: Jaewon Kim 
>> Cc: Krzysztof Kozlowski 
>> Signed-off-by: Chanwoo Choi 
>> ---
>>   drivers/extcon/extcon-max14577.c | 19 +++
>>   drivers/extcon/extcon-max77693.c | 23 +++
>>   drivers/extcon/extcon-max77843.c | 39 
>> ++-
>>   drivers/extcon/extcon-rt8973a.c  | 22 +-
>>   4 files changed, 25 insertions(+), 78 deletions(-)
>>

[snip]

>>   struct max77843_muic_irq {
>> @@ -385,36 +379,31 @@ static int max77843_muic_jig_handler(struct 
>> max77843_muic_info *info,
>>   int cable_type, bool attached)
>>   {
>>   int ret;
>> +u8 path = CTRL1_SW_OPEN;
>>
>>   dev_dbg(info->dev, "external connector is %s (adc:0x%02x)\n",
>>   attached ? "attached" : "detached", cable_type);
>>
>>   switch (cable_type) {
>>   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:
>> -ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
>> -if (ret < 0)
>> -return ret;
>> -extcon_set_cable_state(info->edev, "JIG-USB-ON", attached);
>> +path = CONTROL1_SW_USB;
>>   break;
>>   case MAX77843_MUIC_ADC_FACTORY_MODE_UART_OFF:
>> -ret = max77843_muic_set_path(info, CONTROL1_SW_UART, attached);
>> -if (ret < 0)
>> -return ret;
>> -extcon_set_cable_state(info->edev, "JIG-UART-OFF", attached);
>> +path = CONTROL1_SW_UART;
>>   break;
>>   default:
>> -ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
>> -if (ret < 0)
>> -return ret;
>> -break;
>> +dev_err(info->dev, "failed to detect %s jig cable\n",
>> +attached ? "attached" : "detached");
>> +return -EINVAL;
> 
> The logic for this default case is changed and it is not related to the patch 
> (unification of JIG). Could you split it into separate patch?
> 
> Rest looks fine.

OK. I'll split out.

Thanks,
Chanwoo Choi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] extcon: Unify the jig cable names on RT8963 and MAX14577/77693/77843

2015-04-29 Thread Krzysztof Kozlowski

On 27.04.2015 21:31, Chanwoo Choi wrote:

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 -->|

Cc: Jaewon Kim 
Cc: Krzysztof Kozlowski 
Signed-off-by: Chanwoo Choi 
---
  drivers/extcon/extcon-max14577.c | 19 +++
  drivers/extcon/extcon-max77693.c | 23 +++
  drivers/extcon/extcon-max77843.c | 39 ++-
  drivers/extcon/extcon-rt8973a.c  | 22 +-
  4 files changed, 25 insertions(+), 78 deletions(-)

diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 3823aa4..6d5febe 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -155,10 +155,7 @@ enum {
EXTCON_CABLE_FAST_CHARGER,
EXTCON_CABLE_SLOW_CHARGER,
EXTCON_CABLE_CHARGE_DOWNSTREAM,
-   EXTCON_CABLE_JIG_USB_ON,
-   EXTCON_CABLE_JIG_USB_OFF,
-   EXTCON_CABLE_JIG_UART_OFF,
-   EXTCON_CABLE_JIG_UART_ON,
+   EXTCON_CABLE_JIG,

_EXTCON_CABLE_NUM,
  };
@@ -169,10 +166,7 @@ static const char *max14577_extcon_cable[] = {
[EXTCON_CABLE_FAST_CHARGER] = "Fast-charger",
[EXTCON_CABLE_SLOW_CHARGER] = "Slow-charger",
[EXTCON_CABLE_CHARGE_DOWNSTREAM]= "Charge-downstream",
-   [EXTCON_CABLE_JIG_USB_ON]   = "JIG-USB-ON",
-   [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_JIG]  = "JIG",

NULL,
  };
@@ -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,
int cable_type, bool attached)
  {
-   char cable_name[32];
int ret = 0;
u8 path = CTRL1_SW_OPEN;

@@ -358,18 +351,12 @@ static int max14577_muic_jig_handler(struct 
max14577_muic_info *info,

switch (cable_type) {
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 */
/* PATH:AP_USB */
-   strcpy(cable_name, "JIG-USB-ON");
path = CTRL1_SW_USB;
break;
case MAX14577_MUIC_ADC_FACTORY_MODE_UART_OFF:   /* ADC_JIG_UART_OFF */
/* PATH:AP_UART */
-   strcpy(cable_name, "JIG-UART-OFF");
path = CTRL1_SW_UART;
break;
default:
@@ -382,7 +369,7 @@ static int max14577_muic_jig_handler(struct 
max14577_muic_info *info,
if (ret < 0)
return ret;

-   extcon_set_cable_state(info->edev, cable_name, attached);
+   extcon_set_cable_state(info->edev, "JIG", attached);

return 0;
  }
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index a66bec8..1079321 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -209,10 +209,7 @@ enum {
EXTCON_CABLE_CHARGE_DOWNSTREAM,
EXTCON_CABLE_MHL,
EXTCON_CABLE_MHL_TA,
-   EXTCON_CABLE_JIG_USB_ON,
-   EXTCON_CABLE_JIG_USB_OFF,
-   EXTCON_CABLE_JIG_UART_OFF,
-   EXTCON_CABLE_JIG_UART_ON,
+   EXTCON_CABLE_JIG,
EXTCON_CABLE_DOCK_SMART,
EXTCON_CABLE_DOCK_DESK,
EXTCON_CABLE_DOCK_AUDIO,
@@ -229,10 +226,7 @@ static const char *max77693_extcon_cable[] = {
[EXTCON_CABLE_CHARGE_DOWNSTREAM]= "Charge-downstream",
[EXTCON_CABLE_MHL]  = "MHL",
[EXTCON_CABLE_MHL_TA]   = "MHL-TA",
-   [EXTCON_CABLE_JIG_USB_ON]   = "JIG-USB-ON",
-   [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_JIG]  = "JIG",
[EXTCON_CABLE_DOCK_SMART]   = "Dock-Smart",
[EXTCON_CABLE_DOCK_DESK]= "Dock-Desk",
[EXTCON_CABLE_DOCK_AUDIO]   = "Dock-Audio",
@@ -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,
int cable_type, bool attached)
  {
-   char cable_name[32];
int ret = 0;
u8 path 

Re: [PATCH 1/4] extcon: Unify the jig cable names on RT8963 and MAX14577/77693/77843

2015-04-29 Thread Krzysztof Kozlowski

On 27.04.2015 21:31, Chanwoo Choi wrote:

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 --|

Cc: Jaewon Kim jaewon02@samsung.com
Cc: Krzysztof Kozlowski k.kozlow...@samsung.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
---
  drivers/extcon/extcon-max14577.c | 19 +++
  drivers/extcon/extcon-max77693.c | 23 +++
  drivers/extcon/extcon-max77843.c | 39 ++-
  drivers/extcon/extcon-rt8973a.c  | 22 +-
  4 files changed, 25 insertions(+), 78 deletions(-)

diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 3823aa4..6d5febe 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -155,10 +155,7 @@ enum {
EXTCON_CABLE_FAST_CHARGER,
EXTCON_CABLE_SLOW_CHARGER,
EXTCON_CABLE_CHARGE_DOWNSTREAM,
-   EXTCON_CABLE_JIG_USB_ON,
-   EXTCON_CABLE_JIG_USB_OFF,
-   EXTCON_CABLE_JIG_UART_OFF,
-   EXTCON_CABLE_JIG_UART_ON,
+   EXTCON_CABLE_JIG,

_EXTCON_CABLE_NUM,
  };
@@ -169,10 +166,7 @@ static const char *max14577_extcon_cable[] = {
[EXTCON_CABLE_FAST_CHARGER] = Fast-charger,
[EXTCON_CABLE_SLOW_CHARGER] = Slow-charger,
[EXTCON_CABLE_CHARGE_DOWNSTREAM]= Charge-downstream,
-   [EXTCON_CABLE_JIG_USB_ON]   = JIG-USB-ON,
-   [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_JIG]  = JIG,

NULL,
  };
@@ -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,
int cable_type, bool attached)
  {
-   char cable_name[32];
int ret = 0;
u8 path = CTRL1_SW_OPEN;

@@ -358,18 +351,12 @@ static int max14577_muic_jig_handler(struct 
max14577_muic_info *info,

switch (cable_type) {
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 */
/* PATH:AP_USB */
-   strcpy(cable_name, JIG-USB-ON);
path = CTRL1_SW_USB;
break;
case MAX14577_MUIC_ADC_FACTORY_MODE_UART_OFF:   /* ADC_JIG_UART_OFF */
/* PATH:AP_UART */
-   strcpy(cable_name, JIG-UART-OFF);
path = CTRL1_SW_UART;
break;
default:
@@ -382,7 +369,7 @@ static int max14577_muic_jig_handler(struct 
max14577_muic_info *info,
if (ret  0)
return ret;

-   extcon_set_cable_state(info-edev, cable_name, attached);
+   extcon_set_cable_state(info-edev, JIG, attached);

return 0;
  }
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index a66bec8..1079321 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -209,10 +209,7 @@ enum {
EXTCON_CABLE_CHARGE_DOWNSTREAM,
EXTCON_CABLE_MHL,
EXTCON_CABLE_MHL_TA,
-   EXTCON_CABLE_JIG_USB_ON,
-   EXTCON_CABLE_JIG_USB_OFF,
-   EXTCON_CABLE_JIG_UART_OFF,
-   EXTCON_CABLE_JIG_UART_ON,
+   EXTCON_CABLE_JIG,
EXTCON_CABLE_DOCK_SMART,
EXTCON_CABLE_DOCK_DESK,
EXTCON_CABLE_DOCK_AUDIO,
@@ -229,10 +226,7 @@ static const char *max77693_extcon_cable[] = {
[EXTCON_CABLE_CHARGE_DOWNSTREAM]= Charge-downstream,
[EXTCON_CABLE_MHL]  = MHL,
[EXTCON_CABLE_MHL_TA]   = MHL-TA,
-   [EXTCON_CABLE_JIG_USB_ON]   = JIG-USB-ON,
-   [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_JIG]  = JIG,
[EXTCON_CABLE_DOCK_SMART]   = Dock-Smart,
[EXTCON_CABLE_DOCK_DESK]= Dock-Desk,
[EXTCON_CABLE_DOCK_AUDIO]   = Dock-Audio,
@@ -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,
int cable_type, bool attached)
  {
-   char cable_name[32];
int ret = 0;
  

Re: [PATCH 1/4] extcon: Unify the jig cable names on RT8963 and MAX14577/77693/77843

2015-04-29 Thread Chanwoo Choi
On 04/30/2015 11:00 AM, Krzysztof Kozlowski wrote:
 On 27.04.2015 21:31, Chanwoo Choi wrote:
 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 --|

 Cc: Jaewon Kim jaewon02@samsung.com
 Cc: Krzysztof Kozlowski k.kozlow...@samsung.com
 Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
 ---
   drivers/extcon/extcon-max14577.c | 19 +++
   drivers/extcon/extcon-max77693.c | 23 +++
   drivers/extcon/extcon-max77843.c | 39 
 ++-
   drivers/extcon/extcon-rt8973a.c  | 22 +-
   4 files changed, 25 insertions(+), 78 deletions(-)


[snip]

   struct max77843_muic_irq {
 @@ -385,36 +379,31 @@ static int max77843_muic_jig_handler(struct 
 max77843_muic_info *info,
   int cable_type, bool attached)
   {
   int ret;
 +u8 path = CTRL1_SW_OPEN;

   dev_dbg(info-dev, external connector is %s (adc:0x%02x)\n,
   attached ? attached : detached, cable_type);

   switch (cable_type) {
   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:
 -ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
 -if (ret  0)
 -return ret;
 -extcon_set_cable_state(info-edev, JIG-USB-ON, attached);
 +path = CONTROL1_SW_USB;
   break;
   case MAX77843_MUIC_ADC_FACTORY_MODE_UART_OFF:
 -ret = max77843_muic_set_path(info, CONTROL1_SW_UART, attached);
 -if (ret  0)
 -return ret;
 -extcon_set_cable_state(info-edev, JIG-UART-OFF, attached);
 +path = CONTROL1_SW_UART;
   break;
   default:
 -ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
 -if (ret  0)
 -return ret;
 -break;
 +dev_err(info-dev, failed to detect %s jig cable\n,
 +attached ? attached : detached);
 +return -EINVAL;
 
 The logic for this default case is changed and it is not related to the patch 
 (unification of JIG). Could you split it into separate patch?
 
 Rest looks fine.

OK. I'll split out.

Thanks,
Chanwoo Choi

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] extcon: Unify the jig cable names on RT8963 and MAX14577/77693/77843

2015-04-27 Thread Chanwoo Choi
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 -->|

Cc: Jaewon Kim 
Cc: Krzysztof Kozlowski 
Signed-off-by: Chanwoo Choi 
---
 drivers/extcon/extcon-max14577.c | 19 +++
 drivers/extcon/extcon-max77693.c | 23 +++
 drivers/extcon/extcon-max77843.c | 39 ++-
 drivers/extcon/extcon-rt8973a.c  | 22 +-
 4 files changed, 25 insertions(+), 78 deletions(-)

diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 3823aa4..6d5febe 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -155,10 +155,7 @@ enum {
EXTCON_CABLE_FAST_CHARGER,
EXTCON_CABLE_SLOW_CHARGER,
EXTCON_CABLE_CHARGE_DOWNSTREAM,
-   EXTCON_CABLE_JIG_USB_ON,
-   EXTCON_CABLE_JIG_USB_OFF,
-   EXTCON_CABLE_JIG_UART_OFF,
-   EXTCON_CABLE_JIG_UART_ON,
+   EXTCON_CABLE_JIG,
 
_EXTCON_CABLE_NUM,
 };
@@ -169,10 +166,7 @@ static const char *max14577_extcon_cable[] = {
[EXTCON_CABLE_FAST_CHARGER] = "Fast-charger",
[EXTCON_CABLE_SLOW_CHARGER] = "Slow-charger",
[EXTCON_CABLE_CHARGE_DOWNSTREAM]= "Charge-downstream",
-   [EXTCON_CABLE_JIG_USB_ON]   = "JIG-USB-ON",
-   [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_JIG]  = "JIG",
 
NULL,
 };
@@ -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,
int cable_type, bool attached)
 {
-   char cable_name[32];
int ret = 0;
u8 path = CTRL1_SW_OPEN;
 
@@ -358,18 +351,12 @@ static int max14577_muic_jig_handler(struct 
max14577_muic_info *info,
 
switch (cable_type) {
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 */
/* PATH:AP_USB */
-   strcpy(cable_name, "JIG-USB-ON");
path = CTRL1_SW_USB;
break;
case MAX14577_MUIC_ADC_FACTORY_MODE_UART_OFF:   /* ADC_JIG_UART_OFF */
/* PATH:AP_UART */
-   strcpy(cable_name, "JIG-UART-OFF");
path = CTRL1_SW_UART;
break;
default:
@@ -382,7 +369,7 @@ static int max14577_muic_jig_handler(struct 
max14577_muic_info *info,
if (ret < 0)
return ret;
 
-   extcon_set_cable_state(info->edev, cable_name, attached);
+   extcon_set_cable_state(info->edev, "JIG", attached);
 
return 0;
 }
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index a66bec8..1079321 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -209,10 +209,7 @@ enum {
EXTCON_CABLE_CHARGE_DOWNSTREAM,
EXTCON_CABLE_MHL,
EXTCON_CABLE_MHL_TA,
-   EXTCON_CABLE_JIG_USB_ON,
-   EXTCON_CABLE_JIG_USB_OFF,
-   EXTCON_CABLE_JIG_UART_OFF,
-   EXTCON_CABLE_JIG_UART_ON,
+   EXTCON_CABLE_JIG,
EXTCON_CABLE_DOCK_SMART,
EXTCON_CABLE_DOCK_DESK,
EXTCON_CABLE_DOCK_AUDIO,
@@ -229,10 +226,7 @@ static const char *max77693_extcon_cable[] = {
[EXTCON_CABLE_CHARGE_DOWNSTREAM]= "Charge-downstream",
[EXTCON_CABLE_MHL]  = "MHL",
[EXTCON_CABLE_MHL_TA]   = "MHL-TA",
-   [EXTCON_CABLE_JIG_USB_ON]   = "JIG-USB-ON",
-   [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_JIG]  = "JIG",
[EXTCON_CABLE_DOCK_SMART]   = "Dock-Smart",
[EXTCON_CABLE_DOCK_DESK]= "Dock-Desk",
[EXTCON_CABLE_DOCK_AUDIO]   = "Dock-Audio",
@@ -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,
int cable_type, bool attached)
 {
-   char cable_name[32];
int ret = 0;
u8 path = CONTROL1_SW_OPEN;
 
@@ -652,23 +645,13 @@ 

[PATCH 1/4] extcon: Unify the jig cable names on RT8963 and MAX14577/77693/77843

2015-04-27 Thread Chanwoo Choi
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 --|

Cc: Jaewon Kim jaewon02@samsung.com
Cc: Krzysztof Kozlowski k.kozlow...@samsung.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
---
 drivers/extcon/extcon-max14577.c | 19 +++
 drivers/extcon/extcon-max77693.c | 23 +++
 drivers/extcon/extcon-max77843.c | 39 ++-
 drivers/extcon/extcon-rt8973a.c  | 22 +-
 4 files changed, 25 insertions(+), 78 deletions(-)

diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 3823aa4..6d5febe 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -155,10 +155,7 @@ enum {
EXTCON_CABLE_FAST_CHARGER,
EXTCON_CABLE_SLOW_CHARGER,
EXTCON_CABLE_CHARGE_DOWNSTREAM,
-   EXTCON_CABLE_JIG_USB_ON,
-   EXTCON_CABLE_JIG_USB_OFF,
-   EXTCON_CABLE_JIG_UART_OFF,
-   EXTCON_CABLE_JIG_UART_ON,
+   EXTCON_CABLE_JIG,
 
_EXTCON_CABLE_NUM,
 };
@@ -169,10 +166,7 @@ static const char *max14577_extcon_cable[] = {
[EXTCON_CABLE_FAST_CHARGER] = Fast-charger,
[EXTCON_CABLE_SLOW_CHARGER] = Slow-charger,
[EXTCON_CABLE_CHARGE_DOWNSTREAM]= Charge-downstream,
-   [EXTCON_CABLE_JIG_USB_ON]   = JIG-USB-ON,
-   [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_JIG]  = JIG,
 
NULL,
 };
@@ -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,
int cable_type, bool attached)
 {
-   char cable_name[32];
int ret = 0;
u8 path = CTRL1_SW_OPEN;
 
@@ -358,18 +351,12 @@ static int max14577_muic_jig_handler(struct 
max14577_muic_info *info,
 
switch (cable_type) {
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 */
/* PATH:AP_USB */
-   strcpy(cable_name, JIG-USB-ON);
path = CTRL1_SW_USB;
break;
case MAX14577_MUIC_ADC_FACTORY_MODE_UART_OFF:   /* ADC_JIG_UART_OFF */
/* PATH:AP_UART */
-   strcpy(cable_name, JIG-UART-OFF);
path = CTRL1_SW_UART;
break;
default:
@@ -382,7 +369,7 @@ static int max14577_muic_jig_handler(struct 
max14577_muic_info *info,
if (ret  0)
return ret;
 
-   extcon_set_cable_state(info-edev, cable_name, attached);
+   extcon_set_cable_state(info-edev, JIG, attached);
 
return 0;
 }
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index a66bec8..1079321 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -209,10 +209,7 @@ enum {
EXTCON_CABLE_CHARGE_DOWNSTREAM,
EXTCON_CABLE_MHL,
EXTCON_CABLE_MHL_TA,
-   EXTCON_CABLE_JIG_USB_ON,
-   EXTCON_CABLE_JIG_USB_OFF,
-   EXTCON_CABLE_JIG_UART_OFF,
-   EXTCON_CABLE_JIG_UART_ON,
+   EXTCON_CABLE_JIG,
EXTCON_CABLE_DOCK_SMART,
EXTCON_CABLE_DOCK_DESK,
EXTCON_CABLE_DOCK_AUDIO,
@@ -229,10 +226,7 @@ static const char *max77693_extcon_cable[] = {
[EXTCON_CABLE_CHARGE_DOWNSTREAM]= Charge-downstream,
[EXTCON_CABLE_MHL]  = MHL,
[EXTCON_CABLE_MHL_TA]   = MHL-TA,
-   [EXTCON_CABLE_JIG_USB_ON]   = JIG-USB-ON,
-   [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_JIG]  = JIG,
[EXTCON_CABLE_DOCK_SMART]   = Dock-Smart,
[EXTCON_CABLE_DOCK_DESK]= Dock-Desk,
[EXTCON_CABLE_DOCK_AUDIO]   = Dock-Audio,
@@ -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,
int cable_type, bool attached)
 {
-   char cable_name[32];
int ret = 0;
u8 path = CONTROL1_SW_OPEN;
 
@@ -652,23