Skip to contentSkip to conversation

Add support for USB accessories in the max77843 extcon

PATCH In review Andi Shyti 3 participants 7 messages Apr 2, 2017 – Apr 3, 2017

Subsystems (2)
lore
Share & tools
lore

Andi Shyti

author
#0 lore raw

v2 cover Add support for USB accessories in the max77843 extcon

From: Andi Shyti <[email protected]>

Hi,

this patchset add handling of external USB accessories that are connected to the extcon max77843 device.

The first patch is preparatory, that mainly aims to improve the readability of the second patch. It makes some code refactoring reducing the duplicated code, the result is exactly the same.

It has been tested on TM2 with mainline kernel 4.11-rc4.

Andi

Changelog v1 -> v2
------------------
Added a comment to explain better the meaning of the MAX77843_MUIC_ADC_RESERVED_ACC_* devices as recommended by Krzysztof.

Andi Shyti (2):
extcon: max77843: improve the code and minimize duplicated lines
extcon: max77843: support USB accessories as external USB hosts

 drivers/extcon/extcon-max77843.c | 57 +++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 30 deletions(-)
Signature · 1 line
2.11.0
author
#1 lore raw

PATCH v2 1/2 extcon: max77843: improve the code and minimize duplicated lines

From: Andi Shyti <[email protected]>

---
 drivers/extcon/extcon-max77843.c | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)
drivers/extcon/extcon-max77843.c +8 -25
index 6e722d552cf1..fcdabc4b4025 100644
@@ -264,37 +264,20 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
 		chg_type = info->status[MAX77843_MUIC_STATUS2] &
 				MAX77843_MUIC_STATUS2_CHGTYP_MASK;
 
-		/* Check GROUND accessory with charger cable */
-		if (adc == MAX77843_MUIC_ADC_GROUND) {
-			if (chg_type == MAX77843_MUIC_CHG_NONE) {
-				/*
-				 * The following state when charger cable is
-				 * disconnected but the GROUND accessory still
-				 * connected.
-				 */
-				*attached = false;
-				cable_type = info->prev_chg_type;
-				info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
-			} else {
-
-				/*
-				 * The following state when charger cable is
-				 * connected on the GROUND accessory.
-				 */
-				*attached = true;
-				cable_type = MAX77843_MUIC_CHG_GND;
-				info->prev_chg_type = MAX77843_MUIC_CHG_GND;
-			}
-			break;
-		}
-
 		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 = chg_type;
+			switch (adc) {
+			case MAX77843_MUIC_ADC_GROUND:
+				info->prev_chg_type = MAX77843_MUIC_CHG_GND;
+				break;
+			default:
+				info->prev_chg_type = chg_type;
+			}
+			cable_type = info->prev_chg_type;
 		}
 		break;
 	case MAX77843_CABLE_GROUP_ADC_GND:
Signature · 1 line
2.11.0
maintainer
#2 lore raw

Re: [PATCH v2 1/2] extcon: max77843: improve the code and minimize duplicated lines

Hi,

Actually, I checked this patch on following four case. It is same operation between before and after.
-------------------------------------------------------------
| adc | chg_type |
-------------------------------------------------------------

case 1 | MAX77843_MUIC_ADC_GROUND  | MAX77843_MUIC_CHG_NONE |
case 2 | MAX77843_MUIC_ADC_GROUND  |                        |
case 3 |                           | MAX77843_MUIC_CHG_NONE |
case 4 |                           |                        |

-------------------------------------------------------------

But, I don't want to apply this patch.

By applying this patch, I think there is no huge benefits
and certainly I prefer to remain the all descriptions for specific use-case. (- This patch deletes the 13 lines and add new 8 lines except for the comment.)

Quoted 58 lines · Andi Shyti

From: Andi Shyti <[email protected]>

---
 drivers/extcon/extcon-max77843.c | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)
drivers/extcon/extcon-max77843.c +8 -25
index 6e722d552cf1..fcdabc4b4025 100644
@@ -264,37 +264,20 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
 		chg_type = info->status[MAX77843_MUIC_STATUS2] &
 				MAX77843_MUIC_STATUS2_CHGTYP_MASK;
 
-		/* Check GROUND accessory with charger cable */
-		if (adc == MAX77843_MUIC_ADC_GROUND) {
-			if (chg_type == MAX77843_MUIC_CHG_NONE) {
-				/*
-				 * The following state when charger cable is
-				 * disconnected but the GROUND accessory still
-				 * connected.
-				 */
-				*attached = false;
-				cable_type = info->prev_chg_type;
-				info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
-			} else {
-
-				/*
-				 * The following state when charger cable is
-				 * connected on the GROUND accessory.
-				 */
-				*attached = true;
-				cable_type = MAX77843_MUIC_CHG_GND;
-				info->prev_chg_type = MAX77843_MUIC_CHG_GND;
-			}
-			break;
-		}
-
 		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 = chg_type;
