[PATCH v2 0/3] Fix CS35L56 amplifier on Intel LPSS SPI with broken ACPI cs-gpios

Khalil posted 3 patches 2 months ago
There is a newer version of this series
drivers/spi/spi.c                                |   3 +-
drivers/platform/x86/serial-multi-instantiate.c  | 156 +++++++++++++++-
drivers/spi/spi-pxa2xx.c                         |  78 ++++-----
3 files changed, 196 insertions(+), 41 deletions(-)
[PATCH v2 0/3] Fix CS35L56 amplifier on Intel LPSS SPI with broken ACPI cs-gpios
Posted by Khalil 2 months ago
To: broonie@kernel.org, hdegoede@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: rf@opensource.cirrus.com, linux-spi@vger.kernel.org,
    platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20260215135524.1171065-2-khalil@rentman.nl>

Hi,

This is v2 of the patch series fixing dual CS35L56 amplifiers on HP
laptops with Intel Lunar Lake and broken ACPI cs-gpios.

Changes since RFC v1 (addressing feedback from Richard Fitzgerald):

- Added DMI quirk table: GPIO CS fixup is now only applied on known
  affected platforms (HP EliteBook 8 G1i, board 8D8A), not generically
  for all devices with CS > 0.

- Fixed chip select range check: only chip selects outside the
  controller's num_chipselect range are fixed up. A NULL cs_gpiods[cs]
  within range means "native chip select", not broken. This avoids
  incorrectly replacing native CS0 with the GPIO descriptor.

- Removed ASUS reference (GU605C was fixed by BIOS update).

- Added Patch 1/3 (spi core): __spi_add_device() now preserves preset
  cs_gpiod on the device instead of unconditionally overwriting from
  ctlr->cs_gpiods. This was suggested by Richard as the preferred
  approach to avoid modifying controller state post-probe.

- Patch 2/3 (serial-multi-instantiate): Extracted GPIO fixup into a
  dedicated helper function. Currently still installs the GPIO on the
  controller's cs_gpiods array because __spi_add_device() overwrites
  device-level cs_gpiod. With Patch 1/3 applied, a future cleanup
  could set the GPIO directly on the device instead.

- Patch 3/3 (spi-pxa2xx): Unchanged from v1. Handles clock gating
  on Intel LPSS controllers when GPIO chip select is active.

Note: While Richard also suggested the cs35l41_hda self-fixup approach
(setting cs_gpiod on the device post-probe via spi_setup), this doesn't
work here because the device can't even be added to the bus - SPI core
rejects it with -EINVAL when cs >= num_chipselect. The serial-multi-
instantiate approach is necessary to extend num_chipselect first.

Regarding modifying the probed controller: I acknowledge this is not
ideal. Patch 1/3 is a step toward the cleaner approach (preset on
device). However, num_chipselect still needs to be extended, and
cs_gpiods needs to be expanded to prevent out-of-bounds access in
__spi_add_device(). I'm open to suggestions for a cleaner way to
handle this.

Tested on HP EliteBook 8 G1i 16 inch (Intel Core Ultra 7 258V,
Lunar Lake-M) with 2x CS35L56 Rev B0. Both amplifiers probe
successfully, load calibration and tuning, and produce audio.

Related bug reports:
- https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/2131138
- https://bugzilla.kernel.org/show_bug.cgi?id=221064
- https://github.com/thesofproject/linux/issues/5621

Khalil (3):
  spi: Preserve preset cs_gpiod in __spi_add_device()
  platform/x86: serial-multi-instantiate: Fix SPI chip select on
    platforms with incomplete ACPI cs-gpios
  spi: pxa2xx: Handle clock gating for GPIO chip select devices

 drivers/spi/spi.c                                |   3 +-
 drivers/platform/x86/serial-multi-instantiate.c  | 156 +++++++++++++++-
 drivers/spi/spi-pxa2xx.c                         |  78 ++++-----
 3 files changed, 196 insertions(+), 41 deletions(-)

--
Re: [PATCH v2 0/3] Fix CS35L56 amplifier on Intel LPSS SPI with broken ACPI cs-gpios
Posted by Mark Brown 2 months ago
On Sat, Apr 11, 2026 at 08:04:11PM +0200, Khalil wrote:

> This is v2 of the patch series fixing dual CS35L56 amplifiers on HP
> laptops with Intel Lunar Lake and broken ACPI cs-gpios.

I can't work out what these apply against, please submit against my
current tree.
Re: [PATCH v2 0/3] Fix CS35L56 amplifier on Intel LPSS SPI with broken ACPI cs-gpios
Posted by Richard Fitzgerald 2 months ago
On 11/04/2026 10:57 pm, Mark Brown wrote:
> On Sat, Apr 11, 2026 at 08:04:11PM +0200, Khalil wrote:
> 
>> This is v2 of the patch series fixing dual CS35L56 amplifiers on HP
>> laptops with Intel Lunar Lake and broken ACPI cs-gpios.
> 
> I can't work out what these apply against, please submit against my
> current tree.

Also please put V2 (or whatever version) on all patches in the series,
not just the cover letter.
Re: [PATCH v2 0/3] Fix CS35L56 amplifier on Intel LPSS SPI with broken ACPI cs-gpios
Posted by Richard Fitzgerald 2 months ago
On 13/04/2026 9:48 am, Richard Fitzgerald wrote:
> On 11/04/2026 10:57 pm, Mark Brown wrote:
>> On Sat, Apr 11, 2026 at 08:04:11PM +0200, Khalil wrote:
>>
>>> This is v2 of the patch series fixing dual CS35L56 amplifiers on HP
>>> laptops with Intel Lunar Lake and broken ACPI cs-gpios.
>>
>> I can't work out what these apply against, please submit against my
>> current tree.
> 
> Also please put V2 (or whatever version) on all patches in the series,
> not just the cover letter.

... and use ./scripts/get_maintainer.pl to get the emails of the
maintainers and reviewers.

The email for Hans de Goede is <hansg@kernel.org>

Can you also cc patches@opensource.cirrus.com. Thanks.