Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v1 0/2] Modify documentation and machine driver for SC7180 sound card
@ 2020-09-28  6:37 Ajye Huang
  2020-09-28  6:37 ` [PATCH v1 1/2] ASoC: qcom: dt-bindings: Modify sc7180 machine bindings Ajye Huang
  2020-09-28  6:37 ` [PATCH v1 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic Ajye Huang
  0 siblings, 2 replies; 8+ messages in thread
From: Ajye Huang @ 2020-09-28  6:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mark Brown, Rohit kumar, Banajit Goswami, Patrick Lai,
	Srinivasa Rao Mandadapu, Andy Gross, Bjorn Andersson,
	Liam Girdwood, Rob Herring, Jaroslav Kysela, cychiang, tzungbi,
	dianders, linux-arm-kernel, linux-arm-msm, devicetree,
	alsa-devel, Ajye Huang

Note:
- This patch depends on this patch series 
 ASoC: qcom: dt-bindings: Add sc7180 machine bindings
 https://patchwork.kernel.org/patch/11773221/
 ASoC: qcom: sc7180: Add machine driver for sound card registration
 https://patchwork.kernel.org/patch/11773223/
- The patch is made by the collaboration of
 Ajye Huang <ajye_huang@compal.corp-partner.google.com>
 Cheng-Yi Chiang <cychiang@chromium.org>

Thanks for the review!

Ajye Huang (2):
  ASoC: qcom: dt-bindings: Modify sc7180 machine bindings
  ASoC: qcom: sc7180: Modify machine driver for 2mic

 .../bindings/sound/qcom,sc7180.yaml           | 64 ++++++++++++++++++-
 sound/soc/qcom/sc7180.c                       | 60 +++++++++++++++++
 2 files changed, 123 insertions(+), 1 deletion(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 1/2] ASoC: qcom: dt-bindings: Modify sc7180 machine bindings
  2020-09-28  6:37 [PATCH v1 0/2] Modify documentation and machine driver for SC7180 sound card Ajye Huang
@ 2020-09-28  6:37 ` Ajye Huang
  2020-09-29 19:41   ` Rob Herring
  2020-10-09 13:52   ` Mark Brown
  2020-09-28  6:37 ` [PATCH v1 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic Ajye Huang
  1 sibling, 2 replies; 8+ messages in thread
From: Ajye Huang @ 2020-09-28  6:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mark Brown, Rohit kumar, Banajit Goswami, Patrick Lai,
	Srinivasa Rao Mandadapu, Andy Gross, Bjorn Andersson,
	Liam Girdwood, Rob Herring, Jaroslav Kysela, cychiang, tzungbi,
	dianders, linux-arm-kernel, linux-arm-msm, devicetree,
	alsa-devel, Ajye Huang

Add compatible "qcom,sc7180-sndcard-rt5682-m98357-2mic"
for 2mic case.

Signed-off-by: Ajye Huang <ajye_huang@compal.corp-partner.google.com>
---
This patch depends on this patch series
https://patchwork.kernel.org/patch/11773221/ .

 .../bindings/sound/qcom,sc7180.yaml           | 64 ++++++++++++++++++-
 1 file changed, 63 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml b/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml
index b77311bb5190..ec84dbfc1bc9 100644
--- a/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml
@@ -15,7 +15,9 @@ description:
 
 properties:
   compatible:
-    const: qcom,sc7180-sndcard-rt5682-m98357-1mic
+    enum:
+      - qcom,sc7180-sndcard-rt5682-m98357-1mic
+      - qcom,sc7180-sndcard-rt5682-m98357-2mic
 
   audio-routing:
     $ref: /schemas/types.yaml#/definitions/non-unique-string-array
@@ -34,6 +36,11 @@ properties:
   "#size-cells":
     const: 0
 
+  dmic-gpios:
+    description:
+      GPIO for switching between DMICs, it is required when
+      compatible is "qcom,sc7180-sndcard-rt5682-m98357-2mic".
+
 patternProperties:
   "^dai-link(@[0-9])?$":
     description:
@@ -81,6 +88,7 @@ additionalProperties: false
 examples:
 
   - |
+    //Example 1
     sound {
         compatible = "qcom,sc7180-sndcard-rt5682-m98357-1mic";
         model = "sc7180-snd-card";
@@ -128,3 +136,57 @@ examples:
             };
         };
     };
