Skip to contentSkip to conversation

ASoC: Intel: boards: Add CML_RT1015 m/c driver

PATCH Superseded Keith Tzneg 2 participants 2 messages Oct 19, 2020

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: Intel: boards: Add CML_RT1015 m/c driver

From: Keith Tzeng <[email protected]>

Machine driver to enable RT5682 on SSP0, DMIC, HDMI and RT1015 AMP on
SSP1: Enabled 4 CH TDM playback with 24 bit data.

---
 sound/soc/intel/boards/Kconfig                    |  17 +
 sound/soc/intel/boards/Makefile                   |   2 +
 sound/soc/intel/boards/cml_rt1015_rt5682.c        | 570 ++++++++++++++++++++++
 sound/soc/intel/common/soc-acpi-intel-cnl-match.c |   7 +
 4 files changed, 596 insertions(+)
 create mode 100644 sound/soc/intel/boards/cml_rt1015_rt5682.c
sound/soc/intel/boards/Kconfig +17 -0
index c10c378..9331d0a 100644
@@ -496,6 +496,23 @@ config SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH
 	  Say Y if you have such a device.
 	  If unsure select "N".
 
+config SND_SOC_INTEL_SOF_RT5682_MACH
+        tristate "SOF with rt5682 codec in I2S Mode"
+        depends on I2C && ACPI && GPIOLIB
+        depends on ((SND_HDA_CODEC_HDMI && SND_SOC_SOF_HDA_AUDIO_CODEC) &&\
+                    (MFD_INTEL_LPSS || COMPILE_TEST)) ||\
+                   (SND_SOC_SOF_BAYTRAIL && (X86_INTEL_LPSS || COMPILE_TEST))
+        select SND_SOC_MAX98373_I2C
+        select SND_SOC_RT1015
+        select SND_SOC_RT5682_I2C
+        select SND_SOC_DMIC
+        select SND_SOC_HDAC_HDMI
+        help
+           This adds support for ASoC machine driver for SOF platforms
+           with rt5682 codec.
+           Say Y if you have such a device.
+           If unsure select "N".
+
 endif ## SND_SOC_SOF_COMETLAKE && SND_SOC_SOF_HDA_LINK
 
 if SND_SOC_SOF_JASPERLAKE
sound/soc/intel/boards/Makefile +2 -0
index a58e4d2..73131cc 100644
@@ -20,6 +20,7 @@ snd-soc-sst-byt-cht-es8316-objs := bytcht_es8316.o
 snd-soc-sst-byt-cht-nocodec-objs := bytcht_nocodec.o
 snd-soc-sof_rt5682-objs := sof_rt5682.o hda_dsp_common.o sof_maxim_common.o
 snd-soc-cml_rt1011_rt5682-objs := cml_rt1011_rt5682.o hda_dsp_common.o
+snd-soc-cml_rt1015_rt5682-objs := cml_rt1015_rt5682.o
 snd-soc-kbl_da7219_max98357a-objs := kbl_da7219_max98357a.o
 snd-soc-kbl_da7219_max98927-objs := kbl_da7219_max98927.o
 snd-soc-kbl_rt5663_max98927-objs := kbl_rt5663_max98927.o
@@ -60,6 +61,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_DA7213_MACH) += snd-soc-sst-byt-cht-da7213.o
 obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_ES8316_MACH) += snd-soc-sst-byt-cht-es8316.o
 obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) += snd-soc-sst-byt-cht-nocodec.o
 obj-$(CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH) += snd-soc-cml_rt1011_rt5682.o
+obj-$(CONFIG_SND_SOC_INTEL_SOF_CML_RT1015_RT5682_MACH) += cml_rt1015_rt5682.o
 obj-$(CONFIG_SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH) += snd-soc-kbl_da7219_max98357a.o
 obj-$(CONFIG_SND_SOC_INTEL_KBL_DA7219_MAX98927_MACH) += snd-soc-kbl_da7219_max98927.o
 obj-$(CONFIG_SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH) += snd-soc-kbl_rt5663_max98927.o
sound/soc/intel/boards/cml_rt1015_rt5682.c new file +570 -0

570 lines not on this page · raw message

sound/soc/intel/common/soc-acpi-intel-cnl-match.c +7 -0
index b80f032a..4f99da8 100644
@@ -23,6 +23,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = {
 		.sof_fw_filename = "sof-cnl.ri",
 		.sof_tplg_filename = "sof-cnl-rt274.tplg",
 	},
