aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-15 18:41:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-15 18:41:41 -0400
commitd0a3997c0c3f9351e24029349dee65dd1d9e8d84 (patch)
tree7a04fe282b0c7b329cd87cdb891f0f3879dc71a6 /include
parent6d50ff91d9780263160262daeb6adfdda8ddbc6c (diff)
parentd6eb9e3ec78c98324097bab8eea266c3bb0d0ac7 (diff)
Merge tag 'sound-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai: "There have been major modernization with the standard bus: in ALSA sequencer core and HD-audio. Also, HD-audio receives the regmap support replacing the in-house cache register cache code. These changes shouldn't impact the existing behavior, but rather refactoring. In addition, HD-audio got the code split to a core library part and the "legacy" driver parts. This is a preliminary work for adapting the upcoming ASoC HD-audio driver, and the whole transition is still work in progress, likely finished in 4.1. Along with them, there are many updates in ASoC area as usual, too: lots of cleanups, Intel code shuffling, etc. Here are some highlights: ALSA core: - PCM: the audio timestamp / wallclock enhancement - PCM: fixes in DPCM management - Fixes / cleanups of user-space control element management - Sequencer: modernization using the standard bus HD-audio: - Modernization using the standard bus - Regmap support - Use standard runtime PM for codec power saving - Widget-path based power-saving for IDT, VIA and Realtek codecs - Reorganized sysfs entries for each codec object - More Dell headset support ASoC: - Move of jack registration to the card level - Lots of ASoC cleanups, mainly moving things from the CODEC level to the card level - Support for DAPM routes specified by both the machine driver and DT - Continuing improvements to rcar - pcm512x enhacements - Intel platforms updates - rt5670 updates / fixes - New platforms / devices: some non-DSP Qualcomm platforms, Google's Storm platform, Maxmim MAX98925 CODECs and the Ingenic JZ4780 SoC Misc: - ice1724: Improved ESI W192M support - emu10k1: Emu 1010 fixes/enhancement" * tag 'sound-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (411 commits) ALSA: hda - set GET bit when adding a vendor verb to the codec regmap ALSA: hda/realtek - Enable the ALC292 dock fixup on the Thinkpad T450 ALSA: hda - Fix another race in runtime PM refcounting ALSA: hda - Expose codec type sysfs ALSA: ctl: fix to handle several elements added by one operation for userspace element ASoC: Intel: fix array_size.cocci warnings ASoC: n810: Automatically disconnect non-connected pins ASoC: n810: Consistently pass the card DAPM context to n810_ext_control() ASoC: davinci-evm: Use card DAPM context to access widgets ASoC: mop500_ab8500: Use card DAPM context to access widgets ASoC: wm1133-ev1: Use card DAPM context to access widgets ASoC: atmel: Improve machine driver compile test coverage ASoC: atmel: Add dependency to SND_SOC_I2C_AND_SPI where necessary ALSA: control: Fix a typo of SNDRV_CTL_ELEM_ACCESS_TLV_* with SNDRV_CTL_TLV_OP_* ALSA: usb-audio: Don't attempt to get Microsoft Lifecam Cinema sample rate ASoC: rnsd: fix build regression without CONFIG_OF ALSA: emu10k1: add toggles for E-mu 1010 optical ports ALSA: ctl: fill identical information to return value when adding userspace elements ALSA: ctl: fix a bug to return no identical information in info operation for userspace controls ALSA: ctl: confirm to return all identical information in 'activate' event ...
Diffstat (limited to 'include')
-rw-r--r--include/sound/ac97_codec.h4
-rw-r--r--include/sound/compress_driver.h4
-rw-r--r--include/sound/control.h2
-rw-r--r--include/sound/core.h3
-rw-r--r--include/sound/hda_regmap.h217
-rw-r--r--include/sound/hdaudio.h247
-rw-r--r--include/sound/pcm.h66
-rw-r--r--include/sound/pcm_params.h7
-rw-r--r--include/sound/rt5670.h1
-rw-r--r--include/sound/seq_device.h46
-rw-r--r--include/sound/seq_kernel.h6
-rw-r--r--include/sound/simple_card.h1
-rw-r--r--include/sound/soc-dapm.h6
-rw-r--r--include/sound/soc-dpcm.h2
-rw-r--r--include/sound/soc.h32
-rw-r--r--include/uapi/sound/asequencer.h1
-rw-r--r--include/uapi/sound/asound.h39
-rw-r--r--include/uapi/sound/compress_offload.h2
-rw-r--r--include/uapi/sound/emu10k1.h3
-rw-r--r--include/uapi/sound/hdspm.h6
20 files changed, 649 insertions, 46 deletions
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index d315a08d6c6d..0e9d75b49bed 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -608,7 +608,9 @@ struct ac97_quirk {
608 int type; /* quirk type above */ 608 int type; /* quirk type above */
609}; 609};
610 610
611int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, const char *override); 611int snd_ac97_tune_hardware(struct snd_ac97 *ac97,
612 const struct ac97_quirk *quirk,
613 const char *override);
612int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate); 614int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate);
613 615
614/* 616/*
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index f48089d364c5..fa1d05512c09 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -70,7 +70,7 @@ struct snd_compr_runtime {
70 * @device: device pointer 70 * @device: device pointer
71 * @direction: stream direction, playback/recording 71 * @direction: stream direction, playback/recording
72 * @metadata_set: metadata set flag, true when set 72 * @metadata_set: metadata set flag, true when set
73 * @next_track: has userspace signall next track transistion, true when set 73 * @next_track: has userspace signal next track transition, true when set
74 * @private_data: pointer to DSP private data 74 * @private_data: pointer to DSP private data
75 */ 75 */
76struct snd_compr_stream { 76struct snd_compr_stream {
@@ -95,7 +95,7 @@ struct snd_compr_stream {
95 * and the stream properties 95 * and the stream properties
96 * @get_params: retrieve the codec parameters, mandatory 96 * @get_params: retrieve the codec parameters, mandatory
97 * @set_metadata: Set the metadata values for a stream 97 * @set_metadata: Set the metadata values for a stream
98 * @get_metadata: retreives the requested metadata values from stream 98 * @get_metadata: retrieves the requested metadata values from stream
99 * @trigger: Trigger operations like start, pause, resume, drain, stop. 99 * @trigger: Trigger operations like start, pause, resume, drain, stop.
100 * This callback is mandatory 100 * This callback is mandatory
101 * @pointer: Retrieve current h/w pointer information. Mandatory 101 * @pointer: Retrieve current h/w pointer information. Mandatory
diff --git a/include/sound/control.h b/include/sound/control.h
index 75f3054023f7..95aad6d3fd1a 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -227,7 +227,7 @@ snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
227 * Add a virtual slave control to the given master. 227 * Add a virtual slave control to the given master.
228 * Unlike snd_ctl_add_slave(), the element added via this function 228 * Unlike snd_ctl_add_slave(), the element added via this function
229 * is supposed to have volatile values, and get callback is called 229 * is supposed to have volatile values, and get callback is called
230 * at each time quried from the master. 230 * at each time queried from the master.
231 * 231 *
232 * When the control peeks the hardware values directly and the value 232 * When the control peeks the hardware values directly and the value
233 * can be changed by other means than the put callback of the element, 233 * can be changed by other means than the put callback of the element,
diff --git a/include/sound/core.h b/include/sound/core.h
index da5748289968..b12931f513f4 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -278,7 +278,8 @@ int snd_device_new(struct snd_card *card, enum snd_device_type type,
278 void *device_data, struct snd_device_ops *ops); 278 void *device_data, struct snd_device_ops *ops);
279int snd_device_register(struct snd_card *card, void *device_data); 279int snd_device_register(struct snd_card *card, void *device_data);
280int snd_device_register_all(struct snd_card *card); 280int snd_device_register_all(struct snd_card *card);
281int snd_device_disconnect_all(struct snd_card *card); 281void snd_device_disconnect(struct snd_card *card, void *device_data);
282void snd_device_disconnect_all(struct snd_card *card);
282void snd_device_free(struct snd_card *card, void *device_data); 283void snd_device_free(struct snd_card *card, void *device_data);
283void snd_device_free_all(struct snd_card *card); 284void snd_device_free_all(struct snd_card *card);
284 285
diff --git a/include/sound/hda_regmap.h b/include/sound/hda_regmap.h
new file mode 100644
index 000000000000..53a18b3635e2
--- /dev/null
+++ b/include/sound/hda_regmap.h
@@ -0,0 +1,217 @@
1/*
2 * HD-audio regmap helpers
3 */
4
5#ifndef __SOUND_HDA_REGMAP_H
6#define __SOUND_HDA_REGMAP_H
7
8#include <linux/regmap.h>
9#include <sound/core.h>
10#include <sound/hdaudio.h>
11
12int snd_hdac_regmap_init(struct hdac_device *codec);
13void snd_hdac_regmap_exit(struct hdac_device *codec);
14int snd_hdac_regmap_add_vendor_verb(struct hdac_device *codec,
15 unsigned int verb);
16int snd_hdac_regmap_read_raw(struct hdac_device *codec, unsigned int reg,
17 unsigned int *val);
18int snd_hdac_regmap_write_raw(struct hdac_device *codec, unsigned int reg,
19 unsigned int val);
20int snd_hdac_regmap_update_raw(struct hdac_device *codec, unsigned int reg,
21 unsigned int mask, unsigned int val);
22
23/**
24 * snd_hdac_regmap_encode_verb - encode the verb to a pseudo register
25 * @nid: widget NID
26 * @verb: codec verb
27 *
28 * Returns an encoded pseudo register.
29 */
30#define snd_hdac_regmap_encode_verb(nid, verb) \
31 (((verb) << 8) | 0x80000 | ((unsigned int)(nid) << 20))
32
33/**
34 * snd_hdac_regmap_encode_amp - encode the AMP verb to a pseudo register
35 * @nid: widget NID
36 * @ch: channel (left = 0, right = 1)
37 * @dir: direction (#HDA_INPUT, #HDA_OUTPUT)
38 * @idx: input index value
39 *
40 * Returns an encoded pseudo register.
41 */
42#define snd_hdac_regmap_encode_amp(nid, ch, dir, idx) \
43 (snd_hdac_regmap_encode_verb(nid, AC_VERB_GET_AMP_GAIN_MUTE) | \
44 ((ch) ? AC_AMP_GET_RIGHT : AC_AMP_GET_LEFT) | \
45 ((dir) == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT) | \
46 (idx))
47
48/**
49 * snd_hdac_regmap_encode_amp_stereo - encode a pseudo register for stereo AMPs
50 * @nid: widget NID
51 * @dir: direction (#HDA_INPUT, #HDA_OUTPUT)
52 * @idx: input index value
53 *
54 * Returns an encoded pseudo register.
55 */
56#define snd_hdac_regmap_encode_amp_stereo(nid, dir, idx) \
57 (snd_hdac_regmap_encode_verb(nid, AC_VERB_GET_AMP_GAIN_MUTE) | \
58 AC_AMP_SET_LEFT | AC_AMP_SET_RIGHT | /* both bits set! */ \
59 ((dir) == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT) | \
60 (idx))
61
62/**
63 * snd_hdac_regmap_write - Write a verb with caching
64 * @nid: codec NID
65 * @reg: verb to write
66 * @val: value to write
67 *
68 * For writing an amp value, use snd_hda_regmap_amp_update().
69 */
70static inline int
71snd_hdac_regmap_write(struct hdac_device *codec, hda_nid_t nid,
72 unsigned int verb, unsigned int val)
73{
74 unsigned int cmd = snd_hdac_regmap_encode_verb(nid, verb);
75
76 return snd_hdac_regmap_write_raw(codec, cmd, val);
77}
78
79/**
80 * snd_hda_regmap_update - Update a verb value with caching
81 * @nid: codec NID
82 * @verb: verb to update
83 * @mask: bit mask to update
84 * @val: value to update
85 *
86 * For updating an amp value, use snd_hda_regmap_amp_update().
87 */
88static inline int
89snd_hdac_regmap_update(struct hdac_device *codec, hda_nid_t nid,
90 unsigned int verb, unsigned int mask,
91 unsigned int val)
92{
93 unsigned int cmd = snd_hdac_regmap_encode_verb(nid, verb);
94
95 return snd_hdac_regmap_update_raw(codec, cmd, mask, val);
96}
97
98/**
99 * snd_hda_regmap_read - Read a verb with caching
100 * @nid: codec NID
101 * @verb: verb to read
102 * @val: pointer to store the value
103 *
104 * For reading an amp value, use snd_hda_regmap_get_amp().
105 */
106static inline int
107snd_hdac_regmap_read(struct hdac_device *codec, hda_nid_t nid,
108 unsigned int verb, unsigned int *val)
109{
110 unsigned int cmd = snd_hdac_regmap_encode_verb(nid, verb);
111
112 return snd_hdac_regmap_read_raw(codec, cmd, val);
113}
114
115/**
116 * snd_hdac_regmap_get_amp - Read AMP value
117 * @codec: HD-audio codec
118 * @nid: NID to read the AMP value
119 * @ch: channel (left=0 or right=1)
120 * @direction: #HDA_INPUT or #HDA_OUTPUT
121 * @index: the index value (only for input direction)
122 * @val: the pointer to store the value
123 *
124 * Read AMP value. The volume is between 0 to 0x7f, 0x80 = mute bit.
125 * Returns the value or a negative error.
126 */
127static inline int
128snd_hdac_regmap_get_amp(struct hdac_device *codec, hda_nid_t nid,
129 int ch, int dir, int idx)
130{
131 unsigned int cmd = snd_hdac_regmap_encode_amp(nid, ch, dir, idx);
132 int err, val;
133
134 err = snd_hdac_regmap_read_raw(codec, cmd, &val);
135 return err < 0 ? err : val;
136}
137
138/**
139 * snd_hdac_regmap_update_amp - update the AMP value
140 * @codec: HD-audio codec
141 * @nid: NID to read the AMP value
142 * @ch: channel (left=0 or right=1)
143 * @direction: #HDA_INPUT or #HDA_OUTPUT
144 * @idx: the index value (only for input direction)
145 * @mask: bit mask to set
146 * @val: the bits value to set
147 *
148 * Update the AMP value with a bit mask.
149 * Returns 0 if the value is unchanged, 1 if changed, or a negative error.
150 */
151static inline int
152snd_hdac_regmap_update_amp(struct hdac_device *codec, hda_nid_t nid,
153 int ch, int dir, int idx, int mask, int val)
154{
155 unsigned int cmd = snd_hdac_regmap_encode_amp(nid, ch, dir, idx);
156
157 return snd_hdac_regmap_update_raw(codec, cmd, mask, val);
158}
159
160/**
161 * snd_hdac_regmap_get_amp_stereo - Read stereo AMP values
162 * @codec: HD-audio codec
163 * @nid: NID to read the AMP value
164 * @ch: channel (left=0 or right=1)
165 * @direction: #HDA_INPUT or #HDA_OUTPUT
166 * @index: the index value (only for input direction)
167 * @val: the pointer to store the value
168 *
169 * Read stereo AMP values. The lower byte is left, the upper byte is right.
170 * Returns the value or a negative error.
171 */
172static inline int
173snd_hdac_regmap_get_amp_stereo(struct hdac_device *codec, hda_nid_t nid,
174 int dir, int idx)
175{
176 unsigned int cmd = snd_hdac_regmap_encode_amp_stereo(nid, dir, idx);
177 int err, val;
178
179 err = snd_hdac_regmap_read_raw(codec, cmd, &val);
180 return err < 0 ? err : val;
181}
182
183/**
184 * snd_hdac_regmap_update_amp_stereo - update the stereo AMP value
185 * @codec: HD-audio codec
186 * @nid: NID to read the AMP value
187 * @direction: #HDA_INPUT or #HDA_OUTPUT
188 * @idx: the index value (only for input direction)
189 * @mask: bit mask to set
190 * @val: the bits value to set
191 *
192 * Update the stereo AMP value with a bit mask.
193 * The lower byte is left, the upper byte is right.
194 * Returns 0 if the value is unchanged, 1 if changed, or a negative error.
195 */
196static inline int
197snd_hdac_regmap_update_amp_stereo(struct hdac_device *codec, hda_nid_t nid,
198 int dir, int idx, int mask, int val)
199{
200 unsigned int cmd = snd_hdac_regmap_encode_amp_stereo(nid, dir, idx);
201
202 return snd_hdac_regmap_update_raw(codec, cmd, mask, val);
203}
204
205/**
206 * snd_hdac_regmap_sync_node - sync the widget node attributes
207 * @codec: HD-audio codec
208 * @nid: NID to sync
209 */
210static inline void
211snd_hdac_regmap_sync_node(struct hdac_device *codec, hda_nid_t nid)
212{
213 regcache_mark_dirty(codec->regmap);
214 regcache_sync_region(codec->regmap, nid << 20, ((nid + 1) << 20) - 1);
215}
216
217#endif /* __SOUND_HDA_REGMAP_H */
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
new file mode 100644
index 000000000000..2a8aa9dfb83d
--- /dev/null
+++ b/include/sound/hdaudio.h
@@ -0,0 +1,247 @@
1/*
2 * HD-audio core stuff
3 */
4
5#ifndef __SOUND_HDAUDIO_H
6#define __SOUND_HDAUDIO_H
7
8#include <linux/device.h>
9#include <sound/hda_verbs.h>
10
11/* codec node id */
12typedef u16 hda_nid_t;
13
14struct hdac_bus;
15struct hdac_device;
16struct hdac_driver;
17struct hdac_widget_tree;
18
19/*
20 * exported bus type
21 */
22extern struct bus_type snd_hda_bus_type;
23
24/*
25 * generic arrays
26 */
27struct snd_array {
28 unsigned int used;
29 unsigned int alloced;
30 unsigned int elem_size;
31 unsigned int alloc_align;
32 void *list;
33};
34
35/*
36 * HD-audio codec base device
37 */
38struct hdac_device {
39 struct device dev;
40 int type;
41 struct hdac_bus *bus;
42 unsigned int addr; /* codec address */
43 struct list_head list; /* list point for bus codec_list */
44
45 hda_nid_t afg; /* AFG node id */
46 hda_nid_t mfg; /* MFG node id */
47
48 /* ids */
49 unsigned int vendor_id;
50 unsigned int subsystem_id;
51 unsigned int revision_id;
52 unsigned int afg_function_id;
53 unsigned int mfg_function_id;
54 unsigned int afg_unsol:1;
55 unsigned int mfg_unsol:1;
56
57 unsigned int power_caps; /* FG power caps */
58
59 const char *vendor_name; /* codec vendor name */
60 const char *chip_name; /* codec chip name */
61
62 /* verb exec op override */
63 int (*exec_verb)(struct hdac_device *dev, unsigned int cmd,
64 unsigned int flags, unsigned int *res);
65
66 /* widgets */
67 unsigned int num_nodes;
68 hda_nid_t start_nid, end_nid;
69
70 /* misc flags */
71 atomic_t in_pm; /* suspend/resume being performed */
72
73 /* sysfs */
74 struct hdac_widget_tree *widgets;
75
76 /* regmap */
77 struct regmap *regmap;
78 struct snd_array vendor_verbs;
79 bool lazy_cache:1; /* don't wake up for writes */
80 bool caps_overwriting:1; /* caps overwrite being in process */
81 bool cache_coef:1; /* cache COEF read/write too */
82};
83
84/* device/driver type used for matching */
85enum {
86 HDA_DEV_CORE,
87 HDA_DEV_LEGACY,
88};
89
90/* direction */
91enum {
92 HDA_INPUT, HDA_OUTPUT
93};
94
95#define dev_to_hdac_dev(_dev) container_of(_dev, struct hdac_device, dev)
96
97int snd_hdac_device_init(struct hdac_device *dev, struct hdac_bus *bus,
98 const char *name, unsigned int addr);
99void snd_hdac_device_exit(struct hdac_device *dev);
100int snd_hdac_device_register(struct hdac_device *codec);
101void snd_hdac_device_unregister(struct hdac_device *codec);
102
103int snd_hdac_refresh_widgets(struct hdac_device *codec);
104
105unsigned int snd_hdac_make_cmd(struct hdac_device *codec, hda_nid_t nid,
106 unsigned int verb, unsigned int parm);
107int snd_hdac_exec_verb(struct hdac_device *codec, unsigned int cmd,
108 unsigned int flags, unsigned int *res);
109int snd_hdac_read(struct hdac_device *codec, hda_nid_t nid,
110 unsigned int verb, unsigned int parm, unsigned int *res);
111int _snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm,
112 unsigned int *res);
113int snd_hdac_read_parm_uncached(struct hdac_device *codec, hda_nid_t nid,
114 int parm);
115int snd_hdac_override_parm(struct hdac_device *codec, hda_nid_t nid,
116 unsigned int parm, unsigned int val);
117int snd_hdac_get_connections(struct hdac_device *codec, hda_nid_t nid,
118 hda_nid_t *conn_list, int max_conns);
119int snd_hdac_get_sub_nodes(struct hdac_device *codec, hda_nid_t nid,
120 hda_nid_t *start_id);
121
122/**
123 * snd_hdac_read_parm - read a codec parameter
124 * @codec: the codec object
125 * @nid: NID to read a parameter
126 * @parm: parameter to read
127 *
128 * Returns -1 for error. If you need to distinguish the error more
129 * strictly, use _snd_hdac_read_parm() directly.
130 */
131static inline int snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid,
132 int parm)
133{
134 unsigned int val;
135
136 return _snd_hdac_read_parm(codec, nid, parm, &val) < 0 ? -1 : val;
137}
138
139#ifdef CONFIG_PM
140void snd_hdac_power_up(struct hdac_device *codec);
141void snd_hdac_power_down(struct hdac_device *codec);
142void snd_hdac_power_up_pm(struct hdac_device *codec);
143void snd_hdac_power_down_pm(struct hdac_device *codec);
144#else
145static inline void snd_hdac_power_up(struct hdac_device *codec) {}
146static inline void snd_hdac_power_down(struct hdac_device *codec) {}
147static inline void snd_hdac_power_up_pm(struct hdac_device *codec) {}
148static inline void snd_hdac_power_down_pm(struct hdac_device *codec) {}
149#endif
150
151/*
152 * HD-audio codec base driver
153 */
154struct hdac_driver {
155 struct device_driver driver;
156 int type;
157 int (*match)(struct hdac_device *dev, struct hdac_driver *drv);
158 void (*unsol_event)(struct hdac_device *dev, unsigned int event);
159};
160
161#define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver)
162
163/*
164 * HD-audio bus base driver
165 */
166struct hdac_bus_ops {
167 /* send a single command */
168 int (*command)(struct hdac_bus *bus, unsigned int cmd);
169 /* get a response from the last command */
170 int (*get_response)(struct hdac_bus *bus, unsigned int addr,
171 unsigned int *res);
172};
173
174#define HDA_UNSOL_QUEUE_SIZE 64
175
176struct hdac_bus {
177 struct device *dev;
178 const struct hdac_bus_ops *ops;
179
180 /* codec linked list */
181 struct list_head codec_list;
182 unsigned int num_codecs;
183
184 /* link caddr -> codec */
185 struct hdac_device *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1];
186
187 /* unsolicited event queue */
188 u32 unsol_queue[HDA_UNSOL_QUEUE_SIZE * 2]; /* ring buffer */
189 unsigned int unsol_rp, unsol_wp;
190 struct work_struct unsol_work;
191
192 /* bit flags of powered codecs */
193 unsigned long codec_powered;
194
195 /* flags */
196 bool sync_write:1; /* sync after verb write */
197
198 /* locks */
199 struct mutex cmd_mutex;
200};
201
202int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
203 const struct hdac_bus_ops *ops);
204void snd_hdac_bus_exit(struct hdac_bus *bus);
205int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr,
206 unsigned int cmd, unsigned int *res);
207int snd_hdac_bus_exec_verb_unlocked(struct hdac_bus *bus, unsigned int addr,
208 unsigned int cmd, unsigned int *res);
209void snd_hdac_bus_queue_event(struct hdac_bus *bus, u32 res, u32 res_ex);
210
211int snd_hdac_bus_add_device(struct hdac_bus *bus, struct hdac_device *codec);
212void snd_hdac_bus_remove_device(struct hdac_bus *bus,
213 struct hdac_device *codec);
214
215static inline void snd_hdac_codec_link_up(struct hdac_device *codec)
216{
217 set_bit(codec->addr, &codec->bus->codec_powered);
218}
219
220static inline void snd_hdac_codec_link_down(struct hdac_device *codec)
221{
222 clear_bit(codec->addr, &codec->bus->codec_powered);
223}
224
225/*
226 * generic array helpers
227 */
228void *snd_array_new(struct snd_array *array);
229void snd_array_free(struct snd_array *array);
230static inline void snd_array_init(struct snd_array *array, unsigned int size,
231 unsigned int align)
232{
233 array->elem_size = size;
234 array->alloc_align = align;
235}
236
237static inline void *snd_array_elem(struct snd_array *array, unsigned int idx)
238{
239 return array->list + idx * array->elem_size;
240}
241
242static inline unsigned int snd_array_index(struct snd_array *array, void *ptr)
243{
244 return (unsigned long)(ptr - array->list) / array->elem_size;
245}
246
247#endif /* __SOUND_HDAUDIO_H */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index c0ddb7e69c28..0cb7f3f5df7b 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -60,6 +60,9 @@ struct snd_pcm_hardware {
60 60
61struct snd_pcm_substream; 61struct snd_pcm_substream;
62 62
63struct snd_pcm_audio_tstamp_config; /* definitions further down */
64struct snd_pcm_audio_tstamp_report;
65
63struct snd_pcm_ops { 66struct snd_pcm_ops {
64 int (*open)(struct snd_pcm_substream *substream); 67 int (*open)(struct snd_pcm_substream *substream);
65 int (*close)(struct snd_pcm_substream *substream); 68 int (*close)(struct snd_pcm_substream *substream);
@@ -71,8 +74,10 @@ struct snd_pcm_ops {
71 int (*prepare)(struct snd_pcm_substream *substream); 74 int (*prepare)(struct snd_pcm_substream *substream);
72 int (*trigger)(struct snd_pcm_substream *substream, int cmd); 75 int (*trigger)(struct snd_pcm_substream *substream, int cmd);
73 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); 76 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
74 int (*wall_clock)(struct snd_pcm_substream *substream, 77 int (*get_time_info)(struct snd_pcm_substream *substream,
75 struct timespec *audio_ts); 78 struct timespec *system_ts, struct timespec *audio_ts,
79 struct snd_pcm_audio_tstamp_config *audio_tstamp_config,
80 struct snd_pcm_audio_tstamp_report *audio_tstamp_report);
76 int (*copy)(struct snd_pcm_substream *substream, int channel, 81 int (*copy)(struct snd_pcm_substream *substream, int channel,
77 snd_pcm_uframes_t pos, 82 snd_pcm_uframes_t pos,
78 void __user *buf, snd_pcm_uframes_t count); 83 void __user *buf, snd_pcm_uframes_t count);
@@ -281,6 +286,58 @@ struct snd_pcm_hw_constraint_ranges {
281 286
282struct snd_pcm_hwptr_log; 287struct snd_pcm_hwptr_log;
283 288
289/*
290 * userspace-provided audio timestamp config to kernel,
291 * structure is for internal use only and filled with dedicated unpack routine
292 */
293struct snd_pcm_audio_tstamp_config {
294 /* 5 of max 16 bits used */
295 u32 type_requested:4;
296 u32 report_delay:1; /* add total delay to A/D or D/A */
297};
298
299static inline void snd_pcm_unpack_audio_tstamp_config(__u32 data,
300 struct snd_pcm_audio_tstamp_config *config)
301{
302 config->type_requested = data & 0xF;
303 config->report_delay = (data >> 4) & 1;
304}
305
306/*
307 * kernel-provided audio timestamp report to user-space
308 * structure is for internal use only and read by dedicated pack routine
309 */
310struct snd_pcm_audio_tstamp_report {
311 /* 6 of max 16 bits used for bit-fields */
312
313 /* for backwards compatibility */
314 u32 valid:1;
315
316 /* actual type if hardware could not support requested timestamp */
317 u32 actual_type:4;
318
319 /* accuracy represented in ns units */
320 u32 accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */
321 u32 accuracy; /* up to 4.29s, will be packed in separate field */
322};
323
324static inline void snd_pcm_pack_audio_tstamp_report(__u32 *data, __u32 *accuracy,
325 const struct snd_pcm_audio_tstamp_report *report)
326{
327 u32 tmp;
328
329 tmp = report->accuracy_report;
330 tmp <<= 4;
331 tmp |= report->actual_type;
332 tmp <<= 1;
333 tmp |= report->valid;
334
335 *data &= 0xffff; /* zero-clear MSBs */
336 *data |= (tmp << 16);
337 *accuracy = report->accuracy;
338}
339
340
284struct snd_pcm_runtime { 341struct snd_pcm_runtime {
285 /* -- Status -- */ 342 /* -- Status -- */
286 struct snd_pcm_substream *trigger_master; 343 struct snd_pcm_substream *trigger_master;
@@ -361,6 +418,11 @@ struct snd_pcm_runtime {
361 418
362 struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */ 419 struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */
363 420
421 /* -- audio timestamp config -- */
422 struct snd_pcm_audio_tstamp_config audio_tstamp_config;
423 struct snd_pcm_audio_tstamp_report audio_tstamp_report;
424 struct timespec driver_tstamp;
425
364#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 426#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
365 /* -- OSS things -- */ 427 /* -- OSS things -- */
366 struct snd_pcm_oss_runtime oss; 428 struct snd_pcm_oss_runtime oss;
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index 3c45f3924ba7..c704357775fc 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -366,4 +366,11 @@ static inline int params_physical_width(const struct snd_pcm_hw_params *p)
366 return snd_pcm_format_physical_width(params_format(p)); 366 return snd_pcm_format_physical_width(params_format(p));
367} 367}
368 368
369static inline void
370params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt)
371{
372 snd_mask_set(hw_param_mask(p, SNDRV_PCM_HW_PARAM_FORMAT),
373 (__force int)fmt);
374}
375
369#endif /* __SOUND_PCM_PARAMS_H */ 376#endif /* __SOUND_PCM_PARAMS_H */
diff --git a/include/sound/rt5670.h b/include/sound/rt5670.h
index bd311197a3b5..b7d60510819b 100644
--- a/include/sound/rt5670.h
+++ b/include/sound/rt5670.h
@@ -14,6 +14,7 @@
14struct rt5670_platform_data { 14struct rt5670_platform_data {
15 int jd_mode; 15 int jd_mode;
16 bool in2_diff; 16 bool in2_diff;
17 bool dev_gpio;
17 18
18 bool dmic_en; 19 bool dmic_en;
19 unsigned int dmic1_data_pin; 20 unsigned int dmic1_data_pin;
diff --git a/include/sound/seq_device.h b/include/sound/seq_device.h
index 2b5f24cc7548..ddc0d504cf39 100644
--- a/include/sound/seq_device.h
+++ b/include/sound/seq_device.h
@@ -25,29 +25,26 @@
25 * registered device information 25 * registered device information
26 */ 26 */
27 27
28#define ID_LEN 32
29
30/* status flag */
31#define SNDRV_SEQ_DEVICE_FREE 0
32#define SNDRV_SEQ_DEVICE_REGISTERED 1
33
34struct snd_seq_device { 28struct snd_seq_device {
35 /* device info */ 29 /* device info */
36 struct snd_card *card; /* sound card */ 30 struct snd_card *card; /* sound card */
37 int device; /* device number */ 31 int device; /* device number */
38 char id[ID_LEN]; /* driver id */ 32 const char *id; /* driver id */
39 char name[80]; /* device name */ 33 char name[80]; /* device name */
40 int argsize; /* size of the argument */ 34 int argsize; /* size of the argument */
41 void *driver_data; /* private data for driver */ 35 void *driver_data; /* private data for driver */
42 int status; /* flag - read only */
43 void *private_data; /* private data for the caller */ 36 void *private_data; /* private data for the caller */
44 void (*private_free)(struct snd_seq_device *device); 37 void (*private_free)(struct snd_seq_device *device);
45 struct list_head list; /* link to next device */ 38 struct device dev;
46}; 39};
47 40
41#define to_seq_dev(_dev) \
42 container_of(_dev, struct snd_seq_device, dev)
43
44/* sequencer driver */
48 45
49/* driver operators 46/* driver operators
50 * init_device: 47 * probe:
51 * Initialize the device with given parameters. 48 * Initialize the device with given parameters.
52 * Typically, 49 * Typically,
53 * 1. call snd_hwdep_new 50 * 1. call snd_hwdep_new
@@ -55,25 +52,40 @@ struct snd_seq_device {
55 * 3. call snd_hwdep_register 52 * 3. call snd_hwdep_register
56 * 4. store the instance to dev->driver_data pointer. 53 * 4. store the instance to dev->driver_data pointer.
57 * 54 *
58 * free_device: 55 * remove:
59 * Release the private data. 56 * Release the private data.
60 * Typically, call snd_device_free(dev->card, dev->driver_data) 57 * Typically, call snd_device_free(dev->card, dev->driver_data)
61 */ 58 */
62struct snd_seq_dev_ops { 59struct snd_seq_driver {
63 int (*init_device)(struct snd_seq_device *dev); 60 struct device_driver driver;
64 int (*free_device)(struct snd_seq_device *dev); 61 char *id;
62 int argsize;
65}; 63};
66 64
65#define to_seq_drv(_drv) \
66 container_of(_drv, struct snd_seq_driver, driver)
67
67/* 68/*
68 * prototypes 69 * prototypes
69 */ 70 */
71#ifdef CONFIG_MODULES
70void snd_seq_device_load_drivers(void); 72void snd_seq_device_load_drivers(void);
71int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result); 73#else
72int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize); 74#define snd_seq_device_load_drivers()
73int snd_seq_device_unregister_driver(char *id); 75#endif
76int snd_seq_device_new(struct snd_card *card, int device, const char *id,
77 int argsize, struct snd_seq_device **result);
74 78
75#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device)) 79#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
76 80
81int __must_check __snd_seq_driver_register(struct snd_seq_driver *drv,
82 struct module *mod);
83#define snd_seq_driver_register(drv) \
84 __snd_seq_driver_register(drv, THIS_MODULE)
85void snd_seq_driver_unregister(struct snd_seq_driver *drv);
86
87#define module_snd_seq_driver(drv) \
88 module_driver(drv, snd_seq_driver_register, snd_seq_driver_unregister)
77 89
78/* 90/*
79 * id strings for generic devices 91 * id strings for generic devices
diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
index 18a2ac58b88f..feb58d455560 100644
--- a/include/sound/seq_kernel.h
+++ b/include/sound/seq_kernel.h
@@ -99,13 +99,9 @@ int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
99int snd_seq_event_port_detach(int client, int port); 99int snd_seq_event_port_detach(int client, int port);
100 100
101#ifdef CONFIG_MODULES 101#ifdef CONFIG_MODULES
102void snd_seq_autoload_lock(void);
103void snd_seq_autoload_unlock(void);
104void snd_seq_autoload_init(void); 102void snd_seq_autoload_init(void);
105#define snd_seq_autoload_exit() snd_seq_autoload_lock() 103void snd_seq_autoload_exit(void);
106#else 104#else
107#define snd_seq_autoload_lock()
108#define snd_seq_autoload_unlock()
109#define snd_seq_autoload_init() 105#define snd_seq_autoload_init()
110#define snd_seq_autoload_exit() 106#define snd_seq_autoload_exit()
111#endif 107#endif
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index 1255ddb1d3e2..b9b4f289fe6b 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -16,7 +16,6 @@
16 16
17struct asoc_simple_dai { 17struct asoc_simple_dai {
18 const char *name; 18 const char *name;
19 unsigned int fmt;
20 unsigned int sysclk; 19 unsigned int sysclk;
21 int slots; 20 int slots;
22 int slot_width; 21 int slot_width;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 8d7416e46861..0bc83647d3fa 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
378void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card); 378void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
379int snd_soc_dapm_new_pcm(struct snd_soc_card *card, 379int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
380 const struct snd_soc_pcm_stream *params, 380 const struct snd_soc_pcm_stream *params,
381 unsigned int num_params,
381 struct snd_soc_dapm_widget *source, 382 struct snd_soc_dapm_widget *source,
382 struct snd_soc_dapm_widget *sink); 383 struct snd_soc_dapm_widget *sink);
383 384
@@ -440,7 +441,6 @@ void dapm_mark_endpoints_dirty(struct snd_soc_card *card);
440int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, 441int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
441 struct snd_soc_dapm_widget_list **list); 442 struct snd_soc_dapm_widget_list **list);
442 443
443struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol);
444struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( 444struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
445 struct snd_kcontrol *kcontrol); 445 struct snd_kcontrol *kcontrol);
446 446
@@ -531,6 +531,8 @@ struct snd_soc_dapm_widget {
531 void *priv; /* widget specific data */ 531 void *priv; /* widget specific data */
532 struct regulator *regulator; /* attached regulator */ 532 struct regulator *regulator; /* attached regulator */
533 const struct snd_soc_pcm_stream *params; /* params for dai links */ 533 const struct snd_soc_pcm_stream *params; /* params for dai links */
534 unsigned int num_params; /* number of params for dai links */
535 unsigned int params_select; /* currently selected param for dai link */
534 536
535 /* dapm control */ 537 /* dapm control */
536 int reg; /* negative reg = no direct dapm */ 538 int reg; /* negative reg = no direct dapm */
@@ -586,8 +588,6 @@ struct snd_soc_dapm_update {
586/* DAPM context */ 588/* DAPM context */
587struct snd_soc_dapm_context { 589struct snd_soc_dapm_context {
588 enum snd_soc_bias_level bias_level; 590 enum snd_soc_bias_level bias_level;
589 enum snd_soc_bias_level suspend_bias_level;
590 struct delayed_work delayed_work;
591 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ 591 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
592 /* Go to BIAS_OFF in suspend if the DAPM context is idle */ 592 /* Go to BIAS_OFF in suspend if the DAPM context is idle */
593 unsigned int suspend_bias_off:1; 593 unsigned int suspend_bias_off:1;
diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
index 98f2ade0266e..806059052bfc 100644
--- a/include/sound/soc-dpcm.h
+++ b/include/sound/soc-dpcm.h
@@ -135,7 +135,7 @@ void snd_soc_dpcm_be_set_state(struct snd_soc_pcm_runtime *be, int stream,
135 135
136/* internal use only */ 136/* internal use only */
137int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute); 137int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute);
138int soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd); 138void soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd);
139int soc_dpcm_runtime_update(struct snd_soc_card *); 139int soc_dpcm_runtime_update(struct snd_soc_card *);
140 140
141int dpcm_path_get(struct snd_soc_pcm_runtime *fe, 141int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0d1ade195628..fcb312b3f258 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -450,8 +450,10 @@ int soc_dai_hw_params(struct snd_pcm_substream *substream,
450 struct snd_soc_dai *dai); 450 struct snd_soc_dai *dai);
451 451
452/* Jack reporting */ 452/* Jack reporting */
453int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, 453int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
454 struct snd_soc_jack *jack); 454 struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
455 unsigned int num_pins);
456
455void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); 457void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
456int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, 458int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
457 struct snd_soc_jack_pin *pins); 459 struct snd_soc_jack_pin *pins);
@@ -659,7 +661,7 @@ struct snd_soc_jack_gpio {
659struct snd_soc_jack { 661struct snd_soc_jack {
660 struct mutex mutex; 662 struct mutex mutex;
661 struct snd_jack *jack; 663 struct snd_jack *jack;
662 struct snd_soc_codec *codec; 664 struct snd_soc_card *card;
663 struct list_head pins; 665 struct list_head pins;
664 int status; 666 int status;
665 struct blocking_notifier_head notifier; 667 struct blocking_notifier_head notifier;
@@ -941,6 +943,7 @@ struct snd_soc_dai_link {
941 int be_id; /* optional ID for machine driver BE identification */ 943 int be_id; /* optional ID for machine driver BE identification */
942 944
943 const struct snd_soc_pcm_stream *params; 945 const struct snd_soc_pcm_stream *params;
946 unsigned int num_params;
944 947
945 unsigned int dai_fmt; /* format to set on init */ 948 unsigned int dai_fmt; /* format to set on init */
946 949
@@ -954,6 +957,9 @@ struct snd_soc_dai_link {
954 unsigned int symmetric_channels:1; 957 unsigned int symmetric_channels:1;
955 unsigned int symmetric_samplebits:1; 958 unsigned int symmetric_samplebits:1;
956 959
960 /* Mark this pcm with non atomic ops */
961 bool nonatomic;
962
957 /* Do not create a PCM for this DAI link (Backend link) */ 963 /* Do not create a PCM for this DAI link (Backend link) */
958 unsigned int no_pcm:1; 964 unsigned int no_pcm:1;
959 965
@@ -1071,11 +1077,16 @@ struct snd_soc_card {
1071 1077
1072 /* 1078 /*
1073 * Card-specific routes and widgets. 1079 * Card-specific routes and widgets.
1080 * Note: of_dapm_xxx for Device Tree; Otherwise for driver build-in.
1074 */ 1081 */
1075 const struct snd_soc_dapm_widget *dapm_widgets; 1082 const struct snd_soc_dapm_widget *dapm_widgets;
1076 int num_dapm_widgets; 1083 int num_dapm_widgets;
1077 const struct snd_soc_dapm_route *dapm_routes; 1084 const struct snd_soc_dapm_route *dapm_routes;
1078 int num_dapm_routes; 1085 int num_dapm_routes;
1086 const struct snd_soc_dapm_widget *of_dapm_widgets;
1087 int num_of_dapm_widgets;
1088 const struct snd_soc_dapm_route *of_dapm_routes;
1089 int num_of_dapm_routes;
1079 bool fully_routed; 1090 bool fully_routed;
1080 1091
1081 struct work_struct deferred_resume_work; 1092 struct work_struct deferred_resume_work;
@@ -1258,6 +1269,19 @@ static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
1258 return component->dapm_ptr; 1269 return component->dapm_ptr;
1259} 1270}
1260 1271
1272/**
1273 * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol
1274 * @kcontrol: The kcontrol
1275 *
1276 * This function must only be used on DAPM contexts that are known to be part of
1277 * a CODEC (e.g. in a CODEC driver). Otherwise the behavior is undefined.
1278 */
1279static inline struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(
1280 struct snd_kcontrol *kcontrol)
1281{
1282 return snd_soc_dapm_to_codec(snd_soc_dapm_kcontrol_dapm(kcontrol));
1283}
1284
1261/* codec IO */ 1285/* codec IO */
1262unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); 1286unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
1263int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg, 1287int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
@@ -1469,7 +1493,7 @@ static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
1469} 1493}
1470 1494
1471/** 1495/**
1472 * snd_soc_kcontrol_platform() - Returns the platform that registerd the control 1496 * snd_soc_kcontrol_platform() - Returns the platform that registered the control
1473 * @kcontrol: The control for which to get the platform 1497 * @kcontrol: The control for which to get the platform
1474 * 1498 *
1475 * Note: This function will only work correctly if the control has been 1499 * Note: This function will only work correctly if the control has been
diff --git a/include/uapi/sound/asequencer.h b/include/uapi/sound/asequencer.h
index 09c8a00ea503..5a5fa4956ebd 100644
--- a/include/uapi/sound/asequencer.h
+++ b/include/uapi/sound/asequencer.h
@@ -22,6 +22,7 @@
22#ifndef _UAPI__SOUND_ASEQUENCER_H 22#ifndef _UAPI__SOUND_ASEQUENCER_H
23#define _UAPI__SOUND_ASEQUENCER_H 23#define _UAPI__SOUND_ASEQUENCER_H
24 24
25#include <sound/asound.h>
25 26
26/** version of the sequencer */ 27/** version of the sequencer */
27#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1) 28#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 0e88e7a0f0eb..46145a5277fe 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -25,6 +25,9 @@
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27 27
28#ifndef __KERNEL__
29#include <stdlib.h>
30#endif
28 31
29/* 32/*
30 * protocol version 33 * protocol version
@@ -140,7 +143,7 @@ struct snd_hwdep_dsp_image {
140 * * 143 * *
141 *****************************************************************************/ 144 *****************************************************************************/
142 145
143#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 12) 146#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 13)
144 147
145typedef unsigned long snd_pcm_uframes_t; 148typedef unsigned long snd_pcm_uframes_t;
146typedef signed long snd_pcm_sframes_t; 149typedef signed long snd_pcm_sframes_t;
@@ -267,10 +270,17 @@ typedef int __bitwise snd_pcm_subformat_t;
267#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ 270#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
268#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ 271#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
269#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */ 272#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */
270#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* has audio wall clock for audio/system time sync */ 273#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* (Deprecated)has audio wall clock for audio/system time sync */
274#define SNDRV_PCM_INFO_HAS_LINK_ATIME 0x01000000 /* report hardware link audio time, reset on startup */
275#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */
276#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */
277#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */
278
271#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ 279#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */
272#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ 280#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
273 281
282
283
274typedef int __bitwise snd_pcm_state_t; 284typedef int __bitwise snd_pcm_state_t;
275#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ 285#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
276#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */ 286#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
@@ -408,6 +418,22 @@ struct snd_pcm_channel_info {
408 unsigned int step; /* samples distance in bits */ 418 unsigned int step; /* samples distance in bits */
409}; 419};
410 420
421enum {
422 /*
423 * first definition for backwards compatibility only,
424 * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else
425 */
426 SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0,
427
428 /* timestamp definitions */
429 SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /* DMA time, reported as per hw_ptr */
430 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /* link time reported by sample or wallclock counter, reset on startup */
431 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /* link time reported by sample or wallclock counter, not reset on startup */
432 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /* link time estimated indirectly */
433 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */
434 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
435};
436
411struct snd_pcm_status { 437struct snd_pcm_status {
412 snd_pcm_state_t state; /* stream state */ 438 snd_pcm_state_t state; /* stream state */
413 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ 439 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
@@ -419,9 +445,11 @@ struct snd_pcm_status {
419 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ 445 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
420 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ 446 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
421 snd_pcm_state_t suspended_state; /* suspended stream state */ 447 snd_pcm_state_t suspended_state; /* suspended stream state */
422 __u32 reserved_alignment; /* must be filled with zero */ 448 __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */
423 struct timespec audio_tstamp; /* from sample counter or wall clock */ 449 struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */
424 unsigned char reserved[56-sizeof(struct timespec)]; /* must be filled with zero */ 450 struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */
451 __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */
452 unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
425}; 453};
426 454
427struct snd_pcm_mmap_status { 455struct snd_pcm_mmap_status {
@@ -534,6 +562,7 @@ enum {
534#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) 562#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
535#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22) 563#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
536#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) 564#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
565#define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status)
537#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) 566#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
538#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40) 567#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40)
539#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41) 568#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41)
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h
index 22ed8cb7800b..e00d8cbfc628 100644
--- a/include/uapi/sound/compress_offload.h
+++ b/include/uapi/sound/compress_offload.h
@@ -75,7 +75,7 @@ struct snd_compr_tstamp {
75/** 75/**
76 * struct snd_compr_avail - avail descriptor 76 * struct snd_compr_avail - avail descriptor
77 * @avail: Number of bytes available in ring buffer for writing/reading 77 * @avail: Number of bytes available in ring buffer for writing/reading
78 * @tstamp: timestamp infomation 78 * @tstamp: timestamp information
79 */ 79 */
80struct snd_compr_avail { 80struct snd_compr_avail {
81 __u64 avail; 81 __u64 avail;
diff --git a/include/uapi/sound/emu10k1.h b/include/uapi/sound/emu10k1.h
index d1bbaf78457a..ec1535bb6aed 100644
--- a/include/uapi/sound/emu10k1.h
+++ b/include/uapi/sound/emu10k1.h
@@ -23,8 +23,7 @@
23#define _UAPI__SOUND_EMU10K1_H 23#define _UAPI__SOUND_EMU10K1_H
24 24
25#include <linux/types.h> 25#include <linux/types.h>
26 26#include <sound/asound.h>
27
28 27
29/* 28/*
30 * ---- FX8010 ---- 29 * ---- FX8010 ----
diff --git a/include/uapi/sound/hdspm.h b/include/uapi/sound/hdspm.h
index b357f1a5e29c..5737332d38f2 100644
--- a/include/uapi/sound/hdspm.h
+++ b/include/uapi/sound/hdspm.h
@@ -20,6 +20,12 @@
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 21 */
22 22
23#ifdef __KERNEL__
24#include <linux/types.h>
25#else
26#include <stdint.h>
27#endif
28
23/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ 29/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
24#define HDSPM_MAX_CHANNELS 64 30#define HDSPM_MAX_CHANNELS 64
25 31