mm/migrate: correct failure handling if !hugepage_migration_support()
[firefly-linux-kernel-4.4.55.git] / drivers / mfd / tc3589x.c
index 70f4909fee13b8d30a632029a9639b41b81cb051..2cf636c267d9413f77e39d787b6a47496ce1859e 100644 (file)
 #include <linux/mfd/core.h>
 #include <linux/mfd/tc3589x.h>
 
+/**
+ * enum tc3589x_version - indicates the TC3589x version
+ */
+enum tc3589x_version {
+       TC3589X_TC35890,
+       TC3589X_TC35892,
+       TC3589X_TC35893,
+       TC3589X_TC35894,
+       TC3589X_TC35895,
+       TC3589X_TC35896,
+       TC3589X_UNKNOWN,
+};
+
 #define TC3589x_CLKMODE_MODCTL_SLEEP           0x0
 #define TC3589x_CLKMODE_MODCTL_OPERATION       (1 << 0)
 
@@ -142,7 +155,7 @@ static struct resource keypad_resources[] = {
        },
 };
 
-static struct mfd_cell tc3589x_dev_gpio[] = {
+static const struct mfd_cell tc3589x_dev_gpio[] = {
        {
                .name           = "tc3589x-gpio",
                .num_resources  = ARRAY_SIZE(gpio_resources),
@@ -151,7 +164,7 @@ static struct mfd_cell tc3589x_dev_gpio[] = {
        },
 };
 
-static struct mfd_cell tc3589x_dev_keypad[] = {
+static const struct mfd_cell tc3589x_dev_keypad[] = {
        {
                .name           = "tc3589x-keypad",
                .num_resources  = ARRAY_SIZE(keypad_resources),
@@ -361,7 +374,21 @@ static int tc3589x_probe(struct i2c_client *i2c,
        tc3589x->i2c = i2c;
        tc3589x->pdata = pdata;
        tc3589x->irq_base = pdata->irq_base;
-       tc3589x->num_gpio = id->driver_data;
+
+       switch (id->driver_data) {
+       case TC3589X_TC35893:
+       case TC3589X_TC35895:
+       case TC3589X_TC35896:
+               tc3589x->num_gpio = 20;
+               break;
+       case TC3589X_TC35890:
+       case TC3589X_TC35892:
+       case TC3589X_TC35894:
+       case TC3589X_UNKNOWN:
+       default:
+               tc3589x->num_gpio = 24;
+               break;
+       }
 
        i2c_set_clientdata(i2c, tc3589x);
 
@@ -432,7 +459,13 @@ static int tc3589x_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resume);
 
 static const struct i2c_device_id tc3589x_id[] = {
-       { "tc3589x", 24 },
+       { "tc35890", TC3589X_TC35890 },
+       { "tc35892", TC3589X_TC35892 },
+       { "tc35893", TC3589X_TC35893 },
+       { "tc35894", TC3589X_TC35894 },
+       { "tc35895", TC3589X_TC35895 },
+       { "tc35896", TC3589X_TC35896 },
+       { "tc3589x", TC3589X_UNKNOWN },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, tc3589x_id);