From: Chris Zhong <zyw@rock-chips.com>
To: dianders@chromium.org, heiko@sntech.de, zhengxing@rock-chips.com,
cychiang@chromium.org
Cc: linux-rockchip@lists.infradead.org, zyw@rock-chips.com,
perex@perex.cz, devicetree@vger.kernel.org,
alsa-devel@alsa-project.org, lgirdwood@gmail.com,
broonie@kernel.org, linux-kernel@vger.kernel.org, tiwai@suse.com,
robh+dt@kernel.org, mark.rutland@arm.com,
linux-arm-kernel@lists.infradead.org
Subject: [v2 PATCH 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver
Date: Tue, 6 Sep 2016 10:09:52 -0700 [thread overview]
Message-ID: <1473181792-15398-1-git-send-email-zyw@rock-chips.com> (raw)
In-Reply-To: <1473137335-14541-3-git-send-email-zyw@rock-chips.com>
This patch adds DP audio output support to the rk3399-gru machine
driver.
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
---
Changes in v2:
- correct the commit message
.../bindings/sound/rockchip,rk3399-gru-sound.txt | 13 +++---
sound/soc/rockchip/rk3399_gru_sound.c | 48 ++++++++++++++++++++++
2 files changed, 55 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt b/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt
index f19b6c8..222124b 100644
--- a/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt
+++ b/Documentation/devicetree/bindings/sound/rockchip,rk3399-gru-sound.txt
@@ -1,15 +1,16 @@
-ROCKCHIP with MAX98357A/RT5514/DA7219 codecs on GRU boards
+ROCKCHIP with MAX98357A/RT5514/DA7219 codecs and DP via spdif on GRU boards
Required properties:
- compatible: "rockchip,rk3399-gru-sound"
-- rockchip,cpu: The phandle of the Rockchip I2S controller that's
- connected to the codecs
-- rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs
+- rockchip,cpu: The phandle of the Rockchip I2S controller controller that's
+ connected to the codecs, and the SPDIF controller that's connected to DP
+- rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs and of the
+ DP encoder node
Example:
sound {
compatible = "rockchip,rk3399-gru-sound";
- rockchip,cpu = <&i2s0>;
- rockchip,codec = <&max98357a &rt5514 &da7219>;
+ rockchip,cpu = <&i2s0 &spdif>;
+ rockchip,codec = <&max98357a &rt5514 &da7219 &cdn_dp 1>;
};
diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c
index 164b6da..50e5d9a 100644
--- a/sound/soc/rockchip/rk3399_gru_sound.c
+++ b/sound/soc/rockchip/rk3399_gru_sound.c
@@ -25,6 +25,7 @@
#include <linux/spi/spi.h>
#include <sound/core.h>
#include <sound/jack.h>
+#include <sound/hdmi-codec.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
@@ -226,10 +227,30 @@ static struct snd_soc_ops rockchip_sound_da7219_ops = {
.hw_params = rockchip_sound_da7219_hw_params,
};
+static struct snd_soc_jack cdn_dp_card_jack;
+
+static int cdn_dp_init(struct snd_soc_pcm_runtime *runtime)
+{
+ struct snd_soc_card *card = runtime->card;
+ struct snd_soc_codec *codec = runtime->codec;
+ int ret;
+
+ /* enable jack detection */
+ ret = snd_soc_card_jack_new(card, "DP Jack", SND_JACK_LINEOUT,
+ &cdn_dp_card_jack, NULL, 0);
+ if (ret) {
+ dev_err(card->dev, "Can't new DP Jack %d\n", ret);
+ return ret;
+ }
+
+ return hdmi_codec_set_jack_detect(codec, &cdn_dp_card_jack);
+}
+
enum {
DAILINK_MAX98357A,
DAILINK_RT5514,
DAILINK_DA7219,
+ DAILINK_CDNDP,
DAILINK_RT5514_DSP,
};
@@ -264,6 +285,14 @@ static struct snd_soc_dai_link rockchip_dailinks[] = {
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
},
+ [DAILINK_CDNDP] = {
+ .name = "DP",
+ .stream_name = "DP PCM",
+ .codec_dai_name = "spdif-hifi",
+ .init = cdn_dp_init,
+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBS_CFS,
+ },
/* RT5514 DSP for voice wakeup via spi bus */
[DAILINK_RT5514_DSP] = {
.name = "RT5514 DSP",
@@ -334,6 +363,25 @@ static int rockchip_sound_probe(struct platform_device *pdev)
return -ENODEV;
}
+ cpu_node = of_parse_phandle(pdev->dev.of_node, "rockchip,cpu", 1);
+ if (!cpu_node) {
+ dev_err(&pdev->dev, "Property 'rockchip,cpu 1' missing or invalid\n");
+ return -EINVAL;
+ }
+
+ rockchip_dailinks[DAILINK_CDNDP].platform_of_node = cpu_node;
+ rockchip_dailinks[DAILINK_CDNDP].cpu_of_node = cpu_node;
+
+ rockchip_dailinks[DAILINK_CDNDP].codec_of_node =
+ of_parse_phandle(pdev->dev.of_node, "rockchip,codec",
+ DAILINK_CDNDP);
+ if (!rockchip_dailinks[DAILINK_CDNDP].codec_of_node) {
+ dev_err(&pdev->dev,
+ "Property[%d] 'rockchip,codec' missing or invalid\n",
+ DAILINK_CDNDP);
+ return -EINVAL;
+ }
+
rockchip_dailinks[DAILINK_RT5514_DSP].cpu_name = kstrdup_const(dev_name(dev), GFP_KERNEL);
rockchip_dailinks[DAILINK_RT5514_DSP].cpu_dai_name = kstrdup_const(dev_name(dev), GFP_KERNEL);
rockchip_dailinks[DAILINK_RT5514_DSP].platform_name = kstrdup_const(dev_name(dev), GFP_KERNEL);
--
1.9.1
next prev parent reply other threads:[~2016-09-06 17:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-06 4:48 [PATCH 0/2] Add DP dai-links to the rk3399-gru machine driver Chris Zhong
2016-09-06 4:48 ` [PATCH 1/2] drm/rockchip: cdn-dp: support audio hot-plug Chris Zhong
2016-09-06 4:48 ` [PATCH 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver Chris Zhong
2016-09-06 17:09 ` Chris Zhong [this message]
2016-09-09 4:43 ` [PATCH v3 " Chris Zhong
2016-09-09 10:29 ` Mark Brown
2016-09-24 19:13 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1473181792-15398-1-git-send-email-zyw@rock-chips.com \
--to=zyw@rock-chips.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=cychiang@chromium.org \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=heiko@sntech.de \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=tiwai@suse.com \
--cc=zhengxing@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).