aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/soc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r--include/sound/soc.h80
1 files changed, 59 insertions, 21 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 688fa667dee5..be6ecae247b0 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -248,6 +248,8 @@
248 .info = snd_soc_info_enum_double, \ 248 .info = snd_soc_info_enum_double, \
249 .get = xhandler_get, .put = xhandler_put, \ 249 .get = xhandler_get, .put = xhandler_put, \
250 .private_value = (unsigned long)&xenum } 250 .private_value = (unsigned long)&xenum }
251#define SOC_VALUE_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
252 SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put)
251 253
252#define SND_SOC_BYTES(xname, xbase, xregs) \ 254#define SND_SOC_BYTES(xname, xbase, xregs) \
253{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 255{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -443,6 +445,10 @@ int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
443int snd_soc_platform_trigger(struct snd_pcm_substream *substream, 445int snd_soc_platform_trigger(struct snd_pcm_substream *substream,
444 int cmd, struct snd_soc_platform *platform); 446 int cmd, struct snd_soc_platform *platform);
445 447
448int soc_dai_hw_params(struct snd_pcm_substream *substream,
449 struct snd_pcm_hw_params *params,
450 struct snd_soc_dai *dai);
451
446/* Jack reporting */ 452/* Jack reporting */
447int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, 453int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
448 struct snd_soc_jack *jack); 454 struct snd_soc_jack *jack);
@@ -510,10 +516,12 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
510 const char *prefix); 516 const char *prefix);
511struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card, 517struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
512 const char *name); 518 const char *name);
519int snd_soc_add_component_controls(struct snd_soc_component *component,
520 const struct snd_kcontrol_new *controls, unsigned int num_controls);
513int snd_soc_add_codec_controls(struct snd_soc_codec *codec, 521int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
514 const struct snd_kcontrol_new *controls, int num_controls); 522 const struct snd_kcontrol_new *controls, unsigned int num_controls);
515int snd_soc_add_platform_controls(struct snd_soc_platform *platform, 523int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
516 const struct snd_kcontrol_new *controls, int num_controls); 524 const struct snd_kcontrol_new *controls, unsigned int num_controls);
517int snd_soc_add_card_controls(struct snd_soc_card *soc_card, 525int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
518 const struct snd_kcontrol_new *controls, int num_controls); 526 const struct snd_kcontrol_new *controls, int num_controls);
519int snd_soc_add_dai_controls(struct snd_soc_dai *dai, 527int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
@@ -686,12 +694,17 @@ struct snd_soc_component_driver {
686 int (*of_xlate_dai_name)(struct snd_soc_component *component, 694 int (*of_xlate_dai_name)(struct snd_soc_component *component,
687 struct of_phandle_args *args, 695 struct of_phandle_args *args,
688 const char **dai_name); 696 const char **dai_name);
697 void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type,
698 int subseq);
699 int (*stream_event)(struct snd_soc_component *, int event);
689}; 700};
690 701
691struct snd_soc_component { 702struct snd_soc_component {
692 const char *name; 703 const char *name;
693 int id; 704 int id;
705 const char *name_prefix;
694 struct device *dev; 706 struct device *dev;
707 struct snd_soc_card *card;
695 708
696 unsigned int active; 709 unsigned int active;
697 710
@@ -714,18 +727,18 @@ struct snd_soc_component {
714 int val_bytes; 727 int val_bytes;
715 728
716 struct mutex io_mutex; 729 struct mutex io_mutex;
730
731 /* Don't use these, use snd_soc_component_get_dapm() */
732 struct snd_soc_dapm_context dapm;
733 struct snd_soc_dapm_context *dapm_ptr;
717}; 734};
718 735
719/* SoC Audio Codec device */ 736/* SoC Audio Codec device */
720struct snd_soc_codec { 737struct snd_soc_codec {
721 const char *name;
722 const char *name_prefix;
723 int id;
724 struct device *dev; 738 struct device *dev;
725 const struct snd_soc_codec_driver *driver; 739 const struct snd_soc_codec_driver *driver;
726 740
727 struct mutex mutex; 741 struct mutex mutex;
728 struct snd_soc_card *card;
729 struct list_head list; 742 struct list_head list;
730 struct list_head card_list; 743 struct list_head card_list;
731 744
@@ -799,9 +812,6 @@ struct snd_soc_codec_driver {
799 void (*seq_notifier)(struct snd_soc_dapm_context *, 812 void (*seq_notifier)(struct snd_soc_dapm_context *,
800 enum snd_soc_dapm_type, int); 813 enum snd_soc_dapm_type, int);
801 814
802 /* codec stream completion event */
803 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
804
805 bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ 815 bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */
806 816
807 /* probe ordering - for components with runtime dependencies */ 817 /* probe ordering - for components with runtime dependencies */
@@ -843,9 +853,6 @@ struct snd_soc_platform_driver {
843 /* platform stream compress ops */ 853 /* platform stream compress ops */
844 const struct snd_compr_ops *compr_ops; 854 const struct snd_compr_ops *compr_ops;
845 855
846 /* platform stream completion event */
847 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
848
849 /* probe ordering - for components with runtime dependencies */ 856 /* probe ordering - for components with runtime dependencies */
850 int probe_order; 857 int probe_order;
851 int remove_order; 858 int remove_order;
@@ -856,23 +863,23 @@ struct snd_soc_platform_driver {
856 int (*bespoke_trigger)(struct snd_pcm_substream *, int); 863 int (*bespoke_trigger)(struct snd_pcm_substream *, int);
857}; 864};
858 865
859struct snd_soc_platform { 866struct snd_soc_dai_link_component {
860 const char *name; 867 const char *name;
861 int id; 868 const struct device_node *of_node;
869 const char *dai_name;
870};
871
872struct snd_soc_platform {
862 struct device *dev; 873 struct device *dev;
863 const struct snd_soc_platform_driver *driver; 874 const struct snd_soc_platform_driver *driver;
864 875
865 unsigned int suspended:1; /* platform is suspended */ 876 unsigned int suspended:1; /* platform is suspended */
866 unsigned int probed:1; 877 unsigned int probed:1;
867 878
868 struct snd_soc_card *card;
869 struct list_head list; 879 struct list_head list;
870 struct list_head card_list;
871 880
872 struct snd_soc_component component; 881 struct snd_soc_component component;
873 882
874 struct snd_soc_dapm_context dapm;
875
876#ifdef CONFIG_DEBUG_FS 883#ifdef CONFIG_DEBUG_FS
877 struct dentry *debugfs_platform_root; 884 struct dentry *debugfs_platform_root;
878#endif 885#endif
@@ -905,6 +912,10 @@ struct snd_soc_dai_link {
905 const struct device_node *codec_of_node; 912 const struct device_node *codec_of_node;
906 /* You MUST specify the DAI name within the codec */ 913 /* You MUST specify the DAI name within the codec */
907 const char *codec_dai_name; 914 const char *codec_dai_name;
915
916 struct snd_soc_dai_link_component *codecs;
917 unsigned int num_codecs;
918
908 /* 919 /*
909 * You MAY specify the link's platform/PCM/DMA driver, either by 920 * You MAY specify the link's platform/PCM/DMA driver, either by
910 * device name, or by DT/OF node, but not both. Some forms of link 921 * device name, or by DT/OF node, but not both. Some forms of link
@@ -1056,7 +1067,6 @@ struct snd_soc_card {
1056 1067
1057 /* lists of probed devices belonging to this card */ 1068 /* lists of probed devices belonging to this card */
1058 struct list_head codec_dev_list; 1069 struct list_head codec_dev_list;
1059 struct list_head platform_dev_list;
1060 1070
1061 struct list_head widgets; 1071 struct list_head widgets;
1062 struct list_head paths; 1072 struct list_head paths;
@@ -1103,6 +1113,9 @@ struct snd_soc_pcm_runtime {
1103 struct snd_soc_dai *codec_dai; 1113 struct snd_soc_dai *codec_dai;
1104 struct snd_soc_dai *cpu_dai; 1114 struct snd_soc_dai *cpu_dai;
1105 1115
1116 struct snd_soc_dai **codec_dais;
1117 unsigned int num_codecs;
1118
1106 struct delayed_work delayed_work; 1119 struct delayed_work delayed_work;
1107#ifdef CONFIG_DEBUG_FS 1120#ifdef CONFIG_DEBUG_FS
1108 struct dentry *debugfs_dpcm_root; 1121 struct dentry *debugfs_dpcm_root;
@@ -1177,6 +1190,21 @@ static inline struct snd_soc_platform *snd_soc_component_to_platform(
1177} 1190}
1178 1191
1179/** 1192/**
1193 * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
1194 * embedded in
1195 * @dapm: The DAPM context to cast to the component
1196 *
1197 * This function must only be used on DAPM contexts that are known to be part of
1198 * a component (e.g. in a component driver). Otherwise the behavior is
1199 * undefined.
1200 */
1201static inline struct snd_soc_component *snd_soc_dapm_to_component(
1202 struct snd_soc_dapm_context *dapm)
1203{
1204 return container_of(dapm, struct snd_soc_component, dapm);
1205}
1206
1207/**
1180 * snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in 1208 * snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in
1181 * @dapm: The DAPM context to cast to the CODEC 1209 * @dapm: The DAPM context to cast to the CODEC
1182 * 1210 *
@@ -1200,7 +1228,18 @@ static inline struct snd_soc_codec *snd_soc_dapm_to_codec(
1200static inline struct snd_soc_platform *snd_soc_dapm_to_platform( 1228static inline struct snd_soc_platform *snd_soc_dapm_to_platform(
1201 struct snd_soc_dapm_context *dapm) 1229 struct snd_soc_dapm_context *dapm)
1202{ 1230{
1203 return container_of(dapm, struct snd_soc_platform, dapm); 1231 return snd_soc_component_to_platform(snd_soc_dapm_to_component(dapm));
1232}
1233
1234/**
1235 * snd_soc_component_get_dapm() - Returns the DAPM context associated with a
1236 * component
1237 * @component: The component for which to get the DAPM context
1238 */
1239static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
1240 struct snd_soc_component *component)
1241{
1242 return component->dapm_ptr;
1204} 1243}
1205 1244
1206/* codec IO */ 1245/* codec IO */
@@ -1273,7 +1312,6 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
1273static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) 1312static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
1274{ 1313{
1275 INIT_LIST_HEAD(&card->codec_dev_list); 1314 INIT_LIST_HEAD(&card->codec_dev_list);
1276 INIT_LIST_HEAD(&card->platform_dev_list);
1277 INIT_LIST_HEAD(&card->widgets); 1315 INIT_LIST_HEAD(&card->widgets);
1278 INIT_LIST_HEAD(&card->paths); 1316 INIT_LIST_HEAD(&card->paths);
1279 INIT_LIST_HEAD(&card->dapm_list); 1317 INIT_LIST_HEAD(&card->dapm_list);