Repository navigation
gpio: macsmc: Take the gP13 write-only templated output from the device tree - #2305
RyanTheTide wants to merge 6 commits into
Conversation
Some templated SMC outputs have no established readback of their output latch. Let the device tree list them, so the driver reports the level it last wrote instead of querying the SMC. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…output
On the M4 Macs (J604, J623, J624, J713, J715, J773g) and on the J716s,
the radio's reg-on (the J716s: the N1's power) is the SMC's gP13, driven
with the ADT's pKW4("gP13", 0x00800000) template: 0x00800000 | level.
gpio-macsmc selects that by machine today. Describe it on the boards'
SMC GPIO node instead, with apple,output-templates, and mark it
apple,write-only-outputs, as no readback of the line is established.
t8132-jxxx.dtsi is included by every T8132 board, which is exactly the
set the driver's apple_t8132_managed_radio() matches.
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Commit 5f9edb2 ("gpio: macsmc: use the qualified J713 radio action") drives gP13 with its 0x00800000 template, and reports the last successful write as its level, on the boards apple_t8132_managed_radio() matches, and since then also on the J716s. The template and the missing readback are properties of the board's line, which the device tree already describes for other lines with apple,output-templates. Take the line from apple,output-templates and the missing readback from apple,write-only-outputs, which the boards now describe, and drop the board list. A templated line the device tree does not mark write-only keeps reading the output latch back, as before. The write and the cached level stay serialised under one lock, and a failed write keeps the previous level. The selftest now drives the line as the device tree describes it, rather than through the board list; as it stood it no longer ran, as the J716s match was not in its list of known boards. Fixes: 5f9edb2 ("gpio: macsmc: use the qualified J713 radio action") Suggested-by: Eryk Wieliczko <eryk@wieliczko.ninja> Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Blockers: 2. The new path itself is correct (checked at 43c0796). The write-only bit is only accepted on a line that already has a template (drivers/gpio/gpio-macsmc.c:512-515). A write and the cached level change under
HW row: on the rebased head: J713 with the new DTB and again with the previous DTB (fallback). Both get wlan up, BT up, and Wi-Fi back after 3x s2idle, with gP13 reported as an output. Plus J616s Wi-Fi unchanged, 0 AVC, 0 failed units, no new kernel errors. A J716s owner boot with the N1 up would cover the T6050 side. Assisted-by: LLM (Claude:Opus 5.5) |
Conflict: tools/testing/selftests/drivers/apple/macsmc-j713.py (kept the PR's DT-template test; integration's J716s board entry is covered by the J716s apple,write-only-outputs DT the PR adds). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Merged integration/aurora (d1b022d); conflict in tools/testing/selftests/drivers/apple/macsmc-j713.py resolved (kept the DT-template test; the J716s case is covered by its new DT), gpio-macsmc.o, t6050-j716s and all t8132 dtbs build (only the two new properties differ from integration) and macsmc-j713.py passes. |
|
The rebase is done and it merges cleanly. Still open from review: keep today's gP13 template as a fallback when the device tree has no apple,output-templates entry for 0x13 (kernel-only updates with an older DTB otherwise lose Wi-Fi power control), and a J713 row showing gpioinfo with line 0x13 as an output and Wi-Fi coming up. |
|
One more piece for the J716s: on T6050, macsmc doesn't register the |
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
A kernel-only update boots with the boot loader's DTB, which on the T8132 boards and the J716s does not list gP13 in apple,output-templates yet. Without a template the radio power line would take the generic CMD_OUTPUT write, which is not this line's command, and Wi-Fi (on the J716s the N1) would lose power control. When the gP bank has no template for gP13 on those machines, use the one the driver used before: 0x00800000 with the level in the low bits, write-only. A device tree that describes gP13 always wins. The fallback goes once a boot loader release that ships the DTB with the property is the oldest one supported. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Forward-merged main f02bd68 (c93b83a, clean) and addressed the 11-21 review in 8ff4c11:
Local: Still needed (review point 3): J713 rows with this head's DTB and again with the previous DTB (fallback path): wlan and BT up, Wi-Fi back after 3x s2idle, |
|
Hardware row at exact head
How: one combined test kernel for eight PRs, not this PR alone. Kernel |
Problem
gpio-macsmc drives gP13 with its command template (0x00800000 | level) and reports the last successful write as its level, because no readback of that line is established. This is selected by machine:
apple_t8132_managed_radio() || of_machine_is_compatible("apple,j716s")atdrivers/gpio/gpio-macsmc.c:530(from 5f9edb2, with J716s added later). The template and the missing readback are properties of the board's line. The driver already takes such templates from the device tree (apple,output-templates) for other lines, for example gPe on the J616s.Change
apple,write-only-outputsonapple,smc-gpio: GPIO numbers fromapple,output-templatesthat cannot be read back. Reading one reports the last level written, or-EOPNOTSUPPbefore the first write.apple,output-templates = <0x13 0x00800000>andapple,write-only-outputs = <0x13>. This goes int8132-jxxx.dtsi, which every T8132 board includes (J604, J623, J624, J713, J715, J773g), the same setapple_t8132_managed_radio()matched, and int6050-j716s.dts.macsmc-j713.pyselftest now drives the line as the DT describes it, and also covers a readable templated line.Credit: Eryk Wieliczko wrote the J713 gP13 path (5f9edb2).
apple_t8132_managed_radio()keeps its other users (apple-dart, pcie-apple).Testing
drivers/gpio/gpio-macsmc.o), and the DTBs build. See below.tools/testing/selftests/drivers/apple/macsmc-j713.py:ok 1 - 2321 production SMC GPIO checks passed(host build with a mocked SMC).Still to run
ip linkshows the wlan interface. Expected: unchanged.gpioinfoon the macsmc-pmu-gpio chip shows line 19 (0x13) as an output.DT diff (dtc -I dtb -O dts, before and after)
Every Apple .dts at the base and at this branch, built with cpp+dtc and decompiled; only these boards differ:
Build log
Compiled with the release config's kbuild flags plus the W=1 warning set (clang,
-fsyntax-only):The full kbuild object build in a clean O= tree is pending and will be added here.