~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/mfd/wm8994/core.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * include/linux/mfd/wm8994/core.h -- Core interface for WM8994
  4  *
  5  * Copyright 2009 Wolfson Microelectronics PLC.
  6  *
  7  * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  8  */
  9 
 10 #ifndef __MFD_WM8994_CORE_H__
 11 #define __MFD_WM8994_CORE_H__
 12 
 13 #include <linux/mutex.h>
 14 #include <linux/interrupt.h>
 15 #include <linux/regmap.h>
 16 
 17 #include <linux/mfd/wm8994/pdata.h>
 18 
 19 enum wm8994_type {
 20         WM8994 = 0,
 21         WM8958 = 1,
 22         WM1811 = 2,
 23 };
 24 
 25 struct regulator_dev;
 26 struct regulator_bulk_data;
 27 struct irq_domain;
 28 
 29 #define WM8994_NUM_GPIO_REGS 11
 30 #define WM8994_NUM_LDO_REGS   2
 31 #define WM8994_NUM_IRQ_REGS   2
 32 
 33 #define WM8994_IRQ_TEMP_SHUT            0
 34 #define WM8994_IRQ_MIC1_DET             1
 35 #define WM8994_IRQ_MIC1_SHRT            2
 36 #define WM8994_IRQ_MIC2_DET             3
 37 #define WM8994_IRQ_MIC2_SHRT            4
 38 #define WM8994_IRQ_FLL1_LOCK            5
 39 #define WM8994_IRQ_FLL2_LOCK            6
 40 #define WM8994_IRQ_SRC1_LOCK            7
 41 #define WM8994_IRQ_SRC2_LOCK            8
 42 #define WM8994_IRQ_AIF1DRC1_SIG_DET     9
 43 #define WM8994_IRQ_AIF1DRC2_SIG_DET     10
 44 #define WM8994_IRQ_AIF2DRC_SIG_DET      11
 45 #define WM8994_IRQ_FIFOS_ERR            12
 46 #define WM8994_IRQ_WSEQ_DONE            13
 47 #define WM8994_IRQ_DCS_DONE             14
 48 #define WM8994_IRQ_TEMP_WARN            15
 49 
 50 /* GPIOs in the chip are numbered from 1-11 */
 51 #define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN)
 52 
 53 struct wm8994 {
 54         struct wm8994_pdata pdata;
 55 
 56         enum wm8994_type type;
 57         int revision;
 58         int cust_id;
 59 
 60         struct device *dev;
 61         struct regmap *regmap;
 62 
 63         bool ldo_ena_always_driven;
 64 
 65         int gpio_base;
 66         int irq_base;
 67 
 68         int irq;
 69         struct regmap_irq_chip_data *irq_data;
 70         struct irq_domain *edge_irq;
 71 
 72         /* Used over suspend/resume */
 73         bool suspended;
 74 
 75         struct regulator_dev *dbvdd;
 76         int num_supplies;
 77         struct regulator_bulk_data *supplies;
 78 };
 79 
 80 /* Device I/O API */
 81 
 82 static inline int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg)
 83 {
 84         unsigned int val;
 85         int ret;
 86 
 87         ret = regmap_read(wm8994->regmap, reg, &val);
 88 
 89         if (ret < 0)
 90                 return ret;
 91         else
 92                 return val;
 93 }
 94 
 95 static inline int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
 96                                    unsigned short val)
 97 {
 98         return regmap_write(wm8994->regmap, reg, val);
 99 }
100 
101 static inline int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
102                                    int count, u16 *buf)
103 {
104         return regmap_bulk_read(wm8994->regmap, reg, buf, count);
105 }
106 
107 static inline int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
108                                     int count, const u16 *buf)
109 {
110         return regmap_raw_write(wm8994->regmap, reg, buf, count * sizeof(u16));
111 }
112 
113 static inline int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
114                     unsigned short mask, unsigned short val)
115 {
116         return regmap_update_bits(wm8994->regmap, reg, mask, val);
117 }
118 
119 /* Helper to save on boilerplate */
120 static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
121                                      irq_handler_t handler, const char *name,
122                                      void *data)
123 {
124         if (!wm8994->irq_data)
125                 return -EINVAL;
126         return request_threaded_irq(regmap_irq_get_virq(wm8994->irq_data, irq),
127                                     NULL, handler, IRQF_TRIGGER_RISING, name,
128                                     data);
129 }
130 static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data)
131 {
132         if (!wm8994->irq_data)
133                 return;
134         free_irq(regmap_irq_get_virq(wm8994->irq_data, irq), data);
135 }
136 
137 int wm8994_irq_init(struct wm8994 *wm8994);
138 void wm8994_irq_exit(struct wm8994 *wm8994);
139 
140 #endif
141 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php