diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-07-26 16:36:17 +0530 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-07-31 03:42:04 -0700 |
commit | 0158c77a8bede54da353a2069b5c4bf71c078c3a (patch) | |
tree | 89305e12ad81d4b1a12c3c4e968fc7a6fc1060f9 /drivers/mfd | |
parent | 2bd2f90abcaf21b130beb3b5310d74664f21a5d5 (diff) |
mfd: tps80031: add subdevs through mfd_add_devices()
Add provision to register sub devices through mfd sub
devices. This will help to move all sub devices as
mfd subdevices.
Change-Id: Ibc9f56a210d852749cdc3be7da92d54aad298a21
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/118957
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/tps80031.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/mfd/tps80031.c b/drivers/mfd/tps80031.c index 42e1faaa3155..e8a00a846046 100644 --- a/drivers/mfd/tps80031.c +++ b/drivers/mfd/tps80031.c @@ -297,6 +297,14 @@ struct tps80031 { struct regmap *regmap[TPS_NUM_SLAVES]; }; +/* TPS80031 sub mfd devices */ +static struct mfd_cell tps80031_cell[] = { + { + .name = "tps80031-regulators", + }, +}; + + int tps80031_write(struct device *dev, int sid, int reg, uint8_t val) { struct tps80031 *tps80031 = dev_get_drvdata(dev); @@ -1226,6 +1234,8 @@ static int __devexit tps80031_i2c_remove(struct i2c_client *client) struct tps80031 *tps80031 = i2c_get_clientdata(client); int i; + mfd_remove_devices(tps80031->dev); + if (client->irq) free_irq(client->irq, tps80031); @@ -1331,6 +1341,13 @@ static int __devinit tps80031_i2c_probe(struct i2c_client *client, tps80031_init_ext_control(tps80031, pdata); + ret = mfd_add_devices(tps80031->dev, -1, + tps80031_cell, ARRAY_SIZE(tps80031_cell), NULL, 0); + if (ret < 0) { + dev_err(&client->dev, "mfd_add_devices failed: %d\n", ret); + goto fail_mfd_add; + } + ret = tps80031_add_subdevs(tps80031, pdata); if (ret) { dev_err(&client->dev, "add devices failed: %d\n", ret); @@ -1353,9 +1370,11 @@ static int __devinit tps80031_i2c_probe(struct i2c_client *client, return 0; fail_add_subdev: + mfd_remove_devices(tps80031->dev); + +fail_mfd_add: if (client->irq) free_irq(client->irq, tps80031); - fail_client_reg: for (i = 0; i < TPS_NUM_SLAVES; i++) { struct tps80031_client *tps = &tps80031->tps_clients[i]; |