+	{
+		.id = "10EC1015",
+		.drv_name = "cml_rt1015_rt5682",
+		.quirk_data = &cml_codecs,
+		.sof_fw_filename = "sof-cnl.ri",
+		.sof_tplg_filename = "sof-cml-rt1015-rt5682.tplg",
+	},
 	{},
 };
 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cnl_machines);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 29 lines · Keith Tzneg

From: Keith Tzeng <[email protected]>

Machine driver to enable RT5682 on SSP0, DMIC, HDMI and RT1015 AMP on
SSP1: Enabled 4 CH TDM playback with 24 bit data.

---
  sound/soc/intel/boards/Kconfig                    |  17 +
  sound/soc/intel/boards/Makefile                   |   2 +
  sound/soc/intel/boards/cml_rt1015_rt5682.c        | 570 ++++++++++++++++++++++
  sound/soc/intel/common/soc-acpi-intel-cnl-match.c |   7 +
  4 files changed, 596 insertions(+)

create mode 100644 sound/soc/intel/boards/cml_rt1015_rt5682.c

sound/soc/intel/boards/Kconfig +7 -0
index c10c378..9331d0a 100644
@@ -496,6 +496,23 @@ config SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH
  	  Say Y if you have such a device.
  	  If unsure select "N".
 
+config SND_SOC_INTEL_SOF_RT5682_MACH
+        tristate "SOF with rt5682 codec in I2S Mode"
+        depends on I2C && ACPI && GPIOLIB
+        depends on ((SND_HDA_CODEC_HDMI && SND_SOC_SOF_HDA_AUDIO_CODEC) &&\
+                    (MFD_INTEL_LPSS || COMPILE_TEST)) ||\
+                   (SND_SOC_SOF_BAYTRAIL && (X86_INTEL_LPSS || COMPILE_TEST))
+        select SND_SOC_MAX98373_I2C

sound/soc/intel/boards/Kconfig config SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH · line 515

Quoted 10 lines
sound/soc/intel/boards/Kconfig +10 -0
+        select SND_SOC_RT1015
+        select SND_SOC_RT5682_I2C
+        select SND_SOC_DMIC
+        select SND_SOC_HDAC_HDMI
+        help
+           This adds support for ASoC machine driver for SOF platforms
+           with rt5682 codec.
+           Say Y if you have such a device.
+           If unsure select "N".
+

This is duplicating an existing config

if SND_SOC_SOF_HDA_LINK || SND_SOC_SOF_BAYTRAIL
config SND_SOC_INTEL_SOF_RT5682_MACH

	tristate "SOF with rt5682 codec in I2S Mode"
	depends on I2C && ACPI && GPIOLIB

What you would need is to add

       select SND_SOC_RT1015

to the existing config, not duplicate it.

Quoted 16 lines
sound/soc/intel/boards/Kconfig +0 -0
  endif ## SND_SOC_SOF_COMETLAKE && SND_SOC_SOF_HDA_LINK
 
  if SND_SOC_SOF_JASPERLAKE
sound/soc/intel/boards/Makefile +1 -0
index a58e4d2..73131cc 100644
@@ -20,6 +20,7 @@ snd-soc-sst-byt-cht-es8316-objs := bytcht_es8316.o
  snd-soc-sst-byt-cht-nocodec-objs := bytcht_nocodec.o
  snd-soc-sof_rt5682-objs := sof_rt5682.o hda_dsp_common.o sof_maxim_common.o
  snd-soc-cml_rt1011_rt5682-objs := cml_rt1011_rt5682.o hda_dsp_common.o
+snd-soc-cml_rt1015_rt5682-objs := cml_rt1015_rt5682.o
  snd-soc-kbl_da7219_max98357a-objs := kbl_da7219_max98357a.o
  snd-soc-kbl_da7219_max98927-objs := kbl_da7219_max98927.o
  snd-soc-kbl_rt5663_max98927-objs := kbl_rt5663_max98927.o

sound/soc/intel/boards/Makefile obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_DA7213_MACH) += snd-soc-sst-byt-cht-da7213.o · line 64

