^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * soc-card.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2019 Renesas Electronics Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef __SOC_CARD_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define __SOC_CARD_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) enum snd_soc_card_subclass {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) SND_SOC_CARD_CLASS_INIT = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) SND_SOC_CARD_CLASS_RUNTIME = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct snd_soc_jack *jack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct snd_soc_jack_pin *pins, unsigned int num_pins);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) int snd_soc_card_suspend_pre(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int snd_soc_card_suspend_post(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) int snd_soc_card_resume_pre(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) int snd_soc_card_resume_post(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) int snd_soc_card_probe(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) int snd_soc_card_late_probe(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) int snd_soc_card_remove(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) int snd_soc_card_set_bias_level(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct snd_soc_dapm_context *dapm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) enum snd_soc_bias_level level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct snd_soc_dapm_context *dapm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) enum snd_soc_bias_level level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) int snd_soc_card_add_dai_link(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct snd_soc_dai_link *dai_link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) void snd_soc_card_remove_dai_link(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct snd_soc_dai_link *dai_link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /* device driver data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) card->drvdata = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) return card->drvdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct snd_soc_dai *snd_soc_card_get_codec_dai(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) const char *dai_name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct snd_soc_pcm_runtime *rtd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) for_each_card_rtds(card, rtd) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) if (!strcmp(asoc_rtd_to_codec(rtd, 0)->name, dai_name))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) return asoc_rtd_to_codec(rtd, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #endif /* __SOC_CARD_H */