aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/soc-ops.c')
-rw-r--r--sound/soc/soc-ops.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 100d92b5b77e..ecd38e52285a 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -207,6 +207,34 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
207EXPORT_SYMBOL_GPL(snd_soc_info_volsw); 207EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
208 208
209/** 209/**
210 * snd_soc_info_volsw_sx - Mixer info callback for SX TLV controls
211 * @kcontrol: mixer control
212 * @uinfo: control element information
213 *
214 * Callback to provide information about a single mixer control, or a double
215 * mixer control that spans 2 registers of the SX TLV type. SX TLV controls
216 * have a range that represents both positive and negative values either side
217 * of zero but without a sign bit.
218 *
219 * Returns 0 for success.
220 */
221int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
222 struct snd_ctl_elem_info *uinfo)
223{
224 struct soc_mixer_control *mc =
225 (struct soc_mixer_control *)kcontrol->private_value;
226
227 snd_soc_info_volsw(kcontrol, uinfo);
228 /* Max represents the number of levels in an SX control not the
229 * maximum value, so add the minimum value back on
230 */
231 uinfo->value.integer.max += mc->min;
232
233 return 0;
234}
235EXPORT_SYMBOL_GPL(snd_soc_info_volsw_sx);
236
237/**
210 * snd_soc_get_volsw - single mixer get callback 238 * snd_soc_get_volsw - single mixer get callback
211 * @kcontrol: mixer control 239 * @kcontrol: mixer control
212 * @ucontrol: control element information 240 * @ucontrol: control element information
@@ -560,16 +588,16 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range);
560/** 588/**
561 * snd_soc_limit_volume - Set new limit to an existing volume control. 589 * snd_soc_limit_volume - Set new limit to an existing volume control.
562 * 590 *
563 * @codec: where to look for the control 591 * @card: where to look for the control
564 * @name: Name of the control 592 * @name: Name of the control
565 * @max: new maximum limit 593 * @max: new maximum limit
566 * 594 *
567 * Return 0 for success, else error. 595 * Return 0 for success, else error.
568 */ 596 */
569int snd_soc_limit_volume(struct snd_soc_codec *codec, 597int snd_soc_limit_volume(struct snd_soc_card *card,
570 const char *name, int max) 598 const char *name, int max)
571{ 599{
572 struct snd_card *card = codec->component.card->snd_card; 600 struct snd_card *snd_card = card->snd_card;
573 struct snd_kcontrol *kctl; 601 struct snd_kcontrol *kctl;
574 struct soc_mixer_control *mc; 602 struct soc_mixer_control *mc;
575 int found = 0; 603 int found = 0;
@@ -579,7 +607,7 @@ int snd_soc_limit_volume(struct snd_soc_codec *codec,
579 if (unlikely(!name || max <= 0)) 607 if (unlikely(!name || max <= 0))
580 return -EINVAL; 608 return -EINVAL;
581 609
582 list_for_each_entry(kctl, &card->controls, list) { 610 list_for_each_entry(kctl, &snd_card->controls, list) {
583 if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name))) { 611 if (!strncmp(kctl->id.name, name, sizeof(kctl->id.name))) {
584 found = 1; 612 found = 1;
585 break; 613 break;