Skip to content

Commit

Permalink
mfd: arizona: Basic support for edge triggered IRQs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Brown authored and Samuel Ortiz committed Apr 8, 2013
1 parent 7994c66 commit f8a0941
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions arch/arm/mach-s3c64xx/mach-crag6410-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ static const struct i2c_board_info wm1277_devs[] = {
static struct arizona_pdata wm5102_reva_pdata = {
.ldoena = S3C64XX_GPN(7),
.gpio_base = CODEC_GPIO_BASE,
.irq_active_high = true,
.irq_flags = IRQF_TRIGGER_HIGH,
.micd_pol_gpio = CODEC_GPIO_BASE + 4,
.gpio_defaults = {
[2] = 0x10000, /* AIF3TXLRCLK */
Expand Down Expand Up @@ -237,7 +237,7 @@ static struct spi_board_info wm5102_reva_spi_devs[] = {
static struct arizona_pdata wm5102_pdata = {
.ldoena = S3C64XX_GPN(7),
.gpio_base = CODEC_GPIO_BASE,
.irq_active_high = true,
.irq_flags = IRQF_TRIGGER_HIGH,
.micd_pol_gpio = CODEC_GPIO_BASE + 2,
.gpio_defaults = {
[2] = 0x10000, /* AIF3TXLRCLK */
Expand Down
12 changes: 7 additions & 5 deletions drivers/mfd/arizona-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,22 @@ int arizona_irq_init(struct arizona *arizona)
/* Disable all wake sources by default */
regmap_write(arizona->regmap, ARIZONA_WAKE_CONTROL, 0);

if (arizona->pdata.irq_active_high) {
if (!arizona->pdata.irq_flags)
arizona->pdata.irq_flags = IRQF_TRIGGER_LOW;

if (arizona->pdata.irq_flags & (IRQF_TRIGGER_HIGH |
IRQF_TRIGGER_RISING)) {
ret = regmap_update_bits(arizona->regmap, ARIZONA_IRQ_CTRL_1,
ARIZONA_IRQ_POL, 0);
if (ret != 0) {
dev_err(arizona->dev, "Couldn't set IRQ polarity: %d\n",
ret);
goto err;
}

flags |= IRQF_TRIGGER_HIGH;
} else {
flags |= IRQF_TRIGGER_LOW;
}

flags |= arizona->pdata.irq_flags;

/* Allocate a virtual IRQ domain to distribute to the regmap domains */
arizona->virq = irq_domain_add_linear(NULL, 2, &arizona_domain_ops,
arizona);
Expand Down
3 changes: 2 additions & 1 deletion include/linux/mfd/arizona/pdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ struct arizona_pdata {
/** If a direct 32kHz clock is provided on an MCLK specify it here */
int clk32k_src;

bool irq_active_high; /** IRQ polarity */
/** Mode for primary IRQ (defaults to active low) */
unsigned int irq_flags;

/* Base GPIO */
int gpio_base;
Expand Down

0 comments on commit f8a0941

Please sign in to comment.