diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-05 11:38:37 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-05 11:38:37 -0700 |
commit | 48f286a28fe13fcbc510720fcffb872a184b51dd (patch) | |
tree | f50d868589138628c04dd5600a029ef80fa21da2 /drivers/mfd/wm8350-core.c | |
parent | ea431793f198e26d1553f36ed8b5a830b531eee4 (diff) | |
parent | fa15ce8ad59e9653d50b8596596cb02d3566d4aa (diff) | |
download | linux-48f286a28fe13fcbc510720fcffb872a184b51dd.tar.bz2 |
Merge branch 'for-next' of git://git.o-hand.com/linux-mfd
* 'for-next' of git://git.o-hand.com/linux-mfd:
mfd: fix da903x warning
mfd: fix MAINTAINERS entry
mfd: Use the value of the final spin when reading the AUXADC
mfd: Storage class should be before const qualifier
mfd: PASIC3: supply clock_rate to DS1WM via driver_data
mfd: remove DS1WM clock handling
mfd: remove unused PASIC3 bus_shift field
pxa/magician: remove deprecated .bus_shift from PASIC3 platform_data
mfd: convert PASIC3 to use MFD core
mfd: convert DS1WM to use MFD core
mfd: Support active high IRQs on WM835x
mfd: Use bulk read to fill WM8350 register cache
mfd: remove duplicated #include from pcf50633
Diffstat (limited to 'drivers/mfd/wm8350-core.c')
-rw-r--r-- | drivers/mfd/wm8350-core.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c index b457a05b28d9..c2be3088e2e1 100644 --- a/drivers/mfd/wm8350-core.c +++ b/drivers/mfd/wm8350-core.c @@ -1111,7 +1111,7 @@ int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref) do { schedule_timeout_interruptible(1); reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1); - } while (--tries && (reg & WM8350_AUXADC_POLL)); + } while ((reg & WM8350_AUXADC_POLL) && --tries); if (!tries) dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); @@ -1238,7 +1238,7 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode) } wm8350->reg_cache = - kzalloc(sizeof(u16) * (WM8350_MAX_REGISTER + 1), GFP_KERNEL); + kmalloc(sizeof(u16) * (WM8350_MAX_REGISTER + 1), GFP_KERNEL); if (wm8350->reg_cache == NULL) return -ENOMEM; @@ -1246,17 +1246,20 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode) * a PMIC so the device many not be in a virgin state and we * can't rely on the silicon values. */ + ret = wm8350->read_dev(wm8350, 0, + sizeof(u16) * (WM8350_MAX_REGISTER + 1), + wm8350->reg_cache); + if (ret < 0) { + dev_err(wm8350->dev, + "failed to read initial cache values\n"); + goto out; + } + + /* Mask out uncacheable/unreadable bits and the audio. */ for (i = 0; i < WM8350_MAX_REGISTER; i++) { - /* audio register range */ if (wm8350_reg_io_map[i].readable && (i < WM8350_CLOCK_CONTROL_1 || i > WM8350_AIF_TEST)) { - ret = wm8350->read_dev(wm8350, i, 2, (char *)&value); - if (ret < 0) { - dev_err(wm8350->dev, - "failed to read initial cache value\n"); - goto out; - } - value = be16_to_cpu(value); + value = be16_to_cpu(wm8350->reg_cache[i]); value &= wm8350_reg_io_map[i].readable; value &= ~wm8350_reg_io_map[i].vol; wm8350->reg_cache[i] = value; @@ -1435,7 +1438,21 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, mutex_init(&wm8350->irq_mutex); INIT_WORK(&wm8350->irq_work, wm8350_irq_worker); if (irq) { - ret = request_irq(irq, wm8350_irq, 0, + int flags = 0; + + if (pdata && pdata->irq_high) { + flags |= IRQF_TRIGGER_HIGH; + + wm8350_set_bits(wm8350, WM8350_SYSTEM_CONTROL_1, + WM8350_IRQ_POL); + } else { + flags |= IRQF_TRIGGER_LOW; + + wm8350_clear_bits(wm8350, WM8350_SYSTEM_CONTROL_1, + WM8350_IRQ_POL); + } + + ret = request_irq(irq, wm8350_irq, flags, "wm8350", wm8350); if (ret != 0) { dev_err(wm8350->dev, "Failed to request IRQ: %d\n", |