linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] extcon: Add the EXTCON_CHG_USB_SDP to support SDP charing port
@ 2015-12-29  0:37 Chanwoo Choi
  2015-12-29  1:16 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Chanwoo Choi @ 2015-12-29  0:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: cw00.choi, myungjoo.ham, Krzysztof Kozlowski

This patch adds the new EXTCON_CHG_USB_SDP connector to support SDP (Standard
Downstream Port) USB charging port. The commit 11eecf910bd8 ("extcon: Modify
the id and name of external connector") add the new EXTCON_CHG_USB_SDP
connector which support the both data transfer and usb charging at the same
time.

Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon-max14577.c |  3 +++
 drivers/extcon/extcon-max77693.c | 12 ++++++++++--
 drivers/extcon/extcon-max77843.c |  3 +++
 drivers/extcon/extcon-max8997.c  |  3 +++
 drivers/extcon/extcon-rt8973a.c  |  4 ++++
 drivers/extcon/extcon-sm5502.c   |  4 ++++
 6 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index b30ab97ce75f..852a7112f451 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -150,6 +150,7 @@ enum max14577_muic_acc_type {
 
 static const unsigned int max14577_extcon_cable[] = {
 	EXTCON_USB,
+	EXTCON_CHG_USB_SDP,
 	EXTCON_CHG_USB_DCP,
 	EXTCON_CHG_USB_FAST,
 	EXTCON_CHG_USB_SLOW,
@@ -454,6 +455,8 @@ static int max14577_muic_chg_handler(struct max14577_muic_info *info)
 			return ret;
 
 		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
+		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
+					attached);
 		break;
 	case MAX14577_CHARGER_TYPE_DEDICATED_CHG:
 		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index fdf8f5d4d4e9..b472f2405534 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -204,6 +204,7 @@ enum max77693_muic_acc_type {
 static const unsigned int max77693_extcon_cable[] = {
 	EXTCON_USB,
 	EXTCON_USB_HOST,
+	EXTCON_CHG_USB_SDP,
 	EXTCON_CHG_USB_DCP,
 	EXTCON_CHG_USB_FAST,
 	EXTCON_CHG_USB_SLOW,
@@ -512,8 +513,11 @@ static int max77693_muic_dock_handler(struct max77693_muic_info *info,
 		break;
 	case MAX77693_MUIC_ADC_AV_CABLE_NOLOAD:		/* Dock-Audio */
 		dock_id = EXTCON_DOCK;
-		if (!attached)
+		if (!attached) {
 			extcon_set_cable_state_(info->edev, EXTCON_USB, false);
+			extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
+						false);
+		}
 		break;
 	default:
 		dev_err(info->dev, "failed to detect %s dock device\n",
@@ -601,6 +605,8 @@ static int max77693_muic_adc_ground_handler(struct max77693_muic_info *info)
 		if (ret < 0)
 			return ret;
 		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
+		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
+					attached);
 		break;
 	case MAX77693_MUIC_GND_MHL:
 	case MAX77693_MUIC_GND_MHL_VB:
@@ -830,6 +836,8 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
 			 */
 			extcon_set_cable_state_(info->edev, EXTCON_USB,
 						attached);
+			extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
+						attached);
 
 			if (!cable_attached)
 				extcon_set_cable_state_(info->edev, EXTCON_DOCK,
@@ -897,7 +905,7 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
 			if (ret < 0)
 				return ret;
 
-			extcon_set_cable_state_(info->edev, EXTCON_USB,
+			extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
 						attached);
 			break;
 		case MAX77693_CHARGER_TYPE_DEDICATED_CHG:
diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
index 74dfb7f4f277..7bbc30097771 100644
--- a/drivers/extcon/extcon-max77843.c
+++ b/drivers/extcon/extcon-max77843.c
@@ -122,6 +122,7 @@ enum max77843_muic_charger_type {
 static const unsigned int max77843_extcon_cable[] = {
 	EXTCON_USB,
 	EXTCON_USB_HOST,
+	EXTCON_CHG_USB_SDP,
 	EXTCON_CHG_USB_DCP,
 	EXTCON_CHG_USB_CDP,
 	EXTCON_CHG_USB_FAST,
@@ -486,6 +487,8 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
 			return ret;
 
 		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
+		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
+					attached);
 		break;
 	case MAX77843_MUIC_CHG_DOWNSTREAM:
 		ret = max77843_muic_set_path(info,
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index b2b13b3dce14..79263421b075 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -148,6 +148,7 @@ struct max8997_muic_info {
 static const unsigned int max8997_extcon_cable[] = {
 	EXTCON_USB,
 	EXTCON_USB_HOST,
+	EXTCON_CHG_USB_SDP,
 	EXTCON_CHG_USB_DCP,
 	EXTCON_CHG_USB_FAST,
 	EXTCON_CHG_USB_SLOW,
@@ -484,6 +485,8 @@ static int max8997_muic_chg_handler(struct max8997_muic_info *info)
 			max8997_muic_handle_usb(info,
 					MAX8997_USB_DEVICE, attached);
 		}
+		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
+					attached);
 		break;
 	case MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT:
 		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
diff --git a/drivers/extcon/extcon-rt8973a.c b/drivers/extcon/extcon-rt8973a.c
index 7635a8eaf4c6..97e074d70eca 100644
--- a/drivers/extcon/extcon-rt8973a.c
+++ b/drivers/extcon/extcon-rt8973a.c
@@ -93,6 +93,7 @@ static struct reg_data rt8973a_reg_data[] = {
 static const unsigned int rt8973a_extcon_cable[] = {
 	EXTCON_USB,
 	EXTCON_USB_HOST,
+	EXTCON_CHG_USB_SDP,
 	EXTCON_CHG_USB_DCP,
 	EXTCON_JIG,
 	EXTCON_NONE,
@@ -398,6 +399,9 @@ static int rt8973a_muic_cable_handler(struct rt8973a_muic_info *info,
 
 	/* Change the state of external accessory */
 	extcon_set_cable_state_(info->edev, id, attached);
+	if (id == EXTCON_USB)
+		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
+					attached);
 
 	return 0;
 }
diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c
index 571de2e6e7c4..df769a17e736 100644
--- a/drivers/extcon/extcon-sm5502.c
+++ b/drivers/extcon/extcon-sm5502.c
@@ -95,6 +95,7 @@ static struct reg_data sm5502_reg_data[] = {
 static const unsigned int sm5502_extcon_cable[] = {
 	EXTCON_USB,
 	EXTCON_USB_HOST,
+	EXTCON_CHG_USB_SDP,
 	EXTCON_CHG_USB_DCP,
 	EXTCON_NONE,
 };
@@ -411,6 +412,9 @@ static int sm5502_muic_cable_handler(struct sm5502_muic_info *info,
 
 	/* Change the state of external accessory */
 	extcon_set_cable_state_(info->edev, id, attached);
+	if (id == EXTCON_USB)
+		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
+					attached);
 
 	return 0;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] extcon: Add the EXTCON_CHG_USB_SDP to support SDP charing port
  2015-12-29  0:37 [PATCH] extcon: Add the EXTCON_CHG_USB_SDP to support SDP charing port Chanwoo Choi
@ 2015-12-29  1:16 ` Krzysztof Kozlowski
  2015-12-29  2:57   ` Chanwoo Choi
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2015-12-29  1:16 UTC (permalink / raw)
  To: Chanwoo Choi, linux-kernel; +Cc: myungjoo.ham

On 29.12.2015 09:37, Chanwoo Choi wrote:
> This patch adds the new EXTCON_CHG_USB_SDP connector to support SDP (Standard
> Downstream Port) USB charging port. The commit 11eecf910bd8 ("extcon: Modify
> the id and name of external connector") add the new EXTCON_CHG_USB_SDP
> connector which support the both data transfer and usb charging at the same
> time.
> 
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
>  drivers/extcon/extcon-max14577.c |  3 +++
>  drivers/extcon/extcon-max77693.c | 12 ++++++++++--
>  drivers/extcon/extcon-max77843.c |  3 +++
>  drivers/extcon/extcon-max8997.c  |  3 +++
>  drivers/extcon/extcon-rt8973a.c  |  4 ++++
>  drivers/extcon/extcon-sm5502.c   |  4 ++++
>  6 files changed, 27 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
> index b30ab97ce75f..852a7112f451 100644
> --- a/drivers/extcon/extcon-max14577.c
> +++ b/drivers/extcon/extcon-max14577.c
> @@ -150,6 +150,7 @@ enum max14577_muic_acc_type {
>  
>  static const unsigned int max14577_extcon_cable[] = {
>  	EXTCON_USB,
> +	EXTCON_CHG_USB_SDP,
>  	EXTCON_CHG_USB_DCP,
>  	EXTCON_CHG_USB_FAST,
>  	EXTCON_CHG_USB_SLOW,
> @@ -454,6 +455,8 @@ static int max14577_muic_chg_handler(struct max14577_muic_info *info)
>  			return ret;
>  
>  		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
> +					attached);
>  		break;
>  	case MAX14577_CHARGER_TYPE_DEDICATED_CHG:
>  		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
> index fdf8f5d4d4e9..b472f2405534 100644
> --- a/drivers/extcon/extcon-max77693.c
> +++ b/drivers/extcon/extcon-max77693.c
> @@ -204,6 +204,7 @@ enum max77693_muic_acc_type {
>  static const unsigned int max77693_extcon_cable[] = {
>  	EXTCON_USB,
>  	EXTCON_USB_HOST,
> +	EXTCON_CHG_USB_SDP,
>  	EXTCON_CHG_USB_DCP,
>  	EXTCON_CHG_USB_FAST,
>  	EXTCON_CHG_USB_SLOW,
> @@ -512,8 +513,11 @@ static int max77693_muic_dock_handler(struct max77693_muic_info *info,
>  		break;
>  	case MAX77693_MUIC_ADC_AV_CABLE_NOLOAD:		/* Dock-Audio */
>  		dock_id = EXTCON_DOCK;
> -		if (!attached)
> +		if (!attached) {
>  			extcon_set_cable_state_(info->edev, EXTCON_USB, false);
> +			extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
> +						false);
> +		}
>  		break;
>  	default:
>  		dev_err(info->dev, "failed to detect %s dock device\n",
> @@ -601,6 +605,8 @@ static int max77693_muic_adc_ground_handler(struct max77693_muic_info *info)
>  		if (ret < 0)
>  			return ret;
>  		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
> +					attached);
>  		break;
>  	case MAX77693_MUIC_GND_MHL:
>  	case MAX77693_MUIC_GND_MHL_VB:
> @@ -830,6 +836,8 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
>  			 */
>  			extcon_set_cable_state_(info->edev, EXTCON_USB,
>  						attached);
> +			extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
> +						attached);
>  
>  			if (!cable_attached)
>  				extcon_set_cable_state_(info->edev, EXTCON_DOCK,
> @@ -897,7 +905,7 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
>  			if (ret < 0)
>  				return ret;
>  
> -			extcon_set_cable_state_(info->edev, EXTCON_USB,
> +			extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
>  						attached);


Why for MAX77693_CHARGER_TYPE_USB you are not setting the EXTCON_USB
type? From the description and max14577 code I would suspect that you
want to set both: USB and SDP.

>  			break;
>  		case MAX77693_CHARGER_TYPE_DEDICATED_CHG:
> diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
> index 74dfb7f4f277..7bbc30097771 100644
> --- a/drivers/extcon/extcon-max77843.c
> +++ b/drivers/extcon/extcon-max77843.c
> @@ -122,6 +122,7 @@ enum max77843_muic_charger_type {
>  static const unsigned int max77843_extcon_cable[] = {
>  	EXTCON_USB,
>  	EXTCON_USB_HOST,
> +	EXTCON_CHG_USB_SDP,
>  	EXTCON_CHG_USB_DCP,
>  	EXTCON_CHG_USB_CDP,
>  	EXTCON_CHG_USB_FAST,
> @@ -486,6 +487,8 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
>  			return ret;
>  
>  		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
> +					attached);
>  		break;
>  	case MAX77843_MUIC_CHG_DOWNSTREAM:
>  		ret = max77843_muic_set_path(info,
> diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
> index b2b13b3dce14..79263421b075 100644
> --- a/drivers/extcon/extcon-max8997.c
> +++ b/drivers/extcon/extcon-max8997.c
> @@ -148,6 +148,7 @@ struct max8997_muic_info {
>  static const unsigned int max8997_extcon_cable[] = {
>  	EXTCON_USB,
>  	EXTCON_USB_HOST,
> +	EXTCON_CHG_USB_SDP,
>  	EXTCON_CHG_USB_DCP,
>  	EXTCON_CHG_USB_FAST,
>  	EXTCON_CHG_USB_SLOW,
> @@ -484,6 +485,8 @@ static int max8997_muic_chg_handler(struct max8997_muic_info *info)
>  			max8997_muic_handle_usb(info,
>  					MAX8997_USB_DEVICE, attached);
>  		}
> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
> +					attached);

I am missing something. If this is MAX8997_CHARGER_TYPE_USB but not
MAX8997_MUIC_ADC_OPEN then you will set only SDP, not USB. Aren't they
symmetric?

You aren't setting the SDP in ADC handler, only in charger handler. Why?

Best regards,
Krzysztof

>  		break;
>  	case MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT:
>  		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
> diff --git a/drivers/extcon/extcon-rt8973a.c b/drivers/extcon/extcon-rt8973a.c
> index 7635a8eaf4c6..97e074d70eca 100644
> --- a/drivers/extcon/extcon-rt8973a.c
> +++ b/drivers/extcon/extcon-rt8973a.c
> @@ -93,6 +93,7 @@ static struct reg_data rt8973a_reg_data[] = {
>  static const unsigned int rt8973a_extcon_cable[] = {
>  	EXTCON_USB,
>  	EXTCON_USB_HOST,
> +	EXTCON_CHG_USB_SDP,
>  	EXTCON_CHG_USB_DCP,
>  	EXTCON_JIG,
>  	EXTCON_NONE,
> @@ -398,6 +399,9 @@ static int rt8973a_muic_cable_handler(struct rt8973a_muic_info *info,
>  
>  	/* Change the state of external accessory */
>  	extcon_set_cable_state_(info->edev, id, attached);
> +	if (id == EXTCON_USB)
> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
> +					attached);
>  
>  	return 0;
>  }
> diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c
> index 571de2e6e7c4..df769a17e736 100644
> --- a/drivers/extcon/extcon-sm5502.c
> +++ b/drivers/extcon/extcon-sm5502.c
> @@ -95,6 +95,7 @@ static struct reg_data sm5502_reg_data[] = {
>  static const unsigned int sm5502_extcon_cable[] = {
>  	EXTCON_USB,
>  	EXTCON_USB_HOST,
> +	EXTCON_CHG_USB_SDP,
>  	EXTCON_CHG_USB_DCP,
>  	EXTCON_NONE,
>  };
> @@ -411,6 +412,9 @@ static int sm5502_muic_cable_handler(struct sm5502_muic_info *info,
>  
>  	/* Change the state of external accessory */
>  	extcon_set_cable_state_(info->edev, id, attached);
> +	if (id == EXTCON_USB)
> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
> +					attached);
>  
>  	return 0;
>  }
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] extcon: Add the EXTCON_CHG_USB_SDP to support SDP charing port
  2015-12-29  1:16 ` Krzysztof Kozlowski
@ 2015-12-29  2:57   ` Chanwoo Choi
  0 siblings, 0 replies; 3+ messages in thread
From: Chanwoo Choi @ 2015-12-29  2:57 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-kernel; +Cc: myungjoo.ham

On 2015년 12월 29일 10:16, Krzysztof Kozlowski wrote:
> On 29.12.2015 09:37, Chanwoo Choi wrote:
>> This patch adds the new EXTCON_CHG_USB_SDP connector to support SDP (Standard
>> Downstream Port) USB charging port. The commit 11eecf910bd8 ("extcon: Modify
>> the id and name of external connector") add the new EXTCON_CHG_USB_SDP
>> connector which support the both data transfer and usb charging at the same
>> time.
>>
>> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> ---
>>  drivers/extcon/extcon-max14577.c |  3 +++
>>  drivers/extcon/extcon-max77693.c | 12 ++++++++++--
>>  drivers/extcon/extcon-max77843.c |  3 +++
>>  drivers/extcon/extcon-max8997.c  |  3 +++
>>  drivers/extcon/extcon-rt8973a.c  |  4 ++++
>>  drivers/extcon/extcon-sm5502.c   |  4 ++++
>>  6 files changed, 27 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
>> index b30ab97ce75f..852a7112f451 100644
>> --- a/drivers/extcon/extcon-max14577.c
>> +++ b/drivers/extcon/extcon-max14577.c
>> @@ -150,6 +150,7 @@ enum max14577_muic_acc_type {
>>  
>>  static const unsigned int max14577_extcon_cable[] = {
>>  	EXTCON_USB,
>> +	EXTCON_CHG_USB_SDP,
>>  	EXTCON_CHG_USB_DCP,
>>  	EXTCON_CHG_USB_FAST,
>>  	EXTCON_CHG_USB_SLOW,
>> @@ -454,6 +455,8 @@ static int max14577_muic_chg_handler(struct max14577_muic_info *info)
>>  			return ret;
>>  
>>  		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
>> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
>> +					attached);
>>  		break;
>>  	case MAX14577_CHARGER_TYPE_DEDICATED_CHG:
>>  		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
>> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
>> index fdf8f5d4d4e9..b472f2405534 100644
>> --- a/drivers/extcon/extcon-max77693.c
>> +++ b/drivers/extcon/extcon-max77693.c
>> @@ -204,6 +204,7 @@ enum max77693_muic_acc_type {
>>  static const unsigned int max77693_extcon_cable[] = {
>>  	EXTCON_USB,
>>  	EXTCON_USB_HOST,
>> +	EXTCON_CHG_USB_SDP,
>>  	EXTCON_CHG_USB_DCP,
>>  	EXTCON_CHG_USB_FAST,
>>  	EXTCON_CHG_USB_SLOW,
>> @@ -512,8 +513,11 @@ static int max77693_muic_dock_handler(struct max77693_muic_info *info,
>>  		break;
>>  	case MAX77693_MUIC_ADC_AV_CABLE_NOLOAD:		/* Dock-Audio */
>>  		dock_id = EXTCON_DOCK;
>> -		if (!attached)
>> +		if (!attached) {
>>  			extcon_set_cable_state_(info->edev, EXTCON_USB, false);
>> +			extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
>> +						false);
>> +		}
>>  		break;
>>  	default:
>>  		dev_err(info->dev, "failed to detect %s dock device\n",
>> @@ -601,6 +605,8 @@ static int max77693_muic_adc_ground_handler(struct max77693_muic_info *info)
>>  		if (ret < 0)
>>  			return ret;
>>  		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
>> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
>> +					attached);
>>  		break;
>>  	case MAX77693_MUIC_GND_MHL:
>>  	case MAX77693_MUIC_GND_MHL_VB:
>> @@ -830,6 +836,8 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
>>  			 */
>>  			extcon_set_cable_state_(info->edev, EXTCON_USB,
>>  						attached);
>> +			extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
>> +						attached);
>>  
>>  			if (!cable_attached)
>>  				extcon_set_cable_state_(info->edev, EXTCON_DOCK,
>> @@ -897,7 +905,7 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
>>  			if (ret < 0)
>>  				return ret;
>>  
>> -			extcon_set_cable_state_(info->edev, EXTCON_USB,
>> +			extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
>>  						attached);
> 
> 
> Why for MAX77693_CHARGER_TYPE_USB you are not setting the EXTCON_USB
> type? From the description and max14577 code I would suspect that you
> want to set both: USB and SDP.

You're right. It is my mistake. I'll fix it.

> 
>>  			break;
>>  		case MAX77693_CHARGER_TYPE_DEDICATED_CHG:
>> diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
>> index 74dfb7f4f277..7bbc30097771 100644
>> --- a/drivers/extcon/extcon-max77843.c
>> +++ b/drivers/extcon/extcon-max77843.c
>> @@ -122,6 +122,7 @@ enum max77843_muic_charger_type {
>>  static const unsigned int max77843_extcon_cable[] = {
>>  	EXTCON_USB,
>>  	EXTCON_USB_HOST,
>> +	EXTCON_CHG_USB_SDP,
>>  	EXTCON_CHG_USB_DCP,
>>  	EXTCON_CHG_USB_CDP,
>>  	EXTCON_CHG_USB_FAST,
>> @@ -486,6 +487,8 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
>>  			return ret;
>>  
>>  		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
>> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
>> +					attached);
>>  		break;
>>  	case MAX77843_MUIC_CHG_DOWNSTREAM:
>>  		ret = max77843_muic_set_path(info,
>> diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
>> index b2b13b3dce14..79263421b075 100644
>> --- a/drivers/extcon/extcon-max8997.c
>> +++ b/drivers/extcon/extcon-max8997.c
>> @@ -148,6 +148,7 @@ struct max8997_muic_info {
>>  static const unsigned int max8997_extcon_cable[] = {
>>  	EXTCON_USB,
>>  	EXTCON_USB_HOST,
>> +	EXTCON_CHG_USB_SDP,
>>  	EXTCON_CHG_USB_DCP,
>>  	EXTCON_CHG_USB_FAST,
>>  	EXTCON_CHG_USB_SLOW,
>> @@ -484,6 +485,8 @@ static int max8997_muic_chg_handler(struct max8997_muic_info *info)
>>  			max8997_muic_handle_usb(info,
>>  					MAX8997_USB_DEVICE, attached);
>>  		}
>> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
>> +					attached);
> 
> I am missing something. If this is MAX8997_CHARGER_TYPE_USB but not
> MAX8997_MUIC_ADC_OPEN then you will set only SDP, not USB. Aren't they
> symmetric?
> 
> You aren't setting the SDP in ADC handler, only in charger handler. Why?

EXTCON_CHG_USD_SDP shoule be handled in max8997_muic_handle_usb() function.
I'll fix it as following diff:

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 79263421b075..9a89320d09a8 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -335,6 +335,8 @@ static int max8997_muic_handle_usb(struct max8997_muic_info *info,
                break;
        case MAX8997_USB_DEVICE:
                extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
+               extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
+                                       attached);
                break;
        default:
                dev_err(info->dev, "failed to detect %s usb cable\n",
@@ -485,8 +487,6 @@ static int max8997_muic_chg_handler(struct max8997_muic_info *info)
                        max8997_muic_handle_usb(info,
                                        MAX8997_USB_DEVICE, attached);
                }
-               extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
-                                       attached);
                break;

Best Regards,
Chanwoo Choi

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-29  2:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-29  0:37 [PATCH] extcon: Add the EXTCON_CHG_USB_SDP to support SDP charing port Chanwoo Choi
2015-12-29  1:16 ` Krzysztof Kozlowski
2015-12-29  2:57   ` Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).