ASoC: Fix WM8580 volume update handling for large register changes

The driver is out of sync with the core functions it is using.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Mark Brown 2009-04-21 12:57:00 +01:00
parent ce88168f5b
commit ccb077fd46
1 changed files with 9 additions and 5 deletions

View File

@ -268,9 +268,11 @@ static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
static int wm8580_out_vu(struct snd_kcontrol *kcontrol, static int wm8580_out_vu(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
int reg = kcontrol->private_value & 0xff; unsigned int reg = mc->reg;
int reg2 = (kcontrol->private_value >> 24) & 0xff; unsigned int reg2 = mc->rreg;
int ret; int ret;
u16 val; u16 val;
@ -292,15 +294,17 @@ static int wm8580_out_vu(struct snd_kcontrol *kcontrol,
return 0; return 0;
} }
#define SOC_WM8580_OUT_DOUBLE_R_TLV(xname, reg_left, reg_right, shift, max, invert, tlv_array) \ #define SOC_WM8580_OUT_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, \
xinvert, tlv_array) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
SNDRV_CTL_ELEM_ACCESS_READWRITE, \ SNDRV_CTL_ELEM_ACCESS_READWRITE, \
.tlv.p = (tlv_array), \ .tlv.p = (tlv_array), \
.info = snd_soc_info_volsw_2r, \ .info = snd_soc_info_volsw_2r, \
.get = snd_soc_get_volsw_2r, .put = wm8580_out_vu, \ .get = snd_soc_get_volsw_2r, .put = wm8580_out_vu, \
.private_value = (reg_left) | ((shift) << 8) | \ .private_value = (unsigned long)&(struct soc_mixer_control) \
((max) << 12) | ((invert) << 20) | ((reg_right) << 24) } {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
.max = xmax, .invert = xinvert} }
static const struct snd_kcontrol_new wm8580_snd_controls[] = { static const struct snd_kcontrol_new wm8580_snd_controls[] = {
SOC_WM8580_OUT_DOUBLE_R_TLV("DAC1 Playback Volume", SOC_WM8580_OUT_DOUBLE_R_TLV("DAC1 Playback Volume",