Commit 052901f4 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown

ASoC: twl4030: Use virtual DAPM mixer controls

By using the new virtual DAPM mixer controls it is possible to remove the
twl4030 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 249ce138
...@@ -46,13 +46,7 @@ ...@@ -46,13 +46,7 @@
/* TWL4030 PMBR1 Register GPIO6 mux bits */ /* TWL4030 PMBR1 Register GPIO6 mux bits */
#define TWL4030_GPIO6_PWM0_MUTE(value) ((value & 0x03) << 2) #define TWL4030_GPIO6_PWM0_MUTE(value) ((value & 0x03) << 2)
/* Shadow register used by the audio driver */ #define TWL4030_CACHEREGNUM (TWL4030_REG_MISC_SET_2 + 1)
#define TWL4030_REG_SW_SHADOW 0x4A
#define TWL4030_CACHEREGNUM (TWL4030_REG_SW_SHADOW + 1)
/* TWL4030_REG_SW_SHADOW (0x4A) Fields */
#define TWL4030_HFL_EN 0x01
#define TWL4030_HFR_EN 0x02
/* /*
* twl4030 register cache & default register settings * twl4030 register cache & default register settings
...@@ -132,7 +126,6 @@ static const u8 twl4030_reg[TWL4030_CACHEREGNUM] = { ...@@ -132,7 +126,6 @@ static const u8 twl4030_reg[TWL4030_CACHEREGNUM] = {
0x00, /* REG_VIBRA_PWM_SET (0x47) */ 0x00, /* REG_VIBRA_PWM_SET (0x47) */
0x00, /* REG_ANAMIC_GAIN (0x48) */ 0x00, /* REG_ANAMIC_GAIN (0x48) */
0x00, /* REG_MISC_SET_2 (0x49) */ 0x00, /* REG_MISC_SET_2 (0x49) */
0x00, /* REG_SW_SHADOW (0x4A) - Shadow, non HW register */
}; };
/* codec private data */ /* codec private data */
...@@ -198,7 +191,6 @@ static int twl4030_write(struct snd_soc_codec *codec, ...@@ -198,7 +191,6 @@ static int twl4030_write(struct snd_soc_codec *codec,
int write_to_reg = 0; int write_to_reg = 0;
twl4030_write_reg_cache(codec, reg, value); twl4030_write_reg_cache(codec, reg, value);
if (likely(reg < TWL4030_REG_SW_SHADOW)) {
/* Decide if the given register can be written */ /* Decide if the given register can be written */
switch (reg) { switch (reg) {
case TWL4030_REG_EAR_CTL: case TWL4030_REG_EAR_CTL:
...@@ -233,7 +225,7 @@ static int twl4030_write(struct snd_soc_codec *codec, ...@@ -233,7 +225,7 @@ static int twl4030_write(struct snd_soc_codec *codec,
if (write_to_reg) if (write_to_reg)
return twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, return twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
value, reg); value, reg);
}
return 0; return 0;
} }
...@@ -532,7 +524,7 @@ SOC_DAPM_ENUM("Route", twl4030_handsfreel_enum); ...@@ -532,7 +524,7 @@ SOC_DAPM_ENUM("Route", twl4030_handsfreel_enum);
/* Handsfree Left virtual mute */ /* Handsfree Left virtual mute */
static const struct snd_kcontrol_new twl4030_dapm_handsfreelmute_control = static const struct snd_kcontrol_new twl4030_dapm_handsfreelmute_control =
SOC_DAPM_SINGLE("Switch", TWL4030_REG_SW_SHADOW, 0, 1, 0); SOC_DAPM_SINGLE_VIRT("Switch", 1);
/* Handsfree Right */ /* Handsfree Right */
static const char *twl4030_handsfreer_texts[] = static const char *twl4030_handsfreer_texts[] =
...@@ -548,7 +540,7 @@ SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); ...@@ -548,7 +540,7 @@ SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum);
/* Handsfree Right virtual mute */ /* Handsfree Right virtual mute */
static const struct snd_kcontrol_new twl4030_dapm_handsfreermute_control = static const struct snd_kcontrol_new twl4030_dapm_handsfreermute_control =
SOC_DAPM_SINGLE("Switch", TWL4030_REG_SW_SHADOW, 1, 1, 0); SOC_DAPM_SINGLE_VIRT("Switch", 1);
/* Vibra */ /* Vibra */
/* Vibra audio path selection */ /* Vibra audio path selection */
......
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