diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-06-08 14:47:53 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-06-08 14:47:53 -0400 |
commit | 8ffc57093bb1c270050f4229b5afd38ee8cef2bd (patch) | |
tree | ba78b568b446b9c119385ef17a0fa5d5d0724be2 /include/sound | |
parent | 83b0b677f90a2056a53f1930881bbee2741b048f (diff) | |
parent | 11e688862c4c8162119a4ca51c3326555966c8bb (diff) |
Merge tag 'asoc-v4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Updates for v4.2
The big thing this release has been Liam's addition of topology support
to the core. We've also seen quite a bit of driver work and the
continuation of Lars' refactoring for component support.
- Support for loading ASoC topology maps from firmware, intended to be
used to allow self-describing DSP firmware images to be built which
can map controls added by the DSP to userspace without the kernel
needing to know about individual DSP firmwares.
- Lots of refactoring to avoid direct access to snd_soc_codec where
it's not needed supporting future refactoring.
- Big refactoring and cleanup serieses for the Wolfson ADSP and TI
TAS2552 drivers.
- Support for TI TAS571x power amplifiers.
- Support for Qualcomm APQ8016 and ZTE ZX296702 SoCs.
- Support for x86 systems with RT5650 and Qualcomm Storm.
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/dmaengine_pcm.h | 5 | ||||
-rw-r--r-- | include/sound/rt5645.h | 3 | ||||
-rw-r--r-- | include/sound/soc-dapm.h | 49 | ||||
-rw-r--r-- | include/sound/soc-topology.h | 168 | ||||
-rw-r--r-- | include/sound/soc.h | 118 | ||||
-rw-r--r-- | include/sound/tlv.h | 15 |
6 files changed, 315 insertions, 43 deletions
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index eb73a3a39ec2..f86ef5ea9b01 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h | |||
@@ -91,11 +91,6 @@ void snd_dmaengine_pcm_set_config_from_dai_data( | |||
91 | */ | 91 | */ |
92 | #define SND_DMAENGINE_PCM_FLAG_NO_DT BIT(1) | 92 | #define SND_DMAENGINE_PCM_FLAG_NO_DT BIT(1) |
93 | /* | 93 | /* |
94 | * The platforms dmaengine driver does not support reporting the amount of | ||
95 | * bytes that are still left to transfer. | ||
96 | */ | ||
97 | #define SND_DMAENGINE_PCM_FLAG_NO_RESIDUE BIT(2) | ||
98 | /* | ||
99 | * The PCM is half duplex and the DMA channel is shared between capture and | 94 | * The PCM is half duplex and the DMA channel is shared between capture and |
100 | * playback. | 95 | * playback. |
101 | */ | 96 | */ |
diff --git a/include/sound/rt5645.h b/include/sound/rt5645.h index 120d9610054e..652cb9e4afe5 100644 --- a/include/sound/rt5645.h +++ b/include/sound/rt5645.h | |||
@@ -15,7 +15,6 @@ struct rt5645_platform_data { | |||
15 | /* IN2 can optionally be differential */ | 15 | /* IN2 can optionally be differential */ |
16 | bool in2_diff; | 16 | bool in2_diff; |
17 | 17 | ||
18 | bool dmic_en; | ||
19 | unsigned int dmic1_data_pin; | 18 | unsigned int dmic1_data_pin; |
20 | /* 0 = IN2N; 1 = GPIO5; 2 = GPIO11 */ | 19 | /* 0 = IN2N; 1 = GPIO5; 2 = GPIO11 */ |
21 | unsigned int dmic2_data_pin; | 20 | unsigned int dmic2_data_pin; |
@@ -24,8 +23,6 @@ struct rt5645_platform_data { | |||
24 | unsigned int hp_det_gpio; | 23 | unsigned int hp_det_gpio; |
25 | bool gpio_hp_det_active_high; | 24 | bool gpio_hp_det_active_high; |
26 | 25 | ||
27 | /* true if codec's jd function is used */ | ||
28 | bool en_jd_func; | ||
29 | unsigned int jd_mode; | 26 | unsigned int jd_mode; |
30 | }; | 27 | }; |
31 | 28 | ||
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 1065095c6973..37d95a898275 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -15,6 +15,8 @@ | |||
15 | 15 | ||
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <sound/control.h> | 17 | #include <sound/control.h> |
18 | #include <sound/soc-topology.h> | ||
19 | #include <sound/asoc.h> | ||
18 | 20 | ||
19 | struct device; | 21 | struct device; |
20 | 22 | ||
@@ -107,6 +109,10 @@ struct device; | |||
107 | { .id = snd_soc_dapm_mux, .name = wname, \ | 109 | { .id = snd_soc_dapm_mux, .name = wname, \ |
108 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ | 110 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ |
109 | .kcontrol_news = wcontrols, .num_kcontrols = 1} | 111 | .kcontrol_news = wcontrols, .num_kcontrols = 1} |
112 | #define SND_SOC_DAPM_DEMUX(wname, wreg, wshift, winvert, wcontrols) \ | ||
113 | { .id = snd_soc_dapm_demux, .name = wname, \ | ||
114 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ | ||
115 | .kcontrol_news = wcontrols, .num_kcontrols = 1} | ||
110 | 116 | ||
111 | /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ | 117 | /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ |
112 | #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ | 118 | #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ |
@@ -444,11 +450,15 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, | |||
444 | struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( | 450 | struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( |
445 | struct snd_kcontrol *kcontrol); | 451 | struct snd_kcontrol *kcontrol); |
446 | 452 | ||
453 | int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm, | ||
454 | enum snd_soc_bias_level level); | ||
455 | |||
447 | /* dapm widget types */ | 456 | /* dapm widget types */ |
448 | enum snd_soc_dapm_type { | 457 | enum snd_soc_dapm_type { |
449 | snd_soc_dapm_input = 0, /* input pin */ | 458 | snd_soc_dapm_input = 0, /* input pin */ |
450 | snd_soc_dapm_output, /* output pin */ | 459 | snd_soc_dapm_output, /* output pin */ |
451 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ | 460 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ |
461 | snd_soc_dapm_demux, /* connects the input to one of multiple outputs */ | ||
452 | snd_soc_dapm_mixer, /* mixes several analog signals together */ | 462 | snd_soc_dapm_mixer, /* mixes several analog signals together */ |
453 | snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ | 463 | snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ |
454 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ | 464 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ |
@@ -563,6 +573,7 @@ struct snd_soc_dapm_widget { | |||
563 | int num_kcontrols; | 573 | int num_kcontrols; |
564 | const struct snd_kcontrol_new *kcontrol_news; | 574 | const struct snd_kcontrol_new *kcontrol_news; |
565 | struct snd_kcontrol **kcontrols; | 575 | struct snd_kcontrol **kcontrols; |
576 | struct snd_soc_dobj dobj; | ||
566 | 577 | ||
567 | /* widget input and outputs */ | 578 | /* widget input and outputs */ |
568 | struct list_head sources; | 579 | struct list_head sources; |
@@ -585,6 +596,10 @@ struct snd_soc_dapm_update { | |||
585 | int val; | 596 | int val; |
586 | }; | 597 | }; |
587 | 598 | ||
599 | struct snd_soc_dapm_wcache { | ||
600 | struct snd_soc_dapm_widget *widget; | ||
601 | }; | ||
602 | |||
588 | /* DAPM context */ | 603 | /* DAPM context */ |
589 | struct snd_soc_dapm_context { | 604 | struct snd_soc_dapm_context { |
590 | enum snd_soc_bias_level bias_level; | 605 | enum snd_soc_bias_level bias_level; |
@@ -606,6 +621,9 @@ struct snd_soc_dapm_context { | |||
606 | int (*set_bias_level)(struct snd_soc_dapm_context *dapm, | 621 | int (*set_bias_level)(struct snd_soc_dapm_context *dapm, |
607 | enum snd_soc_bias_level level); | 622 | enum snd_soc_bias_level level); |
608 | 623 | ||
624 | struct snd_soc_dapm_wcache path_sink_cache; | ||
625 | struct snd_soc_dapm_wcache path_source_cache; | ||
626 | |||
609 | #ifdef CONFIG_DEBUG_FS | 627 | #ifdef CONFIG_DEBUG_FS |
610 | struct dentry *debugfs_dapm; | 628 | struct dentry *debugfs_dapm; |
611 | #endif | 629 | #endif |
@@ -623,4 +641,35 @@ struct snd_soc_dapm_stats { | |||
623 | int neighbour_checks; | 641 | int neighbour_checks; |
624 | }; | 642 | }; |
625 | 643 | ||
644 | /** | ||
645 | * snd_soc_dapm_init_bias_level() - Initialize DAPM bias level | ||
646 | * @dapm: The DAPM context to initialize | ||
647 | * @level: The DAPM level to initialize to | ||
648 | * | ||
649 | * This function only sets the driver internal state of the DAPM level and will | ||
650 | * not modify the state of the device. Hence it should not be used during normal | ||
651 | * operation, but only to synchronize the internal state to the device state. | ||
652 | * E.g. during driver probe to set the DAPM level to the one corresponding with | ||
653 | * the power-on reset state of the device. | ||
654 | * | ||
655 | * To change the DAPM state of the device use snd_soc_dapm_set_bias_level(). | ||
656 | */ | ||
657 | static inline void snd_soc_dapm_init_bias_level( | ||
658 | struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) | ||
659 | { | ||
660 | dapm->bias_level = level; | ||
661 | } | ||
662 | |||
663 | /** | ||
664 | * snd_soc_dapm_get_bias_level() - Get current DAPM bias level | ||
665 | * @dapm: The context for which to get the bias level | ||
666 | * | ||
667 | * Returns: The current bias level of the passed DAPM context. | ||
668 | */ | ||
669 | static inline enum snd_soc_bias_level snd_soc_dapm_get_bias_level( | ||
670 | struct snd_soc_dapm_context *dapm) | ||
671 | { | ||
672 | return dapm->bias_level; | ||
673 | } | ||
674 | |||
626 | #endif | 675 | #endif |
diff --git a/include/sound/soc-topology.h b/include/sound/soc-topology.h new file mode 100644 index 000000000000..865a141b118b --- /dev/null +++ b/include/sound/soc-topology.h | |||
@@ -0,0 +1,168 @@ | |||
1 | /* | ||
2 | * linux/sound/soc-topology.h -- ALSA SoC Firmware Controls and DAPM | ||
3 | * | ||
4 | * Copyright (C) 2012 Texas Instruments Inc. | ||
5 | * Copyright (C) 2015 Intel Corporation. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * Simple file API to load FW that includes mixers, coefficients, DAPM graphs, | ||
12 | * algorithms, equalisers, DAIs, widgets, FE caps, BE caps, codec link caps etc. | ||
13 | */ | ||
14 | |||
15 | #ifndef __LINUX_SND_SOC_TPLG_H | ||
16 | #define __LINUX_SND_SOC_TPLG_H | ||
17 | |||
18 | #include <sound/asoc.h> | ||
19 | #include <linux/list.h> | ||
20 | |||
21 | struct firmware; | ||
22 | struct snd_kcontrol; | ||
23 | struct snd_soc_tplg_pcm_be; | ||
24 | struct snd_ctl_elem_value; | ||
25 | struct snd_ctl_elem_info; | ||
26 | struct snd_soc_dapm_widget; | ||
27 | struct snd_soc_component; | ||
28 | struct snd_soc_tplg_pcm_fe; | ||
29 | struct snd_soc_dapm_context; | ||
30 | struct snd_soc_card; | ||
31 | |||
32 | /* object scan be loaded and unloaded in groups with identfying indexes */ | ||
33 | #define SND_SOC_TPLG_INDEX_ALL 0 /* ID that matches all FW objects */ | ||
34 | |||
35 | /* dynamic object type */ | ||
36 | enum snd_soc_dobj_type { | ||
37 | SND_SOC_DOBJ_NONE = 0, /* object is not dynamic */ | ||
38 | SND_SOC_DOBJ_MIXER, | ||
39 | SND_SOC_DOBJ_ENUM, | ||
40 | SND_SOC_DOBJ_BYTES, | ||
41 | SND_SOC_DOBJ_PCM, | ||
42 | SND_SOC_DOBJ_DAI_LINK, | ||
43 | SND_SOC_DOBJ_CODEC_LINK, | ||
44 | SND_SOC_DOBJ_WIDGET, | ||
45 | }; | ||
46 | |||
47 | /* dynamic control object */ | ||
48 | struct snd_soc_dobj_control { | ||
49 | struct snd_kcontrol *kcontrol; | ||
50 | char **dtexts; | ||
51 | unsigned long *dvalues; | ||
52 | }; | ||
53 | |||
54 | /* dynamic widget object */ | ||
55 | struct snd_soc_dobj_widget { | ||
56 | unsigned int kcontrol_enum:1; /* this widget is an enum kcontrol */ | ||
57 | }; | ||
58 | |||
59 | /* dynamic PCM DAI object */ | ||
60 | struct snd_soc_dobj_pcm_dai { | ||
61 | struct snd_soc_tplg_pcm_dai *pd; | ||
62 | unsigned int count; | ||
63 | }; | ||
64 | |||
65 | /* generic dynamic object - all dynamic objects belong to this struct */ | ||
66 | struct snd_soc_dobj { | ||
67 | enum snd_soc_dobj_type type; | ||
68 | unsigned int index; /* objects can belong in different groups */ | ||
69 | struct list_head list; | ||
70 | struct snd_soc_tplg_ops *ops; | ||
71 | union { | ||
72 | struct snd_soc_dobj_control control; | ||
73 | struct snd_soc_dobj_widget widget; | ||
74 | struct snd_soc_dobj_pcm_dai pcm_dai; | ||
75 | }; | ||
76 | void *private; /* core does not touch this */ | ||
77 | }; | ||
78 | |||
79 | /* | ||
80 | * Kcontrol operations - used to map handlers onto firmware based controls. | ||
81 | */ | ||
82 | struct snd_soc_tplg_kcontrol_ops { | ||
83 | u32 id; | ||
84 | int (*get)(struct snd_kcontrol *kcontrol, | ||
85 | struct snd_ctl_elem_value *ucontrol); | ||
86 | int (*put)(struct snd_kcontrol *kcontrol, | ||
87 | struct snd_ctl_elem_value *ucontrol); | ||
88 | int (*info)(struct snd_kcontrol *kcontrol, | ||
89 | struct snd_ctl_elem_info *uinfo); | ||
90 | }; | ||
91 | |||
92 | /* | ||
93 | * DAPM widget event handlers - used to map handlers onto widgets. | ||
94 | */ | ||
95 | struct snd_soc_tplg_widget_events { | ||
96 | u16 type; | ||
97 | int (*event_handler)(struct snd_soc_dapm_widget *w, | ||
98 | struct snd_kcontrol *k, int event); | ||
99 | }; | ||
100 | |||
101 | /* | ||
102 | * Public API - Used by component drivers to load and unload dynamic objects | ||
103 | * and their resources. | ||
104 | */ | ||
105 | struct snd_soc_tplg_ops { | ||
106 | |||
107 | /* external kcontrol init - used for any driver specific init */ | ||
108 | int (*control_load)(struct snd_soc_component *, | ||
109 | struct snd_kcontrol_new *, struct snd_soc_tplg_ctl_hdr *); | ||
110 | int (*control_unload)(struct snd_soc_component *, | ||
111 | struct snd_soc_dobj *); | ||
112 | |||
113 | /* external widget init - used for any driver specific init */ | ||
114 | int (*widget_load)(struct snd_soc_component *, | ||
115 | struct snd_soc_dapm_widget *, | ||
116 | struct snd_soc_tplg_dapm_widget *); | ||
117 | int (*widget_unload)(struct snd_soc_component *, | ||
118 | struct snd_soc_dobj *); | ||
119 | |||
120 | /* FE - used for any driver specific init */ | ||
121 | int (*pcm_dai_load)(struct snd_soc_component *, | ||
122 | struct snd_soc_tplg_pcm_dai *pcm_dai, int num_fe); | ||
123 | int (*pcm_dai_unload)(struct snd_soc_component *, | ||
124 | struct snd_soc_dobj *); | ||
125 | |||
126 | /* callback to handle vendor bespoke data */ | ||
127 | int (*vendor_load)(struct snd_soc_component *, | ||
128 | struct snd_soc_tplg_hdr *); | ||
129 | int (*vendor_unload)(struct snd_soc_component *, | ||
130 | struct snd_soc_tplg_hdr *); | ||
131 | |||
132 | /* completion - called at completion of firmware loading */ | ||
133 | void (*complete)(struct snd_soc_component *); | ||
134 | |||
135 | /* manifest - optional to inform component of manifest */ | ||
136 | int (*manifest)(struct snd_soc_component *, | ||
137 | struct snd_soc_tplg_manifest *); | ||
138 | |||
139 | /* bespoke kcontrol handlers available for binding */ | ||
140 | const struct snd_soc_tplg_kcontrol_ops *io_ops; | ||
141 | int io_ops_count; | ||
142 | }; | ||
143 | |||
144 | /* gets a pointer to data from the firmware block header */ | ||
145 | static inline const void *snd_soc_tplg_get_data(struct snd_soc_tplg_hdr *hdr) | ||
146 | { | ||
147 | const void *ptr = hdr; | ||
148 | |||
149 | return ptr + sizeof(*hdr); | ||
150 | } | ||
151 | |||
152 | /* Dynamic Object loading and removal for component drivers */ | ||
153 | int snd_soc_tplg_component_load(struct snd_soc_component *comp, | ||
154 | struct snd_soc_tplg_ops *ops, const struct firmware *fw, | ||
155 | u32 index); | ||
156 | int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index); | ||
157 | |||
158 | /* Widget removal - widgets also removed wth component API */ | ||
159 | void snd_soc_tplg_widget_remove(struct snd_soc_dapm_widget *w); | ||
160 | void snd_soc_tplg_widget_remove_all(struct snd_soc_dapm_context *dapm, | ||
161 | u32 index); | ||
162 | |||
163 | /* Binds event handlers to dynamic widgets */ | ||
164 | int snd_soc_tplg_widget_bind_event(struct snd_soc_dapm_widget *w, | ||
165 | const struct snd_soc_tplg_widget_events *events, int num_events, | ||
166 | u16 event_type); | ||
167 | |||
168 | #endif | ||
diff --git a/include/sound/soc.h b/include/sound/soc.h index f6226914acfe..93df8bf9d54a 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <sound/compress_driver.h> | 27 | #include <sound/compress_driver.h> |
28 | #include <sound/control.h> | 28 | #include <sound/control.h> |
29 | #include <sound/ac97_codec.h> | 29 | #include <sound/ac97_codec.h> |
30 | #include <sound/soc-topology.h> | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * Convenience kcontrol builders | 33 | * Convenience kcontrol builders |
@@ -190,8 +191,12 @@ | |||
190 | #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \ | 191 | #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \ |
191 | { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ | 192 | { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ |
192 | .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues} | 193 | .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues} |
193 | #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \ | 194 | #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \ |
194 | SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xnitmes, xtexts, xvalues) | 195 | SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xitems, xtexts, xvalues) |
196 | #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \ | ||
197 | { .reg = xreg, .shift_l = xshift, .shift_r = xshift, \ | ||
198 | .mask = xmask, .items = xitems, .texts = xtexts, \ | ||
199 | .values = xvalues, .autodisable = 1} | ||
195 | #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \ | 200 | #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \ |
196 | SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts) | 201 | SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts) |
197 | #define SOC_ENUM(xname, xenum) \ | 202 | #define SOC_ENUM(xname, xenum) \ |
@@ -312,6 +317,11 @@ | |||
312 | ARRAY_SIZE(xtexts), xtexts, xvalues) | 317 | ARRAY_SIZE(xtexts), xtexts, xvalues) |
313 | #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ | 318 | #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ |
314 | SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) | 319 | SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) |
320 | |||
321 | #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ | ||
322 | const struct soc_enum name = SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, \ | ||
323 | xshift, xmask, ARRAY_SIZE(xtexts), xtexts, xvalues) | ||
324 | |||
315 | #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ | 325 | #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ |
316 | const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) | 326 | const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) |
317 | 327 | ||
@@ -767,6 +777,9 @@ struct snd_soc_component { | |||
767 | 777 | ||
768 | struct mutex io_mutex; | 778 | struct mutex io_mutex; |
769 | 779 | ||
780 | /* attached dynamic objects */ | ||
781 | struct list_head dobj_list; | ||
782 | |||
770 | #ifdef CONFIG_DEBUG_FS | 783 | #ifdef CONFIG_DEBUG_FS |
771 | struct dentry *debugfs_root; | 784 | struct dentry *debugfs_root; |
772 | #endif | 785 | #endif |
@@ -819,7 +832,7 @@ struct snd_soc_codec { | |||
819 | /* component */ | 832 | /* component */ |
820 | struct snd_soc_component component; | 833 | struct snd_soc_component component; |
821 | 834 | ||
822 | /* dapm */ | 835 | /* Don't access this directly, use snd_soc_codec_get_dapm() */ |
823 | struct snd_soc_dapm_context dapm; | 836 | struct snd_soc_dapm_context dapm; |
824 | 837 | ||
825 | #ifdef CONFIG_DEBUG_FS | 838 | #ifdef CONFIG_DEBUG_FS |
@@ -961,6 +974,24 @@ struct snd_soc_dai_link { | |||
961 | 974 | ||
962 | enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */ | 975 | enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */ |
963 | 976 | ||
977 | /* codec/machine specific init - e.g. add machine controls */ | ||
978 | int (*init)(struct snd_soc_pcm_runtime *rtd); | ||
979 | |||
980 | /* optional hw_params re-writing for BE and FE sync */ | ||
981 | int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd, | ||
982 | struct snd_pcm_hw_params *params); | ||
983 | |||
984 | /* machine stream operations */ | ||
985 | const struct snd_soc_ops *ops; | ||
986 | const struct snd_soc_compr_ops *compr_ops; | ||
987 | |||
988 | /* For unidirectional dai links */ | ||
989 | bool playback_only; | ||
990 | bool capture_only; | ||
991 | |||
992 | /* Mark this pcm with non atomic ops */ | ||
993 | bool nonatomic; | ||
994 | |||
964 | /* Keep DAI active over suspend */ | 995 | /* Keep DAI active over suspend */ |
965 | unsigned int ignore_suspend:1; | 996 | unsigned int ignore_suspend:1; |
966 | 997 | ||
@@ -969,9 +1000,6 @@ struct snd_soc_dai_link { | |||
969 | unsigned int symmetric_channels:1; | 1000 | unsigned int symmetric_channels:1; |
970 | unsigned int symmetric_samplebits:1; | 1001 | unsigned int symmetric_samplebits:1; |
971 | 1002 | ||
972 | /* Mark this pcm with non atomic ops */ | ||
973 | bool nonatomic; | ||
974 | |||
975 | /* Do not create a PCM for this DAI link (Backend link) */ | 1003 | /* Do not create a PCM for this DAI link (Backend link) */ |
976 | unsigned int no_pcm:1; | 1004 | unsigned int no_pcm:1; |
977 | 1005 | ||
@@ -982,23 +1010,11 @@ struct snd_soc_dai_link { | |||
982 | unsigned int dpcm_capture:1; | 1010 | unsigned int dpcm_capture:1; |
983 | unsigned int dpcm_playback:1; | 1011 | unsigned int dpcm_playback:1; |
984 | 1012 | ||
1013 | /* DPCM used FE & BE merged format */ | ||
1014 | unsigned int dpcm_merged_format:1; | ||
1015 | |||
985 | /* pmdown_time is ignored at stop */ | 1016 | /* pmdown_time is ignored at stop */ |
986 | unsigned int ignore_pmdown_time:1; | 1017 | unsigned int ignore_pmdown_time:1; |
987 | |||
988 | /* codec/machine specific init - e.g. add machine controls */ | ||
989 | int (*init)(struct snd_soc_pcm_runtime *rtd); | ||
990 | |||
991 | /* optional hw_params re-writing for BE and FE sync */ | ||
992 | int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd, | ||
993 | struct snd_pcm_hw_params *params); | ||
994 | |||
995 | /* machine stream operations */ | ||
996 | const struct snd_soc_ops *ops; | ||
997 | const struct snd_soc_compr_ops *compr_ops; | ||
998 | |||
999 | /* For unidirectional dai links */ | ||
1000 | bool playback_only; | ||
1001 | bool capture_only; | ||
1002 | }; | 1018 | }; |
1003 | 1019 | ||
1004 | struct snd_soc_codec_conf { | 1020 | struct snd_soc_codec_conf { |
@@ -1111,6 +1127,9 @@ struct snd_soc_card { | |||
1111 | struct list_head dapm_list; | 1127 | struct list_head dapm_list; |
1112 | struct list_head dapm_dirty; | 1128 | struct list_head dapm_dirty; |
1113 | 1129 | ||
1130 | /* attached dynamic objects */ | ||
1131 | struct list_head dobj_list; | ||
1132 | |||
1114 | /* Generic DAPM context for the card */ | 1133 | /* Generic DAPM context for the card */ |
1115 | struct snd_soc_dapm_context dapm; | 1134 | struct snd_soc_dapm_context dapm; |
1116 | struct snd_soc_dapm_stats dapm_stats; | 1135 | struct snd_soc_dapm_stats dapm_stats; |
@@ -1170,6 +1189,7 @@ struct soc_mixer_control { | |||
1170 | unsigned int sign_bit; | 1189 | unsigned int sign_bit; |
1171 | unsigned int invert:1; | 1190 | unsigned int invert:1; |
1172 | unsigned int autodisable:1; | 1191 | unsigned int autodisable:1; |
1192 | struct snd_soc_dobj dobj; | ||
1173 | }; | 1193 | }; |
1174 | 1194 | ||
1175 | struct soc_bytes { | 1195 | struct soc_bytes { |
@@ -1180,6 +1200,8 @@ struct soc_bytes { | |||
1180 | 1200 | ||
1181 | struct soc_bytes_ext { | 1201 | struct soc_bytes_ext { |
1182 | int max; | 1202 | int max; |
1203 | struct snd_soc_dobj dobj; | ||
1204 | |||
1183 | /* used for TLV byte control */ | 1205 | /* used for TLV byte control */ |
1184 | int (*get)(unsigned int __user *bytes, unsigned int size); | 1206 | int (*get)(unsigned int __user *bytes, unsigned int size); |
1185 | int (*put)(const unsigned int __user *bytes, unsigned int size); | 1207 | int (*put)(const unsigned int __user *bytes, unsigned int size); |
@@ -1200,6 +1222,8 @@ struct soc_enum { | |||
1200 | unsigned int mask; | 1222 | unsigned int mask; |
1201 | const char * const *texts; | 1223 | const char * const *texts; |
1202 | const unsigned int *values; | 1224 | const unsigned int *values; |
1225 | unsigned int autodisable:1; | ||
1226 | struct snd_soc_dobj dobj; | ||
1203 | }; | 1227 | }; |
1204 | 1228 | ||
1205 | /** | 1229 | /** |
@@ -1282,6 +1306,58 @@ static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm( | |||
1282 | } | 1306 | } |
1283 | 1307 | ||
1284 | /** | 1308 | /** |
1309 | * snd_soc_codec_get_dapm() - Returns the DAPM context for the CODEC | ||
1310 | * @codec: The CODEC for which to get the DAPM context | ||
1311 | * | ||
1312 | * Note: Use this function instead of directly accessing the CODEC's dapm field | ||
1313 | */ | ||
1314 | static inline struct snd_soc_dapm_context *snd_soc_codec_get_dapm( | ||
1315 | struct snd_soc_codec *codec) | ||
1316 | { | ||
1317 | return &codec->dapm; | ||
1318 | } | ||
1319 | |||
1320 | /** | ||
1321 | * snd_soc_dapm_init_bias_level() - Initialize CODEC DAPM bias level | ||
1322 | * @dapm: The CODEC for which to initialize the DAPM bias level | ||
1323 | * @level: The DAPM level to initialize to | ||
1324 | * | ||
1325 | * Initializes the CODEC DAPM bias level. See snd_soc_dapm_init_bias_level(). | ||
1326 | */ | ||
1327 | static inline void snd_soc_codec_init_bias_level(struct snd_soc_codec *codec, | ||
1328 | enum snd_soc_bias_level level) | ||
1329 | { | ||
1330 | snd_soc_dapm_init_bias_level(snd_soc_codec_get_dapm(codec), level); | ||
1331 | } | ||
1332 | |||
1333 | /** | ||
1334 | * snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level | ||
1335 | * @codec: The CODEC for which to get the DAPM bias level | ||
1336 | * | ||
1337 | * Returns: The current DAPM bias level of the CODEC. | ||
1338 | */ | ||
1339 | static inline enum snd_soc_bias_level snd_soc_codec_get_bias_level( | ||
1340 | struct snd_soc_codec *codec) | ||
1341 | { | ||
1342 | return snd_soc_dapm_get_bias_level(snd_soc_codec_get_dapm(codec)); | ||
1343 | } | ||
1344 | |||
1345 | /** | ||
1346 | * snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level | ||
1347 | * @codec: The CODEC for which to set the level | ||
1348 | * @level: The level to set to | ||
1349 | * | ||
1350 | * Forces the CODEC bias level to a specific state. See | ||
1351 | * snd_soc_dapm_force_bias_level(). | ||
1352 | */ | ||
1353 | static inline int snd_soc_codec_force_bias_level(struct snd_soc_codec *codec, | ||
1354 | enum snd_soc_bias_level level) | ||
1355 | { | ||
1356 | return snd_soc_dapm_force_bias_level(snd_soc_codec_get_dapm(codec), | ||
1357 | level); | ||
1358 | } | ||
1359 | |||
1360 | /** | ||
1285 | * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol | 1361 | * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol |
1286 | * @kcontrol: The kcontrol | 1362 | * @kcontrol: The kcontrol |
1287 | * | 1363 | * |
diff --git a/include/sound/tlv.h b/include/sound/tlv.h index e11e179420a1..df97d1966468 100644 --- a/include/sound/tlv.h +++ b/include/sound/tlv.h | |||
@@ -31,12 +31,7 @@ | |||
31 | * ~(sizeof(unsigned int) - 1)) .... | 31 | * ~(sizeof(unsigned int) - 1)) .... |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */ | 34 | #include <uapi/sound/tlv.h> |
35 | #define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ | ||
36 | #define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ | ||
37 | #define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ | ||
38 | #define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */ | ||
39 | #define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */ | ||
40 | 35 | ||
41 | #define TLV_ITEM(type, ...) \ | 36 | #define TLV_ITEM(type, ...) \ |
42 | (type), TLV_LENGTH(__VA_ARGS__), __VA_ARGS__ | 37 | (type), TLV_LENGTH(__VA_ARGS__), __VA_ARGS__ |
@@ -90,12 +85,4 @@ | |||
90 | 85 | ||
91 | #define TLV_DB_GAIN_MUTE -9999999 | 86 | #define TLV_DB_GAIN_MUTE -9999999 |
92 | 87 | ||
93 | /* | ||
94 | * channel-mapping TLV items | ||
95 | * TLV length must match with num_channels | ||
96 | */ | ||
97 | #define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */ | ||
98 | #define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */ | ||
99 | #define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */ | ||
100 | |||
101 | #endif /* __SOUND_TLV_H */ | 88 | #endif /* __SOUND_TLV_H */ |