These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / extcon / extcon-sm5502.c
index 2f93cf3..7aac3cc 100644 (file)
@@ -92,19 +92,11 @@ static struct reg_data sm5502_reg_data[] = {
 };
 
 /* List of detectable cables */
-enum {
-       EXTCON_CABLE_USB = 0,
-       EXTCON_CABLE_USB_HOST,
-       EXTCON_CABLE_TA,
-
-       EXTCON_CABLE_END,
-};
-
-static const char *sm5502_extcon_cable[] = {
-       [EXTCON_CABLE_USB]      = "USB",
-       [EXTCON_CABLE_USB_HOST] = "USB-Host",
-       [EXTCON_CABLE_TA]       = "TA",
-       NULL,
+static const unsigned int sm5502_extcon_cable[] = {
+       EXTCON_USB,
+       EXTCON_USB_HOST,
+       EXTCON_CHG_USB_DCP,
+       EXTCON_NONE,
 };
 
 /* Define supported accessory type */
@@ -377,16 +369,12 @@ static int sm5502_muic_cable_handler(struct sm5502_muic_info *info,
                                     bool attached)
 {
        static unsigned int prev_cable_type = SM5502_MUIC_ADC_GROUND;
-       const char **cable_names = info->edev->supported_cable;
        unsigned int cable_type = SM5502_MUIC_ADC_GROUND;
        unsigned int con_sw = DM_DP_SWITCH_OPEN;
        unsigned int vbus_sw = VBUSIN_SWITCH_OPEN;
-       unsigned int idx = 0;
+       unsigned int id;
        int ret;
 
-       if (!cable_names)
-               return 0;
-
        /* Get the type of attached or detached cable */
        if (attached)
                cable_type = sm5502_muic_get_cable_type(info);
@@ -396,17 +384,17 @@ static int sm5502_muic_cable_handler(struct sm5502_muic_info *info,
 
        switch (cable_type) {
        case SM5502_MUIC_ADC_OPEN_USB:
-               idx     = EXTCON_CABLE_USB;
+               id      = EXTCON_USB;
                con_sw  = DM_DP_SWITCH_USB;
                vbus_sw = VBUSIN_SWITCH_VBUSOUT_WITH_USB;
                break;
        case SM5502_MUIC_ADC_OPEN_TA:
-               idx     = EXTCON_CABLE_TA;
+               id      = EXTCON_CHG_USB_DCP;
                con_sw  = DM_DP_SWITCH_OPEN;
                vbus_sw = VBUSIN_SWITCH_VBUSOUT;
                break;
        case SM5502_MUIC_ADC_OPEN_USB_OTG:
-               idx     = EXTCON_CABLE_USB_HOST;
+               id      = EXTCON_USB_HOST;
                con_sw  = DM_DP_SWITCH_USB;
                vbus_sw = VBUSIN_SWITCH_OPEN;
                break;
@@ -422,7 +410,7 @@ static int sm5502_muic_cable_handler(struct sm5502_muic_info *info,
                return ret;
 
        /* Change the state of external accessory */
-       extcon_set_cable_state(info->edev, cable_names[idx], attached);
+       extcon_set_cable_state_(info->edev, id, attached);
 
        return 0;
 }
@@ -598,7 +586,7 @@ static int sm5022_muic_i2c_probe(struct i2c_client *i2c,
 
        for (i = 0; i < info->num_muic_irqs; i++) {
                struct muic_irq *muic_irq = &info->muic_irqs[i];
-               unsigned int virq = 0;
+               int virq = 0;
 
                virq = regmap_irq_get_virq(info->irq_data, muic_irq->irq);
                if (virq <= 0)
@@ -623,7 +611,6 @@ static int sm5022_muic_i2c_probe(struct i2c_client *i2c,
                dev_err(info->dev, "failed to allocate memory for extcon\n");
                return -ENOMEM;
        }
-       info->edev->name = np->name;
 
        /* Register extcon device */
        ret = devm_extcon_dev_register(info->dev, info->edev);
@@ -663,6 +650,7 @@ static const struct of_device_id sm5502_dt_match[] = {
        { .compatible = "siliconmitus,sm5502-muic" },
        { },
 };
+MODULE_DEVICE_TABLE(of, sm5502_dt_match);
 
 #ifdef CONFIG_PM_SLEEP
 static int sm5502_muic_suspend(struct device *dev)
@@ -698,7 +686,6 @@ MODULE_DEVICE_TABLE(i2c, sm5502_i2c_id);
 static struct i2c_driver sm5502_muic_i2c_driver = {
        .driver         = {
                .name   = "sm5502",
-               .owner  = THIS_MODULE,
                .pm     = &sm5502_muic_pm_ops,
                .of_match_table = sm5502_dt_match,
        },