Merge tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
[firefly-linux-kernel-4.4.55.git] / drivers / mfd / mc13xxx-i2c.c
index 7957999f30bbe99c17e562f39bfa97f06bc3885c..f745e27ee874a469e734cebd2757542388a0d10d 100644 (file)
 static const struct i2c_device_id mc13xxx_i2c_device_id[] = {
        {
                .name = "mc13892",
-               .driver_data = MC13XXX_ID_MC13892,
+               .driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13892,
+       }, {
+               .name = "mc34708",
+               .driver_data = (kernel_ulong_t)&mc13xxx_variant_mc34708,
        }, {
                /* sentinel */
        }
@@ -34,7 +37,10 @@ MODULE_DEVICE_TABLE(i2c, mc13xxx_i2c_device_id);
 static const struct of_device_id mc13xxx_dt_ids[] = {
        {
                .compatible = "fsl,mc13892",
-               .data = (void *) &mc13xxx_i2c_device_id[0],
+               .data = &mc13xxx_variant_mc13892,
+       }, {
+               .compatible = "fsl,mc34708",
+               .data = &mc13xxx_variant_mc34708,
        }, {
                /* sentinel */
        }
@@ -76,11 +82,15 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
                return ret;
        }
 
-       ret = mc13xxx_common_init(mc13xxx, pdata, client->irq);
+       if (client->dev.of_node) {
+               const struct of_device_id *of_id =
+                       of_match_device(mc13xxx_dt_ids, &client->dev);
+               mc13xxx->variant = of_id->data;
+       } else {
+               mc13xxx->variant = (void *)id->driver_data;
+       }
 
-       if (ret == 0 && (id->driver_data != mc13xxx->ictype))
-               dev_warn(mc13xxx->dev,
-                               "device id doesn't match auto detection!\n");
+       ret = mc13xxx_common_init(mc13xxx, pdata, client->irq);
 
        return ret;
 }