#include <linux/delay.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/dma-mapping.h>
#include <linux/pm_runtime.h>
#include <sound/soc.h>
#include <sound/pcm_params.h>
#include "mt8365-afe-common.h"
#include "mt8365-afe-clk.h"
#include "mt8365-reg.h"
#include "../common/mtk-base-afe.h"
#include "../common/mtk-afe-platform-driver.h"
#include "../common/mtk-afe-fe-dai.h"
#define AFE_BASE_END_OFFSET …
static unsigned int mCM2Input;
static const unsigned int mt8365_afe_backup_list[] = …;
static const struct snd_pcm_hardware mt8365_afe_hardware = …;
struct mt8365_afe_rate { … };
static const struct mt8365_afe_rate mt8365_afe_fs_rates[] = …;
int mt8365_afe_fs_timing(unsigned int rate)
{ … }
bool mt8365_afe_rate_supported(unsigned int rate, unsigned int id)
{ … }
bool mt8365_afe_channel_supported(unsigned int channel, unsigned int id)
{ … }
static bool mt8365_afe_clk_group_44k(int sample_rate)
{ … }
static bool mt8365_afe_clk_group_48k(int sample_rate)
{ … }
int mt8365_dai_set_priv(struct mtk_base_afe *afe, int id,
int priv_size, const void *priv_data)
{ … }
static int mt8365_afe_irq_direction_enable(struct mtk_base_afe *afe,
int irq_id, int direction)
{ … }
static int mt8365_memif_fs(struct snd_pcm_substream *substream,
unsigned int rate)
{ … }
static int mt8365_irq_fs(struct snd_pcm_substream *substream,
unsigned int rate)
{ … }
static const struct mt8365_cm_ctrl_reg cm_ctrl_reg[MT8365_CM_NUM] = …;
static int mt8365_afe_cm2_mux_conn(struct mtk_base_afe *afe)
{ … }
static int mt8365_afe_get_cm_update_cnt(struct mtk_base_afe *afe,
enum mt8365_cm_num cmNum,
unsigned int rate, unsigned int channel)
{ … }
static int mt8365_afe_configure_cm(struct mtk_base_afe *afe,
enum mt8365_cm_num cmNum,
unsigned int channels,
unsigned int rate)
{ … }
static int mt8365_afe_fe_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static void mt8365_afe_fe_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int mt8365_afe_fe_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int mt8365_afe_fe_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int mt8365_afe_fe_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int mt8365_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{ … }
static int mt8365_afe_hw_gain1_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static void mt8365_afe_hw_gain1_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int mt8365_afe_hw_gain1_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static const struct snd_pcm_hardware mt8365_hostless_hardware = …;
static int mtk_dai_hostless_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static const struct snd_soc_dai_ops mt8365_afe_fe_dai_ops = …;
static const struct snd_soc_dai_ops mt8365_dai_hostless_ops = …;
static const struct snd_soc_dai_ops mt8365_afe_hw_gain1_ops = …;
static struct snd_soc_dai_driver mt8365_memif_dai_driver[] = …;
static const struct snd_kcontrol_new mt8365_afe_o00_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o01_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o03_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o04_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o05_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o06_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o07_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o08_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o09_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o10_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o11_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o12_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o13_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o14_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o15_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o16_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o17_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o18_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o19_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o20_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o21_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o22_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o23_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o24_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o25_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o26_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o27_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o28_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o29_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o30_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o31_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o32_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o33_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o34_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o35_mix[] = …;
static const struct snd_kcontrol_new mt8365_afe_o36_mix[] = …;
static const struct snd_kcontrol_new mtk_hw_gain1_in_ch1_mix[] = …;
static const struct snd_kcontrol_new mtk_hw_gain1_in_ch2_mix[] = …;
static int mt8365_afe_cm2_io_input_mux_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int mt8365_afe_cm2_io_input_mux_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const char * const fmhwgain_text[] = …;
static const char * const ain_text[] = …;
static const char * const vul2_in_input_text[] = …;
static const char * const mt8365_afe_cm2_mux_text[] = …;
static SOC_ENUM_SINGLE_VIRT_DECL(fmhwgain_enum, fmhwgain_text);
static SOC_ENUM_SINGLE_DECL(ain_enum, AFE_ADDA_TOP_CON0, 0, ain_text);
static SOC_ENUM_SINGLE_VIRT_DECL(vul2_in_input_enum, vul2_in_input_text);
static SOC_ENUM_SINGLE_VIRT_DECL(mt8365_afe_cm2_mux_input_enum,
mt8365_afe_cm2_mux_text);
static const struct snd_kcontrol_new fmhwgain_mux = …;
static const struct snd_kcontrol_new ain_mux = …;
static const struct snd_kcontrol_new vul2_in_input_mux = …;
static const struct snd_kcontrol_new mt8365_afe_cm2_mux_input_mux = …;
static const struct snd_soc_dapm_widget mt8365_memif_widgets[] = …;
static const struct snd_soc_dapm_route mt8365_memif_routes[] = …;
static const struct mtk_base_memif_data memif_data[MT8365_AFE_MEMIF_NUM] = …;
static const struct mtk_base_irq_data irq_data[MT8365_AFE_IRQ_NUM] = …;
static int memif_specified_irqs[MT8365_AFE_MEMIF_NUM] = …;
static const struct regmap_config mt8365_afe_regmap_config = …;
static irqreturn_t mt8365_afe_irq_handler(int irq, void *dev_id)
{ … }
static int __maybe_unused mt8365_afe_runtime_suspend(struct device *dev)
{ … }
static int mt8365_afe_runtime_resume(struct device *dev)
{ … }
static int __maybe_unused mt8365_afe_suspend(struct device *dev)
{ … }
static int __maybe_unused mt8365_afe_resume(struct device *dev)
{ … }
static int __maybe_unused mt8365_afe_dev_runtime_suspend(struct device *dev)
{ … }
static int __maybe_unused mt8365_afe_dev_runtime_resume(struct device *dev)
{ … }
static int mt8365_afe_init_registers(struct mtk_base_afe *afe)
{ … }
static int mt8365_dai_memif_register(struct mtk_base_afe *afe)
{ … }
dai_register_cb;
static const dai_register_cb dai_register_cbs[] = …;
static int mt8365_afe_pcm_dev_probe(struct platform_device *pdev)
{ … }
static void mt8365_afe_pcm_dev_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id mt8365_afe_pcm_dt_match[] = …;
MODULE_DEVICE_TABLE(of, mt8365_afe_pcm_dt_match);
static const struct dev_pm_ops mt8365_afe_pm_ops = …;
static struct platform_driver mt8365_afe_pcm_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;