aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/cs42l56.h48
-rw-r--r--include/sound/rcar_snd.h32
-rw-r--r--include/sound/rt5640.h4
-rw-r--r--include/sound/rt5645.h25
-rw-r--r--include/sound/rt5651.h21
-rw-r--r--include/sound/soc-dai.h2
-rw-r--r--include/sound/soc-dapm.h20
-rw-r--r--include/sound/soc.h151
-rw-r--r--include/sound/sta350.h52
9 files changed, 284 insertions, 71 deletions
diff --git a/include/sound/cs42l56.h b/include/sound/cs42l56.h
new file mode 100644
index 000000000000..2467c8ff132c
--- /dev/null
+++ b/include/sound/cs42l56.h
@@ -0,0 +1,48 @@
1/*
2 * linux/sound/cs42l56.h -- Platform data for CS42L56
3 *
4 * Copyright (c) 2014 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 __CS42L56_H
12#define __CS42L56_H
13
14struct cs42l56_platform_data {
15
16 /* GPIO for Reset */
17 unsigned int gpio_nreset;
18
19 /* MICBIAS Level. Check datasheet Pg48 */
20 unsigned int micbias_lvl;
21
22 /* Analog Input 1A Reference 0=Single 1=Pseudo-Differential */
23 unsigned int ain1a_ref_cfg;
24
25 /* Analog Input 2A Reference 0=Single 1=Pseudo-Differential */
26 unsigned int ain2a_ref_cfg;
27
28 /* Analog Input 1B Reference 0=Single 1=Pseudo-Differential */
29 unsigned int ain1b_ref_cfg;
30
31 /* Analog Input 2B Reference 0=Single 1=Pseudo-Differential */
32 unsigned int ain2b_ref_cfg;
33
34 /* Charge Pump Freq. Check datasheet Pg62 */
35 unsigned int chgfreq;
36
37 /* HighPass Filter Right Channel Corner Frequency */
38 unsigned int hpfb_freq;
39
40 /* HighPass Filter Left Channel Corner Frequency */
41 unsigned int hpfa_freq;
42
43 /* Adaptive Power Control for LO/HP */
44 unsigned int adaptive_pwr;
45
46};
47
48#endif /* __CS42L56_H */
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index 34a3c02a4576..f4a706f82cb7 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -34,47 +34,39 @@
34 * B : SSI direction 34 * B : SSI direction
35 */ 35 */
36#define RSND_SSI_CLK_PIN_SHARE (1 << 31) 36#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
37#define RSND_SSI_PLAY (1 << 24)
38 37
39#define RSND_SSI(_dma_id, _pio_irq, _flags) \ 38#define RSND_SSI(_dma_id, _pio_irq, _flags) \
40{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags } 39{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
41#define RSND_SSI_SET(_dai_id, _dma_id, _pio_irq, _flags) \
42{ .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
43#define RSND_SSI_UNUSED \ 40#define RSND_SSI_UNUSED \
44{ .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 } 41{ .dma_id = -1, .pio_irq = -1, .flags = 0 }
45 42
46struct rsnd_ssi_platform_info { 43struct rsnd_ssi_platform_info {
47 int dai_id; /* will be removed */
48 int dma_id; 44 int dma_id;
49 int pio_irq; 45 int pio_irq;
50 u32 flags; 46 u32 flags;
51}; 47};
52 48
53/*
54 * flags
55 */
56#define RSND_SCU_USE_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */
57
58#define RSND_SRC(rate, _dma_id) \ 49#define RSND_SRC(rate, _dma_id) \
59{ .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, } 50{ .convert_rate = rate, .dma_id = _dma_id, }
60#define RSND_SRC_SET(rate, _dma_id) \
61 { .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }
62#define RSND_SRC_UNUSED \ 51#define RSND_SRC_UNUSED \
63 { .flags = 0, .convert_rate = 0, .dma_id = 0, } 52{ .convert_rate = 0, .dma_id = -1, }
64
65#define rsnd_scu_platform_info rsnd_src_platform_info
66#define src_info scu_info
67#define src_info_nr scu_info_nr
68 53
69struct rsnd_src_platform_info { 54struct rsnd_src_platform_info {
70 u32 flags;
71 u32 convert_rate; /* sampling rate convert */ 55 u32 convert_rate; /* sampling rate convert */
72 int dma_id; /* for Gen2 SCU */ 56 int dma_id; /* for Gen2 SCU */
73}; 57};
74 58
59/*
60 * flags
61 */
62struct rsnd_dvc_platform_info {
63 u32 flags;
64};
65
75struct rsnd_dai_path_info { 66struct rsnd_dai_path_info {
76 struct rsnd_ssi_platform_info *ssi; 67 struct rsnd_ssi_platform_info *ssi;
77 struct rsnd_src_platform_info *src; 68 struct rsnd_src_platform_info *src;
69 struct rsnd_dvc_platform_info *dvc;
78}; 70};
79 71
80struct rsnd_dai_platform_info { 72struct rsnd_dai_platform_info {
@@ -99,6 +91,8 @@ struct rcar_snd_info {
99 int ssi_info_nr; 91 int ssi_info_nr;
100 struct rsnd_src_platform_info *src_info; 92 struct rsnd_src_platform_info *src_info;
101 int src_info_nr; 93 int src_info_nr;
94 struct rsnd_dvc_platform_info *dvc_info;
95 int dvc_info_nr;
102 struct rsnd_dai_platform_info *dai_info; 96 struct rsnd_dai_platform_info *dai_info;
103 int dai_info_nr; 97 int dai_info_nr;
104 int (*start)(int id); 98 int (*start)(int id);
diff --git a/include/sound/rt5640.h b/include/sound/rt5640.h
index 27cc75ed67f8..59d26dd81e45 100644
--- a/include/sound/rt5640.h
+++ b/include/sound/rt5640.h
@@ -16,6 +16,10 @@ struct rt5640_platform_data {
16 bool in1_diff; 16 bool in1_diff;
17 bool in2_diff; 17 bool in2_diff;
18 18
19 bool dmic_en;
20 bool dmic1_data_pin; /* 0 = IN1P; 1 = GPIO3 */
21 bool dmic2_data_pin; /* 0 = IN1N; 1 = GPIO4 */
22
19 int ldo1_en; /* GPIO for LDO1_EN */ 23 int ldo1_en; /* GPIO for LDO1_EN */
20}; 24};
21 25
diff --git a/include/sound/rt5645.h b/include/sound/rt5645.h
new file mode 100644
index 000000000000..1de744c242f6
--- /dev/null
+++ b/include/sound/rt5645.h
@@ -0,0 +1,25 @@
1/*
2 * linux/sound/rt5645.h -- Platform data for RT5645
3 *
4 * Copyright 2013 Realtek Microelectronics
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_RT5645_H
12#define __LINUX_SND_RT5645_H
13
14struct rt5645_platform_data {
15 /* IN2 can optionally be differential */
16 bool in2_diff;
17
18 bool dmic_en;
19 unsigned int dmic1_data_pin;
20 /* 0 = IN2N; 1 = GPIO5; 2 = GPIO11 */
21 unsigned int dmic2_data_pin;
22 /* 0 = IN2P; 1 = GPIO6; 2 = GPIO10; 3 = GPIO12 */
23};
24
25#endif
diff --git a/include/sound/rt5651.h b/include/sound/rt5651.h
new file mode 100644
index 000000000000..d35de758dfb5
--- /dev/null
+++ b/include/sound/rt5651.h
@@ -0,0 +1,21 @@
1/*
2 * linux/sound/rt286.h -- Platform data for RT286
3 *
4 * Copyright 2013 Realtek Microelectronics
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_RT5651_H
12#define __LINUX_SND_RT5651_H
13
14struct rt5651_platform_data {
15 /* IN2 can optionally be differential */
16 bool in2_diff;
17
18 bool dmic_en;
19};
20
21#endif
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index fad76769f153..688f2ba8009f 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -252,7 +252,6 @@ struct snd_soc_dai {
252 unsigned int symmetric_rates:1; 252 unsigned int symmetric_rates:1;
253 unsigned int symmetric_channels:1; 253 unsigned int symmetric_channels:1;
254 unsigned int symmetric_samplebits:1; 254 unsigned int symmetric_samplebits:1;
255 struct snd_pcm_runtime *runtime;
256 unsigned int active; 255 unsigned int active;
257 unsigned char probed:1; 256 unsigned char probed:1;
258 257
@@ -277,7 +276,6 @@ struct snd_soc_dai {
277 struct snd_soc_card *card; 276 struct snd_soc_card *card;
278 277
279 struct list_head list; 278 struct list_head list;
280 struct list_head card_list;
281}; 279};
282 280
283static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai, 281static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index ef78f562f4a8..6b59471cdf44 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -107,10 +107,6 @@ struct device;
107{ .id = snd_soc_dapm_mux, .name = wname, \ 107{ .id = snd_soc_dapm_mux, .name = wname, \
108 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 108 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
109 .kcontrol_news = wcontrols, .num_kcontrols = 1} 109 .kcontrol_news = wcontrols, .num_kcontrols = 1}
110#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \
111 SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols)
112#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \
113 SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols)
114 110
115/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ 111/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
116#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ 112#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\
@@ -166,10 +162,6 @@ struct device;
166 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 162 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
167 .kcontrol_news = wcontrols, .num_kcontrols = 1, \ 163 .kcontrol_news = wcontrols, .num_kcontrols = 1, \
168 .event = wevent, .event_flags = wflags} 164 .event = wevent, .event_flags = wflags}
169#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
170 wevent, wflags) \
171 SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, wevent, \
172 wflags)
173 165
174/* additional sequencing control within an event type */ 166/* additional sequencing control within an event type */
175#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \ 167#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \
@@ -256,9 +248,8 @@ struct device;
256/* generic widgets */ 248/* generic widgets */
257#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \ 249#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \
258{ .id = wid, .name = wname, .kcontrol_news = NULL, .num_kcontrols = 0, \ 250{ .id = wid, .name = wname, .kcontrol_news = NULL, .num_kcontrols = 0, \
259 .reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \ 251 .reg = wreg, .shift = wshift, .mask = wmask, \
260 .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \ 252 .on_val = won_val, .off_val = woff_val, }
261 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD}
262#define SND_SOC_DAPM_SUPPLY(wname, wreg, wshift, winvert, wevent, wflags) \ 253#define SND_SOC_DAPM_SUPPLY(wname, wreg, wshift, winvert, wevent, wflags) \
263{ .id = snd_soc_dapm_supply, .name = wname, \ 254{ .id = snd_soc_dapm_supply, .name = wname, \
264 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 255 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
@@ -305,16 +296,12 @@ struct device;
305 .get = snd_soc_dapm_get_enum_double, \ 296 .get = snd_soc_dapm_get_enum_double, \
306 .put = snd_soc_dapm_put_enum_double, \ 297 .put = snd_soc_dapm_put_enum_double, \
307 .private_value = (unsigned long)&xenum } 298 .private_value = (unsigned long)&xenum }
308#define SOC_DAPM_ENUM_VIRT(xname, xenum) \
309 SOC_DAPM_ENUM(xname, xenum)
310#define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \ 299#define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \
311{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 300{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
312 .info = snd_soc_info_enum_double, \ 301 .info = snd_soc_info_enum_double, \
313 .get = xget, \ 302 .get = xget, \
314 .put = xput, \ 303 .put = xput, \
315 .private_value = (unsigned long)&xenum } 304 .private_value = (unsigned long)&xenum }
316#define SOC_DAPM_VALUE_ENUM(xname, xenum) \
317 SOC_DAPM_ENUM(xname, xenum)
318#define SOC_DAPM_PIN_SWITCH(xname) \ 305#define SOC_DAPM_PIN_SWITCH(xname) \
319{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \ 306{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
320 .info = snd_soc_dapm_info_pin_switch, \ 307 .info = snd_soc_dapm_info_pin_switch, \
@@ -362,8 +349,6 @@ struct regulator;
362struct snd_soc_dapm_widget_list; 349struct snd_soc_dapm_widget_list;
363struct snd_soc_dapm_update; 350struct snd_soc_dapm_update;
364 351
365int dapm_reg_event(struct snd_soc_dapm_widget *w,
366 struct snd_kcontrol *kcontrol, int event);
367int dapm_regulator_event(struct snd_soc_dapm_widget *w, 352int dapm_regulator_event(struct snd_soc_dapm_widget *w,
368 struct snd_kcontrol *kcontrol, int event); 353 struct snd_kcontrol *kcontrol, int event);
369int dapm_clock_event(struct snd_soc_dapm_widget *w, 354int dapm_clock_event(struct snd_soc_dapm_widget *w,
@@ -606,6 +591,7 @@ struct snd_soc_dapm_context {
606 enum snd_soc_dapm_type, int); 591 enum snd_soc_dapm_type, int);
607 592
608 struct device *dev; /* from parent - for debug */ 593 struct device *dev; /* from parent - for debug */
594 struct snd_soc_component *component; /* parent component */
609 struct snd_soc_codec *codec; /* parent codec */ 595 struct snd_soc_codec *codec; /* parent codec */
610 struct snd_soc_platform *platform; /* parent platform */ 596 struct snd_soc_platform *platform; /* parent platform */
611 struct snd_soc_card *card; /* parent card */ 597 struct snd_soc_card *card; /* parent card */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0b83168d8ff4..df7ae9ca4854 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -196,8 +196,6 @@
196 .info = snd_soc_info_enum_double, \ 196 .info = snd_soc_info_enum_double, \
197 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \ 197 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
198 .private_value = (unsigned long)&xenum } 198 .private_value = (unsigned long)&xenum }
199#define SOC_VALUE_ENUM(xname, xenum) \
200 SOC_ENUM(xname, xenum)
201#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\ 199#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
202 xhandler_get, xhandler_put) \ 200 xhandler_get, xhandler_put) \
203{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 201{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -266,6 +264,13 @@
266 {.base = xbase, .num_regs = xregs, \ 264 {.base = xbase, .num_regs = xregs, \
267 .mask = xmask }) } 265 .mask = xmask }) }
268 266
267#define SND_SOC_BYTES_EXT(xname, xcount, xhandler_get, xhandler_put) \
268{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
269 .info = snd_soc_bytes_info_ext, \
270 .get = xhandler_get, .put = xhandler_put, \
271 .private_value = (unsigned long)&(struct soc_bytes_ext) \
272 {.max = xcount} }
273
269#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ 274#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \
270 xmin, xmax, xinvert) \ 275 xmin, xmax, xinvert) \
271{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 276{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@ -377,6 +382,8 @@ int snd_soc_resume(struct device *dev);
377int snd_soc_poweroff(struct device *dev); 382int snd_soc_poweroff(struct device *dev);
378int snd_soc_register_platform(struct device *dev, 383int snd_soc_register_platform(struct device *dev,
379 const struct snd_soc_platform_driver *platform_drv); 384 const struct snd_soc_platform_driver *platform_drv);
385int devm_snd_soc_register_platform(struct device *dev,
386 const struct snd_soc_platform_driver *platform_drv);
380void snd_soc_unregister_platform(struct device *dev); 387void snd_soc_unregister_platform(struct device *dev);
381int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, 388int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
382 const struct snd_soc_platform_driver *platform_drv); 389 const struct snd_soc_platform_driver *platform_drv);
@@ -393,14 +400,6 @@ int devm_snd_soc_register_component(struct device *dev,
393 const struct snd_soc_component_driver *cmpnt_drv, 400 const struct snd_soc_component_driver *cmpnt_drv,
394 struct snd_soc_dai_driver *dai_drv, int num_dai); 401 struct snd_soc_dai_driver *dai_drv, int num_dai);
395void snd_soc_unregister_component(struct device *dev); 402void snd_soc_unregister_component(struct device *dev);
396int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
397 unsigned int reg);
398int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
399 unsigned int reg);
400int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
401 unsigned int reg);
402int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
403 struct regmap *regmap);
404int snd_soc_cache_sync(struct snd_soc_codec *codec); 403int snd_soc_cache_sync(struct snd_soc_codec *codec);
405int snd_soc_cache_init(struct snd_soc_codec *codec); 404int snd_soc_cache_init(struct snd_soc_codec *codec);
406int snd_soc_cache_exit(struct snd_soc_codec *codec); 405int snd_soc_cache_exit(struct snd_soc_codec *codec);
@@ -469,12 +468,12 @@ static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
469#endif 468#endif
470 469
471/* codec register bit access */ 470/* codec register bit access */
472int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, 471int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned int reg,
473 unsigned int mask, unsigned int value); 472 unsigned int mask, unsigned int value);
474int snd_soc_update_bits_locked(struct snd_soc_codec *codec, 473int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
475 unsigned short reg, unsigned int mask, 474 unsigned int reg, unsigned int mask,
476 unsigned int value); 475 unsigned int value);
477int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, 476int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg,
478 unsigned int mask, unsigned int value); 477 unsigned int mask, unsigned int value);
479 478
480int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, 479int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
@@ -540,6 +539,8 @@ int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
540 struct snd_ctl_elem_value *ucontrol); 539 struct snd_ctl_elem_value *ucontrol);
541int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, 540int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
542 struct snd_ctl_elem_value *ucontrol); 541 struct snd_ctl_elem_value *ucontrol);
542int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol,
543 struct snd_ctl_elem_info *ucontrol);
543int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, 544int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_info *uinfo); 545 struct snd_ctl_elem_info *uinfo);
545int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, 546int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol,
@@ -668,6 +669,7 @@ struct snd_soc_component {
668 unsigned int active; 669 unsigned int active;
669 670
670 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ 671 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
672 unsigned int registered_as_component:1;
671 673
672 struct list_head list; 674 struct list_head list;
673 675
@@ -677,6 +679,14 @@ struct snd_soc_component {
677 const struct snd_soc_component_driver *driver; 679 const struct snd_soc_component_driver *driver;
678 680
679 struct list_head dai_list; 681 struct list_head dai_list;
682
683 int (*read)(struct snd_soc_component *, unsigned int, unsigned int *);
684 int (*write)(struct snd_soc_component *, unsigned int, unsigned int);
685
686 struct regmap *regmap;
687 int val_bytes;
688
689 struct mutex io_mutex;
680}; 690};
681 691
682/* SoC Audio Codec device */ 692/* SoC Audio Codec device */
@@ -691,10 +701,6 @@ struct snd_soc_codec {
691 struct snd_soc_card *card; 701 struct snd_soc_card *card;
692 struct list_head list; 702 struct list_head list;
693 struct list_head card_list; 703 struct list_head card_list;
694 int num_dai;
695 int (*volatile_register)(struct snd_soc_codec *, unsigned int);
696 int (*readable_register)(struct snd_soc_codec *, unsigned int);
697 int (*writable_register)(struct snd_soc_codec *, unsigned int);
698 704
699 /* runtime */ 705 /* runtime */
700 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 706 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
@@ -704,18 +710,14 @@ struct snd_soc_codec {
704 unsigned int ac97_registered:1; /* Codec has been AC97 registered */ 710 unsigned int ac97_registered:1; /* Codec has been AC97 registered */
705 unsigned int ac97_created:1; /* Codec has been created by SoC */ 711 unsigned int ac97_created:1; /* Codec has been created by SoC */
706 unsigned int cache_init:1; /* codec cache has been initialized */ 712 unsigned int cache_init:1; /* codec cache has been initialized */
707 unsigned int using_regmap:1; /* using regmap access */
708 u32 cache_only; /* Suppress writes to hardware */ 713 u32 cache_only; /* Suppress writes to hardware */
709 u32 cache_sync; /* Cache needs to be synced to hardware */ 714 u32 cache_sync; /* Cache needs to be synced to hardware */
710 715
711 /* codec IO */ 716 /* codec IO */
712 void *control_data; /* codec control (i2c/3wire) data */ 717 void *control_data; /* codec control (i2c/3wire) data */
713 hw_write_t hw_write; 718 hw_write_t hw_write;
714 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
715 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
716 void *reg_cache; 719 void *reg_cache;
717 struct mutex cache_rw_mutex; 720 struct mutex cache_rw_mutex;
718 int val_bytes;
719 721
720 /* component */ 722 /* component */
721 struct snd_soc_component component; 723 struct snd_soc_component component;
@@ -754,13 +756,9 @@ struct snd_soc_codec_driver {
754 unsigned int freq_in, unsigned int freq_out); 756 unsigned int freq_in, unsigned int freq_out);
755 757
756 /* codec IO */ 758 /* codec IO */
759 struct regmap *(*get_regmap)(struct device *);
757 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 760 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
758 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 761 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
759 int (*display_register)(struct snd_soc_codec *, char *,
760 size_t, unsigned int);
761 int (*volatile_register)(struct snd_soc_codec *, unsigned int);
762 int (*readable_register)(struct snd_soc_codec *, unsigned int);
763 int (*writable_register)(struct snd_soc_codec *, unsigned int);
764 unsigned int reg_cache_size; 762 unsigned int reg_cache_size;
765 short reg_cache_step; 763 short reg_cache_step;
766 short reg_word_size; 764 short reg_word_size;
@@ -791,6 +789,7 @@ struct snd_soc_platform_driver {
791 int (*remove)(struct snd_soc_platform *); 789 int (*remove)(struct snd_soc_platform *);
792 int (*suspend)(struct snd_soc_dai *dai); 790 int (*suspend)(struct snd_soc_dai *dai);
793 int (*resume)(struct snd_soc_dai *dai); 791 int (*resume)(struct snd_soc_dai *dai);
792 struct snd_soc_component_driver component_driver;
794 793
795 /* pcm creation and destruction */ 794 /* pcm creation and destruction */
796 int (*pcm_new)(struct snd_soc_pcm_runtime *); 795 int (*pcm_new)(struct snd_soc_pcm_runtime *);
@@ -835,7 +834,6 @@ struct snd_soc_platform {
835 int id; 834 int id;
836 struct device *dev; 835 struct device *dev;
837 const struct snd_soc_platform_driver *driver; 836 const struct snd_soc_platform_driver *driver;
838 struct mutex mutex;
839 837
840 unsigned int suspended:1; /* platform is suspended */ 838 unsigned int suspended:1; /* platform is suspended */
841 unsigned int probed:1; 839 unsigned int probed:1;
@@ -844,6 +842,8 @@ struct snd_soc_platform {
844 struct list_head list; 842 struct list_head list;
845 struct list_head card_list; 843 struct list_head card_list;
846 844
845 struct snd_soc_component component;
846
847 struct snd_soc_dapm_context dapm; 847 struct snd_soc_dapm_context dapm;
848 848
849#ifdef CONFIG_DEBUG_FS 849#ifdef CONFIG_DEBUG_FS
@@ -931,7 +931,12 @@ struct snd_soc_dai_link {
931}; 931};
932 932
933struct snd_soc_codec_conf { 933struct snd_soc_codec_conf {
934 /*
935 * specify device either by device name, or by
936 * DT/OF node, but not both.
937 */
934 const char *dev_name; 938 const char *dev_name;
939 const struct device_node *of_node;
935 940
936 /* 941 /*
937 * optional map of kcontrol, widget and path name prefixes that are 942 * optional map of kcontrol, widget and path name prefixes that are
@@ -942,7 +947,13 @@ struct snd_soc_codec_conf {
942 947
943struct snd_soc_aux_dev { 948struct snd_soc_aux_dev {
944 const char *name; /* Codec name */ 949 const char *name; /* Codec name */
945 const char *codec_name; /* for multi-codec */ 950
951 /*
952 * specify multi-codec either by device name, or by
953 * DT/OF node, but not both.
954 */
955 const char *codec_name;
956 const struct device_node *codec_of_node;
946 957
947 /* codec/machine specific init - e.g. add machine controls */ 958 /* codec/machine specific init - e.g. add machine controls */
948 int (*init)(struct snd_soc_dapm_context *dapm); 959 int (*init)(struct snd_soc_dapm_context *dapm);
@@ -957,7 +968,6 @@ struct snd_soc_card {
957 struct snd_card *snd_card; 968 struct snd_card *snd_card;
958 struct module *owner; 969 struct module *owner;
959 970
960 struct list_head list;
961 struct mutex mutex; 971 struct mutex mutex;
962 struct mutex dapm_mutex; 972 struct mutex dapm_mutex;
963 973
@@ -1020,7 +1030,6 @@ struct snd_soc_card {
1020 /* lists of probed devices belonging to this card */ 1030 /* lists of probed devices belonging to this card */
1021 struct list_head codec_dev_list; 1031 struct list_head codec_dev_list;
1022 struct list_head platform_dev_list; 1032 struct list_head platform_dev_list;
1023 struct list_head dai_dev_list;
1024 1033
1025 struct list_head widgets; 1034 struct list_head widgets;
1026 struct list_head paths; 1035 struct list_head paths;
@@ -1090,6 +1099,10 @@ struct soc_bytes {
1090 u32 mask; 1099 u32 mask;
1091}; 1100};
1092 1101
1102struct soc_bytes_ext {
1103 int max;
1104};
1105
1093/* multi register control */ 1106/* multi register control */
1094struct soc_mreg_control { 1107struct soc_mreg_control {
1095 long min, max; 1108 long min, max;
@@ -1120,10 +1133,39 @@ static inline struct snd_soc_codec *snd_soc_component_to_codec(
1120 return container_of(component, struct snd_soc_codec, component); 1133 return container_of(component, struct snd_soc_codec, component);
1121} 1134}
1122 1135
1136/**
1137 * snd_soc_component_to_platform() - Casts a component to the platform it is embedded in
1138 * @component: The component to cast to a platform
1139 *
1140 * This function must only be used on components that are known to be platforms.
1141 * Otherwise the behavior is undefined.
1142 */
1143static inline struct snd_soc_platform *snd_soc_component_to_platform(
1144 struct snd_soc_component *component)
1145{
1146 return container_of(component, struct snd_soc_platform, component);
1147}
1148
1123/* codec IO */ 1149/* codec IO */
1124unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); 1150unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
1125unsigned int snd_soc_write(struct snd_soc_codec *codec, 1151int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
1126 unsigned int reg, unsigned int val); 1152 unsigned int val);
1153
1154/* component IO */
1155int snd_soc_component_read(struct snd_soc_component *component,
1156 unsigned int reg, unsigned int *val);
1157int snd_soc_component_write(struct snd_soc_component *component,
1158 unsigned int reg, unsigned int val);
1159int snd_soc_component_update_bits(struct snd_soc_component *component,
1160 unsigned int reg, unsigned int mask, unsigned int val);
1161int snd_soc_component_update_bits_async(struct snd_soc_component *component,
1162 unsigned int reg, unsigned int mask, unsigned int val);
1163void snd_soc_component_async_complete(struct snd_soc_component *component);
1164int snd_soc_component_test_bits(struct snd_soc_component *component,
1165 unsigned int reg, unsigned int mask, unsigned int value);
1166
1167int snd_soc_component_init_io(struct snd_soc_component *component,
1168 struct regmap *regmap);
1127 1169
1128/* device driver data */ 1170/* device driver data */
1129 1171
@@ -1173,7 +1215,6 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
1173 1215
1174static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) 1216static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
1175{ 1217{
1176 INIT_LIST_HEAD(&card->dai_dev_list);
1177 INIT_LIST_HEAD(&card->codec_dev_list); 1218 INIT_LIST_HEAD(&card->codec_dev_list);
1178 INIT_LIST_HEAD(&card->platform_dev_list); 1219 INIT_LIST_HEAD(&card->platform_dev_list);
1179 INIT_LIST_HEAD(&card->widgets); 1220 INIT_LIST_HEAD(&card->widgets);
@@ -1228,6 +1269,50 @@ static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
1228 return snd_soc_component_is_active(&codec->component); 1269 return snd_soc_component_is_active(&codec->component);
1229} 1270}
1230 1271
1272/**
1273 * snd_soc_kcontrol_component() - Returns the component that registered the
1274 * control
1275 * @kcontrol: The control for which to get the component
1276 *
1277 * Note: This function will work correctly if the control has been registered
1278 * for a component. Either with snd_soc_add_codec_controls() or
1279 * snd_soc_add_platform_controls() or via table based setup for either a
1280 * CODEC, a platform or component driver. Otherwise the behavior is undefined.
1281 */
1282static inline struct snd_soc_component *snd_soc_kcontrol_component(
1283 struct snd_kcontrol *kcontrol)
1284{
1285 return snd_kcontrol_chip(kcontrol);
1286}
1287
1288/**
1289 * snd_soc_kcontrol_codec() - Returns the CODEC that registered the control
1290 * @kcontrol: The control for which to get the CODEC
1291 *
1292 * Note: This function will only work correctly if the control has been
1293 * registered with snd_soc_add_codec_controls() or via table based setup of
1294 * snd_soc_codec_driver. Otherwise the behavior is undefined.
1295 */
1296static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
1297 struct snd_kcontrol *kcontrol)
1298{
1299 return snd_soc_component_to_codec(snd_soc_kcontrol_component(kcontrol));
1300}
1301
1302/**
1303 * snd_soc_kcontrol_platform() - Returns the platform that registerd the control
1304 * @kcontrol: The control for which to get the platform
1305 *
1306 * Note: This function will only work correctly if the control has been
1307 * registered with snd_soc_add_platform_controls() or via table based setup of
1308 * a snd_soc_platform_driver. Otherwise the behavior is undefined.
1309 */
1310static inline struct snd_soc_platform *snd_soc_kcontrol_platform(
1311 struct snd_kcontrol *kcontrol)
1312{
1313 return snd_soc_component_to_platform(snd_soc_kcontrol_component(kcontrol));
1314}
1315
1231int snd_soc_util_init(void); 1316int snd_soc_util_init(void);
1232void snd_soc_util_exit(void); 1317void snd_soc_util_exit(void);
1233 1318
diff --git a/include/sound/sta350.h b/include/sound/sta350.h
new file mode 100644
index 000000000000..3a3298106b22
--- /dev/null
+++ b/include/sound/sta350.h
@@ -0,0 +1,52 @@
1/*
2 * Platform data for ST STA350 ASoC codec driver.
3 *
4 * Copyright: 2014 Raumfeld GmbH
5 * Author: Sven Brandau <info@brandau.biz>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#ifndef __LINUX_SND__STA350_H
13#define __LINUX_SND__STA350_H
14
15#define STA350_OCFG_2CH 0
16#define STA350_OCFG_2_1CH 1
17#define STA350_OCFG_1CH 3
18
19#define STA350_OM_CH1 0
20#define STA350_OM_CH2 1
21#define STA350_OM_CH3 2
22
23#define STA350_THERMAL_ADJUSTMENT_ENABLE 1
24#define STA350_THERMAL_RECOVERY_ENABLE 2
25#define STA350_FAULT_DETECT_RECOVERY_BYPASS 1
26
27#define STA350_FFX_PM_DROP_COMP 0
28#define STA350_FFX_PM_TAPERED_COMP 1
29#define STA350_FFX_PM_FULL_POWER 2
30#define STA350_FFX_PM_VARIABLE_DROP_COMP 3
31
32
33struct sta350_platform_data {
34 u8 output_conf;
35 u8 ch1_output_mapping;
36 u8 ch2_output_mapping;
37 u8 ch3_output_mapping;
38 u8 ffx_power_output_mode;
39 u8 drop_compensation_ns;
40 unsigned int thermal_warning_recovery:1;
41 unsigned int thermal_warning_adjustment:1;
42 unsigned int fault_detect_recovery:1;
43 unsigned int oc_warning_adjustment:1;
44 unsigned int max_power_use_mpcc:1;
45 unsigned int max_power_correction:1;
46 unsigned int am_reduction_mode:1;
47 unsigned int odd_pwm_speed_mode:1;
48 unsigned int distortion_compensation:1;
49 unsigned int invalid_input_detect_mute:1;
50};
51
52#endif /* __LINUX_SND__STA350_H */