blob: 84fefede3a23dc896b50aeae4b0df872cc6c8988 [file] [log] [blame]
Mark Brown3cc72982012-06-19 16:31:53 +01001/*
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#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] */
45
46#define ARIZONA_MAX_GPIO 5
47
48#define ARIZONA_32KZ_MCLK1 1
49#define ARIZONA_32KZ_MCLK2 2
50#define ARIZONA_32KZ_NONE 3
51
Mark Browne102bef2012-07-10 12:37:58 +010052#define ARIZONA_MAX_INPUT 4
Mark Brown3cc72982012-06-19 16:31:53 +010053
54#define ARIZONA_DMIC_MICVDD 0
55#define ARIZONA_DMIC_MICBIAS1 1
56#define ARIZONA_DMIC_MICBIAS2 2
57#define ARIZONA_DMIC_MICBIAS3 3
58
Mark Brown3d91f822013-01-29 00:47:37 +080059#define ARIZONA_MAX_MICBIAS 3
60
Mark Brown3cc72982012-06-19 16:31:53 +010061#define ARIZONA_INMODE_DIFF 0
62#define ARIZONA_INMODE_SE 1
63#define ARIZONA_INMODE_DMIC 2
64
Mark Browne102bef2012-07-10 12:37:58 +010065#define ARIZONA_MAX_OUTPUT 6
Mark Brown3cc72982012-06-19 16:31:53 +010066
Mark Brownc94aa302013-01-17 16:35:14 +090067#define ARIZONA_MAX_AIF 3
68
Mark Brown9dd555e2012-11-26 21:17:21 +000069#define ARIZONA_HAP_ACT_ERM 0
70#define ARIZONA_HAP_ACT_LRA 2
71
Mark Brown2a51da02012-07-09 19:33:14 +010072#define ARIZONA_MAX_PDM_SPK 2
Mark Brown3cc72982012-06-19 16:31:53 +010073
74struct regulator_init_data;
75
Mark Brown3d91f822013-01-29 00:47:37 +080076struct 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 */
81};
82
Mark Brown3cc72982012-06-19 16:31:53 +010083struct arizona_micd_config {
84 unsigned int src;
85 unsigned int bias;
86 bool gpio;
87};
88
89struct arizona_pdata {
90 int reset; /** GPIO controlling /RESET, if any */
91 int ldoena; /** GPIO controlling LODENA, if any */
92
93 /** Regulator configuration for MICVDD */
94 struct regulator_init_data *micvdd;
95
96 /** Regulator configuration for LDO1 */
97 struct regulator_init_data *ldo1;
98
99 /** If a direct 32kHz clock is provided on an MCLK specify it here */
100 int clk32k_src;
101
Mark Brownf8a09412013-03-22 12:59:33 +0100102 /** Mode for primary IRQ (defaults to active low) */
103 unsigned int irq_flags;
Mark Brown3cc72982012-06-19 16:31:53 +0100104
105 /* Base GPIO */
106 int gpio_base;
107
108 /** Pin state for GPIO pins */
109 int gpio_defaults[ARIZONA_MAX_GPIO];
110
Mark Brownc94aa302013-01-17 16:35:14 +0900111 /**
112 * Maximum number of channels clocks will be generated for,
113 * useful for systems where and I2S bus with multiple data
114 * lines is mastered.
115 */
116 int max_channels_clocked[ARIZONA_MAX_AIF];
117
Mark Brown92a49872013-01-11 08:55:39 +0900118 /** GPIO5 is used for jack detection */
119 bool jd_gpio5;
120
Mark Browndd235ee2013-01-11 08:55:51 +0900121 /** Use the headphone detect circuit to identify the accessory */
122 bool hpdet_acc_id;
123
Mark Brown1eda6aa2013-01-11 08:55:54 +0900124 /** GPIO used for mic isolation with HPDET */
125 int hpdet_id_gpio;
126
Mark Brown3cc72982012-06-19 16:31:53 +0100127 /** GPIO for mic detection polarity */
128 int micd_pol_gpio;
129
Mark Brownb17e5462013-01-11 08:55:24 +0900130 /** Mic detect ramp rate */
131 int micd_bias_start_time;
132
Mark Brown2e033db2013-01-21 17:36:33 +0900133 /** Mic detect sample rate */
134 int micd_rate;
135
136 /** Mic detect debounce level */
137 int micd_dbtime;
138
Mark Brownbbbd46e2013-01-10 19:38:43 +0000139 /** Force MICBIAS on for mic detect */
140 bool micd_force_micbias;
141
Mark Brown3cc72982012-06-19 16:31:53 +0100142 /** Headset polarity configurations */
143 struct arizona_micd_config *micd_configs;
144 int num_micd_configs;
145
146 /** Reference voltage for DMIC inputs */
147 int dmic_ref[ARIZONA_MAX_INPUT];
148
Mark Brown3d91f822013-01-29 00:47:37 +0800149 /** MICBIAS configurations */
150 struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS];
151
Mark Brown3cc72982012-06-19 16:31:53 +0100152 /** Mode of input structures */
153 int inmode[ARIZONA_MAX_INPUT];
154
155 /** Mode for outputs */
156 bool out_mono[ARIZONA_MAX_OUTPUT];
157
158 /** PDM speaker mute setting */
159 unsigned int spk_mute[ARIZONA_MAX_PDM_SPK];
160
161 /** PDM speaker format */
162 unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK];
Mark Brown9dd555e2012-11-26 21:17:21 +0000163
164 /** Haptic actuator type */
165 unsigned int hap_act;
Mark Brown3cc72982012-06-19 16:31:53 +0100166};
167
168#endif