Unverified Commit 439c69f8 authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: Intel: boards: updates for 6.10 - part3

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

This last part is the continuation of Brent Lu's cleanups. Multiple
quirks have been removed to use "default" configurations and
ACPI-based detection of codecs and selection of topology files.

This cleanup has been done in multiple steps/phases since Fall 2023,
thanks Brent for this contribution!
parents ccec9402 57ad033c
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -3,8 +3,8 @@
 * Copyright(c) 2023 Intel Corporation.
 */

#ifndef __SOF_SSP_COMMON_H
#define __SOF_SSP_COMMON_H
#ifndef __LINUX_SND_SOC_ACPI_INTEL_SSP_COMMON_H
#define __LINUX_SND_SOC_ACPI_INTEL_SSP_COMMON_H

/* Cirrus Logic */
#define CS35L41_ACPI_HID	"CSC3541"
@@ -37,7 +37,7 @@
#define RT5682_ACPI_HID		"10EC5682"
#define RT5682S_ACPI_HID	"RTL5682"

enum sof_ssp_codec {
enum snd_soc_acpi_intel_codec {
	CODEC_NONE,

	/* headphone codec */
@@ -65,9 +65,17 @@ enum sof_ssp_codec {
	CODEC_RT1308,
};

enum sof_ssp_codec sof_ssp_detect_codec_type(struct device *dev);
enum sof_ssp_codec sof_ssp_detect_amp_type(struct device *dev);
enum snd_soc_acpi_intel_codec
snd_soc_acpi_intel_detect_codec_type(struct device *dev);
enum snd_soc_acpi_intel_codec
snd_soc_acpi_intel_detect_amp_type(struct device *dev);

const char *sof_ssp_get_codec_name(enum sof_ssp_codec codec_type);
const char *
snd_soc_acpi_intel_get_codec_name(enum snd_soc_acpi_intel_codec codec_type);

#endif /* __SOF_SSP_COMMON_H */
const char *
snd_soc_acpi_intel_get_codec_tplg_suffix(enum snd_soc_acpi_intel_codec codec_type);
const char *
snd_soc_acpi_intel_get_amp_tplg_suffix(enum snd_soc_acpi_intel_codec codec_type);

#endif /* __LINUX_SND_SOC_ACPI_INTEL_SSP_COMMON_H */
+12 −0
Original line number Diff line number Diff line
@@ -151,6 +151,18 @@ struct snd_soc_acpi_link_adr {
 */
#define SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER BIT(2)

/*
 * when set the speaker amplifier name suffix (i.e. "-max98360a") will be
 * appended to topology file name
 */
#define SND_SOC_ACPI_TPLG_INTEL_AMP_NAME BIT(3)

/*
 * when set the headphone codec name suffix (i.e. "-rt5682") will be appended to
 * topology file name
 */
#define SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME BIT(4)

/**
 * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are
 * related to the hardware, except for the firmware and topology file names.
+5 −8
Original line number Diff line number Diff line
@@ -41,9 +41,6 @@ config SND_SOC_INTEL_SOF_CIRRUS_COMMON
config SND_SOC_INTEL_SOF_NUVOTON_COMMON
	tristate

config SND_SOC_INTEL_SOF_SSP_COMMON
	tristate

config SND_SOC_INTEL_SOF_BOARD_HELPERS
	tristate

@@ -503,7 +500,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH
	select SND_SOC_INTEL_SOF_BOARD_HELPERS
	select SND_SOC_INTEL_SOF_MAXIM_COMMON
	select SND_SOC_INTEL_SOF_REALTEK_COMMON
	select SND_SOC_INTEL_SOF_SSP_COMMON
	select SND_SOC_ACPI_INTEL_MATCH
	help
	   This adds support for ASoC machine driver for SOF platforms
	   with rt5650 or rt5682 codec.
@@ -521,7 +518,7 @@ config SND_SOC_INTEL_SOF_CS42L42_MACH
	select SND_SOC_INTEL_HDA_DSP_COMMON
	select SND_SOC_INTEL_SOF_BOARD_HELPERS
	select SND_SOC_INTEL_SOF_MAXIM_COMMON
	select SND_SOC_INTEL_SOF_SSP_COMMON
	select SND_SOC_ACPI_INTEL_MATCH
	help
	   This adds support for ASoC machine driver for SOF platforms
	   with cs42l42 codec.
@@ -574,7 +571,7 @@ config SND_SOC_INTEL_SOF_NAU8825_MACH
	select SND_SOC_INTEL_SOF_MAXIM_COMMON
	select SND_SOC_INTEL_SOF_NUVOTON_COMMON
	select SND_SOC_INTEL_SOF_REALTEK_COMMON
	select SND_SOC_INTEL_SOF_SSP_COMMON
	select SND_SOC_ACPI_INTEL_MATCH
	help
	   This adds support for ASoC machine driver for SOF platforms
	   with nau8825 codec.
@@ -626,7 +623,7 @@ config SND_SOC_INTEL_SOF_DA7219_MACH
	select SND_SOC_DMIC
	select SND_SOC_INTEL_SOF_BOARD_HELPERS
	select SND_SOC_INTEL_SOF_MAXIM_COMMON
	select SND_SOC_INTEL_SOF_SSP_COMMON
	select SND_SOC_ACPI_INTEL_MATCH
	help
	  This adds support for ASoC machine driver for SOF platforms
	  with Dialog DA7219 I2S audio codec.
@@ -646,7 +643,7 @@ config SND_SOC_INTEL_SOF_SSP_AMP_MACH
	select SND_SOC_INTEL_SOF_BOARD_HELPERS
	select SND_SOC_INTEL_SOF_REALTEK_COMMON
	select SND_SOC_INTEL_SOF_CIRRUS_COMMON
	select SND_SOC_INTEL_SOF_SSP_COMMON
	select SND_SOC_ACPI_INTEL_MATCH
	help
	   This adds support for ASoC machine driver for SOF platforms
	   with RT1308/CS35L41 I2S audio codec.
+0 −3
Original line number Diff line number Diff line
@@ -101,8 +101,5 @@ obj-$(CONFIG_SND_SOC_INTEL_SOF_CIRRUS_COMMON) += snd-soc-intel-sof-cirrus-common
snd-soc-intel-sof-nuvoton-common-objs += sof_nuvoton_common.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_NUVOTON_COMMON) += snd-soc-intel-sof-nuvoton-common.o

snd-soc-intel-sof-ssp-common-objs += sof_ssp_common.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_SSP_COMMON) += snd-soc-intel-sof-ssp-common.o

snd-soc-intel-sof-board-helpers-objs += sof_board_helpers.o
obj-$(CONFIG_SND_SOC_INTEL_SOF_BOARD_HELPERS) += snd-soc-intel-sof-board-helpers.o
+8 −7
Original line number Diff line number Diff line
@@ -103,13 +103,13 @@ static struct snd_soc_dai_link_component platform_component[] = {
};

static int set_ssp_codec_link(struct device *dev, struct snd_soc_dai_link *link,
			      int be_id, enum sof_ssp_codec codec_type,
			      int be_id, enum snd_soc_acpi_intel_codec codec_type,
			      int ssp_codec)
{
	struct snd_soc_dai_link_component *cpus;

	dev_dbg(dev, "link %d: ssp codec %s, ssp %d\n", be_id,
		sof_ssp_get_codec_name(codec_type), ssp_codec);
		snd_soc_acpi_intel_get_codec_name(codec_type), ssp_codec);

	/* link name */
	link->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_codec);
@@ -259,12 +259,13 @@ static int set_idisp_hdmi_link(struct device *dev, struct snd_soc_dai_link *link
}

static int set_ssp_amp_link(struct device *dev, struct snd_soc_dai_link *link,
			    int be_id, enum sof_ssp_codec amp_type, int ssp_amp)
			    int be_id, enum snd_soc_acpi_intel_codec amp_type,
			    int ssp_amp)
{
	struct snd_soc_dai_link_component *cpus;

	dev_dbg(dev, "link %d: ssp amp %s, ssp %d\n", be_id,
		sof_ssp_get_codec_name(amp_type), ssp_amp);
		snd_soc_acpi_intel_get_codec_name(amp_type), ssp_amp);

	/* link name */
	link->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_amp);
@@ -598,8 +599,8 @@ sof_intel_board_get_ctx(struct device *dev, unsigned long board_quirk)
	if (!ctx)
		return NULL;

	ctx->codec_type = sof_ssp_detect_codec_type(dev);
	ctx->amp_type = sof_ssp_detect_amp_type(dev);
	ctx->codec_type = snd_soc_acpi_intel_detect_codec_type(dev);
	ctx->amp_type = snd_soc_acpi_intel_detect_amp_type(dev);

	ctx->dmic_be_num = 2;
	ctx->hdmi_num = (board_quirk & SOF_NUM_IDISP_HDMI_MASK) >>
@@ -634,4 +635,4 @@ MODULE_DESCRIPTION("ASoC Intel SOF Machine Driver Board Helpers");
MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON);
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_SSP_COMMON);
MODULE_IMPORT_NS(SND_SOC_ACPI_INTEL_MATCH);
Loading