From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3888D181334 for ; Sat, 11 Apr 2026 18:04:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775930662; cv=none; b=J2NLHFLRf0CqB1x76QUy1daC8U4pEwRn0fgJZOmuvBky43kmA+pCHXxSG5fzDaGPDkTj8N8fyCrtCz5fAP0+RJLNva/wvPvvAZ0JaojZsFuGuOfAT34fq8cROu0Jq6xNrDU507eSc+O6z/fq3FJQMEz8fbpESu/yEQ/Klv4cD7A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775930662; c=relaxed/simple; bh=hw+SP67MUczjNWm2PgIVoT1LydkC/JLPEi4afGQ7WQQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sah6A3/jNA3mPAFBLC9YohuuVszHzVIwyKK5j0VBSH8u32Djcvp7tfKqEn1Apx7rfME4Wphnw5axN7mELm5/4Nch/+i9EaXdzM0UYmjHwpa7vN+ctncKAi5+dPcPFCbdf2fcMWiI0Glbng4OWiLLKdsdooFBoJm4zcdKohl54hc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UhcyoCpy; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UhcyoCpy" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-b8f9568e074so513158066b.0 for ; Sat, 11 Apr 2026 11:04:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775930659; x=1776535459; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y7P0p0kVaJzs6hmjX5/J5a5R/qOsuqr4kJlAR2Hczlg=; b=UhcyoCpyDv7AXpL2oISMk/4+SsHXEnbWxR/XRkJmdF43pW0S7wRA3C/0DP3P4SSAgZ +TK6VcF0ZH37/g2ynHnTLi2WXukayb0Xu9xxkFHBC4gOapoeo0cya/bfRbDWFHeHNH+t Z2x3CghgS77oDVFoAxBPJrjYvjX6rYmyCstSrenWdrwbJvHmTT0cZfErFsMjVo62qZ0B zqcbck59UuNXRpSdy+3xMKGBNBe7TbrpgLXJs3l/+hoFZfLJJsFetMzTcuk+7AY1xUnm RL1LgK1f44ea+UcPNw4ZWqG9IyShldCv8DXoUdG5VYeiSjmLTgjvOR4fRpuEfOW/nHo9 QpCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775930659; x=1776535459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Y7P0p0kVaJzs6hmjX5/J5a5R/qOsuqr4kJlAR2Hczlg=; b=S/r8SgxT5JImZM+GGm3HiH5o3VX7xR9FK9JG9LlgY9023ZNgEuVEGvakuDCjaie6eb Boyg6ZvyX55Ys3SlIuLm0nVDc24ABf6ZP8exuCujSXoybY8O1mITUhs0+09p8mx7Bvku 1hN/hotPpIH+CPR7oesAGF8InHiiGq5JyvZPE2NMvp1AY+LFFvOrZu4IZcdnDJnOITpp Avk+rZRGEA7m56hWz8kwqsnTs7T1RORZvHiT/gWF5TWfq5pEw+plwbM2/8o9H8STUbHR +R2UkxxlT6lPT4fhcBaZObSBXQSR4i81YZ958jgPIfw+idwFolwGLx99bTXfXAFLGe6F JVdg== X-Forwarded-Encrypted: i=1; AJvYcCW22s8G4PXNV9s0Lvv1PGSrbrbPMaJ3odIysS8/+88KdLsv7liDROD8y0ZQ689Mxqqo6q0F8jwcwvxKUGc=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2flE6YlzfDI9YCysnw4ZG0vP4TwgKuq7wJVGwBhrhy7Ef3ZRX 4plqHTLOLzxiy288ph/XVMRRIFyxqMvSDD65TkAD4y2EmSbcLV0V6BkU X-Gm-Gg: AeBDieuwOnOFArWDDuHrPAo7hLqBh5K+O/HN1BS6d6wWmfGFBHCoAq2vc73cRVoykrx 2nRJkBQqOI/PvsXGjfNsC/9thpDhs/2EXS+dU5vim30upoKkiKc8lqIq0R0/vXxdm5xN4pUJu2Y 4wnfjZPgrzTxeeQX+BwsQfz9tJ2m1kXwrocW2s4XmwJRzLlkwEjtGH/HH7WsVEG67BC8CwxkHmC UFaA8k7nFouirL2kugZvx7ka+/SwTGHbxqV03/3U/P2P1fRl7ot6mZcg/UummjkiCYaQbgqt+MX KGNVAmjJgm5G2k9Ja9DwkUAKqeFJbT86bfx5WP8v4Ycs87Vhz8gYtmRgvHLv47ktos+BAfgZpP5 hvrcD404voibItC8PvNlWt8BZugAFSMtY6JMX+RSJdx2sBIzAUGTFftFiHonxHaSKVNZiU7iQOm SCd9qufKcROwKf01cg+unRuA== X-Received: by 2002:a17:906:7943:b0:b9d:6e82:10f7 with SMTP id a640c23a62f3a-b9d72483ff2mr445226566b.13.1775930659367; Sat, 11 Apr 2026 11:04:19 -0700 (PDT) Received: from khalil-hp.home ([62.250.67.33]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b9d6e5c56d3sm186160666b.32.2026.04.11.11.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Apr 2026 11:04:18 -0700 (PDT) From: Khalil X-Google-Original-From: Khalil 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 Subject: [PATCH v2 0/3] Fix CS35L56 amplifier on Intel LPSS SPI with broken ACPI cs-gpios Date: Sat, 11 Apr 2026 20:04:11 +0200 Message-ID: <20260411180414.481427-1-khalil@rentman.nl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260215135524.1171065-2-khalil@rentman.nl> References: <20260215135524.1171065-2-khalil@rentman.nl> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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(-) --