Commit bb5f86ea authored by Baojun Xu's avatar Baojun Xu Committed by Takashi Iwai
Browse files

ALSA: hda/tas2781: Add tas2781 hda SPI driver



This patch was used to add TAS2781 devices on SPI support in sound/pci/hda.
It use ACPI node descript about parameters of TAS2781 on SPI, it like:
    Scope (_SB.PC00.SPI0)
    {
        Device (GSPK)
        {
            Name (_HID, "TXNW2781")  // _HID: Hardware ID
            Method (_CRS, 0, NotSerialized)
            {
                Name (RBUF, ResourceTemplate ()
                {
                    SpiSerialBusV2 (...)
                    SpiSerialBusV2 (...)
                }
            }
        }
    }

And in platform/x86/serial-multi-instantiate.c, those spi devices will be
added into system as a single SPI device, so TAS2781 SPI driver will
probe twice for every single SPI device. And driver will also parser
mono DSP firmware binary and RCA binary for itself.
The code support Realtek as the primary codec.
In patch version-10, add multi devices firmware binary support,
to compatble with windows driver, they can share same firmware binary.

Signed-off-by: default avatarBaojun Xu <baojun.xu@ti.com>
Link: https://patch.msgid.link/20241216122008.15425-1-baojun.xu@ti.com


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d466887a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1769,6 +1769,7 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
		{"CSC3557", },
		{"INT33FE", },
		{"INT3515", },
		{"TXNW2781", },
		/* Non-conforming _HID for Cirrus Logic already released */
		{"CLSA0100", },
		{"CLSA0101", },
+12 −0
Original line number Diff line number Diff line
@@ -384,6 +384,17 @@ static const struct smi_node cs35l57_hda = {
	.bus_type = SMI_AUTO_DETECT,
};

static const struct smi_node tas2781_hda = {
	.instances = {
		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
		{}
	},
	.bus_type = SMI_AUTO_DETECT,
};

/*
 * Note new device-ids must also be added to ignore_serial_bus_ids in
 * drivers/acpi/scan.c: acpi_device_enumeration_by_parent().
@@ -396,6 +407,7 @@ static const struct acpi_device_id smi_acpi_ids[] = {
	{ "CSC3556", (unsigned long)&cs35l56_hda },
	{ "CSC3557", (unsigned long)&cs35l57_hda },
	{ "INT3515", (unsigned long)&int3515_data },
	{ "TXNW2781", (unsigned long)&tas2781_hda },
	/* Non-conforming _HID for Cirrus Logic already released */
	{ "CLSA0100", (unsigned long)&cs35l41_hda },
	{ "CLSA0101", (unsigned long)&cs35l41_hda },
+14 −0
Original line number Diff line number Diff line
@@ -206,6 +206,20 @@ config SND_HDA_SCODEC_TAS2781_I2C
comment "Set to Y if you want auto-loading the side codec driver"
	depends on SND_HDA=y && SND_HDA_SCODEC_TAS2781_I2C=m

config SND_HDA_SCODEC_TAS2781_SPI
	tristate "Build TAS2781 HD-audio side codec support for SPI Bus"
	depends on SPI_MASTER
	depends on ACPI
	depends on EFI
	depends on SND_SOC
	select CRC32_SARWATE
	help
	  Say Y or M here to include TAS2781 SPI HD-audio side codec support
	  in snd-hda-intel driver, such as ALC287.

comment "Set to Y if you want auto-loading the side codec driver"
	depends on SND_HDA=y && SND_HDA_SCODEC_TAS2781_SPI=m

config SND_HDA_CODEC_REALTEK
	tristate "Build Realtek HD-audio codec support"
	select SND_HDA_GENERIC
+2 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ snd-hda-scodec-cs35l56-spi-y := cs35l56_hda_spi.o
snd-hda-cs-dsp-ctls-y :=	hda_cs_dsp_ctl.o
snd-hda-scodec-component-y :=	hda_component.o
snd-hda-scodec-tas2781-i2c-y :=	tas2781_hda_i2c.o
snd-hda-scodec-tas2781-spi-y :=	tas2781_hda_spi.o tas2781_spi_fwlib.o

# common driver
obj-$(CONFIG_SND_HDA) := snd-hda-codec.o
@@ -72,6 +73,7 @@ obj-$(CONFIG_SND_HDA_SCODEC_CS35L56_SPI) += snd-hda-scodec-cs35l56-spi.o
obj-$(CONFIG_SND_HDA_CS_DSP_CONTROLS) += snd-hda-cs-dsp-ctls.o
obj-$(CONFIG_SND_HDA_SCODEC_COMPONENT) += snd-hda-scodec-component.o
obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_I2C) += snd-hda-scodec-tas2781-i2c.o
obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_SPI) += snd-hda-scodec-tas2781-spi.o

# this must be the last entry after codec drivers;
# otherwise the codec patches won't be hooked before the PCI probe
+14 −0
Original line number Diff line number Diff line
@@ -7135,6 +7135,11 @@ static void tas2781_fixup_i2c(struct hda_codec *cdc,
	comp_generic_fixup(cdc, action, "i2c", "TIAS2781", "-%s:00", 1);
}

static void tas2781_fixup_spi(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
{
	comp_generic_fixup(cdc, action, "spi", "TXNW2781", "-%s:00-tas2781-hda.%d", 2);
}

static void yoga7_14arb7_fixup_i2c(struct hda_codec *cdc,
	const struct hda_fixup *fix, int action)
{
@@ -7770,6 +7775,7 @@ enum {
	ALC236_FIXUP_DELL_DUAL_CODECS,
	ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
	ALC287_FIXUP_TAS2781_I2C,
	ALC245_FIXUP_TAS2781_SPI_2,
	ALC287_FIXUP_YOGA7_14ARB7_I2C,
	ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
	ALC245_FIXUP_HP_X360_MUTE_LEDS,
@@ -10000,6 +10006,12 @@ static const struct hda_fixup alc269_fixups[] = {
		.chained = true,
		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
	},
	[ALC245_FIXUP_TAS2781_SPI_2] = {
		.type = HDA_FIXUP_FUNC,
		.v.func = tas2781_fixup_spi,
		.chained = true,
		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
	},
	[ALC287_FIXUP_YOGA7_14ARB7_I2C] = {
		.type = HDA_FIXUP_FUNC,
		.v.func = yoga7_14arb7_fixup_i2c,
@@ -10562,6 +10574,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
	SND_PCI_QUIRK(0x103c, 0x8d84, "HP EliteBook X G1i", ALC285_FIXUP_HP_GPIO_LED),
	SND_PCI_QUIRK(0x103c, 0x8d91, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
	SND_PCI_QUIRK(0x103c, 0x8d92, "HP ZBook Firefly 16 G12", ALC285_FIXUP_HP_GPIO_LED),
	SND_PCI_QUIRK(0x103c, 0x8de8, "HP Gemtree", ALC245_FIXUP_TAS2781_SPI_2),
	SND_PCI_QUIRK(0x103c, 0x8de9, "HP Gemtree", ALC245_FIXUP_TAS2781_SPI_2),
	SND_PCI_QUIRK(0x103c, 0x8e18, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
	SND_PCI_QUIRK(0x103c, 0x8e19, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
	SND_PCI_QUIRK(0x103c, 0x8e1a, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
Loading