Re: [PATCH v7 2/3] ASoC: qcom: dt-bindings: Add sc7180 machine bindings

Cheng-yi Chiang
2020-09-09T10:20:00Z

On Wed, Sep 9, 2020 at 5:23 PM Cheng-yi Chiang <cychiang@chromium.org> wrote:
>
> On Wed, Sep 9, 2020 at 4:34 AM Rob Herring <robh@kernel.org> wrote:
> >
> > On Mon, Sep 07, 2020 at 06:00:38PM +0800, Cheng-Yi Chiang wrote:
> > > Add devicetree bindings documentation file for sc7180 sound card.
> > >
> > > Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> > > ---
> > > .../bindings/sound/qcom,sc7180.yaml | 143 ++++++++++++++++++
> > > 1 file changed, 143 insertions(+)
> > > create mode 100644 Documentation/devicetree/bindings/sound/qcom,sc7180.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml b/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml
> > > new file mode 100644
> > > index 000000000000..ae809346ca80
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml
> > > @@ -0,0 +1,143 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/sound/qcom,sc7180.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Qualcomm Technologies Inc. SC7180 ASoC sound card driver
> > > +
> > > +maintainers:
> > > + - Rohit kumar <rohitkr@codeaurora.org>
> > > + - Cheng-Yi Chiang <cychiang@chromium.org>
> > > +
> > > +description:
> > > + This binding describes the SC7180 sound card which uses LPASS for audio.
> > > +
> > > +properties:
> > > + compatible:
> > > + const: qcom,sc7180-sndcard
> > > +
> > > + audio-routing:
> > > + $ref: /schemas/types.yaml#/definitions/non-unique-string-array
> > > + description:
> > > + A list of the connections between audio components. Each entry is a
> > > + pair of strings, the first being the connection's sink, the second
> > > + being the connection's source.
> > > +
> > > + model:
> > > + $ref: /schemas/types.yaml#/definitions/string
> > > + description: User specified audio sound card name
> > > +
> > > + headset-jack:
> > > + $ref: /schemas/types.yaml#/definitions/phandle
> > > + description: phandle of the codec for headset detection
> > > +
> > > + hdmi-jack:
> > > + $ref: /schemas/types.yaml#/definitions/phandle
> > > + description: phandle of the codec for hdmi jack detection
> >
> > You already have links to these devices. Why duplicate it here?
> >
> > What if you had 2 headsets? This doesn't scale.
> >
> Hi Rob, thanks for reviewing.
> There was some discussion in
> https://patchwork.kernel.org/patch/11737905/#23571643 about how to
> specify the dailink that has a headset jack.
> I would like to pass the information of headset jack and hdmi jack to
> the machine driver so the machine driver can call
> snd_soc_component_set_jack to set jack when init the corresponding link.
> Headset jack and hdmi jack will be treated differently for button and
> event type.
> Because of this, we can not just set a property "jack" in the link.
>
> As for the 2 headsets case (I guess you mean hp jack and mic jack), on
> this board we will not have this use case.
> If someone really wants to build hp jack and mic jack on the board
> based on this machine driver, we can add two more property hp-jack and
> mic-jack to specify that,
> as the machine driver will need to know the different jack types
> anyway. What do you think ?
>
> Or could you please suggest a proper way to pass such information ?
>
> Thanks!
> >
Alternatively we can probably do

dai-link@0 {
link-name = "MultiMedia0";
reg = <0>;
cpu {
sound-dai = <&lpass_cpu 0>;
};
headset_jack;
codec {
sound-dai = <&alc5682 0>;
};
};
dai-link@2 {
link-name = "MultiMedia2";
reg = <2>;
cpu {
sound-dai = <&lpass_hdmi 0>;
};
hdmi_jack;
codec {
sound-dai = <&msm_dp>;
};
};

Or even put the flag into codec {}.
Please let me know if you feel this is a better way.
I think it will make the driver code a little more complicated, but
the interface on dts might looks cleaner.
Thanks!

> > Rob