#include <linux/input.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pm_runtime.h>
#include <sound/jack.h>
#include <sound/pcm_params.h>
#include <sound/rt5682.h>
#include <sound/soc.h>
#include "../../codecs/mt6359.h"
#include "../../codecs/rt1011.h"
#include "../../codecs/rt5682.h"
#include "../common/mtk-afe-platform-driver.h"
#include "../common/mtk-dsp-sof-common.h"
#include "../common/mtk-soc-card.h"
#include "../common/mtk-soundcard-driver.h"
#include "mt8195-afe-clk.h"
#include "mt8195-afe-common.h"
#define RT1011_SPEAKER_AMP_PRESENT …
#define RT1019_SPEAKER_AMP_PRESENT …
#define MAX98390_SPEAKER_AMP_PRESENT …
#define DUMB_CODEC_INIT …
#define MT6359_CODEC_INIT …
#define RT1011_CODEC_INIT …
#define RT1019_CODEC_INIT …
#define MAX98390_CODEC_INIT …
#define RT5682_CODEC_INIT …
#define RT1011_CODEC_DAI …
#define RT1011_DEV0_NAME …
#define RT1011_DEV1_NAME …
#define RT1019_CODEC_DAI …
#define RT1019_DEV0_NAME …
#define MAX98390_CODEC_DAI …
#define MAX98390_DEV0_NAME …
#define MAX98390_DEV1_NAME …
#define RT5682_CODEC_DAI …
#define RT5682_DEV0_NAME …
#define RT5682S_CODEC_DAI …
#define RT5682S_DEV0_NAME …
#define SOF_DMA_DL2 …
#define SOF_DMA_DL3 …
#define SOF_DMA_UL4 …
#define SOF_DMA_UL5 …
struct mt8195_mt6359_priv { … };
enum mt8195_jacks { … };
static struct snd_soc_jack_pin mt8195_jack_pins[] = …;
static const struct snd_soc_dapm_widget mt8195_mt6359_widgets[] = …;
static const struct snd_soc_dapm_route mt8195_mt6359_routes[] = …;
static const struct snd_kcontrol_new mt8195_mt6359_controls[] = …;
static const struct snd_soc_dapm_widget mt8195_dual_speaker_widgets[] = …;
static const struct snd_kcontrol_new mt8195_dual_speaker_controls[] = …;
static const struct snd_soc_dapm_widget mt8195_speaker_widgets[] = …;
static const struct snd_kcontrol_new mt8195_speaker_controls[] = …;
static const struct snd_soc_dapm_route mt8195_rt1011_routes[] = …;
static const struct snd_soc_dapm_route mt8195_rt1019_routes[] = …;
static const struct snd_soc_dapm_route mt8195_max98390_routes[] = …;
#define CKSYS_AUD_TOP_CFG …
#define CKSYS_AUD_TOP_MON …
static int mt8195_mt6359_mtkaif_calibration(struct snd_soc_pcm_runtime *rtd)
{ … }
static int mt8195_mt6359_init(struct snd_soc_pcm_runtime *rtd)
{ … }
static int mt8195_hdmitx_dptx_startup(struct snd_pcm_substream *substream)
{ … }
static const struct snd_soc_ops mt8195_hdmitx_dptx_playback_ops = …;
static int mt8195_dptx_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{ … }
static const struct snd_soc_ops mt8195_dptx_ops = …;
static int mt8195_dptx_codec_init(struct snd_soc_pcm_runtime *rtd)
{ … }
static int mt8195_hdmi_codec_init(struct snd_soc_pcm_runtime *rtd)
{ … }
static int mt8195_dptx_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{ … }
static int mt8195_rt5682_etdm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{ … }
static const struct snd_soc_ops mt8195_rt5682_etdm_ops = …;
static int mt8195_rt5682_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *cmpnt_codec =
snd_soc_rtd_to_codec(rtd, 0)->component;
struct mtk_soc_card_data *soc_card_data = snd_soc_card_get_drvdata(rtd->card);
struct mt8195_mt6359_priv *priv = soc_card_data->mach_priv;
struct snd_soc_jack *jack = &soc_card_data->card_data->jacks[MT8195_JACK_HEADSET];
struct snd_soc_component *cmpnt_afe =
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt_afe);
struct mt8195_afe_private *afe_priv = afe->platform_priv;
int ret;
priv->i2so1_mclk = afe_priv->clk[MT8195_CLK_TOP_APLL12_DIV2];
ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
SND_JACK_HEADSET | SND_JACK_BTN_0 |
SND_JACK_BTN_1 | SND_JACK_BTN_2 |
SND_JACK_BTN_3,
jack, mt8195_jack_pins,
ARRAY_SIZE(mt8195_jack_pins));
if (ret) {
dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
return ret;
}
snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
ret = snd_soc_component_set_jack(cmpnt_codec, jack, NULL);
if (ret) {
dev_err(rtd->dev, "Headset Jack set failed: %d\n", ret);
return ret;
}
return 0;
};
static int mt8195_rt1011_etdm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{ … }
static const struct snd_soc_ops mt8195_rt1011_etdm_ops = …;
static int mt8195_sof_be_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{ … }
static const struct snd_soc_ops mt8195_sof_be_ops = …;
static int mt8195_rt1011_init(struct snd_soc_pcm_runtime *rtd)
{ … }
static int mt8195_dumb_amp_init(struct snd_soc_pcm_runtime *rtd)
{ … }
static int mt8195_rt1019_init(struct snd_soc_pcm_runtime *rtd)
{ … }
static int mt8195_max98390_init(struct snd_soc_pcm_runtime *rtd)
{ … }
static int mt8195_etdm_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{ … }
static int mt8195_set_bias_level_post(struct snd_soc_card *card,
struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level)
{ … }
enum { … };
#define DAI_LINK_REGULAR_NUM …
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEFS(…);
SND_SOC_DAILINK_DEF(rt1019_comps,
DAILINK_COMP_ARRAY(COMP_CODEC(RT1019_DEV0_NAME,
RT1019_CODEC_DAI)));
SND_SOC_DAILINK_DEF(…);
SND_SOC_DAILINK_DEF(…);
static const struct sof_conn_stream g_sof_conn_streams[] = …;
static struct snd_soc_dai_link mt8195_mt6359_dai_links[] = …;
static struct snd_soc_codec_conf rt1011_codec_conf[] = …;
static struct snd_soc_codec_conf max98390_codec_conf[] = …;
static struct snd_soc_card mt8195_mt6359_soc_card = …;
static int mt8195_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{ … }
static int mt8195_mt6359_legacy_probe(struct mtk_soc_card_data *soc_card_data)
{ … }
static int mt8195_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data, bool legacy)
{ … }
static const unsigned int mt8195_pcm_playback_channels[] = …;
static const unsigned int mt8195_pcm_capture_channels[] = …;
static const unsigned int mt8195_pcm_hdmidp_channels[] = …;
static const unsigned int mt8195_pcm_rates[] = …;
static const struct snd_pcm_hw_constraint_list mt8195_rate_constraint = …;
static const struct mtk_pcm_constraints_data mt8195_pcm_constraints[MTK_CONSTRAINT_HDMIDP + 1] = …;
static const struct mtk_sof_priv mt8195_sof_priv = …;
static const struct mtk_soundcard_pdata mt8195_mt6359_rt1019_rt5682_card = …;
static const struct mtk_soundcard_pdata mt8195_mt6359_rt1011_rt5682_card = …;
static const struct mtk_soundcard_pdata mt8195_mt6359_max98390_rt5682_card = …;
static const struct of_device_id mt8195_mt6359_dt_match[] = …;
MODULE_DEVICE_TABLE(of, mt8195_mt6359_dt_match);
static struct platform_driver mt8195_mt6359_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;