Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193451
b: refs/heads/master
c: bd843ed
h: refs/heads/master
i:
  193449: 8a62bc3
  193447: 95be0f4
v: v3
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed May 7, 2010
1 parent f34213c commit 141b791
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 826e962c4689172e25acde72eafebc063253b69d
refs/heads/master: bd843edf81dc1200f71b61d4804af0e2918e8ae3
18 changes: 10 additions & 8 deletions trunk/sound/soc/codecs/tpa6130a2.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,16 @@ static int tpa6130a2_power(int power)
return ret;
}

static int tpa6130a2_get_reg(struct snd_kcontrol *kcontrol,
static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
struct tpa6130a2_data *data;
unsigned int reg = mc->reg;
unsigned int shift = mc->shift;
unsigned int mask = mc->max;
int max = mc->max;
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert;

BUG_ON(tpa6130a2_client == NULL);
Expand All @@ -197,21 +198,22 @@ static int tpa6130a2_get_reg(struct snd_kcontrol *kcontrol,

if (invert)
ucontrol->value.integer.value[0] =
mask - ucontrol->value.integer.value[0];
max - ucontrol->value.integer.value[0];

mutex_unlock(&data->mutex);
return 0;
}

static int tpa6130a2_set_reg(struct snd_kcontrol *kcontrol,
static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
struct tpa6130a2_data *data;
unsigned int reg = mc->reg;
unsigned int shift = mc->shift;
unsigned int mask = mc->max;
int max = mc->max;
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert;
unsigned int val = (ucontrol->value.integer.value[0] & mask);
unsigned int val_reg;
Expand All @@ -220,7 +222,7 @@ static int tpa6130a2_set_reg(struct snd_kcontrol *kcontrol,
data = i2c_get_clientdata(tpa6130a2_client);

if (invert)
val = mask - val;
val = max - val;

mutex_lock(&data->mutex);

Expand Down Expand Up @@ -260,7 +262,7 @@ static const unsigned int tpa6130_tlv[] = {
static const struct snd_kcontrol_new tpa6130a2_controls[] = {
SOC_SINGLE_EXT_TLV("TPA6130A2 Headphone Playback Volume",
TPA6130A2_REG_VOL_MUTE, 0, 0x3f, 0,
tpa6130a2_get_reg, tpa6130a2_set_reg,
tpa6130a2_get_volsw, tpa6130a2_put_volsw,
tpa6130_tlv),
};

Expand All @@ -274,7 +276,7 @@ static const unsigned int tpa6140_tlv[] = {
static const struct snd_kcontrol_new tpa6140a2_controls[] = {
SOC_SINGLE_EXT_TLV("TPA6140A2 Headphone Playback Volume",
TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0,
tpa6130a2_get_reg, tpa6130a2_set_reg,
tpa6130a2_get_volsw, tpa6130a2_put_volsw,
tpa6140_tlv),
};

Expand Down

0 comments on commit 141b791

Please sign in to comment.