2020-05-28 04:47:46 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0
|
|
|
|
*
|
|
|
|
* soc-card.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 Renesas Electronics Corp.
|
|
|
|
* Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
|
|
|
|
*/
|
|
|
|
#ifndef __SOC_CARD_H
|
|
|
|
#define __SOC_CARD_H
|
|
|
|
|
2020-05-28 04:48:28 +03:00
|
|
|
enum snd_soc_card_subclass {
|
2023-04-06 03:16:27 +03:00
|
|
|
SND_SOC_CARD_CLASS_ROOT = 0,
|
2020-05-28 04:48:28 +03:00
|
|
|
SND_SOC_CARD_CLASS_RUNTIME = 1,
|
|
|
|
};
|
|
|
|
|
2023-04-06 03:16:27 +03:00
|
|
|
static inline void snd_soc_card_mutex_lock_root(struct snd_soc_card *card)
|
|
|
|
{
|
|
|
|
mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_ROOT);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void snd_soc_card_mutex_lock(struct snd_soc_card *card)
|
|
|
|
{
|
|
|
|
mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void snd_soc_card_mutex_unlock(struct snd_soc_card *card)
|
|
|
|
{
|
|
|
|
mutex_unlock(&card->mutex);
|
|
|
|
}
|
|
|
|
|
2020-05-28 04:47:56 +03:00
|
|
|
struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
|
|
|
|
const char *name);
|
2020-05-28 04:48:03 +03:00
|
|
|
int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
|
2022-04-08 07:11:14 +03:00
|
|
|
struct snd_soc_jack *jack);
|
|
|
|
int snd_soc_card_jack_new_pins(struct snd_soc_card *card, const char *id,
|
|
|
|
int type, struct snd_soc_jack *jack,
|
|
|
|
struct snd_soc_jack_pin *pins,
|
|
|
|
unsigned int num_pins);
|
2020-05-28 04:47:56 +03:00
|
|
|
|
2020-05-28 04:48:39 +03:00
|
|
|
int snd_soc_card_suspend_pre(struct snd_soc_card *card);
|
2020-05-28 04:48:48 +03:00
|
|
|
int snd_soc_card_suspend_post(struct snd_soc_card *card);
|
2020-05-28 04:48:55 +03:00
|
|
|
int snd_soc_card_resume_pre(struct snd_soc_card *card);
|
2020-05-28 04:49:02 +03:00
|
|
|
int snd_soc_card_resume_post(struct snd_soc_card *card);
|
2020-05-28 04:48:39 +03:00
|
|
|
|
2020-05-28 04:49:11 +03:00
|
|
|
int snd_soc_card_probe(struct snd_soc_card *card);
|
2020-05-28 04:49:20 +03:00
|
|
|
int snd_soc_card_late_probe(struct snd_soc_card *card);
|
2022-06-06 22:19:09 +03:00
|
|
|
void snd_soc_card_fixup_controls(struct snd_soc_card *card);
|
2020-05-28 04:49:26 +03:00
|
|
|
int snd_soc_card_remove(struct snd_soc_card *card);
|
2020-05-28 04:49:11 +03:00
|
|
|
|
2020-05-28 04:49:35 +03:00
|
|
|
int snd_soc_card_set_bias_level(struct snd_soc_card *card,
|
|
|
|
struct snd_soc_dapm_context *dapm,
|
|
|
|
enum snd_soc_bias_level level);
|
2020-05-28 04:50:35 +03:00
|
|
|
int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
|
|
|
|
struct snd_soc_dapm_context *dapm,
|
|
|
|
enum snd_soc_bias_level level);
|
2020-05-28 04:49:35 +03:00
|
|
|
|
2020-05-28 04:50:41 +03:00
|
|
|
int snd_soc_card_add_dai_link(struct snd_soc_card *card,
|
|
|
|
struct snd_soc_dai_link *dai_link);
|
2020-05-28 04:50:46 +03:00
|
|
|
void snd_soc_card_remove_dai_link(struct snd_soc_card *card,
|
|
|
|
struct snd_soc_dai_link *dai_link);
|
2020-05-28 04:50:41 +03:00
|
|
|
|
2020-05-28 04:48:11 +03:00
|
|
|
/* device driver data */
|
|
|
|
static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
card->drvdata = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
|
|
|
|
{
|
|
|
|
return card->drvdata;
|
|
|
|
}
|
|
|
|
|
2020-05-28 04:48:20 +03:00
|
|
|
static inline
|
|
|
|
struct snd_soc_dai *snd_soc_card_get_codec_dai(struct snd_soc_card *card,
|
|
|
|
const char *dai_name)
|
|
|
|
{
|
|
|
|
struct snd_soc_pcm_runtime *rtd;
|
|
|
|
|
|
|
|
for_each_card_rtds(card, rtd) {
|
|
|
|
if (!strcmp(asoc_rtd_to_codec(rtd, 0)->name, dai_name))
|
|
|
|
return asoc_rtd_to_codec(rtd, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-05-28 04:47:46 +03:00
|
|
|
#endif /* __SOC_CARD_H */
|