]> Pileus Git - ~andy/linux/commitdiff
extcon: max77693: Fix bug when detecting MHL/Dock-Audio with USB/TA cable
authorChanwoo Choi <cw00.choi@samsung.com>
Thu, 6 Dec 2012 12:36:18 +0000 (21:36 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 15 Jan 2013 06:42:16 +0000 (15:42 +0900)
This patch fix bug that muic couldn't detect MHL/Dock-Audio with USB/TA
cable on exception situation. I explain detail case on following:

When MHL(with USB/TA cable) or Dock-Audio with USB/TA cable is attached,
the MUIC device happen following two interrupt.
- 'MAX77693_MUIC_IRQ_INT1_ADC' for detecting MHL/Dock-Audio.
- 'MAX77693_MUIC_IRQ_INT2_CHGTYP' for detecting USB/TA cable connected to
MHL/Dock-Audio. Always, happen eariler MAX77693_MUIC_IRQ_INT1_ADC interrupt
than MAX77693_MUIC_IRQ_INT2_CHGTYP interrupt.

If user attach MHL with USB/TA cable and immediately detach MHL with USB/TA
cable before MAX77693_MUIC_IRQ_INT2_CHGTYP interrupt is happened, USB/TA
connected to MHL cable remain connected state to target. But USB/TA connected
to MHL cable isn't connected to target. user be faced with unusual action.
So, driver should check this situation in spite of that, previous charger type
is N/A.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
drivers/extcon/extcon-max77693.c

index abab068adc358eb820c357f632be4dec96895954..28eff88fca1823ce85791f356ba2658ef32df888 100644 (file)
@@ -737,6 +737,7 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
 
        switch (chg_type) {
        case MAX77693_CHARGER_TYPE_USB:
+       case MAX77693_CHARGER_TYPE_NONE:
                /*
                 * MHL_TA(USB/TA) with MHL cable
                 * - MHL cable include two port(HDMI line and separate micro
@@ -778,6 +779,25 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
                        goto out;
                }
 
+               /*
+                * When MHL(with USB/TA cable) or Dock-Audio with USB/TA cable
+                * is attached, muic device happen below two interrupt.
+                * - 'MAX77693_MUIC_IRQ_INT1_ADC' for detecting MHL/Dock-Audio.
+                * - 'MAX77693_MUIC_IRQ_INT2_CHGTYP' for detecting USB/TA cable
+                *   connected to MHL or Dock-Audio.
+                * Always, happen eariler MAX77693_MUIC_IRQ_INT1_ADC interrupt
+                * than MAX77693_MUIC_IRQ_INT2_CHGTYP interrupt.
+                *
+                * If user attach MHL (with USB/TA cable and immediately detach
+                * MHL with USB/TA cable before MAX77693_MUIC_IRQ_INT2_CHGTYP
+                * interrupt is happened, USB/TA cable remain connected state to
+                * target. But USB/TA cable isn't connected to target. The user
+                * be face with unusual action. So, driver should check this
+                * situation in spite of, that previous charger type is N/A.
+                */
+               if (chg_type == MAX77693_CHARGER_TYPE_NONE)
+                       break;
+
                /* Only USB cable, PATH:AP_USB */
                ret = max77693_muic_set_path(info, CONTROL1_SW_USB, attached);
                if (ret < 0)