Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 273405
b: refs/heads/master
c: 7583a21
h: refs/heads/master
i:
  273403: 1093d90
v: v3
  • Loading branch information
Mark Brown authored and Samuel Ortiz committed Oct 24, 2011
1 parent 4ebd296 commit 6f0c7eb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1f08c1125ed1c9a6ca9bb195a56fe340b2134018
refs/heads/master: 7583a213ec3bde3082547ee37ad96214513bc1cb
22 changes: 21 additions & 1 deletion trunk/drivers/mfd/wm831x-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,19 @@ static int wm831x_irq_set_type(struct irq_data *data, unsigned int type)
switch (type) {
case IRQ_TYPE_EDGE_BOTH:
wm831x->gpio_update[irq] = 0x10000 | WM831X_GPN_INT_MODE;
wm831x->gpio_level[irq] = false;
break;
case IRQ_TYPE_EDGE_RISING:
wm831x->gpio_update[irq] = 0x10000 | WM831X_GPN_POL;
wm831x->gpio_level[irq] = false;
break;
case IRQ_TYPE_EDGE_FALLING:
wm831x->gpio_update[irq] = 0x10000;
wm831x->gpio_level[irq] = false;
break;
case IRQ_TYPE_LEVEL_HIGH:
wm831x->gpio_update[irq] = 0x10000 | WM831X_GPN_POL;
wm831x->gpio_level[irq] = true;
break;
default:
return -EINVAL;
Expand All @@ -449,7 +456,7 @@ static irqreturn_t wm831x_irq_thread(int irq, void *data)
{
struct wm831x *wm831x = data;
unsigned int i;
int primary, status_addr;
int primary, status_addr, ret;
int status_regs[WM831X_NUM_IRQ_REGS] = { 0 };
int read[WM831X_NUM_IRQ_REGS] = { 0 };
int *status;
Expand Down Expand Up @@ -507,6 +514,19 @@ static irqreturn_t wm831x_irq_thread(int irq, void *data)

if (*status & wm831x_irqs[i].mask)
handle_nested_irq(wm831x->irq_base + i);

/* Simulate an edge triggered IRQ by polling the input
* status. This is sucky but improves interoperability.
*/
if (primary == WM831X_GP_INT &&
wm831x->gpio_level[i - WM831X_IRQ_GPIO_1]) {
ret = wm831x_reg_read(wm831x, WM831X_GPIO_LEVEL);
while (ret & 1 << (i - WM831X_IRQ_GPIO_1)) {
handle_nested_irq(wm831x->irq_base + i);
ret = wm831x_reg_read(wm831x,
WM831X_GPIO_LEVEL);
}
}
}

out:
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mfd/wm831x/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ struct wm831x {

/* Used by the interrupt controller code to post writes */
int gpio_update[WM831X_NUM_GPIO_REGS];
bool gpio_level[WM831X_NUM_GPIO_REGS];

struct mutex auxadc_lock;
struct list_head auxadc_pending;
Expand Down

0 comments on commit 6f0c7eb

Please sign in to comment.