aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--include/sound/soc.h117
-rw-r--r--include/sound/sta350.h52
3 files changed, 144 insertions, 26 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index ef78f562f4a8..75020f52acdd 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -606,6 +606,7 @@ struct snd_soc_dapm_context {
606 enum snd_soc_dapm_type, int); 606 enum snd_soc_dapm_type, int);
607 607
608 struct device *dev; /* from parent - for debug */ 608 struct device *dev; /* from parent - for debug */
609 struct snd_soc_component *component; /* parent component */
609 struct snd_soc_codec *codec; /* parent codec */ 610 struct snd_soc_codec *codec; /* parent codec */
610 struct snd_soc_platform *platform; /* parent platform */ 611 struct snd_soc_platform *platform; /* parent platform */
611 struct snd_soc_card *card; /* parent card */ 612 struct snd_soc_card *card; /* parent card */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0b83168d8ff4..c0b65fc90783 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -393,14 +393,6 @@ int devm_snd_soc_register_component(struct device *dev,
393 const struct snd_soc_component_driver *cmpnt_drv, 393 const struct snd_soc_component_driver *cmpnt_drv,
394 struct snd_soc_dai_driver *dai_drv, int num_dai); 394 struct snd_soc_dai_driver *dai_drv, int num_dai);
395void snd_soc_unregister_component(struct device *dev); 395void 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); 396int snd_soc_cache_sync(struct snd_soc_codec *codec);
405int snd_soc_cache_init(struct snd_soc_codec *codec); 397int snd_soc_cache_init(struct snd_soc_codec *codec);
406int snd_soc_cache_exit(struct snd_soc_codec *codec); 398int snd_soc_cache_exit(struct snd_soc_codec *codec);
@@ -469,12 +461,12 @@ static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
469#endif 461#endif
470 462
471/* codec register bit access */ 463/* codec register bit access */
472int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, 464int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned int reg,
473 unsigned int mask, unsigned int value); 465 unsigned int mask, unsigned int value);
474int snd_soc_update_bits_locked(struct snd_soc_codec *codec, 466int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
475 unsigned short reg, unsigned int mask, 467 unsigned int reg, unsigned int mask,
476 unsigned int value); 468 unsigned int value);
477int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, 469int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg,
478 unsigned int mask, unsigned int value); 470 unsigned int mask, unsigned int value);
479 471
480int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, 472int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
@@ -668,6 +660,7 @@ struct snd_soc_component {
668 unsigned int active; 660 unsigned int active;
669 661
670 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ 662 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
663 unsigned int registered_as_component:1;
671 664
672 struct list_head list; 665 struct list_head list;
673 666
@@ -677,6 +670,14 @@ struct snd_soc_component {
677 const struct snd_soc_component_driver *driver; 670 const struct snd_soc_component_driver *driver;
678 671
679 struct list_head dai_list; 672 struct list_head dai_list;
673
674 int (*read)(struct snd_soc_component *, unsigned int, unsigned int *);
675 int (*write)(struct snd_soc_component *, unsigned int, unsigned int);
676
677 struct regmap *regmap;
678 int val_bytes;
679
680 struct mutex io_mutex;
680}; 681};
681 682
682/* SoC Audio Codec device */ 683/* SoC Audio Codec device */
@@ -692,9 +693,6 @@ struct snd_soc_codec {
692 struct list_head list; 693 struct list_head list;
693 struct list_head card_list; 694 struct list_head card_list;
694 int num_dai; 695 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 696
699 /* runtime */ 697 /* runtime */
700 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 698 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
@@ -704,18 +702,14 @@ struct snd_soc_codec {
704 unsigned int ac97_registered:1; /* Codec has been AC97 registered */ 702 unsigned int ac97_registered:1; /* Codec has been AC97 registered */
705 unsigned int ac97_created:1; /* Codec has been created by SoC */ 703 unsigned int ac97_created:1; /* Codec has been created by SoC */
706 unsigned int cache_init:1; /* codec cache has been initialized */ 704 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 */ 705 u32 cache_only; /* Suppress writes to hardware */
709 u32 cache_sync; /* Cache needs to be synced to hardware */ 706 u32 cache_sync; /* Cache needs to be synced to hardware */
710 707
711 /* codec IO */ 708 /* codec IO */
712 void *control_data; /* codec control (i2c/3wire) data */ 709 void *control_data; /* codec control (i2c/3wire) data */
713 hw_write_t hw_write; 710 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; 711 void *reg_cache;
717 struct mutex cache_rw_mutex; 712 struct mutex cache_rw_mutex;
718 int val_bytes;
719 713
720 /* component */ 714 /* component */
721 struct snd_soc_component component; 715 struct snd_soc_component component;
@@ -754,13 +748,9 @@ struct snd_soc_codec_driver {
754 unsigned int freq_in, unsigned int freq_out); 748 unsigned int freq_in, unsigned int freq_out);
755 749
756 /* codec IO */ 750 /* codec IO */
751 struct regmap *(*get_regmap)(struct device *);
757 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 752 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
758 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 753 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; 754 unsigned int reg_cache_size;
765 short reg_cache_step; 755 short reg_cache_step;
766 short reg_word_size; 756 short reg_word_size;
@@ -791,6 +781,7 @@ struct snd_soc_platform_driver {
791 int (*remove)(struct snd_soc_platform *); 781 int (*remove)(struct snd_soc_platform *);
792 int (*suspend)(struct snd_soc_dai *dai); 782 int (*suspend)(struct snd_soc_dai *dai);
793 int (*resume)(struct snd_soc_dai *dai); 783 int (*resume)(struct snd_soc_dai *dai);
784 struct snd_soc_component_driver component_driver;
794 785
795 /* pcm creation and destruction */ 786 /* pcm creation and destruction */
796 int (*pcm_new)(struct snd_soc_pcm_runtime *); 787 int (*pcm_new)(struct snd_soc_pcm_runtime *);
@@ -835,7 +826,6 @@ struct snd_soc_platform {
835 int id; 826 int id;
836 struct device *dev; 827 struct device *dev;
837 const struct snd_soc_platform_driver *driver; 828 const struct snd_soc_platform_driver *driver;
838 struct mutex mutex;
839 829
840 unsigned int suspended:1; /* platform is suspended */ 830 unsigned int suspended:1; /* platform is suspended */
841 unsigned int probed:1; 831 unsigned int probed:1;
@@ -844,6 +834,8 @@ struct snd_soc_platform {
844 struct list_head list; 834 struct list_head list;
845 struct list_head card_list; 835 struct list_head card_list;
846 836
837 struct snd_soc_component component;
838
847 struct snd_soc_dapm_context dapm; 839 struct snd_soc_dapm_context dapm;
848 840
849#ifdef CONFIG_DEBUG_FS 841#ifdef CONFIG_DEBUG_FS
@@ -1120,10 +1112,39 @@ static inline struct snd_soc_codec *snd_soc_component_to_codec(
1120 return container_of(component, struct snd_soc_codec, component); 1112 return container_of(component, struct snd_soc_codec, component);
1121} 1113}
1122 1114
1115/**
1116 * snd_soc_component_to_platform() - Casts a component to the platform it is embedded in
1117 * @component: The component to cast to a platform
1118 *
1119 * This function must only be used on components that are known to be platforms.
1120 * Otherwise the behavior is undefined.
1121 */
1122static inline struct snd_soc_platform *snd_soc_component_to_platform(
1123 struct snd_soc_component *component)
1124{
1125 return container_of(component, struct snd_soc_platform, component);
1126}
1127
1123/* codec IO */ 1128/* codec IO */
1124unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); 1129unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
1125unsigned int snd_soc_write(struct snd_soc_codec *codec, 1130int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
1126 unsigned int reg, unsigned int val); 1131 unsigned int val);
1132
1133/* component IO */
1134int snd_soc_component_read(struct snd_soc_component *component,
1135 unsigned int reg, unsigned int *val);
1136int snd_soc_component_write(struct snd_soc_component *component,
1137 unsigned int reg, unsigned int val);
1138int snd_soc_component_update_bits(struct snd_soc_component *component,
1139 unsigned int reg, unsigned int mask, unsigned int val);
1140int snd_soc_component_update_bits_async(struct snd_soc_component *component,
1141 unsigned int reg, unsigned int mask, unsigned int val);
1142void snd_soc_component_async_complete(struct snd_soc_component *component);
1143int snd_soc_component_test_bits(struct snd_soc_component *component,
1144 unsigned int reg, unsigned int mask, unsigned int value);
1145
1146int snd_soc_component_init_io(struct snd_soc_component *component,
1147 struct regmap *regmap);
1127 1148
1128/* device driver data */ 1149/* device driver data */
1129 1150
@@ -1228,6 +1249,50 @@ static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
1228 return snd_soc_component_is_active(&codec->component); 1249 return snd_soc_component_is_active(&codec->component);
1229} 1250}
1230 1251
1252/**
1253 * snd_soc_kcontrol_component() - Returns the component that registered the
1254 * control
1255 * @kcontrol: The control for which to get the component
1256 *
1257 * Note: This function will work correctly if the control has been registered
1258 * for a component. Either with snd_soc_add_codec_controls() or
1259 * snd_soc_add_platform_controls() or via table based setup for either a
1260 * CODEC, a platform or component driver. Otherwise the behavior is undefined.
1261 */
1262static inline struct snd_soc_component *snd_soc_kcontrol_component(
1263 struct snd_kcontrol *kcontrol)
1264{
1265 return snd_kcontrol_chip(kcontrol);
1266}
1267
1268/**
1269 * snd_soc_kcontrol_codec() - Returns the CODEC that registered the control
1270 * @kcontrol: The control for which to get the CODEC
1271 *
1272 * Note: This function will only work correctly if the control has been
1273 * registered with snd_soc_add_codec_controls() or via table based setup of
1274 * snd_soc_codec_driver. Otherwise the behavior is undefined.
1275 */
1276static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
1277 struct snd_kcontrol *kcontrol)
1278{
1279 return snd_soc_component_to_codec(snd_soc_kcontrol_component(kcontrol));
1280}
1281
1282/**
1283 * snd_soc_kcontrol_platform() - Returns the platform that registerd the control
1284 * @kcontrol: The control for which to get the platform
1285 *
1286 * Note: This function will only work correctly if the control has been
1287 * registered with snd_soc_add_platform_controls() or via table based setup of
1288 * a snd_soc_platform_driver. Otherwise the behavior is undefined.
1289 */
1290static inline struct snd_soc_platform *snd_soc_kcontrol_platform(
1291 struct snd_kcontrol *kcontrol)
1292{
1293 return snd_soc_component_to_platform(snd_soc_kcontrol_component(kcontrol));
1294}
1295
1231int snd_soc_util_init(void); 1296int snd_soc_util_init(void);
1232void snd_soc_util_exit(void); 1297void snd_soc_util_exit(void);
1233 1298
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 */