mbox series

[v5,0/2] Modify documentation and machine driver for SC7180 sound card

Message ID 20201103103051.34553-1-ajye_huang@compal.corp-partner.google.com
Headers show
Series Modify documentation and machine driver for SC7180 sound card | expand

Message

Ajye Huang Nov. 3, 2020, 10:30 a.m. UTC
Note:
- The patch is made by the collaboration of
 Ajye Huang <ajye_huang@compal.corp-partner.google.com>
 Cheng-Yi Chiang <cychiang@chromium.org>

v5:
- Machine driver:
  - Fix a format string warning (Reported-by: kernel test robot <lkp@intel.com>).
    detailed info at https://lore.kernel.org/patchwork/patch/1331087/

v4:
- Machine driver: Addressed suggestions from Tzung-Bi.
  - Remove redundant judgments in dmic_set() and dmic_get().
  - Remove 1 level indent of judgment of IS_ERR(data->dmic_sel).

v3:
- Machine driver: Addressed suggestions from Tzung-Bi.
  - move variables "dmic_switch" and "dmic_sel" into struct sc7180_snd_data.
  - Remove redundant judgments in dmic_set().

v2:
- Documentation: Modify the dimc-gpios property description and examples.
- Machine driver: 
  - Remove "qcom,sc7180-sndcard-rt5682-m98357-2mic" compatible
  - See gpio property and use anadditional control.

Thanks for the review!

Ajye Huang (2):
  ASoC: google: dt-bindings: modify machine bindings for two MICs case
  ASoC: qcom: sc7180: Modify machine driver for 2mic

 .../bindings/sound/google,sc7180-trogdor.yaml | 58 ++++++++++++++++++
 sound/soc/qcom/sc7180.c                       | 61 +++++++++++++++++++
 2 files changed, 119 insertions(+)

Comments

Rob Herring (Arm) Nov. 5, 2020, 6:43 p.m. UTC | #1
On Tue, Nov 03, 2020 at 06:30:50PM +0800, Ajye Huang wrote:
> Add a property "dmic-gpios" for switching between two MICs.
> 
> Signed-off-by: Ajye Huang <ajye_huang@compal.corp-partner.google.com>
> ---
>  .../bindings/sound/google,sc7180-trogdor.yaml | 58 +++++++++++++++++++
>  1 file changed, 58 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml b/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
> index efc34689d6b5..9e0505467e57 100644
> --- a/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
> +++ b/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
> @@ -34,6 +34,9 @@ properties:
>    "#size-cells":
>      const: 0
>  
> +  dmic-gpios:
> +    description: GPIO for switching between DMICs

Need to define how many (maxItems: 1).

> +
>  patternProperties:
>    "^dai-link(@[0-9])?$":
>      description:
> @@ -81,6 +84,7 @@ additionalProperties: false
>  examples:
>  
>    - |
> +    //Example 1
>      sound {
>          compatible = "google,sc7180-trogdor";
>          model = "sc7180-rt5682-max98357a-1mic";
> @@ -128,3 +132,57 @@ examples:
>              };
>          };
>      };
> +
> +  - |
> +    //Example 2 (2mic case)
> +    sound {
> +        compatible = "google,sc7180-trogdor";
> +        model = "sc7180-rt5682-max98357a-2mic";
> +
> +        audio-routing =
> +                    "Headphone Jack", "HPOL",
> +                    "Headphone Jack", "HPOR";
> +
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        dmic-gpios = <&tlmm 86 0>;

Do we really need another example for this? Can't you just add it to the 
existing example?

> +
> +        dai-link@0 {
> +            link-name = "MultiMedia0";
> +            reg = <0>;
> +            cpu {
> +                sound-dai = <&lpass_cpu 0>;
> +            };
> +
> +            codec {
> +                sound-dai = <&alc5682 0>;
> +            };
> +        };
> +
> +        dai-link@1 {
> +            link-name = "MultiMedia1";
> +            reg = <1>;
> +            cpu {
> +                sound-dai = <&lpass_cpu 1>;
> +            };
> +
> +            codec {
> +                sound-dai = <&max98357a>;
> +            };
> +        };
> +
> +        dai-link@2 {
> +            link-name = "MultiMedia2";
> +            reg = <2>;
> +            cpu {
> +                sound-dai = <&lpass_hdmi 0>;
> +            };
> +
> +            codec {
> +                sound-dai = <&msm_dp>;
> +            };
> +        };
> +    };
> +
> +...
> -- 
> 2.25.1
>
Ajye Huang Nov. 6, 2020, 3:48 a.m. UTC | #2
HI, Rob,

