Skip to content

ASoC: rt5631: Support an MCLK clock from the SoC

Romain TISSERAND linux-devicetree linux-sound lkml sashiko-reviews 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Patch 2: get the clock in the I2C probe, as rt5616 does since
b5c9df40ca56: from the component probe a deferral was lost and a rebind leaked the clock (reported by Sashiko).
- Patch 1: unchanged; picked up Krzysztof's Reviewed-by.
- v1: https://lore.kernel.org/all/[email protected]/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2ASoC: dt-bindings: realtek,rt5631: Add the optional MCLKDocumentation/devicetree/bindings/sound/realtek,rt5631.yaml+8 -00 replies
2/2ASoC: codecs: rt5631: Enable the optional MCLKsound/soc/codecs/rt5631.c+17 -10 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchKrzysztof Kozlowski
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] ASoC: rt5631: Support an MCLK clock from the SoC

The RT5631 driver doesn't take a master clock, so when MCLK comes from a SoC clock output, that clock is turned off at boot as unused. This series adds an optional "mclk" clock to the binding and enables it in the driver while the codec is active, as rt5616 does.

The board that needs it is the GPD XD (RK3288), whose device tree is not upstream yet. Its MCLK is i2s0_clkout: handed to simple-audio-card, the mux picked the 12 MHz oscillator for 12.288 MHz (wrong pitch); held by the codec, it follows the I2S clock, as on the RK3288 boards with ES8388 and MAX98090 codecs.

Changes in v2:
- Patch 2: get the clock in the I2C probe, as rt5616 does since
b5c9df40ca56: from the component probe a deferral was lost and a rebind leaked the clock (reported by Sashiko).
- Patch 1: unchanged; picked up Krzysztof's Reviewed-by.
- v1: https://lore.kernel.org/all/[email protected]/

Testing: dt_binding_check for realtek,rt5631.yaml; W=1 builds for arm (multi_v7) and arm64 (defconfig) with SND_SOC_RT5631=y and =m, no warnings. Tested live on the GPD XD (RT5631 on simple-audio-card, mclk-fs 256) on 6.18.54 with this change backported (the bias level read uses snd_soc_component_get_bias_level() there): i2s0_clkout stays on the I2S clock at 11.2896 MHz for 44.1 kHz and 12.288 MHz for 48 kHz, and both play at the right pitch; v2 tested the same way, with the clock taken in the I2C probe. Boards without an "mclk" clock are not affected (clk_prepare_enable() on a NULL clock does nothing); not tested on other boards.

Tool disclosure: this series was prepared with Claude Opus 5.5 (Anthropic) as a coding assistant, in an interactive session where I asked it to fix the pitch problem without the RK3288 clock change that was refused in 2014. It traced the clock ordering in simple-audio-card, proposed taking the clock in the codec driver following rt5616, and drafted the patches and the messages; v2 follows the Sashiko review. I reviewed and understand them, and tested them on the GPD XD as described above.

Romain TISSERAND (2):
ASoC: dt-bindings: realtek,rt5631: Add the optional MCLK
ASoC: codecs: rt5631: Enable the optional MCLK

 .../bindings/sound/realtek,rt5631.yaml         |  8 ++++++++
 sound/soc/codecs/rt5631.c                      | 18 +++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

base-commit: cc3fc99f1bce93c3ae3771ef98cb91a566da857e

Signature · 1 line
2.43.0