diff options
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r-- | include/sound/soc.h | 77 |
1 files changed, 72 insertions, 5 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index c703871f5f65..e063380f63a2 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -42,11 +42,22 @@ | |||
42 | ((unsigned long)&(struct soc_mixer_control) \ | 42 | ((unsigned long)&(struct soc_mixer_control) \ |
43 | {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ | 43 | {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ |
44 | .max = xmax, .platform_max = xmax, .invert = xinvert}) | 44 | .max = xmax, .platform_max = xmax, .invert = xinvert}) |
45 | #define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \ | ||
46 | ((unsigned long)&(struct soc_mixer_control) \ | ||
47 | {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ | ||
48 | .min = xmin, .max = xmax, .platform_max = xmax, .invert = xinvert}) | ||
45 | #define SOC_SINGLE(xname, reg, shift, max, invert) \ | 49 | #define SOC_SINGLE(xname, reg, shift, max, invert) \ |
46 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 50 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
47 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ | 51 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ |
48 | .put = snd_soc_put_volsw, \ | 52 | .put = snd_soc_put_volsw, \ |
49 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | 53 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } |
54 | #define SOC_SINGLE_RANGE(xname, xreg, xshift, xmin, xmax, xinvert) \ | ||
55 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | ||
56 | .info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \ | ||
57 | .put = snd_soc_put_volsw_range, \ | ||
58 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
59 | {.reg = xreg, .shift = xshift, .min = xmin,\ | ||
60 | .max = xmax, .platform_max = xmax, .invert = xinvert} } | ||
50 | #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ | 61 | #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ |
51 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 62 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
52 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | 63 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ |
@@ -67,6 +78,16 @@ | |||
67 | {.reg = xreg, .rreg = xreg, \ | 78 | {.reg = xreg, .rreg = xreg, \ |
68 | .shift = xshift, .rshift = xshift, \ | 79 | .shift = xshift, .rshift = xshift, \ |
69 | .max = xmax, .min = xmin} } | 80 | .max = xmax, .min = xmin} } |
81 | #define SOC_SINGLE_RANGE_TLV(xname, xreg, xshift, xmin, xmax, xinvert, tlv_array) \ | ||
82 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | ||
83 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | ||
84 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | ||
85 | .tlv.p = (tlv_array), \ | ||
86 | .info = snd_soc_info_volsw_range, \ | ||
87 | .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \ | ||
88 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
89 | {.reg = xreg, .shift = xshift, .min = xmin,\ | ||
90 | .max = xmax, .platform_max = xmax, .invert = xinvert} } | ||
70 | #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ | 91 | #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ |
71 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | 92 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ |
72 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ | 93 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ |
@@ -79,6 +100,13 @@ | |||
79 | .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ | 100 | .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ |
80 | .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ | 101 | .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ |
81 | xmax, xinvert) } | 102 | xmax, xinvert) } |
103 | #define SOC_DOUBLE_R_RANGE(xname, reg_left, reg_right, xshift, xmin, \ | ||
104 | xmax, xinvert) \ | ||
105 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | ||
106 | .info = snd_soc_info_volsw_range, \ | ||
107 | .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \ | ||
108 | .private_value = SOC_DOUBLE_R_RANGE_VALUE(reg_left, reg_right, \ | ||
109 | xshift, xmin, xmax, xinvert) } | ||
82 | #define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \ | 110 | #define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \ |
83 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | 111 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ |
84 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | 112 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ |
@@ -97,6 +125,16 @@ | |||
97 | .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ | 125 | .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ |
98 | .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ | 126 | .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ |
99 | xmax, xinvert) } | 127 | xmax, xinvert) } |
128 | #define SOC_DOUBLE_R_RANGE_TLV(xname, reg_left, reg_right, xshift, xmin, \ | ||
129 | xmax, xinvert, tlv_array) \ | ||
130 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | ||
131 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | ||
132 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | ||
133 | .tlv.p = (tlv_array), \ | ||
134 | .info = snd_soc_info_volsw_range, \ | ||
135 | .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \ | ||
136 | .private_value = SOC_DOUBLE_R_RANGE_VALUE(reg_left, reg_right, \ | ||
137 | xshift, xmin, xmax, xinvert) } | ||
100 | #define SOC_DOUBLE_R_SX_TLV(xname, xreg, xrreg, xshift, xmin, xmax, tlv_array) \ | 138 | #define SOC_DOUBLE_R_SX_TLV(xname, xreg, xrreg, xshift, xmin, xmax, tlv_array) \ |
101 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 139 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ |
102 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | 140 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
@@ -460,6 +498,12 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol, | |||
460 | struct snd_ctl_elem_value *ucontrol); | 498 | struct snd_ctl_elem_value *ucontrol); |
461 | int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, | 499 | int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, |
462 | struct snd_ctl_elem_value *ucontrol); | 500 | struct snd_ctl_elem_value *ucontrol); |
501 | int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol, | ||
502 | struct snd_ctl_elem_info *uinfo); | ||
503 | int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, | ||
504 | struct snd_ctl_elem_value *ucontrol); | ||
505 | int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol, | ||
506 | struct snd_ctl_elem_value *ucontrol); | ||
463 | int snd_soc_limit_volume(struct snd_soc_codec *codec, | 507 | int snd_soc_limit_volume(struct snd_soc_codec *codec, |
464 | const char *name, int max); | 508 | const char *name, int max); |
465 | int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, | 509 | int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, |
@@ -785,13 +829,36 @@ struct snd_soc_dai_link { | |||
785 | /* config - must be set by machine driver */ | 829 | /* config - must be set by machine driver */ |
786 | const char *name; /* Codec name */ | 830 | const char *name; /* Codec name */ |
787 | const char *stream_name; /* Stream name */ | 831 | const char *stream_name; /* Stream name */ |
788 | const char *codec_name; /* for multi-codec */ | 832 | /* |
789 | const struct device_node *codec_of_node; | 833 | * You MAY specify the link's CPU-side device, either by device name, |
790 | const char *platform_name; /* for multi-platform */ | 834 | * or by DT/OF node, but not both. If this information is omitted, |
791 | const struct device_node *platform_of_node; | 835 | * the CPU-side DAI is matched using .cpu_dai_name only, which hence |
836 | * must be globally unique. These fields are currently typically used | ||
837 | * only for codec to codec links, or systems using device tree. | ||
838 | */ | ||
839 | const char *cpu_name; | ||
840 | const struct device_node *cpu_of_node; | ||
841 | /* | ||
842 | * You MAY specify the DAI name of the CPU DAI. If this information is | ||
843 | * omitted, the CPU-side DAI is matched using .cpu_name/.cpu_of_node | ||
844 | * only, which only works well when that device exposes a single DAI. | ||
845 | */ | ||
792 | const char *cpu_dai_name; | 846 | const char *cpu_dai_name; |
793 | const struct device_node *cpu_dai_of_node; | 847 | /* |
848 | * You MUST specify the link's codec, either by device name, or by | ||
849 | * DT/OF node, but not both. | ||
850 | */ | ||
851 | const char *codec_name; | ||
852 | const struct device_node *codec_of_node; | ||
853 | /* You MUST specify the DAI name within the codec */ | ||
794 | const char *codec_dai_name; | 854 | const char *codec_dai_name; |
855 | /* | ||
856 | * You MAY specify the link's platform/PCM/DMA driver, either by | ||
857 | * device name, or by DT/OF node, but not both. Some forms of link | ||
858 | * do not need a platform. | ||
859 | */ | ||
860 | const char *platform_name; | ||
861 | const struct device_node *platform_of_node; | ||
795 | int be_id; /* optional ID for machine driver BE identification */ | 862 | int be_id; /* optional ID for machine driver BE identification */ |
796 | 863 | ||
797 | const struct snd_soc_pcm_stream *params; | 864 | const struct snd_soc_pcm_stream *params; |