aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-11-08 05:43:40 -0500
committerMark Brown <broonie@linaro.org>2013-11-08 05:43:40 -0500
commit022aa51e3fda0b3c6688defaa859961c11c36ec8 (patch)
tree07058652b94200da3e9fd4cfc147bf3e6ae670d0 /sound/soc
parent88cb5111e8d658abde760605e63db4ecd4f67d82 (diff)
parent290c348ee5522a5682c2011fa4d51f232404e8a4 (diff)
Merge remote-tracking branch 'asoc/topic/twl6040' into asoc-next
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/twl6040.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 3c79dbb6c323..f2f4bcb2ff71 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -54,12 +54,7 @@ enum twl6040_dai_id {
54#define TWL6040_OUTHF_0dB 0x03 54#define TWL6040_OUTHF_0dB 0x03
55#define TWL6040_OUTHF_M52dB 0x1D 55#define TWL6040_OUTHF_M52dB 0x1D
56 56
57/* Shadow register used by the driver */ 57#define TWL6040_CACHEREGNUM (TWL6040_REG_STATUS + 1)
58#define TWL6040_REG_SW_SHADOW 0x2F
59#define TWL6040_CACHEREGNUM (TWL6040_REG_SW_SHADOW + 1)
60
61/* TWL6040_REG_SW_SHADOW (0x2F) fields */
62#define TWL6040_EAR_PATH_ENABLE 0x01
63 58
64struct twl6040_jack_data { 59struct twl6040_jack_data {
65 struct snd_soc_jack *jack; 60 struct snd_soc_jack *jack;
@@ -135,8 +130,6 @@ static const u8 twl6040_reg[TWL6040_CACHEREGNUM] = {
135 0x00, /* REG_HFOTRIM 0x2C */ 130 0x00, /* REG_HFOTRIM 0x2C */
136 0x09, /* REG_ACCCTL 0x2D */ 131 0x09, /* REG_ACCCTL 0x2D */
137 0x00, /* REG_STATUS 0x2E (ro) */ 132 0x00, /* REG_STATUS 0x2E (ro) */
138
139 0x00, /* REG_SW_SHADOW 0x2F - Shadow, non HW register */
140}; 133};
141 134
142/* List of registers to be restored after power up */ 135/* List of registers to be restored after power up */
@@ -220,12 +213,8 @@ static int twl6040_read_reg_volatile(struct snd_soc_codec *codec,
220 if (reg >= TWL6040_CACHEREGNUM) 213 if (reg >= TWL6040_CACHEREGNUM)
221 return -EIO; 214 return -EIO;
222 215
223 if (likely(reg < TWL6040_REG_SW_SHADOW)) { 216 value = twl6040_reg_read(twl6040, reg);
224 value = twl6040_reg_read(twl6040, reg); 217 twl6040_write_reg_cache(codec, reg, value);
225 twl6040_write_reg_cache(codec, reg, value);
226 } else {
227 value = twl6040_read_reg_cache(codec, reg);
228 }
229 218
230 return value; 219 return value;
231} 220}
@@ -246,7 +235,7 @@ static bool twl6040_is_path_unmuted(struct snd_soc_codec *codec,
246 return priv->dl2_unmuted; 235 return priv->dl2_unmuted;
247 default: 236 default:
248 return 1; 237 return 1;
249 }; 238 }
250} 239}
251 240
252/* 241/*
@@ -261,8 +250,7 @@ static int twl6040_write(struct snd_soc_codec *codec,
261 return -EIO; 250 return -EIO;
262 251
263 twl6040_write_reg_cache(codec, reg, value); 252 twl6040_write_reg_cache(codec, reg, value);
264 if (likely(reg < TWL6040_REG_SW_SHADOW) && 253 if (twl6040_is_path_unmuted(codec, reg))
265 twl6040_is_path_unmuted(codec, reg))
266 return twl6040_reg_write(twl6040, reg, value); 254 return twl6040_reg_write(twl6040, reg, value);
267 else 255 else
268 return 0; 256 return 0;
@@ -555,7 +543,7 @@ static const struct snd_kcontrol_new hfr_mux_controls =
555 SOC_DAPM_ENUM("Route", twl6040_hf_enum[1]); 543 SOC_DAPM_ENUM("Route", twl6040_hf_enum[1]);
556 544
557static const struct snd_kcontrol_new ep_path_enable_control = 545static const struct snd_kcontrol_new ep_path_enable_control =
558 SOC_DAPM_SINGLE("Switch", TWL6040_REG_SW_SHADOW, 0, 1, 0); 546 SOC_DAPM_SINGLE_VIRT("Switch", 1);
559 547
560static const struct snd_kcontrol_new auxl_switch_control = 548static const struct snd_kcontrol_new auxl_switch_control =
561 SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFLCTL, 6, 1, 0); 549 SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFLCTL, 6, 1, 0);
@@ -1100,7 +1088,7 @@ static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id i
1100 break; 1088 break;
1101 default: 1089 default:
1102 break; 1090 break;
1103 }; 1091 }
1104} 1092}
1105 1093
1106static int twl6040_digital_mute(struct snd_soc_dai *dai, int mute) 1094static int twl6040_digital_mute(struct snd_soc_dai *dai, int mute)