Commit Graph

15 Commits

Author SHA1 Message Date
Jaroslav Kysela c6b492c5c2 ALSA: hda/tas2781: Add tas2781 hda SPI driver
JIRA: https://issues.redhat.com/browse/RHEL-76110

Conflicts: Add int return value for tas2781_hda_spi_remove() (old declarations),
           fix include - {linux -> asm}/unaligned.h

commit bb5f86ea50ffb292f42eb1ebdb99991d5c5ac3ba
Author: Baojun Xu <baojun.xu@ti.com>
Date: Mon Dec 16 20:20:08 2024 +0800

    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: Baojun Xu <baojun.xu@ti.com>
    Link: https://patch.msgid.link/20241216122008.15425-1-baojun.xu@ti.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
2025-01-27 19:47:20 +01:00
Jaroslav Kysela 71699e1cb9 platform/x86: serial-multi-instantiate: Add support for CS35L54 and CS35L57
JIRA: https://issues.redhat.com/browse/RHEL-27515

commit 6fa9ba2d6278da69ef11c3c8e1ac6163437d1fca
Author: Simon Trimmer <simont@opensource.cirrus.com>
Date: Fri Mar 8 13:59:00 2024 +0000

    platform/x86: serial-multi-instantiate: Add support for CS35L54 and CS35L57

    Add the ACPI HIDs and smi_node descriptions for the CS35L54 and CS35L57
    Boosted Smart Amplifiers.

    Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
    Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
    Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Message-ID: <20240308135900.603192-4-rf@opensource.cirrus.com>

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
2024-07-08 20:55:02 +02:00
Mark Langsdorf 9a17ae622f ACPI: scan: Create platform device for CS35L56
JIRA: https://issues.redhat.com/browse/RHEL-26871

commit 1cd0302be5645420f73090aee26fa787287e1096
Author: Simon Trimmer <simont@opensource.cirrus.com>
Date: Mon, 31 Jul 2023 16:03:39 +0000

The ACPI device CSC3556 is a Cirrus Logic CS35L56 mono amplifier which
is used in multiples, and can be connected either to I2C or SPI.

There will be multiple instances under the same Device() node. Add it
to ignore_serial_bus_ids and handle it in the serial-multi-instantiate
driver.

There can be a 5th I2cSerialBusV2, but this is an alias address and doesn't
represent a real device. Ignore this by having a dummy 5th entry in the
serial-multi-instantiate instance list with the name of a non-existent
driver, on the same pattern as done for bsg2150.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/20230728111345.7224-1-rf@opensource.cirrus.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
2024-03-27 13:28:58 -04:00
Mark Langsdorf b2a7a66100 platform/x86: serial-multi-instantiate: Auto detect IRQ resource for CSC3551
JIRA: https://issues.redhat.com/browse/RHEL-26871

commit 676b7c5ecab36274442887ceadd6dee8248a244f
Author: David Xu <xuwd1@hotmail.com>
Date:   Thu Jul 13 21:35:28 2023 +0800

The current code assumes that the CSC3551(multiple cs35l41) always have
its interrupt pin connected to GPIO thus the IRQ can be acquired with
acpi_dev_gpio_irq_get. However on some newer laptop models this is no
longer the case as they have the CSC3551's interrupt pin connected to
APIC. This causes smi_i2c_probe to fail on these machines.

To support these machines, a new macro IRQ_RESOURCE_AUTO was introduced
for cs35l41 smi_node, and smi_get_irq function was modified so it tries
to get GPIO irq resource first and if failed, tries to get
APIC irq resource for cs35l41.

This patch affects only the cs35l41's probing and brings no negative
influence on machines that indeed have the cs35l41's interrupt pin
connected to GPIO.

