Enable audio support for J721S2 EVM
v6 cover Enable audio support for J721S2 EVM
Earlier version of the patchset sent upstream[0] was rejected as its dependency[1], which resolves the DTBS check errors introduced by [0] also got rejected on the grounds of ABI breakage.
Another solution to fix the DTBS check errors introduced by [0] is to modify the ti,j721e-system-controller.yaml binding to allow audio-refclk as clock-controller child. This is done in the first patch of this series.
Changes since v5:
Link to v5:
https://lore.kernel.org/all/[email protected]/
- Move audio_refclk1 clock node from the overlay (k3-j721s2-evm-audio.dtso) to the main DTSI (k3-j721s2-main.dtsi) so it is always available independent of the overlay being applied
- Drop the &scm_conf block from the overlay since it is now in main.dtsi
Changes since v4:
Link to v4:
https://lore.kernel.org/all/[email protected]/
- Explicitly disable main_mcan3 and main_mcan5 as they will silently break mcasp audio routing
Link to v3:
https://lore.kernel.org/all/[email protected]/
Link to v2:
https://lore.kernel.org/all/[email protected]/
Link to v1:
https://lore.kernel.org/all/[email protected]/
Bootlogs:
https://gist.github.com/Jamm02/8ee551c2c8db3a58a9aa7976e049fa28
[0]: https://lore.kernel.org/linux-arm-kernel/[email protected]/
[1]: https://lore.kernel.org/all/[email protected]/
Jayesh Choudhary (1):
arm64: dts: ti: Add audio overlay for k3-j721s2-evm
Moteen Shah (1):
dt-bindings: ti: Update audio-refclk binding and j721e system
controller
.../bindings/clock/ti,am62-audio-refclk.yaml | 8 +- .../soc/ti/ti,j721e-system-controller.yaml | 6 +- arch/arm64/boot/dts/ti/Makefile | 4 + .../boot/dts/ti/k3-j721s2-evm-audio.dtso | 157 ++++++++++++++++++ arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi | 9 + 5 files changed, 180 insertions(+), 4 deletions(-) create mode 100644 arch/arm64/boot/dts/ti/k3-j721s2-evm-audio.dtso
Signature · 1 line
2.34.1
PATCH RESEND v6 1/2 dt-bindings: ti: Update audio-refclk binding and j721e system controller
Add ti,j721s2-audio-refclk as a supported compatible string in the ti,am62-audio-refclk binding. J721S2 uses the same audio reference clock IP block first introduced on AM62. Per writing-bindings guidelines, the J721S2-specific compatible is added as the primary string with ti,am62-audio-refclk as the fallback.
Also extend the ti,j721e-system-controller clock-controller@ child pattern to accept audio-refclk schemas alongside ehrpwm-tbclk via a oneOf constraint, fixing the alphanumerical ordering of $refs.
--- .../devicetree/bindings/clock/ti,am62-audio-refclk.yaml | 8 ++++++-- .../bindings/soc/ti/ti,j721e-system-controller.yaml | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/clock/ti,am62-audio-refclk.yaml +6 -2
@@ -11,8 +11,12 @@ maintainers: properties: compatible: - items: - - const: ti,am62-audio-refclk + oneOf: + - items: + - const: ti,am62-audio-refclk + - items: + - const: ti,j721s2-audio-refclk + - const: ti,am62-audio-refclk reg: maxItems: 1
Documentation/devicetree/bindings/soc/ti/ti,j721e-system-controller.yaml +4 -2
@@ -53,9 +53,11 @@ patternProperties: "^clock-controller@[0-9a-f]+$": type: object - $ref: /schemas/clock/ti,am654-ehrpwm-tbclk.yaml# + oneOf: + - $ref: /schemas/clock/ti,am62-audio-refclk.yaml# + - $ref: /schemas/clock/ti,am654-ehrpwm-tbclk.yaml# description: - Clock provider for TI EHRPWM nodes. + Clock provider for TI EHRPWM or Audio Reference Clock nodes. "phy@[0-9a-f]+$": type: object
Signature · 1 line
2.34.1
PATCH RESEND v6 2/2 arm64: dts: ti: Add audio overlay for k3-j721s2-evm
In reply to Moteen ShahFrom: Jayesh Choudhary <[email protected]>
Add device tree overlay to enable analog audio support on J721S2-EVM using PCM3168A codec connected to McASP4 serializers.
- Add audio_refclk1 clock node to k3-j721s2-main.dtsi
- Add nodes for sound-card, audio codec, I2C3 and McASP4
- Add pinmux for I2C3, McASP4, AUDIO_EXT_REFCLK1 and WKUP_GPIO_0
- Add GPIO expander (TCA6408) for codec control
- Add GPIO hogs to route I2C3 lines and McASP serializers
- Set idle-state to 0 in mux0 and mux1 for McASP signal routing
--- arch/arm64/boot/dts/ti/Makefile | 4 + .../boot/dts/ti/k3-j721s2-evm-audio.dtso | 157 ++++++++++++++++++ arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi | 9 + 3 files changed, 170 insertions(+) create mode 100644 arch/arm64/boot/dts/ti/k3-j721s2-evm-audio.dtso
arch/arm64/boot/dts/ti/Makefile +4 -0
@@ -180,6 +180,7 @@ dtb-$(CONFIG_ARCH_K3) += k3-j721s2-common-proc-board.dtb dtb-$(CONFIG_ARCH_K3) += k3-j721s2-evm-gesi-exp-board.dtbo k3-j721s2-evm-dtbs := k3-j721s2-common-proc-board.dtb k3-j721s2-evm-gesi-exp-board.dtbo dtb-$(CONFIG_ARCH_K3) += k3-j721s2-evm.dtb +dtb-$(CONFIG_ARCH_K3) += k3-j721s2-evm-audio.dtbo dtb-$(CONFIG_ARCH_K3) += k3-j721s2-evm-pcie1-ep.dtbo dtb-$(CONFIG_ARCH_K3) += k3-j721s2-evm-usb0-type-a.dtbo
@@ -320,6 +321,8 @@ k3-j721e-evm-pcie1-ep-dtbs := k3-j721e-common-proc-board.dtb \ k3-j721e-evm-pcie1-ep.dtbo k3-j721e-sk-csi2-dual-imx219-dtbs := k3-j721e-sk.dtb \ k3-j721e-sk-csi2-dual-imx219.dtbo +k3-j721s2-evm-audio-dtbs := k3-j721s2-common-proc-board.dtb \ + k3-j721s2-evm-audio.dtbo k3-j721s2-evm-pcie1-ep-dtbs := k3-j721s2-common-proc-board.dtb \ k3-j721s2-evm-pcie1-ep.dtbo k3-j721s2-evm-usb0-type-a-dtbs := k3-j721s2-common-proc-board.dtb \
@@ -396,6 +399,7 @@ dtb- += k3-am625-beagleplay-csi2-ov5640.dtb \ k3-j721e-evm-pcie0-ep.dtb \ k3-j721e-evm-pcie1-ep.dtb \ k3-j721e-sk-csi2-dual-imx219.dtb \ + k3-j721s2-evm-audio.dtb \ k3-j721s2-evm-pcie1-ep.dtb \ k3-j721s2-evm-usb0-type-a.dtb \ k3-j722s-evm-csi2-quad-rpi-cam-imx219.dtb \
arch/arm64/boot/dts/ti/k3-j721s2-evm-audio.dtso new file +157 -0
157 lines not on this page · raw message
arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi +9 -0
@@ -74,6 +74,15 @@ ehrpwm_tbclk: clock-controller@140 { reg = <0x140 0x18>; #clock-cells = <1>; }; + + audio_refclk1: clock-controller@42e4 { + compatible = "ti,j721s2-audio-refclk", "ti,am62-audio-refclk"; + reg = <0x42e4 0x4>; + clocks = <&k3_clks 157 299>; + assigned-clocks = <&k3_clks 157 299>; + assigned-clock-parents = <&k3_clks 157 328>; + #clock-cells = <0>; + }; }; main_ehrpwm0: pwm@3000000 {
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH RESEND v6 2/2] arm64: dts: ti: Add audio overlay for k3-j721s2-evm
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] The commit message claims to 'Add GPIO hogs to route I2C3 lines and McASP serializers', but I2C3 routing is implemented using a dynamically managed gpio-mux (mux-controller) rather than a static GPIO hog.
Pre-existing issues:
- [High] Adding the mux-states property to the main_i2c3 node triggers a preexisting bug in the i2c-omap driver where the multiplexer control state is deselected twice on driver unbind, corrupting the multiplexer's semaphore lock. --
--- Patch [2]: [PATCH RESEND v6 2/2] arm64: dts: ti: Add audio overlay for k3-j721s2-evm --- commit b8739eb8a1b6fedb5e3ae2312559bc8686123be2
Author: Jayesh Choudhary <[email protected]>
arm64: dts: ti: Add audio overlay for k3-j721s2-evm
This patch adds a device tree overlay to enable analog audio support on the J721S2-EVM. It configures the sound-card, audio codec, I2C3, and McASP4 along with their respective pinmux and signal routing settings.
Quoted 1 line
- Add GPIO hogs to route I2C3 lines and McASP serializers
[Severity: Medium]
Is this commit message description accurate for the I2C3 routing?
Looking at the added overlay, I2C3 routing is implemented using a dynamically managed gpio-mux (mux-controller-2) rather than a static GPIO hog.
Quoted 4 lines
arch/arm64/boot/dts/ti/k3-j721s2-evm-audio.dtso new file +0
-0
[ ... ]
arch/arm64/boot/dts/ti/k3-j721s2-evm-audio.dtso line 112
Quoted 6 lines
+&main_i2c3 {
arch/arm64/boot/dts/ti/k3-j721s2-evm-audio.dtso new file +5
-0+ status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&main_i2c3_pins_default>; + clock-frequency = <400000>; + mux-states = <&i2c_mux 1>;
[Severity: High]
This is a pre-existing issue, but adding this property exposes a latent double-deselect bug in the i2c-omap driver during unbind.
The devm_mux_state_get_optional_selected() API registers a devres action that automatically calls mux_state_deselect(). However, the unbind path explicitly calls it again:
drivers/i2c/busses/i2c-omap.c:omap_i2c_remove() {
...
if (omap->mux_state)
mux_state_deselect(omap->mux_state);
...
}Because mux_control_deselect() unconditionally executes up(&mux->lock), would this double deselect increment the binary semaphore past 1 and break mutual exclusion for the multiplexer?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2