Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170164
b: refs/heads/master
c: d2b247a
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Oct 6, 2009
1 parent 85dcb18 commit c1ed44a
Show file tree
Hide file tree
Showing 3 changed files with 59 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: 3a65577d2199a7b33c85fd32838020c39da200f3
refs/heads/master: d2b247a8be57647d1745535acd58169fbcbe431a
10 changes: 10 additions & 0 deletions trunk/include/sound/soc-dapm.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@
.get = snd_soc_dapm_get_enum_double, \
.put = snd_soc_dapm_put_enum_double, \
.private_value = (unsigned long)&xenum }
#define SOC_DAPM_ENUM_VIRT(xname, xenum) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
.info = snd_soc_info_enum_double, \
.get = snd_soc_dapm_get_enum_virt, \
.put = snd_soc_dapm_put_enum_virt, \
.private_value = (unsigned long)&xenum }
#define SOC_DAPM_VALUE_ENUM(xname, xenum) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
.info = snd_soc_info_enum_double, \
Expand Down Expand Up @@ -260,6 +266,10 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_dapm_get_enum_virt(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
Expand Down
48 changes: 48 additions & 0 deletions trunk/sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1807,6 +1807,54 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double);

/**
* snd_soc_dapm_get_enum_virt - Get virtual DAPM mux
* @kcontrol: mixer control
* @ucontrol: control element information
*
* Returns 0 for success.
*/
int snd_soc_dapm_get_enum_virt(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);

ucontrol->value.enumerated.item[0] = widget->value;

return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_virt);

/**
* snd_soc_dapm_put_enum_virt - Set virtual DAPM mux
* @kcontrol: mixer control
* @ucontrol: control element information
*
* Returns 0 for success.
*/
int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
struct soc_enum *e =
(struct soc_enum *)kcontrol->private_value;
int change;
int ret = 0;

if (ucontrol->value.enumerated.item[0] >= e->max)
return -EINVAL;

mutex_lock(&widget->codec->mutex);

change = widget->value != ucontrol->value.enumerated.item[0];
widget->value = ucontrol->value.enumerated.item[0];
dapm_mux_update_power(widget, kcontrol, change, widget->value, e);

mutex_unlock(&widget->codec->mutex);
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_virt);

/**
* snd_soc_dapm_get_value_enum_double - dapm semi enumerated double mixer get
* callback
Expand Down

0 comments on commit c1ed44a

Please sign in to comment.