diff options
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r-- | include/sound/soc.h | 94 |
1 files changed, 72 insertions, 22 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index ed9e2d7e5fdc..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, \ |
@@ -270,7 +272,14 @@ | |||
270 | .get = xhandler_get, .put = xhandler_put, \ | 272 | .get = xhandler_get, .put = xhandler_put, \ |
271 | .private_value = (unsigned long)&(struct soc_bytes_ext) \ | 273 | .private_value = (unsigned long)&(struct soc_bytes_ext) \ |
272 | {.max = xcount} } | 274 | {.max = xcount} } |
273 | 275 | #define SND_SOC_BYTES_TLV(xname, xcount, xhandler_get, xhandler_put) \ | |
276 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
277 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \ | ||
278 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ | ||
279 | .tlv.c = (snd_soc_bytes_tlv_callback), \ | ||
280 | .info = snd_soc_info_bytes_ext, \ | ||
281 | .private_value = (unsigned long)&(struct soc_bytes_ext) \ | ||
282 | {.max = xcount, .get = xhandler_get, .put = xhandler_put, } } | ||
274 | #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ | 283 | #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ |
275 | xmin, xmax, xinvert) \ | 284 | xmin, xmax, xinvert) \ |
276 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 285 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ |
@@ -436,6 +445,10 @@ int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, | |||
436 | int snd_soc_platform_trigger(struct snd_pcm_substream *substream, | 445 | int snd_soc_platform_trigger(struct snd_pcm_substream *substream, |
437 | int cmd, struct snd_soc_platform *platform); | 446 | int cmd, struct snd_soc_platform *platform); |
438 | 447 | ||
448 | int soc_dai_hw_params(struct snd_pcm_substream *substream, | ||
449 | struct snd_pcm_hw_params *params, | ||
450 | struct snd_soc_dai *dai); | ||
451 | |||
439 | /* Jack reporting */ | 452 | /* Jack reporting */ |
440 | int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, | 453 | int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, |
441 | struct snd_soc_jack *jack); | 454 | struct snd_soc_jack *jack); |
@@ -503,10 +516,12 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, | |||
503 | const char *prefix); | 516 | const char *prefix); |
504 | struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card, | 517 | struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card, |
505 | const char *name); | 518 | const char *name); |
519 | int snd_soc_add_component_controls(struct snd_soc_component *component, | ||
520 | const struct snd_kcontrol_new *controls, unsigned int num_controls); | ||
506 | int snd_soc_add_codec_controls(struct snd_soc_codec *codec, | 521 | int snd_soc_add_codec_controls(struct snd_soc_codec *codec, |
507 | const struct snd_kcontrol_new *controls, int num_controls); | 522 | const struct snd_kcontrol_new *controls, unsigned int num_controls); |
508 | int snd_soc_add_platform_controls(struct snd_soc_platform *platform, | 523 | int snd_soc_add_platform_controls(struct snd_soc_platform *platform, |
509 | const struct snd_kcontrol_new *controls, int num_controls); | 524 | const struct snd_kcontrol_new *controls, unsigned int num_controls); |
510 | int snd_soc_add_card_controls(struct snd_soc_card *soc_card, | 525 | int snd_soc_add_card_controls(struct snd_soc_card *soc_card, |
511 | const struct snd_kcontrol_new *controls, int num_controls); | 526 | const struct snd_kcontrol_new *controls, int num_controls); |
512 | int snd_soc_add_dai_controls(struct snd_soc_dai *dai, | 527 | int snd_soc_add_dai_controls(struct snd_soc_dai *dai, |
@@ -552,6 +567,8 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, | |||
552 | struct snd_ctl_elem_value *ucontrol); | 567 | struct snd_ctl_elem_value *ucontrol); |
553 | int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol, | 568 | int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol, |
554 | struct snd_ctl_elem_info *ucontrol); | 569 | struct snd_ctl_elem_info *ucontrol); |
570 | int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag, | ||
571 | unsigned int size, unsigned int __user *tlv); | ||
555 | int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, | 572 | int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, |
556 | struct snd_ctl_elem_info *uinfo); | 573 | struct snd_ctl_elem_info *uinfo); |
557 | int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, | 574 | int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, |
@@ -677,12 +694,17 @@ struct snd_soc_component_driver { | |||
677 | int (*of_xlate_dai_name)(struct snd_soc_component *component, | 694 | int (*of_xlate_dai_name)(struct snd_soc_component *component, |
678 | struct of_phandle_args *args, | 695 | struct of_phandle_args *args, |
679 | 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); | ||
680 | }; | 700 | }; |
681 | 701 | ||
682 | struct snd_soc_component { | 702 | struct snd_soc_component { |
683 | const char *name; | 703 | const char *name; |
684 | int id; | 704 | int id; |
705 | const char *name_prefix; | ||
685 | struct device *dev; | 706 | struct device *dev; |
707 | struct snd_soc_card *card; | ||
686 | 708 | ||
687 | unsigned int active; | 709 | unsigned int active; |
688 | 710 | ||
@@ -705,18 +727,18 @@ struct snd_soc_component { | |||
705 | int val_bytes; | 727 | int val_bytes; |
706 | 728 | ||
707 | 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; | ||
708 | }; | 734 | }; |
709 | 735 | ||
710 | /* SoC Audio Codec device */ | 736 | /* SoC Audio Codec device */ |
711 | struct snd_soc_codec { | 737 | struct snd_soc_codec { |
712 | const char *name; | ||
713 | const char *name_prefix; | ||
714 | int id; | ||
715 | struct device *dev; | 738 | struct device *dev; |
716 | const struct snd_soc_codec_driver *driver; | 739 | const struct snd_soc_codec_driver *driver; |
717 | 740 | ||
718 | struct mutex mutex; | 741 | struct mutex mutex; |
719 | struct snd_soc_card *card; | ||
720 | struct list_head list; | 742 | struct list_head list; |
721 | struct list_head card_list; | 743 | struct list_head card_list; |
722 | 744 | ||
@@ -790,9 +812,6 @@ struct snd_soc_codec_driver { | |||
790 | void (*seq_notifier)(struct snd_soc_dapm_context *, | 812 | void (*seq_notifier)(struct snd_soc_dapm_context *, |
791 | enum snd_soc_dapm_type, int); | 813 | enum snd_soc_dapm_type, int); |
792 | 814 | ||
793 | /* codec stream completion event */ | ||
794 | int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); | ||
795 | |||
796 | bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ | 815 | bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ |
797 | 816 | ||
798 | /* probe ordering - for components with runtime dependencies */ | 817 | /* probe ordering - for components with runtime dependencies */ |
@@ -834,9 +853,6 @@ struct snd_soc_platform_driver { | |||
834 | /* platform stream compress ops */ | 853 | /* platform stream compress ops */ |
835 | const struct snd_compr_ops *compr_ops; | 854 | const struct snd_compr_ops *compr_ops; |
836 | 855 | ||
837 | /* platform stream completion event */ | ||
838 | int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); | ||
839 | |||
840 | /* probe ordering - for components with runtime dependencies */ | 856 | /* probe ordering - for components with runtime dependencies */ |
841 | int probe_order; | 857 | int probe_order; |
842 | int remove_order; | 858 | int remove_order; |
@@ -847,23 +863,23 @@ struct snd_soc_platform_driver { | |||
847 | int (*bespoke_trigger)(struct snd_pcm_substream *, int); | 863 | int (*bespoke_trigger)(struct snd_pcm_substream *, int); |
848 | }; | 864 | }; |
849 | 865 | ||
850 | struct snd_soc_platform { | 866 | struct snd_soc_dai_link_component { |
851 | const char *name; | 867 | const char *name; |
852 | int id; | 868 | const struct device_node *of_node; |
869 | const char *dai_name; | ||
870 | }; | ||
871 | |||
872 | struct snd_soc_platform { | ||
853 | struct device *dev; | 873 | struct device *dev; |
854 | const struct snd_soc_platform_driver *driver; | 874 | const struct snd_soc_platform_driver *driver; |
855 | 875 | ||
856 | unsigned int suspended:1; /* platform is suspended */ | 876 | unsigned int suspended:1; /* platform is suspended */ |
857 | unsigned int probed:1; | 877 | unsigned int probed:1; |
858 | 878 | ||
859 | struct snd_soc_card *card; | ||
860 | struct list_head list; | 879 | struct list_head list; |
861 | struct list_head card_list; | ||
862 | 880 | ||
863 | struct snd_soc_component component; | 881 | struct snd_soc_component component; |
864 | 882 | ||
865 | struct snd_soc_dapm_context dapm; | ||
866 | |||
867 | #ifdef CONFIG_DEBUG_FS | 883 | #ifdef CONFIG_DEBUG_FS |
868 | struct dentry *debugfs_platform_root; | 884 | struct dentry *debugfs_platform_root; |
869 | #endif | 885 | #endif |
@@ -896,6 +912,10 @@ struct snd_soc_dai_link { | |||
896 | const struct device_node *codec_of_node; | 912 | const struct device_node *codec_of_node; |
897 | /* You MUST specify the DAI name within the codec */ | 913 | /* You MUST specify the DAI name within the codec */ |
898 | 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 | |||
899 | /* | 919 | /* |
900 | * 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 |
901 | * 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 |
@@ -1047,7 +1067,6 @@ struct snd_soc_card { | |||
1047 | 1067 | ||
1048 | /* lists of probed devices belonging to this card */ | 1068 | /* lists of probed devices belonging to this card */ |
1049 | struct list_head codec_dev_list; | 1069 | struct list_head codec_dev_list; |
1050 | struct list_head platform_dev_list; | ||
1051 | 1070 | ||
1052 | struct list_head widgets; | 1071 | struct list_head widgets; |
1053 | struct list_head paths; | 1072 | struct list_head paths; |
@@ -1094,6 +1113,9 @@ struct snd_soc_pcm_runtime { | |||
1094 | struct snd_soc_dai *codec_dai; | 1113 | struct snd_soc_dai *codec_dai; |
1095 | struct snd_soc_dai *cpu_dai; | 1114 | struct snd_soc_dai *cpu_dai; |
1096 | 1115 | ||
1116 | struct snd_soc_dai **codec_dais; | ||
1117 | unsigned int num_codecs; | ||
1118 | |||
1097 | struct delayed_work delayed_work; | 1119 | struct delayed_work delayed_work; |
1098 | #ifdef CONFIG_DEBUG_FS | 1120 | #ifdef CONFIG_DEBUG_FS |
1099 | struct dentry *debugfs_dpcm_root; | 1121 | struct dentry *debugfs_dpcm_root; |
@@ -1119,6 +1141,9 @@ struct soc_bytes { | |||
1119 | 1141 | ||
1120 | struct soc_bytes_ext { | 1142 | struct soc_bytes_ext { |
1121 | int max; | 1143 | int max; |
1144 | /* used for TLV byte control */ | ||
1145 | int (*get)(unsigned int __user *bytes, unsigned int size); | ||
1146 | int (*put)(const unsigned int __user *bytes, unsigned int size); | ||
1122 | }; | 1147 | }; |
1123 | 1148 | ||
1124 | /* multi register control */ | 1149 | /* multi register control */ |
@@ -1165,6 +1190,21 @@ static inline struct snd_soc_platform *snd_soc_component_to_platform( | |||
1165 | } | 1190 | } |
1166 | 1191 | ||
1167 | /** | 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 | */ | ||
1201 | static 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 | /** | ||
1168 | * 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 |
1169 | * @dapm: The DAPM context to cast to the CODEC | 1209 | * @dapm: The DAPM context to cast to the CODEC |
1170 | * | 1210 | * |
@@ -1188,7 +1228,18 @@ static inline struct snd_soc_codec *snd_soc_dapm_to_codec( | |||
1188 | static inline struct snd_soc_platform *snd_soc_dapm_to_platform( | 1228 | static inline struct snd_soc_platform *snd_soc_dapm_to_platform( |
1189 | struct snd_soc_dapm_context *dapm) | 1229 | struct snd_soc_dapm_context *dapm) |
1190 | { | 1230 | { |
1191 | 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 | */ | ||
1239 | static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm( | ||
1240 | struct snd_soc_component *component) | ||
1241 | { | ||
1242 | return component->dapm_ptr; | ||
1192 | } | 1243 | } |
1193 | 1244 | ||
1194 | /* codec IO */ | 1245 | /* codec IO */ |
@@ -1261,7 +1312,6 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd) | |||
1261 | static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) | 1312 | static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) |
1262 | { | 1313 | { |
1263 | INIT_LIST_HEAD(&card->codec_dev_list); | 1314 | INIT_LIST_HEAD(&card->codec_dev_list); |
1264 | INIT_LIST_HEAD(&card->platform_dev_list); | ||
1265 | INIT_LIST_HEAD(&card->widgets); | 1315 | INIT_LIST_HEAD(&card->widgets); |
1266 | INIT_LIST_HEAD(&card->paths); | 1316 | INIT_LIST_HEAD(&card->paths); |
1267 | INIT_LIST_HEAD(&card->dapm_list); | 1317 | INIT_LIST_HEAD(&card->dapm_list); |