diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2014-05-08 17:16:34 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-05-23 04:41:01 -0400 |
commit | 9e9dc7d9597bd6881b3e7ae6ae3d710319605c47 (patch) | |
tree | 86a55e9ccf8388a805eaaa4fed10b472590af6b4 | |
parent | 9c9e321455fb806108f9dbb1872bacfd42c6002b (diff) |
mfd: stmpe: root out static GPIO and IRQ assignments
The only platform using the STMPE expander now boots from
device tree using all-dynamic GPIO and IRQ number assignments, so
remove the mechanism to pass this from the device tree entirely.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/gpio/gpio-stmpe.c | 18 | ||||
-rw-r--r-- | drivers/mfd/stmpe.c | 6 | ||||
-rw-r--r-- | include/linux/mfd/stmpe.h | 14 |
3 files changed, 6 insertions, 32 deletions
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index 2776a09bee58..628b58494294 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c | |||
@@ -23,7 +23,8 @@ | |||
23 | enum { REG_RE, REG_FE, REG_IE }; | 23 | enum { REG_RE, REG_FE, REG_IE }; |
24 | 24 | ||
25 | #define CACHE_NR_REGS 3 | 25 | #define CACHE_NR_REGS 3 |
26 | #define CACHE_NR_BANKS (STMPE_NR_GPIOS / 8) | 26 | /* No variant has more than 24 GPIOs */ |
27 | #define CACHE_NR_BANKS (24 / 8) | ||
27 | 28 | ||
28 | struct stmpe_gpio { | 29 | struct stmpe_gpio { |
29 | struct gpio_chip chip; | 30 | struct gpio_chip chip; |
@@ -31,8 +32,6 @@ struct stmpe_gpio { | |||
31 | struct device *dev; | 32 | struct device *dev; |
32 | struct mutex irq_lock; | 33 | struct mutex irq_lock; |
33 | struct irq_domain *domain; | 34 | struct irq_domain *domain; |
34 | |||
35 | int irq_base; | ||
36 | unsigned norequest_mask; | 35 | unsigned norequest_mask; |
37 | 36 | ||
38 | /* Caches of interrupt control registers for bus_lock */ | 37 | /* Caches of interrupt control registers for bus_lock */ |
@@ -311,13 +310,8 @@ static const struct irq_domain_ops stmpe_gpio_irq_simple_ops = { | |||
311 | static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio, | 310 | static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio, |
312 | struct device_node *np) | 311 | struct device_node *np) |
313 | { | 312 | { |
314 | int base = 0; | ||
315 | |||
316 | if (!np) | ||
317 | base = stmpe_gpio->irq_base; | ||
318 | |||
319 | stmpe_gpio->domain = irq_domain_add_simple(np, | 313 | stmpe_gpio->domain = irq_domain_add_simple(np, |
320 | stmpe_gpio->chip.ngpio, base, | 314 | stmpe_gpio->chip.ngpio, 0, |
321 | &stmpe_gpio_irq_simple_ops, stmpe_gpio); | 315 | &stmpe_gpio_irq_simple_ops, stmpe_gpio); |
322 | if (!stmpe_gpio->domain) { | 316 | if (!stmpe_gpio->domain) { |
323 | dev_err(stmpe_gpio->dev, "failed to create irqdomain\n"); | 317 | dev_err(stmpe_gpio->dev, "failed to create irqdomain\n"); |
@@ -354,7 +348,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) | |||
354 | #ifdef CONFIG_OF | 348 | #ifdef CONFIG_OF |
355 | stmpe_gpio->chip.of_node = np; | 349 | stmpe_gpio->chip.of_node = np; |
356 | #endif | 350 | #endif |
357 | stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1; | 351 | stmpe_gpio->chip.base = -1; |
358 | 352 | ||
359 | if (pdata) | 353 | if (pdata) |
360 | stmpe_gpio->norequest_mask = pdata->norequest_mask; | 354 | stmpe_gpio->norequest_mask = pdata->norequest_mask; |
@@ -362,9 +356,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) | |||
362 | of_property_read_u32(np, "st,norequest-mask", | 356 | of_property_read_u32(np, "st,norequest-mask", |
363 | &stmpe_gpio->norequest_mask); | 357 | &stmpe_gpio->norequest_mask); |
364 | 358 | ||
365 | if (irq >= 0) | 359 | if (irq < 0) |
366 | stmpe_gpio->irq_base = stmpe->irq_base + STMPE_INT_GPIO(0); | ||
367 | else | ||
368 | dev_info(&pdev->dev, | 360 | dev_info(&pdev->dev, |
369 | "device configured in no-irq mode; " | 361 | "device configured in no-irq mode; " |
370 | "irqs are not available\n"); | 362 | "irqs are not available\n"); |
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index 294731be1a15..3b6bfa7184ad 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c | |||
@@ -996,9 +996,6 @@ static int stmpe_irq_init(struct stmpe *stmpe, struct device_node *np) | |||
996 | int base = 0; | 996 | int base = 0; |
997 | int num_irqs = stmpe->variant->num_irqs; | 997 | int num_irqs = stmpe->variant->num_irqs; |
998 | 998 | ||
999 | if (!np) | ||
1000 | base = stmpe->irq_base; | ||
1001 | |||
1002 | stmpe->domain = irq_domain_add_simple(np, num_irqs, base, | 999 | stmpe->domain = irq_domain_add_simple(np, num_irqs, base, |
1003 | &stmpe_irq_ops, stmpe); | 1000 | &stmpe_irq_ops, stmpe); |
1004 | if (!stmpe->domain) { | 1001 | if (!stmpe->domain) { |
@@ -1077,7 +1074,7 @@ static int stmpe_chip_init(struct stmpe *stmpe) | |||
1077 | static int stmpe_add_device(struct stmpe *stmpe, const struct mfd_cell *cell) | 1074 | static int stmpe_add_device(struct stmpe *stmpe, const struct mfd_cell *cell) |
1078 | { | 1075 | { |
1079 | return mfd_add_devices(stmpe->dev, stmpe->pdata->id, cell, 1, | 1076 | return mfd_add_devices(stmpe->dev, stmpe->pdata->id, cell, 1, |
1080 | NULL, stmpe->irq_base, stmpe->domain); | 1077 | NULL, 0, stmpe->domain); |
1081 | } | 1078 | } |
1082 | 1079 | ||
1083 | static int stmpe_devices_init(struct stmpe *stmpe) | 1080 | static int stmpe_devices_init(struct stmpe *stmpe) |
@@ -1181,7 +1178,6 @@ int stmpe_probe(struct stmpe_client_info *ci, int partnum) | |||
1181 | stmpe->dev = ci->dev; | 1178 | stmpe->dev = ci->dev; |
1182 | stmpe->client = ci->client; | 1179 | stmpe->client = ci->client; |
1183 | stmpe->pdata = pdata; | 1180 | stmpe->pdata = pdata; |
1184 | stmpe->irq_base = pdata->irq_base; | ||
1185 | stmpe->ci = ci; | 1181 | stmpe->ci = ci; |
1186 | stmpe->partnum = partnum; | 1182 | stmpe->partnum = partnum; |
1187 | stmpe->variant = stmpe_variant_info[partnum]; | 1183 | stmpe->variant = stmpe_variant_info[partnum]; |
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h index 980898620e57..575a86c7fcbd 100644 --- a/include/linux/mfd/stmpe.h +++ b/include/linux/mfd/stmpe.h | |||
@@ -76,7 +76,6 @@ struct stmpe_client_info; | |||
76 | * @regs: list of addresses of registers which are at different addresses on | 76 | * @regs: list of addresses of registers which are at different addresses on |
77 | * different variants. Indexed by one of STMPE_IDX_*. | 77 | * different variants. Indexed by one of STMPE_IDX_*. |
78 | * @irq: irq number for stmpe | 78 | * @irq: irq number for stmpe |
79 | * @irq_base: starting IRQ number for internal IRQs | ||
80 | * @num_gpios: number of gpios, differs for variants | 79 | * @num_gpios: number of gpios, differs for variants |
81 | * @ier: cache of IER registers for bus_lock | 80 | * @ier: cache of IER registers for bus_lock |
82 | * @oldier: cache of IER registers for bus_lock | 81 | * @oldier: cache of IER registers for bus_lock |
@@ -96,7 +95,6 @@ struct stmpe { | |||
96 | const u8 *regs; | 95 | const u8 *regs; |
97 | 96 | ||
98 | int irq; | 97 | int irq; |
99 | int irq_base; | ||
100 | int num_gpios; | 98 | int num_gpios; |
101 | u8 ier[2]; | 99 | u8 ier[2]; |
102 | u8 oldier[2]; | 100 | u8 oldier[2]; |
@@ -137,8 +135,6 @@ struct stmpe_keypad_platform_data { | |||
137 | 135 | ||
138 | /** | 136 | /** |
139 | * struct stmpe_gpio_platform_data - STMPE GPIO platform data | 137 | * struct stmpe_gpio_platform_data - STMPE GPIO platform data |
140 | * @gpio_base: first gpio number assigned. A maximum of | ||
141 | * %STMPE_NR_GPIOS GPIOs will be allocated. | ||
142 | * @norequest_mask: bitmask specifying which GPIOs should _not_ be | 138 | * @norequest_mask: bitmask specifying which GPIOs should _not_ be |
143 | * requestable due to different usage (e.g. touch, keypad) | 139 | * requestable due to different usage (e.g. touch, keypad) |
144 | * STMPE_GPIO_NOREQ_* macros can be used here. | 140 | * STMPE_GPIO_NOREQ_* macros can be used here. |
@@ -146,7 +142,6 @@ struct stmpe_keypad_platform_data { | |||
146 | * @remove: board specific remove callback | 142 | * @remove: board specific remove callback |
147 | */ | 143 | */ |
148 | struct stmpe_gpio_platform_data { | 144 | struct stmpe_gpio_platform_data { |
149 | int gpio_base; | ||
150 | unsigned norequest_mask; | 145 | unsigned norequest_mask; |
151 | void (*setup)(struct stmpe *stmpe, unsigned gpio_base); | 146 | void (*setup)(struct stmpe *stmpe, unsigned gpio_base); |
152 | void (*remove)(struct stmpe *stmpe, unsigned gpio_base); | 147 | void (*remove)(struct stmpe *stmpe, unsigned gpio_base); |
@@ -200,8 +195,6 @@ struct stmpe_ts_platform_data { | |||
200 | * @irq_trigger: IRQ trigger to use for the interrupt to the host | 195 | * @irq_trigger: IRQ trigger to use for the interrupt to the host |
201 | * @autosleep: bool to enable/disable stmpe autosleep | 196 | * @autosleep: bool to enable/disable stmpe autosleep |
202 | * @autosleep_timeout: inactivity timeout in milliseconds for autosleep | 197 | * @autosleep_timeout: inactivity timeout in milliseconds for autosleep |
203 | * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or | ||
204 | * %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used. | ||
205 | * @irq_over_gpio: true if gpio is used to get irq | 198 | * @irq_over_gpio: true if gpio is used to get irq |
206 | * @irq_gpio: gpio number over which irq will be requested (significant only if | 199 | * @irq_gpio: gpio number over which irq will be requested (significant only if |
207 | * irq_over_gpio is true) | 200 | * irq_over_gpio is true) |
@@ -212,7 +205,6 @@ struct stmpe_ts_platform_data { | |||
212 | struct stmpe_platform_data { | 205 | struct stmpe_platform_data { |
213 | int id; | 206 | int id; |
214 | unsigned int blocks; | 207 | unsigned int blocks; |
215 | int irq_base; | ||
216 | unsigned int irq_trigger; | 208 | unsigned int irq_trigger; |
217 | bool autosleep; | 209 | bool autosleep; |
218 | bool irq_over_gpio; | 210 | bool irq_over_gpio; |
@@ -224,10 +216,4 @@ struct stmpe_platform_data { | |||
224 | struct stmpe_ts_platform_data *ts; | 216 | struct stmpe_ts_platform_data *ts; |
225 | }; | 217 | }; |
226 | 218 | ||
227 | #define STMPE_NR_INTERNAL_IRQS 9 | ||
228 | #define STMPE_INT_GPIO(x) (STMPE_NR_INTERNAL_IRQS + (x)) | ||
229 | |||
230 | #define STMPE_NR_GPIOS 24 | ||
231 | #define STMPE_NR_IRQS STMPE_INT_GPIO(STMPE_NR_GPIOS) | ||
232 | |||
233 | #endif | 219 | #endif |