Re: [v1 2/3] arm64: dts: qcom: sc7280: Add sc7280-herobrine-audio-rt5682.dtsi

Matthias Kaehlcke
2022-05-19T16:04:27Z

On Thu, May 19, 2022 at 08:41:18AM +0000, Judy Hsiao wrote:
> Audio dtsi for sc7280 boards that using rt5682 headset codec:
> 1. Add dt nodes for sound card which use I2S playback and record
> through rt5682s and I2S playback through max98357a.
> 2. Enable lpass cpu node and add pin control and dai-links.
>
> Signed-off-by: Judy Hsiao <judyhsiao@chromium.org>

A general note: this series depends on others like "Add lpass pin
control support for audio on sc7280 based targets" [1] and "Add
soundcard support for sc7280 based platforms" [2]. This should be
mentioned somewhere, either in the cover letter or after '---'.

[1] https://patchwork.kernel.org/project/linux-arm-msm/list/?series=638776
[2] https://patchwork.kernel.org/project/linux-arm-msm/list/?series=638274

> ---
> .../qcom/sc7280-herobrine-audio-rt5682.dtsi | 121 ++++++++++++++++++
> 1 file changed, 121 insertions(+)
> create mode 100644 arch/arm64/boot/dts/qcom/sc7280-herobrine-audio-rt5682.dtsi
>
> diff --git a/arch/arm64/boot/dts/qcom/sc7280-herobrine-audio-rt5682.dtsi b/arch/arm64/boot/dts/qcom/sc7280-herobrine-audio-rt5682.dtsi
> new file mode 100644
> index 000000000000..9e449817f6fd
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/sc7280-herobrine-audio-rt5682.dtsi
> @@ -0,0 +1,121 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + *
> + * This file defines the common audio settings for the child boards using rt5682 codec.
> + *
> + * Copyright 2022 Google LLC.
> + */
> +
> +/ {
> + /* BOARD-SPECIFIC TOP LEVEL NODES */
> + sound: sound {
> + compatible = "google,sc7280-herobrine";
> + model = "sc7280-rt5682-max98360a-1mic";
> +
> + status = "okay";
> + audio-routing =
> + "Headphone Jack", "HPOL",
> + "Headphone Jack", "HPOR";
> +
> + #address-cells = <1>;
> + #size-cells = <0>;
> + #sound-dai-cells = <0>;

Is 'sound-dai-cells' really needed here? The binding doesn't mention it and
the sound card isn't really a DAI.

> +
> + dai-link@0 {
> + link-name = "MAX98360";
> + reg = <0>;

Eventually the 'reg' property should be removed from the binding and DTs
([1], [2]), but for now it is needed to match the binding.

[1] https://patchwork.kernel.org/project/linux-arm-msm/patch/1649863277-31615-5-git-send-email-quic_srivasam@quicinc.com/
[2] https://patchwork.kernel.org/project/linux-arm-msm/patch/1650291252-30398-5-git-send-email-quic_srivasam@quicinc.com/

> +
> + cpu {
> + sound-dai = <&lpass_cpu MI2S_SECONDARY>;
> + };
> +
> + codec {
> + sound-dai = <&max98360a>;
> + };
> + };
> +
> + dai-link@1 {
> + link-name = "ALC5682";
> + reg = <1>;
> +
> + cpu {
> + sound-dai = <&lpass_cpu MI2S_PRIMARY>;
> + };
> +
> + codec {
> + sound-dai = <&alc5682 0 /* aif1 */>;
> + };
> + };
> + };
> +};
> +
> +hp_i2c: &i2c2 {
> + status = "okay";
> + clock-frequency = <400000>;
> +
> + alc5682: codec@1a {
> + compatible = "realtek,rt5682s";
> + reg = <0x1a>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&hp_irq>;
> +
> + #sound-dai-cells = <1>;
> +
> + interrupt-parent = <&tlmm>;
> + interrupts = <101 IRQ_TYPE_EDGE_BOTH>;
> +
> + AVDD-supply = <&pp1800_alc5682>;
> + MICVDD-supply = <&pp3300_codec>;

The regulators are not mentioned in the binding, but the driver
expects them, so I guess this is fine (maybe the binding should
be updated in a separate patch?).