Kuninori Morimoto | 1793936 | 2020-05-28 10:47:46 +0900 | [diff] [blame] | 1 | /* 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 Morimoto | bf5bb8d | 2020-05-28 10:48:28 +0900 | [diff] [blame] | 11 | enum snd_soc_card_subclass { |
| 12 | SND_SOC_CARD_CLASS_INIT = 0, |
| 13 | SND_SOC_CARD_CLASS_RUNTIME = 1, |
| 14 | }; |
| 15 | |
Kuninori Morimoto | 209c6cd | 2020-05-28 10:47:56 +0900 | [diff] [blame] | 16 | struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card, |
| 17 | const char *name); |
Kuninori Morimoto | 3359e9b | 2020-05-28 10:48:03 +0900 | [diff] [blame] | 18 | int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type, |
Akihiko Odaki | 19aed2d | 2022-04-08 13:11:14 +0900 | [diff] [blame] | 19 | struct snd_soc_jack *jack); |
| 20 | int 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 Morimoto | 209c6cd | 2020-05-28 10:47:56 +0900 | [diff] [blame] | 24 | |
Kuninori Morimoto | 130dc08 | 2020-05-28 10:48:39 +0900 | [diff] [blame] | 25 | int snd_soc_card_suspend_pre(struct snd_soc_card *card); |
Kuninori Morimoto | d17b60b | 2020-05-28 10:48:48 +0900 | [diff] [blame] | 26 | int snd_soc_card_suspend_post(struct snd_soc_card *card); |
Kuninori Morimoto | 934c752 | 2020-05-28 10:48:55 +0900 | [diff] [blame] | 27 | int snd_soc_card_resume_pre(struct snd_soc_card *card); |
Kuninori Morimoto | 739443d | 2020-05-28 10:49:02 +0900 | [diff] [blame] | 28 | int snd_soc_card_resume_post(struct snd_soc_card *card); |
Kuninori Morimoto | 130dc08 | 2020-05-28 10:48:39 +0900 | [diff] [blame] | 29 | |
Kuninori Morimoto | 73de4b02 | 2020-05-28 10:49:11 +0900 | [diff] [blame] | 30 | int snd_soc_card_probe(struct snd_soc_card *card); |
Kuninori Morimoto | 5c0eac0 | 2020-05-28 10:49:20 +0900 | [diff] [blame] | 31 | int snd_soc_card_late_probe(struct snd_soc_card *card); |
Martin PoviĊĦer | df4d27b | 2022-06-06 21:19:09 +0200 | [diff] [blame] | 32 | void snd_soc_card_fixup_controls(struct snd_soc_card *card); |
Kuninori Morimoto | b0275d9 | 2020-05-28 10:49:26 +0900 | [diff] [blame] | 33 | int snd_soc_card_remove(struct snd_soc_card *card); |
Kuninori Morimoto | 73de4b02 | 2020-05-28 10:49:11 +0900 | [diff] [blame] | 34 | |
Kuninori Morimoto | 39caefd | 2020-05-28 10:49:35 +0900 | [diff] [blame] | 35 | int 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 Morimoto | d41278e | 2020-05-28 10:50:35 +0900 | [diff] [blame] | 38 | int 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 Morimoto | 39caefd | 2020-05-28 10:49:35 +0900 | [diff] [blame] | 41 | |
Kuninori Morimoto | cbc7a6b | 2020-05-28 10:50:41 +0900 | [diff] [blame] | 42 | int snd_soc_card_add_dai_link(struct snd_soc_card *card, |
| 43 | struct snd_soc_dai_link *dai_link); |
Kuninori Morimoto | fcbbcc3 | 2020-05-28 10:50:46 +0900 | [diff] [blame] | 44 | void snd_soc_card_remove_dai_link(struct snd_soc_card *card, |
| 45 | struct snd_soc_dai_link *dai_link); |
Kuninori Morimoto | cbc7a6b | 2020-05-28 10:50:41 +0900 | [diff] [blame] | 46 | |
Kuninori Morimoto | 63efed5 | 2020-05-28 10:48:11 +0900 | [diff] [blame] | 47 | /* device driver data */ |
| 48 | static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card, |
| 49 | void *data) |
| 50 | { |
| 51 | card->drvdata = data; |
| 52 | } |
| 53 | |
| 54 | static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card) |
| 55 | { |
| 56 | return card->drvdata; |
| 57 | } |
| 58 | |
Kuninori Morimoto | 65a7571 | 2020-05-28 10:48:20 +0900 | [diff] [blame] | 59 | static inline |
| 60 | struct 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 Morimoto | 1793936 | 2020-05-28 10:47:46 +0900 | [diff] [blame] | 73 | #endif /* __SOC_CARD_H */ |