All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Modify documentation and machine driver for SC7180 sound card
@ 2020-11-02  6:24 ` Ajye Huang
  0 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02  6:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mark Brown, Rohit kumar, Banajit Goswami, Patrick Lai,
	Srinivasa Rao Mandadapu, srinivas.kandagatla, 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:
- The patch is made by the collaboration of
 Ajye Huang <ajye_huang@compal.corp-partner.google.com>
 Cheng-Yi Chiang <cychiang@chromium.org>

Changes from v1 to v2:
- Ducumentation: 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.

Changes from v2 to 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(). 
  
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                       | 65 +++++++++++++++++++
 2 files changed, 123 insertions(+)

-- 
2.25.1


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

* [PATCH v3 0/2] Modify documentation and machine driver for SC7180 sound card
@ 2020-11-02  6:24 ` Ajye Huang
  0 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02  6:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: dianders, devicetree, alsa-devel, Banajit Goswami,
	Srinivasa Rao Mandadapu, Liam Girdwood, linux-arm-msm,
	Patrick Lai, Ajye Huang, Andy Gross, Rob Herring,
	Bjorn Andersson, Mark Brown, Rohit kumar, tzungbi,
	srinivas.kandagatla, linux-arm-kernel, cychiang

Note:
- The patch is made by the collaboration of
 Ajye Huang <ajye_huang@compal.corp-partner.google.com>
 Cheng-Yi Chiang <cychiang@chromium.org>

Changes from v1 to v2:
- Ducumentation: 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.

Changes from v2 to 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(). 
  
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                       | 65 +++++++++++++++++++
 2 files changed, 123 insertions(+)

-- 
2.25.1


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

* [PATCH v3 0/2] Modify documentation and machine driver for SC7180 sound card
@ 2020-11-02  6:24 ` Ajye Huang
  0 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02  6:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: dianders, devicetree, alsa-devel, Banajit Goswami,
	Srinivasa Rao Mandadapu, Liam Girdwood, linux-arm-msm,
	Patrick Lai, Ajye Huang, Andy Gross, Rob Herring,
	Bjorn Andersson, Mark Brown, Rohit kumar, tzungbi,
	srinivas.kandagatla, Jaroslav Kysela, linux-arm-kernel, cychiang

Note:
- The patch is made by the collaboration of
 Ajye Huang <ajye_huang@compal.corp-partner.google.com>
 Cheng-Yi Chiang <cychiang@chromium.org>

Changes from v1 to v2:
- Ducumentation: 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.

Changes from v2 to 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(). 
  
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                       | 65 +++++++++++++++++++
 2 files changed, 123 insertions(+)

-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v3 1/2] ASoC: google: dt-bindings: modify machine bindings for two MICs case
  2020-11-02  6:24 ` Ajye Huang
  (?)
@ 2020-11-02  6:24   ` Ajye Huang
  -1 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02  6:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mark Brown, Rohit kumar, Banajit Goswami, Patrick Lai,
	Srinivasa Rao Mandadapu, srinivas.kandagatla, 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 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
+
 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>;
+
+        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 related	[flat|nested] 15+ messages in thread

* [PATCH v3 1/2] ASoC: google: dt-bindings: modify machine bindings for two MICs case
@ 2020-11-02  6:24   ` Ajye Huang
  0 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02  6:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: dianders, devicetree, alsa-devel, Banajit Goswami,
	Srinivasa Rao Mandadapu, Liam Girdwood, linux-arm-msm,
	Patrick Lai, Ajye Huang, Andy Gross, Rob Herring,
	Bjorn Andersson, Mark Brown, Rohit kumar, tzungbi,
	srinivas.kandagatla, linux-arm-kernel, cychiang

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
+
 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>;
+
+        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 related	[flat|nested] 15+ messages in thread

* [PATCH v3 1/2] ASoC: google: dt-bindings: modify machine bindings for two MICs case
@ 2020-11-02  6:24   ` Ajye Huang
  0 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02  6:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: dianders, devicetree, alsa-devel, Banajit Goswami,
	Srinivasa Rao Mandadapu, Liam Girdwood, linux-arm-msm,
	Patrick Lai, Ajye Huang, Andy Gross, Rob Herring,
	Bjorn Andersson, Mark Brown, Rohit kumar, tzungbi,
	srinivas.kandagatla, Jaroslav Kysela, linux-arm-kernel, cychiang

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
+
 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>;
+
+        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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v3 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic
  2020-11-02  6:24 ` Ajye Huang
  (?)
