]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/mfd/rohm-bd718x7.c
Merge tag 'dmaengine-fix-5.6-rc1' of git://git.infradead.org/users/vkoul/slave-dma
[linux.git] / drivers / mfd / rohm-bd718x7.c
index 85e7f51333659551229583db92470586bea0af64..c32c1b6c98fa3463db2226547f570f43edca61ec 100644 (file)
@@ -30,14 +30,24 @@ static struct gpio_keys_platform_data bd718xx_powerkey_data = {
        .name = "bd718xx-pwrkey",
 };
 
-static struct mfd_cell bd718xx_mfd_cells[] = {
+static struct mfd_cell bd71837_mfd_cells[] = {
        {
                .name = "gpio-keys",
                .platform_data = &bd718xx_powerkey_data,
                .pdata_size = sizeof(bd718xx_powerkey_data),
        },
-       { .name = "bd718xx-clk", },
-       { .name = "bd718xx-pmic", },
+       { .name = "bd71837-clk", },
+       { .name = "bd71837-pmic", },
+};
+
+static struct mfd_cell bd71847_mfd_cells[] = {
+       {
+               .name = "gpio-keys",
+               .platform_data = &bd718xx_powerkey_data,
+               .pdata_size = sizeof(bd718xx_powerkey_data),
+       },
+       { .name = "bd71847-clk", },
+       { .name = "bd71847-pmic", },
 };
 
 static const struct regmap_irq bd718xx_irqs[] = {
@@ -124,6 +134,9 @@ static int bd718xx_i2c_probe(struct i2c_client *i2c,
 {
        struct bd718xx *bd718xx;
        int ret;
+       unsigned int chip_type;
+       struct mfd_cell *mfd;
+       int cells;
 
        if (!i2c->irq) {
                dev_err(&i2c->dev, "No IRQ configured\n");
@@ -136,8 +149,21 @@ static int bd718xx_i2c_probe(struct i2c_client *i2c,
                return -ENOMEM;
 
        bd718xx->chip_irq = i2c->irq;
-       bd718xx->chip.chip_type = (unsigned int)(uintptr_t)
-                               of_device_get_match_data(&i2c->dev);
+       chip_type = (unsigned int)(uintptr_t)
+                   of_device_get_match_data(&i2c->dev);
+       switch (chip_type) {
+       case ROHM_CHIP_TYPE_BD71837:
+               mfd = bd71837_mfd_cells;
+               cells = ARRAY_SIZE(bd71837_mfd_cells);
+               break;
+       case ROHM_CHIP_TYPE_BD71847:
+               mfd = bd71847_mfd_cells;
+               cells = ARRAY_SIZE(bd71847_mfd_cells);
+               break;
+       default:
+               dev_err(&i2c->dev, "Unknown device type");
+               return -EINVAL;
+       }
        bd718xx->chip.dev = &i2c->dev;
        dev_set_drvdata(&i2c->dev, bd718xx);
 
@@ -170,8 +196,7 @@ static int bd718xx_i2c_probe(struct i2c_client *i2c,
        button.irq = ret;
 
        ret = devm_mfd_add_devices(bd718xx->chip.dev, PLATFORM_DEVID_AUTO,
-                                  bd718xx_mfd_cells,
-                                  ARRAY_SIZE(bd718xx_mfd_cells), NULL, 0,
+                                  mfd, cells, NULL, 0,
                                   regmap_irq_get_domain(bd718xx->irq_data));
        if (ret)
                dev_err(&i2c->dev, "Failed to create subdevices\n");
@@ -188,6 +213,10 @@ static const struct of_device_id bd718xx_of_match[] = {
                .compatible = "rohm,bd71847",
                .data = (void *)ROHM_CHIP_TYPE_BD71847,
        },
+       {
+               .compatible = "rohm,bd71850",
+               .data = (void *)ROHM_CHIP_TYPE_BD71847,
+       },
        { }
 };
 MODULE_DEVICE_TABLE(of, bd718xx_of_match);