summaryrefslogtreecommitdiff
path: root/sound/soc/intel/boards/sof_rt5682.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/intel/boards/sof_rt5682.c')
-rw-r--r--sound/soc/intel/boards/sof_rt5682.c87
1 files changed, 81 insertions, 6 deletions
diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
index ddbb9fe7cc06..8b1ca2da9bb9 100644
--- a/sound/soc/intel/boards/sof_rt5682.c
+++ b/sound/soc/intel/boards/sof_rt5682.c
@@ -24,6 +24,7 @@
#include "../common/soc-intel-quirks.h"
#include "hda_dsp_common.h"
#include "sof_maxim_common.h"
+#include "sof_realtek_common.h"
#define NAME_SIZE 32
@@ -41,9 +42,11 @@
#define SOF_RT5682_NUM_HDMIDEV_MASK (GENMASK(12, 10))
#define SOF_RT5682_NUM_HDMIDEV(quirk) \
((quirk << SOF_RT5682_NUM_HDMIDEV_SHIFT) & SOF_RT5682_NUM_HDMIDEV_MASK)
-#define SOF_RT1015_SPEAKER_AMP_PRESENT BIT(13)
-#define SOF_MAX98373_SPEAKER_AMP_PRESENT BIT(14)
-#define SOF_MAX98360A_SPEAKER_AMP_PRESENT BIT(15)
+#define SOF_RT1011_SPEAKER_AMP_PRESENT BIT(13)
+#define SOF_RT1015_SPEAKER_AMP_PRESENT BIT(14)
+#define SOF_RT1015_SPEAKER_AMP_100FS BIT(15)
+#define SOF_MAX98373_SPEAKER_AMP_PRESENT BIT(16)
+#define SOF_MAX98360A_SPEAKER_AMP_PRESENT BIT(17)
/* Default: MCLK on, MCLK 19.2M, SSP0 */
static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN |
@@ -100,6 +103,24 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = {
SOF_RT5682_SSP_CODEC(1)),
},
{
+ /*
+ * Dooly is hatch family but using rt1015 amp so it
+ * requires a quirk before "Google_Hatch".
+ */
+ .callback = sof_rt5682_quirk_cb,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Dooly"),
+ },
+ .driver_data = (void *)(SOF_RT5682_MCLK_EN |
+ SOF_RT5682_MCLK_24MHZ |
+ SOF_RT5682_SSP_CODEC(0) |
+ SOF_SPEAKER_AMP_PRESENT |
+ SOF_RT1015_SPEAKER_AMP_PRESENT |
+ SOF_RT1015_SPEAKER_AMP_100FS |
+ SOF_RT5682_SSP_AMP(1)),
+ },
+ {
.callback = sof_rt5682_quirk_cb,
.matches = {
DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Hatch"),
@@ -291,21 +312,26 @@ static int sof_rt1015_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_soc_card *card = rtd->card;
struct snd_soc_dai *codec_dai;
- int i, ret;
+ int i, fs, ret;
if (!snd_soc_card_get_codec_dai(card, "rt1015-aif"))
return 0;
+ if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_100FS)
+ fs = 100;
+ else
+ fs = 64;
+
for_each_rtd_codec_dais(rtd, i, codec_dai) {
/* Set tdm/i2s1 master bclk ratio */
- ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64);
+ ret = snd_soc_dai_set_bclk_ratio(codec_dai, fs);
if (ret < 0) {
dev_err(card->dev, "failed to set bclk ratio\n");
return ret;
}
ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK,
- params_rate(params) * 64,
+ params_rate(params) * fs,
params_rate(params) * 256);
if (ret < 0) {
dev_err(card->dev, "failed to set pll\n");
@@ -319,6 +345,26 @@ static int sof_rt1015_hw_params(struct snd_pcm_substream *substream,
dev_err(card->dev, "failed to set sysclk\n");
return ret;
}
+
+ if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_100FS) {
+ if (!strcmp(codec_dai->component->name, "i2c-10EC1015:00")) {
+ ret = snd_soc_dai_set_tdm_slot(codec_dai,
+ 0x0, 0x1, 4, 24);
+ if (ret < 0) {
+ dev_err(card->dev, "failed to set tdm slot\n");
+ return ret;
+ }
+ }
+
+ if (!strcmp(codec_dai->component->name, "i2c-10EC1015:01")) {
+ ret = snd_soc_dai_set_tdm_slot(codec_dai,
+ 0x0, 0x2, 4, 24);
+ if (ret < 0) {
+ dev_err(card->dev, "failed to set tdm slot\n");
+ return ret;
+ }
+ }
+ }
}
return 0;
@@ -690,11 +736,16 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
links[id].num_codecs = ARRAY_SIZE(max_98373_components);
links[id].init = max98373_spk_codec_init;
links[id].ops = &max_98373_ops;
+ /* feedback stream */
+ links[id].dpcm_capture = 1;
} else if (sof_rt5682_quirk &
SOF_MAX98360A_SPEAKER_AMP_PRESENT) {
links[id].codecs = max98360a_component;
links[id].num_codecs = ARRAY_SIZE(max98360a_component);
links[id].init = speaker_codec_init;
+ } else if (sof_rt5682_quirk &
+ SOF_RT1011_SPEAKER_AMP_PRESENT) {
+ sof_rt1011_dai_link(&links[id]);
} else {
links[id].codecs = max98357a_component;
links[id].num_codecs = ARRAY_SIZE(max98357a_component);
@@ -805,6 +856,8 @@ static int sof_audio_probe(struct platform_device *pdev)
if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT)
sof_max98373_codec_conf(&sof_audio_card_rt5682);
+ else if (sof_rt5682_quirk & SOF_RT1011_SPEAKER_AMP_PRESENT)
+ sof_rt1011_codec_conf(&sof_audio_card_rt5682);
dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, ssp_amp,
dmic_be_num, hdmi_num);
@@ -875,6 +928,25 @@ static const struct platform_device_id board_ids[] = {
SOF_MAX98360A_SPEAKER_AMP_PRESENT |
SOF_RT5682_SSP_AMP(1)),
},
+ {
+ .name = "cml_rt1015_rt5682",
+ .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
+ SOF_RT5682_MCLK_24MHZ |
+ SOF_RT5682_SSP_CODEC(0) |
+ SOF_SPEAKER_AMP_PRESENT |
+ SOF_RT1015_SPEAKER_AMP_PRESENT |
+ SOF_RT1015_SPEAKER_AMP_100FS |
+ SOF_RT5682_SSP_AMP(1)),
+ },
+ {
+ .name = "tgl_rt1011_rt5682",
+ .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
+ SOF_RT5682_SSP_CODEC(0) |
+ SOF_SPEAKER_AMP_PRESENT |
+ SOF_RT1011_SPEAKER_AMP_PRESENT |
+ SOF_RT5682_SSP_AMP(1) |
+ SOF_RT5682_NUM_HDMIDEV(4)),
+ },
{ }
};
@@ -892,9 +964,12 @@ module_platform_driver(sof_audio)
MODULE_DESCRIPTION("SOF Audio Machine driver");
MODULE_AUTHOR("Bard Liao <bard.liao@intel.com>");
MODULE_AUTHOR("Sathya Prakash M R <sathya.prakash.m.r@intel.com>");
+MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:sof_rt5682");
MODULE_ALIAS("platform:tgl_max98357a_rt5682");
MODULE_ALIAS("platform:jsl_rt5682_rt1015");
MODULE_ALIAS("platform:tgl_max98373_rt5682");
MODULE_ALIAS("platform:jsl_rt5682_max98360a");
+MODULE_ALIAS("platform:cml_rt1015_rt5682");
+MODULE_ALIAS("platform:tgl_rt1011_rt5682");