diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-20 17:13:52 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-02-18 18:15:30 -0500 |
commit | abe06082d07fcb0673cb93338c1d6f037fdc375b (patch) | |
tree | 1ea446f1a77a30f3cb06e19f1af6f2a4ddfb6b6b | |
parent | a6aecae29affdd1a84198afe45ef9e13ecbf9826 (diff) |
MFD: mcp/ucb1x00: separate ucb1x00 driver data from the MCP data
Patch taken from 5dd7bf59e0 (ARM: sa11x0: Implement autoloading of codec
and codec pdata for mcp bus.) by Jochen Friedrich <jochen@scram.de>.
This adds just the codec data part of the patch.
Acked-by: Jochen Friedrich <jochen@scram.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-sa1100/collie.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/include/mach/mcp.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/simpad.c | 7 | ||||
-rw-r--r-- | drivers/mfd/mcp-core.c | 3 | ||||
-rw-r--r-- | drivers/mfd/mcp-sa11x0.c | 3 | ||||
-rw-r--r-- | drivers/mfd/ucb1x00-core.c | 7 | ||||
-rw-r--r-- | include/linux/mfd/mcp.h | 3 | ||||
-rw-r--r-- | include/linux/mfd/ucb1x00.h | 3 |
8 files changed, 24 insertions, 11 deletions
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index efa2bc132cbf..0e7359785159 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/tty.h> | 22 | #include <linux/tty.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/mfd/ucb1x00.h> | ||
25 | #include <linux/mtd/mtd.h> | 26 | #include <linux/mtd/mtd.h> |
26 | #include <linux/mtd/partitions.h> | 27 | #include <linux/mtd/partitions.h> |
27 | #include <linux/timer.h> | 28 | #include <linux/timer.h> |
@@ -85,10 +86,14 @@ static struct scoop_pcmcia_config collie_pcmcia_config = { | |||
85 | .num_devs = 1, | 86 | .num_devs = 1, |
86 | }; | 87 | }; |
87 | 88 | ||
89 | static struct ucb1x00_plat_data collie_ucb1x00_data = { | ||
90 | .gpio_base = COLLIE_TC35143_GPIO_BASE, | ||
91 | }; | ||
92 | |||
88 | static struct mcp_plat_data collie_mcp_data = { | 93 | static struct mcp_plat_data collie_mcp_data = { |
89 | .mccr0 = MCCR0_ADM | MCCR0_ExtClk, | 94 | .mccr0 = MCCR0_ADM | MCCR0_ExtClk, |
90 | .sclk_rate = 9216000, | 95 | .sclk_rate = 9216000, |
91 | .gpio_base = COLLIE_TC35143_GPIO_BASE, | 96 | .codec_pdata = &collie_ucb1x00_data, |
92 | }; | 97 | }; |
93 | 98 | ||
94 | /* | 99 | /* |
diff --git a/arch/arm/mach-sa1100/include/mach/mcp.h b/arch/arm/mach-sa1100/include/mach/mcp.h index ed1a331508a7..4b2860ae3828 100644 --- a/arch/arm/mach-sa1100/include/mach/mcp.h +++ b/arch/arm/mach-sa1100/include/mach/mcp.h | |||
@@ -16,7 +16,7 @@ struct mcp_plat_data { | |||
16 | u32 mccr0; | 16 | u32 mccr0; |
17 | u32 mccr1; | 17 | u32 mccr1; |
18 | unsigned int sclk_rate; | 18 | unsigned int sclk_rate; |
19 | int gpio_base; | 19 | void *codec_pdata; |
20 | }; | 20 | }; |
21 | 21 | ||
22 | #endif | 22 | #endif |
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c index 3aa36ec21039..81506562ee26 100644 --- a/arch/arm/mach-sa1100/simpad.c +++ b/arch/arm/mach-sa1100/simpad.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/string.h> | 10 | #include <linux/string.h> |
11 | #include <linux/pm.h> | 11 | #include <linux/pm.h> |
12 | #include <linux/platform_device.h> | 12 | #include <linux/platform_device.h> |
13 | #include <linux/mfd/ucb1x00.h> | ||
13 | #include <linux/mtd/mtd.h> | 14 | #include <linux/mtd/mtd.h> |
14 | #include <linux/mtd/partitions.h> | 15 | #include <linux/mtd/partitions.h> |
15 | #include <linux/io.h> | 16 | #include <linux/io.h> |
@@ -187,10 +188,14 @@ static struct resource simpad_flash_resources [] = { | |||
187 | } | 188 | } |
188 | }; | 189 | }; |
189 | 190 | ||
191 | static struct ucb1x00_plat_data simpad_ucb1x00_data = { | ||
192 | .gpio_base = SIMPAD_UCB1X00_GPIO_BASE, | ||
193 | }; | ||
194 | |||
190 | static struct mcp_plat_data simpad_mcp_data = { | 195 | static struct mcp_plat_data simpad_mcp_data = { |
191 | .mccr0 = MCCR0_ADM, | 196 | .mccr0 = MCCR0_ADM, |
192 | .sclk_rate = 11981000, | 197 | .sclk_rate = 11981000, |
193 | .gpio_base = SIMPAD_UCB1X00_GPIO_BASE, | 198 | .codec_pdata = &simpad_ucb1x00_data, |
194 | }; | 199 | }; |
195 | 200 | ||
196 | 201 | ||
diff --git a/drivers/mfd/mcp-core.c b/drivers/mfd/mcp-core.c index 280a4f8a7876..c409d6327140 100644 --- a/drivers/mfd/mcp-core.c +++ b/drivers/mfd/mcp-core.c | |||
@@ -217,8 +217,9 @@ struct mcp *mcp_host_alloc(struct device *parent, size_t size) | |||
217 | } | 217 | } |
218 | EXPORT_SYMBOL(mcp_host_alloc); | 218 | EXPORT_SYMBOL(mcp_host_alloc); |
219 | 219 | ||
220 | int mcp_host_add(struct mcp *mcp) | 220 | int mcp_host_add(struct mcp *mcp, void *pdata) |
221 | { | 221 | { |
222 | mcp->attached_device.platform_data = pdata; | ||
222 | dev_set_name(&mcp->attached_device, "mcp0"); | 223 | dev_set_name(&mcp->attached_device, "mcp0"); |
223 | return device_add(&mcp->attached_device); | 224 | return device_add(&mcp->attached_device); |
224 | } | 225 | } |
diff --git a/drivers/mfd/mcp-sa11x0.c b/drivers/mfd/mcp-sa11x0.c index 420710b19f2d..960ebc790389 100644 --- a/drivers/mfd/mcp-sa11x0.c +++ b/drivers/mfd/mcp-sa11x0.c | |||
@@ -194,7 +194,6 @@ static int mcp_sa11x0_probe(struct platform_device *dev) | |||
194 | mcp->owner = THIS_MODULE; | 194 | mcp->owner = THIS_MODULE; |
195 | mcp->ops = &mcp_sa11x0; | 195 | mcp->ops = &mcp_sa11x0; |
196 | mcp->sclk_rate = data->sclk_rate; | 196 | mcp->sclk_rate = data->sclk_rate; |
197 | mcp->gpio_base = data->gpio_base; | ||
198 | 197 | ||
199 | m = priv(mcp); | 198 | m = priv(mcp); |
200 | m->mccr0 = data->mccr0 | 0x7f7f; | 199 | m->mccr0 = data->mccr0 | 0x7f7f; |
@@ -229,7 +228,7 @@ static int mcp_sa11x0_probe(struct platform_device *dev) | |||
229 | mcp->rw_timeout = (64 * 3 * 1000000 + mcp->sclk_rate - 1) / | 228 | mcp->rw_timeout = (64 * 3 * 1000000 + mcp->sclk_rate - 1) / |
230 | mcp->sclk_rate; | 229 | mcp->sclk_rate; |
231 | 230 | ||
232 | ret = mcp_host_add(mcp); | 231 | ret = mcp_host_add(mcp, data->codec_pdata); |
233 | if (ret == 0) | 232 | if (ret == 0) |
234 | return 0; | 233 | return 0; |
235 | 234 | ||
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index f2fb4205467c..6825169b06fc 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c | |||
@@ -534,6 +534,7 @@ static int ucb1x00_probe(struct mcp *mcp) | |||
534 | { | 534 | { |
535 | struct ucb1x00 *ucb; | 535 | struct ucb1x00 *ucb; |
536 | struct ucb1x00_driver *drv; | 536 | struct ucb1x00_driver *drv; |
537 | struct ucb1x00_plat_data *pdata; | ||
537 | unsigned int id; | 538 | unsigned int id; |
538 | int ret = -ENODEV; | 539 | int ret = -ENODEV; |
539 | int temp; | 540 | int temp; |
@@ -551,7 +552,7 @@ static int ucb1x00_probe(struct mcp *mcp) | |||
551 | if (!ucb) | 552 | if (!ucb) |
552 | goto err_disable; | 553 | goto err_disable; |
553 | 554 | ||
554 | 555 | pdata = mcp->attached_device.platform_data; | |
555 | ucb->dev.class = &ucb1x00_class; | 556 | ucb->dev.class = &ucb1x00_class; |
556 | ucb->dev.parent = &mcp->attached_device; | 557 | ucb->dev.parent = &mcp->attached_device; |
557 | dev_set_name(&ucb->dev, "ucb1x00"); | 558 | dev_set_name(&ucb->dev, "ucb1x00"); |
@@ -570,9 +571,9 @@ static int ucb1x00_probe(struct mcp *mcp) | |||
570 | } | 571 | } |
571 | 572 | ||
572 | ucb->gpio.base = -1; | 573 | ucb->gpio.base = -1; |
573 | if (mcp->gpio_base != 0) { | 574 | if (pdata && pdata->gpio_base) { |
574 | ucb->gpio.label = dev_name(&ucb->dev); | 575 | ucb->gpio.label = dev_name(&ucb->dev); |
575 | ucb->gpio.base = mcp->gpio_base; | 576 | ucb->gpio.base = pdata->gpio_base; |
576 | ucb->gpio.ngpio = 10; | 577 | ucb->gpio.ngpio = 10; |
577 | ucb->gpio.set = ucb1x00_gpio_set; | 578 | ucb->gpio.set = ucb1x00_gpio_set; |
578 | ucb->gpio.get = ucb1x00_gpio_get; | 579 | ucb->gpio.get = ucb1x00_gpio_get; |
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h index dfe7e517ad9b..bfcdf6d3f1bf 100644 --- a/include/linux/mfd/mcp.h +++ b/include/linux/mfd/mcp.h | |||
@@ -20,7 +20,6 @@ struct mcp { | |||
20 | unsigned int sclk_rate; | 20 | unsigned int sclk_rate; |
21 | unsigned int rw_timeout; | 21 | unsigned int rw_timeout; |
22 | struct device attached_device; | 22 | struct device attached_device; |
23 | int gpio_base; | ||
24 | }; | 23 | }; |
25 | 24 | ||
26 | struct mcp_ops { | 25 | struct mcp_ops { |
@@ -41,7 +40,7 @@ void mcp_disable(struct mcp *); | |||
41 | #define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) | 40 | #define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) |
42 | 41 | ||
43 | struct mcp *mcp_host_alloc(struct device *, size_t); | 42 | struct mcp *mcp_host_alloc(struct device *, size_t); |
44 | int mcp_host_add(struct mcp *); | 43 | int mcp_host_add(struct mcp *, void *); |
45 | void mcp_host_del(struct mcp *); | 44 | void mcp_host_del(struct mcp *); |
46 | void mcp_host_free(struct mcp *); | 45 | void mcp_host_free(struct mcp *); |
47 | 46 | ||
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h index 4321f044d1e4..731b23a656c0 100644 --- a/include/linux/mfd/ucb1x00.h +++ b/include/linux/mfd/ucb1x00.h | |||
@@ -104,6 +104,9 @@ | |||
104 | #define UCB_MODE_DYN_VFLAG_ENA (1 << 12) | 104 | #define UCB_MODE_DYN_VFLAG_ENA (1 << 12) |
105 | #define UCB_MODE_AUD_OFF_CAN (1 << 13) | 105 | #define UCB_MODE_AUD_OFF_CAN (1 << 13) |
106 | 106 | ||
107 | struct ucb1x00_plat_data { | ||
108 | int gpio_base; | ||
109 | }; | ||
107 | 110 | ||
108 | struct ucb1x00_irq { | 111 | struct ucb1x00_irq { |
109 | void *devid; | 112 | void *devid; |