aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/core.h8
-rw-r--r--include/sound/pxa2xx-lib.h7
-rw-r--r--include/sound/rcar_snd.h85
-rw-r--r--include/sound/soc-dapm.h201
-rw-r--r--include/sound/soc-dpcm.h2
-rw-r--r--include/sound/soc.h47
-rw-r--r--include/sound/tea575x-tuner.h78
7 files changed, 238 insertions, 190 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index c586617cfa0d..2a14f1f02d4f 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -27,6 +27,7 @@
27#include <linux/rwsem.h> /* struct rw_semaphore */ 27#include <linux/rwsem.h> /* struct rw_semaphore */
28#include <linux/pm.h> /* pm_message_t */ 28#include <linux/pm.h> /* pm_message_t */
29#include <linux/stringify.h> 29#include <linux/stringify.h>
30#include <linux/printk.h>
30 31
31/* number of supported soundcards */ 32/* number of supported soundcards */
32#ifdef CONFIG_SND_DYNAMIC_MINORS 33#ifdef CONFIG_SND_DYNAMIC_MINORS
@@ -376,6 +377,11 @@ void __snd_printk(unsigned int level, const char *file, int line,
376#define snd_BUG() WARN(1, "BUG?\n") 377#define snd_BUG() WARN(1, "BUG?\n")
377 378
378/** 379/**
380 * Suppress high rates of output when CONFIG_SND_DEBUG is enabled.
381 */
382#define snd_printd_ratelimit() printk_ratelimit()
383
384/**
379 * snd_BUG_ON - debugging check macro 385 * snd_BUG_ON - debugging check macro
380 * @cond: condition to evaluate 386 * @cond: condition to evaluate
381 * 387 *
@@ -398,6 +404,8 @@ static inline void _snd_printd(int level, const char *format, ...) {}
398 unlikely(__ret_warn_on); \ 404 unlikely(__ret_warn_on); \
399}) 405})
400 406
407static inline bool snd_printd_ratelimit(void) { return false; }
408
401#endif /* CONFIG_SND_DEBUG */ 409#endif /* CONFIG_SND_DEBUG */
402 410
403#ifdef CONFIG_SND_DEBUG_VERBOSE 411#ifdef CONFIG_SND_DEBUG_VERBOSE
diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h
index 2fd3d251d9a5..56e818e4a1cb 100644
--- a/include/sound/pxa2xx-lib.h
+++ b/include/sound/pxa2xx-lib.h
@@ -6,13 +6,6 @@
6 6
7/* PCM */ 7/* PCM */
8 8
9struct pxa2xx_pcm_dma_params {
10 char *name; /* stream identifier */
11 u32 dcmd; /* DMA descriptor dcmd field */
12 volatile u32 *drcmr; /* the DMA request channel to use */
13 u32 dev_addr; /* device physical address for DMA */
14};
15
16extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, 9extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
17 struct snd_pcm_hw_params *params); 10 struct snd_pcm_hw_params *params);
18extern int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream); 11extern int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream);
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
new file mode 100644
index 000000000000..fb0a312bcb81
--- /dev/null
+++ b/include/sound/rcar_snd.h
@@ -0,0 +1,85 @@
1/*
2 * Renesas R-Car SRU/SCU/SSIU/SSI support
3 *
4 * Copyright (C) 2013 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 RCAR_SND_H
13#define RCAR_SND_H
14
15#include <linux/sh_clk.h>
16
17#define RSND_GEN1_SRU 0
18#define RSND_GEN1_ADG 1
19#define RSND_GEN1_SSI 2
20
21#define RSND_GEN2_SRU 0
22#define RSND_GEN2_ADG 1
23#define RSND_GEN2_SSIU 2
24#define RSND_GEN2_SSI 3
25
26#define RSND_BASE_MAX 4
27
28/*
29 * flags
30 *
31 * 0xAB000000
32 *
33 * A : clock sharing settings
34 * B : SSI direction
35 */
36#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
37#define RSND_SSI_CLK_FROM_ADG (1 << 30) /* clock parent is master */
38#define RSND_SSI_SYNC (1 << 29) /* SSI34_sync etc */
39#define RSND_SSI_DEPENDENT (1 << 28) /* SSI needs SRU/SCU */
40
41#define RSND_SSI_PLAY (1 << 24)
42
43#define RSND_SSI_SET(_dai_id, _dma_id, _pio_irq, _flags) \
44{ .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
45#define RSND_SSI_UNUSED \
46{ .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 }
47
48struct rsnd_ssi_platform_info {
49 int dai_id;
50 int dma_id;
51 int pio_irq;
52 u32 flags;
53};
54
55/*
56 * flags
57 */
58#define RSND_SCU_USE_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */
59
60struct rsnd_scu_platform_info {
61 u32 flags;
62};
63
64/*
65 * flags
66 *
67 * 0x0000000A
68 *
69 * A : generation
70 */
71#define RSND_GEN_MASK (0xF << 0)
72#define RSND_GEN1 (1 << 0) /* fixme */
73#define RSND_GEN2 (2 << 0) /* fixme */
74
75struct rcar_snd_info {
76 u32 flags;
77 struct rsnd_ssi_platform_info *ssi_info;
78 int ssi_info_nr;
79 struct rsnd_scu_platform_info *scu_info;
80 int scu_info_nr;
81 int (*start)(int id);
82 int (*stop)(int id);
83};
84
85#endif
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 3e479f4e15f5..27a72d5d4b00 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -70,121 +70,144 @@ struct device;
70 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \ 70 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
71 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD} 71 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
72 72
73#define SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert) \
74 .reg = wreg, .mask = 1, .shift = wshift, \
75 .on_val = winvert ? 0 : 1, .off_val = winvert ? 1 : 0
76
73/* path domain */ 77/* path domain */
74#define SND_SOC_DAPM_PGA(wname, wreg, wshift, winvert,\ 78#define SND_SOC_DAPM_PGA(wname, wreg, wshift, winvert,\
75 wcontrols, wncontrols) \ 79 wcontrols, wncontrols) \
76{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 80{ .id = snd_soc_dapm_pga, .name = wname, \
77 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = wncontrols} 81 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
82 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols}
78#define SND_SOC_DAPM_OUT_DRV(wname, wreg, wshift, winvert,\ 83#define SND_SOC_DAPM_OUT_DRV(wname, wreg, wshift, winvert,\
79 wcontrols, wncontrols) \ 84 wcontrols, wncontrols) \
80{ .id = snd_soc_dapm_out_drv, .name = wname, .reg = wreg, .shift = wshift, \ 85{ .id = snd_soc_dapm_out_drv, .name = wname, \
81 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = wncontrols} 86 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
87 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols}
82#define SND_SOC_DAPM_MIXER(wname, wreg, wshift, winvert, \ 88#define SND_SOC_DAPM_MIXER(wname, wreg, wshift, winvert, \
83 wcontrols, wncontrols)\ 89 wcontrols, wncontrols)\
84{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 90{ .id = snd_soc_dapm_mixer, .name = wname, \
85 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = wncontrols} 91 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
92 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols}
86#define SND_SOC_DAPM_MIXER_NAMED_CTL(wname, wreg, wshift, winvert, \ 93#define SND_SOC_DAPM_MIXER_NAMED_CTL(wname, wreg, wshift, winvert, \
87 wcontrols, wncontrols)\ 94 wcontrols, wncontrols)\
88{ .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \ 95{ .id = snd_soc_dapm_mixer_named_ctl, .name = wname, \
89 .shift = wshift, .invert = winvert, .kcontrol_news = wcontrols, \ 96 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
90 .num_kcontrols = wncontrols} 97 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols}
91#define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \ 98#define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \
92{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \ 99{ .id = snd_soc_dapm_micbias, .name = wname, \
93 .invert = winvert, .kcontrol_news = NULL, .num_kcontrols = 0} 100 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
101 .kcontrol_news = NULL, .num_kcontrols = 0}
94#define SND_SOC_DAPM_SWITCH(wname, wreg, wshift, winvert, wcontrols) \ 102#define SND_SOC_DAPM_SWITCH(wname, wreg, wshift, winvert, wcontrols) \
95{ .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \ 103{ .id = snd_soc_dapm_switch, .name = wname, \
96 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = 1} 104 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
105 .kcontrol_news = wcontrols, .num_kcontrols = 1}
97#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \ 106#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \
98{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \ 107{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, \
99 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = 1} 108 .kcontrol_news = wcontrols, .num_kcontrols = 1}
100#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \ 109#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \
101{ .id = snd_soc_dapm_virt_mux, .name = wname, .reg = wreg, .shift = wshift, \ 110{ .id = snd_soc_dapm_virt_mux, .name = wname, \
102 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = 1} 111 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
112 .kcontrol_news = wcontrols, .num_kcontrols = 1}
103#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \ 113#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \
104{ .id = snd_soc_dapm_value_mux, .name = wname, .reg = wreg, \ 114{ .id = snd_soc_dapm_value_mux, .name = wname, \
105 .shift = wshift, .invert = winvert, .kcontrol_news = wcontrols, \ 115 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
106 .num_kcontrols = 1} 116 .kcontrol_news = wcontrols, .num_kcontrols = 1}
107 117
108/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ 118/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
109#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ 119#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\
110 wcontrols) \ 120 wcontrols) \
111{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 121{ .id = snd_soc_dapm_pga, .name = wname, \
112 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)} 122 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
123 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)}
113#define SOC_MIXER_ARRAY(wname, wreg, wshift, winvert, \ 124#define SOC_MIXER_ARRAY(wname, wreg, wshift, winvert, \
114 wcontrols)\ 125 wcontrols)\
115{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 126{ .id = snd_soc_dapm_mixer, .name = wname, \
116 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)} 127 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
128 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)}
117#define SOC_MIXER_NAMED_CTL_ARRAY(wname, wreg, wshift, winvert, \ 129#define SOC_MIXER_NAMED_CTL_ARRAY(wname, wreg, wshift, winvert, \
118 wcontrols)\ 130 wcontrols)\
119{ .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \ 131{ .id = snd_soc_dapm_mixer_named_ctl, .name = wname, \
120 .shift = wshift, .invert = winvert, .kcontrol_news = wcontrols, \ 132 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
121 .num_kcontrols = ARRAY_SIZE(wcontrols)} 133 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)}
122 134
123/* path domain with event - event handler must return 0 for success */ 135/* path domain with event - event handler must return 0 for success */
124#define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \ 136#define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \
125 wncontrols, wevent, wflags) \ 137 wncontrols, wevent, wflags) \
126{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 138{ .id = snd_soc_dapm_pga, .name = wname, \
127 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \ 139 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
140 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \
128 .event = wevent, .event_flags = wflags} 141 .event = wevent, .event_flags = wflags}
129#define SND_SOC_DAPM_OUT_DRV_E(wname, wreg, wshift, winvert, wcontrols, \ 142#define SND_SOC_DAPM_OUT_DRV_E(wname, wreg, wshift, winvert, wcontrols, \
130 wncontrols, wevent, wflags) \ 143 wncontrols, wevent, wflags) \
131{ .id = snd_soc_dapm_out_drv, .name = wname, .reg = wreg, .shift = wshift, \ 144{ .id = snd_soc_dapm_out_drv, .name = wname, \
132 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \ 145 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
146 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \
133 .event = wevent, .event_flags = wflags} 147 .event = wevent, .event_flags = wflags}
134#define SND_SOC_DAPM_MIXER_E(wname, wreg, wshift, winvert, wcontrols, \ 148#define SND_SOC_DAPM_MIXER_E(wname, wreg, wshift, winvert, wcontrols, \
135 wncontrols, wevent, wflags) \ 149 wncontrols, wevent, wflags) \
136{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 150{ .id = snd_soc_dapm_mixer, .name = wname, \
137 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \ 151 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
152 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \
138 .event = wevent, .event_flags = wflags} 153 .event = wevent, .event_flags = wflags}
139#define SND_SOC_DAPM_MIXER_NAMED_CTL_E(wname, wreg, wshift, winvert, \ 154#define SND_SOC_DAPM_MIXER_NAMED_CTL_E(wname, wreg, wshift, winvert, \
140 wcontrols, wncontrols, wevent, wflags) \ 155 wcontrols, wncontrols, wevent, wflags) \
141{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 156{ .id = snd_soc_dapm_mixer, .name = wname, \
142 .invert = winvert, .kcontrol_news = wcontrols, \ 157 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
158 .kcontrol_news = wcontrols, \
143 .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags} 159 .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags}
144#define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \ 160#define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \
145 wevent, wflags) \ 161 wevent, wflags) \
146{ .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \ 162{ .id = snd_soc_dapm_switch, .name = wname, \
147 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = 1, \ 163 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
164 .kcontrol_news = wcontrols, .num_kcontrols = 1, \
148 .event = wevent, .event_flags = wflags} 165 .event = wevent, .event_flags = wflags}
149#define SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, \ 166#define SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
150 wevent, wflags) \ 167 wevent, wflags) \
151{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \ 168{ .id = snd_soc_dapm_mux, .name = wname, \
152 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = 1, \ 169 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
170 .kcontrol_news = wcontrols, .num_kcontrols = 1, \
153 .event = wevent, .event_flags = wflags} 171 .event = wevent, .event_flags = wflags}
154#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \ 172#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
155 wevent, wflags) \ 173 wevent, wflags) \
156{ .id = snd_soc_dapm_virt_mux, .name = wname, .reg = wreg, .shift = wshift, \ 174{ .id = snd_soc_dapm_virt_mux, .name = wname, \
157 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = 1, \ 175 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
176 .kcontrol_news = wcontrols, .num_kcontrols = 1, \
158 .event = wevent, .event_flags = wflags} 177 .event = wevent, .event_flags = wflags}
159 178
160/* additional sequencing control within an event type */ 179/* additional sequencing control within an event type */
161#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \ 180#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \
162 wevent, wflags) \ 181 wevent, wflags) \
163{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 182{ .id = snd_soc_dapm_pga, .name = wname, \
164 .invert = winvert, .event = wevent, .event_flags = wflags, \ 183 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
184 .event = wevent, .event_flags = wflags, \
165 .subseq = wsubseq} 185 .subseq = wsubseq}
166#define SND_SOC_DAPM_SUPPLY_S(wname, wsubseq, wreg, wshift, winvert, wevent, \ 186#define SND_SOC_DAPM_SUPPLY_S(wname, wsubseq, wreg, wshift, winvert, wevent, \
167 wflags) \ 187 wflags) \
168{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ 188{ .id = snd_soc_dapm_supply, .name = wname, \
169 .shift = wshift, .invert = winvert, .event = wevent, \ 189 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
170 .event_flags = wflags, .subseq = wsubseq} 190 .event = wevent, .event_flags = wflags, .subseq = wsubseq}
171 191
172/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ 192/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
173#define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ 193#define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \
174 wevent, wflags) \ 194 wevent, wflags) \
175{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 195{ .id = snd_soc_dapm_pga, .name = wname, \
176 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \ 196 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
197 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \
177 .event = wevent, .event_flags = wflags} 198 .event = wevent, .event_flags = wflags}
178#define SOC_MIXER_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ 199#define SOC_MIXER_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \
179 wevent, wflags) \ 200 wevent, wflags) \
180{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 201{ .id = snd_soc_dapm_mixer, .name = wname, \
181 .invert = winvert, .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \ 202 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
203 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \
182 .event = wevent, .event_flags = wflags} 204 .event = wevent, .event_flags = wflags}
183#define SOC_MIXER_NAMED_CTL_E_ARRAY(wname, wreg, wshift, winvert, \ 205#define SOC_MIXER_NAMED_CTL_E_ARRAY(wname, wreg, wshift, winvert, \
184 wcontrols, wevent, wflags) \ 206 wcontrols, wevent, wflags) \
185{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 207{ .id = snd_soc_dapm_mixer, .name = wname, \
186 .invert = winvert, .kcontrol_news = wcontrols, \ 208 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
187 .num_kcontrols = ARRAY_SIZE(wcontrols), .event = wevent, .event_flags = wflags} 209 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \
210 .event = wevent, .event_flags = wflags}
188 211
189/* events that are pre and post DAPM */ 212/* events that are pre and post DAPM */
190#define SND_SOC_DAPM_PRE(wname, wevent) \ 213#define SND_SOC_DAPM_PRE(wname, wevent) \
@@ -199,35 +222,36 @@ struct device;
199/* stream domain */ 222/* stream domain */
200#define SND_SOC_DAPM_AIF_IN(wname, stname, wslot, wreg, wshift, winvert) \ 223#define SND_SOC_DAPM_AIF_IN(wname, stname, wslot, wreg, wshift, winvert) \
201{ .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \ 224{ .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
202 .reg = wreg, .shift = wshift, .invert = winvert } 225 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
203#define SND_SOC_DAPM_AIF_IN_E(wname, stname, wslot, wreg, wshift, winvert, \ 226#define SND_SOC_DAPM_AIF_IN_E(wname, stname, wslot, wreg, wshift, winvert, \
204 wevent, wflags) \ 227 wevent, wflags) \
205{ .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \ 228{ .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
206 .reg = wreg, .shift = wshift, .invert = winvert, \ 229 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
207 .event = wevent, .event_flags = wflags } 230 .event = wevent, .event_flags = wflags }
208#define SND_SOC_DAPM_AIF_OUT(wname, stname, wslot, wreg, wshift, winvert) \ 231#define SND_SOC_DAPM_AIF_OUT(wname, stname, wslot, wreg, wshift, winvert) \
209{ .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \ 232{ .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
210 .reg = wreg, .shift = wshift, .invert = winvert } 233 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
211#define SND_SOC_DAPM_AIF_OUT_E(wname, stname, wslot, wreg, wshift, winvert, \ 234#define SND_SOC_DAPM_AIF_OUT_E(wname, stname, wslot, wreg, wshift, winvert, \
212 wevent, wflags) \ 235 wevent, wflags) \
213{ .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \ 236{ .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
214 .reg = wreg, .shift = wshift, .invert = winvert, \ 237 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
215 .event = wevent, .event_flags = wflags } 238 .event = wevent, .event_flags = wflags }
216#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \ 239#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
217{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \ 240{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, \
218 .shift = wshift, .invert = winvert} 241 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert) }
219#define SND_SOC_DAPM_DAC_E(wname, stname, wreg, wshift, winvert, \ 242#define SND_SOC_DAPM_DAC_E(wname, stname, wreg, wshift, winvert, \
220 wevent, wflags) \ 243 wevent, wflags) \
221{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \ 244{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, \
222 .shift = wshift, .invert = winvert, \ 245 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
223 .event = wevent, .event_flags = wflags} 246 .event = wevent, .event_flags = wflags}
247
224#define SND_SOC_DAPM_ADC(wname, stname, wreg, wshift, winvert) \ 248#define SND_SOC_DAPM_ADC(wname, stname, wreg, wshift, winvert) \
225{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \ 249{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, \
226 .shift = wshift, .invert = winvert} 250 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
227#define SND_SOC_DAPM_ADC_E(wname, stname, wreg, wshift, winvert, \ 251#define SND_SOC_DAPM_ADC_E(wname, stname, wreg, wshift, winvert, \
228 wevent, wflags) \ 252 wevent, wflags) \
229{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \ 253{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, \
230 .shift = wshift, .invert = winvert, \ 254 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
231 .event = wevent, .event_flags = wflags} 255 .event = wevent, .event_flags = wflags}
232#define SND_SOC_DAPM_CLOCK_SUPPLY(wname) \ 256#define SND_SOC_DAPM_CLOCK_SUPPLY(wname) \
233{ .id = snd_soc_dapm_clock_supply, .name = wname, \ 257{ .id = snd_soc_dapm_clock_supply, .name = wname, \
@@ -241,14 +265,14 @@ struct device;
241 .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \ 265 .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \
242 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD} 266 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD}
243#define SND_SOC_DAPM_SUPPLY(wname, wreg, wshift, winvert, wevent, wflags) \ 267#define SND_SOC_DAPM_SUPPLY(wname, wreg, wshift, winvert, wevent, wflags) \
244{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ 268{ .id = snd_soc_dapm_supply, .name = wname, \
245 .shift = wshift, .invert = winvert, .event = wevent, \ 269 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
246 .event_flags = wflags} 270 .event = wevent, .event_flags = wflags}
247#define SND_SOC_DAPM_REGULATOR_SUPPLY(wname, wdelay, wflags) \ 271#define SND_SOC_DAPM_REGULATOR_SUPPLY(wname, wdelay, wflags) \
248{ .id = snd_soc_dapm_regulator_supply, .name = wname, \ 272{ .id = snd_soc_dapm_regulator_supply, .name = wname, \
249 .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \ 273 .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \
250 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD, \ 274 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD, \
251 .invert = wflags} 275 .on_val = wflags}
252 276
253 277
254/* dapm kcontrol types */ 278/* dapm kcontrol types */
@@ -256,14 +280,26 @@ struct device;
256{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 280{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
257 .info = snd_soc_info_volsw, \ 281 .info = snd_soc_info_volsw, \
258 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 282 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
259 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 283 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
284#define SOC_DAPM_SINGLE_AUTODISABLE(xname, reg, shift, max, invert) \
285{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
286 .info = snd_soc_info_volsw, \
287 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
288 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) }
260#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ 289#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
261{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 290{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
262 .info = snd_soc_info_volsw, \ 291 .info = snd_soc_info_volsw, \
263 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 292 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
264 .tlv.p = (tlv_array), \ 293 .tlv.p = (tlv_array), \
265 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 294 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
266 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 295 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
296#define SOC_DAPM_SINGLE_TLV_AUTODISABLE(xname, reg, shift, max, invert, tlv_array) \
297{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
298 .info = snd_soc_info_volsw, \
299 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
300 .tlv.p = (tlv_array), \
301 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
302 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
267#define SOC_DAPM_ENUM(xname, xenum) \ 303#define SOC_DAPM_ENUM(xname, xenum) \
268{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 304{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
269 .info = snd_soc_info_enum_double, \ 305 .info = snd_soc_info_enum_double, \
@@ -333,6 +369,7 @@ struct snd_soc_dapm_route;
333struct snd_soc_dapm_context; 369struct snd_soc_dapm_context;
334struct regulator; 370struct regulator;
335struct snd_soc_dapm_widget_list; 371struct snd_soc_dapm_widget_list;
372struct snd_soc_dapm_update;
336 373
337int dapm_reg_event(struct snd_soc_dapm_widget *w, 374int dapm_reg_event(struct snd_soc_dapm_widget *w,
338 struct snd_kcontrol *kcontrol, int event); 375 struct snd_kcontrol *kcontrol, int event);
@@ -376,7 +413,7 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
376 struct snd_soc_dapm_widget *sink); 413 struct snd_soc_dapm_widget *sink);
377 414
378/* dapm path setup */ 415/* dapm path setup */
379int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm); 416int snd_soc_dapm_new_widgets(struct snd_soc_card *card);
380void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm); 417void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm);
381int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, 418int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
382 const struct snd_soc_dapm_route *route, int num); 419 const struct snd_soc_dapm_route *route, int num);
@@ -391,10 +428,12 @@ void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
391void snd_soc_dapm_shutdown(struct snd_soc_card *card); 428void snd_soc_dapm_shutdown(struct snd_soc_card *card);
392 429
393/* external DAPM widget events */ 430/* external DAPM widget events */
394int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, 431int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
395 struct snd_kcontrol *kcontrol, int connect); 432 struct snd_kcontrol *kcontrol, int connect,
396int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget, 433 struct snd_soc_dapm_update *update);
397 struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e); 434int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
435 struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e,
436 struct snd_soc_dapm_update *update);
398 437
399/* dapm sys fs - used by the core */ 438/* dapm sys fs - used by the core */
400int snd_soc_dapm_sys_add(struct device *dev); 439int snd_soc_dapm_sys_add(struct device *dev);
@@ -424,6 +463,8 @@ void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);
424int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, 463int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
425 struct snd_soc_dapm_widget_list **list); 464 struct snd_soc_dapm_widget_list **list);
426 465
466struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol);
467
427/* dapm widget types */ 468/* dapm widget types */
428enum snd_soc_dapm_type { 469enum snd_soc_dapm_type {
429 snd_soc_dapm_input = 0, /* input pin */ 470 snd_soc_dapm_input = 0, /* input pin */
@@ -455,6 +496,7 @@ enum snd_soc_dapm_type {
455 snd_soc_dapm_dai_in, /* link to DAI structure */ 496 snd_soc_dapm_dai_in, /* link to DAI structure */
456 snd_soc_dapm_dai_out, 497 snd_soc_dapm_dai_out,
457 snd_soc_dapm_dai_link, /* link between two DAI structures */ 498 snd_soc_dapm_dai_link, /* link between two DAI structures */
499 snd_soc_dapm_kcontrol, /* Auto-disabled kcontrol */
458}; 500};
459 501
460enum snd_soc_dapm_subclass { 502enum snd_soc_dapm_subclass {
@@ -485,7 +527,6 @@ struct snd_soc_dapm_path {
485 /* source (input) and sink (output) widgets */ 527 /* source (input) and sink (output) widgets */
486 struct snd_soc_dapm_widget *source; 528 struct snd_soc_dapm_widget *source;
487 struct snd_soc_dapm_widget *sink; 529 struct snd_soc_dapm_widget *sink;
488 struct snd_kcontrol *kcontrol;
489 530
490 /* status */ 531 /* status */
491 u32 connect:1; /* source and sink widgets are connected */ 532 u32 connect:1; /* source and sink widgets are connected */
@@ -498,6 +539,7 @@ struct snd_soc_dapm_path {
498 539
499 struct list_head list_source; 540 struct list_head list_source;
500 struct list_head list_sink; 541 struct list_head list_sink;
542 struct list_head list_kcontrol;
501 struct list_head list; 543 struct list_head list;
502}; 544};
503 545
@@ -518,12 +560,10 @@ struct snd_soc_dapm_widget {
518 /* dapm control */ 560 /* dapm control */
519 int reg; /* negative reg = no direct dapm */ 561 int reg; /* negative reg = no direct dapm */
520 unsigned char shift; /* bits to shift */ 562 unsigned char shift; /* bits to shift */
521 unsigned int value; /* widget current value */
522 unsigned int mask; /* non-shifted mask */ 563 unsigned int mask; /* non-shifted mask */
523 unsigned int on_val; /* on state value */ 564 unsigned int on_val; /* on state value */
524 unsigned int off_val; /* off state value */ 565 unsigned int off_val; /* off state value */
525 unsigned char power:1; /* block power status */ 566 unsigned char power:1; /* block power status */
526 unsigned char invert:1; /* invert the power bit */
527 unsigned char active:1; /* active stream on DAC, ADC's */ 567 unsigned char active:1; /* active stream on DAC, ADC's */
528 unsigned char connected:1; /* connected codec pin */ 568 unsigned char connected:1; /* connected codec pin */
529 unsigned char new:1; /* cnew complete */ 569 unsigned char new:1; /* cnew complete */
@@ -559,7 +599,6 @@ struct snd_soc_dapm_widget {
559}; 599};
560 600
561struct snd_soc_dapm_update { 601struct snd_soc_dapm_update {
562 struct snd_soc_dapm_widget *widget;
563 struct snd_kcontrol *kcontrol; 602 struct snd_kcontrol *kcontrol;
564 int reg; 603 int reg;
565 int mask; 604 int mask;
@@ -573,8 +612,6 @@ struct snd_soc_dapm_context {
573 struct delayed_work delayed_work; 612 struct delayed_work delayed_work;
574 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ 613 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
575 614
576 struct snd_soc_dapm_update *update;
577
578 void (*seq_notifier)(struct snd_soc_dapm_context *, 615 void (*seq_notifier)(struct snd_soc_dapm_context *,
579 enum snd_soc_dapm_type, int); 616 enum snd_soc_dapm_type, int);
580 617
diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
index 04598f1efd77..047d657c331c 100644
--- a/include/sound/soc-dpcm.h
+++ b/include/sound/soc-dpcm.h
@@ -133,6 +133,6 @@ void snd_soc_dpcm_be_set_state(struct snd_soc_pcm_runtime *be, int stream,
133/* internal use only */ 133/* internal use only */
134int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute); 134int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute);
135int soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd); 135int soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd);
136int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *); 136int soc_dpcm_runtime_update(struct snd_soc_card *);
137 137
138#endif 138#endif
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 6eabee7ec15a..d22cb0a06feb 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -30,13 +30,13 @@
30/* 30/*
31 * Convenience kcontrol builders 31 * Convenience kcontrol builders
32 */ 32 */
33#define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert) \ 33#define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert, xautodisable) \
34 ((unsigned long)&(struct soc_mixer_control) \ 34 ((unsigned long)&(struct soc_mixer_control) \
35 {.reg = xreg, .rreg = xreg, .shift = shift_left, \ 35 {.reg = xreg, .rreg = xreg, .shift = shift_left, \
36 .rshift = shift_right, .max = xmax, .platform_max = xmax, \ 36 .rshift = shift_right, .max = xmax, .platform_max = xmax, \
37 .invert = xinvert}) 37 .invert = xinvert, .autodisable = xautodisable})
38#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \ 38#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \
39 SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert) 39 SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert, xautodisable)
40#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ 40#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
41 ((unsigned long)&(struct soc_mixer_control) \ 41 ((unsigned long)&(struct soc_mixer_control) \
42 {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert}) 42 {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert})
@@ -52,7 +52,7 @@
52{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 52{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
53 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 53 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
54 .put = snd_soc_put_volsw, \ 54 .put = snd_soc_put_volsw, \
55 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 55 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
56#define SOC_SINGLE_RANGE(xname, xreg, xshift, xmin, xmax, xinvert) \ 56#define SOC_SINGLE_RANGE(xname, xreg, xshift, xmin, xmax, xinvert) \
57{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 57{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
58 .info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \ 58 .info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \
@@ -68,7 +68,7 @@
68 .tlv.p = (tlv_array), \ 68 .tlv.p = (tlv_array), \
69 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 69 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
70 .put = snd_soc_put_volsw, \ 70 .put = snd_soc_put_volsw, \
71 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 71 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
72#define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \ 72#define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \
73{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 73{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
74 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 74 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
@@ -97,7 +97,7 @@
97 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 97 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
98 .put = snd_soc_put_volsw, \ 98 .put = snd_soc_put_volsw, \
99 .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \ 99 .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
100 max, invert) } 100 max, invert, 0) }
101#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \ 101#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
102{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 102{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
103 .info = snd_soc_info_volsw, \ 103 .info = snd_soc_info_volsw, \
@@ -119,7 +119,7 @@
119 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 119 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
120 .put = snd_soc_put_volsw, \ 120 .put = snd_soc_put_volsw, \
121 .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \ 121 .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
122 max, invert) } 122 max, invert, 0) }
123#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ 123#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
124{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 124{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
125 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 125 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -190,14 +190,14 @@
190{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 190{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
191 .info = snd_soc_info_volsw, \ 191 .info = snd_soc_info_volsw, \
192 .get = xhandler_get, .put = xhandler_put, \ 192 .get = xhandler_get, .put = xhandler_put, \
193 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) } 193 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, 0) }
194#define SOC_DOUBLE_EXT(xname, reg, shift_left, shift_right, max, invert,\ 194#define SOC_DOUBLE_EXT(xname, reg, shift_left, shift_right, max, invert,\
195 xhandler_get, xhandler_put) \ 195 xhandler_get, xhandler_put) \
196{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 196{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
197 .info = snd_soc_info_volsw, \ 197 .info = snd_soc_info_volsw, \
198 .get = xhandler_get, .put = xhandler_put, \ 198 .get = xhandler_get, .put = xhandler_put, \
199 .private_value = \ 199 .private_value = \
200 SOC_DOUBLE_VALUE(reg, shift_left, shift_right, max, invert) } 200 SOC_DOUBLE_VALUE(reg, shift_left, shift_right, max, invert, 0) }
201#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\ 201#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
202 xhandler_get, xhandler_put, tlv_array) \ 202 xhandler_get, xhandler_put, tlv_array) \
203{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 203{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -206,7 +206,7 @@
206 .tlv.p = (tlv_array), \ 206 .tlv.p = (tlv_array), \
207 .info = snd_soc_info_volsw, \ 207 .info = snd_soc_info_volsw, \
208 .get = xhandler_get, .put = xhandler_put, \ 208 .get = xhandler_get, .put = xhandler_put, \
209 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) } 209 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, 0) }
210#define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\ 210#define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\
211 xhandler_get, xhandler_put, tlv_array) \ 211 xhandler_get, xhandler_put, tlv_array) \
212{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 212{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@ -216,7 +216,7 @@
216 .info = snd_soc_info_volsw, \ 216 .info = snd_soc_info_volsw, \
217 .get = xhandler_get, .put = xhandler_put, \ 217 .get = xhandler_get, .put = xhandler_put, \
218 .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \ 218 .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
219 xmax, xinvert) } 219 xmax, xinvert, 0) }
220#define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\ 220#define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
221 xhandler_get, xhandler_put, tlv_array) \ 221 xhandler_get, xhandler_put, tlv_array) \
222{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 222{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@ -234,7 +234,7 @@
234 .private_value = xdata } 234 .private_value = xdata }
235#define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \ 235#define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
236{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 236{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
237 .info = snd_soc_info_enum_ext, \ 237 .info = snd_soc_info_enum_double, \
238 .get = xhandler_get, .put = xhandler_put, \ 238 .get = xhandler_get, .put = xhandler_put, \
239 .private_value = (unsigned long)&xenum } 239 .private_value = (unsigned long)&xenum }
240 240
@@ -468,6 +468,8 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
468void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); 468void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
469 469
470int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops); 470int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops);
471int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops,
472 struct platform_device *pdev);
471 473
472/* 474/*
473 *Controls 475 *Controls
@@ -475,6 +477,8 @@ int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops);
475struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, 477struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
476 void *data, const char *long_name, 478 void *data, const char *long_name,
477 const char *prefix); 479 const char *prefix);
480struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
481 const char *name);
478int snd_soc_add_codec_controls(struct snd_soc_codec *codec, 482int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
479 const struct snd_kcontrol_new *controls, int num_controls); 483 const struct snd_kcontrol_new *controls, int num_controls);
480int snd_soc_add_platform_controls(struct snd_soc_platform *platform, 484int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
@@ -485,8 +489,6 @@ int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
485 const struct snd_kcontrol_new *controls, int num_controls); 489 const struct snd_kcontrol_new *controls, int num_controls);
486int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, 490int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
487 struct snd_ctl_elem_info *uinfo); 491 struct snd_ctl_elem_info *uinfo);
488int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
489 struct snd_ctl_elem_info *uinfo);
490int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol, 492int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
491 struct snd_ctl_elem_value *ucontrol); 493 struct snd_ctl_elem_value *ucontrol);
492int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, 494int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
@@ -497,8 +499,6 @@ int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
497 struct snd_ctl_elem_value *ucontrol); 499 struct snd_ctl_elem_value *ucontrol);
498int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, 500int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
499 struct snd_ctl_elem_info *uinfo); 501 struct snd_ctl_elem_info *uinfo);
500int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol,
501 struct snd_ctl_elem_info *uinfo);
502#define snd_soc_info_bool_ext snd_ctl_boolean_mono_info 502#define snd_soc_info_bool_ext snd_ctl_boolean_mono_info
503int snd_soc_get_volsw(struct snd_kcontrol *kcontrol, 503int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
504 struct snd_ctl_elem_value *ucontrol); 504 struct snd_ctl_elem_value *ucontrol);
@@ -697,7 +697,6 @@ struct snd_soc_codec {
697 unsigned int probed:1; /* Codec has been probed */ 697 unsigned int probed:1; /* Codec has been probed */
698 unsigned int ac97_registered:1; /* Codec has been AC97 registered */ 698 unsigned int ac97_registered:1; /* Codec has been AC97 registered */
699 unsigned int ac97_created:1; /* Codec has been created by SoC */ 699 unsigned int ac97_created:1; /* Codec has been created by SoC */
700 unsigned int sysfs_registered:1; /* codec has been sysfs registered */
701 unsigned int cache_init:1; /* codec cache has been initialized */ 700 unsigned int cache_init:1; /* codec cache has been initialized */
702 unsigned int using_regmap:1; /* using regmap access */ 701 unsigned int using_regmap:1; /* using regmap access */
703 u32 cache_only; /* Suppress writes to hardware */ 702 u32 cache_only; /* Suppress writes to hardware */
@@ -705,7 +704,6 @@ struct snd_soc_codec {
705 704
706 /* codec IO */ 705 /* codec IO */
707 void *control_data; /* codec control (i2c/3wire) data */ 706 void *control_data; /* codec control (i2c/3wire) data */
708 enum snd_soc_control_type control_type;
709 hw_write_t hw_write; 707 hw_write_t hw_write;
710 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int); 708 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
711 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 709 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
@@ -724,7 +722,6 @@ struct snd_soc_codec {
724#ifdef CONFIG_DEBUG_FS 722#ifdef CONFIG_DEBUG_FS
725 struct dentry *debugfs_codec_root; 723 struct dentry *debugfs_codec_root;
726 struct dentry *debugfs_reg; 724 struct dentry *debugfs_reg;
727 struct dentry *debugfs_dapm;
728#endif 725#endif
729}; 726};
730 727
@@ -849,7 +846,6 @@ struct snd_soc_platform {
849 846
850#ifdef CONFIG_DEBUG_FS 847#ifdef CONFIG_DEBUG_FS
851 struct dentry *debugfs_platform_root; 848 struct dentry *debugfs_platform_root;
852 struct dentry *debugfs_dapm;
853#endif 849#endif
854}; 850};
855 851
@@ -934,6 +930,10 @@ struct snd_soc_dai_link {
934 /* machine stream operations */ 930 /* machine stream operations */
935 const struct snd_soc_ops *ops; 931 const struct snd_soc_ops *ops;
936 const struct snd_soc_compr_ops *compr_ops; 932 const struct snd_soc_compr_ops *compr_ops;
933
934 /* For unidirectional dai links */
935 bool playback_only;
936 bool capture_only;
937}; 937};
938 938
939struct snd_soc_codec_conf { 939struct snd_soc_codec_conf {
@@ -1042,6 +1042,7 @@ struct snd_soc_card {
1042 /* Generic DAPM context for the card */ 1042 /* Generic DAPM context for the card */
1043 struct snd_soc_dapm_context dapm; 1043 struct snd_soc_dapm_context dapm;
1044 struct snd_soc_dapm_stats dapm_stats; 1044 struct snd_soc_dapm_stats dapm_stats;
1045 struct snd_soc_dapm_update *update;
1045 1046
1046#ifdef CONFIG_DEBUG_FS 1047#ifdef CONFIG_DEBUG_FS
1047 struct dentry *debugfs_card_root; 1048 struct dentry *debugfs_card_root;
@@ -1087,7 +1088,9 @@ struct snd_soc_pcm_runtime {
1087/* mixer control */ 1088/* mixer control */
1088struct soc_mixer_control { 1089struct soc_mixer_control {
1089 int min, max, platform_max; 1090 int min, max, platform_max;
1090 unsigned int reg, rreg, shift, rshift, invert; 1091 unsigned int reg, rreg, shift, rshift;
1092 unsigned int invert:1;
1093 unsigned int autodisable:1;
1091}; 1094};
1092 1095
1093struct soc_bytes { 1096struct soc_bytes {
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
deleted file mode 100644
index 098c4de44945..000000000000
--- a/include/sound/tea575x-tuner.h
+++ /dev/null
@@ -1,78 +0,0 @@
1#ifndef __SOUND_TEA575X_TUNER_H
2#define __SOUND_TEA575X_TUNER_H
3
4/*
5 * ALSA driver for TEA5757/5759 Philips AM/FM tuner chips
6 *
7 * Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include <linux/videodev2.h>
26#include <media/v4l2-ctrls.h>
27#include <media/v4l2-dev.h>
28#include <media/v4l2-device.h>
29
30#define TEA575X_FMIF 10700
31#define TEA575X_AMIF 450
32
33#define TEA575X_DATA (1 << 0)
34#define TEA575X_CLK (1 << 1)
35#define TEA575X_WREN (1 << 2)
36#define TEA575X_MOST (1 << 3)
37
38struct snd_tea575x;
39
40struct snd_tea575x_ops {
41 /* Drivers using snd_tea575x must either define read_ and write_val */
42 void (*write_val)(struct snd_tea575x *tea, u32 val);
43 u32 (*read_val)(struct snd_tea575x *tea);
44 /* Or define the 3 pin functions */
45 void (*set_pins)(struct snd_tea575x *tea, u8 pins);
46 u8 (*get_pins)(struct snd_tea575x *tea);
47 void (*set_direction)(struct snd_tea575x *tea, bool output);
48};
49
50struct snd_tea575x {
51 struct v4l2_device *v4l2_dev;
52 struct v4l2_file_operations fops;
53 struct video_device vd; /* video device */
54 int radio_nr; /* radio_nr */
55 bool tea5759; /* 5759 chip is present */
56 bool has_am; /* Device can tune to AM freqs */
57 bool cannot_read_data; /* Device cannot read the data pin */
58 bool cannot_mute; /* Device cannot mute */
59 bool mute; /* Device is muted? */
60 bool stereo; /* receiving stereo */
61 bool tuned; /* tuned to a station */
62 unsigned int val; /* hw value */
63 u32 band; /* 0: FM, 1: FM-Japan, 2: AM */
64 u32 freq; /* frequency */
65 struct mutex mutex;
66 struct snd_tea575x_ops *ops;
67 void *private_data;
68 u8 card[32];
69 u8 bus_info[32];
70 struct v4l2_ctrl_handler ctrl_handler;
71 int (*ext_init)(struct snd_tea575x *tea);
72};
73
74int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner);
75void snd_tea575x_exit(struct snd_tea575x *tea);
76void snd_tea575x_set_freq(struct snd_tea575x *tea);
77
78#endif /* __SOUND_TEA575X_TUNER_H */