aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/pcm.h2
-rw-r--r--include/sound/soc-dai.h7
-rw-r--r--include/sound/soc-dapm.h9
-rw-r--r--include/sound/soc-dpcm.h2
-rw-r--r--include/sound/soc.h112
5 files changed, 91 insertions, 41 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index e862497f7556..8bb00a27e219 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -184,6 +184,8 @@ struct snd_pcm_ops {
184#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) 184#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8)
185#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) 185#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE)
186#define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE) 186#define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE)
187#define SNDRV_PCM_FMTBIT_DSD_U16_BE _SNDRV_PCM_FMTBIT(DSD_U16_BE)
188#define SNDRV_PCM_FMTBIT_DSD_U32_BE _SNDRV_PCM_FMTBIT(DSD_U32_BE)
187 189
188#ifdef SNDRV_LITTLE_ENDIAN 190#ifdef SNDRV_LITTLE_ENDIAN
189#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE 191#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index e8b3080d196a..2df96b1384c7 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -206,7 +206,6 @@ struct snd_soc_dai_driver {
206 /* DAI description */ 206 /* DAI description */
207 const char *name; 207 const char *name;
208 unsigned int id; 208 unsigned int id;
209 int ac97_control;
210 unsigned int base; 209 unsigned int base;
211 210
212 /* DAI driver callbacks */ 211 /* DAI driver callbacks */
@@ -216,6 +215,8 @@ struct snd_soc_dai_driver {
216 int (*resume)(struct snd_soc_dai *dai); 215 int (*resume)(struct snd_soc_dai *dai);
217 /* compress dai */ 216 /* compress dai */
218 bool compress_dai; 217 bool compress_dai;
218 /* DAI is also used for the control bus */
219 bool bus_control;
219 220
220 /* ops */ 221 /* ops */
221 const struct snd_soc_dai_ops *ops; 222 const struct snd_soc_dai_ops *ops;
@@ -241,7 +242,6 @@ struct snd_soc_dai {
241 const char *name; 242 const char *name;
242 int id; 243 int id;
243 struct device *dev; 244 struct device *dev;
244 void *ac97_pdata; /* platform_data for the ac97 codec */
245 245
246 /* driver ops */ 246 /* driver ops */
247 struct snd_soc_dai_driver *driver; 247 struct snd_soc_dai_driver *driver;
@@ -268,7 +268,6 @@ struct snd_soc_dai {
268 unsigned int sample_bits; 268 unsigned int sample_bits;
269 269
270 /* parent platform/codec */ 270 /* parent platform/codec */
271 struct snd_soc_platform *platform;
272 struct snd_soc_codec *codec; 271 struct snd_soc_codec *codec;
273 struct snd_soc_component *component; 272 struct snd_soc_component *component;
274 273
@@ -276,8 +275,6 @@ struct snd_soc_dai {
276 unsigned int tx_mask; 275 unsigned int tx_mask;
277 unsigned int rx_mask; 276 unsigned int rx_mask;
278 277
279 struct snd_soc_card *card;
280
281 struct list_head list; 278 struct list_head list;
282}; 279};
283 280
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 3a4d7da67b8d..89823cfe6f04 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -435,7 +435,7 @@ void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card);
435unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol); 435unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol);
436 436
437/* Mostly internal - should not normally be used */ 437/* Mostly internal - should not normally be used */
438void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm); 438void dapm_mark_endpoints_dirty(struct snd_soc_card *card);
439 439
440/* dapm path query */ 440/* dapm path query */
441int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, 441int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
@@ -508,9 +508,9 @@ struct snd_soc_dapm_path {
508 508
509 /* status */ 509 /* status */
510 u32 connect:1; /* source and sink widgets are connected */ 510 u32 connect:1; /* source and sink widgets are connected */
511 u32 walked:1; /* path has been walked */
512 u32 walking:1; /* path is in the process of being walked */ 511 u32 walking:1; /* path is in the process of being walked */
513 u32 weak:1; /* path ignored for power management */ 512 u32 weak:1; /* path ignored for power management */
513 u32 is_supply:1; /* At least one of the connected widgets is a supply */
514 514
515 int (*connected)(struct snd_soc_dapm_widget *source, 515 int (*connected)(struct snd_soc_dapm_widget *source,
516 struct snd_soc_dapm_widget *sink); 516 struct snd_soc_dapm_widget *sink);
@@ -544,11 +544,13 @@ struct snd_soc_dapm_widget {
544 unsigned char active:1; /* active stream on DAC, ADC's */ 544 unsigned char active:1; /* active stream on DAC, ADC's */
545 unsigned char connected:1; /* connected codec pin */ 545 unsigned char connected:1; /* connected codec pin */
546 unsigned char new:1; /* cnew complete */ 546 unsigned char new:1; /* cnew complete */
547 unsigned char ext:1; /* has external widgets */
548 unsigned char force:1; /* force state */ 547 unsigned char force:1; /* force state */
549 unsigned char ignore_suspend:1; /* kept enabled over suspend */ 548 unsigned char ignore_suspend:1; /* kept enabled over suspend */
550 unsigned char new_power:1; /* power from this run */ 549 unsigned char new_power:1; /* power from this run */
551 unsigned char power_checked:1; /* power checked this run */ 550 unsigned char power_checked:1; /* power checked this run */
551 unsigned char is_supply:1; /* Widget is a supply type widget */
552 unsigned char is_sink:1; /* Widget is a sink type widget */
553 unsigned char is_source:1; /* Widget is a source type widget */
552 int subseq; /* sort within widget type */ 554 int subseq; /* sort within widget type */
553 555
554 int (*power_check)(struct snd_soc_dapm_widget *w); 556 int (*power_check)(struct snd_soc_dapm_widget *w);
@@ -567,6 +569,7 @@ struct snd_soc_dapm_widget {
567 struct list_head sinks; 569 struct list_head sinks;
568 570
569 /* used during DAPM updates */ 571 /* used during DAPM updates */
572 struct list_head work_list;
570 struct list_head power_list; 573 struct list_head power_list;
571 struct list_head dirty; 574 struct list_head dirty;
572 int inputs; 575 int inputs;
diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
index 2883a7a6f9f3..98f2ade0266e 100644
--- a/include/sound/soc-dpcm.h
+++ b/include/sound/soc-dpcm.h
@@ -102,6 +102,8 @@ struct snd_soc_dpcm_runtime {
102 /* state and update */ 102 /* state and update */
103 enum snd_soc_dpcm_update runtime_update; 103 enum snd_soc_dpcm_update runtime_update;
104 enum snd_soc_dpcm_state state; 104 enum snd_soc_dpcm_state state;
105
106 int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */
105}; 107};
106 108
107/* can this BE stop and free */ 109/* can this BE stop and free */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 7ba7130037a0..a765c684bd7b 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -36,6 +36,11 @@
36 {.reg = xreg, .rreg = xreg, .shift = shift_left, \ 36 {.reg = xreg, .rreg = xreg, .shift = shift_left, \
37 .rshift = shift_right, .max = xmax, .platform_max = xmax, \ 37 .rshift = shift_right, .max = xmax, .platform_max = xmax, \
38 .invert = xinvert, .autodisable = xautodisable}) 38 .invert = xinvert, .autodisable = xautodisable})
39#define SOC_DOUBLE_S_VALUE(xreg, shift_left, shift_right, xmin, xmax, xsign_bit, xinvert, xautodisable) \
40 ((unsigned long)&(struct soc_mixer_control) \
41 {.reg = xreg, .rreg = xreg, .shift = shift_left, \
42 .rshift = shift_right, .min = xmin, .max = xmax, .platform_max = xmax, \
43 .sign_bit = xsign_bit, .invert = xinvert, .autodisable = xautodisable})
39#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \ 44#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \
40 SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert, xautodisable) 45 SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert, xautodisable)
41#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ 46#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
@@ -171,11 +176,9 @@
171 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 176 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
172 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 177 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
173 .tlv.p = (tlv_array), \ 178 .tlv.p = (tlv_array), \
174 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \ 179 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
175 .put = snd_soc_put_volsw_s8, \ 180 .put = snd_soc_put_volsw, \
176 .private_value = (unsigned long)&(struct soc_mixer_control) \ 181 .private_value = SOC_DOUBLE_S_VALUE(xreg, 0, 8, xmin, xmax, 7, 0, 0) }
177 {.reg = xreg, .min = xmin, .max = xmax, \
178 .platform_max = xmax} }
179#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xitems, xtexts) \ 182#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xitems, xtexts) \
180{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 183{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
181 .items = xitems, .texts = xtexts, \ 184 .items = xitems, .texts = xtexts, \
@@ -366,8 +369,6 @@ struct snd_soc_jack_gpio;
366 369
367typedef int (*hw_write_t)(void *,const char* ,int); 370typedef int (*hw_write_t)(void *,const char* ,int);
368 371
369extern struct snd_ac97_bus_ops *soc_ac97_ops;
370
371enum snd_soc_pcm_subclass { 372enum snd_soc_pcm_subclass {
372 SND_SOC_PCM_CLASS_PCM = 0, 373 SND_SOC_PCM_CLASS_PCM = 0,
373 SND_SOC_PCM_CLASS_BE = 1, 374 SND_SOC_PCM_CLASS_BE = 1,
@@ -409,13 +410,9 @@ int devm_snd_soc_register_component(struct device *dev,
409 const struct snd_soc_component_driver *cmpnt_drv, 410 const struct snd_soc_component_driver *cmpnt_drv,
410 struct snd_soc_dai_driver *dai_drv, int num_dai); 411 struct snd_soc_dai_driver *dai_drv, int num_dai);
411void snd_soc_unregister_component(struct device *dev); 412void snd_soc_unregister_component(struct device *dev);
412int snd_soc_cache_sync(struct snd_soc_codec *codec);
413int snd_soc_cache_init(struct snd_soc_codec *codec); 413int snd_soc_cache_init(struct snd_soc_codec *codec);
414int snd_soc_cache_exit(struct snd_soc_codec *codec); 414int snd_soc_cache_exit(struct snd_soc_codec *codec);
415int snd_soc_cache_write(struct snd_soc_codec *codec, 415
416 unsigned int reg, unsigned int value);
417int snd_soc_cache_read(struct snd_soc_codec *codec,
418 unsigned int reg, unsigned int *value);
419int snd_soc_platform_read(struct snd_soc_platform *platform, 416int snd_soc_platform_read(struct snd_soc_platform *platform,
420 unsigned int reg); 417 unsigned int reg);
421int snd_soc_platform_write(struct snd_soc_platform *platform, 418int snd_soc_platform_write(struct snd_soc_platform *platform,
@@ -500,14 +497,28 @@ int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
500int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg, 497int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg,
501 unsigned int mask, unsigned int value); 498 unsigned int mask, unsigned int value);
502 499
503int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, 500#ifdef CONFIG_SND_SOC_AC97_BUS
504 struct snd_ac97_bus_ops *ops, int num); 501struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec);
505void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); 502void snd_soc_free_ac97_codec(struct snd_ac97 *ac97);
506 503
507int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops); 504int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops);
508int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops, 505int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops,
509 struct platform_device *pdev); 506 struct platform_device *pdev);
510 507
508extern struct snd_ac97_bus_ops *soc_ac97_ops;
509#else
510static inline int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops,
511 struct platform_device *pdev)
512{
513 return 0;
514}
515
516static inline int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops)
517{
518 return 0;
519}
520#endif
521
511/* 522/*
512 *Controls 523 *Controls
513 */ 524 */
@@ -545,12 +556,6 @@ int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
545 struct snd_ctl_elem_value *ucontrol); 556 struct snd_ctl_elem_value *ucontrol);
546int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, 557int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
547 struct snd_ctl_elem_value *ucontrol); 558 struct snd_ctl_elem_value *ucontrol);
548int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
549 struct snd_ctl_elem_info *uinfo);
550int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
551 struct snd_ctl_elem_value *ucontrol);
552int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
553 struct snd_ctl_elem_value *ucontrol);
554int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol, 559int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
555 struct snd_ctl_elem_info *uinfo); 560 struct snd_ctl_elem_info *uinfo);
556int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, 561int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
@@ -785,19 +790,14 @@ struct snd_soc_codec {
785 struct list_head card_list; 790 struct list_head card_list;
786 791
787 /* runtime */ 792 /* runtime */
788 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
789 unsigned int cache_bypass:1; /* Suppress access to the cache */ 793 unsigned int cache_bypass:1; /* Suppress access to the cache */
790 unsigned int suspended:1; /* Codec is in suspend PM state */ 794 unsigned int suspended:1; /* Codec is in suspend PM state */
791 unsigned int ac97_registered:1; /* Codec has been AC97 registered */
792 unsigned int ac97_created:1; /* Codec has been created by SoC */
793 unsigned int cache_init:1; /* codec cache has been initialized */ 795 unsigned int cache_init:1; /* codec cache has been initialized */
794 u32 cache_sync; /* Cache needs to be synced to hardware */
795 796
796 /* codec IO */ 797 /* codec IO */
797 void *control_data; /* codec control (i2c/3wire) data */ 798 void *control_data; /* codec control (i2c/3wire) data */
798 hw_write_t hw_write; 799 hw_write_t hw_write;
799 void *reg_cache; 800 void *reg_cache;
800 struct mutex cache_rw_mutex;
801 801
802 /* component */ 802 /* component */
803 struct snd_soc_component component; 803 struct snd_soc_component component;
@@ -860,8 +860,6 @@ struct snd_soc_platform_driver {
860 860
861 int (*probe)(struct snd_soc_platform *); 861 int (*probe)(struct snd_soc_platform *);
862 int (*remove)(struct snd_soc_platform *); 862 int (*remove)(struct snd_soc_platform *);
863 int (*suspend)(struct snd_soc_dai *dai);
864 int (*resume)(struct snd_soc_dai *dai);
865 struct snd_soc_component_driver component_driver; 863 struct snd_soc_component_driver component_driver;
866 864
867 /* pcm creation and destruction */ 865 /* pcm creation and destruction */
@@ -886,7 +884,7 @@ struct snd_soc_platform_driver {
886 884
887struct snd_soc_dai_link_component { 885struct snd_soc_dai_link_component {
888 const char *name; 886 const char *name;
889 const struct device_node *of_node; 887 struct device_node *of_node;
890 const char *dai_name; 888 const char *dai_name;
891}; 889};
892 890
@@ -894,8 +892,6 @@ struct snd_soc_platform {
894 struct device *dev; 892 struct device *dev;
895 const struct snd_soc_platform_driver *driver; 893 const struct snd_soc_platform_driver *driver;
896 894
897 unsigned int suspended:1; /* platform is suspended */
898
899 struct list_head list; 895 struct list_head list;
900 896
901 struct snd_soc_component component; 897 struct snd_soc_component component;
@@ -990,7 +986,7 @@ struct snd_soc_codec_conf {
990 * DT/OF node, but not both. 986 * DT/OF node, but not both.
991 */ 987 */
992 const char *dev_name; 988 const char *dev_name;
993 const struct device_node *of_node; 989 struct device_node *of_node;
994 990
995 /* 991 /*
996 * optional map of kcontrol, widget and path name prefixes that are 992 * optional map of kcontrol, widget and path name prefixes that are
@@ -1007,7 +1003,7 @@ struct snd_soc_aux_dev {
1007 * DT/OF node, but not both. 1003 * DT/OF node, but not both.
1008 */ 1004 */
1009 const char *codec_name; 1005 const char *codec_name;
1010 const struct device_node *codec_of_node; 1006 struct device_node *codec_of_node;
1011 1007
1012 /* codec/machine specific init - e.g. add machine controls */ 1008 /* codec/machine specific init - e.g. add machine controls */
1013 int (*init)(struct snd_soc_component *component); 1009 int (*init)(struct snd_soc_component *component);
@@ -1264,6 +1260,17 @@ unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
1264int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg, 1260int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
1265 unsigned int val); 1261 unsigned int val);
1266 1262
1263/**
1264 * snd_soc_cache_sync() - Sync the register cache with the hardware
1265 * @codec: CODEC to sync
1266 *
1267 * Note: This function will call regcache_sync()
1268 */
1269static inline int snd_soc_cache_sync(struct snd_soc_codec *codec)
1270{
1271 return regcache_sync(codec->component.regmap);
1272}
1273
1267/* component IO */ 1274/* component IO */
1268int snd_soc_component_read(struct snd_soc_component *component, 1275int snd_soc_component_read(struct snd_soc_component *component,
1269 unsigned int reg, unsigned int *val); 1276 unsigned int reg, unsigned int *val);
@@ -1277,6 +1284,45 @@ void snd_soc_component_async_complete(struct snd_soc_component *component);
1277int snd_soc_component_test_bits(struct snd_soc_component *component, 1284int snd_soc_component_test_bits(struct snd_soc_component *component,
1278 unsigned int reg, unsigned int mask, unsigned int value); 1285 unsigned int reg, unsigned int mask, unsigned int value);
1279 1286
1287#ifdef CONFIG_REGMAP
1288
1289void snd_soc_component_init_regmap(struct snd_soc_component *component,
1290 struct regmap *regmap);
1291void snd_soc_component_exit_regmap(struct snd_soc_component *component);
1292
1293/**
1294 * snd_soc_codec_init_regmap() - Initialize regmap instance for the CODEC
1295 * @codec: The CODEC for which to initialize the regmap instance
1296 * @regmap: The regmap instance that should be used by the CODEC
1297 *
1298 * This function allows deferred assignment of the regmap instance that is
1299 * associated with the CODEC. Only use this if the regmap instance is not yet
1300 * ready when the CODEC is registered. The function must also be called before
1301 * the first IO attempt of the CODEC.
1302 */
1303static inline void snd_soc_codec_init_regmap(struct snd_soc_codec *codec,
1304 struct regmap *regmap)
1305{
1306 snd_soc_component_init_regmap(&codec->component, regmap);
1307}
1308
1309/**
1310 * snd_soc_codec_exit_regmap() - De-initialize regmap instance for the CODEC
1311 * @codec: The CODEC for which to de-initialize the regmap instance
1312 *
1313 * Calls regmap_exit() on the regmap instance associated to the CODEC and
1314 * removes the regmap instance from the CODEC.
1315 *
1316 * This function should only be used if snd_soc_codec_init_regmap() was used to
1317 * initialize the regmap instance.
1318 */
1319static inline void snd_soc_codec_exit_regmap(struct snd_soc_codec *codec)
1320{
1321 snd_soc_component_exit_regmap(&codec->component);
1322}
1323
1324#endif
1325
1280/* device driver data */ 1326/* device driver data */
1281 1327
1282static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card, 1328static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,