@ 2020-11-02  6:24   ` Ajye Huang
  -1 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02  6:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mark Brown, Rohit kumar, Banajit Goswami, Patrick Lai,
	Srinivasa Rao Mandadapu, srinivas.kandagatla, 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 by
using "dmic-gpios" property.

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>
---
 sound/soc/qcom/sc7180.c | 65 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/sound/soc/qcom/sc7180.c b/sound/soc/qcom/sc7180.c
index b391f64c3a80..f86db7871999 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>
@@ -28,6 +30,8 @@ struct sc7180_snd_data {
 	u32 pri_mi2s_clk_count;
 	struct snd_soc_jack hs_jack;
 	struct snd_soc_jack hdmi_jack;
+	struct gpio_desc *dmic_sel;
+	int dmic_switch;
 };
 
 static void sc7180_jack_free(struct snd_jack *jack)
@@ -169,6 +173,30 @@ 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)
+{
+	struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
+	struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
+
+	if (data)
+		ucontrol->value.integer.value[0] = data->dmic_switch;
+	return 0;
+}
+
+static int dmic_set(struct snd_kcontrol *kcontrol,
+		    struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
+	struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
+
+	if (data) {
+		data->dmic_switch = ucontrol->value.integer.value[0];
+		gpiod_set_value(data->dmic_sel, data->dmic_switch);
+	}
+	return 0;
+}
+
 static void sc7180_snd_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -206,6 +234,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 +290,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_property_read_bool(dev->of_node, "dmic-gpios")) {
+		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),
+		data->dmic_sel = devm_gpiod_get(&pdev->dev, "dmic", GPIOD_OUT_LOW);
+		if (IS_ERR(data->dmic_sel)) {
+			dev_err(&pdev->dev, "DMIC gpio failed err=%d\n",
+				PTR_ERR(data->dmic_sel));
+				return PTR_ERR(data->dmic_sel);
+		}
+	}
+
 	ret = qcom_snd_parse_of(card);
 	if (ret)
 		return ret;
-- 
2.25.1


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

* [PATCH v3 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic
@ 2020-11-02  6:24   ` Ajye Huang
  0 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02  6:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: dianders, devicetree, alsa-devel, Banajit Goswami,
	Srinivasa Rao Mandadapu, Liam Girdwood, linux-arm-msm,
	Patrick Lai, Ajye Huang, Andy Gross, Rob Herring,
	Bjorn Andersson, Mark Brown, Rohit kumar, tzungbi,
	srinivas.kandagatla, linux-arm-kernel, cychiang

In addition, having mixer control to switch between DMICs by
using "dmic-gpios" property.

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>
---
 sound/soc/qcom/sc7180.c | 65 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/sound/soc/qcom/sc7180.c b/sound/soc/qcom/sc7180.c
index b391f64c3a80..f86db7871999 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>
@@ -28,6 +30,8 @@ struct sc7180_snd_data {
 	u32 pri_mi2s_clk_count;
 	struct snd_soc_jack hs_jack;
 	struct snd_soc_jack hdmi_jack;
+	struct gpio_desc *dmic_sel;
+	int dmic_switch;
 };
 
 static void sc7180_jack_free(struct snd_jack *jack)
@@ -169,6 +173,30 @@ 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)
+{
+	struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
+	struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
+
+	if (data)
+		ucontrol->value.integer.value[0] = data->dmic_switch;
+	return 0;
+}
+
+static int dmic_set(struct snd_kcontrol *kcontrol,
+		    struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
+	struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
+
+	if (data) {
+		data->dmic_switch = ucontrol->value.integer.value[0];
+		gpiod_set_value(data->dmic_sel, data->dmic_switch);
+	}
+	return 0;
+}
+
 static void sc7180_snd_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -206,6 +234,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 +290,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_property_read_bool(dev->of_node, "dmic-gpios")) {
+		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),
+		data->dmic_sel = devm_gpiod_get(&pdev->dev, "dmic", GPIOD_OUT_LOW);
+		if (IS_ERR(data->dmic_sel)) {
+			dev_err(&pdev->dev, "DMIC gpio failed err=%d\n",
+				PTR_ERR(data->dmic_sel));
+				return PTR_ERR(data->dmic_sel);
+		}
+	}
+
 	ret = qcom_snd_parse_of(card);
 	if (ret)
 		return ret;
