mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
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!
This commit is contained in:
commit
439c69f809
|
@ -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 */
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#define __SOF_INTEL_BOARD_HELPERS_H
|
||||
|
||||
#include <sound/soc.h>
|
||||
#include <sound/soc-acpi-intel-ssp-common.h>
|
||||
#include "sof_hdmi_common.h"
|
||||
#include "sof_ssp_common.h"
|
||||
|
||||
/*
|
||||
* Common board quirks: from bit 8 to 31, LSB 8 bits reserved for machine
|
||||
|
@ -132,8 +132,8 @@ struct sof_card_private {
|
|||
struct snd_soc_jack headset_jack;
|
||||
struct sof_hdmi_private hdmi;
|
||||
|
||||
enum sof_ssp_codec codec_type;
|
||||
enum sof_ssp_codec amp_type;
|
||||
enum snd_soc_acpi_intel_codec codec_type;
|
||||
enum snd_soc_acpi_intel_codec amp_type;
|
||||
|
||||
int dmic_be_num;
|
||||
int hdmi_num;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#define __SOF_CIRRUS_COMMON_H
|
||||
|
||||
#include <sound/soc.h>
|
||||
#include "sof_ssp_common.h"
|
||||
#include <sound/soc-acpi-intel-ssp-common.h>
|
||||
|
||||
/*
|
||||
* Cirrus Logic CS35L41/CS35L53
|
||||
|
|
|
@ -263,13 +263,28 @@ static const struct platform_device_id board_ids[] = {
|
|||
SOF_SSP_PORT_AMP(1)),
|
||||
},
|
||||
{
|
||||
.name = "adl_mx98360a_cs4242",
|
||||
.name = "adl_cs42l42_def",
|
||||
.driver_data = (kernel_ulong_t)(SOF_SSP_PORT_CODEC(0) |
|
||||
SOF_SSP_PORT_AMP(1) |
|
||||
SOF_NUM_IDISP_HDMI(4) |
|
||||
SOF_BT_OFFLOAD_PRESENT |
|
||||
SOF_SSP_PORT_BT_OFFLOAD(2)),
|
||||
},
|
||||
{
|
||||
.name = "rpl_cs42l42_def",
|
||||
.driver_data = (kernel_ulong_t)(SOF_SSP_PORT_CODEC(0) |
|
||||
SOF_SSP_PORT_AMP(1) |
|
||||
SOF_NUM_IDISP_HDMI(4) |
|
||||
SOF_BT_OFFLOAD_PRESENT |
|
||||
SOF_SSP_PORT_BT_OFFLOAD(2)),
|
||||
},
|
||||
{
|
||||
.name = "mtl_cs42l42_def",
|
||||
.driver_data = (kernel_ulong_t)(SOF_SSP_PORT_CODEC(2) |
|
||||
SOF_SSP_PORT_AMP(0) |
|
||||
SOF_BT_OFFLOAD_PRESENT |
|
||||
SOF_SSP_PORT_BT_OFFLOAD(1)),
|
||||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, board_ids);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#define __SOF_MAXIM_COMMON_H
|
||||
|
||||
#include <sound/soc.h>
|
||||
#include "sof_ssp_common.h"
|
||||
#include <sound/soc-acpi-intel-ssp-common.h>
|
||||
|
||||
/*
|
||||
* Maxim MAX98373
|
||||
|
|
|
@ -319,6 +319,13 @@ static const struct platform_device_id board_ids[] = {
|
|||
SOF_SSP_PORT_BT_OFFLOAD(2) |
|
||||
SOF_BT_OFFLOAD_PRESENT),
|
||||
},
|
||||
{
|
||||
.name = "mtl_nau8825_def",
|
||||
.driver_data = (kernel_ulong_t)(SOF_SSP_PORT_CODEC(2) |
|
||||
SOF_SSP_PORT_AMP(0) |
|
||||
SOF_SSP_PORT_BT_OFFLOAD(1) |
|
||||
SOF_BT_OFFLOAD_PRESENT),
|
||||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, board_ids);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#define __SOF_NUVOTON_COMMON_H
|
||||
|
||||
#include <sound/soc.h>
|
||||
#include "sof_ssp_common.h"
|
||||
#include <sound/soc-acpi-intel-ssp-common.h>
|
||||
|
||||
/*
|
||||
* Nuvoton NAU8318
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#define __SOF_REALTEK_COMMON_H
|
||||
|
||||
#include <sound/soc.h>
|
||||
#include "sof_ssp_common.h"
|
||||
#include <sound/soc-acpi-intel-ssp-common.h>
|
||||
|
||||
/*
|
||||
* Realtek ALC1011
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
//
|
||||
// Copyright(c) 2023 Intel Corporation. All rights reserved.
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <sound/soc-acpi.h>
|
||||
#include "sof_ssp_common.h"
|
||||
|
||||
/*
|
||||
* Codec probe function
|
||||
*/
|
||||
#define CODEC_MAP_ENTRY(n, h, t) \
|
||||
{ \
|
||||
.name = n, \
|
||||
.acpi_hid = h, \
|
||||
.codec_type = t, \
|
||||
}
|
||||
|
||||
struct codec_map {
|
||||
const char *name;
|
||||
const char *acpi_hid;
|
||||
enum sof_ssp_codec codec_type;
|
||||
};
|
||||
|
||||
static const struct codec_map codecs[] = {
|
||||
/* Cirrus Logic */
|
||||
CODEC_MAP_ENTRY("CS42L42", CS42L42_ACPI_HID, CODEC_CS42L42),
|
||||
|
||||
/* Dialog */
|
||||
CODEC_MAP_ENTRY("DA7219", DA7219_ACPI_HID, CODEC_DA7219),
|
||||
|
||||
/* Everest */
|
||||
CODEC_MAP_ENTRY("ES8316", ES8316_ACPI_HID, CODEC_ES8316),
|
||||
CODEC_MAP_ENTRY("ES8326", ES8326_ACPI_HID, CODEC_ES8326),
|
||||
CODEC_MAP_ENTRY("ES8336", ES8336_ACPI_HID, CODEC_ES8336),
|
||||
|
||||
/* Nuvoton */
|
||||
CODEC_MAP_ENTRY("NAU8825", NAU8825_ACPI_HID, CODEC_NAU8825),
|
||||
|
||||
/* Realtek */
|
||||
CODEC_MAP_ENTRY("RT5650", RT5650_ACPI_HID, CODEC_RT5650),
|
||||
CODEC_MAP_ENTRY("RT5682", RT5682_ACPI_HID, CODEC_RT5682),
|
||||
CODEC_MAP_ENTRY("RT5682S", RT5682S_ACPI_HID, CODEC_RT5682S),
|
||||
};
|
||||
|
||||
static const struct codec_map amps[] = {
|
||||
/* Cirrus Logic */
|
||||
CODEC_MAP_ENTRY("CS35L41", CS35L41_ACPI_HID, CODEC_CS35L41),
|
||||
|
||||
/* Maxim */
|
||||
CODEC_MAP_ENTRY("MAX98357A", MAX_98357A_ACPI_HID, CODEC_MAX98357A),
|
||||
CODEC_MAP_ENTRY("MAX98360A", MAX_98360A_ACPI_HID, CODEC_MAX98360A),
|
||||
CODEC_MAP_ENTRY("MAX98373", MAX_98373_ACPI_HID, CODEC_MAX98373),
|
||||
CODEC_MAP_ENTRY("MAX98390", MAX_98390_ACPI_HID, CODEC_MAX98390),
|
||||
|
||||
/* Nuvoton */
|
||||
CODEC_MAP_ENTRY("NAU8318", NAU8318_ACPI_HID, CODEC_NAU8318),
|
||||
|
||||
/* Realtek */
|
||||
CODEC_MAP_ENTRY("RT1011", RT1011_ACPI_HID, CODEC_RT1011),
|
||||
CODEC_MAP_ENTRY("RT1015", RT1015_ACPI_HID, CODEC_RT1015),
|
||||
CODEC_MAP_ENTRY("RT1015P", RT1015P_ACPI_HID, CODEC_RT1015P),
|
||||
CODEC_MAP_ENTRY("RT1019P", RT1019P_ACPI_HID, CODEC_RT1019P),
|
||||
CODEC_MAP_ENTRY("RT1308", RT1308_ACPI_HID, CODEC_RT1308),
|
||||
};
|
||||
|
||||
enum sof_ssp_codec sof_ssp_detect_codec_type(struct device *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(codecs); i++) {
|
||||
if (!acpi_dev_present(codecs[i].acpi_hid, NULL, -1))
|
||||
continue;
|
||||
|
||||
dev_dbg(dev, "codec %s found\n", codecs[i].name);
|
||||
return codecs[i].codec_type;
|
||||
}
|
||||
|
||||
return CODEC_NONE;
|
||||
}
|
||||
EXPORT_SYMBOL_NS(sof_ssp_detect_codec_type, SND_SOC_INTEL_SOF_SSP_COMMON);
|
||||
|
||||
enum sof_ssp_codec sof_ssp_detect_amp_type(struct device *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(amps); i++) {
|
||||
if (!acpi_dev_present(amps[i].acpi_hid, NULL, -1))
|
||||
continue;
|
||||
|
||||
dev_dbg(dev, "amp %s found\n", amps[i].name);
|
||||
return amps[i].codec_type;
|
||||
}
|
||||
|
||||
return CODEC_NONE;
|
||||
}
|
||||
EXPORT_SYMBOL_NS(sof_ssp_detect_amp_type, SND_SOC_INTEL_SOF_SSP_COMMON);
|
||||
|
||||
const char *sof_ssp_get_codec_name(enum sof_ssp_codec codec_type)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(codecs); i++) {
|
||||
if (codecs[i].codec_type != codec_type)
|
||||
continue;
|
||||
|
||||
return codecs[i].name;
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(amps); i++) {
|
||||
if (amps[i].codec_type != codec_type)
|
||||
continue;
|
||||
|
||||
return amps[i].name;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_NS(sof_ssp_get_codec_name, SND_SOC_INTEL_SOF_SSP_COMMON);
|
||||
|
||||
MODULE_DESCRIPTION("ASoC Intel SOF Common Machine Driver Helpers");
|
||||
MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -15,5 +15,7 @@ snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-m
|
|||
soc-acpi-intel-hda-match.o \
|
||||
soc-acpi-intel-sdw-mockup-match.o
|
||||
|
||||
snd-soc-acpi-intel-match-objs += soc-acpi-intel-ssp-common.o
|
||||
|
||||
obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o
|
||||
obj-$(CONFIG_SND_SOC_ACPI_INTEL_MATCH) += snd-soc-acpi-intel-match.o
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <sound/soc-acpi.h>
|
||||
#include <sound/soc-acpi-intel-match.h>
|
||||
#include <sound/soc-acpi-intel-ssp-common.h>
|
||||
|
||||
static const struct snd_soc_acpi_codecs essx_83x6 = {
|
||||
.num_codecs = 3,
|
||||
|
@ -447,11 +448,6 @@ static const struct snd_soc_acpi_link_adr adl_chromebook_base[] = {
|
|||
{}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs adl_max98373_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"MX98373"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs adl_max98357a_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"MX98357A"}
|
||||
|
@ -464,12 +460,7 @@ static const struct snd_soc_acpi_codecs adl_max98360a_amp = {
|
|||
|
||||
static const struct snd_soc_acpi_codecs adl_rt5682_rt5682s_hp = {
|
||||
.num_codecs = 2,
|
||||
.codecs = {"10EC5682", "RTL5682"},
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs adl_rt1015p_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"RTL1015"}
|
||||
.codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID},
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs adl_rt1019p_amp = {
|
||||
|
@ -477,34 +468,12 @@ static const struct snd_soc_acpi_codecs adl_rt1019p_amp = {
|
|||
.codecs = {"RTL1019"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs adl_max98390_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"MX98390"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs adl_lt6911_hdmi = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"INTC10B0"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs adl_nau8318_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"NVTN2012"}
|
||||
};
|
||||
|
||||
static struct snd_soc_acpi_codecs adl_rt5650_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"10EC5650"}
|
||||
};
|
||||
|
||||
struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
|
||||
{
|
||||
.comp_ids = &adl_rt5682_rt5682s_hp,
|
||||
.drv_name = "adl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &adl_max98373_amp,
|
||||
.sof_tplg_filename = "sof-adl-max98373-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &adl_rt5682_rt5682s_hp,
|
||||
.drv_name = "adl_mx98357_rt5682",
|
||||
|
@ -512,13 +481,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
|
|||
.quirk_data = &adl_max98357a_amp,
|
||||
.sof_tplg_filename = "sof-adl-max98357a-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &adl_rt5682_rt5682s_hp,
|
||||
.drv_name = "adl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &adl_max98360a_amp,
|
||||
.sof_tplg_filename = "sof-adl-max98360a-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.id = "10508825",
|
||||
.drv_name = "adl_rt1019p_8825",
|
||||
|
@ -526,53 +488,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
|
|||
.quirk_data = &adl_rt1019p_amp,
|
||||
.sof_tplg_filename = "sof-adl-rt1019-nau8825.tplg",
|
||||
},
|
||||
{
|
||||
.id = "10508825",
|
||||
.drv_name = "adl_nau8825_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &adl_max98373_amp,
|
||||
.sof_tplg_filename = "sof-adl-max98373-nau8825.tplg",
|
||||
},
|
||||
{
|
||||
.id = "10508825",
|
||||
.drv_name = "adl_nau8825_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &adl_max98360a_amp,
|
||||
.sof_tplg_filename = "sof-adl-max98360a-nau8825.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &adl_rt5682_rt5682s_hp,
|
||||
.drv_name = "adl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &adl_rt1019p_amp,
|
||||
.sof_tplg_filename = "sof-adl-rt1019-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.id = "10508825",
|
||||
.drv_name = "adl_nau8825_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &adl_rt1015p_amp,
|
||||
.sof_tplg_filename = "sof-adl-rt1015-nau8825.tplg",
|
||||
},
|
||||
{
|
||||
.id = "10508825",
|
||||
.drv_name = "adl_nau8825_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &adl_nau8318_amp,
|
||||
.sof_tplg_filename = "sof-adl-nau8318-nau8825.tplg",
|
||||
},
|
||||
{
|
||||
.id = "10508825",
|
||||
.drv_name = "adl_nau8825_def",
|
||||
.sof_tplg_filename = "sof-adl-nau8825.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &adl_rt5682_rt5682s_hp,
|
||||
.drv_name = "adl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &adl_max98390_amp,
|
||||
.sof_tplg_filename = "sof-adl-max98390-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &adl_rt5682_rt5682s_hp,
|
||||
.drv_name = "adl_rt5682_c1_h02",
|
||||
|
@ -580,18 +495,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
|
|||
.quirk_data = &adl_lt6911_hdmi,
|
||||
.sof_tplg_filename = "sof-adl-rt5682-ssp1-hdmi-ssp02.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &adl_rt5682_rt5682s_hp,
|
||||
.drv_name = "adl_rt5682_def",
|
||||
.sof_tplg_filename = "sof-adl-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.id = "10134242",
|
||||
.drv_name = "adl_mx98360a_cs4242",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &adl_max98360a_amp,
|
||||
.sof_tplg_filename = "sof-adl-max98360a-cs42l42.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &essx_83x6,
|
||||
.drv_name = "adl_es83x6_c1_h02",
|
||||
|
@ -607,13 +510,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
|
|||
SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
|
||||
SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
|
||||
},
|
||||
{
|
||||
.id = "10EC5650",
|
||||
.drv_name = "adl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &adl_rt5650_amp,
|
||||
.sof_tplg_filename = "sof-adl-rt5650.tplg",
|
||||
},
|
||||
{
|
||||
.id = "DLGS7219",
|
||||
.drv_name = "adl_da7219_def",
|
||||
|
@ -621,6 +517,37 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
|
|||
.quirk_data = &adl_max98360a_amp,
|
||||
.sof_tplg_filename = "sof-adl-max98360a-da7219.tplg",
|
||||
},
|
||||
/* place boards for each headphone codec: sof driver will complete the
|
||||
* tplg name and machine driver will detect the amp type
|
||||
*/
|
||||
{
|
||||
.id = CS42L42_ACPI_HID,
|
||||
.drv_name = "adl_cs42l42_def",
|
||||
.sof_tplg_filename = "sof-adl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
{
|
||||
.id = NAU8825_ACPI_HID,
|
||||
.drv_name = "adl_nau8825_def",
|
||||
.sof_tplg_filename = "sof-adl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
{
|
||||
.id = RT5650_ACPI_HID,
|
||||
.drv_name = "adl_rt5682_def",
|
||||
.sof_tplg_filename = "sof-adl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
{
|
||||
.comp_ids = &adl_rt5682_rt5682s_hp,
|
||||
.drv_name = "adl_rt5682_def",
|
||||
.sof_tplg_filename = "sof-adl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
/* place amp-only boards in the end of table */
|
||||
{
|
||||
.id = "CSC3541",
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <sound/soc-acpi.h>
|
||||
#include <sound/soc-acpi-intel-match.h>
|
||||
#include <sound/soc-acpi-intel-ssp-common.h>
|
||||
#include "soc-acpi-intel-sdw-mockup-match.h"
|
||||
|
||||
static const struct snd_soc_acpi_codecs mtl_max98357a_amp = {
|
||||
|
@ -20,14 +21,9 @@ static const struct snd_soc_acpi_codecs mtl_max98360a_amp = {
|
|||
.codecs = {"MX98360A"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs mtl_rt1019p_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"RTL1019"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp = {
|
||||
.num_codecs = 2,
|
||||
.codecs = {"10EC5682", "RTL5682"},
|
||||
.codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID},
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs mtl_essx_83x6 = {
|
||||
|
@ -40,11 +36,6 @@ static const struct snd_soc_acpi_codecs mtl_lt6911_hdmi = {
|
|||
.codecs = {"INTC10B0"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs mtl_rt5650_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"10EC5650"}
|
||||
};
|
||||
|
||||
struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = {
|
||||
{
|
||||
.comp_ids = &mtl_rt5682_rt5682s_hp,
|
||||
|
@ -60,13 +51,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = {
|
|||
.quirk_data = &mtl_max98360a_amp,
|
||||
.sof_tplg_filename = "sof-mtl-max98360a-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &mtl_rt5682_rt5682s_hp,
|
||||
.drv_name = "mtl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &mtl_rt1019p_amp,
|
||||
.sof_tplg_filename = "sof-mtl-rt1019-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &mtl_essx_83x6,
|
||||
.drv_name = "mtl_es83x6_c1_h02",
|
||||
|
@ -82,12 +66,36 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = {
|
|||
SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
|
||||
SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
|
||||
},
|
||||
/* place boards for each headphone codec: sof driver will complete the
|
||||
* tplg name and machine driver will detect the amp type
|
||||
*/
|
||||
{
|
||||
.id = "10EC5650",
|
||||
.id = CS42L42_ACPI_HID,
|
||||
.drv_name = "mtl_cs42l42_def",
|
||||
.sof_tplg_filename = "sof-mtl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
{
|
||||
.id = NAU8825_ACPI_HID,
|
||||
.drv_name = "mtl_nau8825_def",
|
||||
.sof_tplg_filename = "sof-mtl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
{
|
||||
.id = RT5650_ACPI_HID,
|
||||
.drv_name = "mtl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &mtl_rt5650_amp,
|
||||
.sof_tplg_filename = "sof-mtl-rt5650.tplg",
|
||||
.sof_tplg_filename = "sof-mtl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
{
|
||||
.comp_ids = &mtl_rt5682_rt5682s_hp,
|
||||
.drv_name = "mtl_rt5682_def",
|
||||
.sof_tplg_filename = "sof-mtl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
/* place amp-only boards in the end of table */
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <sound/soc-acpi.h>
|
||||
#include <sound/soc-acpi-intel-match.h>
|
||||
#include <sound/soc-acpi-intel-ssp-common.h>
|
||||
|
||||
static const struct snd_soc_acpi_endpoint single_endpoint = {
|
||||
.num = 0,
|
||||
|
@ -347,7 +348,7 @@ static const struct snd_soc_acpi_link_adr rplp_crb[] = {
|
|||
|
||||
static const struct snd_soc_acpi_codecs rpl_rt5682_hp = {
|
||||
.num_codecs = 2,
|
||||
.codecs = {"10EC5682", "RTL5682"},
|
||||
.codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID},
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs rpl_essx_83x6 = {
|
||||
|
@ -365,26 +366,11 @@ static const struct snd_soc_acpi_codecs rpl_max98360a_amp = {
|
|||
.codecs = {"MX98360A"},
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs rpl_max98373_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"MX98373"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs rpl_lt6911_hdmi = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"INTC10B0"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs rpl_nau8318_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"NVTN2012"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs rpl_rt1019p_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"RTL1019"}
|
||||
};
|
||||
|
||||
struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[] = {
|
||||
{
|
||||
.comp_ids = &rpl_rt5682_hp,
|
||||
|
@ -393,41 +379,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[] = {
|
|||
.quirk_data = &rpl_max98357a_amp,
|
||||
.sof_tplg_filename = "sof-rpl-max98357a-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &rpl_rt5682_hp,
|
||||
.drv_name = "rpl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &rpl_max98360a_amp,
|
||||
.sof_tplg_filename = "sof-rpl-max98360a-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.id = "10508825",
|
||||
.drv_name = "rpl_nau8825_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &rpl_max98373_amp,
|
||||
.sof_tplg_filename = "sof-rpl-max98373-nau8825.tplg",
|
||||
},
|
||||
{
|
||||
.id = "10508825",
|
||||
.drv_name = "rpl_nau8825_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &rpl_max98360a_amp,
|
||||
.sof_tplg_filename = "sof-rpl-max98360a-nau8825.tplg",
|
||||
},
|
||||
{
|
||||
.id = "10508825",
|
||||
.drv_name = "rpl_nau8825_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &rpl_nau8318_amp,
|
||||
.sof_tplg_filename = "sof-rpl-nau8318-nau8825.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &rpl_rt5682_hp,
|
||||
.drv_name = "rpl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &rpl_rt1019p_amp,
|
||||
.sof_tplg_filename = "sof-rpl-rt1019-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &rpl_rt5682_hp,
|
||||
.drv_name = "rpl_rt5682_c1_h02",
|
||||
|
@ -450,6 +401,38 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[] = {
|
|||
SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
|
||||
SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
|
||||
},
|
||||
/* place boards for each headphone codec: sof driver will complete the
|
||||
* tplg name and machine driver will detect the amp type
|
||||
*/
|
||||
{
|
||||
.id = CS42L42_ACPI_HID,
|
||||
.drv_name = "rpl_cs42l42_def",
|
||||
.sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
{
|
||||
.id = NAU8825_ACPI_HID,
|
||||
.drv_name = "rpl_nau8825_def",
|
||||
.sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
{
|
||||
.id = RT5650_ACPI_HID,
|
||||
.drv_name = "rpl_rt5682_def",
|
||||
.sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
{
|
||||
.comp_ids = &rpl_rt5682_hp,
|
||||
.drv_name = "rpl_rt5682_def",
|
||||
.sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
/* place amp-only boards in the end of table */
|
||||
{
|
||||
.id = "INTC10B0",
|
||||
.drv_name = "rpl_lt6911_hdmi_ssp",
|
||||
|
@ -462,11 +445,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[] = {
|
|||
.quirk_data = &rpl_max98360a_amp,
|
||||
.sof_tplg_filename = "sof-rpl-max98360a-da7219.tplg",
|
||||
},
|
||||
{
|
||||
.id = "10EC5650",
|
||||
.drv_name = "rpl_rt5682_def",
|
||||
.sof_tplg_filename = "sof-rpl-rt5650.tplg",
|
||||
},
|
||||
{},
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_rpl_machines);
|
||||
|
|
159
sound/soc/intel/common/soc-acpi-intel-ssp-common.c
Normal file
159
sound/soc/intel/common/soc-acpi-intel-ssp-common.c
Normal file
|
@ -0,0 +1,159 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
//
|
||||
// Copyright(c) 2023 Intel Corporation. All rights reserved.
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <sound/soc-acpi.h>
|
||||
#include <sound/soc-acpi-intel-ssp-common.h>
|
||||
|
||||
/*
|
||||
* Codec probe function
|
||||
*/
|
||||
#define CODEC_MAP_ENTRY(n, s, h, t) \
|
||||
{ \
|
||||
.name = n, \
|
||||
.tplg_suffix = s, \
|
||||
.acpi_hid = h, \
|
||||
.codec_type = t, \
|
||||
}
|
||||
|
||||
struct codec_map {
|
||||
const char *name;
|
||||
const char *tplg_suffix;
|
||||
const char *acpi_hid;
|
||||
enum snd_soc_acpi_intel_codec codec_type;
|
||||
};
|
||||
|
||||
static const struct codec_map codecs[] = {
|
||||
/* Cirrus Logic */
|
||||
CODEC_MAP_ENTRY("CS42L42", "cs42l42", CS42L42_ACPI_HID, CODEC_CS42L42),
|
||||
|
||||
/* Dialog */
|
||||
CODEC_MAP_ENTRY("DA7219", "da7219", DA7219_ACPI_HID, CODEC_DA7219),
|
||||
|
||||
/* Everest */
|
||||
CODEC_MAP_ENTRY("ES8316", "es8336", ES8316_ACPI_HID, CODEC_ES8316),
|
||||
CODEC_MAP_ENTRY("ES8326", "es8336", ES8326_ACPI_HID, CODEC_ES8326),
|
||||
CODEC_MAP_ENTRY("ES8336", "es8336", ES8336_ACPI_HID, CODEC_ES8336),
|
||||
|
||||
/* Nuvoton */
|
||||
CODEC_MAP_ENTRY("NAU8825", "nau8825", NAU8825_ACPI_HID, CODEC_NAU8825),
|
||||
|
||||
/* Realtek */
|
||||
CODEC_MAP_ENTRY("RT5650", "rt5650", RT5650_ACPI_HID, CODEC_RT5650),
|
||||
CODEC_MAP_ENTRY("RT5682", "rt5682", RT5682_ACPI_HID, CODEC_RT5682),
|
||||
CODEC_MAP_ENTRY("RT5682S", "rt5682", RT5682S_ACPI_HID, CODEC_RT5682S),
|
||||
};
|
||||
|
||||
static const struct codec_map amps[] = {
|
||||
/* Cirrus Logic */
|
||||
CODEC_MAP_ENTRY("CS35L41", "cs35l41", CS35L41_ACPI_HID, CODEC_CS35L41),
|
||||
|
||||
/* Maxim */
|
||||
CODEC_MAP_ENTRY("MAX98357A", "max98357a", MAX_98357A_ACPI_HID, CODEC_MAX98357A),
|
||||
CODEC_MAP_ENTRY("MAX98360A", "max98360a", MAX_98360A_ACPI_HID, CODEC_MAX98360A),
|
||||
CODEC_MAP_ENTRY("MAX98373", "max98373", MAX_98373_ACPI_HID, CODEC_MAX98373),
|
||||
CODEC_MAP_ENTRY("MAX98390", "max98390", MAX_98390_ACPI_HID, CODEC_MAX98390),
|
||||
|
||||
/* Nuvoton */
|
||||
CODEC_MAP_ENTRY("NAU8318", "nau8318", NAU8318_ACPI_HID, CODEC_NAU8318),
|
||||
|
||||
/* Realtek */
|
||||
CODEC_MAP_ENTRY("RT1011", "rt1011", RT1011_ACPI_HID, CODEC_RT1011),
|
||||
CODEC_MAP_ENTRY("RT1015", "rt1015", RT1015_ACPI_HID, CODEC_RT1015),
|
||||
CODEC_MAP_ENTRY("RT1015P", "rt1015", RT1015P_ACPI_HID, CODEC_RT1015P),
|
||||
CODEC_MAP_ENTRY("RT1019P", "rt1019", RT1019P_ACPI_HID, CODEC_RT1019P),
|
||||
CODEC_MAP_ENTRY("RT1308", "rt1308", RT1308_ACPI_HID, CODEC_RT1308),
|
||||
};
|
||||
|
||||
enum snd_soc_acpi_intel_codec
|
||||
snd_soc_acpi_intel_detect_codec_type(struct device *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(codecs); i++) {
|
||||
if (!acpi_dev_present(codecs[i].acpi_hid, NULL, -1))
|
||||
continue;
|
||||
|
||||
dev_dbg(dev, "codec %s found\n", codecs[i].name);
|
||||
return codecs[i].codec_type;
|
||||
}
|
||||
|
||||
return CODEC_NONE;
|
||||
}
|
||||
EXPORT_SYMBOL_NS(snd_soc_acpi_intel_detect_codec_type, SND_SOC_ACPI_INTEL_MATCH);
|
||||
|
||||
enum snd_soc_acpi_intel_codec
|
||||
snd_soc_acpi_intel_detect_amp_type(struct device *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(amps); i++) {
|
||||
if (!acpi_dev_present(amps[i].acpi_hid, NULL, -1))
|
||||
continue;
|
||||
|
||||
dev_dbg(dev, "amp %s found\n", amps[i].name);
|
||||
return amps[i].codec_type;
|
||||
}
|
||||
|
||||
return CODEC_NONE;
|
||||
}
|
||||
EXPORT_SYMBOL_NS(snd_soc_acpi_intel_detect_amp_type, SND_SOC_ACPI_INTEL_MATCH);
|
||||
|
||||
const char *
|
||||
snd_soc_acpi_intel_get_codec_name(enum snd_soc_acpi_intel_codec codec_type)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(codecs); i++) {
|
||||
if (codecs[i].codec_type != codec_type)
|
||||
continue;
|
||||
|
||||
return codecs[i].name;
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(amps); i++) {
|
||||
if (amps[i].codec_type != codec_type)
|
||||
continue;
|
||||
|
||||
return amps[i].name;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_NS(snd_soc_acpi_intel_get_codec_name, SND_SOC_ACPI_INTEL_MATCH);
|
||||
|
||||
const char *
|
||||
snd_soc_acpi_intel_get_codec_tplg_suffix(enum snd_soc_acpi_intel_codec codec_type)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(codecs); i++) {
|
||||
if (codecs[i].codec_type != codec_type)
|
||||
continue;
|
||||
|
||||
return codecs[i].tplg_suffix;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_NS(snd_soc_acpi_intel_get_codec_tplg_suffix, SND_SOC_ACPI_INTEL_MATCH);
|
||||
|
||||
const char *
|
||||
snd_soc_acpi_intel_get_amp_tplg_suffix(enum snd_soc_acpi_intel_codec codec_type)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(amps); i++) {
|
||||
if (amps[i].codec_type != codec_type)
|
||||
continue;
|
||||
|
||||
return amps[i].tplg_suffix;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_NS(snd_soc_acpi_intel_get_amp_tplg_suffix, SND_SOC_ACPI_INTEL_MATCH);
|
||||
|
||||
MODULE_DESCRIPTION("ASoC Intel SOF Common Machine Driver Helpers");
|
||||
MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <sound/soc-acpi.h>
|
||||
#include <sound/soc-acpi-intel-match.h>
|
||||
#include <sound/soc-acpi-intel-ssp-common.h>
|
||||
#include "soc-acpi-intel-sdw-mockup-match.h"
|
||||
|
||||
static const struct snd_soc_acpi_codecs essx_83x6 = {
|
||||
|
@ -15,11 +16,6 @@ static const struct snd_soc_acpi_codecs essx_83x6 = {
|
|||
.codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs tgl_codecs = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"MX98357A"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_endpoint single_endpoint = {
|
||||
.num = 0,
|
||||
.aggregated = 0,
|
||||
|
@ -499,19 +495,9 @@ static const struct snd_soc_acpi_link_adr tgl_cs42l43_cs35l56[] = {
|
|||
{}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs tgl_max98373_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"MX98373"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs tgl_rt1011_amp = {
|
||||
.num_codecs = 1,
|
||||
.codecs = {"10EC1011"}
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs tgl_rt5682_rt5682s_hp = {
|
||||
.num_codecs = 2,
|
||||
.codecs = {"10EC5682", "RTL5682"},
|
||||
.codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID},
|
||||
};
|
||||
|
||||
static const struct snd_soc_acpi_codecs tgl_lt6911_hdmi = {
|
||||
|
@ -520,27 +506,6 @@ static const struct snd_soc_acpi_codecs tgl_lt6911_hdmi = {
|
|||
};
|
||||
|
||||
struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_machines[] = {
|
||||
{
|
||||
.comp_ids = &tgl_rt5682_rt5682s_hp,
|
||||
.drv_name = "tgl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &tgl_codecs,
|
||||
.sof_tplg_filename = "sof-tgl-max98357a-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &tgl_rt5682_rt5682s_hp,
|
||||
.drv_name = "tgl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &tgl_max98373_amp,
|
||||
.sof_tplg_filename = "sof-tgl-max98373-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &tgl_rt5682_rt5682s_hp,
|
||||
.drv_name = "tgl_rt5682_def",
|
||||
.machine_quirk = snd_soc_acpi_codec_list,
|
||||
.quirk_data = &tgl_rt1011_amp,
|
||||
.sof_tplg_filename = "sof-tgl-rt1011-rt5682.tplg",
|
||||
},
|
||||
{
|
||||
.comp_ids = &essx_83x6,
|
||||
.drv_name = "sof-essx8336",
|
||||
|
@ -549,6 +514,17 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_machines[] = {
|
|||
SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
|
||||
SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
|
||||
},
|
||||
/* place boards for each headphone codec: sof driver will complete the
|
||||
* tplg name and machine driver will detect the amp type
|
||||
*/
|
||||
{
|
||||
.comp_ids = &tgl_rt5682_rt5682s_hp,
|
||||
.drv_name = "tgl_rt5682_def",
|
||||
.sof_tplg_filename = "sof-tgl", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
|
||||
SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
|
||||
},
|
||||
/* place amp-only boards in the end of table */
|
||||
{
|
||||
.id = "10EC1308",
|
||||
.drv_name = "tgl_rt1308_hdmi_ssp",
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <linux/soundwire/sdw_intel.h>
|
||||
#include <sound/intel-dsp-config.h>
|
||||
#include <sound/intel-nhlt.h>
|
||||
#include <sound/soc-acpi-intel-ssp-common.h>
|
||||
#include <sound/sof.h>
|
||||
#include <sound/sof/xtensa.h>
|
||||
#include <sound/hda-mlink.h>
|
||||
|
@ -1676,13 +1677,36 @@ void hda_set_mach_params(struct snd_soc_acpi_mach *mach,
|
|||
mach_params->dai_drivers = desc->ops->drv;
|
||||
}
|
||||
|
||||
static int check_tplg_quirk_mask(struct snd_soc_acpi_mach *mach)
|
||||
{
|
||||
u32 dmic_ssp_quirk;
|
||||
u32 codec_amp_name_quirk;
|
||||
|
||||
/*
|
||||
* In current implementation dmic and ssp quirks are designed for es8336
|
||||
* machine driver and could not be mixed with codec name and amp name
|
||||
* quirks.
|
||||
*/
|
||||
dmic_ssp_quirk = mach->tplg_quirk_mask &
|
||||
(SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER | SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER);
|
||||
codec_amp_name_quirk = mach->tplg_quirk_mask &
|
||||
(SND_SOC_ACPI_TPLG_INTEL_AMP_NAME | SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME);
|
||||
|
||||
if (dmic_ssp_quirk && codec_amp_name_quirk)
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev)
|
||||
{
|
||||
u32 interface_mask = hda_get_interface_mask(sdev);
|
||||
struct snd_sof_pdata *sof_pdata = sdev->pdata;
|
||||
const struct sof_dev_desc *desc = sof_pdata->desc;
|
||||
struct snd_soc_acpi_mach *mach = NULL;
|
||||
enum snd_soc_acpi_intel_codec codec_type;
|
||||
const char *tplg_filename;
|
||||
const char *tplg_suffix;
|
||||
|
||||
/* Try I2S or DMIC if it is supported */
|
||||
if (interface_mask & (BIT(SOF_DAI_INTEL_SSP) | BIT(SOF_DAI_INTEL_DMIC)))
|
||||
|
@ -1701,6 +1725,17 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev)
|
|||
tplg_fixup = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checking quirk mask integrity; some quirk flags could not be
|
||||
* set concurrently.
|
||||
*/
|
||||
if (tplg_fixup &&
|
||||
check_tplg_quirk_mask(mach)) {
|
||||
dev_err(sdev->dev, "Invalid tplg quirk mask 0x%x\n",
|
||||
mach->tplg_quirk_mask);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* report to machine driver if any DMICs are found */
|
||||
mach->mach_params.dmic_num = check_dmic_num(sdev);
|
||||
|
||||
|
@ -1775,6 +1810,52 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev)
|
|||
}
|
||||
}
|
||||
|
||||
codec_type = snd_soc_acpi_intel_detect_amp_type(sdev->dev);
|
||||
|
||||
if (tplg_fixup &&
|
||||
mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_AMP_NAME &&
|
||||
codec_type != CODEC_NONE) {
|
||||
tplg_suffix = snd_soc_acpi_intel_get_amp_tplg_suffix(codec_type);
|
||||
if (!tplg_suffix) {
|
||||
dev_err(sdev->dev, "no tplg suffix found, amp %d\n",
|
||||
codec_type);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL,
|
||||
"%s-%s",
|
||||
sof_pdata->tplg_filename,
|
||||
tplg_suffix);
|
||||
if (!tplg_filename)
|
||||
return NULL;
|
||||
|
||||
sof_pdata->tplg_filename = tplg_filename;
|
||||
add_extension = true;
|
||||
}
|
||||
|
||||
codec_type = snd_soc_acpi_intel_detect_codec_type(sdev->dev);
|
||||
|
||||
if (tplg_fixup &&
|
||||
mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME &&
|
||||
codec_type != CODEC_NONE) {
|
||||
tplg_suffix = snd_soc_acpi_intel_get_codec_tplg_suffix(codec_type);
|
||||
if (!tplg_suffix) {
|
||||
dev_err(sdev->dev, "no tplg suffix found, codec %d\n",
|
||||
codec_type);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL,
|
||||
"%s-%s",
|
||||
sof_pdata->tplg_filename,
|
||||
tplg_suffix);
|
||||
if (!tplg_filename)
|
||||
return NULL;
|
||||
|
||||
sof_pdata->tplg_filename = tplg_filename;
|
||||
add_extension = true;
|
||||
}
|
||||
|
||||
if (tplg_fixup && add_extension) {
|
||||
tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL,
|
||||
"%s%s",
|
||||
|
@ -1842,3 +1923,4 @@ MODULE_IMPORT_NS(SND_INTEL_SOUNDWIRE_ACPI);
|
|||
MODULE_IMPORT_NS(SOUNDWIRE_INTEL_INIT);
|
||||
MODULE_IMPORT_NS(SOUNDWIRE_INTEL);
|
||||
MODULE_IMPORT_NS(SND_SOC_SOF_HDA_MLINK);
|
||||
MODULE_IMPORT_NS(SND_SOC_ACPI_INTEL_MATCH);
|
||||
|
|
Loading…
Reference in a new issue