#include <linux/bitops.h>
#include <linux/regmap.h>
#include <sound/pcm_params.h>
#include "mt8186-afe-clk.h"
#include "mt8186-afe-common.h"
#include "mt8186-afe-gpio.h"
#include "mt8186-interconnection.h"
enum { … };
enum { … };
enum { … };
enum { … };
enum { … };
struct mtk_afe_i2s_priv { … };
static unsigned int get_i2s_wlen(snd_pcm_format_t format)
{ … }
#define MTK_AFE_I2S0_KCONTROL_NAME …
#define MTK_AFE_I2S1_KCONTROL_NAME …
#define MTK_AFE_I2S2_KCONTROL_NAME …
#define MTK_AFE_I2S3_KCONTROL_NAME …
#define MTK_AFE_I2S0_SRC_KCONTROL_NAME …
#define I2S0_HD_EN_W_NAME …
#define I2S1_HD_EN_W_NAME …
#define I2S2_HD_EN_W_NAME …
#define I2S3_HD_EN_W_NAME …
#define I2S0_MCLK_EN_W_NAME …
#define I2S1_MCLK_EN_W_NAME …
#define I2S2_MCLK_EN_W_NAME …
#define I2S3_MCLK_EN_W_NAME …
static int get_i2s_id_by_name(struct mtk_base_afe *afe,
const char *name)
{ … }
static struct mtk_afe_i2s_priv *get_i2s_priv_by_name(struct mtk_base_afe *afe,
const char *name)
{ … }
static const char * const mt8186_i2s_hd_str[] = …;
static const struct soc_enum mt8186_i2s_enum[] = …;
static int mt8186_i2s_hd_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int mt8186_i2s_hd_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new mtk_dai_i2s_controls[] = …;
static const char * const i2s_mux_map[] = …;
static int i2s_mux_map_value[] = …;
static SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(i2s_mux_map_enum,
SND_SOC_NOPM,
0,
1,
i2s_mux_map,
i2s_mux_map_value);
static const struct snd_kcontrol_new i2s0_in_mux_control = …;
static const struct snd_kcontrol_new i2s1_out_mux_control = …;
static const struct snd_kcontrol_new i2s2_in_mux_control = …;
static const struct snd_kcontrol_new i2s3_out_mux_control = …;
static const char * const i2s_lpbk_mux_map[] = …;
static int i2s_lpbk_mux_map_value[] = …;
static SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(i2s0_lpbk_mux_map_enum,
AFE_I2S_CON,
I2S_LOOPBACK_SFT,
1,
i2s_lpbk_mux_map,
i2s_lpbk_mux_map_value);
static const struct snd_kcontrol_new i2s0_lpbk_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(i2s2_lpbk_mux_map_enum,
AFE_I2S_CON2,
I2S3_LOOPBACK_SFT,
1,
i2s_lpbk_mux_map,
i2s_lpbk_mux_map_value);
static const struct snd_kcontrol_new i2s2_lpbk_mux_control = …;
static const struct snd_kcontrol_new mtk_i2s3_ch1_mix[] = …;
static const struct snd_kcontrol_new mtk_i2s3_ch2_mix[] = …;
static const struct snd_kcontrol_new mtk_i2s1_ch1_mix[] = …;
static const struct snd_kcontrol_new mtk_i2s1_ch2_mix[] = …;
enum { … };
static int mtk_i2s_en_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mtk_apll_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mtk_mclk_en_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static const struct snd_soc_dapm_widget mtk_dai_i2s_widgets[] = …;
static int mtk_afe_i2s_share_connect(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static int mtk_afe_i2s_hd_connect(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static int mtk_afe_i2s_apll_connect(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static int mtk_afe_i2s_mclk_connect(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static int mtk_afe_mclk_apll_connect(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static const struct snd_soc_dapm_route mtk_dai_i2s_routes[] = …;
static int mtk_dai_connsys_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int mtk_dai_connsys_i2s_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *dai)
{ … }
static const struct snd_soc_dai_ops mtk_dai_connsys_i2s_ops = …;
static int mtk_dai_i2s_config(struct mtk_base_afe *afe,
struct snd_pcm_hw_params *params,
int i2s_id)
{ … }
static int mtk_dai_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int mtk_dai_i2s_set_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir)
{ … }
static const struct snd_soc_dai_ops mtk_dai_i2s_ops = …;
#define MTK_CONNSYS_I2S_RATES …
#define MTK_I2S_RATES …
#define MTK_I2S_FORMATS …
static struct snd_soc_dai_driver mtk_dai_i2s_driver[] = …;
enum { … };
static const struct mtk_afe_i2s_priv mt8186_i2s_priv[DAI_I2S_NUM] = …;
int mt8186_dai_i2s_set_share(struct mtk_base_afe *afe, const char *main_i2s_name,
const char *secondary_i2s_name)
{ … }
EXPORT_SYMBOL_GPL(…);
static int mt8186_dai_i2s_set_priv(struct mtk_base_afe *afe)
{ … }
int mt8186_dai_i2s_register(struct mtk_base_afe *afe)
{ … }