]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/extcon/extcon-max77693.c
extcon: Unify the dock device names on max8997/77693
[karo-tx-linux.git] / drivers / extcon / extcon-max77693.c
index af165fd0c6f54761a56d1cf75d81663173ff400a..652bb13739f133f43027e966cc91045be91c14f9 100644 (file)
@@ -190,8 +190,8 @@ enum max77693_muic_acc_type {
        /* The below accessories have same ADC value so ADCLow and
           ADC1K bit is used to separate specific accessory */
                                                /* ADC|VBVolot|ADCLow|ADC1K| */
-       MAX77693_MUIC_GND_USB_OTG = 0x100,      /* 0x0|      0|     0|    0| */
-       MAX77693_MUIC_GND_USB_OTG_VB = 0x104,   /* 0x0|      1|     0|    0| */
+       MAX77693_MUIC_GND_USB_HOST = 0x100,     /* 0x0|      0|     0|    0| */
+       MAX77693_MUIC_GND_USB_HOST_VB = 0x104,  /* 0x0|      1|     0|    0| */
        MAX77693_MUIC_GND_AV_CABLE_LOAD = 0x102,/* 0x0|      0|     1|    0| */
        MAX77693_MUIC_GND_MHL = 0x103,          /* 0x0|      0|     1|    1| */
        MAX77693_MUIC_GND_MHL_VB = 0x107,       /* 0x0|      1|     1|    1| */
@@ -209,13 +209,8 @@ 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_DOCK_SMART,
-       EXTCON_CABLE_DOCK_DESK,
-       EXTCON_CABLE_DOCK_AUDIO,
+       EXTCON_CABLE_JIG,
+       EXTCON_CABLE_DOCK,
 
        _EXTCON_CABLE_NUM,
 };
@@ -228,14 +223,9 @@ static const char *max77693_extcon_cable[] = {
        [EXTCON_CABLE_SLOW_CHARGER]             = "Slow-charger",
        [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_DOCK_SMART]               = "Dock-Smart",
-       [EXTCON_CABLE_DOCK_DESK]                = "Dock-Desk",
-       [EXTCON_CABLE_DOCK_AUDIO]               = "Dock-Audio",
+       [EXTCON_CABLE_MHL_TA]                   = "MHL-TA",
+       [EXTCON_CABLE_JIG]                      = "JIG",
+       [EXTCON_CABLE_DOCK]                     = "DOCK",
 
        NULL,
 };
