Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193449
b: refs/heads/master
c: 637d384
h: refs/heads/master
i:
  193447: 95be0f4
v: v3
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed May 7, 2010
1 parent e4dc0b0 commit 8a62bc3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 305787649826d6c84a6f9f71bc3318460610aba4
refs/heads/master: 637d3847ba0ca2c7780e6521cbe75568d19ff0db
2 changes: 2 additions & 0 deletions trunk/include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_limit_volume(struct snd_soc_codec *codec,
const char *name, int max);

/**
* struct snd_soc_jack_pin - Describes a pin to update based on jack detection
Expand Down
39 changes: 39 additions & 0 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,45 @@ int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
}
EXPORT_SYMBOL_GPL(snd_soc_put_volsw_s8);

/**
* snd_soc_limit_volume - Set new limit to an existing volume control.
*
* @codec: where to look for the control
* @name: Name of the control
* @max: new maximum limit
*
* Return 0 for success, else error.
*/
int snd_soc_limit_volume(struct snd_soc_codec *codec,
const char *name, int max)
{
struct snd_card *card = codec->card;
struct snd_kcontrol *kctl;
struct soc_mixer_control *mc;
int found = 0;
int ret = -EINVAL;

/* Sanity check for name and max */
if (unlikely(!name || max <= 0))
return -EINVAL;

list_for_each_entry(kctl, &card->controls, list) {
if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name))) {
found = 1;
break;
}
}
if (found) {
mc = (struct soc_mixer_control *)kctl->private_value;
if (max <= mc->max) {
mc->max = max;
ret = 0;
}
}
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_limit_volume);

/**
* snd_soc_dai_set_sysclk - configure DAI system or master clock.
* @dai: DAI
Expand Down

0 comments on commit 8a62bc3

Please sign in to comment.