blob: 9d31a5c0db33c2ff36a18b8629430c218884e889 [file] [log] [blame]
Kuninori Morimoto17939362020-05-28 10:47:46 +09001/* SPDX-License-Identifier: GPL-2.0
2 *
3 * soc-card.h
4 *
5 * Copyright (C) 2019 Renesas Electronics Corp.
6 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
7 */
8#ifndef __SOC_CARD_H
9#define __SOC_CARD_H
10
Kuninori Morimotobf5bb8d2020-05-28 10:48:28 +090011enum snd_soc_card_subclass {
12 SND_SOC_CARD_CLASS_INIT = 0,
13 SND_SOC_CARD_CLASS_RUNTIME = 1,
14};
15
Kuninori Morimoto209c6cd2020-05-28 10:47:56 +090016struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
17 const char *name);
Kuninori Morimoto3359e9b2020-05-28 10:48:03 +090018int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
Akihiko Odaki19aed2d2022-04-08 13:11:14 +090019 struct snd_soc_jack *jack);
20int snd_soc_card_jack_new_pins(struct snd_soc_card *card, const char *id,
21 int type, struct snd_soc_jack *jack,
22 struct snd_soc_jack_pin *pins,
23 unsigned int num_pins);
Kuninori Morimoto209c6cd2020-05-28 10:47:56 +090024
Kuninori Morimoto130dc082020-05-28 10:48:39 +090025int snd_soc_card_suspend_pre(struct snd_soc_card *card);
Kuninori Morimotod17b60b2020-05-28 10:48:48 +090026int snd_soc_card_suspend_post(struct snd_soc_card *card);
Kuninori Morimoto934c7522020-05-28 10:48:55 +090027int snd_soc_card_resume_pre(struct snd_soc_card *card);
Kuninori Morimoto739443d2020-05-28 10:49:02 +090028int snd_soc_card_resume_post(struct snd_soc_card *card);
Kuninori Morimoto130dc082020-05-28 10:48:39 +090029
Kuninori Morimoto73de4b022020-05-28 10:49:11 +090030int snd_soc_card_probe(struct snd_soc_card *card);
Kuninori Morimoto5c0eac02020-05-28 10:49:20 +090031int snd_soc_card_late_probe(struct snd_soc_card *card);
Martin PoviĊĦerdf4d27b2022-06-06 21:19:09 +020032void snd_soc_card_fixup_controls(struct snd_soc_card *card);
Kuninori Morimotob0275d92020-05-28 10:49:26 +090033int snd_soc_card_remove(struct snd_soc_card *card);
Kuninori Morimoto73de4b022020-05-28 10:49:11 +090034
Kuninori Morimoto39caefd2020-05-28 10:49:35 +090035int snd_soc_card_set_bias_level(struct snd_soc_card *card,
36 struct snd_soc_dapm_context *dapm,
37 enum snd_soc_bias_level level);
Kuninori Morimotod41278e2020-05-28 10:50:35 +090038int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
39 struct snd_soc_dapm_context *dapm,
40 enum snd_soc_bias_level level);
Kuninori Morimoto39caefd2020-05-28 10:49:35 +090041
Kuninori Morimotocbc7a6b2020-05-28 10:50:41 +090042int snd_soc_card_add_dai_link(struct snd_soc_card *card,
43 struct snd_soc_dai_link *dai_link);
Kuninori Morimotofcbbcc32020-05-28 10:50:46 +090044void snd_soc_card_remove_dai_link(struct snd_soc_card *card,
45 struct snd_soc_dai_link *dai_link);
Kuninori Morimotocbc7a6b2020-05-28 10:50:41 +090046
Kuninori Morimoto63efed52020-05-28 10:48:11 +090047/* device driver data */
48static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
49 void *data)
50{
51 card->drvdata = data;
52}
53
54static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
55{
56 return card->drvdata;
57}
58
Kuninori Morimoto65a75712020-05-28 10:48:20 +090059static inline
60struct snd_soc_dai *snd_soc_card_get_codec_dai(struct snd_soc_card *card,
61 const char *dai_name)
62{
63 struct snd_soc_pcm_runtime *rtd;
64
65 for_each_card_rtds(card, rtd) {
66 if (!strcmp(asoc_rtd_to_codec(rtd, 0)->name, dai_name))
67 return asoc_rtd_to_codec(rtd, 0);
68 }
69
70 return NULL;
71}
72
Kuninori Morimoto17939362020-05-28 10:47:46 +090073#endif /* __SOC_CARD_H */