Signed-off-by: David Xu <xuwd1@hotmail.com>
Link: https://lore.kernel.org/r/SY4P282MB18350CD8288687B87FFD2243E037A@SY4P282MB1835.AUSP282.PROD.OUTLOOK.COM
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
2024-03-27 13:28:58 -04:00
Jaroslav Kysela f85a88def1 platform/x86: serial-multi-instantiate: Add CLSA0101 Laptop
The device CLSA0101 has two instances of CS35L41
connected by I2C.

    Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
    Link: https://lore.kernel.org/r/20220727095924.80884-5-tanureal@opensource.cirrus.com
    Link: https://lore.kernel.org/r/20220816194639.13870-1-cam@neo-zeon.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>

Author: Lucas Tanure <tanureal@opensource.cirrus.com>
Date: Wed Jul 27 10:59:24 2022 +0100

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
(cherry picked from commit 88392a0dd0ab263edb4ca416ebdecabd8289158a)
Bugzilla: https://bugzilla.redhat.com/2123651
2022-09-02 12:29:52 +02:00
Jaroslav Kysela 30750b1b2e platform/x86: serial-multi-instantiate: Sort ACPI IDs by HID
It's easier to maintain the sorted table.
Keep the sorting order in sync with one in drivers/acpi/scan.c.

    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20220709211653.18938-6-andriy.shevchenko@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Sun Jul 10 00:16:53 2022 +0300

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
(cherry picked from commit e286044bf5b089801c20688c45b66fd6b6a712fa)
Bugzilla: https://bugzilla.redhat.com/2123651
2022-09-02 12:29:52 +02:00
Jaroslav Kysela ee96dcf5ae platform/x86: serial-multi-instantiate: Get rid of redundant 'else'
In the snippets like the following

	if (...)
		return / goto / break / continue ...;
	else
		...

the 'else' is redundant. Get rid of it.

    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20220709211653.18938-5-andriy.shevchenko@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Sun Jul 10 00:16:52 2022 +0300

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
(cherry picked from commit f3e13bbc6f5a84f9c15883a97649023522eec481)
Bugzilla: https://bugzilla.redhat.com/2123651
2022-09-02 12:29:52 +02:00
Jaroslav Kysela 1212aed338 platform/x86: serial-multi-instantiate: Use while (i--) pattern to clean up
Use more natural while (i--) patter to clean up allocated resources.

    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20220709211653.18938-4-andriy.shevchenko@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Sun Jul 10 00:16:51 2022 +0300

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
(cherry picked from commit ed7adc2b69c6492ebb2733d8914c6d765ec9770b)
Bugzilla: https://bugzilla.redhat.com/2123651
2022-09-02 12:29:52 +02:00
Jaroslav Kysela 64f379068f platform/x86: serial-multi-instantiate: Improve dev_err_probe() messaging
Drop duplicate print of returned value in the messages and use pattern
return dev_err_probe(...) where it's possible.

    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20220709211653.18938-3-andriy.shevchenko@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Sun Jul 10 00:16:50 2022 +0300

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
(cherry picked from commit 14a9aa99aca6c28728de357b7be3c9ef4f2a5bb6)
Bugzilla: https://bugzilla.redhat.com/2123651
2022-09-02 12:29:52 +02:00
Jaroslav Kysela 60343906ad platform/x86: serial-multi-instantiate: Drop duplicate check
The device_get_match_data() checks for firmware node to be present,
there is no need to check for ACPI companion.

    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://lore.kernel.org/r/20220709211653.18938-2-andriy.shevchenko@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Sun Jul 10 00:16:49 2022 +0300

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
(cherry picked from commit 8b50c48d59a9cd007cf0b09e479e4221b2b349ae)
Bugzilla: https://bugzilla.redhat.com/2123651
2022-09-02 12:29:51 +02:00
Jaroslav Kysela 3790ae61b7 platform/x86: serial-multi-instantiate: Improve autodetection
Instead of calling specific resource counter, let just probe each
of the type and see what it says. Return -ENOENT if no resources
found.

    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://lore.kernel.org/r/20220709211653.18938-1-andriy.shevchenko@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Sun Jul 10 00:16:48 2022 +0300

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
(cherry picked from commit 2b5b27826a48eea579bf103161c76d3b435764a8)
Bugzilla: https://bugzilla.redhat.com/2123651
2022-09-02 12:29:51 +02:00
Jaroslav Kysela 001be8e7f0 ACPI / scan: Create platform device for CS35L41
The ACPI device with CSC3551 or CLSA0100 are sound cards
with multiple instances of CS35L41 connected by I2C or SPI
to the main CPU.

