From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=82.195.75.108 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796139154; b=ZTlWrRpPQIlzKnXm/MrXmSqyWDp+sgYhbaRxxioYElRQHnsLZuF3gia1ta1bkDsCJquO cA/wzX0cBizjoFn0YdJKF7gD8m1DOihZ964WLwi0R7gnJ6N1NbmzrKGE0DOtfDpNOMBIC QApxqYn61Etr7PLPq316AGgzkbJBRHV9WSLRGH2C/sQiBuhFe7Sa3Yjg2U7kIpS/79FsH rrtTFTT0uxzjxy1kOEzo7ni7adTPn+pIV71TwKs8eZGKv8L+lg823JITkPuhzt0F29ZXN i606prz690hlpT0HWresV33OBgoBAqw3UuYo3roLzjS4IZMoq2BIGKuqMw+7yeKk9Xw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796139154; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding: X-Debian-User; bh=JyF5IKTYpJOlmc/0+zJVK4KnYE9X/HjrWsE6zgnvUXo=; b=hOAS2kCJ+QEY3jkX4ncl0jyHa4HNVBzVxRYXHPWFsMaiqT8P1webeY+zPG/RkPCWf/+U 8kVmO4t0dW1VEyBNN5uRmrVyeOJQDDNOTsf3ut5NjhBU1dn/bK+XMvhs8OLu/k1evAp1F ZjeeolBukqNpSgWkA7HQkVvRvLX2RiviyiCglPGd7oItXaGTKzlSbMP1Im+V6uE7mGEhO 9gfZZd7LcIzc+UzeOjGgMMgZdj+11Sm3JsFXObMiRQbaVFIaDzxckVUSdOER1Nss46B8l XvdbKEBhNQP8Glc0iwdHDoqmEXTngpCdJakC/KMCBaUe68XUgvuJej+unWDtXYY9Aig== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=qGu9YDhk; arc=none smtp.remote-ip=82.195.75.108 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 179F5606A327; Tue, 1 Dec 2026 15:32:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 179F5606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=qGu9YDhk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Content-Transfer-Encoding:MIME-Version :Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=JyF5IKTYpJOlmc/0+zJVK4KnYE9X/HjrWsE6zgnvUXo=; b=qGu9YDhkZCkfgWvV3N9VW/zLl6 BoauxNZnhyu1en//FBU/ZsoBeZZacaJsA37f1p9nMppmjRj2dY58temzVgRsWUF129rqDy9a9TwEY las0dZd7oUwLL0ApO/u4T5yVjwAMV04RxKvEe2PJIVBbZvSdJMbEGW5m0H+Sb0F0x36M3vhrb6NHJ hs/hoxxbzfqECoeRM25nu+g19Ss+HE7kU4uKr0xXGpQHdj5PQ+Z3It+UoxK9XptExFF70Lrqdht0t zjQ5zM0lI3t8UhNhJR40Vla05//CSVnn74uWR8czC/DySCzYxXZWjH1B7aaZafudODOngkpQcKfce eq2OKKjA==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1xYPqH-000q8r-1r; Tue, 01 Dec 2026 15:32:30 +0000 From: Shih-Yuan Lee To: Takashi Iwai , Jaroslav Kysela Cc: Shih-Yuan Lee , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 0/2] ALSA: hda/cs420x: MacBook8,1 speakers and headset mic Date: Tue, 1 Dec 2026 23:32:11 +0800 Message-Id: <20261201153214.25157-1-fourdollars@debian.org> X-Mailer: git-send-email 2.39.5 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Debian-User: fourdollars This series adds audio support for the 12-inch MacBook (MacBook8,1, codec SSID 106b:6400, Cirrus Logic CS4208), which currently has no working internal speakers or headset microphone on mainline. Patch 1 adds a CS4208_MB81 fixup for the four MAX98357B TDM speaker amplifiers (digital pin 0x1d / converter 0x0a, enabled via GPIO0), with a { FL, FR, NA, NA } channel map and GPIO0 automute on headphone plug/unplug. Patch 2 adds 4-pole TRRS headset mic support. Pin 0x18 has no mechanical jack sense, so CTIA/OMTP/3-pole polarity is detected with the CS4208 HS3/HS4 impedance detector and routed via NID 0x24 CIR 0x1a. Userspace needs a matching alsa-ucm-conf profile (SplitPCM to expose the 4-channel TDM PCM as a stereo sink); I will send that once this is settled. Background and reverse-engineering credits are in https://bugzilla.kernel.org/show_bug.cgi?id=110561 (Leif Liddy, Thomas Shirley, Zach Robinson and others). Questions for review: - Patch 1 locks the "IEC958 Default PCM Playback Switch" read-only in HDA_FIXUP_ACT_BUILD to stop analog playback from being mirrored onto the 4-channel TDM converter. Would you prefer a flag in hda_gen_spec (e.g. no_share_spdif) that skips snd_hda_create_spdif_share_sw() instead? - Patch 2 calls snd_hda_gen_fix_pin_power() for pin 0x18, because dyn_adc_switch does not propagate stream_enabled to the newly selected input pin when switching an already open capture stream. Should this be fixed in generic.c rather than worked around here? Known limitations: speaker protection (pin 0x22 IV-sense) is not implemented, so keep volume moderate. Only MacBook8,1 was tested; MacBook9,1/10,1 share the hardware family but are not added. Testing, on a real MacBook8,1 (Ubuntu 7.0.0-44-generic, built as an out-of-tree module of this cs420x.c since no mainline kernel with this base is installed there): - Cold boot matches the quirk; speaker playback (4ch/44.1kHz/S16_LE via UCM SplitPCM), headphone plug/unplug with GPIO0 automute, internal mic, and TRRS headset mic hotplug all work. - Runtime PM D3 -> D0 resume and S3 suspend/resume keep working. On this machine the codec does not wake the HDA link from D3 on jack plug/unplug, hence cs_init() re-runs debounced detection on resume. - Caveat for S3: on this MacBook8,1 suspend/resume is only reliable with three platform workarounds that are unrelated to this series: the ACPI LID0 wakeup source is disabled (otherwise the machine wakes again about 2 seconds after suspending with the lid open), the WiFi/Bluetooth kernel modules are unloaded before suspending, and my separate spi-pxa2xx patchset (currently under review) is applied. Without those, suspend/resume fails or wakes up immediately regardless of this driver. - Analog headphone playback (hw:PCH,0, 48/96 kHz S32_LE) leaves converter 0x0a idle (stream=0). - checkpatch.pl --strict is clean, W=1 and sparse report nothing, and each patch builds on its own on top of v7.4-rc5-era master. - The locking and runtime-PM interaction of the headset detection (hs_mutex vs. runtime PM, unplug vs. resume, unsol vs. resume) was also modelled in SPIN and checked exhaustively. Tool disclosure: I used an AI coding assistant for review feedback and iteration on the code and for drafting parts of the changelogs, and the SPIN model above was written with its help. I reviewed and tested everything myself and take responsibility for the submission. Shih-Yuan Lee (2): ALSA: hda/cs420x: Add CS4208 TDM speaker fixup for MacBook8,1 ALSA: hda/cs420x: Support headset mic type detection on MacBook8,1 Documentation/sound/hd-audio/models.rst | 2 + sound/hda/codecs/cirrus/cs420x.c | 751 +++++++++++++++++++++++- 2 files changed, 747 insertions(+), 6 deletions(-) -- 2.39.5