+			switch (adc) {
+			case MAX77843_MUIC_ADC_GROUND:
+				info->prev_chg_type = MAX77843_MUIC_CHG_GND;
+				break;
+			default:
+				info->prev_chg_type = chg_type;
+			}
+			cable_type = info->prev_chg_type;
 		}
 		break;
 	case MAX77843_CABLE_GROUP_ADC_GND:
Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics
author
#3 lore raw

PATCH v2 2/2 extcon: max77843: support USB accessories as external USB hosts

In reply to Andi Shyti

From: Andi Shyti <[email protected]>

The ADC state defines the resistance that a USB device has in order to distinguish between devices.

The external accessories (like the Gear VR) are defined as:

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_RESERVED_ACC_5

and they should be set as such in the extcon driver.

Do not ignore interrupts generated by external accessories by handling cables of the type from any of the above.

Do not handle any charging related action. This can be misleading as also external devices might have some power and in such cases the MUIC might consider them as power providers. In this case check the value of the adc and if it corresponds to one or the MAX77843_MUIC_ADC_RESERVED_ACC_*, return a no-action value (MAX77843_MUIC_CHG_NONE).

---
 drivers/extcon/extcon-max77843.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/extcon/extcon-max77843.c +19 -5
index fcdabc4b4025..154d65afd45a 100644
@@ -271,6 +271,20 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
 		} else {
 			*attached = true;
 			switch (adc) {
+			/*
+			 * the MAX77843_MUIC_ADC_RESERVED_ACC_* type are
+			 * external eccessories and as such they don't
+			 * need any charging action. In this case just
+			 * return MAX77843_MUIC_CHG_NONE so that charging type
+			 * interrupts are ignored.
+			 */
+			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:
+				info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
+				break;
 			case MAX77843_MUIC_ADC_GROUND:
 				info->prev_chg_type = MAX77843_MUIC_CHG_GND;
 				break;
@@ -403,6 +417,11 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
 
 	switch (cable_type) {
 	case MAX77843_MUIC_ADC_GROUND:
+	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:
 		ret = max77843_muic_adc_gnd_handler(info);
 		if (ret < 0)
 			return ret;
@@ -427,11 +446,6 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
 	case MAX77843_MUIC_ADC_REMOTE_S10_BUTTON:
 	case MAX77843_MUIC_ADC_REMOTE_S11_BUTTON:
 	case MAX77843_MUIC_ADC_REMOTE_S12_BUTTON:
-	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:
 	case MAX77843_MUIC_ADC_TTY_CONVERTER:
Signature · 1 line
2.11.0
maintainer
#4 lore raw

Re: [PATCH v2 2/2] extcon: max77843: support USB accessories as external USB hosts

Hi,

Quoted 35 lines · Andi Shyti

From: Andi Shyti <[email protected]>

The ADC state defines the resistance that a USB device has in order to distinguish between devices.

The external accessories (like the Gear VR) are defined as:

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_RESERVED_ACC_5

and they should be set as such in the extcon driver.

Do not ignore interrupts generated by external accessories by handling cables of the type from any of the above.

Do not handle any charging related action. This can be misleading as also external devices might have some power and in such cases the MUIC might consider them as power providers. In this case check the value of the adc and if it corresponds to one or the MAX77843_MUIC_ADC_RESERVED_ACC_*, return a no-action value (MAX77843_MUIC_CHG_NONE).

---
 drivers/extcon/extcon-max77843.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/extcon/extcon-max77843.c +0 -0
index fcdabc4b4025..154d65afd45a 100644

drivers/extcon/extcon-max77843.c static int max77843_muic_get_cable_type(struct max77843_muic_info *info, · line 276

Quoted 6 lines
drivers/extcon/extcon-max77843.c +3 -0
@@ -271,6 +271,20 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
 		} else {
 			*attached = true;
 			switch (adc) {
+			/*
+			 * the MAX77843_MUIC_ADC_RESERVED_ACC_* type are
+			 * external eccessories and as such they don't

s/eccessories/accessories

Quoted 29 lines
drivers/extcon/extcon-max77843.c +16 -0
+			 * need any charging action. In this case just
+			 * return MAX77843_MUIC_CHG_NONE so that charging type
+			 * interrupts are ignored.
+			 */
+			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:
+				info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
+				break;
 			case MAX77843_MUIC_ADC_GROUND:
 				info->prev_chg_type = MAX77843_MUIC_CHG_GND;
 				break;
@@ -403,6 +417,11 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
 
 	switch (cable_type) {
 	case MAX77843_MUIC_ADC_GROUND:
+	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:
 		ret = max77843_muic_adc_gnd_handler(info);
 		if (ret < 0)
 			return ret;
@@ -427,11 +446,6 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
 	case MAX77843_MUIC_ADC_REMOTE_S10_BUTTON:

drivers/extcon/extcon-max77843.c static int max77843_muic_adc_handler(struct max77843_muic_info *info) · line 451

Quoted 10 lines
drivers/extcon/extcon-max77843.c +0 -5
 	case MAX77843_MUIC_ADC_REMOTE_S11_BUTTON:
 	case MAX77843_MUIC_ADC_REMOTE_S12_BUTTON:
-	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:
 	case MAX77843_MUIC_ADC_TTY_CONVERTER:

The extcon-max77843.c driver was implemented with real use-case by testing the various kind of external connectors.

I want to apply the part for real use-case of this patch.
As I knew, you tested this patch with only MAX77843_MUIC_ADC_RESERVED_ACC_4. So, I prefer to apply following patch only for MAX77843_MUIC_ADC_RESERVED_ACC_4.

--

 drivers/extcon/extcon-max77843.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/extcon/extcon-max77843.c +11 -1
index fcdabc4b4025..45367d74bc01 100644
@@ -271,6 +271,16 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
                } else {
                        *attached = true;
                        switch (adc) {
+                       case MAX77843_MUIC_ADC_RESERVED_ACC_4:
+                               /*
+                                * The MAX77843_MUIC_ADC_RESERVED_ACC_* type are
+                                * external accessories and as such they don't
+                                * need any charging action. In this case just
+                                * return MAX77843_MUIC_CHG_NONE so that
+                                * charging type interrupts are ignored.
+                                */
+                               info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
+                               break;
                        case MAX77843_MUIC_ADC_GROUND:
                                info->prev_chg_type = MAX77843_MUIC_CHG_GND;
                                break;
@@ -403,6 +413,7 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
 
        switch (cable_type) {
        case MAX77843_MUIC_ADC_GROUND:
+       case MAX77843_MUIC_ADC_RESERVED_ACC_4:
                ret = max77843_muic_adc_gnd_handler(info);
                if (ret < 0)
                        return ret;
@@ -430,7 +441,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:
Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics
#5 lore raw

Re: [PATCH v2 2/2] extcon: max77843: support USB accessories as external USB hosts

Hi Chanwoo,

Quoted 29 lines
Quoted 15 lines
drivers/extcon/extcon-max77843.c +5 -0
@@ -403,6 +417,11 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
 
 	switch (cable_type) {
 	case MAX77843_MUIC_ADC_GROUND:
+	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:
 		ret = max77843_muic_adc_gnd_handler(info);
 		if (ret < 0)
 			return ret;
@@ -427,11 +446,6 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
 	case MAX77843_MUIC_ADC_REMOTE_S10_BUTTON:

drivers/extcon/extcon-max77843.c static int max77843_muic_adc_handler(struct max77843_muic_info *info) · line 451

Quoted 10 lines
drivers/extcon/extcon-max77843.c +0 -5
 	case MAX77843_MUIC_ADC_REMOTE_S11_BUTTON:
 	case MAX77843_MUIC_ADC_REMOTE_S12_BUTTON:
-	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:
 	case MAX77843_MUIC_ADC_TTY_CONVERTER:

The extcon-max77843.c driver was implemented with real use-case by testing the various kind of external connectors.

Quoted 3 lines

I want to apply the part for real use-case of this patch.
As I knew, you tested this patch with only MAX77843_MUIC_ADC_RESERVED_ACC_4. So, I prefer to apply following patch only for MAX77843_MUIC_ADC_RESERVED_ACC_4.

OK, I will do as you say, although I don't agree (as we discussed on review.tizen.org).

I will drop patch 1 and change only ACC_4.

Quoted 34 lines

--

 drivers/extcon/extcon-max77843.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/extcon/extcon-max77843.c +11 -0
index fcdabc4b4025..45367d74bc01 100644
@@ -271,6 +271,16 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
                } else {
                        *attached = true;
                        switch (adc) {
+                       case MAX77843_MUIC_ADC_RESERVED_ACC_4:
+                               /*
+                                * The MAX77843_MUIC_ADC_RESERVED_ACC_* type are
+                                * external accessories and as such they don't
+                                * need any charging action. In this case just
+                                * return MAX77843_MUIC_CHG_NONE so that
+                                * charging type interrupts are ignored.
+                                */
+                               info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
+                               break;
                        case MAX77843_MUIC_ADC_GROUND:
                                info->prev_chg_type = MAX77843_MUIC_CHG_GND;
                                break;
@@ -403,6 +413,7 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
 
        switch (cable_type) {
        case MAX77843_MUIC_ADC_GROUND:
+       case MAX77843_MUIC_ADC_RESERVED_ACC_4:
                ret = max77843_muic_adc_gnd_handler(info);
                if (ret < 0)
                        return ret;

drivers/extcon/extcon-max77843.c static int max77843_muic_adc_handler(struct max77843_muic_info *info) · line 446

Quoted 7 lines
drivers/extcon/extcon-max77843.c +0 -1
@@ -430,7 +441,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:

This patch, of course, doesn't make sense because it's based on top of the previous that you asked me to drop. I will send the correct one.

Thanks,
Andi

maintainer
#6 lore raw

Re: [PATCH v2 2/2] extcon: max77843: support USB accessories as external USB hosts

Quoted 31 lines · Andi Shyti

Hi Chanwoo,

Quoted 29 lines
Quoted 15 lines
drivers/extcon/extcon-max77843.c +5 -0
@@ -403,6 +417,11 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
 
 	switch (cable_type) {
 	case MAX77843_MUIC_ADC_GROUND:
+	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:
 		ret = max77843_muic_adc_gnd_handler(info);
 		if (ret < 0)
 			return ret;
@@ -427,11 +446,6 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
 	case MAX77843_MUIC_ADC_REMOTE_S10_BUTTON:

drivers/extcon/extcon-max77843.c static int max77843_muic_adc_handler(struct max77843_muic_info *info) · line 451

Quoted 10 lines
drivers/extcon/extcon-max77843.c +0 -5
 	case MAX77843_MUIC_ADC_REMOTE_S11_BUTTON:
 	case MAX77843_MUIC_ADC_REMOTE_S12_BUTTON:
-	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:
 	case MAX77843_MUIC_ADC_TTY_CONVERTER:

The extcon-max77843.c driver was implemented with real use-case by testing the various kind of external connectors.

Quoted 6 lines
Quoted 3 lines

I want to apply the part for real use-case of this patch.
As I knew, you tested this patch with only MAX77843_MUIC_ADC_RESERVED_ACC_4. So, I prefer to apply following patch only for MAX77843_MUIC_ADC_RESERVED_ACC_4.

OK, I will do as you say, although I don't agree (as we discussed on review.tizen.org).

I'm not sure that other MAX77843_MUIC_ADC_RESERVED_ACC_1/2/3/5 are always same with MAX77843_MUIC_ADC_RESERVED_ACC_4. Also, we don't have the any test case for MAX77843_MUIC_ADC_RESERVED_ACC_1/2/3/5.

Quoted 55 lines

I will drop patch 1 and change only ACC_4.

Quoted 34 lines

--

 drivers/extcon/extcon-max77843.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/extcon/extcon-max77843.c +11 -0
index fcdabc4b4025..45367d74bc01 100644
@@ -271,6 +271,16 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
                } else {
                        *attached = true;
                        switch (adc) {
+                       case MAX77843_MUIC_ADC_RESERVED_ACC_4:
+                               /*
+                                * The MAX77843_MUIC_ADC_RESERVED_ACC_* type are
+                                * external accessories and as such they don't
+                                * need any charging action. In this case just
+                                * return MAX77843_MUIC_CHG_NONE so that
+                                * charging type interrupts are ignored.
+                                */
+                               info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
+                               break;
                        case MAX77843_MUIC_ADC_GROUND:
                                info->prev_chg_type = MAX77843_MUIC_CHG_GND;
                                break;
@@ -403,6 +413,7 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
 
        switch (cable_type) {
        case MAX77843_MUIC_ADC_GROUND:
+       case MAX77843_MUIC_ADC_RESERVED_ACC_4:
                ret = max77843_muic_adc_gnd_handler(info);
                if (ret < 0)
                        return ret;

drivers/extcon/extcon-max77843.c static int max77843_muic_adc_handler(struct max77843_muic_info *info) · line 446

Quoted 7 lines
drivers/extcon/extcon-max77843.c +0 -1
@@ -430,7 +441,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:

This patch, of course, doesn't make sense because it's based on top of the previous that you asked me to drop. I will send the correct one.

Thanks,
Andi

.

Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics