1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * mtk-soundcard-driver.h -- MediaTek soundcard driver common definition 4 * 5 * Copyright (c) 2022 MediaTek Inc. 6 * Author: Trevor Wu <trevor.wu@mediatek.com> 7 */ 8 9 #ifndef _MTK_SOUNDCARD_DRIVER_H_ 10 #define _MTK_SOUNDCARD_DRIVER_H_ 11 12 struct mtk_sof_priv; 13 struct mtk_soc_card_data; 14 struct snd_pcm_hw_constraint_list; 15 16 enum mtk_pcm_constraint_type { 17 MTK_CONSTRAINT_PLAYBACK, 18 MTK_CONSTRAINT_CAPTURE, 19 MTK_CONSTRAINT_HDMIDP, 20 MTK_CONSTRAINT_MAX 21 }; 22 23 struct mtk_pcm_constraints_data { 24 const struct snd_pcm_hw_constraint_list *channels; 25 const struct snd_pcm_hw_constraint_list *rates; 26 }; 27 28 struct mtk_platform_card_data { 29 struct snd_soc_card *card; 30 struct snd_soc_jack *jacks; 31 const struct mtk_pcm_constraints_data *pcm_constraints; 32 u8 num_jacks; 33 u8 num_pcm_constraints; 34 u8 flags; 35 }; 36 37 struct mtk_soundcard_pdata { 38 const char *card_name; 39 struct mtk_platform_card_data *card_data; 40 const struct mtk_sof_priv *sof_priv; 41 42 int (*soc_probe)(struct mtk_soc_card_data *card_data, bool legacy); 43 }; 44 45 /* Common playback/capture card startup ops */ 46 extern const struct snd_soc_ops mtk_soundcard_common_playback_ops; 47 extern const struct snd_soc_ops mtk_soundcard_common_capture_ops; 48 49 /* Exported for custom/extended soundcard startup ops */ 50 int mtk_soundcard_startup(struct snd_pcm_substream *substream, 51 enum mtk_pcm_constraint_type ctype); 52 53 int parse_dai_link_info(struct snd_soc_card *card); 54 void clean_card_reference(struct snd_soc_card *card); 55 int mtk_soundcard_common_probe(struct platform_device *pdev); 56 #endif 57