Commit 290c348e authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown

ASoC: twl6040: Use virtual DAPM mixer controls

By using the new virtual DAPM mixer controls it is possible to remove the
twl6040 specific implementation of virtual controls.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Acked-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 9f9e4266
...@@ -54,12 +54,7 @@ enum twl6040_dai_id { ...@@ -54,12 +54,7 @@ enum twl6040_dai_id {
#define TWL6040_OUTHF_0dB 0x03 #define TWL6040_OUTHF_0dB 0x03
#define TWL6040_OUTHF_M52dB 0x1D #define TWL6040_OUTHF_M52dB 0x1D
/* Shadow register used by the driver */ #define TWL6040_CACHEREGNUM (TWL6040_REG_STATUS + 1)
#define TWL6040_REG_SW_SHADOW 0x2F
#define TWL6040_CACHEREGNUM (TWL6040_REG_SW_SHADOW + 1)
/* TWL6040_REG_SW_SHADOW (0x2F) fields */
#define TWL6040_EAR_PATH_ENABLE 0x01
struct twl6040_jack_data { struct twl6040_jack_data {
struct snd_soc_jack *jack; struct snd_soc_jack *jack;
...@@ -135,8 +130,6 @@ static const u8 twl6040_reg[TWL6040_CACHEREGNUM] = { ...@@ -135,8 +130,6 @@ static const u8 twl6040_reg[TWL6040_CACHEREGNUM] = {
0x00, /* REG_HFOTRIM 0x2C */ 0x00, /* REG_HFOTRIM 0x2C */
0x09, /* REG_ACCCTL 0x2D */ 0x09, /* REG_ACCCTL 0x2D */
0x00, /* REG_STATUS 0x2E (ro) */ 0x00, /* REG_STATUS 0x2E (ro) */
0x00, /* REG_SW_SHADOW 0x2F - Shadow, non HW register */
}; };
/* List of registers to be restored after power up */ /* 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,12 +213,8 @@ static int twl6040_read_reg_volatile(struct snd_soc_codec *codec,
if (reg >= TWL6040_CACHEREGNUM) if (reg >= TWL6040_CACHEREGNUM)
return -EIO; return -EIO;
if (likely(reg < TWL6040_REG_SW_SHADOW)) { value = twl6040_reg_read(twl6040, reg);
value = twl6040_reg_read(twl6040, reg); twl6040_write_reg_cache(codec, reg, value);
twl6040_write_reg_cache(codec, reg, value);
} else {
value = twl6040_read_reg_cache(codec, reg);
}
return value; return value;
} }
...@@ -261,8 +250,7 @@ static int twl6040_write(struct snd_soc_codec *codec, ...@@ -261,8 +250,7 @@ static int twl6040_write(struct snd_soc_codec *codec,
return -EIO; return -EIO;
twl6040_write_reg_cache(codec, reg, value); twl6040_write_reg_cache(codec, reg, value);
if (likely(reg < TWL6040_REG_SW_SHADOW) && if (twl6040_is_path_unmuted(codec, reg))
twl6040_is_path_unmuted(codec, reg))
return twl6040_reg_write(twl6040, reg, value); return twl6040_reg_write(twl6040, reg, value);
else else
return 0; return 0;
...@@ -555,7 +543,7 @@ static const struct snd_kcontrol_new hfr_mux_controls = ...@@ -555,7 +543,7 @@ static const struct snd_kcontrol_new hfr_mux_controls =
SOC_DAPM_ENUM("Route", twl6040_hf_enum[1]); SOC_DAPM_ENUM("Route", twl6040_hf_enum[1]);
static const struct snd_kcontrol_new ep_path_enable_control = static const struct snd_kcontrol_new ep_path_enable_control =
SOC_DAPM_SINGLE("Switch", TWL6040_REG_SW_SHADOW, 0, 1, 0); SOC_DAPM_SINGLE_VIRT("Switch", 1);
static const struct snd_kcontrol_new auxl_switch_control = static const struct snd_kcontrol_new auxl_switch_control =
SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFLCTL, 6, 1, 0); SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFLCTL, 6, 1, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment