Skip to content

Commit

Permalink
ASoC: Let snd_soc_limit_volume() take a snd_soc_card
Browse files Browse the repository at this point in the history
snd_soc_limit_volume() operates on a card and the CODEC that is passed in
is only used to look up the card. Let it directly take the card instead.
This makes it possible to use it when no snd_soc_codec is available.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Tested-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Oct 22, 2015
1 parent 6ff33f3 commit 26d9ca3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_limit_volume(struct snd_soc_codec *codec,
int snd_soc_limit_volume(struct snd_soc_card *card,
const char *name, int max);
int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo);
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/omap/rx51.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
dev_err(card->dev, "Failed to add TPA6130A2 controls\n");
return err;
}
snd_soc_limit_volume(codec, "TPA6130A2 Headphone Playback Volume", 42);
snd_soc_limit_volume(card, "TPA6130A2 Headphone Playback Volume", 42);

err = omap_mcbsp_st_add_controls(rtd, 2);
if (err < 0) {
Expand Down
8 changes: 4 additions & 4 deletions sound/soc/soc-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,16 +560,16 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range);
/**
* snd_soc_limit_volume - Set new limit to an existing volume control.
*
* @codec: where to look for the control
* @card: 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,
int snd_soc_limit_volume(struct snd_soc_card *card,
const char *name, int max)
{
struct snd_card *card = codec->component.card->snd_card;
struct snd_card *snd_card = card->snd_card;
struct snd_kcontrol *kctl;
struct soc_mixer_control *mc;
int found = 0;
Expand All @@ -579,7 +579,7 @@ int snd_soc_limit_volume(struct snd_soc_codec *codec,
if (unlikely(!name || max <= 0))
return -EINVAL;

list_for_each_entry(kctl, &card->controls, list) {
list_for_each_entry(kctl, &snd_card->controls, list) {
if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name))) {
found = 1;
break;
Expand Down

0 comments on commit 26d9ca3

Please sign in to comment.