The Apple Silicon audio driver code within the Linux kernel is preparing to make use of the recent shared GPIO infrastructure for allowing multiple drivers / kernel components to nicely share the same GPIO lines. This should help clean things up in the mainline kernel for the Apple Silicon audio support and with a cleaner architecture than the current downstream Asahi Linux code. Apple Silicon Linux developer James Calligeros posted the patches this week to enable shared GPIO usage for Apple Silicon audio support. This overcomes challenges with how the audio support for Apple's M-series SoCs is engineered and the "impossible" power management behavior that pressed the Asahi Linux developers. Calligeros explained with this week's patch series: "On Apple Silicon Macs, every speaker codec's software shutdown pin is connected to the same GPIO line. This line must be pulled high whenever any codec asserts it so. This makes power management impossible. When we [go] through the list of codecs and call each suspend/resume, the GPIO line is asserted low or high by the first suspended/resumed codec. This causes issues for the subsequent codecs; they are already shut off by the time we try to cache the register state on suspend. In the downstream Asahi Linux kernel, we were previously (ab)using the regulator API to work around this safely. We replaced the shutdown-gpios property in the codec Devicetree nodes with a virtual regulator which acts as a proxy for the GPIO line. The regulator will not deassert the pin until every consumer wants it off, and it will assert it as soon as any one codec requires it. Now that the kernel has shared GPIO support, this has become unnecessary. The first commit in this series enables shared GPIO for ARCH_APPLE so that we can take advantage of this new(ish) infrastructure. The shared GPIO infrastructure considers the first state change of a line to be the "default" state, which is the state that it will allow to be asserted without all consumers agreeing. Currently the TAS2764 and TAS2770 drivers initialise the shutdown GPIO high, which means the first change is to low. This does not help us, as the line will not be reasserted on resume until all codecs have tried to assert it. Since both drivers explicitly pull the line high on codec probe, we can initialise it low, causing the first state change to be from low to high. This makes the shared GPIO proxy behave as we intend. The second and third commits in this series implement this." This shared GPIO support for Apple Silicon and the tas2764 / tas2770 ASoC driver changes are queued now into the Apple SoC driver branch for submission to the Linux 7.4 kernel cycle.
Linux 7.4 To Improve Apple Silicon Audio Support & Its "Impossible" Power Management
Full Article
Original Source
Read the full article at Phoronix →KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.