Commit 5a65edbc authored by Mark Brown's avatar Mark Brown Committed by Samuel Ortiz

mfd: Convert wm8350 IRQ handlers to irq_handler_t

This is done as simple code transformation, the semantics of the
IRQ API provided by the core are are still very different to those
of genirq (mainly with regard to masking).
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent b9f96b5d
...@@ -371,7 +371,7 @@ static void wm8350_irq_call_handler(struct wm8350 *wm8350, int irq) ...@@ -371,7 +371,7 @@ static void wm8350_irq_call_handler(struct wm8350 *wm8350, int irq)
mutex_lock(&wm8350->irq_mutex); mutex_lock(&wm8350->irq_mutex);
if (wm8350->irq[irq].handler) if (wm8350->irq[irq].handler)
wm8350->irq[irq].handler(wm8350, irq, wm8350->irq[irq].data); wm8350->irq[irq].handler(irq, wm8350->irq[irq].data);
else { else {
dev_err(wm8350->dev, "irq %d nobody cared. now masked.\n", dev_err(wm8350->dev, "irq %d nobody cared. now masked.\n",
irq); irq);
...@@ -431,8 +431,8 @@ static irqreturn_t wm8350_irq(int irq, void *irq_data) ...@@ -431,8 +431,8 @@ static irqreturn_t wm8350_irq(int irq, void *irq_data)
} }
int wm8350_register_irq(struct wm8350 *wm8350, int irq, int wm8350_register_irq(struct wm8350 *wm8350, int irq,
void (*handler) (struct wm8350 *, int, void *), irq_handler_t handler, unsigned long flags,
void *data) const char *name, void *data)
{ {
if (irq < 0 || irq > WM8350_NUM_IRQ || !handler) if (irq < 0 || irq > WM8350_NUM_IRQ || !handler)
return -EINVAL; return -EINVAL;
......
...@@ -184,8 +184,9 @@ static ssize_t charger_state_show(struct device *dev, ...@@ -184,8 +184,9 @@ static ssize_t charger_state_show(struct device *dev,
static DEVICE_ATTR(charger_state, 0444, charger_state_show, NULL); static DEVICE_ATTR(charger_state, 0444, charger_state_show, NULL);
static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data) static irqreturn_t wm8350_charger_handler(int irq, void *data)
{ {
struct wm8350 *wm8350 = data;
struct wm8350_power *power = &wm8350->power; struct wm8350_power *power = &wm8350->power;
struct wm8350_charger_policy *policy = power->policy; struct wm8350_charger_policy *policy = power->policy;
...@@ -238,6 +239,8 @@ static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data) ...@@ -238,6 +239,8 @@ static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data)
default: default:
dev_err(wm8350->dev, "Unknown interrupt %d\n", irq); dev_err(wm8350->dev, "Unknown interrupt %d\n", irq);
} }
return IRQ_HANDLED;
} }
/********************************************************************* /*********************************************************************
...@@ -387,45 +390,53 @@ static void wm8350_init_charger(struct wm8350 *wm8350) ...@@ -387,45 +390,53 @@ static void wm8350_init_charger(struct wm8350 *wm8350)
{ {
/* register our interest in charger events */ /* register our interest in charger events */
wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0, "Battery hot", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT);
wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0, "Battery cold", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD);
wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0, "Battery fail", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL);
wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0,
"Charger timeout", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_TO); wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_TO);
wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0,
"Charge end", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_END); wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_END);
wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0,
"Charge start", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_START); wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_START);
wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0,
"Fast charge ready", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY); wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY);
wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0,
"Battery <3.9V", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9);
wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0,
"Battery <3.1V", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1);
wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0,
"Battery <2.85V", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85);
/* and supply change events */ /* and supply change events */
wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0, "USB", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_USB_FB); wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_USB_FB);
wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0, "Wall", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB);
wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB,
wm8350_charger_handler, NULL); wm8350_charger_handler, 0, "Battery", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB);
} }
......
...@@ -1330,9 +1330,10 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = { ...@@ -1330,9 +1330,10 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
}, },
}; };
static void pmic_uv_handler(struct wm8350 *wm8350, int irq, void *data) static irqreturn_t pmic_uv_handler(int irq, void *data)
{ {
struct regulator_dev *rdev = (struct regulator_dev *)data; struct regulator_dev *rdev = (struct regulator_dev *)data;
struct wm8350 *wm8350 = rdev_get_drvdata(rdev);
mutex_lock(&rdev->mutex); mutex_lock(&rdev->mutex);
if (irq == WM8350_IRQ_CS1 || irq == WM8350_IRQ_CS2) if (irq == WM8350_IRQ_CS1 || irq == WM8350_IRQ_CS2)
...@@ -1344,6 +1345,8 @@ static void pmic_uv_handler(struct wm8350 *wm8350, int irq, void *data) ...@@ -1344,6 +1345,8 @@ static void pmic_uv_handler(struct wm8350 *wm8350, int irq, void *data)
REGULATOR_EVENT_UNDER_VOLTAGE, REGULATOR_EVENT_UNDER_VOLTAGE,
wm8350); wm8350);
mutex_unlock(&rdev->mutex); mutex_unlock(&rdev->mutex);
return IRQ_HANDLED;
} }
static int wm8350_regulator_probe(struct platform_device *pdev) static int wm8350_regulator_probe(struct platform_device *pdev)
...@@ -1388,7 +1391,7 @@ static int wm8350_regulator_probe(struct platform_device *pdev) ...@@ -1388,7 +1391,7 @@ static int wm8350_regulator_probe(struct platform_device *pdev)
/* register regulator IRQ */ /* register regulator IRQ */
ret = wm8350_register_irq(wm8350, wm8350_reg[pdev->id].irq, ret = wm8350_register_irq(wm8350, wm8350_reg[pdev->id].irq,
pmic_uv_handler, rdev); pmic_uv_handler, 0, "UV", rdev);
if (ret < 0) { if (ret < 0) {
regulator_unregister(rdev); regulator_unregister(rdev);
dev_err(&pdev->dev, "failed to register regulator %s IRQ\n", dev_err(&pdev->dev, "failed to register regulator %s IRQ\n",
......
...@@ -315,9 +315,9 @@ static int wm8350_rtc_update_irq_enable(struct device *dev, ...@@ -315,9 +315,9 @@ static int wm8350_rtc_update_irq_enable(struct device *dev,
return 0; return 0;
} }
static void wm8350_rtc_alarm_handler(struct wm8350 *wm8350, int irq, static irqreturn_t wm8350_rtc_alarm_handler(int irq, void *data)
void *data)
{ {
struct wm8350 *wm8350 = data;
struct rtc_device *rtc = wm8350->rtc.rtc; struct rtc_device *rtc = wm8350->rtc.rtc;
int ret; int ret;
...@@ -330,14 +330,18 @@ static void wm8350_rtc_alarm_handler(struct wm8350 *wm8350, int irq, ...@@ -330,14 +330,18 @@ static void wm8350_rtc_alarm_handler(struct wm8350 *wm8350, int irq,
dev_err(&(wm8350->rtc.pdev->dev), dev_err(&(wm8350->rtc.pdev->dev),
"Failed to disable alarm: %d\n", ret); "Failed to disable alarm: %d\n", ret);
} }
return IRQ_HANDLED;
} }
static void wm8350_rtc_update_handler(struct wm8350 *wm8350, int irq, static irqreturn_t wm8350_rtc_update_handler(int irq, void *data)
void *data)
{ {
struct wm8350 *wm8350 = data;
struct rtc_device *rtc = wm8350->rtc.rtc; struct rtc_device *rtc = wm8350->rtc.rtc;
rtc_update_irq(rtc, 1, RTC_IRQF | RTC_UF); rtc_update_irq(rtc, 1, RTC_IRQF | RTC_UF);
return IRQ_HANDLED;
} }
static const struct rtc_class_ops wm8350_rtc_ops = { static const struct rtc_class_ops wm8350_rtc_ops = {
...@@ -459,10 +463,12 @@ static int wm8350_rtc_probe(struct platform_device *pdev) ...@@ -459,10 +463,12 @@ static int wm8350_rtc_probe(struct platform_device *pdev)
wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_PER); wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_PER);
wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC, wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC,
wm8350_rtc_update_handler, NULL); wm8350_rtc_update_handler, 0,
"RTC Seconds", wm8350);
wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM, wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM,
wm8350_rtc_alarm_handler, NULL); wm8350_rtc_alarm_handler, 0,
"RTC Alarm", wm8350);
wm8350_unmask_irq(wm8350, WM8350_IRQ_RTC_ALM); wm8350_unmask_irq(wm8350, WM8350_IRQ_RTC_ALM);
return 0; return 0;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/workqueue.h> #include <linux/interrupt.h>
#include <linux/mfd/wm8350/audio.h> #include <linux/mfd/wm8350/audio.h>
#include <linux/mfd/wm8350/gpio.h> #include <linux/mfd/wm8350/gpio.h>
...@@ -601,7 +601,7 @@ extern const u16 wm8352_mode3_defaults[]; ...@@ -601,7 +601,7 @@ extern const u16 wm8352_mode3_defaults[];
struct wm8350; struct wm8350;
struct wm8350_irq { struct wm8350_irq {
void (*handler) (struct wm8350 *, int, void *); irq_handler_t handler;
void *data; void *data;
}; };
...@@ -678,8 +678,8 @@ int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src); ...@@ -678,8 +678,8 @@ int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src);
* WM8350 internal interrupts * WM8350 internal interrupts
*/ */
int wm8350_register_irq(struct wm8350 *wm8350, int irq, int wm8350_register_irq(struct wm8350 *wm8350, int irq,
void (*handler) (struct wm8350 *, int, void *), irq_handler_t handler, unsigned long flags,
void *data); const char *name, void *data);
int wm8350_free_irq(struct wm8350 *wm8350, int irq); int wm8350_free_irq(struct wm8350 *wm8350, int irq);
int wm8350_mask_irq(struct wm8350 *wm8350, int irq); int wm8350_mask_irq(struct wm8350 *wm8350, int irq);
int wm8350_unmask_irq(struct wm8350 *wm8350, int irq); int wm8350_unmask_irq(struct wm8350 *wm8350, int irq);
......
...@@ -1340,9 +1340,10 @@ static int wm8350_resume(struct platform_device *pdev) ...@@ -1340,9 +1340,10 @@ static int wm8350_resume(struct platform_device *pdev)
return 0; return 0;
} }
static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data) static irqreturn_t wm8350_hp_jack_handler(int irq, void *data)
{ {
struct wm8350_data *priv = data; struct wm8350_data *priv = data;
struct wm8350 *wm8350 = priv->codec.control_data;
u16 reg; u16 reg;
int report; int report;
int mask; int mask;
...@@ -1365,7 +1366,7 @@ static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data) ...@@ -1365,7 +1366,7 @@ static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data)
if (!jack->jack) { if (!jack->jack) {
dev_warn(wm8350->dev, "Jack interrupt called with no jack\n"); dev_warn(wm8350->dev, "Jack interrupt called with no jack\n");
return; return IRQ_NONE;
} }
/* Debounce */ /* Debounce */
...@@ -1378,6 +1379,8 @@ static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data) ...@@ -1378,6 +1379,8 @@ static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data)
report = 0; report = 0;
snd_soc_jack_report(jack->jack, report, jack->report); snd_soc_jack_report(jack->jack, report, jack->report);
return IRQ_HANDLED;
} }
/** /**
...@@ -1421,7 +1424,7 @@ int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, ...@@ -1421,7 +1424,7 @@ int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena); wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena);
/* Sync status */ /* Sync status */
wm8350_hp_jack_handler(wm8350, irq, priv); wm8350_hp_jack_handler(irq, priv);
wm8350_unmask_irq(wm8350, irq); wm8350_unmask_irq(wm8350, irq);
...@@ -1485,9 +1488,11 @@ static int wm8350_probe(struct platform_device *pdev) ...@@ -1485,9 +1488,11 @@ static int wm8350_probe(struct platform_device *pdev)
wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L); wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L);
wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R); wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R);
wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L,
wm8350_hp_jack_handler, priv); wm8350_hp_jack_handler, 0, "Left jack detect",
priv);
wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R,
wm8350_hp_jack_handler, priv); wm8350_hp_jack_handler, 0, "Right jack detect",
priv);
ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
if (ret < 0) { if (ret < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment