ASoC: SOF: Intel: add support for SoundWire-based HP Omen16

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

This device exposes a headset codec on link0 and an amplifier on
link3. This is a very unusual pin-muxing, usually the microphones are
pin-muxed with link2/link3. This resulted in a problematic error
handling leading to a kernel oops, and invalidated a hard-coded
assumption.

Full support for this device requires a DMI quirk shared separately
("soundwire: dmi-quirks: add remapping for HP Omen 16-k0005TX").
This commit is contained in:
Mark Brown 2022-07-15 20:07:01 +01:00
commit c3fc63479e
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
5 changed files with 48 additions and 4 deletions

View file

@ -315,6 +315,15 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
RT711_JD2 |
SOF_SDW_FOUR_SPK),
},
{
.callback = sof_sdw_quirk_cb,
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
DMI_MATCH(DMI_PRODUCT_NAME, "OMEN by HP Gaming Laptop 16-k0xxx"),
},
.driver_data = (void *)(SOF_SDW_TGL_HDMI |
RT711_JD2),
},
/* MeteorLake devices */
{
.callback = sof_sdw_quirk_cb,

View file

@ -139,6 +139,9 @@ int sof_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_l
{
struct mc_private *ctx = snd_soc_card_get_drvdata(card);
if (!ctx->headset_codec_dev)
return 0;
device_remove_software_node(ctx->headset_codec_dev);
put_device(ctx->headset_codec_dev);

View file

@ -140,6 +140,9 @@ int sof_sdw_rt711_sdca_exit(struct snd_soc_card *card, struct snd_soc_dai_link *
{
struct mc_private *ctx = snd_soc_card_get_drvdata(card);
if (!ctx->headset_codec_dev)
return 0;
device_remove_software_node(ctx->headset_codec_dev);
put_device(ctx->headset_codec_dev);

View file

@ -137,6 +137,15 @@ static const struct snd_soc_acpi_adr_device rt1316_2_single_adr[] = {
}
};
static const struct snd_soc_acpi_adr_device rt1316_3_single_adr[] = {
{
.adr = 0x000330025D131601ull,
.num_endpoints = 1,
.endpoints = &single_endpoint,
.name_prefix = "rt1316-1"
}
};
static const struct snd_soc_acpi_adr_device rt714_0_adr[] = {
{
.adr = 0x000030025D071401ull,
@ -326,6 +335,20 @@ static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link2_rt714_link0[] = {
{}
};
static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link0_rt1316_link3[] = {
{
.mask = BIT(0),
.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
.adr_d = rt711_sdca_0_adr,
},
{
.mask = BIT(3),
.num_adr = ARRAY_SIZE(rt1316_3_single_adr),
.adr_d = rt1316_3_single_adr,
},
{}
};
static const struct snd_soc_acpi_adr_device mx8373_2_adr[] = {
{
.adr = 0x000223019F837300ull,
@ -546,6 +569,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = {
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l0.tplg",
},
{
.link_mask = 0x9, /* 2 active links required */
.links = adl_sdw_rt711_link0_rt1316_link3,
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l3.tplg",
},
{
.link_mask = 0x1, /* link0 required */
.links = adl_rvp,

View file

@ -1406,12 +1406,12 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev
/*
* DMICs use up to 4 pins and are typically pin-muxed with SoundWire
* link 2 and 3, thus we only try to enable dmics if all conditions
* are true:
* a) link 2 and 3 are not used by SoundWire
* link 2 and 3, or link 1 and 2, thus we only try to enable dmics
* if all conditions are true:
* a) 2 or fewer links are used by SoundWire
* b) the NHLT table reports the presence of microphones
*/
if (!(mach->link_mask & GENMASK(3, 2))) {
if (hweight_long(mach->link_mask) <= 2) {
const char *tplg_filename = mach->sof_tplg_filename;
int ret;