-- 
2.25.1


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

* [PATCH v3 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic
@ 2020-11-02  6:24   ` Ajye Huang
  0 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02  6:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: dianders, devicetree, alsa-devel, Banajit Goswami,
	Srinivasa Rao Mandadapu, Liam Girdwood, linux-arm-msm,
	Patrick Lai, Ajye Huang, Andy Gross, Rob Herring,
	Bjorn Andersson, Mark Brown, Rohit kumar, tzungbi,
	srinivas.kandagatla, Jaroslav Kysela, linux-arm-kernel, cychiang

In addition, having mixer control to switch between DMICs by
using "dmic-gpios" property.

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>
---
 sound/soc/qcom/sc7180.c | 65 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/sound/soc/qcom/sc7180.c b/sound/soc/qcom/sc7180.c
index b391f64c3a80..f86db7871999 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>
@@ -28,6 +30,8 @@ struct sc7180_snd_data {
 	u32 pri_mi2s_clk_count;
 	struct snd_soc_jack hs_jack;
 	struct snd_soc_jack hdmi_jack;
+	struct gpio_desc *dmic_sel;
+	int dmic_switch;
 };
 
 static void sc7180_jack_free(struct snd_jack *jack)
@@ -169,6 +173,30 @@ 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)
+{
+	struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
+	struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
+
+	if (data)
+		ucontrol->value.integer.value[0] = data->dmic_switch;
+	return 0;
+}
+
+static int dmic_set(struct snd_kcontrol *kcontrol,
+		    struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
+	struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
+
+	if (data) {
+		data->dmic_switch = ucontrol->value.integer.value[0];
+		gpiod_set_value(data->dmic_sel, data->dmic_switch);
+	}
+	return 0;
+}
+
 static void sc7180_snd_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -206,6 +234,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 +290,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_property_read_bool(dev->of_node, "dmic-gpios")) {
+		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),
+		data->dmic_sel = devm_gpiod_get(&pdev->dev, "dmic", GPIOD_OUT_LOW);
+		if (IS_ERR(data->dmic_sel)) {
+			dev_err(&pdev->dev, "DMIC gpio failed err=%d\n",
+				PTR_ERR(data->dmic_sel));
+				return PTR_ERR(data->dmic_sel);
+		}
+	}
+
 	ret = qcom_snd_parse_of(card);
 	if (ret)
 		return ret;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic
  2020-11-02  6:24   ` Ajye Huang
  (?)
@ 2020-11-02 10:46     ` Tzung-Bi Shih
  -1 siblings, 0 replies; 15+ messages in thread
From: Tzung-Bi Shih @ 2020-11-02 10:46 UTC (permalink / raw)
  To: Ajye Huang
  Cc: Linux Kernel Mailing List, Mark Brown, Rohit kumar,
	Banajit Goswami, Patrick Lai, Srinivasa Rao Mandadapu,
	Srini Kandagatla, Andy Gross, Bjorn Andersson, Liam Girdwood,
	Rob Herring, Jaroslav Kysela, Cheng-Yi Chiang, Tzung-Bi Shih,
	Douglas Anderson, moderated list:ARM/Mediatek SoC support,
	linux-arm-msm,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	ALSA development, Ajye Huang

On Mon, Nov 2, 2020 at 2:24 PM Ajye Huang <ajye.huang@gmail.com> wrote:
>
> In addition, having mixer control to switch between DMICs by
> using "dmic-gpios" property.
>
> 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>

I am not sure if it would be better if you use another email (e.g.
@gmail) for signoff.

> +static int dmic_get(struct snd_kcontrol *kcontrol,
> +                   struct snd_ctl_elem_value *ucontrol)
> +{
> +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> +
> +       if (data)

You don't need to check for NULL.  If snd_soc_card_get_drvdata()
returns NULL, it shouldn't run into here.  See other
snd_soc_card_get_drvdata() calls in the file.

> +static int dmic_set(struct snd_kcontrol *kcontrol,
> +                   struct snd_ctl_elem_value *ucontrol)
> +{
> +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> +
> +       if (data) {

Ditto.

> +               if (IS_ERR(data->dmic_sel)) {
> +                       dev_err(&pdev->dev, "DMIC gpio failed err=%d\n",
> +                               PTR_ERR(data->dmic_sel));
> +                               return PTR_ERR(data->dmic_sel);

Remove 1 level indent.

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

* Re: [PATCH v3 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic
@ 2020-11-02 10:46     ` Tzung-Bi Shih
  0 siblings, 0 replies; 15+ messages in thread
From: Tzung-Bi Shih @ 2020-11-02 10:46 UTC (permalink / raw)
  To: Ajye Huang
  Cc: Douglas Anderson,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	ALSA development, Banajit Goswami, Srinivasa Rao Mandadapu,
	Liam Girdwood, linux-arm-msm, Patrick Lai, Ajye Huang,
	Linux Kernel Mailing List, Rob Herring, Bjorn Andersson,
	Mark Brown, Rohit kumar, Andy Gross, Tzung-Bi Shih,
	Srini Kandagatla, moderated list:ARM/Mediatek SoC support,
	Cheng-Yi Chiang

On Mon, Nov 2, 2020 at 2:24 PM Ajye Huang <ajye.huang@gmail.com> wrote:
>
> In addition, having mixer control to switch between DMICs by
> using "dmic-gpios" property.
>
> 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>

I am not sure if it would be better if you use another email (e.g.
@gmail) for signoff.

> +static int dmic_get(struct snd_kcontrol *kcontrol,
> +                   struct snd_ctl_elem_value *ucontrol)
> +{
> +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> +
> +       if (data)

You don't need to check for NULL.  If snd_soc_card_get_drvdata()
returns NULL, it shouldn't run into here.  See other
snd_soc_card_get_drvdata() calls in the file.

> +static int dmic_set(struct snd_kcontrol *kcontrol,
> +                   struct snd_ctl_elem_value *ucontrol)
> +{
> +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> +
> +       if (data) {

Ditto.

> +               if (IS_ERR(data->dmic_sel)) {
> +                       dev_err(&pdev->dev, "DMIC gpio failed err=%d\n",
> +                               PTR_ERR(data->dmic_sel));
> +                               return PTR_ERR(data->dmic_sel);

Remove 1 level indent.

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

* Re: [PATCH v3 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic
@ 2020-11-02 10:46     ` Tzung-Bi Shih
  0 siblings, 0 replies; 15+ messages in thread
From: Tzung-Bi Shih @ 2020-11-02 10:46 UTC (permalink / raw)
  To: Ajye Huang
  Cc: Douglas Anderson,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	ALSA development, Banajit Goswami, Srinivasa Rao Mandadapu,
	Liam Girdwood, linux-arm-msm, Patrick Lai, Ajye Huang,
	Linux Kernel Mailing List, Rob Herring, Bjorn Andersson,
	Mark Brown, Rohit kumar, Andy Gross, Tzung-Bi Shih,
	Srini Kandagatla, Jaroslav Kysela,
	moderated list:ARM/Mediatek SoC support, Cheng-Yi Chiang

On Mon, Nov 2, 2020 at 2:24 PM Ajye Huang <ajye.huang@gmail.com> wrote:
>
> In addition, having mixer control to switch between DMICs by
> using "dmic-gpios" property.
>
> 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>

I am not sure if it would be better if you use another email (e.g.
@gmail) for signoff.

> +static int dmic_get(struct snd_kcontrol *kcontrol,
> +                   struct snd_ctl_elem_value *ucontrol)
> +{
> +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> +
> +       if (data)

You don't need to check for NULL.  If snd_soc_card_get_drvdata()
returns NULL, it shouldn't run into here.  See other
snd_soc_card_get_drvdata() calls in the file.

> +static int dmic_set(struct snd_kcontrol *kcontrol,
> +                   struct snd_ctl_elem_value *ucontrol)
> +{
> +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> +
> +       if (data) {

Ditto.

> +               if (IS_ERR(data->dmic_sel)) {
> +                       dev_err(&pdev->dev, "DMIC gpio failed err=%d\n",
> +                               PTR_ERR(data->dmic_sel));
> +                               return PTR_ERR(data->dmic_sel);

Remove 1 level indent.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v3 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic
  2020-11-02 10:46     ` Tzung-Bi Shih
  (?)
@ 2020-11-02 14:13       ` Ajye Huang
  -1 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02 14:13 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Ajye Huang, Linux Kernel Mailing List, Mark Brown, Rohit kumar,
	Banajit Goswami, Patrick Lai, Srinivasa Rao Mandadapu,
	Srini Kandagatla, Andy Gross, Bjorn Andersson, Liam Girdwood,
	Rob Herring, Jaroslav Kysela, Cheng-Yi Chiang, Tzung-Bi Shih,
	Douglas Anderson, moderated list:ARM/Mediatek SoC support,
	linux-arm-msm,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	ALSA development

On Mon, Nov 2, 2020 at 6:46 PM Tzung-Bi Shih <tzungbi@google.com> wrote:
>
> On Mon, Nov 2, 2020 at 2:24 PM Ajye Huang <ajye.huang@gmail.com> wrote:
> >
> > In addition, having mixer control to switch between DMICs by
> > using "dmic-gpios" property.
> >
> > 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>
>
> I am not sure if it would be better if you use another email (e.g.
> @gmail) for signoff.
>
hi, Tzung-Bi
Thank you for your review, it's our company's rule to use  this PD account

> > +static int dmic_get(struct snd_kcontrol *kcontrol,
> > +                   struct snd_ctl_elem_value *ucontrol)
> > +{
> > +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> > +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> > +
> > +       if (data)
>
> You don't need to check for NULL.  If snd_soc_card_get_drvdata()
> returns NULL, it shouldn't run into here.  See other
> snd_soc_card_get_drvdata() calls in the file.
>
your are right, I will remove on v4

> > +static int dmic_set(struct snd_kcontrol *kcontrol,
> > +                   struct snd_ctl_elem_value *ucontrol)
> > +{
> > +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> > +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> > +
> > +       if (data) {
>
> Ditto.
>
I will remove it on v4

> > +               if (IS_ERR(data->dmic_sel)) {
> > +                       dev_err(&pdev->dev, "DMIC gpio failed err=%d\n",
> > +                               PTR_ERR(data->dmic_sel));
> > +                               return PTR_ERR(data->dmic_sel);
>
> Remove 1 level indent.
Your are really attentive, I will remove the indent on v4, thank you so much.

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

* Re: [PATCH v3 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic
@ 2020-11-02 14:13       ` Ajye Huang
  0 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02 14:13 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Douglas Anderson,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	ALSA development, Banajit Goswami, Srinivasa Rao Mandadapu,
	Liam Girdwood, Ajye Huang, Patrick Lai,
	Linux Kernel Mailing List, Rob Herring, Bjorn Andersson,
	Mark Brown, Rohit kumar, Andy Gross, Tzung-Bi Shih,
	linux-arm-msm, Srini Kandagatla,
	moderated list:ARM/Mediatek SoC support, Cheng-Yi Chiang

On Mon, Nov 2, 2020 at 6:46 PM Tzung-Bi Shih <tzungbi@google.com> wrote:
>
> On Mon, Nov 2, 2020 at 2:24 PM Ajye Huang <ajye.huang@gmail.com> wrote:
> >
> > In addition, having mixer control to switch between DMICs by
> > using "dmic-gpios" property.
> >
> > 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>
>
> I am not sure if it would be better if you use another email (e.g.
> @gmail) for signoff.
>
hi, Tzung-Bi
Thank you for your review, it's our company's rule to use  this PD account

> > +static int dmic_get(struct snd_kcontrol *kcontrol,
> > +                   struct snd_ctl_elem_value *ucontrol)
> > +{
> > +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> > +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> > +
> > +       if (data)
>
> You don't need to check for NULL.  If snd_soc_card_get_drvdata()
> returns NULL, it shouldn't run into here.  See other
> snd_soc_card_get_drvdata() calls in the file.
>
your are right, I will remove on v4

> > +static int dmic_set(struct snd_kcontrol *kcontrol,
> > +                   struct snd_ctl_elem_value *ucontrol)
> > +{
> > +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> > +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> > +
> > +       if (data) {
>
> Ditto.
>
I will remove it on v4

> > +               if (IS_ERR(data->dmic_sel)) {
> > +                       dev_err(&pdev->dev, "DMIC gpio failed err=%d\n",
> > +                               PTR_ERR(data->dmic_sel));
> > +                               return PTR_ERR(data->dmic_sel);
>
> Remove 1 level indent.
Your are really attentive, I will remove the indent on v4, thank you so much.

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

* Re: [PATCH v3 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic
@ 2020-11-02 14:13       ` Ajye Huang
  0 siblings, 0 replies; 15+ messages in thread
From: Ajye Huang @ 2020-11-02 14:13 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Douglas Anderson,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	ALSA development, Banajit Goswami, Srinivasa Rao Mandadapu,
	Liam Girdwood, Ajye Huang, Patrick Lai,
	Linux Kernel Mailing List, Rob Herring, Bjorn Andersson,
	Mark Brown, Rohit kumar, Andy Gross, Tzung-Bi Shih,
	linux-arm-msm, Srini Kandagatla, Jaroslav Kysela,
	moderated list:ARM/Mediatek SoC support, Cheng-Yi Chiang

On Mon, Nov 2, 2020 at 6:46 PM Tzung-Bi Shih <tzungbi@google.com> wrote:
>
> On Mon, Nov 2, 2020 at 2:24 PM Ajye Huang <ajye.huang@gmail.com> wrote:
> >
> > In addition, having mixer control to switch between DMICs by
> > using "dmic-gpios" property.
> >
> > 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>
>
> I am not sure if it would be better if you use another email (e.g.
> @gmail) for signoff.
>
hi, Tzung-Bi
Thank you for your review, it's our company's rule to use  this PD account

> > +static int dmic_get(struct snd_kcontrol *kcontrol,
> > +                   struct snd_ctl_elem_value *ucontrol)
> > +{
> > +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> > +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> > +
> > +       if (data)
>
> You don't need to check for NULL.  If snd_soc_card_get_drvdata()
> returns NULL, it shouldn't run into here.  See other
> snd_soc_card_get_drvdata() calls in the file.
>
your are right, I will remove on v4

> > +static int dmic_set(struct snd_kcontrol *kcontrol,
> > +                   struct snd_ctl_elem_value *ucontrol)
> > +{
> > +       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
> > +       struct sc7180_snd_data *data = snd_soc_card_get_drvdata(dapm->card);
> > +
> > +       if (data) {
>
> Ditto.
>
I will remove it on v4

> > +               if (IS_ERR(data->dmic_sel)) {
> > +                       dev_err(&pdev->dev, "DMIC gpio failed err=%d\n",
> > +                               PTR_ERR(data->dmic_sel));
> > +                               return PTR_ERR(data->dmic_sel);
>
> Remove 1 level indent.
Your are really attentive, I will remove the indent on v4, thank you so much.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-11-02 14:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02  6:24 [PATCH v3 0/2] Modify documentation and machine driver for SC7180 sound card Ajye Huang
2020-11-02  6:24 ` Ajye Huang
2020-11-02  6:24 ` Ajye Huang
2020-11-02  6:24 ` [PATCH v3 1/2] ASoC: google: dt-bindings: modify machine bindings for two MICs case Ajye Huang
2020-11-02  6:24   ` Ajye Huang
2020-11-02  6:24   ` Ajye Huang
2020-11-02  6:24 ` [PATCH v3 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic Ajye Huang
2020-11-02  6:24   ` Ajye Huang
2020-11-02  6:24   ` Ajye Huang
2020-11-02 10:46   ` Tzung-Bi Shih
2020-11-02 10:46     ` Tzung-Bi Shih
2020-11-02 10:46     ` Tzung-Bi Shih
2020-11-02 14:13     ` Ajye Huang
2020-11-02 14:13       ` Ajye Huang
2020-11-02 14:13       ` Ajye Huang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.