]> asedeno.scripts.mit.edu Git - linux.git/blob - include/linux/mfd/arizona/pdata.h
regulator: arizona-micsupp: Move pdata into a separate structure
[linux.git] / include / linux / mfd / arizona / pdata.h
1 /*
2  * Platform data for Arizona devices
3  *
4  * Copyright 2012 Wolfson Microelectronics. PLC.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10
11 #ifndef _ARIZONA_PDATA_H
12 #define _ARIZONA_PDATA_H
13
14 #include <dt-bindings/mfd/arizona.h>
15 #include <linux/regulator/arizona-micsupp.h>
16
17 #define ARIZONA_GPN_DIR_MASK                     0x8000  /* GPN_DIR */
18 #define ARIZONA_GPN_DIR_SHIFT                        15  /* GPN_DIR */
19 #define ARIZONA_GPN_DIR_WIDTH                         1  /* GPN_DIR */
20 #define ARIZONA_GPN_PU_MASK                      0x4000  /* GPN_PU */
21 #define ARIZONA_GPN_PU_SHIFT                         14  /* GPN_PU */
22 #define ARIZONA_GPN_PU_WIDTH                          1  /* GPN_PU */
23 #define ARIZONA_GPN_PD_MASK                      0x2000  /* GPN_PD */
24 #define ARIZONA_GPN_PD_SHIFT                         13  /* GPN_PD */
25 #define ARIZONA_GPN_PD_WIDTH                          1  /* GPN_PD */
26 #define ARIZONA_GPN_LVL_MASK                     0x0800  /* GPN_LVL */
27 #define ARIZONA_GPN_LVL_SHIFT                        11  /* GPN_LVL */
28 #define ARIZONA_GPN_LVL_WIDTH                         1  /* GPN_LVL */
29 #define ARIZONA_GPN_POL_MASK                     0x0400  /* GPN_POL */
30 #define ARIZONA_GPN_POL_SHIFT                        10  /* GPN_POL */
31 #define ARIZONA_GPN_POL_WIDTH                         1  /* GPN_POL */
32 #define ARIZONA_GPN_OP_CFG_MASK                  0x0200  /* GPN_OP_CFG */
33 #define ARIZONA_GPN_OP_CFG_SHIFT                      9  /* GPN_OP_CFG */
34 #define ARIZONA_GPN_OP_CFG_WIDTH                      1  /* GPN_OP_CFG */
35 #define ARIZONA_GPN_DB_MASK                      0x0100  /* GPN_DB */
36 #define ARIZONA_GPN_DB_SHIFT                          8  /* GPN_DB */
37 #define ARIZONA_GPN_DB_WIDTH                          1  /* GPN_DB */
38 #define ARIZONA_GPN_FN_MASK                      0x007F  /* GPN_FN - [6:0] */
39 #define ARIZONA_GPN_FN_SHIFT                          0  /* GPN_FN - [6:0] */
40 #define ARIZONA_GPN_FN_WIDTH                          7  /* GPN_FN - [6:0] */
41
42 #define ARIZONA_MAX_GPIO 5
43
44 #define ARIZONA_MAX_INPUT 4
45
46 #define ARIZONA_MAX_MICBIAS 3
47
48 #define ARIZONA_MAX_OUTPUT 6
49
50 #define ARIZONA_MAX_AIF 3
51
52 #define ARIZONA_HAP_ACT_ERM 0
53 #define ARIZONA_HAP_ACT_LRA 2
54
55 #define ARIZONA_MAX_PDM_SPK 2
56
57 struct regulator_init_data;
58
59 struct arizona_micbias {
60         int mV;                    /** Regulated voltage */
61         unsigned int ext_cap:1;    /** External capacitor fitted */
62         unsigned int discharge:1;  /** Actively discharge */
63         unsigned int soft_start:1; /** Disable aggressive startup ramp rate */
64         unsigned int bypass:1;     /** Use bypass mode */
65 };
66
67 struct arizona_micd_config {
68         unsigned int src;
69         unsigned int bias;
70         bool gpio;
71 };
72
73 struct arizona_micd_range {
74         int max;  /** Ohms */
75         int key;  /** Key to report to input layer */
76 };
77
78 struct arizona_pdata {
79         int reset;      /** GPIO controlling /RESET, if any */
80         int ldoena;     /** GPIO controlling LODENA, if any */
81
82         /** Regulator configuration for MICVDD */
83         struct arizona_micsupp_pdata micvdd;
84
85         /** Regulator configuration for LDO1 */
86         struct regulator_init_data *ldo1;
87
88         /** If a direct 32kHz clock is provided on an MCLK specify it here */
89         int clk32k_src;
90
91         /** Mode for primary IRQ (defaults to active low) */
92         unsigned int irq_flags;
93
94         /* Base GPIO */
95         int gpio_base;
96
97         /** Pin state for GPIO pins */
98         unsigned int gpio_defaults[ARIZONA_MAX_GPIO];
99
100         /**
101          * Maximum number of channels clocks will be generated for,
102          * useful for systems where and I2S bus with multiple data
103          * lines is mastered.
104          */
105         unsigned int max_channels_clocked[ARIZONA_MAX_AIF];
106
107         /** GPIO5 is used for jack detection */
108         bool jd_gpio5;
109
110         /** Internal pull on GPIO5 is disabled when used for jack detection */
111         bool jd_gpio5_nopull;
112
113         /** set to true if jackdet contact opens on insert */
114         bool jd_invert;
115
116         /** Use the headphone detect circuit to identify the accessory */
117         bool hpdet_acc_id;
118
119         /** Check for line output with HPDET method */
120         bool hpdet_acc_id_line;
121
122         /** GPIO used for mic isolation with HPDET */
123         int hpdet_id_gpio;
124
125         /** Channel to use for headphone detection */
126         unsigned int hpdet_channel;
127
128         /** Use software comparison to determine mic presence */
129         bool micd_software_compare;
130
131         /** Extra debounce timeout used during initial mic detection (ms) */
132         unsigned int micd_detect_debounce;
133
134         /** GPIO for mic detection polarity */
135         int micd_pol_gpio;
136
137         /** Mic detect ramp rate */
138         unsigned int micd_bias_start_time;
139
140         /** Mic detect sample rate */
141         unsigned int micd_rate;
142
143         /** Mic detect debounce level */
144         unsigned int micd_dbtime;
145
146         /** Mic detect timeout (ms) */
147         unsigned int micd_timeout;
148
149         /** Force MICBIAS on for mic detect */
150         bool micd_force_micbias;
151
152         /** Mic detect level parameters */
153         const struct arizona_micd_range *micd_ranges;
154         int num_micd_ranges;
155
156         /** Headset polarity configurations */
157         struct arizona_micd_config *micd_configs;
158         int num_micd_configs;
159
160         /** Reference voltage for DMIC inputs */
161         int dmic_ref[ARIZONA_MAX_INPUT];
162
163         /** MICBIAS configurations */
164         struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS];
165
166         /**
167          * Mode of input structures
168          * One of the ARIZONA_INMODE_xxx values
169          * wm5102/wm5110/wm8280/wm8997: [0]=IN1 [1]=IN2 [2]=IN3 [3]=IN4
170          * wm8998: [0]=IN1A [1]=IN2A [2]=IN1B [3]=IN2B
171          */
172         int inmode[ARIZONA_MAX_INPUT];
173
174         /** Mode for outputs */
175         int out_mono[ARIZONA_MAX_OUTPUT];
176
177         /** PDM speaker mute setting */
178         unsigned int spk_mute[ARIZONA_MAX_PDM_SPK];
179
180         /** PDM speaker format */
181         unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK];
182
183         /** Haptic actuator type */
184         unsigned int hap_act;
185
186         /** GPIO for primary IRQ (used for edge triggered emulation) */
187         int irq_gpio;
188
189         /** General purpose switch control */
190         unsigned int gpsw;
191 };
192
193 #endif