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