We add an ID to the ignore_serial_bus_ids list to enumerate
all I2C or SPI devices correctly.

The same IDs are also added into serial-multi-instantiate
so that the driver can correctly enumerate the ACPI.

    Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
    Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
    Link: https://lore.kernel.org/r/20220121172431.6876-10-sbinding@opensource.cirrus.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Author: Lucas Tanure <tanureal@opensource.cirrus.com>
Date: Fri Jan 21 17:24:31 2022 +0000

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
(cherry picked from commit d9c01c530cc5e3b6d5bdfeae12c3d0f33fae7498)
Bugzilla: https://bugzilla.redhat.com/2123651
2022-09-02 12:29:51 +02:00
Jaroslav Kysela 021f831a38 platform/x86: serial-multi-instantiate: Add SPI support
Add support for spi bus in serial-multi-instantiate driver

Some peripherals can have either a I2C or a SPI connection
to the host (but not both) but use the same HID for both
types. So it is not possible to use the HID to determine
whether it is I2C or SPI. The driver must check the node
to see if it contains I2cSerialBus or SpiSerialBus entries.

For backwards-compatibility with the existing nodes I2C is
checked first and if such entries are found ONLY I2C devices
are created. Since some existing nodes that were already
handled by this driver could also contain unrelated
SpiSerialBus nodes that were previously ignored, and this
preserves that behavior. If there is ever a need to handle
a node where both I2C and SPI devices must be instantiated
this can be added in future.

    Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
    Link: https://lore.kernel.org/r/20220121172431.6876-8-sbinding@opensource.cirrus.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Author: Stefan Binding <sbinding@opensource.cirrus.com>
Date: Fri Jan 21 17:24:29 2022 +0000

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
(cherry picked from commit 68f201f9061c000d7a4a9f359f021b1cd535d62b)
Bugzilla: https://bugzilla.redhat.com/2123651
2022-09-02 12:29:51 +02:00
Jaroslav Kysela 2cf7306e1b platform/x86: serial-multi-instantiate: Reorganize I2C functions
Reorganize I2C functions to accommodate SPI support
Split the probe and factor out parts of the code
that will be used in the SPI support
Also switched from strlcpy() to strscpy()

    Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
    Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
    Link: https://lore.kernel.org/r/20220121172431.6876-7-sbinding@opensource.cirrus.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Author: Lucas Tanure <tanureal@opensource.cirrus.com>
Date: Fri Jan 21 17:24:28 2022 +0000

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
(cherry picked from commit 35a36cbb7b1ce7596fc03962f7ce261b2e908d1f)
Bugzilla: https://bugzilla.redhat.com/2123651
2022-09-02 12:29:51 +02:00
Jaroslav Kysela bb91acc180 platform/x86: i2c-multi-instantiate: Rename it for a generic serial driver name
Rename I2C multi instantiate driver to serial-multi-instantiate for
upcoming addition of SPI support

    Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
    Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
    Link: https://lore.kernel.org/r/20220121172431.6876-6-sbinding@opensource.cirrus.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Author: Lucas Tanure <tanureal@opensource.cirrus.com>
Date: Fri Jan 21 17:24:27 2022 +0000

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
(cherry picked from commit 5e63b2ea3dfbab9307e197004a3c5ee4e1442582)
Bugzilla: https://bugzilla.redhat.com/2123651
2022-09-02 12:29:51 +02:00