diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-01-05 08:59:09 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-03-07 16:16:57 -0500 |
commit | 760e4518788df6762700e6bb9dd8692379f11168 (patch) | |
tree | d4fa27366ec331e9b120b4c5e3b8d62610c2b36a /include | |
parent | 29c71b138c83c8191f1f7e46fcc28b9d6bc8a5dd (diff) |
mfd: Convert WM8350 to genirq
This gives us use of the diagnostic facilities genirq provides and
will allow implementation of interrupt support for the WM8350 GPIOs.
Stub functions are provided to ease the transition of the individual
drivers, probably after additional work to pass the IRQ numbers via
the struct devices.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mfd/wm8350/core.h | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h index 8883125ddea1..04217a71f173 100644 --- a/include/linux/mfd/wm8350/core.h +++ b/include/linux/mfd/wm8350/core.h | |||
@@ -579,6 +579,8 @@ | |||
579 | 579 | ||
580 | #define WM8350_NUM_IRQ 63 | 580 | #define WM8350_NUM_IRQ 63 |
581 | 581 | ||
582 | #define WM8350_NUM_IRQ_REGS 7 | ||
583 | |||
582 | struct wm8350_reg_access { | 584 | struct wm8350_reg_access { |
583 | u16 readable; /* Mask of readable bits */ | 585 | u16 readable; /* Mask of readable bits */ |
584 | u16 writable; /* Mask of writable bits */ | 586 | u16 writable; /* Mask of writable bits */ |
@@ -600,11 +602,6 @@ extern const u16 wm8352_mode3_defaults[]; | |||
600 | 602 | ||
601 | struct wm8350; | 603 | struct wm8350; |
602 | 604 | ||
603 | struct wm8350_irq { | ||
604 | irq_handler_t handler; | ||
605 | void *data; | ||
606 | }; | ||
607 | |||
608 | struct wm8350_hwmon { | 605 | struct wm8350_hwmon { |
609 | struct platform_device *pdev; | 606 | struct platform_device *pdev; |
610 | struct device *classdev; | 607 | struct device *classdev; |
@@ -626,9 +623,10 @@ struct wm8350 { | |||
626 | struct mutex auxadc_mutex; | 623 | struct mutex auxadc_mutex; |
627 | 624 | ||
628 | /* Interrupt handling */ | 625 | /* Interrupt handling */ |
629 | struct mutex irq_mutex; /* IRQ table mutex */ | 626 | struct mutex irq_lock; |
630 | struct wm8350_irq irq[WM8350_NUM_IRQ]; | ||
631 | int chip_irq; | 627 | int chip_irq; |
628 | int irq_base; | ||
629 | u16 irq_masks[WM8350_NUM_IRQ_REGS]; | ||
632 | 630 | ||
633 | /* Client devices */ | 631 | /* Client devices */ |
634 | struct wm8350_codec codec; | 632 | struct wm8350_codec codec; |
@@ -677,13 +675,33 @@ int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src); | |||
677 | /* | 675 | /* |
678 | * WM8350 internal interrupts | 676 | * WM8350 internal interrupts |
679 | */ | 677 | */ |
680 | int wm8350_register_irq(struct wm8350 *wm8350, int irq, | 678 | static inline int wm8350_register_irq(struct wm8350 *wm8350, int irq, |
681 | irq_handler_t handler, unsigned long flags, | 679 | irq_handler_t handler, |
682 | const char *name, void *data); | 680 | unsigned long flags, |
683 | int wm8350_free_irq(struct wm8350 *wm8350, int irq, void *data); | 681 | const char *name, void *data) |
682 | { | ||
683 | if (!wm8350->irq_base) | ||
684 | return -ENODEV; | ||
685 | |||
686 | return request_threaded_irq(irq + wm8350->irq_base, NULL, | ||
687 | handler, flags, name, data); | ||
688 | } | ||
689 | |||
690 | static inline void wm8350_free_irq(struct wm8350 *wm8350, int irq, void *data) | ||
691 | { | ||
692 | free_irq(irq + wm8350->irq_base, data); | ||
693 | } | ||
694 | |||
695 | static inline void wm8350_mask_irq(struct wm8350 *wm8350, int irq) | ||
696 | { | ||
697 | disable_irq(irq + wm8350->irq_base); | ||
698 | } | ||
699 | |||
700 | static inline void wm8350_unmask_irq(struct wm8350 *wm8350, int irq) | ||
701 | { | ||
702 | enable_irq(irq + wm8350->irq_base); | ||
703 | } | ||
684 | 704 | ||
685 | int wm8350_mask_irq(struct wm8350 *wm8350, int irq); | ||
686 | int wm8350_unmask_irq(struct wm8350 *wm8350, int irq); | ||
687 | int wm8350_irq_init(struct wm8350 *wm8350, int irq, | 705 | int wm8350_irq_init(struct wm8350 *wm8350, int irq, |
688 | struct wm8350_platform_data *pdata); | 706 | struct wm8350_platform_data *pdata); |
689 | int wm8350_irq_exit(struct wm8350 *wm8350); | 707 | int wm8350_irq_exit(struct wm8350 *wm8350); |