Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193349
b: refs/heads/master
c: a6c6573
h: refs/heads/master
i:
  193347: f674303
v: v3
  • Loading branch information
Mark Brown committed Mar 17, 2010
1 parent fe590af commit bf1448d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 91 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: 2a0761a35b70f170a9c14ecbcb6a959fb6e7bdf3
refs/heads/master: a6c65736bc2e63392334bd800f1b2754ab55db1e
93 changes: 3 additions & 90 deletions trunk/sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,54 +321,6 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget)
return change;
}

/* ramps the volume up or down to minimise pops before or after a
* DAPM power event */
static int dapm_set_pga(struct snd_soc_dapm_widget *widget, int power)
{
const struct snd_kcontrol_new *k = widget->kcontrols;

if (widget->muted && !power)
return 0;
if (!widget->muted && power)
return 0;

if (widget->num_kcontrols && k) {
struct soc_mixer_control *mc =
(struct soc_mixer_control *)k->private_value;
unsigned int reg = mc->reg;
unsigned int shift = mc->shift;
int max = mc->max;
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert;

if (power) {
int i;
/* power up has happended, increase volume to last level */
if (invert) {
for (i = max; i > widget->saved_value; i--)
snd_soc_update_bits(widget->codec, reg, mask, i);
} else {
for (i = 0; i < widget->saved_value; i++)
snd_soc_update_bits(widget->codec, reg, mask, i);
}
widget->muted = 0;
} else {
/* power down is about to occur, decrease volume to mute */
int val = snd_soc_read(widget->codec, reg);
int i = widget->saved_value = (val >> shift) & mask;
if (invert) {
for (; i < mask; i++)
snd_soc_update_bits(widget->codec, reg, mask, i);
} else {
for (; i > 0; i--)
snd_soc_update_bits(widget->codec, reg, mask, i);
}
widget->muted = 1;
}
}
return 0;
}

/* create new dapm mixer control */
static int dapm_new_mixer(struct snd_soc_codec *codec,
struct snd_soc_dapm_widget *w)
Expand Down Expand Up @@ -463,20 +415,10 @@ static int dapm_new_mux(struct snd_soc_codec *codec,
static int dapm_new_pga(struct snd_soc_codec *codec,
struct snd_soc_dapm_widget *w)
{
struct snd_kcontrol *kcontrol;
int ret = 0;

if (!w->num_kcontrols)
return -EINVAL;
if (w->num_kcontrols)
pr_err("asoc: PGA controls not supported: '%s'\n", w->name);

kcontrol = snd_soc_cnew(&w->kcontrols[0], w, w->name);
ret = snd_ctl_add(codec->card, kcontrol);
if (ret < 0) {
printk(KERN_ERR "asoc: failed to add kcontrol %s\n", w->name);
return ret;
}

return ret;
return 0;
}

/* reset 'walked' bit for each dapm path */
Expand Down Expand Up @@ -632,16 +574,8 @@ static int dapm_generic_apply_power(struct snd_soc_dapm_widget *w)
return ret;
}

/* Lower PGA volume to reduce pops */
if (w->id == snd_soc_dapm_pga && !w->power)
dapm_set_pga(w, w->power);

dapm_update_bits(w);

/* Raise PGA volume to reduce pops */
if (w->id == snd_soc_dapm_pga && w->power)
dapm_set_pga(w, w->power);

/* power up post event */
if (w->power && w->event &&
(w->event_flags & SND_SOC_DAPM_POST_PMU)) {
Expand Down Expand Up @@ -808,10 +742,6 @@ static void dapm_seq_run_coalesced(struct snd_soc_codec *codec,
pr_err("%s: pre event failed: %d\n",
w->name, ret);
}

/* Lower PGA volume to reduce pops */
if (w->id == snd_soc_dapm_pga && !w->power)
dapm_set_pga(w, w->power);
}

if (reg >= 0) {
Expand All @@ -823,10 +753,6 @@ static void dapm_seq_run_coalesced(struct snd_soc_codec *codec,
}

list_for_each_entry(w, pending, power_list) {
/* Raise PGA volume to reduce pops */
if (w->id == snd_soc_dapm_pga && w->power)
dapm_set_pga(w, w->power);

/* power up post event */
if (w->power && w->event &&
(w->event_flags & SND_SOC_DAPM_POST_PMU)) {
Expand Down Expand Up @@ -1596,12 +1522,6 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
unsigned int invert = mc->invert;
unsigned int mask = (1 << fls(max)) - 1;

/* return the saved value if we are powered down */
if (widget->id == snd_soc_dapm_pga && !widget->power) {
ucontrol->value.integer.value[0] = widget->saved_value;
return 0;
}

ucontrol->value.integer.value[0] =
(snd_soc_read(widget->codec, reg) >> shift) & mask;
if (shift != rshift)
Expand Down Expand Up @@ -1661,13 +1581,6 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
mutex_lock(&widget->codec->mutex);
widget->value = val;

/* save volume value if the widget is powered down */
if (widget->id == snd_soc_dapm_pga && !widget->power) {
widget->saved_value = val;
mutex_unlock(&widget->codec->mutex);
return 1;
}

if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) {
if (val)
/* new connection */
Expand Down

0 comments on commit bf1448d

Please sign in to comment.