* [PATCH v1 0/2] Support SC7180 sound card variation without headset
@ 2020-11-05 1:32 xuyuqing
2020-11-05 1:32 ` [PATCH v1 1/2] ASoC: google: dt-bindings: add new compatible for sc7180-coachz xuyuqing
2020-11-05 1:32 ` [PATCH v1 2/2] ASoC: qcom: sc7180: Modify machine driver for adau7002 xuyuqing
0 siblings, 2 replies; 4+ messages in thread
From: xuyuqing @ 2020-11-05 1:32 UTC (permalink / raw)
To: linux-kernel
Cc: Taniya Das, alsa-devel, Banajit Goswami, Liam Girdwood,
Rohit kumar, cychiang, Patrick Lai, Andy Gross, dgreid,
zhouguohui, devicetree, tzungbi, Stephan Gerhold, linux-arm-msm,
Rob Herring, Jaroslav Kysela, Bjorn Andersson, linux-arm-kernel,
dianders, Takashi Iwai, xuyuqing, Mark Brown, Srini Kandagatla,
judyhsiao
This series is based on patch
[v5,2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic
Use compatible string to let machine driver handle the case
where ALC5682 headset codec is replaced with ADAU7002 dmic codec
xuyuqing (2):
ASoC: google: dt-bindings: add new compatible for sc7180-coachz
ASoC: qcom: sc7180: Modify machine driver for adau7002
.../bindings/sound/google,sc7180-trogdor.yaml | 4 +-
sound/soc/qcom/Kconfig | 1 +
sound/soc/qcom/sc7180.c | 119 ++++++++++++++++--
3 files changed, 112 insertions(+), 12 deletions(-)
--
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] 4+ messages in thread
* [PATCH v1 1/2] ASoC: google: dt-bindings: add new compatible for sc7180-coachz
2020-11-05 1:32 [PATCH v1 0/2] Support SC7180 sound card variation without headset xuyuqing
@ 2020-11-05 1:32 ` xuyuqing
2020-11-09 19:02 ` Rob Herring
2020-11-05 1:32 ` [PATCH v1 2/2] ASoC: qcom: sc7180: Modify machine driver for adau7002 xuyuqing
1 sibling, 1 reply; 4+ messages in thread
From: xuyuqing @ 2020-11-05 1:32 UTC (permalink / raw)
To: linux-kernel
Cc: Taniya Das, alsa-devel, Banajit Goswami, Liam Girdwood,
Rohit kumar, cychiang, Patrick Lai, Andy Gross, dgreid,
zhouguohui, devicetree, tzungbi, Stephan Gerhold, linux-arm-msm,
Rob Herring, Jaroslav Kysela, Bjorn Andersson, linux-arm-kernel,
dianders, Takashi Iwai, xuyuqing, Mark Brown, Srini Kandagatla,
judyhsiao
Add devicetree bindings for coachz in documentation file
Signed-off-by: xuyuqing <xuyuqing@huaqin.corp-partner.google.com>
---
.../devicetree/bindings/sound/google,sc7180-trogdor.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml b/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
index efc34689d6b5..5857b3464e51 100644
--- a/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
+++ b/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
@@ -15,7 +15,9 @@ description:
properties:
compatible:
- const: google,sc7180-trogdor
+ enum:
+ - google,sc7180-trogdor
+ - google,sc7180-coachz
audio-routing:
$ref: /schemas/types.yaml#/definitions/non-unique-string-array
--
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] 4+ messages in thread
* [PATCH v1 2/2] ASoC: qcom: sc7180: Modify machine driver for adau7002
2020-11-05 1:32 [PATCH v1 0/2] Support SC7180 sound card variation without headset xuyuqing
2020-11-05 1:32 ` [PATCH v1 1/2] ASoC: google: dt-bindings: add new compatible for sc7180-coachz xuyuqing
@ 2020-11-05 1:32 ` xuyuqing
1 sibling, 0 replies; 4+ messages in thread
From: xuyuqing @ 2020-11-05 1:32 UTC (permalink / raw)
To: linux-kernel
Cc: Taniya Das, alsa-devel, Banajit Goswami, Liam Girdwood,
Rohit kumar, cychiang, Patrick Lai, Andy Gross, dgreid,
zhouguohui, devicetree, tzungbi, Stephan Gerhold, linux-arm-msm,
Rob Herring, Jaroslav Kysela, Bjorn Andersson, linux-arm-kernel,
dianders, Takashi Iwai, xuyuqing, Mark Brown, Srini Kandagatla,
judyhsiao
Bypass set jack because there is no jack on coachz.
Create route for dmic.
Signed-off-by: xuyuqing <xuyuqing@huaqin.corp-partner.google.com>
---
sound/soc/qcom/Kconfig | 1 +
sound/soc/qcom/sc7180.c | 119 ++++++++++++++++++++++++++++++++++++----
2 files changed, 109 insertions(+), 11 deletions(-)
diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index 41cb08bd5588..27f93006be96 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -145,6 +145,7 @@ config SND_SOC_SC7180
select SND_SOC_LPASS_SC7180
select SND_SOC_MAX98357A
select SND_SOC_RT5682_I2C
+ select SND_SOC_ADAU7002
help
To add support for audio on Qualcomm Technologies Inc.
SC7180 SoC-based systems.
diff --git a/sound/soc/qcom/sc7180.c b/sound/soc/qcom/sc7180.c
index b391f64c3a80..240b75b44716 100644
--- a/sound/soc/qcom/sc7180.c
+++ b/sound/soc/qcom/sc7180.c
@@ -196,33 +196,102 @@ static void sc7180_snd_shutdown(struct snd_pcm_substream *substream)
}
}
+static int sc7180_adau7002_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+
+ switch (cpu_dai->id) {
+ case MI2S_PRIMARY:
+ return 0;
+ case MI2S_SECONDARY:
+ return 0;
+ case LPASS_DP_RX:
+ return sc7180_hdmi_init(rtd);
+ default:
+ dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__,
+ cpu_dai->id);
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static int sc7180_adau7002_snd_startup(struct snd_pcm_substream *substream)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+
+ switch (cpu_dai->id) {
+ case MI2S_PRIMARY:
+ snd_soc_dai_set_fmt(codec_dai,
+ SND_SOC_DAIFMT_CBS_CFS |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_I2S);
+
+ break;
+ case MI2S_SECONDARY:
+ break;
+ case LPASS_DP_RX:
+ break;
+ default:
+ dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__,
+ cpu_dai->id);
+ return -EINVAL;
+ }
+ return 0;
+}
+
static const struct snd_soc_ops sc7180_ops = {
.startup = sc7180_snd_startup,
.shutdown = sc7180_snd_shutdown,
};
+static const struct snd_soc_ops sc7180_adau7002_ops = {
+ .startup = sc7180_adau7002_snd_startup,
+};
+
static const struct snd_soc_dapm_widget sc7180_snd_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
};
-static void sc7180_add_ops(struct snd_soc_card *card)
-{
- struct snd_soc_dai_link *link;
- int i;
+static const struct snd_soc_dapm_widget sc7180_adau7002_snd_widgets[] = {
+ SND_SOC_DAPM_MIC("DMIC", NULL),
+};
- for_each_card_prelinks(card, i, link) {
- link->ops = &sc7180_ops;
- link->init = sc7180_init;
- }
-}
+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 int sc7180_snd_platform_probe(struct platform_device *pdev)
{
struct snd_soc_card *card;
struct sc7180_snd_data *data;
struct device *dev = &pdev->dev;
+ struct snd_soc_dai_link *link;
int ret;
+ int i;
+ bool no_headphone;
/* Allocate the private data */
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
@@ -238,17 +307,45 @@ 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);
+ }
+ }
+
+ if (of_device_is_compatible(dev->of_node, "google,sc7180-coachz")) {
+ no_headphone = true;
+ card->dapm_widgets = sc7180_adau7002_snd_widgets;
+ card->num_dapm_widgets = ARRAY_SIZE(sc7180_adau7002_snd_widgets);
+ }
+
ret = qcom_snd_parse_of(card);
if (ret)
return ret;
- sc7180_add_ops(card);
+ for_each_card_prelinks(card, i, link) {
+ if (no_headphone) {
+ link->ops = &sc7180_adau7002_ops;
+ link->init = sc7180_adau7002_init;
+ } else {
+ link->ops = &sc7180_ops;
+ link->init = sc7180_init;
+ }
+ }
return devm_snd_soc_register_card(dev, card);
}
static const struct of_device_id sc7180_snd_device_id[] = {
- { .compatible = "google,sc7180-trogdor"},
+ {.compatible = "google,sc7180-trogdor"},
+ {.compatible = "google,sc7180-coachz"},
{},
};
MODULE_DEVICE_TABLE(of, sc7180_snd_device_id);
--
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] 4+ messages in thread
* Re: [PATCH v1 1/2] ASoC: google: dt-bindings: add new compatible for sc7180-coachz
2020-11-05 1:32 ` [PATCH v1 1/2] ASoC: google: dt-bindings: add new compatible for sc7180-coachz xuyuqing
@ 2020-11-09 19:02 ` Rob Herring
0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2020-11-09 19:02 UTC (permalink / raw)
To: xuyuqing
Cc: Taniya Das, alsa-devel, Banajit Goswami, linux-kernel,
Rohit kumar, cychiang, Patrick Lai, Takashi Iwai, Andy Gross,
dgreid, zhouguohui, devicetree, tzungbi, Stephan Gerhold,
linux-arm-msm, Mark Brown, Bjorn Andersson, linux-arm-kernel,
dianders, Liam Girdwood, Rob Herring, Srini Kandagatla, judyhsiao
On Thu, 05 Nov 2020 09:32:41 +0800, xuyuqing wrote:
> Add devicetree bindings for coachz in documentation file
>
> Signed-off-by: xuyuqing <xuyuqing@huaqin.corp-partner.google.com>
> ---
> .../devicetree/bindings/sound/google,sc7180-trogdor.yaml | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Acked-by: Rob Herring <robh@kernel.org>
_______________________________________________
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] 4+ messages in thread
end of thread, other threads:[~2020-11-09 19:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-05 1:32 [PATCH v1 0/2] Support SC7180 sound card variation without headset xuyuqing
2020-11-05 1:32 ` [PATCH v1 1/2] ASoC: google: dt-bindings: add new compatible for sc7180-coachz xuyuqing
2020-11-09 19:02 ` Rob Herring
2020-11-05 1:32 ` [PATCH v1 2/2] ASoC: qcom: sc7180: Modify machine driver for adau7002 xuyuqing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).