#include <linux/delay.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <sound/pcm_params.h>
#include "mt8195-afe-clk.h"
#include "mt8195-afe-common.h"
#include "mt8195-reg.h"
#define MT8195_ETDM_MAX_CHANNELS …
#define MT8195_ETDM_NORMAL_MAX_BCK_RATE …
#define ETDM_TO_DAI_ID(x) …
#define ENUM_TO_STR(x) …
enum { … };
enum { … };
enum { … };
enum { … };
enum { … };
enum { … };
enum { … };
enum { … };
enum { … };
struct etdm_con_reg { … };
struct mtk_dai_etdm_rate { … };
struct mtk_dai_etdm_priv { … };
static const struct mtk_dai_etdm_rate mt8195_etdm_rates[] = …;
static bool mt8195_afe_etdm_is_valid(int id)
{ … }
static bool mt8195_afe_hdmitx_dptx_is_valid(int id)
{ … }
static int get_etdm_fs_timing(unsigned int rate)
{ … }
static unsigned int get_etdm_ch_fixup(unsigned int channels)
{ … }
static int get_etdm_reg(unsigned int dai_id, struct etdm_con_reg *etdm_reg)
{ … }
static int get_etdm_dir(unsigned int dai_id)
{ … }
static int get_etdm_wlen(unsigned int bitwidth)
{ … }
static int is_cowork_mode(struct snd_soc_dai *dai)
{ … }
static int sync_to_dai_id(int source_sel)
{ … }
static int get_etdm_cowork_master_id(struct snd_soc_dai *dai)
{ … }
static const struct snd_kcontrol_new mtk_dai_etdm_o048_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o049_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o050_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o051_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o052_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o053_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o054_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o055_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o056_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o057_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o058_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o059_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o060_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o061_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o062_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o063_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o064_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o065_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o066_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o067_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o068_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o069_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o070_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o071_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o072_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o073_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o074_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o075_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o076_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o077_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o078_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o079_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o080_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o081_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o082_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o083_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o084_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o085_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o086_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o087_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o088_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o089_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o090_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o091_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o092_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o093_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o094_mix[] = …;
static const struct snd_kcontrol_new mtk_dai_etdm_o095_mix[] = …;
static const char * const mt8195_etdm_clk_src_sel_text[] = …;
static SOC_ENUM_SINGLE_EXT_DECL(etdmout_clk_src_enum,
mt8195_etdm_clk_src_sel_text);
static const char * const hdmitx_dptx_mux_map[] = …;
static int hdmitx_dptx_mux_map_value[] = …;
static SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(hdmi_out_mux_map_enum,
SND_SOC_NOPM,
0,
1,
hdmitx_dptx_mux_map,
hdmitx_dptx_mux_map_value);
static const struct snd_kcontrol_new hdmi_out_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(dptx_out_mux_map_enum,
SND_SOC_NOPM,
0,
1,
hdmitx_dptx_mux_map,
hdmitx_dptx_mux_map_value);
static const struct snd_kcontrol_new dptx_out_mux_control = …;
static const char *const afe_conn_hdmi_mux_map[] = …;
static int afe_conn_hdmi_mux_map_value[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(hdmi_ch0_mux_map_enum,
AFE_TDMOUT_CONN0,
0,
0xf,
afe_conn_hdmi_mux_map,
afe_conn_hdmi_mux_map_value);
static const struct snd_kcontrol_new hdmi_ch0_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_DECL(hdmi_ch1_mux_map_enum,
AFE_TDMOUT_CONN0,
4,
0xf,
afe_conn_hdmi_mux_map,
afe_conn_hdmi_mux_map_value);
static const struct snd_kcontrol_new hdmi_ch1_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_DECL(hdmi_ch2_mux_map_enum,
AFE_TDMOUT_CONN0,
8,
0xf,
afe_conn_hdmi_mux_map,
afe_conn_hdmi_mux_map_value);
static const struct snd_kcontrol_new hdmi_ch2_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_DECL(hdmi_ch3_mux_map_enum,
AFE_TDMOUT_CONN0,
12,
0xf,
afe_conn_hdmi_mux_map,
afe_conn_hdmi_mux_map_value);
static const struct snd_kcontrol_new hdmi_ch3_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_DECL(hdmi_ch4_mux_map_enum,
AFE_TDMOUT_CONN0,
16,
0xf,
afe_conn_hdmi_mux_map,
afe_conn_hdmi_mux_map_value);
static const struct snd_kcontrol_new hdmi_ch4_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_DECL(hdmi_ch5_mux_map_enum,
AFE_TDMOUT_CONN0,
20,
0xf,
afe_conn_hdmi_mux_map,
afe_conn_hdmi_mux_map_value);
static const struct snd_kcontrol_new hdmi_ch5_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_DECL(hdmi_ch6_mux_map_enum,
AFE_TDMOUT_CONN0,
24,
0xf,
afe_conn_hdmi_mux_map,
afe_conn_hdmi_mux_map_value);
static const struct snd_kcontrol_new hdmi_ch6_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_DECL(hdmi_ch7_mux_map_enum,
AFE_TDMOUT_CONN0,
28,
0xf,
afe_conn_hdmi_mux_map,
afe_conn_hdmi_mux_map_value);
static const struct snd_kcontrol_new hdmi_ch7_mux_control = …;
static int mt8195_etdm_clk_src_sel_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int mt8195_etdm_clk_src_sel_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new mtk_dai_etdm_controls[] = …;
static const struct snd_soc_dapm_widget mtk_dai_etdm_widgets[] = …;
static const struct snd_soc_dapm_route mtk_dai_etdm_routes[] = …;
static int mt8195_afe_enable_etdm(struct mtk_base_afe *afe, int dai_id)
{ … }
static int mt8195_afe_disable_etdm(struct mtk_base_afe *afe, int dai_id)
{ … }
static int etdm_cowork_slv_sel(int id, int slave_mode)
{ … }
static int mt8195_etdm_sync_mode_configure(struct mtk_base_afe *afe, int dai_id)
{ … }
static int mtk_dai_etdm_get_cg_id_by_dai_id(int dai_id)
{ … }
static int mtk_dai_etdm_get_clk_id_by_dai_id(int dai_id)
{ … }
static int mtk_dai_etdm_get_clkdiv_id_by_dai_id(int dai_id)
{ … }
static int mtk_dai_etdm_enable_mclk(struct mtk_base_afe *afe, int dai_id)
{ … }
static int mtk_dai_etdm_disable_mclk(struct mtk_base_afe *afe, int dai_id)
{ … }
static int mtk_dai_etdm_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static void mtk_dai_etdm_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int mtk_dai_etdm_fifo_mode(struct mtk_base_afe *afe,
int dai_id, unsigned int rate)
{ … }
static int mtk_dai_etdm_in_configure(struct mtk_base_afe *afe,
unsigned int rate,
unsigned int channels,
int dai_id)
{ … }
static int mtk_dai_etdm_out_configure(struct mtk_base_afe *afe,
unsigned int rate,
unsigned int channels,
int dai_id)
{ … }
static int mtk_dai_etdm_mclk_configure(struct mtk_base_afe *afe, int dai_id)
{ … }
static int mtk_dai_etdm_configure(struct mtk_base_afe *afe,
unsigned int rate,
unsigned int channels,
unsigned int bit_width,
int dai_id)
{ … }
static int mtk_dai_etdm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int mtk_dai_etdm_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{ … }
static int mtk_dai_etdm_cal_mclk(struct mtk_base_afe *afe, int freq, int dai_id)
{ … }
static int mtk_dai_etdm_set_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int mtk_dai_etdm_set_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask,
int slots, int slot_width)
{ … }
static int mtk_dai_etdm_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static int mtk_dai_hdmitx_dptx_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static void mtk_dai_hdmitx_dptx_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static unsigned int mtk_dai_get_dptx_ch_en(unsigned int channel)
{ … }
static unsigned int mtk_dai_get_dptx_ch(unsigned int ch)
{ … }
static unsigned int mtk_dai_get_dptx_wlen(snd_pcm_format_t format)
{ … }
static int mtk_dai_hdmitx_dptx_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int mtk_dai_hdmitx_dptx_trigger(struct snd_pcm_substream *substream,
int cmd,
struct snd_soc_dai *dai)
{ … }
static int mtk_dai_hdmitx_dptx_set_sysclk(struct snd_soc_dai *dai,
int clk_id,
unsigned int freq,
int dir)
{ … }
#define MTK_ETDM_RATES …
#define MTK_ETDM_FORMATS …
static int mtk_dai_etdm_probe(struct snd_soc_dai *dai)
{ … }
static const struct snd_soc_dai_ops mtk_dai_hdmitx_dptx_ops = …;
static const struct snd_soc_dai_ops mtk_dai_hdmitx_dptx_ops2 = …;
static const struct snd_soc_dai_ops mtk_dai_etdm_ops = …;
static struct snd_soc_dai_driver mtk_dai_etdm_driver[] = …;
static void mt8195_etdm_update_sync_info(struct mtk_base_afe *afe)
{ … }
static void mt8195_dai_etdm_parse_of(struct mtk_base_afe *afe)
{ … }
static int init_etdm_priv_data(struct mtk_base_afe *afe)
{ … }
int mt8195_dai_etdm_register(struct mtk_base_afe *afe)
{ … }