aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/tc3589x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/tc3589x.c')
-rw-r--r--drivers/mfd/tc3589x.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
index 7deff53181d1..0ed9669d95fa 100644
--- a/drivers/mfd/tc3589x.c
+++ b/drivers/mfd/tc3589x.c
@@ -129,7 +129,7 @@ static struct resource gpio_resources[] = {
129 }, 129 },
130}; 130};
131 131
132static struct mfd_cell tc3589x_devs[] = { 132static struct mfd_cell tc3589x_dev_gpio[] = {
133 { 133 {
134 .name = "tc3589x-gpio", 134 .name = "tc3589x-gpio",
135 .num_resources = ARRAY_SIZE(gpio_resources), 135 .num_resources = ARRAY_SIZE(gpio_resources),
@@ -240,6 +240,26 @@ static int tc3589x_chip_init(struct tc3589x *tc3589x)
240 return tc3589x_reg_write(tc3589x, TC3589x_RSTINTCLR, 0x1); 240 return tc3589x_reg_write(tc3589x, TC3589x_RSTINTCLR, 0x1);
241} 241}
242 242
243static int __devinit tc3589x_device_init(struct tc3589x *tc3589x)
244{
245 int ret = 0;
246 unsigned int blocks = tc3589x->pdata->block;
247
248 if (blocks & TC3589x_BLOCK_GPIO) {
249 ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio,
250 ARRAY_SIZE(tc3589x_dev_gpio), NULL,
251 tc3589x->irq_base);
252 if (ret) {
253 dev_err(tc3589x->dev, "failed to add gpio child\n");
254 return ret;
255 }
256 dev_info(tc3589x->dev, "added gpio block\n");
257 }
258
259 return ret;
260
261}
262
243static int __devinit tc3589x_probe(struct i2c_client *i2c, 263static int __devinit tc3589x_probe(struct i2c_client *i2c,
244 const struct i2c_device_id *id) 264 const struct i2c_device_id *id)
245{ 265{
@@ -281,11 +301,9 @@ static int __devinit tc3589x_probe(struct i2c_client *i2c,
281 goto out_removeirq; 301 goto out_removeirq;
282 } 302 }
283 303
284 ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_devs, 304 ret = tc3589x_device_init(tc3589x);
285 ARRAY_SIZE(tc3589x_devs), NULL,
286 tc3589x->irq_base);
287 if (ret) { 305 if (ret) {
288 dev_err(tc3589x->dev, "failed to add children\n"); 306 dev_err(tc3589x->dev, "failed to add child devices\n");
289 goto out_freeirq; 307 goto out_freeirq;
290 } 308 }
291 309