diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2014-01-03 08:27:48 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-01-08 06:37:52 -0500 |
commit | 9146070089cca0fa5c396f1a4d0b96d675004c04 (patch) | |
tree | 4068a178d54b787a594de18181468dc7b5e571aa /drivers/mfd | |
parent | 3def927ea8c0a1983aa9f1499645efc53e005bb6 (diff) |
mfd: twl-core: Enable regcache for audio registers
Enable regmap's regcache for the audio registers:
i2c address 0x49, register range 0x01 - 0x49
Mark all other registers as volatile to avoid any side effect for the non
audio functions behind 0x49 i2c address.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/twl-core.c | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index f0abca79ff34..6ef7685a4cf8 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
@@ -47,6 +47,9 @@ | |||
47 | #include <linux/i2c.h> | 47 | #include <linux/i2c.h> |
48 | #include <linux/i2c/twl.h> | 48 | #include <linux/i2c/twl.h> |
49 | 49 | ||
50 | /* Register descriptions for audio */ | ||
51 | #include <linux/mfd/twl4030-audio.h> | ||
52 | |||
50 | #include "twl-core.h" | 53 | #include "twl-core.h" |
51 | 54 | ||
52 | /* | 55 | /* |
@@ -200,6 +203,105 @@ static struct twl_mapping twl4030_map[] = { | |||
200 | { 2, TWL5031_BASEADD_INTERRUPTS }, | 203 | { 2, TWL5031_BASEADD_INTERRUPTS }, |
201 | }; | 204 | }; |
202 | 205 | ||
206 | static struct reg_default twl4030_49_defaults[] = { | ||
207 | /* Audio Registers */ | ||
208 | { 0x01, 0x00}, /* CODEC_MODE */ | ||
209 | { 0x02, 0x00}, /* OPTION */ | ||
210 | /* 0x03 Unused */ | ||
211 | { 0x04, 0x00}, /* MICBIAS_CTL */ | ||
212 | { 0x05, 0x00}, /* ANAMICL */ | ||
213 | { 0x06, 0x00}, /* ANAMICR */ | ||
214 | { 0x07, 0x00}, /* AVADC_CTL */ | ||
215 | { 0x08, 0x00}, /* ADCMICSEL */ | ||
216 | { 0x09, 0x00}, /* DIGMIXING */ | ||
217 | { 0x0a, 0x0f}, /* ATXL1PGA */ | ||
218 | { 0x0b, 0x0f}, /* ATXR1PGA */ | ||
219 | { 0x0c, 0x0f}, /* AVTXL2PGA */ | ||
220 | { 0x0d, 0x0f}, /* AVTXR2PGA */ | ||
221 | { 0x0e, 0x00}, /* AUDIO_IF */ | ||
222 | { 0x0f, 0x00}, /* VOICE_IF */ | ||
223 | { 0x10, 0x3f}, /* ARXR1PGA */ | ||
224 | { 0x11, 0x3f}, /* ARXL1PGA */ | ||
225 | { 0x12, 0x3f}, /* ARXR2PGA */ | ||
226 | { 0x13, 0x3f}, /* ARXL2PGA */ | ||
227 | { 0x14, 0x25}, /* VRXPGA */ | ||
228 | { 0x15, 0x00}, /* VSTPGA */ | ||
229 | { 0x16, 0x00}, /* VRX2ARXPGA */ | ||
230 | { 0x17, 0x00}, /* AVDAC_CTL */ | ||
231 | { 0x18, 0x00}, /* ARX2VTXPGA */ | ||
232 | { 0x19, 0x32}, /* ARXL1_APGA_CTL*/ | ||
233 | { 0x1a, 0x32}, /* ARXR1_APGA_CTL*/ | ||
234 | { 0x1b, 0x32}, /* ARXL2_APGA_CTL*/ | ||
235 | { 0x1c, 0x32}, /* ARXR2_APGA_CTL*/ | ||
236 | { 0x1d, 0x00}, /* ATX2ARXPGA */ | ||
237 | { 0x1e, 0x00}, /* BT_IF */ | ||
238 | { 0x1f, 0x55}, /* BTPGA */ | ||
239 | { 0x20, 0x00}, /* BTSTPGA */ | ||
240 | { 0x21, 0x00}, /* EAR_CTL */ | ||
241 | { 0x22, 0x00}, /* HS_SEL */ | ||
242 | { 0x23, 0x00}, /* HS_GAIN_SET */ | ||
243 | { 0x24, 0x00}, /* HS_POPN_SET */ | ||
244 | { 0x25, 0x00}, /* PREDL_CTL */ | ||
245 | { 0x26, 0x00}, /* PREDR_CTL */ | ||
246 | { 0x27, 0x00}, /* PRECKL_CTL */ | ||
247 | { 0x28, 0x00}, /* PRECKR_CTL */ | ||
248 | { 0x29, 0x00}, /* HFL_CTL */ | ||
249 | { 0x2a, 0x00}, /* HFR_CTL */ | ||
250 | { 0x2b, 0x05}, /* ALC_CTL */ | ||
251 | { 0x2c, 0x00}, /* ALC_SET1 */ | ||
252 | { 0x2d, 0x00}, /* ALC_SET2 */ | ||
253 | { 0x2e, 0x00}, /* BOOST_CTL */ | ||
254 | { 0x2f, 0x00}, /* SOFTVOL_CTL */ | ||
255 | { 0x30, 0x13}, /* DTMF_FREQSEL */ | ||
256 | { 0x31, 0x00}, /* DTMF_TONEXT1H */ | ||
257 | { 0x32, 0x00}, /* DTMF_TONEXT1L */ | ||
258 | { 0x33, 0x00}, /* DTMF_TONEXT2H */ | ||
259 | { 0x34, 0x00}, /* DTMF_TONEXT2L */ | ||
260 | { 0x35, 0x79}, /* DTMF_TONOFF */ | ||
261 | { 0x36, 0x11}, /* DTMF_WANONOFF */ | ||
262 | { 0x37, 0x00}, /* I2S_RX_SCRAMBLE_H */ | ||
263 | { 0x38, 0x00}, /* I2S_RX_SCRAMBLE_M */ | ||
264 | { 0x39, 0x00}, /* I2S_RX_SCRAMBLE_L */ | ||
265 | { 0x3a, 0x06}, /* APLL_CTL */ | ||
266 | { 0x3b, 0x00}, /* DTMF_CTL */ | ||
267 | { 0x3c, 0x44}, /* DTMF_PGA_CTL2 (0x3C) */ | ||
268 | { 0x3d, 0x69}, /* DTMF_PGA_CTL1 (0x3D) */ | ||
269 | { 0x3e, 0x00}, /* MISC_SET_1 */ | ||
270 | { 0x3f, 0x00}, /* PCMBTMUX */ | ||
271 | /* 0x40 - 0x42 Unused */ | ||
272 | { 0x43, 0x00}, /* RX_PATH_SEL */ | ||
273 | { 0x44, 0x32}, /* VDL_APGA_CTL */ | ||
274 | { 0x45, 0x00}, /* VIBRA_CTL */ | ||
275 | { 0x46, 0x00}, /* VIBRA_SET */ | ||
276 | { 0x47, 0x00}, /* VIBRA_PWM_SET */ | ||
277 | { 0x48, 0x00}, /* ANAMIC_GAIN */ | ||
278 | { 0x49, 0x00}, /* MISC_SET_2 */ | ||
279 | /* End of Audio Registers */ | ||
280 | }; | ||
281 | |||
282 | static bool twl4030_49_nop_reg(struct device *dev, unsigned int reg) | ||
283 | { | ||
284 | switch (reg) { | ||
285 | case 0: | ||
286 | case 3: | ||
287 | case 40: | ||
288 | case 41: | ||
289 | case 42: | ||
290 | return false; | ||
291 | default: | ||
292 | return true; | ||
293 | } | ||
294 | } | ||
295 | |||
296 | static const struct regmap_range twl4030_49_volatile_ranges[] = { | ||
297 | regmap_reg_range(TWL4030_BASEADD_TEST, 0xff), | ||
298 | }; | ||
299 | |||
300 | static const struct regmap_access_table twl4030_49_volatile_table = { | ||
301 | .yes_ranges = twl4030_49_volatile_ranges, | ||
302 | .n_yes_ranges = ARRAY_SIZE(twl4030_49_volatile_ranges), | ||
303 | }; | ||
304 | |||
203 | static struct regmap_config twl4030_regmap_config[4] = { | 305 | static struct regmap_config twl4030_regmap_config[4] = { |
204 | { | 306 | { |
205 | /* Address 0x48 */ | 307 | /* Address 0x48 */ |
@@ -212,6 +314,15 @@ static struct regmap_config twl4030_regmap_config[4] = { | |||
212 | .reg_bits = 8, | 314 | .reg_bits = 8, |
213 | .val_bits = 8, | 315 | .val_bits = 8, |
214 | .max_register = 0xff, | 316 | .max_register = 0xff, |
317 | |||
318 | .readable_reg = twl4030_49_nop_reg, | ||
319 | .writeable_reg = twl4030_49_nop_reg, | ||
320 | |||
321 | .volatile_table = &twl4030_49_volatile_table, | ||
322 | |||
323 | .reg_defaults = twl4030_49_defaults, | ||
324 | .num_reg_defaults = ARRAY_SIZE(twl4030_49_defaults), | ||
325 | .cache_type = REGCACHE_RBTREE, | ||
215 | }, | 326 | }, |
216 | { | 327 | { |
217 | /* Address 0x4a */ | 328 | /* Address 0x4a */ |