aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorAdam Thomson <Adam.Thomson@diasemi.com>2012-05-31 10:18:01 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-03 08:06:41 -0400
commit6c9d8cf6372ed2995a3d982f5c1f966e842101cc (patch)
tree1a71ce7d37e0183e7e01968e64774711d444d10e /include/sound
parentbc92657a11c0982783979bbb84ceaf58ba222124 (diff)
ASoC: core: Add single controls with specified range of values
Control type added for cases where a specific range of values within a register are required for control. Added convenience macros: SOC_SINGLE_RANGE SOC_SINGLE_RANGE_TLV Added accessor implementations: snd_soc_info_volsw_range snd_soc_put_volsw_range snd_soc_get_volsw_range Signed-off-by: Michal Hajduk <Michal.Hajduk@diasemi.com> Signed-off-by: Adam Thomson <Adam.Thomson@diasemi.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 23c4efbe13a6..e4348d25fca3 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -47,6 +47,13 @@
47 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 47 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
48 .put = snd_soc_put_volsw, \ 48 .put = snd_soc_put_volsw, \
49 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 49 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
50#define SOC_SINGLE_RANGE(xname, xreg, xshift, xmin, xmax, xinvert) \
51{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
52 .info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \
53 .put = snd_soc_put_volsw_range, \
54 .private_value = (unsigned long)&(struct soc_mixer_control) \
55 {.reg = xreg, .shift = xshift, .min = xmin,\
56 .max = xmax, .platform_max = xmax, .invert = xinvert} }
50#define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ 57#define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
51{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 58{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
52 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 59 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -67,6 +74,16 @@
67 {.reg = xreg, .rreg = xreg, \ 74 {.reg = xreg, .rreg = xreg, \
68 .shift = xshift, .rshift = xshift, \ 75 .shift = xshift, .rshift = xshift, \
69 .max = xmax, .min = xmin} } 76 .max = xmax, .min = xmin} }
77#define SOC_SINGLE_RANGE_TLV(xname, xreg, xshift, xmin, xmax, xinvert, tlv_array) \
78{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
79 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
80 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
81 .tlv.p = (tlv_array), \
82 .info = snd_soc_info_volsw_range, \
83 .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
84 .private_value = (unsigned long)&(struct soc_mixer_control) \
85 {.reg = xreg, .shift = xshift, .min = xmin,\
86 .max = xmax, .platform_max = xmax, .invert = xinvert} }
70#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ 87#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
71{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 88{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
72 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 89 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
@@ -460,6 +477,12 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
460 struct snd_ctl_elem_value *ucontrol); 477 struct snd_ctl_elem_value *ucontrol);
461int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, 478int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
462 struct snd_ctl_elem_value *ucontrol); 479 struct snd_ctl_elem_value *ucontrol);
480int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
481 struct snd_ctl_elem_info *uinfo);
482int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
483 struct snd_ctl_elem_value *ucontrol);
484int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
485 struct snd_ctl_elem_value *ucontrol);
463int snd_soc_limit_volume(struct snd_soc_codec *codec, 486int snd_soc_limit_volume(struct snd_soc_codec *codec,
464 const char *name, int max); 487 const char *name, int max);
465int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, 488int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,