alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com,
	amadeuszx.slawinski@linux.intel.com, tiwai@suse.com
Subject: [PATCH 04/15] ASoC: Intel: avs: Add quirk for KBL-R RVP platform
Date: Mon, 10 Oct 2022 14:07:38 +0200	[thread overview]
Message-ID: <20221010120749.716499-5-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20221010120749.716499-1-cezary.rojewski@intel.com>

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

KBL-R RVPs contain built-in rt298 codec which requires different PLL
clock and .dai_fmt configuration than seen on other boards.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 sound/soc/intel/avs/boards/rt298.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/avs/boards/rt298.c b/sound/soc/intel/avs/boards/rt298.c
index b28d36872dcb..58c9d9edecf0 100644
--- a/sound/soc/intel/avs/boards/rt298.c
+++ b/sound/soc/intel/avs/boards/rt298.c
@@ -6,6 +6,7 @@
 //          Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
 //
 
+#include <linux/dmi.h>
 #include <linux/module.h>
 #include <sound/jack.h>
 #include <sound/pcm.h>
@@ -14,6 +15,16 @@
 #include <sound/soc-acpi.h>
 #include "../../../codecs/rt298.h"
 
+static const struct dmi_system_id kblr_dmi_table[] = {
+	{
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
+			DMI_MATCH(DMI_BOARD_NAME, "Kabylake R DDR4 RVP"),
+		},
+	},
+	{}
+};
+
 static const struct snd_kcontrol_new card_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Mic Jack"),
@@ -96,9 +107,15 @@ avs_rt298_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_param
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+	unsigned int clk_freq;
 	int ret;
 
-	ret = snd_soc_dai_set_sysclk(codec_dai, RT298_SCLK_S_PLL, 19200000, SND_SOC_CLOCK_IN);
+	if (dmi_first_match(kblr_dmi_table))
+		clk_freq = 24000000;
+	else
+		clk_freq = 19200000;
+
+	ret = snd_soc_dai_set_sysclk(codec_dai, RT298_SCLK_S_PLL, clk_freq, SND_SOC_CLOCK_IN);
 	if (ret < 0)
 		dev_err(rtd->dev, "Set codec sysclk failed: %d\n", ret);
 
@@ -139,7 +156,10 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
 	dl->platforms = platform;
 	dl->num_platforms = 1;
 	dl->id = 0;
-	dl->dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;
+	if (dmi_first_match(kblr_dmi_table))
+		dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;
+	else
+		dl->dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;
 	dl->init = avs_rt298_codec_init;
 	dl->be_hw_params_fixup = avs_rt298_be_fixup;
 	dl->ops = &avs_rt298_ops;
-- 
2.25.1


  parent reply	other threads:[~2022-10-10 11:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10 12:07 [PATCH 00/15] ASoC: Intel: avs: Fixes and new boards support Cezary Rojewski
2022-10-10 11:57 ` Cezary Rojewski
2022-10-10 12:07 ` [PATCH 01/15] ASoC: Intel: avs: Fix DMA mask assignment Cezary Rojewski
2022-10-10 12:07 ` [PATCH 02/15] ASoC: Intel: avs: Fix potential RX buffer overflow Cezary Rojewski
2022-10-10 12:07 ` [PATCH 03/15] ASoC: codecs: rt298: Add quirk for KBL-R RVP platform Cezary Rojewski
2022-10-10 12:07 ` Cezary Rojewski [this message]
2022-10-10 12:07 ` [PATCH 05/15] ASoC: Intel: avs: Support AML with rt286 configuration Cezary Rojewski
2022-10-10 12:07 ` [PATCH 06/15] ASoC: Intel: avs: Support da7219 on both KBL and APL Cezary Rojewski
2022-10-10 12:07 ` [PATCH 07/15] ASoC: Intel: avs: Add missing SKL-based device IDs Cezary Rojewski
2022-10-10 12:07 ` [PATCH 08/15] ASoC: Intel: avs: Simplify d0ix disabling routine Cezary Rojewski
2022-10-10 12:07 ` [PATCH 09/15] ASoC: Intel: avs: Add missing include to HDA board Cezary Rojewski
2022-10-10 12:07 ` [PATCH 10/15] ASoC: Intel: avs: Do not reuse msg between different IPC handlers Cezary Rojewski
2022-10-10 12:07 ` [PATCH 11/15] ASoC: Intel: avs: Do not treat unsupported IPCs as invalid Cezary Rojewski
2022-10-10 12:07 ` [PATCH 12/15] ASoC: Intel: avs: Do not print IPC error message twice Cezary Rojewski
2022-10-10 12:07 ` [PATCH 13/15] ASoC: Intel: avs: Simplify ignore_fw_version description Cezary Rojewski
2022-10-10 12:07 ` [PATCH 14/15] ASoC: Intel: avs: Simplify log control for SKL Cezary Rojewski
2022-10-10 12:07 ` [PATCH 15/15] ASoC: codecs: hda: Fix spelling error in log message Cezary Rojewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221010120749.716499-5-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).