mfd: arizona: Add support for WM8998 and WM1814
[linux-2.6/btrfs-unstable.git] / include / linux / mfd / arizona / core.h
blob79e607e2f0819796d05d513c2926e9ef57372451
1 /*
2 * Arizona MFD internals
4 * Copyright 2012 Wolfson Microelectronics plc
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #ifndef _WM_ARIZONA_CORE_H
14 #define _WM_ARIZONA_CORE_H
16 #include <linux/interrupt.h>
17 #include <linux/regmap.h>
18 #include <linux/regulator/consumer.h>
19 #include <linux/mfd/arizona/pdata.h>
21 #define ARIZONA_MAX_CORE_SUPPLIES 2
23 enum arizona_type {
24 WM5102 = 1,
25 WM5110 = 2,
26 WM8997 = 3,
27 WM8280 = 4,
28 WM8998 = 5,
29 WM1814 = 6,
32 #define ARIZONA_IRQ_GP1 0
33 #define ARIZONA_IRQ_GP2 1
34 #define ARIZONA_IRQ_GP3 2
35 #define ARIZONA_IRQ_GP4 3
36 #define ARIZONA_IRQ_GP5_FALL 4
37 #define ARIZONA_IRQ_GP5_RISE 5
38 #define ARIZONA_IRQ_JD_FALL 6
39 #define ARIZONA_IRQ_JD_RISE 7
40 #define ARIZONA_IRQ_DSP1_RAM_RDY 8
41 #define ARIZONA_IRQ_DSP2_RAM_RDY 9
42 #define ARIZONA_IRQ_DSP3_RAM_RDY 10
43 #define ARIZONA_IRQ_DSP4_RAM_RDY 11
44 #define ARIZONA_IRQ_DSP_IRQ1 12
45 #define ARIZONA_IRQ_DSP_IRQ2 13
46 #define ARIZONA_IRQ_DSP_IRQ3 14
47 #define ARIZONA_IRQ_DSP_IRQ4 15
48 #define ARIZONA_IRQ_DSP_IRQ5 16
49 #define ARIZONA_IRQ_DSP_IRQ6 17
50 #define ARIZONA_IRQ_DSP_IRQ7 18
51 #define ARIZONA_IRQ_DSP_IRQ8 19
52 #define ARIZONA_IRQ_SPK_OVERHEAT_WARN 20
53 #define ARIZONA_IRQ_SPK_OVERHEAT 21
54 #define ARIZONA_IRQ_MICDET 22
55 #define ARIZONA_IRQ_HPDET 23
56 #define ARIZONA_IRQ_WSEQ_DONE 24
57 #define ARIZONA_IRQ_DRC2_SIG_DET 25
58 #define ARIZONA_IRQ_DRC1_SIG_DET 26
59 #define ARIZONA_IRQ_ASRC2_LOCK 27
60 #define ARIZONA_IRQ_ASRC1_LOCK 28
61 #define ARIZONA_IRQ_UNDERCLOCKED 29
62 #define ARIZONA_IRQ_OVERCLOCKED 30
63 #define ARIZONA_IRQ_FLL2_LOCK 31
64 #define ARIZONA_IRQ_FLL1_LOCK 32
65 #define ARIZONA_IRQ_CLKGEN_ERR 33
66 #define ARIZONA_IRQ_CLKGEN_ERR_ASYNC 34
67 #define ARIZONA_IRQ_ASRC_CFG_ERR 35
68 #define ARIZONA_IRQ_AIF3_ERR 36
69 #define ARIZONA_IRQ_AIF2_ERR 37
70 #define ARIZONA_IRQ_AIF1_ERR 38
71 #define ARIZONA_IRQ_CTRLIF_ERR 39
72 #define ARIZONA_IRQ_MIXER_DROPPED_SAMPLES 40
73 #define ARIZONA_IRQ_ASYNC_CLK_ENA_LOW 41
74 #define ARIZONA_IRQ_SYSCLK_ENA_LOW 42
75 #define ARIZONA_IRQ_ISRC1_CFG_ERR 43
76 #define ARIZONA_IRQ_ISRC2_CFG_ERR 44
77 #define ARIZONA_IRQ_BOOT_DONE 45
78 #define ARIZONA_IRQ_DCS_DAC_DONE 46
79 #define ARIZONA_IRQ_DCS_HP_DONE 47
80 #define ARIZONA_IRQ_FLL2_CLOCK_OK 48
81 #define ARIZONA_IRQ_FLL1_CLOCK_OK 49
82 #define ARIZONA_IRQ_MICD_CLAMP_RISE 50
83 #define ARIZONA_IRQ_MICD_CLAMP_FALL 51
84 #define ARIZONA_IRQ_HP3R_DONE 52
85 #define ARIZONA_IRQ_HP3L_DONE 53
86 #define ARIZONA_IRQ_HP2R_DONE 54
87 #define ARIZONA_IRQ_HP2L_DONE 55
88 #define ARIZONA_IRQ_HP1R_DONE 56
89 #define ARIZONA_IRQ_HP1L_DONE 57
90 #define ARIZONA_IRQ_ISRC3_CFG_ERR 58
91 #define ARIZONA_IRQ_DSP_SHARED_WR_COLL 59
92 #define ARIZONA_IRQ_SPK_SHUTDOWN 60
93 #define ARIZONA_IRQ_SPK1R_SHORT 61
94 #define ARIZONA_IRQ_SPK1L_SHORT 62
95 #define ARIZONA_IRQ_HP3R_SC_NEG 63
96 #define ARIZONA_IRQ_HP3R_SC_POS 64
97 #define ARIZONA_IRQ_HP3L_SC_NEG 65
98 #define ARIZONA_IRQ_HP3L_SC_POS 66
99 #define ARIZONA_IRQ_HP2R_SC_NEG 67
100 #define ARIZONA_IRQ_HP2R_SC_POS 68
101 #define ARIZONA_IRQ_HP2L_SC_NEG 69
102 #define ARIZONA_IRQ_HP2L_SC_POS 70
103 #define ARIZONA_IRQ_HP1R_SC_NEG 71
104 #define ARIZONA_IRQ_HP1R_SC_POS 72
105 #define ARIZONA_IRQ_HP1L_SC_NEG 73
106 #define ARIZONA_IRQ_HP1L_SC_POS 74
108 #define ARIZONA_NUM_IRQ 75
110 struct snd_soc_dapm_context;
112 struct arizona {
113 struct regmap *regmap;
114 struct device *dev;
116 enum arizona_type type;
117 unsigned int rev;
119 int num_core_supplies;
120 struct regulator_bulk_data core_supplies[ARIZONA_MAX_CORE_SUPPLIES];
121 struct regulator *dcvdd;
122 bool has_fully_powered_off;
124 struct arizona_pdata pdata;
126 unsigned int external_dcvdd:1;
128 int irq;
129 struct irq_domain *virq;
130 struct regmap_irq_chip_data *aod_irq_chip;
131 struct regmap_irq_chip_data *irq_chip;
133 bool hpdet_clamp;
134 unsigned int hp_ena;
136 struct mutex clk_lock;
137 int clk32k_ref;
139 bool ctrlif_error;
141 struct snd_soc_dapm_context *dapm;
143 int tdm_width[ARIZONA_MAX_AIF];
144 int tdm_slots[ARIZONA_MAX_AIF];
146 uint16_t dac_comp_coeff;
147 uint8_t dac_comp_enabled;
148 struct mutex dac_comp_lock;
151 int arizona_clk32k_enable(struct arizona *arizona);
152 int arizona_clk32k_disable(struct arizona *arizona);
154 int arizona_request_irq(struct arizona *arizona, int irq, char *name,
155 irq_handler_t handler, void *data);
156 void arizona_free_irq(struct arizona *arizona, int irq, void *data);
157 int arizona_set_irq_wake(struct arizona *arizona, int irq, int on);
159 #ifdef CONFIG_MFD_WM5102
160 int wm5102_patch(struct arizona *arizona);
161 #else
162 static inline int wm5102_patch(struct arizona *arizona)
164 return 0;
166 #endif
168 int wm5110_patch(struct arizona *arizona);
169 int wm8997_patch(struct arizona *arizona);
170 int wm8998_patch(struct arizona *arizona);
172 extern int arizona_of_get_named_gpio(struct arizona *arizona, const char *prop,
173 bool mandatory);
175 #endif