@@ -403,8 +393,8 @@ static int max77693_muic_get_cable_type(struct max77693_muic_info *info,
 
                        /**
                         * [0x1|VBVolt|ADCLow|ADC1K]
-                        * [0x1|     0|     0|    0] USB_OTG
-                        * [0x1|     1|     0|    0] USB_OTG_VB
+                        * [0x1|     0|     0|    0] USB_HOST
+                        * [0x1|     1|     0|    0] USB_HSOT_VB
                         * [0x1|     0|     1|    0] Audio Video cable with load
                         * [0x1|     0|     1|    1] MHL without charging cable
                         * [0x1|     1|     1|    1] MHL with charging cable
@@ -507,15 +497,15 @@ static int max77693_muic_dock_handler(struct max77693_muic_info *info,
                }
 
                /*
-                * Notify Dock-Smart/MHL state.
-                * - Dock-Smart device include three type of cable which
+                * Notify Dock/MHL state.
+                * - Dock device include three type of cable which
                 * are HDMI, USB for mouse/keyboard and micro-usb port
-                * for USB/TA cable. Dock-Smart device need always exteranl
-                * power supply(USB/TA cable through micro-usb cable). Dock-
-                * Smart device support screen output of target to separate
+                * for USB/TA cable. Dock device need always exteranl
+                * power supply(USB/TA cable through micro-usb cable). Dock
+                * device support screen output of target to separate
                 * monitor and mouse/keyboard for desktop mode.
                 *
-                * Features of 'USB/TA cable with Dock-Smart device'
+                * Features of 'USB/TA cable with Dock device'
                 * - Support MHL
                 * - Support external output feature of audio
                 * - Support charging through micro-usb port without data
@@ -523,20 +513,20 @@ static int max77693_muic_dock_handler(struct max77693_muic_info *info,
                 * - Support charging and data connection through micro-usb port
                 *           if USB cable is connected between target and host
                 *           device.
-                * - Support OTG device (Mouse/Keyboard)
+                * - Support OTG(On-The-Go) device (Ex: Mouse/Keyboard)
                 */
                ret = max77693_muic_set_path(info, info->path_usb, attached);
                if (ret < 0)
                        return ret;
 
-               extcon_set_cable_state(info->edev, "Dock-Smart", attached);
+               extcon_set_cable_state(info->edev, "DOCK", attached);
                extcon_set_cable_state(info->edev, "MHL", attached);
                goto out;
        case MAX77693_MUIC_ADC_AUDIO_MODE_REMOTE:       /* Dock-Desk */
-               strcpy(dock_name, "Dock-Desk");
+               strcpy(dock_name, "DOCK");
                break;
        case MAX77693_MUIC_ADC_AV_CABLE_NOLOAD:         /* Dock-Audio */
-               strcpy(dock_name, "Dock-Audio");
+               strcpy(dock_name, "DOCK");
                if (!attached)
                        extcon_set_cable_state(info->edev, "USB", false);
                break;
@@ -609,9 +599,9 @@ static int max77693_muic_adc_ground_handler(struct max77693_muic_info *info)
                                MAX77693_CABLE_GROUP_ADC_GND, &attached);
 
        switch (cable_type_gnd) {
-       case MAX77693_MUIC_GND_USB_OTG:
-       case MAX77693_MUIC_GND_USB_OTG_VB:
-               /* USB_OTG, PATH: AP_USB */
+       case MAX77693_MUIC_GND_USB_HOST:
+       case MAX77693_MUIC_GND_USB_HOST_VB:
+               /* USB_HOST, PATH: AP_USB */
                ret = max77693_muic_set_path(info, CONTROL1_SW_USB, attached);
                if (ret < 0)
                        return ret;
@@ -642,7 +632,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 +641,13 @@ static int max77693_muic_jig_handler(struct max77693_muic_info *info,
 
        switch (cable_type) {
        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 */
                /* PATH:AP_USB */
-               strcpy(cable_name, "JIG-USB-ON");
                path = CONTROL1_SW_USB;
                break;
        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 */
                /* PATH:AP_UART */
-               strcpy(cable_name, "JIG-UART-ON");
                path = CONTROL1_SW_UART;
                break;
        default:
@@ -681,7 +660,7 @@ static int max77693_muic_jig_handler(struct max77693_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;
 }
@@ -704,7 +683,7 @@ static int max77693_muic_adc_handler(struct max77693_muic_info *info)
 
        switch (cable_type) {
        case MAX77693_MUIC_ADC_GROUND:
-               /* USB_OTG/MHL/Audio */
+               /* USB_HOST/MHL/Audio */
                max77693_muic_adc_ground_handler(info);
                break;
        case MAX77693_MUIC_ADC_FACTORY_MODE_USB_OFF:
@@ -823,19 +802,19 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
                case MAX77693_MUIC_GND_MHL:
                case MAX77693_MUIC_GND_MHL_VB:
                        /*
-                        * MHL cable with MHL_TA(USB/TA) cable
+                        * MHL cable with MHL-TA(USB/TA) cable
                         * - MHL cable include two port(HDMI line and separate
                         * micro-usb port. When the target connect MHL cable,
-                        * extcon driver check whether MHL_TA(USB/TA) cable is
-                        * connected. If MHL_TA cable is connected, extcon
+                        * extcon driver check whether MHL-TA(USB/TA) cable is
+                        * connected. If MHL-TA cable is connected, extcon
                         * driver notify state to notifiee for charging battery.
                         *
-                        * Features of 'MHL_TA(USB/TA) with MHL cable'
+                        * Features of 'MHL-TA(USB/TA) with MHL cable'
                         * - Support MHL
                         * - Support charging through micro-usb port without
                         *   data connection
                         */
-                       extcon_set_cable_state(info->edev, "MHL_TA", attached);
+                       extcon_set_cable_state(info->edev, "MHL-TA", attached);
                        if (!cable_attached)
                                extcon_set_cable_state(info->edev,
                                                      "MHL", cable_attached);
@@ -864,7 +843,7 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
                        extcon_set_cable_state(info->edev, "USB", attached);
 
                        if (!cable_attached)
-                               extcon_set_cable_state(info->edev, "Dock-Audio",
+                               extcon_set_cable_state(info->edev, "DOCK",
                                                      cable_attached);
                        break;
                case MAX77693_MUIC_ADC_RESERVED_ACC_3:          /* Dock-Smart */
@@ -886,15 +865,14 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
                         * - Support charging and data connection through micro-
                         *   usb port if USB cable is connected between target
                         *   and host device
-                        * - Support OTG device (Mouse/Keyboard)
+                        * - Support OTG(On-The-Go) device (Ex: Mouse/Keyboard)
                         */
                        ret = max77693_muic_set_path(info, info->path_usb,
                                                    attached);
                        if (ret < 0)
                                return ret;
 
-                       extcon_set_cable_state(info->edev, "Dock-Smart",
-                                             attached);
+                       extcon_set_cable_state(info->edev, "DOCK", attached);
                        extcon_set_cable_state(info->edev, "MHL", attached);
 
                        break;
@@ -1019,8 +997,6 @@ static void max77693_muic_irq_work(struct work_struct *work)
                dev_err(info->dev, "failed to handle MUIC interrupt\n");
 
        mutex_unlock(&info->mutex);
-
-       return;
 }
 
 static irqreturn_t max77693_muic_irq_handler(int irq, void *data)
@@ -1171,8 +1147,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
                                muic_irq->name, info);
                if (ret) {
                        dev_err(&pdev->dev,
-                               "failed: irq request (IRQ: %d,"
-                               " error :%d)\n",
+                               "failed: irq request (IRQ: %d, error :%d)\n",
                                muic_irq->irq, ret);
                        return ret;
                }