Skip to content

Commit a18eac7

Browse files
committed
ALSA: hda: add AW88399 side codec support
Link: https://github.com/nadimkobeissi/16iax10h-linux-sound-saga Signed-off-by: Eric Naim <dnaim@cachyos.org>
1 parent b3bbc40 commit a18eac7

12 files changed

Lines changed: 835 additions & 16 deletions

File tree

drivers/acpi/scan.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,6 +1750,7 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
17501750
* by the drivers/platform/x86/serial-multi-instantiate.c driver, which
17511751
* knows which client device id to use for each resource.
17521752
*/
1753+
{"AWDZ8399", },
17531754
{"BSG1160", },
17541755
{"BSG2150", },
17551756
{"CSC3551", },

drivers/platform/x86/serial-multi-instantiate.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,11 +411,21 @@ static const struct smi_node max98390_hda = {
411411
.bus_type = SMI_I2C,
412412
};
413413

414+
static const struct smi_node aw88399_hda = {
415+
.instances = {
416+
{ "aw88399-hda", IRQ_RESOURCE_AUTO, 0 },
417+
{ "aw88399-hda", IRQ_RESOURCE_AUTO, 0 },
418+
{}
419+
},
420+
.bus_type = SMI_AUTO_DETECT,
421+
};
422+
414423
/*
415424
* Note new device-ids must also be added to ignore_serial_bus_ids in
416425
* drivers/acpi/scan.c: acpi_device_enumeration_by_parent().
417426
*/
418427
static const struct acpi_device_id smi_acpi_ids[] = {
428+
{ "AWDZ8399", (unsigned long)&aw88399_hda },
419429
{ "BSG1160", (unsigned long)&bsg1160_data },
420430
{ "BSG2150", (unsigned long)&bsg2150_data },
421431
{ "CSC3551", (unsigned long)&cs35l41_hda },

sound/hda/codecs/realtek/alc269.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3254,6 +3254,34 @@ static void find_cirrus_companion_amps(struct hda_codec *cdc)
32543254
comp_generic_fixup(cdc, HDA_FIXUP_ACT_PRE_PROBE, bus, acpi_ids[i].hid, match, count);
32553255
}
32563256

3257+
static void aw88399_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
3258+
{
3259+
comp_generic_fixup(cdc, action, "i2c", "AWDZ8399", "-%s:00-aw88399-hda.%d", 2);
3260+
}
3261+
3262+
static void alc287_fixup_legion_16iax10h_aw88399(struct hda_codec *codec,
3263+
const struct hda_fixup *fix, int action)
3264+
{
3265+
static const struct hda_pintbl pincfgs[] = {
3266+
{ 0x1d, 0x411111f0 }, /* unused bogus pin */
3267+
{ }
3268+
};
3269+
3270+
/*
3271+
* Force DAC 0x02 for the bass speaker 0x17, as the default 0x06 lacks volume controls.
3272+
*/
3273+
static const hda_nid_t conn[] = { 0x02 };
3274+
3275+
alc269_fixup_limit_int_mic_boost(codec, fix, action);
3276+
3277+
switch (action) {
3278+
case HDA_FIXUP_ACT_PRE_PROBE:
3279+
snd_hda_apply_pincfgs(codec, pincfgs);
3280+
snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
3281+
break;
3282+
}
3283+
}
3284+
32573285
static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
32583286
{
32593287
comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
@@ -4130,6 +4158,8 @@ enum {
41304158
ALC245_FIXUP_ACER_MICMUTE_LED,
41314159
ALC245_FIXUP_CS35L41_I2C_2_MUTE_LED,
41324160
ALC236_FIXUP_HP_DMIC,
4161+
ALC287_FIXUP_AW88399_I2C_2,
4162+
ALC287_FIXUP_LENOVO_LEGION_AW88399,
41334163
};
41344164

41354165
/* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -6676,6 +6706,16 @@ static const struct hda_fixup alc269_fixups[] = {
66766706
{ 0x12, 0x90a60160 }, /* use as internal mic */
66776707
{ }
66786708
},
6709+
},
6710+
[ALC287_FIXUP_AW88399_I2C_2] = {
6711+
.type = HDA_FIXUP_FUNC,
6712+
.v.func = aw88399_fixup_i2c_two,
6713+
},
6714+
[ALC287_FIXUP_LENOVO_LEGION_AW88399] = {
6715+
.type = HDA_FIXUP_FUNC,
6716+
.v.func = alc287_fixup_legion_16iax10h_aw88399,
6717+
.chained = true,
6718+
.chain_id = ALC287_FIXUP_AW88399_I2C_2,
66796719
}
66806720
};
66816721

