Commit 611b7590 authored by Sundar Iyer's avatar Sundar Iyer Committed by Linus Walleij

mfd/tc3589x: add block identifier for multiple child devices

Add block identifier to be able to add multiple mfd clients
to the mfd core
Acked-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
Signed-off-by: default avatarSundar Iyer <sundar.iyer@stericsson.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
parent 20406ebf
...@@ -122,6 +122,7 @@ static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = { ...@@ -122,6 +122,7 @@ static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
}; };
static struct tc3589x_platform_data mop500_tc35892_data = { static struct tc3589x_platform_data mop500_tc35892_data = {
.block = TC3589x_BLOCK_GPIO,
.gpio = &mop500_tc35892_gpio_data, .gpio = &mop500_tc35892_gpio_data,
.irq_base = MOP500_EGPIO_IRQ_BASE, .irq_base = MOP500_EGPIO_IRQ_BASE,
}; };
......
...@@ -129,7 +129,7 @@ static struct resource gpio_resources[] = { ...@@ -129,7 +129,7 @@ static struct resource gpio_resources[] = {
}, },
}; };
static struct mfd_cell tc3589x_devs[] = { static struct mfd_cell tc3589x_dev_gpio[] = {
{ {
.name = "tc3589x-gpio", .name = "tc3589x-gpio",
.num_resources = ARRAY_SIZE(gpio_resources), .num_resources = ARRAY_SIZE(gpio_resources),
...@@ -240,6 +240,26 @@ static int tc3589x_chip_init(struct tc3589x *tc3589x) ...@@ -240,6 +240,26 @@ static int tc3589x_chip_init(struct tc3589x *tc3589x)
return tc3589x_reg_write(tc3589x, TC3589x_RSTINTCLR, 0x1); return tc3589x_reg_write(tc3589x, TC3589x_RSTINTCLR, 0x1);
} }
static int __devinit tc3589x_device_init(struct tc3589x *tc3589x)
{
int ret = 0;
unsigned int blocks = tc3589x->pdata->block;
if (blocks & TC3589x_BLOCK_GPIO) {
ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio,
ARRAY_SIZE(tc3589x_dev_gpio), NULL,
tc3589x->irq_base);
if (ret) {
dev_err(tc3589x->dev, "failed to add gpio child\n");
return ret;
}
dev_info(tc3589x->dev, "added gpio block\n");
}
return ret;
}
static int __devinit tc3589x_probe(struct i2c_client *i2c, static int __devinit tc3589x_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
...@@ -281,11 +301,9 @@ static int __devinit tc3589x_probe(struct i2c_client *i2c, ...@@ -281,11 +301,9 @@ static int __devinit tc3589x_probe(struct i2c_client *i2c,
goto out_removeirq; goto out_removeirq;
} }
ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_devs, ret = tc3589x_device_init(tc3589x);
ARRAY_SIZE(tc3589x_devs), NULL,
tc3589x->irq_base);
if (ret) { if (ret) {
dev_err(tc3589x->dev, "failed to add children\n"); dev_err(tc3589x->dev, "failed to add child devices\n");
goto out_freeirq; goto out_freeirq;
} }
......
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
#include <linux/device.h> #include <linux/device.h>
enum tx3589x_block {
TC3589x_BLOCK_GPIO = 1 << 0,
TC3589x_BLOCK_KEYPAD = 1 << 1,
};
#define TC3589x_RSTCTRL_IRQRST (1 << 4) #define TC3589x_RSTCTRL_IRQRST (1 << 4)
#define TC3589x_RSTCTRL_TIMRST (1 << 3) #define TC3589x_RSTCTRL_TIMRST (1 << 3)
#define TC3589x_RSTCTRL_ROTRST (1 << 2) #define TC3589x_RSTCTRL_ROTRST (1 << 2)
...@@ -122,10 +127,12 @@ struct tc3589x_gpio_platform_data { ...@@ -122,10 +127,12 @@ struct tc3589x_gpio_platform_data {
/** /**
* struct tc3589x_platform_data - TC3589x platform data * struct tc3589x_platform_data - TC3589x platform data
* @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
* @irq_base: base IRQ number. %TC3589x_NR_IRQS irqs will be used. * @irq_base: base IRQ number. %TC3589x_NR_IRQS irqs will be used.
* @gpio: GPIO-specific platform data * @gpio: GPIO-specific platform data
*/ */
struct tc3589x_platform_data { struct tc3589x_platform_data {
unsigned int block;
int irq_base; int irq_base;
struct tc3589x_gpio_platform_data *gpio; struct tc3589x_gpio_platform_data *gpio;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment