aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd/wm8350
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mfd/wm8350')
-rw-r--r--include/linux/mfd/wm8350/core.h49
-rw-r--r--include/linux/mfd/wm8350/gpio.h1
-rw-r--r--include/linux/mfd/wm8350/rtc.h1
3 files changed, 38 insertions, 13 deletions
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 43868899bf49..98fcc977e82b 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -16,6 +16,7 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/completion.h>
19 20
20#include <linux/mfd/wm8350/audio.h> 21#include <linux/mfd/wm8350/audio.h>
21#include <linux/mfd/wm8350/gpio.h> 22#include <linux/mfd/wm8350/gpio.h>
@@ -579,6 +580,8 @@
579 580
580#define WM8350_NUM_IRQ 63 581#define WM8350_NUM_IRQ 63
581 582
583#define WM8350_NUM_IRQ_REGS 7
584
582struct wm8350_reg_access { 585struct wm8350_reg_access {
583 u16 readable; /* Mask of readable bits */ 586 u16 readable; /* Mask of readable bits */
584 u16 writable; /* Mask of writable bits */ 587 u16 writable; /* Mask of writable bits */
@@ -600,11 +603,6 @@ extern const u16 wm8352_mode3_defaults[];
600 603
601struct wm8350; 604struct wm8350;
602 605
603struct wm8350_irq {
604 irq_handler_t handler;
605 void *data;
606};
607
608struct wm8350_hwmon { 606struct wm8350_hwmon {
609 struct platform_device *pdev; 607 struct platform_device *pdev;
610 struct device *classdev; 608 struct device *classdev;
@@ -624,11 +622,13 @@ struct wm8350 {
624 u16 *reg_cache; 622 u16 *reg_cache;
625 623
626 struct mutex auxadc_mutex; 624 struct mutex auxadc_mutex;
625 struct completion auxadc_done;
627 626
628 /* Interrupt handling */ 627 /* Interrupt handling */
629 struct mutex irq_mutex; /* IRQ table mutex */ 628 struct mutex irq_lock;
630 struct wm8350_irq irq[WM8350_NUM_IRQ];
631 int chip_irq; 629 int chip_irq;
630 int irq_base;
631 u16 irq_masks[WM8350_NUM_IRQ_REGS];
632 632
633 /* Client devices */ 633 /* Client devices */
634 struct wm8350_codec codec; 634 struct wm8350_codec codec;
@@ -647,11 +647,13 @@ struct wm8350 {
647 * used by the platform to configure GPIO functions and similar. 647 * used by the platform to configure GPIO functions and similar.
648 * @irq_high: Set if WM8350 IRQ is active high. 648 * @irq_high: Set if WM8350 IRQ is active high.
649 * @irq_base: Base IRQ for genirq (not currently used). 649 * @irq_base: Base IRQ for genirq (not currently used).
650 * @gpio_base: Base for gpiolib.
650 */ 651 */
651struct wm8350_platform_data { 652struct wm8350_platform_data {
652 int (*init)(struct wm8350 *wm8350); 653 int (*init)(struct wm8350 *wm8350);
653 int irq_high; 654 int irq_high;
654 int irq_base; 655 int irq_base;
656 int gpio_base;
655}; 657};
656 658
657 659
@@ -677,12 +679,33 @@ int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src);
677/* 679/*
678 * WM8350 internal interrupts 680 * WM8350 internal interrupts
679 */ 681 */
680int wm8350_register_irq(struct wm8350 *wm8350, int irq, 682static inline int wm8350_register_irq(struct wm8350 *wm8350, int irq,
681 irq_handler_t handler, unsigned long flags, 683 irq_handler_t handler,
682 const char *name, void *data); 684 unsigned long flags,
683int wm8350_free_irq(struct wm8350 *wm8350, int irq); 685 const char *name, void *data)
684int wm8350_mask_irq(struct wm8350 *wm8350, int irq); 686{
685int wm8350_unmask_irq(struct wm8350 *wm8350, int irq); 687 if (!wm8350->irq_base)
688 return -ENODEV;
689
690 return request_threaded_irq(irq + wm8350->irq_base, NULL,
691 handler, flags, name, data);
692}
693
694static inline void wm8350_free_irq(struct wm8350 *wm8350, int irq, void *data)
695{
696 free_irq(irq + wm8350->irq_base, data);
697}
698
699static inline void wm8350_mask_irq(struct wm8350 *wm8350, int irq)
700{
701 disable_irq(irq + wm8350->irq_base);
702}
703
704static inline void wm8350_unmask_irq(struct wm8350 *wm8350, int irq)
705{
706 enable_irq(irq + wm8350->irq_base);
707}
708
686int wm8350_irq_init(struct wm8350 *wm8350, int irq, 709int wm8350_irq_init(struct wm8350 *wm8350, int irq,
687 struct wm8350_platform_data *pdata); 710 struct wm8350_platform_data *pdata);
688int wm8350_irq_exit(struct wm8350 *wm8350); 711int wm8350_irq_exit(struct wm8350 *wm8350);
diff --git a/include/linux/mfd/wm8350/gpio.h b/include/linux/mfd/wm8350/gpio.h
index 71af3d6ebe9d..d657bcd6d955 100644
--- a/include/linux/mfd/wm8350/gpio.h
+++ b/include/linux/mfd/wm8350/gpio.h
@@ -29,6 +29,7 @@
29#define WM8350_GPIO_FUNCTION_SELECT_2 0x8D 29#define WM8350_GPIO_FUNCTION_SELECT_2 0x8D
30#define WM8350_GPIO_FUNCTION_SELECT_3 0x8E 30#define WM8350_GPIO_FUNCTION_SELECT_3 0x8E
31#define WM8350_GPIO_FUNCTION_SELECT_4 0x8F 31#define WM8350_GPIO_FUNCTION_SELECT_4 0x8F
32#define WM8350_GPIO_LEVEL 0xE6
32 33
33/* 34/*
34 * GPIO Functions 35 * GPIO Functions
diff --git a/include/linux/mfd/wm8350/rtc.h b/include/linux/mfd/wm8350/rtc.h
index 24add2bef6c9..ebd72ffc62d1 100644
--- a/include/linux/mfd/wm8350/rtc.h
+++ b/include/linux/mfd/wm8350/rtc.h
@@ -263,6 +263,7 @@ struct wm8350_rtc {
263 struct platform_device *pdev; 263 struct platform_device *pdev;
264 struct rtc_device *rtc; 264 struct rtc_device *rtc;
265 int alarm_enabled; /* used over suspend/resume */ 265 int alarm_enabled; /* used over suspend/resume */
266 int update_enabled;
266}; 267};
267 268
268#endif 269#endif