+
+  - |
+    //Example 2 (2mic case)
+    sound {
+        compatible = "qcom,sc7180-sndcard-rt5682-m98357-2mic";
+        model = "sc7180-snd-card";
+
+        audio-routing =
+                    "Headphone Jack", "HPOL",
+                    "Headphone Jack", "HPOR";
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        dmic-gpios = <&tlmm 86 0>;
+
+        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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic
  2020-09-28  6:37 [PATCH v1 0/2] Modify documentation and machine driver for SC7180 sound card Ajye Huang
  2020-09-28  6:37 ` [PATCH v1 1/2] ASoC: qcom: dt-bindings: Modify sc7180 machine bindings Ajye Huang
@ 2020-09-28  6:37 ` Ajye Huang
  1 sibling, 0 replies; 8+ messages in thread
From: Ajye Huang @ 2020-09-28  6:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mark Brown, Rohit kumar, Banajit Goswami, Patrick Lai,
	Srinivasa Rao Mandadapu, Andy Gross, Bjorn Andersson,
	Liam Girdwood, Rob Herring, Jaroslav Kysela, cychiang, tzungbi,
	dianders, linux-arm-kernel, linux-arm-msm, devicetree,
	alsa-devel, Ajye Huang

In addition, having mixer control to switch between DMICs for
"qcom,sc7180-sndcard-rt5682-m98357-2mic" 2mic case.

Refer to this one as an example,
commit b7a742cff3f6 ("ASoC: AMD: Use mixer control to switch between DMICs")

Signed-off-by: Ajye Huang <ajye_huang@compal.corp-partner.google.com>
---
This patch depends on this patch series
https://patchwork.kernel.org/patch/11773223/ .


 sound/soc/qcom/sc7180.c | 60 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/sound/soc/qcom/sc7180.c b/sound/soc/qcom/sc7180.c
index 0e90448523b0..c8751fb9f9bf 100644
--- a/sound/soc/qcom/sc7180.c
+++ b/sound/soc/qcom/sc7180.c
@@ -5,6 +5,8 @@
 // sc7180.c -- ALSA SoC Machine driver for SC7180
 
 #include <dt-bindings/sound/sc7180-lpass.h>
+#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
@@ -24,6 +26,9 @@
 // This will be defined in include/dt-bindings/sound/sc7180-lpass.h
 #define LPASS_DP_RX 2
 
+static struct gpio_desc *dmic_sel;
+static int dmic_switch;
+
 struct sc7180_snd_data {
 	struct snd_soc_card card;
 	u32 pri_mi2s_clk_count;
@@ -170,6 +175,23 @@ static int sc7180_snd_startup(struct snd_pcm_substream *substream)
 	return 0;
 }
 
+static int dmic_get(struct snd_kcontrol *kcontrol,
+		    struct snd_ctl_elem_value *ucontrol)
+{
+	ucontrol->value.integer.value[0] = dmic_switch;
+	return 0;
+}
+
+static int dmic_set(struct snd_kcontrol *kcontrol,
+		    struct snd_ctl_elem_value *ucontrol)
+{
+	if (dmic_sel) {
+		dmic_switch = ucontrol->value.integer.value[0];
+		gpiod_set_value(dmic_sel, dmic_switch);
+	}
+	return 0;
+}
+
 static void sc7180_snd_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -207,6 +229,30 @@ static const struct snd_soc_dapm_widget sc7180_snd_widgets[] = {
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
 };
 
+static const char * const dmic_mux_text[] = {
+	"Front Mic",
+	"Rear Mic",
+};
+
+static SOC_ENUM_SINGLE_DECL(sc7180_dmic_enum,
+			    SND_SOC_NOPM, 0, dmic_mux_text);
+
+static const struct snd_kcontrol_new sc7180_dmic_mux_control =
+	SOC_DAPM_ENUM_EXT("DMIC Select Mux", sc7180_dmic_enum,
+			  dmic_get, dmic_set);
+
+static const struct snd_soc_dapm_widget sc7180_snd_dual_mic_widgets[] = {
+	SND_SOC_DAPM_HP("Headphone Jack", NULL),
+	SND_SOC_DAPM_MIC("Headset Mic", NULL),
+	SND_SOC_DAPM_MIC("DMIC", NULL),
+	SND_SOC_DAPM_MUX("Dmic Mux", SND_SOC_NOPM, 0, 0, &sc7180_dmic_mux_control),
+};
+
+static const struct snd_soc_dapm_route sc7180_snd_dual_mic_audio_route[] = {
+	{"Dmic Mux", "Front Mic", "DMIC"},
+	{"Dmic Mux", "Rear Mic", "DMIC"},
+};
+
 static void sc7180_add_ops(struct snd_soc_card *card)
 {
 	struct snd_soc_dai_link *link;
@@ -238,6 +284,19 @@ static int sc7180_snd_platform_probe(struct platform_device *pdev)
 	card->dapm_widgets = sc7180_snd_widgets;
 	card->num_dapm_widgets = ARRAY_SIZE(sc7180_snd_widgets);
 
+	if (of_device_is_compatible(dev->of_node, "qcom,sc7180-sndcard-rt5682-m98357-2mic")) {
+		card->dapm_widgets = sc7180_snd_dual_mic_widgets,
+		card->num_dapm_widgets = ARRAY_SIZE(sc7180_snd_dual_mic_widgets),
+		card->dapm_routes = sc7180_snd_dual_mic_audio_route,
+		card->num_dapm_routes = ARRAY_SIZE(sc7180_snd_dual_mic_audio_route),
+		dmic_sel = devm_gpiod_get(&pdev->dev, "dmic", GPIOD_OUT_LOW);
+		if (IS_ERR(dmic_sel)) {
+			dev_err(&pdev->dev, "DMIC gpio failed err=%d\n",
+				PTR_ERR(dmic_sel));
+				return PTR_ERR(dmic_sel);
+		}
+	}
+
 	ret = qcom_snd_parse_of(card);
 	if (ret)
 		return ret;
@@ -249,6 +308,7 @@ static int sc7180_snd_platform_probe(struct platform_device *pdev)
 
 static const struct of_device_id sc7180_snd_device_id[]  = {
 	{ .compatible = "qcom,sc7180-sndcard-rt5682-m98357-1mic" },
+	{ .compatible = "qcom,sc7180-sndcard-rt5682-m98357-2mic" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sc7180_snd_device_id);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] ASoC: qcom: dt-bindings: Modify sc7180 machine bindings
  2020-09-28  6:37 ` [PATCH v1 1/2] ASoC: qcom: dt-bindings: Modify sc7180 machine bindings Ajye Huang
@ 2020-09-29 19:41   ` Rob Herring
  2020-10-09 13:52   ` Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Rob Herring @ 2020-09-29 19:41 UTC (permalink / raw)
  To: Ajye Huang
  Cc: Jaroslav Kysela, Andy Gross, linux-arm-kernel, Patrick Lai,
	Rohit kumar, Srinivasa Rao Mandadapu, tzungbi, Ajye Huang,
	alsa-devel, dianders, Banajit Goswami, Bjorn Andersson,
	Rob Herring, devicetree, Liam Girdwood, linux-arm-msm,
	Mark Brown, cychiang, linux-kernel

On Mon, 28 Sep 2020 14:37:43 +0800, Ajye Huang wrote:
> Add compatible "qcom,sc7180-sndcard-rt5682-m98357-2mic"
> for 2mic case.
> 
> Signed-off-by: Ajye Huang <ajye_huang@compal.corp-partner.google.com>
> ---
> This patch depends on this patch series
> https://patchwork.kernel.org/patch/11773221/ .
> 
>  .../bindings/sound/qcom,sc7180.yaml           | 64 ++++++++++++++++++-
>  1 file changed, 63 insertions(+), 1 deletion(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] ASoC: qcom: dt-bindings: Modify sc7180 machine bindings
  2020-09-28  6:37 ` [PATCH v1 1/2] ASoC: qcom: dt-bindings: Modify sc7180 machine bindings Ajye Huang
  2020-09-29 19:41   ` Rob Herring
@ 2020-10-09 13:52   ` Mark Brown
  2020-10-09 16:07     ` Ajye Huang
  1 sibling, 1 reply; 8+ messages in thread
From: Mark Brown @ 2020-10-09 13:52 UTC (permalink / raw)
  To: Ajye Huang
  Cc: linux-kernel, dianders, devicetree, alsa-devel, Banajit Goswami,
	Srinivasa Rao Mandadapu, Liam Girdwood, linux-arm-msm,
	Patrick Lai, Ajye Huang, Andy Gross, Rob Herring,
	Bjorn Andersson, Rohit kumar, tzungbi, linux-arm-kernel,
	cychiang


[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

On Mon, Sep 28, 2020 at 02:37:43PM +0800, Ajye Huang wrote:
> Add compatible "qcom,sc7180-sndcard-rt5682-m98357-2mic"
> for 2mic case.

This doesn't apply against current code, please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] ASoC: qcom: dt-bindings: Modify sc7180 machine bindings
  2020-10-09 13:52   ` Mark Brown
@ 2020-10-09 16:07     ` Ajye Huang
  2020-10-12 13:50       ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Ajye Huang @ 2020-10-09 16:07 UTC (permalink / raw)
  To: Mark Brown
  Cc: Ajye Huang, linux-kernel, dianders, devicetree, alsa-devel,
	Banajit Goswami, Srinivasa Rao Mandadapu, Liam Girdwood,
	linux-arm-msm, Patrick Lai, Andy Gross, Rob Herring,
	Bjorn Andersson, Rohit kumar, tzungbi, linux-arm-kernel,
	Cheng-yi Chiang

On Fri, Oct 9, 2020 at 9:52 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Mon, Sep 28, 2020 at 02:37:43PM +0800, Ajye Huang wrote:
> > Add compatible "qcom,sc7180-sndcard-rt5682-m98357-2mic"
> > for 2mic case.
>
> This doesn't apply against current code, please check and resend.

Hi, Mark

Thank you for your reply,
This patch depends on  Cheng-Yi's patch series
https://patchwork.kernel.org/patch/11773221/.

  If I misunderstand what you mean, please correct me,
Thank you,

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] ASoC: qcom: dt-bindings: Modify sc7180 machine bindings
  2020-10-09 16:07     ` Ajye Huang
@ 2020-10-12 13:50       ` Mark Brown
  2020-10-15 13:46         ` Ajye Huang
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2020-10-12 13:50 UTC (permalink / raw)
  To: Ajye Huang
  Cc: Ajye Huang, linux-kernel, dianders, devicetree, alsa-devel,
	Banajit Goswami, Srinivasa Rao Mandadapu, Liam Girdwood,
	linux-arm-msm, Patrick Lai, Andy Gross, Rob Herring,
	Bjorn Andersson, Rohit kumar, tzungbi, linux-arm-kernel,
	Cheng-yi Chiang


[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]

On Sat, Oct 10, 2020 at 12:07:54AM +0800, Ajye Huang wrote:
> On Fri, Oct 9, 2020 at 9:52 PM Mark Brown <broonie@kernel.org> wrote:
> > On Mon, Sep 28, 2020 at 02:37:43PM +0800, Ajye Huang wrote:

> > > Add compatible "qcom,sc7180-sndcard-rt5682-m98357-2mic"
> > > for 2mic case.

> > This doesn't apply against current code, please check and resend.

> Thank you for your reply,
> This patch depends on  Cheng-Yi's patch series
> https://patchwork.kernel.org/patch/11773221/.

That's "ASoC: qcom: dt-bindings: Add sc7180 machine bindings" for those
playing at home.

>   If I misunderstand what you mean, please correct me,

A version of some SC7180 patches was applied.  However it does seem like
that didn't include any machine driver bindings so it must've been a
different, similar looking series which is presumably waiting for a new
version - please resend based on that new version (ideally these patches
could be picked up as part of that series).

Please include human readable descriptions of things like commits and
issues being discussed in e-mail in your mails, this makes them much
easier for humans to read especially when they have no internet access.
I do frequently catch up on my mail on flights or while otherwise
travelling so this is even more pressing for me than just being about
making things a bit easier to read.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] ASoC: qcom: dt-bindings: Modify sc7180 machine bindings
  2020-10-12 13:50       ` Mark Brown
@ 2020-10-15 13:46         ` Ajye Huang
  0 siblings, 0 replies; 8+ messages in thread
From: Ajye Huang @ 2020-10-15 13:46 UTC (permalink / raw)
  To: Mark Brown
  Cc: Ajye Huang, linux-kernel, Douglas Anderson, devicetree,
	alsa-devel, Banajit Goswami, Srinivasa Rao Mandadapu,
	Liam Girdwood, linux-arm-msm, Patrick Lai, Andy Gross,
	Rob Herring, Bjorn Andersson, Rohit kumar, tzungbi,
	linux-arm-kernel, Cheng-yi Chiang

On Mon, Oct 12, 2020 at 9:50 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Sat, Oct 10, 2020 at 12:07:54AM +0800, Ajye Huang wrote:
> > On Fri, Oct 9, 2020 at 9:52 PM Mark Brown <broonie@kernel.org> wrote:
> > > On Mon, Sep 28, 2020 at 02:37:43PM +0800, Ajye Huang wrote:
>
> > > > Add compatible "qcom,sc7180-sndcard-rt5682-m98357-2mic"
> > > > for 2mic case.
>
> > > This doesn't apply against current code, please check and resend.
>
> > Thank you for your reply,
> > This patch depends on  Cheng-Yi's patch series
> > https://patchwork.kernel.org/patch/11773221/.
>
> That's "ASoC: qcom: dt-bindings: Add sc7180 machine bindings" for those
> playing at home.
>
> >   If I misunderstand what you mean, please correct me,
>
> A version of some SC7180 patches was applied.  However it does seem like
> that didn't include any machine driver bindings so it must've been a
> different, similar looking series which is presumably waiting for a new
> version - please resend based on that new version (ideally these patches
> could be picked up as part of that series).
>
> Please include human readable descriptions of things like commits and
> issues being discussed in e-mail in your mails, this makes them much
> easier for humans to read especially when they have no internet access.
> I do frequently catch up on my mail on flights or while otherwise
> travelling so this is even more pressing for me than just being about
> making things a bit easier to read.

Hi, Mark

Thank you for your reply, I understand you point now, I will resend
when it is done.

thank you.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28  6:37 [PATCH v1 0/2] Modify documentation and machine driver for SC7180 sound card Ajye Huang
2020-09-28  6:37 ` [PATCH v1 1/2] ASoC: qcom: dt-bindings: Modify sc7180 machine bindings Ajye Huang
2020-09-29 19:41   ` Rob Herring
2020-10-09 13:52   ` Mark Brown
2020-10-09 16:07     ` Ajye Huang
2020-10-12 13:50       ` Mark Brown
2020-10-15 13:46         ` Ajye Huang
2020-09-28  6:37 ` [PATCH v1 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic Ajye Huang

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org
	public-inbox-index linux-arm-msm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git