2 * Platform data for Arizona devices
4 * Copyright 2012 Wolfson Microelectronics. PLC.
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.
11 #ifndef _ARIZONA_PDATA_H
12 #define _ARIZONA_PDATA_H
14 #define ARIZONA_GPN_DIR 0x8000 /* GPN_DIR */
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 */
18 #define ARIZONA_GPN_PU 0x4000 /* GPN_PU */
19 #define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */
20 #define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */
21 #define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */
22 #define ARIZONA_GPN_PD 0x2000 /* GPN_PD */
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 0x0800 /* GPN_LVL */
27 #define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */
28 #define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */
29 #define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */
30 #define ARIZONA_GPN_POL 0x0400 /* GPN_POL */
31 #define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */
32 #define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */
33 #define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */
34 #define ARIZONA_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */
35 #define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
36 #define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
37 #define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
38 #define ARIZONA_GPN_DB 0x0100 /* GPN_DB */
39 #define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */
40 #define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */
41 #define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */
42 #define ARIZONA_GPN_FN_MASK 0x007F /* GPN_FN - [6:0] */
43 #define ARIZONA_GPN_FN_SHIFT 0 /* GPN_FN - [6:0] */
44 #define ARIZONA_GPN_FN_WIDTH 7 /* GPN_FN - [6:0] */
46 #define ARIZONA_MAX_GPIO 5
48 #define ARIZONA_32KZ_MCLK1 1
49 #define ARIZONA_32KZ_MCLK2 2
50 #define ARIZONA_32KZ_NONE 3
52 #define ARIZONA_MAX_INPUT 4
54 #define ARIZONA_DMIC_MICVDD 0
55 #define ARIZONA_DMIC_MICBIAS1 1
56 #define ARIZONA_DMIC_MICBIAS2 2
57 #define ARIZONA_DMIC_MICBIAS3 3
59 #define ARIZONA_MAX_MICBIAS 3
61 #define ARIZONA_INMODE_DIFF 0
62 #define ARIZONA_INMODE_SE 1
63 #define ARIZONA_INMODE_DMIC 2
65 #define ARIZONA_MAX_OUTPUT 6
67 #define ARIZONA_MAX_AIF 3
69 #define ARIZONA_HAP_ACT_ERM 0
70 #define ARIZONA_HAP_ACT_LRA 2
72 #define ARIZONA_MAX_PDM_SPK 2
74 struct regulator_init_data;
76 struct arizona_micbias {
77 int mV; /** Regulated voltage */
78 unsigned int ext_cap:1; /** External capacitor fitted */
79 unsigned int discharge:1; /** Actively discharge */
80 unsigned int fast_start:1; /** Enable aggressive startup ramp rate */
83 struct arizona_micd_config {
89 struct arizona_micd_range {
91 int key; /** Key to report to input layer */
94 struct arizona_pdata {
95 int reset; /** GPIO controlling /RESET, if any */
96 int ldoena; /** GPIO controlling LODENA, if any */
98 /** Regulator configuration for MICVDD */
99 struct regulator_init_data *micvdd;
101 /** Regulator configuration for LDO1 */
102 struct regulator_init_data *ldo1;
104 /** If a direct 32kHz clock is provided on an MCLK specify it here */
107 bool irq_active_high; /** IRQ polarity */
112 /** Pin state for GPIO pins */
113 int gpio_defaults[ARIZONA_MAX_GPIO];
116 * Maximum number of channels clocks will be generated for,
117 * useful for systems where and I2S bus with multiple data
120 int max_channels_clocked[ARIZONA_MAX_AIF];
122 /** GPIO5 is used for jack detection */
125 /** Internal pull on GPIO5 is disabled when used for jack detection */
126 bool jd_gpio5_nopull;
128 /** Use the headphone detect circuit to identify the accessory */
131 /** Check for line output with HPDET method */
132 bool hpdet_acc_id_line;
134 /** GPIO used for mic isolation with HPDET */
137 /** Extra debounce timeout used during initial mic detection (ms) */
138 int micd_detect_debounce;
140 /** GPIO for mic detection polarity */
143 /** Mic detect ramp rate */
144 int micd_bias_start_time;
146 /** Mic detect sample rate */
149 /** Mic detect debounce level */
152 /** Mic detect timeout (ms) */
155 /** Force MICBIAS on for mic detect */
156 bool micd_force_micbias;
158 /** Mic detect level parameters */
159 const struct arizona_micd_range *micd_ranges;
162 /** Headset polarity configurations */
163 struct arizona_micd_config *micd_configs;
164 int num_micd_configs;
166 /** Reference voltage for DMIC inputs */
167 int dmic_ref[ARIZONA_MAX_INPUT];
169 /** MICBIAS configurations */
170 struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS];
172 /** Mode of input structures */
173 int inmode[ARIZONA_MAX_INPUT];
175 /** Mode for outputs */
176 bool out_mono[ARIZONA_MAX_OUTPUT];
178 /** PDM speaker mute setting */
179 unsigned int spk_mute[ARIZONA_MAX_PDM_SPK];
181 /** PDM speaker format */
182 unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK];
184 /** Haptic actuator type */
185 unsigned int hap_act;