Merge remote-tracking branch 'stable/linux-3.0.y' into develop-3.0
[firefly-linux-kernel-4.4.55.git] / drivers / mfd / ab8500-core.c
index 62e33e2258d492998aec419bb747fd283fd398c3..fc0c1af1566e08d01b7351de9e1a00466d2c0614 100644 (file)
@@ -254,8 +254,9 @@ static void ab8500_irq_sync_unlock(struct irq_data *data)
                if (new == old)
                        continue;
 
-               /* Interrupt register 12 does'nt exist prior to version 0x20 */
-               if (ab8500_irq_regoffset[i] == 11 && ab8500->chip_id < 0x20)
+               /* Interrupt register 12 doesn't exist prior to version 2.0 */
+               if (ab8500_irq_regoffset[i] == 11 &&
+                       ab8500->chip_id < AB8500_CUT2P0)
                        continue;
 
                ab8500->oldmask[i] = new;
@@ -307,8 +308,8 @@ static irqreturn_t ab8500_irq(int irq, void *dev)
                int status;
                u8 value;
 
-               /* Interrupt register 12 does'nt exist prior to version 0x20 */
-               if (regoffset == 11 && ab8500->chip_id < 0x20)
+               /* Interrupt register 12 doesn't exist prior to version 2.0 */
+               if (regoffset == 11 && ab8500->chip_id < AB8500_CUT2P0)
                        continue;
 
                status = get_register_interruptible(ab8500, AB8500_INTERRUPT,
@@ -362,6 +363,15 @@ static void ab8500_irq_remove(struct ab8500 *ab8500)
        }
 }
 
+static struct resource ab8500_gpio_resources[] = {
+       {
+               .name   = "GPIO_INT6",
+               .start  = AB8500_INT_GPIO6R,
+               .end    = AB8500_INT_GPIO41F,
+               .flags  = IORESOURCE_IRQ,
+       }
+};
+
 static struct resource ab8500_gpadc_resources[] = {
        {
                .name   = "HW_CONV_END",
@@ -595,6 +605,11 @@ static struct mfd_cell ab8500_devs[] = {
        {
                .name = "ab8500-regulator",
        },
+       {
+               .name = "ab8500-gpio",
+               .num_resources = ARRAY_SIZE(ab8500_gpio_resources),
+               .resources = ab8500_gpio_resources,
+       },
        {
                .name = "ab8500-gpadc",
                .num_resources = ARRAY_SIZE(ab8500_gpadc_resources),
@@ -710,17 +725,15 @@ int __devinit ab8500_init(struct ab8500 *ab8500)
        if (ret < 0)
                return ret;
 
-       /*
-        * 0x0 - Early Drop
-        * 0x10 - Cut 1.0
-        * 0x11 - Cut 1.1
-        * 0x20 - Cut 2.0
-        * 0x30 - Cut 3.0
-        */
-       if (value == 0x0 || value == 0x10 || value == 0x11 || value == 0x20 ||
-               value == 0x30) {
+       switch (value) {
+       case AB8500_CUTEARLY:
+       case AB8500_CUT1P0:
+       case AB8500_CUT1P1:
+       case AB8500_CUT2P0:
+       case AB8500_CUT3P0:
                dev_info(ab8500->dev, "detected chip, revision: %#x\n", value);
-       } else {
+               break;
+       default:
                dev_err(ab8500->dev, "unknown chip, revision: %#x\n", value);
                return -EINVAL;
        }
@@ -749,8 +762,9 @@ int __devinit ab8500_init(struct ab8500 *ab8500)
 
        /* Clear and mask all interrupts */
        for (i = 0; i < AB8500_NUM_IRQ_REGS; i++) {
-               /* Interrupt register 12 does'nt exist prior to version 0x20 */
-               if (ab8500_irq_regoffset[i] == 11 && ab8500->chip_id < 0x20)
+               /* Interrupt register 12 doesn't exist prior to version 2.0 */
+               if (ab8500_irq_regoffset[i] == 11 &&
+                       ab8500->chip_id < AB8500_CUT2P0)
                        continue;
 
                get_register_interruptible(ab8500, AB8500_INTERRUPT,