Quoted 4 lines
sound/soc/intel/boards/Makefile +1 -0
@@ -60,6 +61,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_DA7213_MACH) += snd-soc-sst-byt-cht-da7213.o
  obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_ES8316_MACH) += snd-soc-sst-byt-cht-es8316.o
  obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) += snd-soc-sst-byt-cht-nocodec.o
  obj-$(CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH) += snd-soc-cml_rt1011_rt5682.o
+obj-$(CONFIG_SND_SOC_INTEL_SOF_CML_RT1015_RT5682_MACH) += cml_rt1015_rt5682.o

But here you are using a config that was never defined.

And as I said in my previous email, please consider reusing an existing machine driver rather than adding a new one just to use rt1011 to rt1015.

Quoted 60 lines
sound/soc/intel/boards/Makefile +0 -0
  obj-$(CONFIG_SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH) += snd-soc-kbl_da7219_max98357a.o
  obj-$(CONFIG_SND_SOC_INTEL_KBL_DA7219_MAX98927_MACH) += snd-soc-kbl_da7219_max98927.o
  obj-$(CONFIG_SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH) += snd-soc-kbl_rt5663_max98927.o
sound/soc/intel/boards/cml_rt1015_rt5682.c new file +51 -0
new file mode 100644
index 0000000..bf18830
@@ -0,0 +1,570 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright(c) 2019 Intel Corporation.
+
+/*
+ * Intel Cometlake I2S Machine driver for RT1015 + RT5682 codec
+ */
+
+#include <linux/input.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+#include <linux/dmi.h>
+#include <linux/slab.h>
+#include <asm/cpu_device_id.h>
+#include <linux/acpi.h>
+#include <sound/core.h>
+#include <sound/jack.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/rt5682.h>
+#include <sound/soc-acpi.h>
+#include "../../codecs/rt1015.h"
+#include "../../codecs/rt5682.h"
+#include "../../codecs/hdac_hdmi.h"
+
+/* The platform clock outputs 24Mhz clock to codec as I2S MCLK */
+#define CML_PLAT_CLK	24000000
+#define CML_RT1015_CODEC_DAI "rt1015-aif"
+#define CML_RT5682_CODEC_DAI "rt5682-aif1"
+#define NAME_SIZE 32
+
+#define SOF_RT1015_SPEAKER_WL		BIT(0)
+#define SOF_RT1015_SPEAKER_WR		BIT(1)
+#define SOF_RT1015_SPEAKER_TL		BIT(2)
+#define SOF_RT1015_SPEAKER_TR		BIT(3)
+#define SPK_CH 4
+
+/* Default: Woofer speakers  */
+static unsigned long sof_rt1015_quirk = SOF_RT1015_SPEAKER_WL |
+					SOF_RT1015_SPEAKER_WR;
+
+static int sof_rt1015_quirk_cb(const struct dmi_system_id *id)
+{
+	sof_rt1015_quirk = (unsigned long)id->driver_data;
+	return 1;
+}
+
+static const struct dmi_system_id sof_rt1015_quirk_table[] = {
+	{
+		.callback = sof_rt1015_quirk_cb,

sound/soc/intel/boards/cml_rt1015_rt5682.c line 61

Quoted 10 lines
sound/soc/intel/boards/cml_rt1015_rt5682.c new file +10 -0
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Google"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Helios"),
+	},
+		.driver_data = (void *)(SOF_RT1015_SPEAKER_WL | SOF_RT1015_SPEAKER_WR |
+					SOF_RT1015_SPEAKER_TL | SOF_RT1015_SPEAKER_TR),
+	},
+	{
+	}
+};

in cml_rt1011_rt5682.c, we already have:

static const struct dmi_system_id sof_rt1011_quirk_table[] = {
	{
		.callback = sof_rt1011_quirk_cb,
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Google"),
			DMI_MATCH(DMI_PRODUCT_NAME, "Helios"),
	},
		.driver_data = (void *)(SOF_RT1011_SPEAKER_WL | SOF_RT1011_SPEAKER_WR |
					SOF_RT1011_SPEAKER_TL | SOF_RT1011_SPEAKER_TR),
	},
	{
	}
};

Can someone explain how the same "Helios" product can have DMI identical quirks pointing to different amplifiers? this really begs the question on what PRODUCT_NAME means. I would expect DMI quirks to be unique, not match in different drivers as suggested.

NAK on this version. Please don't copy-paste like this.