From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84EC63CC9F4; Mon, 20 Apr 2026 13:17:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776691067; cv=none; b=nbHJizljjPMhTOcQY/mkrL/EwMmjt3VOKBhEL4M2USiglIZxcsziwG+czd98fLc5gUsmeS847DHc3kf7QN3heM1MjT0H8//gZNwuYd88eBB2z+2lIXgvapqvG3Hff9WaVTxKil8lj2VNGGHdvel/VV7oz+W9rw3qqDtaP9saYck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776691067; c=relaxed/simple; bh=1BnUsJ9rtrA+zccP0lKv+OjEToMSdEhfzh6+sSmolwQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SJ90cdXf6m5VTMBt62WYaqfQSFBP1MufPGASd+ZjRBuwR/ZxdXzTLLBbk50453pQhVvv3TnDXoSUCBfjT+JE8i8cXMihjbqHx5W1bwpuDBZIQ8IgiKBeCTIpuM2Hf+xGFK9+4jYWYQzovQZ6nLjNpjXqMElDRn6JmcgZp5mt0TE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KCcHaTcB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KCcHaTcB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26673C2BCB9; Mon, 20 Apr 2026 13:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776691067; bh=1BnUsJ9rtrA+zccP0lKv+OjEToMSdEhfzh6+sSmolwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KCcHaTcBm1NVlUdKyDheb2LRPJAjpUhV1ASZr2DscPx8UIJJtQ5wU5Mixt1PBwIiF 7rO6LSHtFHGX4ZBlOaIMLpLLL4PDdSoUCCoaZZJh2lZbw8ZpCMN05YwV+cy9Mq6ms2 8vkwtpGnV6c73yNtFQ+o4B/b/Mch0A70J3YV57QBvSpT25M410/HM1UAF9OVyBN8bZ atAhljH9xRpTr01aRFAL6BCWSu5FZiLll8SBZR3jnxf+FPEt1Extvf7qmy7IsYVUB0 Cvyix52NURo83NCFuTrH4yq9H9VYh1RZAhEHbEK48uN5BDhTS9svSE8iD+MtzkNgVe 0kmUUUluAgedw== From: Sasha Levin To: patches@lists.linux.dev, stable@vger.kernel.org Cc: Stefano Radaelli , Luiz Augusto von Dentz , Sasha Levin , marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH AUTOSEL 7.0-6.19] Bluetooth: hci_ll: Enable BROKEN_ENHANCED_SETUP_SYNC_CONN for WL183x Date: Mon, 20 Apr 2026 09:09:00 -0400 Message-ID: <20260420131539.986432-74-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420131539.986432-1-sashal@kernel.org> References: <20260420131539.986432-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 7.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Stefano Radaelli [ Upstream commit 1c0bc11cd445ba8235ac8ec87d5999b6769ed8b9 ] TI WL183x controllers advertise support for the HCI Enhanced Setup Synchronous Connection command, but SCO setup fails when the enhanced path is used. The only working configuration is to fall back to the legacy HCI Setup Synchronous Connection (0x0028). This matches the scenario described in commit 05abad857277 ("Bluetooth: HCI: Add HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN quirk"). Enable HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN automatically for devices compatible with: - ti,wl1831-st - ti,wl1835-st - ti,wl1837-st Signed-off-by: Stefano Radaelli Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- LLM Generated explanations, may be completely bogus: Now let me compile the full analysis. --- ## PHASE 1: COMMIT MESSAGE FORENSICS ### Step 1.1: PARSE THE SUBJECT LINE - **Subsystem prefix**: `Bluetooth: hci_ll:` - **Action verb**: "Enable" — enabling a quirk workaround for broken hardware - **Summary**: Enable the BROKEN_ENHANCED_SETUP_SYNC_CONN quirk for TI WL183x Bluetooth controllers because SCO setup fails when using the enhanced path. Record: [Bluetooth: hci_ll] [Enable] [Hardware quirk for broken enhanced SCO setup on WL183x] ### Step 1.2: PARSE ALL COMMIT MESSAGE TAGS - **Signed-off-by: Stefano Radaelli** — patch author (Variscite employee, embedded board vendor) - **Signed-off-by: Luiz Augusto von Dentz** — Bluetooth subsystem maintainer who merged it - No Fixes: tag (expected for review candidates) - No Cc: stable (expected) - No Reported-by (author found the bug during hardware validation) - No Link: tags Record: Maintainer SOB from Luiz Augusto von Dentz. No syzbot, no explicit stable nomination. ### Step 1.3: ANALYZE THE COMMIT BODY TEXT The commit explains that TI WL183x controllers advertise support for HCI Enhanced Setup Synchronous Connection but SCO fails when the enhanced path is used. The only working configuration is to fall back to legacy HCI Setup Synchronous Connection (0x0028). This references commit 05abad857277 which introduced the exact quirk for this scenario. Record: Bug = SCO audio setup fails on WL183x chips. Symptom = SCO connection failure. Root cause = controller claims enhanced setup support but it's broken. ### Step 1.4: DETECT HIDDEN BUG FIXES This is a **hardware quirk/workaround**, not a hidden fix. It's explicitly enabling an existing quirk for specific devices that are broken. This falls squarely into the "hardware quirk" exception category for stable. Record: This is a hardware workaround (quirk), a known exception category that IS appropriate for stable. --- ## PHASE 2: DIFF ANALYSIS ### Step 2.1: INVENTORY THE CHANGES - **File**: `drivers/bluetooth/hci_ll.c` - **Lines added**: ~10 (1 struct field + 4 lines in probe + 3 lines in setup) - **Functions modified**: `struct ll_device` (field addition), `ll_setup()` (quirk setting), `hci_ti_probe()` (compatible detection) - **Scope**: Single-file, surgical change Record: 1 file, ~10 lines added, 3 locations modified. Small and contained. ### Step 2.2: UNDERSTAND THE CODE FLOW CHANGE 1. **struct ll_device**: adds `bool broken_enhanced_setup` field 2. **hci_ti_probe()**: checks if device is compatible with wl1831-st/wl1835-st/wl1837-st and sets the new bool 3. **ll_setup()**: if `broken_enhanced_setup` is true, calls `hci_set_quirk()` to set `HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN` Record: Probe detects WL183x compatible → stores flag → setup applies quirk during device initialization. ### Step 2.3: IDENTIFY THE BUG MECHANISM Category: **Hardware workaround** (h). The TI WL183x chips claim support for Enhanced Setup Synchronous Connection but it doesn't work. The quirk tells the Bluetooth stack to fall back to the legacy command. Record: Hardware quirk. Broken enhanced SCO command on WL183x. Fix = set existing quirk flag. ### Step 2.4: ASSESS THE FIX QUALITY - Obviously correct — same pattern used by btusb.c for QCA and MTK controllers - Minimal and surgical — only affects WL183x devices - Zero regression risk for non-WL183x devices (guarded by compatible check) - Low regression risk for WL183x (just falls back to legacy SCO path that works) Record: High quality, obviously correct, follows established pattern. No regression risk. --- ## PHASE 3: GIT HISTORY INVESTIGATION ### Step 3.1: BLAME THE CHANGED LINES The areas being modified were introduced by: - `struct ll_device`: Rob Herring, 2017-04-13 (commit 371805522f8709) — in tree since v4.13 - `ll_setup()`: David Lechner, 2017-12-12 (commit 0e58d0cdb3eb6e) — in tree since v4.16 - `hci_ti_probe()`: Rob Herring, 2017-04-13 — in tree since v4.13 Record: Code being modified is very old (v4.13-v4.16), present in all stable trees. ### Step 3.2: FOLLOW THE FIXES: TAG No Fixes: tag. The commit references 05abad857277 as context (the commit that added the quirk), not as a Fixes target. Record: N/A — no Fixes tag, but the referenced quirk commit (05abad857277) exists since v5.19. ### Step 3.3: CHECK FILE HISTORY FOR RELATED CHANGES Recent changes to hci_ll.c are mostly unrelated (firmware leak fix, alloc_obj conversion, hci_set_quirk API migration). No prerequisites needed. Record: Standalone change. No prerequisites beyond the existing quirk definition (v5.19+) and compatible strings (always existed). ### Step 3.4: CHECK THE AUTHOR'S OTHER COMMITS Stefano Radaelli from Variscite is primarily an embedded/DTS contributor (imx8mp, imx93). This is their first Bluetooth subsystem commit. The patch was reviewed and merged by the Bluetooth maintainer (Luiz Augusto von Dentz). Record: Author is a hardware vendor contributor; patch was accepted by subsystem maintainer. ### Step 3.5: CHECK FOR DEPENDENT/PREREQUISITE COMMITS - `HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN` exists since v5.19 (commit 05abad857277) - `hci_set_quirk()` API exists since v6.16 (commit 6851a0c228fc04) - For stable trees v6.1-v6.15, the quirk must use `set_bit(HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, &hu->hdev->quirks)` instead of `hci_set_quirk()` - v5.15 CANNOT receive this fix (quirk doesn't exist there) Record: Backportable to v6.1+ with minor API adjustment for trees before v6.16. --- ## PHASE 4: MAILING LIST AND EXTERNAL RESEARCH ### Step 4.1: FIND THE ORIGINAL PATCH DISCUSSION Found at patchew.org — this is v2 of a 2-version series. v1 used a DT property approach, and after review feedback from Krzysztof Kozlowski, v2 switched to detecting the compatible string. The patch went through proper review. Record: v1→v2 evolution. Reviewer suggested compatible-based detection instead of DT property. Final version is clean. ### Step 4.2: CHECK WHO REVIEWED THE PATCH - Krzysztof Kozlowski reviewed v1 and suggested the approach used in v2 - Luiz Augusto von Dentz (Bluetooth maintainer) merged the patch - David Lechner and Marcel Holtmann were CC'd Record: Proper review by DT and Bluetooth maintainers. ### Step 4.3: SEARCH FOR THE BUG REPORT The author (Variscite) found this during platform validation. The linked bugzilla (215576) for the original quirk commit shows this is a known class of bugs across multiple BT controller vendors (QCA, MTK, and now TI WL183x). Record: Real hardware bug affecting real products. ### Step 4.4: CHECK FOR RELATED PATCHES AND SERIES This is a standalone patch (v2 0/1 series). No dependencies on other patches. Record: Standalone, no series dependencies. ### Step 4.5: CHECK STABLE MAILING LIST HISTORY No prior stable discussion found for this specific commit. Record: No prior stable discussion. --- ## PHASE 5: CODE SEMANTIC ANALYSIS ### Step 5.1-5.4: IDENTIFY KEY FUNCTIONS AND TRACE CALL CHAINS - `hci_ti_probe()` → called during device enumeration when DT compatible matches - `ll_setup()` → called during HCI device setup (hci_uart_proto.setup) - `enhanced_sync_conn_capable()` → checked in `hci_conn.c` and `sco.c` when setting up SCO connections - The quirk prevents `HCI_OP_ENHANCED_SETUP_SYNC_CONN` from being used, falling back to `HCI_OP_SETUP_SYNC_CONN` Record: The quirk controls a well-defined code path in SCO connection setup. Impact is limited to SCO/audio on affected devices. ### Step 5.5: SEARCH FOR SIMILAR PATTERNS The exact same quirk is set for QCA (commit d44e1dbda36ff) and MTK (commit e11523e97f474) controllers in btusb.c. This is an established, well-tested pattern. Record: Identical pattern used for 2 other controller families. --- ## PHASE 6: CROSS-REFERENCING AND STABLE TREE ANALYSIS ### Step 6.1: DOES THE BUGGY CODE EXIST IN STABLE TREES? - The hci_ll driver with WL183x compatibles exists in all stable trees (v4.13+) - The quirk mechanism exists in v5.19+ (v6.1.y, v6.6.y, v6.12.y stable trees) - The `hci_set_quirk()` API only exists in v6.16+; older trees use `set_bit()` Record: The bug exists in v6.1+, v6.6+, v6.12+ stable trees. Fix is applicable with minor API adjustment. ### Step 6.2: CHECK FOR BACKPORT COMPLICATIONS - For v6.16+ (v7.0 target): clean apply - For v6.1-v6.15: needs `set_bit()` instead of `hci_set_quirk()` — trivial one-line change Record: Clean apply to v7.0. Minor adjustment for older stable trees. ### Step 6.3: CHECK IF RELATED FIXES ARE ALREADY IN STABLE No other fix for WL183x SCO exists in any stable tree. Record: No related fixes in stable. --- ## PHASE 7: SUBSYSTEM AND MAINTAINER CONTEXT ### Step 7.1: IDENTIFY THE SUBSYSTEM AND ITS CRITICALITY - Subsystem: Bluetooth (drivers/bluetooth) — IMPORTANT - Affects users of TI WL183x Bluetooth modules on embedded platforms (Variscite boards, etc.) Record: Bluetooth driver, IMPORTANT subsystem, embedded hardware audience. ### Step 7.2: ASSESS SUBSYSTEM ACTIVITY The Bluetooth subsystem is actively maintained by Luiz Augusto von Dentz. The hci_ll driver sees moderate activity. Record: Active subsystem, moderate driver activity. --- ## PHASE 8: IMPACT AND RISK ASSESSMENT ### Step 8.1: DETERMINE WHO IS AFFECTED Users of TI WL1831/WL1835/WL1837 Bluetooth modules. These are common on embedded ARM platforms (iMX, TI AM series, etc.) particularly for IoT and automotive applications. Record: Driver-specific, but significant embedded user base. ### Step 8.2: DETERMINE THE TRIGGER CONDITIONS Trigger: Any attempt to use SCO/HFP audio over Bluetooth on affected WL183x hardware. This is a common use case (phone calls, headsets). Record: Common trigger (SCO audio setup), happens every time audio is used. ### Step 8.3: DETERMINE THE FAILURE MODE SEVERITY Without this fix, SCO audio connections simply fail. Users cannot use Bluetooth audio functionality (HFP/HSP profiles). This is a **functional failure** — a complete feature doesn't work. Record: Functional failure — SCO audio doesn't work at all. Severity: HIGH (complete loss of Bluetooth audio functionality). ### Step 8.4: CALCULATE RISK-BENEFIT RATIO - **BENEFIT**: HIGH — enables Bluetooth audio on WL183x hardware - **RISK**: VERY LOW — 10 lines of code, only affects WL183x devices, uses a well-tested quirk mechanism already proven with QCA and MTK - **Ratio**: Very favorable for backporting Record: Benefit HIGH, Risk VERY LOW. Clear favorable ratio. --- ## PHASE 9: FINAL SYNTHESIS ### Step 9.1: COMPILE THE EVIDENCE **Evidence FOR backporting:** - Fixes a real hardware bug: SCO audio completely fails on WL183x - Hardware quirk — a recognized exception category for stable - Small, surgical change (~10 lines, single file) - Uses an established pattern (same quirk for QCA and MTK controllers) - Reviewed and merged by Bluetooth subsystem maintainer - Zero regression risk for non-affected devices - The driver and compatible strings exist in all stable trees - The quirk definition exists in v6.1+ **Evidence AGAINST backporting:** - No Fixes: tag or explicit stable nomination (but expected for review candidates) - Author is not a regular BT subsystem contributor (but patch was accepted by maintainer) - Needs trivial API adjustment for stable trees < v6.16 (set_bit vs hci_set_quirk) **UNRESOLVED:** - None significant ### Step 9.2: STABLE RULES CHECKLIST 1. Obviously correct and tested? **YES** — tested on WL183x hardware, follows existing pattern 2. Fixes a real bug? **YES** — SCO audio fails completely 3. Important issue? **YES** — complete loss of Bluetooth audio functionality 4. Small and contained? **YES** — ~10 lines, single file 5. No new features or APIs? **YES** — just enables existing quirk for additional devices 6. Can apply to stable trees? **YES** — clean apply to 7.0, minor adjustment for older trees ### Step 9.3: CHECK FOR EXCEPTION CATEGORIES This falls into the **hardware quirk/workaround** exception category. Adding a quirk to an existing driver for broken hardware is explicitly listed as appropriate for stable. ### Step 9.4: DECISION This is a textbook hardware quirk for stable. It's small, obviously correct, fixes a real functional failure (no Bluetooth audio on WL183x), follows an established pattern, and carries virtually no regression risk. --- ## Verification - [Phase 1] Parsed commit message: no Fixes: tag, no Reported-by, maintainer SOB from Luiz von Dentz - [Phase 2] Diff analysis: ~10 lines added to 1 file, 3 locations (struct, probe, setup). Adds bool flag and quirk setting - [Phase 3] git blame: code modified dates to v4.13-v4.16 (371805522f8709, 0e58d0cdb3eb6e), present in all stable trees - [Phase 3] git show 05abad857277d: confirmed original quirk commit exists since v5.19 - [Phase 3] git merge-base checks: quirk in v5.19+, hci_set_quirk API in v6.16+ only - [Phase 3] Verified WL183x compatibles exist in v5.15, v6.1, v6.6, v6.12 - [Phase 4] Found original submission on patchew.org: v2 series, v1→v2 evolution per reviewer feedback - [Phase 4] Review discussion: Krzysztof Kozlowski suggested compatible- based approach - [Phase 5] Verified identical quirk pattern used for QCA (d44e1dbda36ff) and MTK (e11523e97f474) in btusb.c - [Phase 6] Verified quirk does NOT exist in v5.15 (cannot backport there), EXISTS in v6.1+ - [Phase 6] Verified hci_set_quirk() NOT in v6.12/v6.15; older trees need set_bit() instead - [Phase 8] Failure mode: complete SCO audio failure on WL183x hardware. Severity: HIGH **YES** drivers/bluetooth/hci_ll.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c index 91c96ad123422..ab744001dafc4 100644 --- a/drivers/bluetooth/hci_ll.c +++ b/drivers/bluetooth/hci_ll.c @@ -68,6 +68,7 @@ struct ll_device { struct gpio_desc *enable_gpio; struct clk *ext_clk; bdaddr_t bdaddr; + bool broken_enhanced_setup; }; struct ll_struct { @@ -658,6 +659,10 @@ static int ll_setup(struct hci_uart *hu) hci_set_quirk(hu->hdev, HCI_QUIRK_INVALID_BDADDR); } + if (lldev->broken_enhanced_setup) + hci_set_quirk(hu->hdev, + HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN); + /* Operational speed if any */ if (hu->oper_speed) speed = hu->oper_speed; @@ -712,6 +717,11 @@ static int hci_ti_probe(struct serdev_device *serdev) of_property_read_u32(serdev->dev.of_node, "max-speed", &max_speed); hci_uart_set_speeds(hu, 115200, max_speed); + if (of_device_is_compatible(serdev->dev.of_node, "ti,wl1831-st") || + of_device_is_compatible(serdev->dev.of_node, "ti,wl1835-st") || + of_device_is_compatible(serdev->dev.of_node, "ti,wl1837-st")) + lldev->broken_enhanced_setup = true; + /* optional BD address from nvram */ bdaddr_cell = nvmem_cell_get(&serdev->dev, "bd-address"); if (IS_ERR(bdaddr_cell)) { -- 2.53.0