Thank you for the comments.


On Fri, Nov 6, 2020 at 2:43 AM Rob Herring <robh@kernel.org> wrote:
>
> On Tue, Nov 03, 2020 at 06:30:50PM +0800, Ajye Huang wrote:
> > Add a property "dmic-gpios" for switching between two MICs.
> >
> > Signed-off-by: Ajye Huang <ajye_huang@compal.corp-partner.google.com>
> > ---
> >  .../bindings/sound/google,sc7180-trogdor.yaml | 58 +++++++++++++++++++
> >  1 file changed, 58 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml b/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
> > index efc34689d6b5..9e0505467e57 100644
> > --- a/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
> > +++ b/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
> > @@ -34,6 +34,9 @@ properties:
> >    "#size-cells":
> >      const: 0
> >
> > +  dmic-gpios:
> > +    description: GPIO for switching between DMICs
>
> Need to define how many (maxItems: 1).

Yes, I will add in the v6 version.

>
> > +
> >  patternProperties:
> >    "^dai-link(@[0-9])?$":
> >      description:
> > @@ -81,6 +84,7 @@ additionalProperties: false
> >  examples:
> >
> >    - |
> > +    //Example 1
> >      sound {
> >          compatible = "google,sc7180-trogdor";
> >          model = "sc7180-rt5682-max98357a-1mic";
> > @@ -128,3 +132,57 @@ examples:
> >              };
> >          };
> >      };
> > +
> > +  - |
> > +    //Example 2 (2mic case)
> > +    sound {
> > +        compatible = "google,sc7180-trogdor";
> > +        model = "sc7180-rt5682-max98357a-2mic";
> > +
> > +        audio-routing =
> > +                    "Headphone Jack", "HPOL",
> > +                    "Headphone Jack", "HPOR";
> > +
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        dmic-gpios = <&tlmm 86 0>;
>
> Do we really need another example for this? Can't you just add it to the
> existing example?

I think just keep One example. I will remove the example2 and put
dmic-gpios = <&tlmm 86 0>; in the first example and
modify the model from "sc7180-rt5682-max98357a-1mic" to
"sc7180-rt5682-max98357a-2mic". It looks clear.

>
> > +
> > +        dai-link@0 {
> > +            link-name = "MultiMedia0";
> > +            reg = <0>;
> > +            cpu {
> > +                sound-dai = <&lpass_cpu 0>;
> > +            };
> > +
> > +            codec {
> > +                sound-dai = <&alc5682 0>;
> > +            };
> > +        };
> > +
> > +        dai-link@1 {
> > +            link-name = "MultiMedia1";
> > +            reg = <1>;
> > +            cpu {
> > +                sound-dai = <&lpass_cpu 1>;
> > +            };
> > +
> > +            codec {
> > +                sound-dai = <&max98357a>;
> > +            };
> > +        };
> > +
> > +        dai-link@2 {
> > +            link-name = "MultiMedia2";
> > +            reg = <2>;
> > +            cpu {
> > +                sound-dai = <&lpass_hdmi 0>;
> > +            };
> > +
> > +            codec {
> > +                sound-dai = <&msm_dp>;
> > +            };
> > +        };
> > +    };
> > +
> > +...
> > --
> > 2.25.1
> >