1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * include/linux/mfd/wm8994/pdata.h -- Platform data for WM8994 4 * 5 * Copyright 2009 Wolfson Microelectronics PLC. 6 * 7 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 8 */ 9 10 #ifndef __MFD_WM8994_PDATA_H__ 11 #define __MFD_WM8994_PDATA_H__ 12 13 #define WM8994_NUM_LDO 2 14 #define WM8994_NUM_GPIO 11 15 #define WM8994_NUM_AIF 3 16 17 struct wm8994_ldo_pdata { 18 const struct regulator_init_data *init_data; 19 }; 20 21 #define WM8994_CONFIGURE_GPIO 0x10000 22 23 #define WM8994_DRC_REGS 5 24 #define WM8994_EQ_REGS 20 25 #define WM8958_MBC_CUTOFF_REGS 20 26 #define WM8958_MBC_COEFF_REGS 48 27 #define WM8958_MBC_COMBINED_REGS 56 28 #define WM8958_VSS_HPF_REGS 2 29 #define WM8958_VSS_REGS 148 30 #define WM8958_ENH_EQ_REGS 32 31 32 /** 33 * DRC configurations are specified with a label and a set of register 34 * values to write (the enable bits will be ignored). At runtime an 35 * enumerated control will be presented for each DRC block allowing 36 * the user to choose the configration to use. 37 * 38 * Configurations may be generated by hand or by using the DRC control 39 * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/ 40 * for details. 41 */ 42 struct wm8994_drc_cfg { 43 const char *name; 44 u16 regs[WM8994_DRC_REGS]; 45 }; 46 47 /** 48 * ReTune Mobile configurations are specified with a label, sample 49 * rate and set of values to write (the enable bits will be ignored). 50 * 51 * Configurations are expected to be generated using the ReTune Mobile 52 * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/ 53 */ 54 struct wm8994_retune_mobile_cfg { 55 const char *name; 56 unsigned int rate; 57 u16 regs[WM8994_EQ_REGS]; 58 }; 59 60 /** 61 * Multiband compressor configurations are specified with a label and 62 * two sets of values to write. Configurations are expected to be 63 * generated using the multiband compressor configuration panel in 64 * WISCE - see http://www.wolfsonmicro.com/wisce/ 65 */ 66 struct wm8958_mbc_cfg { 67 const char *name; 68 u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS]; 69 u16 coeff_regs[WM8958_MBC_COEFF_REGS]; 70 71 /* Coefficient layout when using MBC+VSS firmware */ 72 u16 combined_regs[WM8958_MBC_COMBINED_REGS]; 73 }; 74 75 /** 76 * VSS HPF configurations are specified with a label and two values to 77 * write. Configurations are expected to be generated using the 78 * multiband compressor configuration panel in WISCE - see 79 * http://www.wolfsonmicro.com/wisce/ 80 */ 81 struct wm8958_vss_hpf_cfg { 82 const char *name; 83 u16 regs[WM8958_VSS_HPF_REGS]; 84 }; 85 86 /** 87 * VSS configurations are specified with a label and array of values 88 * to write. Configurations are expected to be generated using the 89 * multiband compressor configuration panel in WISCE - see 90 * http://www.wolfsonmicro.com/wisce/ 91 */ 92 struct wm8958_vss_cfg { 93 const char *name; 94 u16 regs[WM8958_VSS_REGS]; 95 }; 96 97 /** 98 * Enhanced EQ configurations are specified with a label and array of 99 * values to write. Configurations are expected to be generated using 100 * the multiband compressor configuration panel in WISCE - see 101 * http://www.wolfsonmicro.com/wisce/ 102 */ 103 struct wm8958_enh_eq_cfg { 104 const char *name; 105 u16 regs[WM8958_ENH_EQ_REGS]; 106 }; 107 108 /** 109 * Microphone detection rates, used to tune response rates and power 110 * consumption for WM8958/WM1811 microphone detection. 111 * 112 * @sysclk: System clock rate to use this configuration for. 113 * @idle: True if this configuration should use when no accessory is detected, 114 * false otherwise. 115 * @start: Value for MICD_BIAS_START_TIME register field (not shifted). 116 * @rate: Value for MICD_RATE register field (not shifted). 117 */ 118 struct wm8958_micd_rate { 119 int sysclk; 120 bool idle; 121 int start; 122 int rate; 123 }; 124 125 struct wm8994_pdata { 126 int gpio_base; 127 128 /** 129 * Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO 130 * can be used for all zero values. 131 */ 132 int gpio_defaults[WM8994_NUM_GPIO]; 133 134 struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO]; 135 136 int irq_base; /** Base IRQ number for WM8994, required for IRQs */ 137 unsigned long irq_flags; /** user irq flags */ 138 139 int num_drc_cfgs; 140 struct wm8994_drc_cfg *drc_cfgs; 141 142 int num_retune_mobile_cfgs; 143 struct wm8994_retune_mobile_cfg *retune_mobile_cfgs; 144 145 int num_mbc_cfgs; 146 struct wm8958_mbc_cfg *mbc_cfgs; 147 148 int num_vss_cfgs; 149 struct wm8958_vss_cfg *vss_cfgs; 150 151 int num_vss_hpf_cfgs; 152 struct wm8958_vss_hpf_cfg *vss_hpf_cfgs; 153 154 int num_enh_eq_cfgs; 155 struct wm8958_enh_eq_cfg *enh_eq_cfgs; 156 157 int num_micd_rates; 158 struct wm8958_micd_rate *micd_rates; 159 160 /* Power up delays to add after microphone bias power up (ms) */ 161 int micb1_delay; 162 int micb2_delay; 163 164 /* LINEOUT can be differential or single ended */ 165 unsigned int lineout1_diff:1; 166 unsigned int lineout2_diff:1; 167 168 /* Common mode feedback */ 169 unsigned int lineout1fb:1; 170 unsigned int lineout2fb:1; 171 172 /* Delay between detecting a jack and starting microphone 173 * detect (specified in ms) 174 */ 175 int micdet_delay; 176 177 /* Delay between microphone detect completing and reporting on 178 * insert (specified in ms) 179 */ 180 int mic_id_delay; 181 182 /* IRQ for microphone detection if brought out directly as a 183 * signal. 184 */ 185 int micdet_irq; 186 187 /* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */ 188 unsigned int micbias1_lvl:1; 189 unsigned int micbias2_lvl:1; 190 191 /* WM8994 jack detect threashold levels, see datasheet for values */ 192 unsigned int jd_scthr:2; 193 unsigned int jd_thr:2; 194 195 /* Configure WM1811 jack detection for use with external capacitor */ 196 unsigned int jd_ext_cap:1; 197 198 /* WM8958 microphone bias configuration */ 199 int micbias[2]; 200 201 /* WM8958 microphone detection ranges */ 202 u16 micd_lvl_sel; 203 204 /* Disable the internal pull downs on the LDOs if they are 205 * always driven (eg, connected to an always on supply or 206 * GPIO that always drives an output. If they float power 207 * consumption will rise. 208 */ 209 bool ldo_ena_always_driven; 210 211 /* 212 * SPKMODE must be pulled internally by the device on this 213 * system. 214 */ 215 bool spkmode_pu; 216 217 /* 218 * CS/ADDR must be pulled internally by the device on this 219 * system. 220 */ 221 bool csnaddr_pd; 222 223 /** 224 * Maximum number of channels clocks will be generated for, 225 * useful for systems where and I2S bus with multiple data 226 * lines is mastered. 227 */ 228 int max_channels_clocked[WM8994_NUM_AIF]; 229 230 /** 231 * GPIO for the IRQ pin if host only supports edge triggering 232 */ 233 int irq_gpio; 234 }; 235 236 #endif 237