diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-03-24 19:16:56 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-04-08 09:20:58 -0400 |
commit | 22c75fe7c772c4c47df47364d9e807dcf204d7c2 (patch) | |
tree | 1133bd6fced33aad6506911ce97977af3257c21c /drivers/mfd/arizona-irq.c | |
parent | 3092f8050eccce8463afe771f0910634a433e24b (diff) |
mfd: arizona: Try to use interrupt flags from interrupt controller
If no irq_flags are passed in platform data then query the interrupt
controller for the trigger type and try to use that. This provides
default operation with a wider range of hardware and will be needed
for device tree support where the interrupt flags are configured on
the interrupt controller.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/arizona-irq.c')
-rw-r--r-- | drivers/mfd/arizona-irq.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c index f761cc119c01..64cd9b6dac92 100644 --- a/drivers/mfd/arizona-irq.c +++ b/drivers/mfd/arizona-irq.c | |||
@@ -189,6 +189,7 @@ int arizona_irq_init(struct arizona *arizona) | |||
189 | int ret, i; | 189 | int ret, i; |
190 | const struct regmap_irq_chip *aod, *irq; | 190 | const struct regmap_irq_chip *aod, *irq; |
191 | bool ctrlif_error = true; | 191 | bool ctrlif_error = true; |
192 | struct irq_data *irq_data; | ||
192 | 193 | ||
193 | switch (arizona->type) { | 194 | switch (arizona->type) { |
194 | #ifdef CONFIG_MFD_WM5102 | 195 | #ifdef CONFIG_MFD_WM5102 |
@@ -215,8 +216,30 @@ int arizona_irq_init(struct arizona *arizona) | |||
215 | /* Disable all wake sources by default */ | 216 | /* Disable all wake sources by default */ |
216 | regmap_write(arizona->regmap, ARIZONA_WAKE_CONTROL, 0); | 217 | regmap_write(arizona->regmap, ARIZONA_WAKE_CONTROL, 0); |
217 | 218 | ||
218 | if (!arizona->pdata.irq_flags) | 219 | /* Read the flags from the interrupt controller if not specified */ |
219 | arizona->pdata.irq_flags = IRQF_TRIGGER_LOW; | 220 | if (!arizona->pdata.irq_flags) { |
221 | irq_data = irq_get_irq_data(arizona->irq); | ||
222 | if (!irq_data) { | ||
223 | dev_err(arizona->dev, "Invalid IRQ: %d\n", | ||
224 | arizona->irq); | ||
225 | return -EINVAL; | ||
226 | } | ||
227 | |||
228 | arizona->pdata.irq_flags = irqd_get_trigger_type(irq_data); | ||
229 | switch (arizona->pdata.irq_flags) { | ||
230 | case IRQF_TRIGGER_LOW: | ||
231 | case IRQF_TRIGGER_HIGH: | ||
232 | case IRQF_TRIGGER_RISING: | ||
233 | case IRQF_TRIGGER_FALLING: | ||
234 | break; | ||
235 | |||
236 | case IRQ_TYPE_NONE: | ||
237 | default: | ||
238 | /* Device default */ | ||
239 | arizona->pdata.irq_flags = IRQF_TRIGGER_LOW; | ||
240 | break; | ||
241 | } | ||
242 | } | ||
220 | 243 | ||
221 | if (arizona->pdata.irq_flags & (IRQF_TRIGGER_HIGH | | 244 | if (arizona->pdata.irq_flags & (IRQF_TRIGGER_HIGH | |
222 | IRQF_TRIGGER_RISING)) { | 245 | IRQF_TRIGGER_RISING)) { |