aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/wm8350-irq.c6
-rw-r--r--drivers/power/wm8350_power.c39
-rw-r--r--drivers/regulator/wm8350-regulator.c7
-rw-r--r--drivers/rtc/rtc-wm8350.c18
-rw-r--r--include/linux/mfd/wm8350/core.h8
-rw-r--r--sound/soc/codecs/wm8350.c15
6 files changed, 59 insertions, 34 deletions
diff --git a/drivers/mfd/wm8350-irq.c b/drivers/mfd/wm8350-irq.c
index d9abfc94c685..2ea2b8b4c72a 100644
--- a/drivers/mfd/wm8350-irq.c
+++ b/drivers/mfd/wm8350-irq.c
@@ -371,7 +371,7 @@ static void wm8350_irq_call_handler(struct wm8350 *wm8350, int irq)
371 mutex_lock(&wm8350->irq_mutex); 371 mutex_lock(&wm8350->irq_mutex);
372 372
373 if (wm8350->irq[irq].handler) 373 if (wm8350->irq[irq].handler)
374 wm8350->irq[irq].handler(wm8350, irq, wm8350->irq[irq].data); 374 wm8350->irq[irq].handler(irq, wm8350->irq[irq].data);
375 else { 375 else {
376 dev_err(wm8350->dev, "irq %d nobody cared. now masked.\n", 376 dev_err(wm8350->dev, "irq %d nobody cared. now masked.\n",
377 irq); 377 irq);
@@ -431,8 +431,8 @@ static irqreturn_t wm8350_irq(int irq, void *irq_data)
431} 431}
432 432
433int wm8350_register_irq(struct wm8350 *wm8350, int irq, 433int wm8350_register_irq(struct wm8350 *wm8350, int irq,
434 void (*handler) (struct wm8350 *, int, void *), 434 irq_handler_t handler, unsigned long flags,
435 void *data) 435 const char *name, void *data)
436{ 436{
437 if (irq < 0 || irq > WM8350_NUM_IRQ || !handler) 437 if (irq < 0 || irq > WM8350_NUM_IRQ || !handler)
438 return -EINVAL; 438 return -EINVAL;
diff --git a/drivers/power/wm8350_power.c b/drivers/power/wm8350_power.c
index 28b0299c0043..6e634cf7fc14 100644
--- a/drivers/power/wm8350_power.c
+++ b/drivers/power/wm8350_power.c
@@ -184,8 +184,9 @@ static ssize_t charger_state_show(struct device *dev,
184 184
185static DEVICE_ATTR(charger_state, 0444, charger_state_show, NULL); 185static DEVICE_ATTR(charger_state, 0444, charger_state_show, NULL);
186 186
187static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data) 187static irqreturn_t wm8350_charger_handler(int irq, void *data)
188{ 188{
189 struct wm8350 *wm8350 = data;
189 struct wm8350_power *power = &wm8350->power; 190 struct wm8350_power *power = &wm8350->power;
190 struct wm8350_charger_policy *policy = power->policy; 191 struct wm8350_charger_policy *policy = power->policy;
191 192
@@ -238,6 +239,8 @@ static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data)
238 default: 239 default:
239 dev_err(wm8350->dev, "Unknown interrupt %d\n", irq); 240 dev_err(wm8350->dev, "Unknown interrupt %d\n", irq);
240 } 241 }
242
243 return IRQ_HANDLED;
241} 244}
242 245
243/********************************************************************* 246/*********************************************************************
@@ -387,45 +390,53 @@ static void wm8350_init_charger(struct wm8350 *wm8350)
387{ 390{
388 /* register our interest in charger events */ 391 /* register our interest in charger events */
389 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, 392 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT,
390 wm8350_charger_handler, NULL); 393 wm8350_charger_handler, 0, "Battery hot", wm8350);
391 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); 394 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT);
392 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, 395 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD,
393 wm8350_charger_handler, NULL); 396 wm8350_charger_handler, 0, "Battery cold", wm8350);
394 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); 397 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD);
395 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, 398 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL,
396 wm8350_charger_handler, NULL); 399 wm8350_charger_handler, 0, "Battery fail", wm8350);
397 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); 400 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL);
398 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, 401 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO,
399 wm8350_charger_handler, NULL); 402 wm8350_charger_handler, 0,
403 "Charger timeout", wm8350);
400 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_TO); 404 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_TO);
401 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, 405 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END,
402 wm8350_charger_handler, NULL); 406 wm8350_charger_handler, 0,
407 "Charge end", wm8350);
403 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_END); 408 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_END);
404 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, 409 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START,
405 wm8350_charger_handler, NULL); 410 wm8350_charger_handler, 0,
411 "Charge start", wm8350);
406 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_START); 412 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_START);
407 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, 413 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY,
408 wm8350_charger_handler, NULL); 414 wm8350_charger_handler, 0,
415 "Fast charge ready", wm8350);
409 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY); 416 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY);
410 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, 417 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9,
411 wm8350_charger_handler, NULL); 418 wm8350_charger_handler, 0,
419 "Battery <3.9V", wm8350);
412 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); 420 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9);
413 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, 421 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1,
414 wm8350_charger_handler, NULL); 422 wm8350_charger_handler, 0,
423 "Battery <3.1V", wm8350);
415 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); 424 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1);
416 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, 425 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85,
417 wm8350_charger_handler, NULL); 426 wm8350_charger_handler, 0,
427 "Battery <2.85V", wm8350);
428
418 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); 429 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85);
419 430
420 /* and supply change events */ 431 /* and supply change events */
421 wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, 432 wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB,
422 wm8350_charger_handler, NULL); 433 wm8350_charger_handler, 0, "USB", wm8350);
423 wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_USB_FB); 434 wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_USB_FB);
424 wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, 435 wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB,
425 wm8350_charger_handler, NULL); 436 wm8350_charger_handler, 0, "Wall", wm8350);
426 wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); 437 wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB);
427 wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, 438 wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB,
428 wm8350_charger_handler, NULL); 439 wm8350_charger_handler, 0, "Battery", wm8350);
429 wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); 440 wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB);
430} 441}
431 442
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index 768bd0e5b48b..8c289fd4add2 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -1330,9 +1330,10 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
1330 }, 1330 },
1331}; 1331};
1332 1332
1333static void pmic_uv_handler(struct wm8350 *wm8350, int irq, void *data) 1333static irqreturn_t pmic_uv_handler(int irq, void *data)
1334{ 1334{
1335 struct regulator_dev *rdev = (struct regulator_dev *)data; 1335 struct regulator_dev *rdev = (struct regulator_dev *)data;
1336 struct wm8350 *wm8350 = rdev_get_drvdata(rdev);
1336 1337
1337 mutex_lock(&rdev->mutex); 1338 mutex_lock(&rdev->mutex);
1338 if (irq == WM8350_IRQ_CS1 || irq == WM8350_IRQ_CS2) 1339 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 REGULATOR_EVENT_UNDER_VOLTAGE, 1345 REGULATOR_EVENT_UNDER_VOLTAGE,
1345 wm8350); 1346 wm8350);
1346 mutex_unlock(&rdev->mutex); 1347 mutex_unlock(&rdev->mutex);
1348
1349 return IRQ_HANDLED;
1347} 1350}
1348 1351
1349static int wm8350_regulator_probe(struct platform_device *pdev) 1352static int wm8350_regulator_probe(struct platform_device *pdev)
@@ -1388,7 +1391,7 @@ static int wm8350_regulator_probe(struct platform_device *pdev)
1388 1391
1389 /* register regulator IRQ */ 1392 /* register regulator IRQ */
1390 ret = wm8350_register_irq(wm8350, wm8350_reg[pdev->id].irq, 1393 ret = wm8350_register_irq(wm8350, wm8350_reg[pdev->id].irq,
1391 pmic_uv_handler, rdev); 1394 pmic_uv_handler, 0, "UV", rdev);
1392 if (ret < 0) { 1395 if (ret < 0) {
1393 regulator_unregister(rdev); 1396 regulator_unregister(rdev);
1394 dev_err(&pdev->dev, "failed to register regulator %s IRQ\n", 1397 dev_err(&pdev->dev, "failed to register regulator %s IRQ\n",
diff --git a/drivers/rtc/rtc-wm8350.c b/drivers/rtc/rtc-wm8350.c
index c91edc572eb6..56e56e552813 100644
--- a/drivers/rtc/rtc-wm8350.c
+++ b/drivers/rtc/rtc-wm8350.c
@@ -315,9 +315,9 @@ static int wm8350_rtc_update_irq_enable(struct device *dev,
315 return 0; 315 return 0;
316} 316}
317 317
318static void wm8350_rtc_alarm_handler(struct wm8350 *wm8350, int irq, 318static irqreturn_t wm8350_rtc_alarm_handler(int irq, void *data)
319 void *data)
320{ 319{
320 struct wm8350 *wm8350 = data;
321 struct rtc_device *rtc = wm8350->rtc.rtc; 321 struct rtc_device *rtc = wm8350->rtc.rtc;
322 int ret; 322 int ret;
323 323
@@ -330,14 +330,18 @@ static void wm8350_rtc_alarm_handler(struct wm8350 *wm8350, int irq,
330 dev_err(&(wm8350->rtc.pdev->dev), 330 dev_err(&(wm8350->rtc.pdev->dev),
331 "Failed to disable alarm: %d\n", ret); 331 "Failed to disable alarm: %d\n", ret);
332 } 332 }
333
334 return IRQ_HANDLED;
333} 335}
334 336
335static void wm8350_rtc_update_handler(struct wm8350 *wm8350, int irq, 337static irqreturn_t wm8350_rtc_update_handler(int irq, void *data)
336 void *data)
337{ 338{
339 struct wm8350 *wm8350 = data;
338 struct rtc_device *rtc = wm8350->rtc.rtc; 340 struct rtc_device *rtc = wm8350->rtc.rtc;
339 341
340 rtc_update_irq(rtc, 1, RTC_IRQF | RTC_UF); 342 rtc_update_irq(rtc, 1, RTC_IRQF | RTC_UF);
343
344 return IRQ_HANDLED;
341} 345}
342 346
343static const struct rtc_class_ops wm8350_rtc_ops = { 347static const struct rtc_class_ops wm8350_rtc_ops = {
@@ -459,10 +463,12 @@ static int wm8350_rtc_probe(struct platform_device *pdev)
459 wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_PER); 463 wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_PER);
460 464
461 wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC, 465 wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC,
462 wm8350_rtc_update_handler, NULL); 466 wm8350_rtc_update_handler, 0,
467 "RTC Seconds", wm8350);
463 468
464 wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM, 469 wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM,
465 wm8350_rtc_alarm_handler, NULL); 470 wm8350_rtc_alarm_handler, 0,
471 "RTC Alarm", wm8350);
466 wm8350_unmask_irq(wm8350, WM8350_IRQ_RTC_ALM); 472 wm8350_unmask_irq(wm8350, WM8350_IRQ_RTC_ALM);
467 473
468 return 0; 474 return 0;
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index ffce508a9109..43868899bf49 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -15,7 +15,7 @@
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/workqueue.h> 18#include <linux/interrupt.h>
19 19
20#include <linux/mfd/wm8350/audio.h> 20#include <linux/mfd/wm8350/audio.h>
21#include <linux/mfd/wm8350/gpio.h> 21#include <linux/mfd/wm8350/gpio.h>
@@ -601,7 +601,7 @@ extern const u16 wm8352_mode3_defaults[];
601struct wm8350; 601struct wm8350;
602 602
603struct wm8350_irq { 603struct wm8350_irq {
604 void (*handler) (struct wm8350 *, int, void *); 604 irq_handler_t handler;
605 void *data; 605 void *data;
606}; 606};
607 607
@@ -678,8 +678,8 @@ int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src);
678 * WM8350 internal interrupts 678 * WM8350 internal interrupts
679 */ 679 */
680int wm8350_register_irq(struct wm8350 *wm8350, int irq, 680int wm8350_register_irq(struct wm8350 *wm8350, int irq,
681 void (*handler) (struct wm8350 *, int, void *), 681 irq_handler_t handler, unsigned long flags,
682 void *data); 682 const char *name, void *data);
683int wm8350_free_irq(struct wm8350 *wm8350, int irq); 683int wm8350_free_irq(struct wm8350 *wm8350, int irq);
684int wm8350_mask_irq(struct wm8350 *wm8350, int irq); 684int wm8350_mask_irq(struct wm8350 *wm8350, int irq);
685int wm8350_unmask_irq(struct wm8350 *wm8350, int irq); 685int wm8350_unmask_irq(struct wm8350 *wm8350, int irq);
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index f82125d9e85a..17a327d67fd5 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -1340,9 +1340,10 @@ static int wm8350_resume(struct platform_device *pdev)
1340 return 0; 1340 return 0;
1341} 1341}
1342 1342
1343static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data) 1343static irqreturn_t wm8350_hp_jack_handler(int irq, void *data)
1344{ 1344{
1345 struct wm8350_data *priv = data; 1345 struct wm8350_data *priv = data;
1346 struct wm8350 *wm8350 = priv->codec.control_data;
1346 u16 reg; 1347 u16 reg;
1347 int report; 1348 int report;
1348 int mask; 1349 int mask;
@@ -1365,7 +1366,7 @@ static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data)
1365 1366
1366 if (!jack->jack) { 1367 if (!jack->jack) {
1367 dev_warn(wm8350->dev, "Jack interrupt called with no jack\n"); 1368 dev_warn(wm8350->dev, "Jack interrupt called with no jack\n");
1368 return; 1369 return IRQ_NONE;
1369 } 1370 }
1370 1371
1371 /* Debounce */ 1372 /* Debounce */
@@ -1378,6 +1379,8 @@ static void wm8350_hp_jack_handler(struct wm8350 *wm8350, int irq, void *data)
1378 report = 0; 1379 report = 0;
1379 1380
1380 snd_soc_jack_report(jack->jack, report, jack->report); 1381 snd_soc_jack_report(jack->jack, report, jack->report);
1382
1383 return IRQ_HANDLED;
1381} 1384}
1382 1385
1383/** 1386/**
@@ -1421,7 +1424,7 @@ int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
1421 wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena); 1424 wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena);
1422 1425
1423 /* Sync status */ 1426 /* Sync status */
1424 wm8350_hp_jack_handler(wm8350, irq, priv); 1427 wm8350_hp_jack_handler(irq, priv);
1425 1428
1426 wm8350_unmask_irq(wm8350, irq); 1429 wm8350_unmask_irq(wm8350, irq);
1427 1430
@@ -1485,9 +1488,11 @@ static int wm8350_probe(struct platform_device *pdev)
1485 wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L); 1488 wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L);
1486 wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R); 1489 wm8350_mask_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R);
1487 wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, 1490 wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L,
1488 wm8350_hp_jack_handler, priv); 1491 wm8350_hp_jack_handler, 0, "Left jack detect",
1492 priv);
1489 wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, 1493 wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R,
1490 wm8350_hp_jack_handler, priv); 1494 wm8350_hp_jack_handler, 0, "Right jack detect",
1495 priv);
1491 1496
1492 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 1497 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
1493 if (ret < 0) { 1498 if (ret < 0) {