Commit 4aa323bd839604dd83aec56ed3a88df352c3339d

Authored by Philipp Zabel
Committed by Linus Torvalds
1 parent eccba06891

DS1WM: decouple host IRQ and INTR active state settings

The DS1WM driver incorrectly infers the IAS bit (1-wire interrupt active
high) from IRQ settings.  There are devices that have IAS=0 but still need
the IRQ to trigger on a rising edge.  With this patch, machines with DS1WM
that need IAS=1 have to set .active_high=1 in the ds1wm_platform_data.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Acked-by: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 6 additions and 4 deletions Side-by-side Diff

drivers/w1/masters/ds1wm.c
... ... @@ -361,11 +361,12 @@
361 361 goto err1;
362 362 }
363 363 ds1wm_data->irq = res->start;
364   - ds1wm_data->active_high = (res->flags & IORESOURCE_IRQ_HIGHEDGE) ?
365   - 1 : 0;
  364 + ds1wm_data->active_high = plat->active_high;
366 365  
367   - set_irq_type(ds1wm_data->irq, ds1wm_data->active_high ?
368   - IRQ_TYPE_EDGE_RISING : IRQ_TYPE_EDGE_FALLING);
  366 + if (res->flags & IORESOURCE_IRQ_HIGHEDGE)
  367 + set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_RISING);
  368 + if (res->flags & IORESOURCE_IRQ_LOWEDGE)
  369 + set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_FALLING);
369 370  
370 371 ret = request_irq(ds1wm_data->irq, ds1wm_isr, IRQF_DISABLED,
371 372 "ds1wm", ds1wm_data);
include/linux/ds1wm.h
... ... @@ -6,6 +6,7 @@
6 6 * e.g. on h5xxx and h2200 this is 2
7 7 * (registers aligned to 4-byte boundaries),
8 8 * while on hx4700 this is 1 */
  9 + int active_high;
9 10 void (*enable)(struct platform_device *pdev);
10 11 void (*disable)(struct platform_device *pdev);
11 12 };