Skip to content

Commit f8a0941

Browse files
broonieSamuel Ortiz
authored andcommitted
mfd: arizona: Basic support for edge triggered IRQs
Allow the user to configure edge triggered IRQs, though we do not yet fully handle new interrupts occurring while an interrupt is being handled. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
1 parent 7994c66 commit f8a0941

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

‎arch/arm/mach-s3c64xx/mach-crag6410-module.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static const struct i2c_board_info wm1277_devs[] = {
208208
static struct arizona_pdata wm5102_reva_pdata = {
209209
.ldoena = S3C64XX_GPN(7),
210210
.gpio_base = CODEC_GPIO_BASE,
211-
.irq_active_high = true,
211+
.irq_flags = IRQF_TRIGGER_HIGH,
212212
.micd_pol_gpio = CODEC_GPIO_BASE + 4,
213213
.gpio_defaults = {
214214
[2] = 0x10000, /* AIF3TXLRCLK */
@@ -237,7 +237,7 @@ static struct spi_board_info wm5102_reva_spi_devs[] = {
237237
static struct arizona_pdata wm5102_pdata = {
238238
.ldoena = S3C64XX_GPN(7),
239239
.gpio_base = CODEC_GPIO_BASE,
240-
.irq_active_high = true,
240+
.irq_flags = IRQF_TRIGGER_HIGH,
241241
.micd_pol_gpio = CODEC_GPIO_BASE + 2,
242242
.gpio_defaults = {
243243
[2] = 0x10000, /* AIF3TXLRCLK */

‎drivers/mfd/arizona-irq.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,20 +195,22 @@ int arizona_irq_init(struct arizona *arizona)
195195
/* Disable all wake sources by default */
196196
regmap_write(arizona->regmap, ARIZONA_WAKE_CONTROL, 0);
197197

198-
if (arizona->pdata.irq_active_high) {
198+
if (!arizona->pdata.irq_flags)
199+
arizona->pdata.irq_flags = IRQF_TRIGGER_LOW;
200+
201+
if (arizona->pdata.irq_flags & (IRQF_TRIGGER_HIGH |
202+
IRQF_TRIGGER_RISING)) {
199203
ret = regmap_update_bits(arizona->regmap, ARIZONA_IRQ_CTRL_1,
200204
ARIZONA_IRQ_POL, 0);
201205
if (ret != 0) {
202206
dev_err(arizona->dev, "Couldn't set IRQ polarity: %d\n",
203207
ret);
204208
goto err;
205209
}
206-
207-
flags |= IRQF_TRIGGER_HIGH;
208-
} else {
209-
flags |= IRQF_TRIGGER_LOW;
210210
}
211211

212+
flags |= arizona->pdata.irq_flags;
213+
212214
/* Allocate a virtual IRQ domain to distribute to the regmap domains */
213215
arizona->virq = irq_domain_add_linear(NULL, 2, &arizona_domain_ops,
214216
arizona);

‎include/linux/mfd/arizona/pdata.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ struct arizona_pdata {
9999
/** If a direct 32kHz clock is provided on an MCLK specify it here */
100100
int clk32k_src;
101101

102-
bool irq_active_high; /** IRQ polarity */
102+
/** Mode for primary IRQ (defaults to active low) */
103+
unsigned int irq_flags;
103104

104105
/* Base GPIO */
105106
int gpio_base;

0 commit comments

Comments
 (0)