diff options
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/core.h | 10 | ||||
-rw-r--r-- | include/sound/cs42l52.h | 36 | ||||
-rw-r--r-- | include/sound/max98095.h | 12 | ||||
-rw-r--r-- | include/sound/sh_fsi.h | 12 | ||||
-rw-r--r-- | include/sound/simple_card.h | 38 | ||||
-rw-r--r-- | include/sound/soc-dai.h | 4 | ||||
-rw-r--r-- | include/sound/soc-dapm.h | 28 | ||||
-rw-r--r-- | include/sound/soc-dpcm.h | 138 | ||||
-rw-r--r-- | include/sound/soc.h | 118 |
9 files changed, 355 insertions, 41 deletions
diff --git a/include/sound/core.h b/include/sound/core.h index b6e0f57d451d..bc056687f647 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -325,6 +325,13 @@ void release_and_free_resource(struct resource *res); | |||
325 | 325 | ||
326 | /* --- */ | 326 | /* --- */ |
327 | 327 | ||
328 | /* sound printk debug levels */ | ||
329 | enum { | ||
330 | SND_PR_ALWAYS, | ||
331 | SND_PR_DEBUG, | ||
332 | SND_PR_VERBOSE, | ||
333 | }; | ||
334 | |||
328 | #if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK) | 335 | #if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK) |
329 | __printf(4, 5) | 336 | __printf(4, 5) |
330 | void __snd_printk(unsigned int level, const char *file, int line, | 337 | void __snd_printk(unsigned int level, const char *file, int line, |
@@ -354,6 +361,8 @@ void __snd_printk(unsigned int level, const char *file, int line, | |||
354 | */ | 361 | */ |
355 | #define snd_printd(fmt, args...) \ | 362 | #define snd_printd(fmt, args...) \ |
356 | __snd_printk(1, __FILE__, __LINE__, fmt, ##args) | 363 | __snd_printk(1, __FILE__, __LINE__, fmt, ##args) |
364 | #define _snd_printd(level, fmt, args...) \ | ||
365 | __snd_printk(level, __FILE__, __LINE__, fmt, ##args) | ||
357 | 366 | ||
358 | /** | 367 | /** |
359 | * snd_BUG - give a BUG warning message and stack trace | 368 | * snd_BUG - give a BUG warning message and stack trace |
@@ -383,6 +392,7 @@ void __snd_printk(unsigned int level, const char *file, int line, | |||
383 | #else /* !CONFIG_SND_DEBUG */ | 392 | #else /* !CONFIG_SND_DEBUG */ |
384 | 393 | ||
385 | #define snd_printd(fmt, args...) do { } while (0) | 394 | #define snd_printd(fmt, args...) do { } while (0) |
395 | #define _snd_printd(level, fmt, args...) do { } while (0) | ||
386 | #define snd_BUG() do { } while (0) | 396 | #define snd_BUG() do { } while (0) |
387 | static inline int __snd_bug_on(int cond) | 397 | static inline int __snd_bug_on(int cond) |
388 | { | 398 | { |
diff --git a/include/sound/cs42l52.h b/include/sound/cs42l52.h new file mode 100644 index 000000000000..4c68955f7330 --- /dev/null +++ b/include/sound/cs42l52.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * linux/sound/cs42l52.h -- Platform data for CS42L52 | ||
3 | * | ||
4 | * Copyright (c) 2012 Cirrus Logic Inc. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __CS42L52_H | ||
12 | #define __CS42L52_H | ||
13 | |||
14 | struct cs42l52_platform_data { | ||
15 | |||
16 | /* MICBIAS Level. Check datasheet Pg48 */ | ||
17 | unsigned int micbias_lvl; | ||
18 | |||
19 | /* MICA mode selection 0=Single 1=Differential */ | ||
20 | unsigned int mica_cfg; | ||
21 | |||
22 | /* MICB mode selection 0=Single 1=Differential */ | ||
23 | unsigned int micb_cfg; | ||
24 | |||
25 | /* MICA Select 0=MIC1A 1=MIC2A */ | ||
26 | unsigned int mica_sel; | ||
27 | |||
28 | /* MICB Select 0=MIC2A 1=MIC2B */ | ||
29 | unsigned int micb_sel; | ||
30 | |||
31 | /* Charge Pump Freq. Check datasheet Pg73 */ | ||
32 | unsigned int chgfreq; | ||
33 | |||
34 | }; | ||
35 | |||
36 | #endif /* __CS42L52_H */ | ||
diff --git a/include/sound/max98095.h b/include/sound/max98095.h index 7513a42dd4aa..e87ae67b0a55 100644 --- a/include/sound/max98095.h +++ b/include/sound/max98095.h | |||
@@ -49,6 +49,18 @@ struct max98095_pdata { | |||
49 | */ | 49 | */ |
50 | unsigned int digmic_left_mode:1; | 50 | unsigned int digmic_left_mode:1; |
51 | unsigned int digmic_right_mode:1; | 51 | unsigned int digmic_right_mode:1; |
52 | |||
53 | /* Pin5 is the mechanical method of sensing jack insertion | ||
54 | * but it is something that might not be supported. | ||
55 | * 0 = PIN5 not supported | ||
56 | * 1 = PIN5 supported | ||
57 | */ | ||
58 | unsigned int jack_detect_pin5en:1; | ||
59 | |||
60 | /* Slew amount for jack detection. Calculated as 4 * (delay + 1). | ||
61 | * Default delay is 24 to get a time of 100ms. | ||
62 | */ | ||
63 | unsigned int jack_detect_delay; | ||
52 | }; | 64 | }; |
53 | 65 | ||
54 | #endif | 66 | #endif |
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h index b457e87fbd08..956e30e89ea8 100644 --- a/include/sound/sh_fsi.h +++ b/include/sound/sh_fsi.h | |||
@@ -84,16 +84,4 @@ struct sh_fsi_platform_info { | |||
84 | struct sh_fsi_port_info port_b; | 84 | struct sh_fsi_port_info port_b; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | /* | ||
88 | * for fsi-ak4642 | ||
89 | */ | ||
90 | struct fsi_ak4642_info { | ||
91 | const char *name; | ||
92 | const char *card; | ||
93 | const char *cpu_dai; | ||
94 | const char *codec; | ||
95 | const char *platform; | ||
96 | int id; | ||
97 | }; | ||
98 | |||
99 | #endif /* __SOUND_FSI_H */ | 87 | #endif /* __SOUND_FSI_H */ |
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h new file mode 100644 index 000000000000..4b62b8dc6a4f --- /dev/null +++ b/include/sound/simple_card.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * ASoC simple sound card support | ||
3 | * | ||
4 | * Copyright (C) 2012 Renesas Solutions Corp. | ||
5 | * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | ||
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 | |||
12 | #ifndef __SIMPLE_CARD_H | ||
13 | #define __SIMPLE_CARD_H | ||
14 | |||
15 | #include <sound/soc.h> | ||
16 | |||
17 | struct asoc_simple_dai_init_info { | ||
18 | unsigned int fmt; | ||
19 | unsigned int cpu_daifmt; | ||
20 | unsigned int codec_daifmt; | ||
21 | unsigned int sysclk; | ||
22 | }; | ||
23 | |||
24 | struct asoc_simple_card_info { | ||
25 | const char *name; | ||
26 | const char *card; | ||
27 | const char *cpu_dai; | ||
28 | const char *codec; | ||
29 | const char *platform; | ||
30 | const char *codec_dai; | ||
31 | struct asoc_simple_dai_init_info *init; /* for snd_link.init */ | ||
32 | |||
33 | /* used in simple-card.c */ | ||
34 | struct snd_soc_dai_link snd_link; | ||
35 | struct snd_soc_card snd_card; | ||
36 | }; | ||
37 | |||
38 | #endif /* __SIMPLE_CARD_H */ | ||
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index c429f248cf4e..1f69e0af2941 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h | |||
@@ -173,6 +173,8 @@ struct snd_soc_dai_ops { | |||
173 | struct snd_soc_dai *); | 173 | struct snd_soc_dai *); |
174 | int (*trigger)(struct snd_pcm_substream *, int, | 174 | int (*trigger)(struct snd_pcm_substream *, int, |
175 | struct snd_soc_dai *); | 175 | struct snd_soc_dai *); |
176 | int (*bespoke_trigger)(struct snd_pcm_substream *, int, | ||
177 | struct snd_soc_dai *); | ||
176 | /* | 178 | /* |
177 | * For hardware based FIFO caused delay reporting. | 179 | * For hardware based FIFO caused delay reporting. |
178 | * Optional. | 180 | * Optional. |
@@ -196,6 +198,7 @@ struct snd_soc_dai_driver { | |||
196 | const char *name; | 198 | const char *name; |
197 | unsigned int id; | 199 | unsigned int id; |
198 | int ac97_control; | 200 | int ac97_control; |
201 | unsigned int base; | ||
199 | 202 | ||
200 | /* DAI driver callbacks */ | 203 | /* DAI driver callbacks */ |
201 | int (*probe)(struct snd_soc_dai *dai); | 204 | int (*probe)(struct snd_soc_dai *dai); |
@@ -241,6 +244,7 @@ struct snd_soc_dai { | |||
241 | 244 | ||
242 | struct snd_soc_dapm_widget *playback_widget; | 245 | struct snd_soc_dapm_widget *playback_widget; |
243 | struct snd_soc_dapm_widget *capture_widget; | 246 | struct snd_soc_dapm_widget *capture_widget; |
247 | struct snd_soc_dapm_context dapm; | ||
244 | 248 | ||
245 | /* DAI DMA data */ | 249 | /* DAI DMA data */ |
246 | void *playback_dma_data; | 250 | void *playback_dma_data; |
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 8da3c2409060..e3833d9f1914 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -141,10 +141,6 @@ struct device; | |||
141 | { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ | 141 | { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ |
142 | .invert = winvert, .kcontrol_news = wcontrols, \ | 142 | .invert = winvert, .kcontrol_news = wcontrols, \ |
143 | .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags} | 143 | .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags} |
144 | #define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \ | ||
145 | { .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \ | ||
146 | .invert = winvert, .kcontrol_news = NULL, .num_kcontrols = 0, \ | ||
147 | .event = wevent, .event_flags = wflags} | ||
148 | #define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \ | 144 | #define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \ |
149 | wevent, wflags) \ | 145 | wevent, wflags) \ |
150 | { .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \ | 146 | { .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \ |
@@ -324,6 +320,8 @@ struct snd_soc_dapm_path; | |||
324 | struct snd_soc_dapm_pin; | 320 | struct snd_soc_dapm_pin; |
325 | struct snd_soc_dapm_route; | 321 | struct snd_soc_dapm_route; |
326 | struct snd_soc_dapm_context; | 322 | struct snd_soc_dapm_context; |
323 | struct regulator; | ||
324 | struct snd_soc_dapm_widget_list; | ||
327 | 325 | ||
328 | int dapm_reg_event(struct snd_soc_dapm_widget *w, | 326 | int dapm_reg_event(struct snd_soc_dapm_widget *w, |
329 | struct snd_kcontrol *kcontrol, int event); | 327 | struct snd_kcontrol *kcontrol, int event); |
@@ -359,6 +357,10 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, | |||
359 | int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, | 357 | int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, |
360 | struct snd_soc_dai *dai); | 358 | struct snd_soc_dai *dai); |
361 | int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); | 359 | int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); |
360 | int snd_soc_dapm_new_pcm(struct snd_soc_card *card, | ||
361 | const struct snd_soc_pcm_stream *params, | ||
362 | struct snd_soc_dapm_widget *source, | ||
363 | struct snd_soc_dapm_widget *sink); | ||
362 | 364 | ||
363 | /* dapm path setup */ | 365 | /* dapm path setup */ |
364 | int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm); | 366 | int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm); |
@@ -369,8 +371,8 @@ int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm, | |||
369 | const struct snd_soc_dapm_route *route, int num); | 371 | const struct snd_soc_dapm_route *route, int num); |
370 | 372 | ||
371 | /* dapm events */ | 373 | /* dapm events */ |
372 | int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, | 374 | void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, |
373 | struct snd_soc_dai *dai, int event); | 375 | int event); |
374 | void snd_soc_dapm_shutdown(struct snd_soc_card *card); | 376 | void snd_soc_dapm_shutdown(struct snd_soc_card *card); |
375 | 377 | ||
376 | /* external DAPM widget events */ | 378 | /* external DAPM widget events */ |
@@ -402,6 +404,10 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec); | |||
402 | /* Mostly internal - should not normally be used */ | 404 | /* Mostly internal - should not normally be used */ |
403 | void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason); | 405 | void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason); |
404 | 406 | ||
407 | /* dapm path query */ | ||
408 | int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, | ||
409 | struct snd_soc_dapm_widget_list **list); | ||
410 | |||
405 | /* dapm widget types */ | 411 | /* dapm widget types */ |
406 | enum snd_soc_dapm_type { | 412 | enum snd_soc_dapm_type { |
407 | snd_soc_dapm_input = 0, /* input pin */ | 413 | snd_soc_dapm_input = 0, /* input pin */ |
@@ -430,6 +436,12 @@ enum snd_soc_dapm_type { | |||
430 | snd_soc_dapm_aif_out, /* audio interface output */ | 436 | snd_soc_dapm_aif_out, /* audio interface output */ |
431 | snd_soc_dapm_siggen, /* signal generator */ | 437 | snd_soc_dapm_siggen, /* signal generator */ |
432 | snd_soc_dapm_dai, /* link to DAI structure */ | 438 | snd_soc_dapm_dai, /* link to DAI structure */ |
439 | snd_soc_dapm_dai_link, /* link between two DAI structures */ | ||
440 | }; | ||
441 | |||
442 | enum snd_soc_dapm_subclass { | ||
443 | SND_SOC_DAPM_CLASS_INIT = 0, | ||
444 | SND_SOC_DAPM_CLASS_RUNTIME = 1, | ||
433 | }; | 445 | }; |
434 | 446 | ||
435 | /* | 447 | /* |
@@ -482,9 +494,11 @@ struct snd_soc_dapm_widget { | |||
482 | struct snd_soc_dapm_context *dapm; | 494 | struct snd_soc_dapm_context *dapm; |
483 | 495 | ||
484 | void *priv; /* widget specific data */ | 496 | void *priv; /* widget specific data */ |
497 | struct regulator *regulator; /* attached regulator */ | ||
498 | const struct snd_soc_pcm_stream *params; /* params for dai links */ | ||
485 | 499 | ||
486 | /* dapm control */ | 500 | /* dapm control */ |
487 | short reg; /* negative reg = no direct dapm */ | 501 | int reg; /* negative reg = no direct dapm */ |
488 | unsigned char shift; /* bits to shift */ | 502 | unsigned char shift; /* bits to shift */ |
489 | unsigned int saved_value; /* widget saved value */ | 503 | unsigned int saved_value; /* widget saved value */ |
490 | unsigned int value; /* widget current value */ | 504 | unsigned int value; /* widget current value */ |
diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h new file mode 100644 index 000000000000..04598f1efd77 --- /dev/null +++ b/include/sound/soc-dpcm.h | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | * linux/sound/soc-dpcm.h -- ALSA SoC Dynamic PCM Support | ||
3 | * | ||
4 | * Author: Liam Girdwood <lrg@ti.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __LINUX_SND_SOC_DPCM_H | ||
12 | #define __LINUX_SND_SOC_DPCM_H | ||
13 | |||
14 | #include <linux/list.h> | ||
15 | #include <sound/pcm.h> | ||
16 | |||
17 | struct snd_soc_pcm_runtime; | ||
18 | |||
19 | /* | ||
20 | * Types of runtime_update to perform. e.g. originated from FE PCM ops | ||
21 | * or audio route changes triggered by muxes/mixers. | ||
22 | */ | ||
23 | enum snd_soc_dpcm_update { | ||
24 | SND_SOC_DPCM_UPDATE_NO = 0, | ||
25 | SND_SOC_DPCM_UPDATE_BE, | ||
26 | SND_SOC_DPCM_UPDATE_FE, | ||
27 | }; | ||
28 | |||
29 | /* | ||
30 | * Dynamic PCM Frontend -> Backend link management states. | ||
31 | */ | ||
32 | enum snd_soc_dpcm_link_state { | ||
33 | SND_SOC_DPCM_LINK_STATE_NEW = 0, /* newly created link */ | ||
34 | SND_SOC_DPCM_LINK_STATE_FREE, /* link to be dismantled */ | ||
35 | }; | ||
36 | |||
37 | /* | ||
38 | * Dynamic PCM Frontend -> Backend link PCM states. | ||
39 | */ | ||
40 | enum snd_soc_dpcm_state { | ||
41 | SND_SOC_DPCM_STATE_NEW = 0, | ||
42 | SND_SOC_DPCM_STATE_OPEN, | ||
43 | SND_SOC_DPCM_STATE_HW_PARAMS, | ||
44 | SND_SOC_DPCM_STATE_PREPARE, | ||
45 | SND_SOC_DPCM_STATE_START, | ||
46 | SND_SOC_DPCM_STATE_STOP, | ||
47 | SND_SOC_DPCM_STATE_PAUSED, | ||
48 | SND_SOC_DPCM_STATE_SUSPEND, | ||
49 | SND_SOC_DPCM_STATE_HW_FREE, | ||
50 | SND_SOC_DPCM_STATE_CLOSE, | ||
51 | }; | ||
52 | |||
53 | /* | ||
54 | * Dynamic PCM trigger ordering. Triggering flexibility is required as some | ||
55 | * DSPs require triggering before/after their CPU platform and DAIs. | ||
56 | * | ||
57 | * i.e. some clients may want to manually order this call in their PCM | ||
58 | * trigger() whilst others will just use the regular core ordering. | ||
59 | */ | ||
60 | enum snd_soc_dpcm_trigger { | ||
61 | SND_SOC_DPCM_TRIGGER_PRE = 0, | ||
62 | SND_SOC_DPCM_TRIGGER_POST, | ||
63 | SND_SOC_DPCM_TRIGGER_BESPOKE, | ||
64 | }; | ||
65 | |||
66 | /* | ||
67 | * Dynamic PCM link | ||
68 | * This links together a FE and BE DAI at runtime and stores the link | ||
69 | * state information and the hw_params configuration. | ||
70 | */ | ||
71 | struct snd_soc_dpcm { | ||
72 | /* FE and BE DAIs*/ | ||
73 | struct snd_soc_pcm_runtime *be; | ||
74 | struct snd_soc_pcm_runtime *fe; | ||
75 | |||
76 | /* link state */ | ||
77 | enum snd_soc_dpcm_link_state state; | ||
78 | |||
79 | /* list of BE and FE for this DPCM link */ | ||
80 | struct list_head list_be; | ||
81 | struct list_head list_fe; | ||
82 | |||
83 | /* hw params for this link - may be different for each link */ | ||
84 | struct snd_pcm_hw_params hw_params; | ||
85 | #ifdef CONFIG_DEBUG_FS | ||
86 | struct dentry *debugfs_state; | ||
87 | #endif | ||
88 | }; | ||
89 | |||
90 | /* | ||
91 | * Dynamic PCM runtime data. | ||
92 | */ | ||
93 | struct snd_soc_dpcm_runtime { | ||
94 | struct list_head be_clients; | ||
95 | struct list_head fe_clients; | ||
96 | |||
97 | int users; | ||
98 | struct snd_pcm_runtime *runtime; | ||
99 | struct snd_pcm_hw_params hw_params; | ||
100 | |||
101 | /* state and update */ | ||
102 | enum snd_soc_dpcm_update runtime_update; | ||
103 | enum snd_soc_dpcm_state state; | ||
104 | }; | ||
105 | |||
106 | /* can this BE stop and free */ | ||
107 | int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, | ||
108 | struct snd_soc_pcm_runtime *be, int stream); | ||
109 | |||
110 | /* can this BE perform a hw_params() */ | ||
111 | int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, | ||
112 | struct snd_soc_pcm_runtime *be, int stream); | ||
113 | |||
114 | /* is the current PCM operation for this FE ? */ | ||
115 | int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream); | ||
116 | |||
117 | /* is the current PCM operation for this BE ? */ | ||
118 | int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe, | ||
119 | struct snd_soc_pcm_runtime *be, int stream); | ||
120 | |||
121 | /* get the substream for this BE */ | ||
122 | struct snd_pcm_substream * | ||
123 | snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream); | ||
124 | |||
125 | /* get the BE runtime state */ | ||
126 | enum snd_soc_dpcm_state | ||
127 | snd_soc_dpcm_be_get_state(struct snd_soc_pcm_runtime *be, int stream); | ||
128 | |||
129 | /* set the BE runtime state */ | ||
130 | void snd_soc_dpcm_be_set_state(struct snd_soc_pcm_runtime *be, int stream, | ||
131 | enum snd_soc_dpcm_state state); | ||
132 | |||
133 | /* internal use only */ | ||
134 | int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute); | ||
135 | int soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd); | ||
136 | int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *); | ||
137 | |||
138 | #endif | ||
diff --git a/include/sound/soc.h b/include/sound/soc.h index 2ebf7877c148..c703871f5f65 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -55,6 +55,18 @@ | |||
55 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ | 55 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ |
56 | .put = snd_soc_put_volsw, \ | 56 | .put = snd_soc_put_volsw, \ |
57 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | 57 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } |
58 | #define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \ | ||
59 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
60 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
61 | SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
62 | .tlv.p = (tlv_array),\ | ||
63 | .info = snd_soc_info_volsw, \ | ||
64 | .get = snd_soc_get_volsw_sx,\ | ||
65 | .put = snd_soc_put_volsw_sx, \ | ||
66 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
67 | {.reg = xreg, .rreg = xreg, \ | ||
68 | .shift = xshift, .rshift = xshift, \ | ||
69 | .max = xmax, .min = xmin} } | ||
58 | #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ | 70 | #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ |
59 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | 71 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ |
60 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ | 72 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ |
@@ -85,6 +97,18 @@ | |||
85 | .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ | 97 | .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ |
86 | .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ | 98 | .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ |
87 | xmax, xinvert) } | 99 | xmax, xinvert) } |
100 | #define SOC_DOUBLE_R_SX_TLV(xname, xreg, xrreg, xshift, xmin, xmax, tlv_array) \ | ||
101 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | ||
102 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
103 | SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
104 | .tlv.p = (tlv_array), \ | ||
105 | .info = snd_soc_info_volsw, \ | ||
106 | .get = snd_soc_get_volsw_sx, \ | ||
107 | .put = snd_soc_put_volsw_sx, \ | ||
108 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
109 | {.reg = xreg, .rreg = xrreg, \ | ||
110 | .shift = xshift, .rshift = xshift, \ | ||
111 | .max = xmax, .min = xmin} } | ||
88 | #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ | 112 | #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ |
89 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 113 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ |
90 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | 114 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
@@ -171,20 +195,6 @@ | |||
171 | .get = xhandler_get, .put = xhandler_put, \ | 195 | .get = xhandler_get, .put = xhandler_put, \ |
172 | .private_value = (unsigned long)&xenum } | 196 | .private_value = (unsigned long)&xenum } |
173 | 197 | ||
174 | #define SOC_DOUBLE_R_SX_TLV(xname, xreg_left, xreg_right, xshift,\ | ||
175 | xmin, xmax, tlv_array) \ | ||
176 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | ||
177 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
178 | SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
179 | .tlv.p = (tlv_array), \ | ||
180 | .info = snd_soc_info_volsw_2r_sx, \ | ||
181 | .get = snd_soc_get_volsw_2r_sx, \ | ||
182 | .put = snd_soc_put_volsw_2r_sx, \ | ||
183 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | ||
184 | {.reg = xreg_left, \ | ||
185 | .rreg = xreg_right, .shift = xshift, \ | ||
186 | .min = xmin, .max = xmax} } | ||
187 | |||
188 | #define SND_SOC_BYTES(xname, xbase, xregs) \ | 198 | #define SND_SOC_BYTES(xname, xbase, xregs) \ |
189 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 199 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
190 | .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ | 200 | .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ |
@@ -200,6 +210,19 @@ | |||
200 | {.base = xbase, .num_regs = xregs, \ | 210 | {.base = xbase, .num_regs = xregs, \ |
201 | .mask = xmask }) } | 211 | .mask = xmask }) } |
202 | 212 | ||
213 | #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ | ||
214 | xmin, xmax, xinvert) \ | ||
215 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | ||
216 | .info = snd_soc_info_xr_sx, .get = snd_soc_get_xr_sx, \ | ||
217 | .put = snd_soc_put_xr_sx, \ | ||
218 | .private_value = (unsigned long)&(struct soc_mreg_control) \ | ||
219 | {.regbase = xregbase, .regcount = xregcount, .nbits = xnbits, \ | ||
220 | .invert = xinvert, .min = xmin, .max = xmax} } | ||
221 | |||
222 | #define SOC_SINGLE_STROBE(xname, xreg, xshift, xinvert) \ | ||
223 | SOC_SINGLE_EXT(xname, xreg, xshift, 1, xinvert, \ | ||
224 | snd_soc_get_strobe, snd_soc_put_strobe) | ||
225 | |||
203 | /* | 226 | /* |
204 | * Simplified versions of above macros, declaring a struct and calculating | 227 | * Simplified versions of above macros, declaring a struct and calculating |
205 | * ARRAY_SIZE internally | 228 | * ARRAY_SIZE internally |
@@ -264,6 +287,7 @@ struct snd_soc_jack_zone; | |||
264 | struct snd_soc_jack_pin; | 287 | struct snd_soc_jack_pin; |
265 | struct snd_soc_cache_ops; | 288 | struct snd_soc_cache_ops; |
266 | #include <sound/soc-dapm.h> | 289 | #include <sound/soc-dapm.h> |
290 | #include <sound/soc-dpcm.h> | ||
267 | 291 | ||
268 | #ifdef CONFIG_GPIOLIB | 292 | #ifdef CONFIG_GPIOLIB |
269 | struct snd_soc_jack_gpio; | 293 | struct snd_soc_jack_gpio; |
@@ -288,6 +312,11 @@ enum snd_soc_pcm_subclass { | |||
288 | SND_SOC_PCM_CLASS_BE = 1, | 312 | SND_SOC_PCM_CLASS_BE = 1, |
289 | }; | 313 | }; |
290 | 314 | ||
315 | enum snd_soc_card_subclass { | ||
316 | SND_SOC_CARD_CLASS_INIT = 0, | ||
317 | SND_SOC_CARD_CLASS_RUNTIME = 1, | ||
318 | }; | ||
319 | |||
291 | int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id, | 320 | int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id, |
292 | int source, unsigned int freq, int dir); | 321 | int source, unsigned int freq, int dir); |
293 | int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source, | 322 | int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source, |
@@ -333,6 +362,11 @@ int snd_soc_platform_write(struct snd_soc_platform *platform, | |||
333 | unsigned int reg, unsigned int val); | 362 | unsigned int reg, unsigned int val); |
334 | int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); | 363 | int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); |
335 | 364 | ||
365 | struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card, | ||
366 | const char *dai_link, int stream); | ||
367 | struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card, | ||
368 | const char *dai_link); | ||
369 | |||
336 | /* Utility functions to get clock rates from various things */ | 370 | /* Utility functions to get clock rates from various things */ |
337 | int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); | 371 | int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); |
338 | int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params); | 372 | int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params); |
@@ -343,6 +377,9 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms); | |||
343 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, | 377 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, |
344 | const struct snd_pcm_hardware *hw); | 378 | const struct snd_pcm_hardware *hw); |
345 | 379 | ||
380 | int snd_soc_platform_trigger(struct snd_pcm_substream *substream, | ||
381 | int cmd, struct snd_soc_platform *platform); | ||
382 | |||
346 | /* Jack reporting */ | 383 | /* Jack reporting */ |
347 | int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, | 384 | int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, |
348 | struct snd_soc_jack *jack); | 385 | struct snd_soc_jack *jack); |
@@ -413,6 +450,10 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, | |||
413 | struct snd_ctl_elem_value *ucontrol); | 450 | struct snd_ctl_elem_value *ucontrol); |
414 | #define snd_soc_get_volsw_2r snd_soc_get_volsw | 451 | #define snd_soc_get_volsw_2r snd_soc_get_volsw |
415 | #define snd_soc_put_volsw_2r snd_soc_put_volsw | 452 | #define snd_soc_put_volsw_2r snd_soc_put_volsw |
453 | int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol, | ||
454 | struct snd_ctl_elem_value *ucontrol); | ||
455 | int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, | ||
456 | struct snd_ctl_elem_value *ucontrol); | ||
416 | int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol, | 457 | int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol, |
417 | struct snd_ctl_elem_info *uinfo); | 458 | struct snd_ctl_elem_info *uinfo); |
418 | int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol, | 459 | int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol, |
@@ -421,19 +462,22 @@ int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, | |||
421 | struct snd_ctl_elem_value *ucontrol); | 462 | struct snd_ctl_elem_value *ucontrol); |
422 | int snd_soc_limit_volume(struct snd_soc_codec *codec, | 463 | int snd_soc_limit_volume(struct snd_soc_codec *codec, |
423 | const char *name, int max); | 464 | const char *name, int max); |
424 | int snd_soc_info_volsw_2r_sx(struct snd_kcontrol *kcontrol, | ||
425 | struct snd_ctl_elem_info *uinfo); | ||
426 | int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol, | ||
427 | struct snd_ctl_elem_value *ucontrol); | ||
428 | int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol, | ||
429 | struct snd_ctl_elem_value *ucontrol); | ||
430 | int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, | 465 | int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, |
431 | struct snd_ctl_elem_info *uinfo); | 466 | struct snd_ctl_elem_info *uinfo); |
432 | int snd_soc_bytes_get(struct snd_kcontrol *kcontrol, | 467 | int snd_soc_bytes_get(struct snd_kcontrol *kcontrol, |
433 | struct snd_ctl_elem_value *ucontrol); | 468 | struct snd_ctl_elem_value *ucontrol); |
434 | int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, | 469 | int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, |
435 | struct snd_ctl_elem_value *ucontrol); | 470 | struct snd_ctl_elem_value *ucontrol); |
436 | 471 | int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, | |
472 | struct snd_ctl_elem_info *uinfo); | ||
473 | int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, | ||
474 | struct snd_ctl_elem_value *ucontrol); | ||
475 | int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol, | ||
476 | struct snd_ctl_elem_value *ucontrol); | ||
477 | int snd_soc_get_strobe(struct snd_kcontrol *kcontrol, | ||
478 | struct snd_ctl_elem_value *ucontrol); | ||
479 | int snd_soc_put_strobe(struct snd_kcontrol *kcontrol, | ||
480 | struct snd_ctl_elem_value *ucontrol); | ||
437 | 481 | ||
438 | /** | 482 | /** |
439 | * struct snd_soc_reg_access - Describes whether a given register is | 483 | * struct snd_soc_reg_access - Describes whether a given register is |
@@ -513,6 +557,7 @@ struct snd_soc_jack_gpio { | |||
513 | #endif | 557 | #endif |
514 | 558 | ||
515 | struct snd_soc_jack { | 559 | struct snd_soc_jack { |
560 | struct mutex mutex; | ||
516 | struct snd_jack *jack; | 561 | struct snd_jack *jack; |
517 | struct snd_soc_codec *codec; | 562 | struct snd_soc_codec *codec; |
518 | struct list_head pins; | 563 | struct list_head pins; |
@@ -711,6 +756,7 @@ struct snd_soc_platform_driver { | |||
711 | /* platform IO - used for platform DAPM */ | 756 | /* platform IO - used for platform DAPM */ |
712 | unsigned int (*read)(struct snd_soc_platform *, unsigned int); | 757 | unsigned int (*read)(struct snd_soc_platform *, unsigned int); |
713 | int (*write)(struct snd_soc_platform *, unsigned int, unsigned int); | 758 | int (*write)(struct snd_soc_platform *, unsigned int, unsigned int); |
759 | int (*bespoke_trigger)(struct snd_pcm_substream *, int); | ||
714 | }; | 760 | }; |
715 | 761 | ||
716 | struct snd_soc_platform { | 762 | struct snd_soc_platform { |
@@ -746,21 +792,36 @@ struct snd_soc_dai_link { | |||
746 | const char *cpu_dai_name; | 792 | const char *cpu_dai_name; |
747 | const struct device_node *cpu_dai_of_node; | 793 | const struct device_node *cpu_dai_of_node; |
748 | const char *codec_dai_name; | 794 | const char *codec_dai_name; |
795 | int be_id; /* optional ID for machine driver BE identification */ | ||
796 | |||
797 | const struct snd_soc_pcm_stream *params; | ||
749 | 798 | ||
750 | unsigned int dai_fmt; /* format to set on init */ | 799 | unsigned int dai_fmt; /* format to set on init */ |
751 | 800 | ||
801 | enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */ | ||
802 | |||
752 | /* Keep DAI active over suspend */ | 803 | /* Keep DAI active over suspend */ |
753 | unsigned int ignore_suspend:1; | 804 | unsigned int ignore_suspend:1; |
754 | 805 | ||
755 | /* Symmetry requirements */ | 806 | /* Symmetry requirements */ |
756 | unsigned int symmetric_rates:1; | 807 | unsigned int symmetric_rates:1; |
757 | 808 | ||
809 | /* Do not create a PCM for this DAI link (Backend link) */ | ||
810 | unsigned int no_pcm:1; | ||
811 | |||
812 | /* This DAI link can route to other DAI links at runtime (Frontend)*/ | ||
813 | unsigned int dynamic:1; | ||
814 | |||
758 | /* pmdown_time is ignored at stop */ | 815 | /* pmdown_time is ignored at stop */ |
759 | unsigned int ignore_pmdown_time:1; | 816 | unsigned int ignore_pmdown_time:1; |
760 | 817 | ||
761 | /* codec/machine specific init - e.g. add machine controls */ | 818 | /* codec/machine specific init - e.g. add machine controls */ |
762 | int (*init)(struct snd_soc_pcm_runtime *rtd); | 819 | int (*init)(struct snd_soc_pcm_runtime *rtd); |
763 | 820 | ||
821 | /* optional hw_params re-writing for BE and FE sync */ | ||
822 | int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd, | ||
823 | struct snd_pcm_hw_params *params); | ||
824 | |||
764 | /* machine stream operations */ | 825 | /* machine stream operations */ |
765 | struct snd_soc_ops *ops; | 826 | struct snd_soc_ops *ops; |
766 | }; | 827 | }; |
@@ -800,6 +861,7 @@ struct snd_soc_card { | |||
800 | 861 | ||
801 | struct list_head list; | 862 | struct list_head list; |
802 | struct mutex mutex; | 863 | struct mutex mutex; |
864 | struct mutex dapm_mutex; | ||
803 | 865 | ||
804 | bool instantiated; | 866 | bool instantiated; |
805 | 867 | ||
@@ -889,9 +951,11 @@ struct snd_soc_pcm_runtime { | |||
889 | enum snd_soc_pcm_subclass pcm_subclass; | 951 | enum snd_soc_pcm_subclass pcm_subclass; |
890 | struct snd_pcm_ops ops; | 952 | struct snd_pcm_ops ops; |
891 | 953 | ||
892 | unsigned int complete:1; | ||
893 | unsigned int dev_registered:1; | 954 | unsigned int dev_registered:1; |
894 | 955 | ||
956 | /* Dynamic PCM BE runtime data */ | ||
957 | struct snd_soc_dpcm_runtime dpcm[2]; | ||
958 | |||
895 | long pmdown_time; | 959 | long pmdown_time; |
896 | 960 | ||
897 | /* runtime devices */ | 961 | /* runtime devices */ |
@@ -902,6 +966,10 @@ struct snd_soc_pcm_runtime { | |||
902 | struct snd_soc_dai *cpu_dai; | 966 | struct snd_soc_dai *cpu_dai; |
903 | 967 | ||
904 | struct delayed_work delayed_work; | 968 | struct delayed_work delayed_work; |
969 | #ifdef CONFIG_DEBUG_FS | ||
970 | struct dentry *debugfs_dpcm_root; | ||
971 | struct dentry *debugfs_dpcm_state; | ||
972 | #endif | ||
905 | }; | 973 | }; |
906 | 974 | ||
907 | /* mixer control */ | 975 | /* mixer control */ |
@@ -916,6 +984,12 @@ struct soc_bytes { | |||
916 | u32 mask; | 984 | u32 mask; |
917 | }; | 985 | }; |
918 | 986 | ||
987 | /* multi register control */ | ||
988 | struct soc_mreg_control { | ||
989 | long min, max; | ||
990 | unsigned int regbase, regcount, nbits, invert; | ||
991 | }; | ||
992 | |||
919 | /* enumerated kcontrol */ | 993 | /* enumerated kcontrol */ |
920 | struct soc_enum { | 994 | struct soc_enum { |
921 | unsigned short reg; | 995 | unsigned short reg; |