diff options
author | Sundar Iyer <sundar.iyer@stericsson.com> | 2010-12-12 23:03:15 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@stericsson.com> | 2010-12-19 13:27:49 -0500 |
commit | 611b7590afa6e6c6b0942b1d3efef17fbb348ef5 (patch) | |
tree | 4fc9c73ea4d1f9a9f80c55fa97dafc95f61bd265 | |
parent | 20406ebff4a298e6e3abbc1717a90bb3e55dc820 (diff) |
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: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Sundar Iyer <sundar.iyer@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.c | 1 | ||||
-rw-r--r-- | drivers/mfd/tc3589x.c | 28 | ||||
-rw-r--r-- | include/linux/mfd/tc3589x.h | 7 |
3 files changed, 31 insertions, 5 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index 5c950261968e..060b23aab8e4 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -122,6 +122,7 @@ static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = { | |||
122 | }; | 122 | }; |
123 | 123 | ||
124 | static struct tc3589x_platform_data mop500_tc35892_data = { | 124 | static struct tc3589x_platform_data mop500_tc35892_data = { |
125 | .block = TC3589x_BLOCK_GPIO, | ||
125 | .gpio = &mop500_tc35892_gpio_data, | 126 | .gpio = &mop500_tc35892_gpio_data, |
126 | .irq_base = MOP500_EGPIO_IRQ_BASE, | 127 | .irq_base = MOP500_EGPIO_IRQ_BASE, |
127 | }; | 128 | }; |
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 | ||
132 | static struct mfd_cell tc3589x_devs[] = { | 132 | static 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 | ||
243 | static 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 | |||
243 | static int __devinit tc3589x_probe(struct i2c_client *i2c, | 263 | static 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 | ||
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h index ea1918896f5b..da00958b12d9 100644 --- a/include/linux/mfd/tc3589x.h +++ b/include/linux/mfd/tc3589x.h | |||
@@ -9,6 +9,11 @@ | |||
9 | 9 | ||
10 | #include <linux/device.h> | 10 | #include <linux/device.h> |
11 | 11 | ||
12 | enum tx3589x_block { | ||
13 | TC3589x_BLOCK_GPIO = 1 << 0, | ||
14 | TC3589x_BLOCK_KEYPAD = 1 << 1, | ||
15 | }; | ||
16 | |||
12 | #define TC3589x_RSTCTRL_IRQRST (1 << 4) | 17 | #define TC3589x_RSTCTRL_IRQRST (1 << 4) |
13 | #define TC3589x_RSTCTRL_TIMRST (1 << 3) | 18 | #define TC3589x_RSTCTRL_TIMRST (1 << 3) |
14 | #define TC3589x_RSTCTRL_ROTRST (1 << 2) | 19 | #define TC3589x_RSTCTRL_ROTRST (1 << 2) |
@@ -122,10 +127,12 @@ struct tc3589x_gpio_platform_data { | |||
122 | 127 | ||
123 | /** | 128 | /** |
124 | * struct tc3589x_platform_data - TC3589x platform data | 129 | * struct tc3589x_platform_data - TC3589x platform data |
130 | * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*) | ||
125 | * @irq_base: base IRQ number. %TC3589x_NR_IRQS irqs will be used. | 131 | * @irq_base: base IRQ number. %TC3589x_NR_IRQS irqs will be used. |
126 | * @gpio: GPIO-specific platform data | 132 | * @gpio: GPIO-specific platform data |
127 | */ | 133 | */ |
128 | struct tc3589x_platform_data { | 134 | struct tc3589x_platform_data { |
135 | unsigned int block; | ||
129 | int irq_base; | 136 | int irq_base; |
130 | struct tc3589x_gpio_platform_data *gpio; | 137 | struct tc3589x_gpio_platform_data *gpio; |
131 | }; | 138 | }; |