@@ -7694,6 +7734,11 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
76947734
SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
76957735
SND_PCI_QUIRK(0x17aa, 0x38fd, "ThinkBook plus Gen5 Hybrid", ALC287_FIXUP_TAS2781_I2C),
76967736
SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
7737+
SND_PCI_QUIRK(0x17aa, 0x3906, "Lenovo Legion Pro 7i 16IAX10H", ALC287_FIXUP_LENOVO_LEGION_AW88399),
7738+
SND_PCI_QUIRK(0x17aa, 0x3907, "Lenovo Legion Pro 7i 16IAX10H / Y9000P IAX10", ALC287_FIXUP_LENOVO_LEGION_AW88399),
7739+
SND_PCI_QUIRK(0x17aa, 0x3d6c, "Lenovo Legion Pro 7i 16IAX10H", ALC287_FIXUP_LENOVO_LEGION_AW88399),
7740+
SND_PCI_QUIRK(0x17aa, 0x3938, "Lenovo Legion Pro 7 16AFR10H", ALC287_FIXUP_LENOVO_LEGION_AW88399),
7741+
SND_PCI_QUIRK(0x17aa, 0x3939, "Lenovo Legion Pro 7 16AFR10H", ALC287_FIXUP_LENOVO_LEGION_AW88399),
76977742
SND_PCI_QUIRK(0x17aa, 0x390d, "Lenovo Yoga Pro 7 14ASP10", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
76987743
SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
76997744
SND_PCI_QUIRK(0x17aa, 0x391a, "Lenovo Yoga Slim 7 14AKP10", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),

sound/hda/codecs/side-codecs/Kconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,24 @@ config SND_HDA_SCODEC_MAX98390_I2C
160160

161161
comment "Set to Y if you want auto-loading the side codec driver"
162162
depends on SND_HDA=y && SND_HDA_SCODEC_MAX98390_I2C=m
163+
164+
config SND_HDA_SCODEC_AW88399
165+
tristate
166+
select SND_HDA_GENERIC
167+
168+
config SND_HDA_SCODEC_AW88399_I2C
169+
tristate "Build AW88399 HD-audio side codec support for I2C Bus"
170+
depends on I2C
171+
depends on ACPI
172+
depends on SND_SOC
173+
select SND_HDA_SCODEC_AW88399
174+
select SND_SOC_AW88399
175+
help
176+
Say Y or M here to include AW88399 I2C HD-audio side codec support
177+
in snd-hda-intel driver, such as ALC287.
178+
179+
This is for systems where the AW88399 smart amplifier is connected
180+
as a side codec to the HDA controller, rather than via SOF/SSP.
181+
182+
comment "Set to Y if you want auto-loading the side codec driver"
183+
depends on SND_HDA=y && SND_HDA_SCODEC_AW88399_I2C=m

sound/hda/codecs/side-codecs/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ snd-hda-scodec-tas2781-i2c-y := tas2781_hda_i2c.o
1515
snd-hda-scodec-tas2781-spi-y := tas2781_hda_spi.o
1616
snd-hda-scodec-max98390-y := max98390_hda.o max98390_hda_filters.o
1717
snd-hda-scodec-max98390-i2c-y := max98390_hda_i2c.o
18+
snd-hda-scodec-aw88399-y := aw88399_hda.o aw88399_hda_property.o
19+
snd-hda-scodec-aw88399-i2c-y := aw88399_hda_i2c.o
1820

1921
obj-$(CONFIG_SND_HDA_CIRRUS_SCODEC) += snd-hda-cirrus-scodec.o
2022
obj-$(CONFIG_SND_HDA_CIRRUS_SCODEC_KUNIT_TEST) += snd-hda-cirrus-scodec-test.o
@@ -30,3 +32,5 @@ obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_I2C) += snd-hda-scodec-tas2781-i2c.o
3032
obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_SPI) += snd-hda-scodec-tas2781-spi.o
3133
obj-$(CONFIG_SND_HDA_SCODEC_MAX98390) += snd-hda-scodec-max98390.o
3234
obj-$(CONFIG_SND_HDA_SCODEC_MAX98390_I2C) += snd-hda-scodec-max98390-i2c.o
35+
obj-$(CONFIG_SND_HDA_SCODEC_AW88399) += snd-hda-scodec-aw88399.o
36+
obj-$(CONFIG_SND_HDA_SCODEC_AW88399_I2C) += snd-hda-scodec-aw88399-i2c.o

0 commit comments

Comments
 (0)