mfd: Convert WM8350 to use request_threaded_irq()
Instead of hand rolling our own variant. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
3860e6c4b9
commit
37bce07077
|
@ -353,15 +353,15 @@ static void wm8350_irq_call_handler(struct wm8350 *wm8350, int irq)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wm8350_irq_worker actually handles the interrupts. Since all
|
* This is a threaded IRQ handler so can access I2C/SPI. Since all
|
||||||
* interrupts are clear on read the IRQ line will be reasserted and
|
* interrupts are clear on read the IRQ line will be reasserted and
|
||||||
* the physical IRQ will be handled again if another interrupt is
|
* the physical IRQ will be handled again if another interrupt is
|
||||||
* asserted while we run - in the normal course of events this is a
|
* asserted while we run - in the normal course of events this is a
|
||||||
* rare occurrence so we save I2C/SPI reads.
|
* rare occurrence so we save I2C/SPI reads.
|
||||||
*/
|
*/
|
||||||
static void wm8350_irq_worker(struct work_struct *work)
|
static irqreturn_t wm8350_irq(int irq, void *data)
|
||||||
{
|
{
|
||||||
struct wm8350 *wm8350 = container_of(work, struct wm8350, irq_work);
|
struct wm8350 *wm8350 = data;
|
||||||
u16 level_one, status1, status2, comp;
|
u16 level_one, status1, status2, comp;
|
||||||
|
|
||||||
/* TODO: Use block reads to improve performance? */
|
/* TODO: Use block reads to improve performance? */
|
||||||
|
@ -552,16 +552,6 @@ static void wm8350_irq_worker(struct work_struct *work)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enable_irq(wm8350->chip_irq);
|
|
||||||
}
|
|
||||||
|
|
||||||
static irqreturn_t wm8350_irq(int irq, void *data)
|
|
||||||
{
|
|
||||||
struct wm8350 *wm8350 = data;
|
|
||||||
|
|
||||||
disable_irq_nosync(irq);
|
|
||||||
schedule_work(&wm8350->irq_work);
|
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1428,9 +1418,8 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
|
||||||
|
|
||||||
mutex_init(&wm8350->auxadc_mutex);
|
mutex_init(&wm8350->auxadc_mutex);
|
||||||
mutex_init(&wm8350->irq_mutex);
|
mutex_init(&wm8350->irq_mutex);
|
||||||
INIT_WORK(&wm8350->irq_work, wm8350_irq_worker);
|
|
||||||
if (irq) {
|
if (irq) {
|
||||||
int flags = 0;
|
int flags = IRQF_ONESHOT;
|
||||||
|
|
||||||
if (pdata && pdata->irq_high) {
|
if (pdata && pdata->irq_high) {
|
||||||
flags |= IRQF_TRIGGER_HIGH;
|
flags |= IRQF_TRIGGER_HIGH;
|
||||||
|
@ -1444,8 +1433,8 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
|
||||||
WM8350_IRQ_POL);
|
WM8350_IRQ_POL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = request_irq(irq, wm8350_irq, flags,
|
ret = request_threaded_irq(irq, NULL, wm8350_irq, flags,
|
||||||
"wm8350", wm8350);
|
"wm8350", wm8350);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
dev_err(wm8350->dev, "Failed to request IRQ: %d\n",
|
dev_err(wm8350->dev, "Failed to request IRQ: %d\n",
|
||||||
ret);
|
ret);
|
||||||
|
@ -1505,7 +1494,6 @@ void wm8350_device_exit(struct wm8350 *wm8350)
|
||||||
platform_device_unregister(wm8350->codec.pdev);
|
platform_device_unregister(wm8350->codec.pdev);
|
||||||
|
|
||||||
free_irq(wm8350->chip_irq, wm8350);
|
free_irq(wm8350->chip_irq, wm8350);
|
||||||
flush_work(&wm8350->irq_work);
|
|
||||||
kfree(wm8350->reg_cache);
|
kfree(wm8350->reg_cache);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(wm8350_device_exit);
|
EXPORT_SYMBOL_GPL(wm8350_device_exit);
|
||||||
|
|
|
@ -626,7 +626,6 @@ struct wm8350 {
|
||||||
struct mutex auxadc_mutex;
|
struct mutex auxadc_mutex;
|
||||||
|
|
||||||
/* Interrupt handling */
|
/* Interrupt handling */
|
||||||
struct work_struct irq_work;
|
|
||||||
struct mutex irq_mutex; /* IRQ table mutex */
|
struct mutex irq_mutex; /* IRQ table mutex */
|
||||||
struct wm8350_irq irq[WM8350_NUM_IRQ];
|
struct wm8350_irq irq[WM8350_NUM_IRQ];
|
||||||
int chip_irq;
|
int chip_irq;
|
||||||
|
|
Loading…
Reference in New Issue