* [PATCH 0/2] Add DP dai-links to the rk3399-gru machine driver @ 2016-09-06 4:48 ` Chris Zhong 0 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-06 4:48 UTC (permalink / raw) To: dianders, heiko, zhengxing, cychiang Cc: linux-rockchip, Chris Zhong, Jaroslav Kysela, devicetree, alsa-devel, Mark Yao, Takashi Iwai, Mark Brown, linux-kernel, dri-devel, Liam Girdwood, David Airlie, Rob Herring, Mark Rutland, linux-arm-kernel Hi This series patch is for the machine driver supporting for DP. It base on the DP drvier patches[0] and hdmi-notify patches[1], they are both in reviewing. [0] https://patchwork.kernel.org/patch/9315557/ https://patchwork.kernel.org/patch/9278077/ [1] https://patchwork.kernel.org/patch/8887261/ https://patchwork.kernel.org/patch/8887251/ Chris Zhong (2): drm/rockchip: cdn-dp: support audio hot-plug ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver .../bindings/sound/rockchip,rk3399-gru-sound.txt | 13 +++--- drivers/gpu/drm/rockchip/cdn-dp-core.c | 4 ++ sound/soc/rockchip/rk3399_gru_sound.c | 48 ++++++++++++++++++++++ 3 files changed, 59 insertions(+), 6 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 0/2] Add DP dai-links to the rk3399-gru machine driver @ 2016-09-06 4:48 ` Chris Zhong 0 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-06 4:48 UTC (permalink / raw) To: linux-arm-kernel Hi This series patch is for the machine driver supporting for DP. It base on the DP drvier patches[0] and hdmi-notify patches[1], they are both in reviewing. [0] https://patchwork.kernel.org/patch/9315557/ https://patchwork.kernel.org/patch/9278077/ [1] https://patchwork.kernel.org/patch/8887261/ https://patchwork.kernel.org/patch/8887251/ Chris Zhong (2): drm/rockchip: cdn-dp: support audio hot-plug ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver .../bindings/sound/rockchip,rk3399-gru-sound.txt | 13 +++--- drivers/gpu/drm/rockchip/cdn-dp-core.c | 4 ++ sound/soc/rockchip/rk3399_gru_sound.c | 48 ++++++++++++++++++++++ 3 files changed, 59 insertions(+), 6 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 0/2] Add DP dai-links to the rk3399-gru machine driver @ 2016-09-06 4:48 ` Chris Zhong 0 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-06 4:48 UTC (permalink / raw) To: dianders-F7+t8E8rja9g9hUCZPvPmw, heiko-4mtYJXux2i+zQB+pC5nmwQ, zhengxing-TNX95d0MmH7DzftRWevZcw, cychiang-F7+t8E8rja9g9hUCZPvPmw Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Chris Zhong, Jaroslav Kysela, devicetree-u79uwXL29TY76Z2rM5mHXA, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Mark Yao, Takashi Iwai, Mark Brown, linux-kernel-u79uwXL29TY76Z2rM5mHXA, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Liam Girdwood, David Airlie, Rob Herring, Mark Rutland, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Hi This series patch is for the machine driver supporting for DP. It base on the DP drvier patches[0] and hdmi-notify patches[1], they are both in reviewing. [0] https://patchwork.kernel.org/patch/9315557/ https://patchwork.kernel.org/patch/9278077/ [1] https://patchwork.kernel.org/patch/8887261/ https://patchwork.kernel.org/patch/8887251/ Chris Zhong (2): drm/rockchip: cdn-dp: support audio hot-plug ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver .../bindings/sound/rockchip,rk3399-gru-sound.txt | 13 +++--- drivers/gpu/drm/rockchip/cdn-dp-core.c | 4 ++ sound/soc/rockchip/rk3399_gru_sound.c | 48 ++++++++++++++++++++++ 3 files changed, 59 insertions(+), 6 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/2] drm/rockchip: cdn-dp: support audio hot-plug 2016-09-06 4:48 ` Chris Zhong (?) @ 2016-09-06 4:48 ` Chris Zhong -1 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-06 4:48 UTC (permalink / raw) To: dianders, heiko, zhengxing, cychiang Cc: linux-rockchip, Chris Zhong, Mark Yao, linux-kernel, dri-devel, David Airlie, linux-arm-kernel Issue hot-plug detection, EDID update, and ELD update notifications from DP drivers. Signed-off-by: Chris Zhong <zyw@rock-chips.com> --- drivers/gpu/drm/rockchip/cdn-dp-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index 530b7ba..e0055a9 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -23,6 +23,7 @@ #include <linux/component.h> #include <linux/extcon.h> #include <linux/firmware.h> +#include <linux/hdmi-notifier.h> #include <linux/regmap.h> #include <linux/reset.h> #include <linux/mfd/syscon.h> @@ -185,6 +186,7 @@ static int cdn_dp_connector_get_modes(struct drm_connector *connector) drm_mode_connector_update_edid_property(connector, edid); drm_edid_to_eld(connector, edid); + hdmi_event_new_eld(dp->dev, connector->eld); } kfree(edid); } @@ -345,6 +347,7 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder) if (dp->dpms_mode != DRM_MODE_DPMS_ON) cdn_dp_commit(encoder); + hdmi_event_connect(dp->dev); } static void cdn_dp_encoder_disable(struct drm_encoder *encoder) @@ -352,6 +355,7 @@ static void cdn_dp_encoder_disable(struct drm_encoder *encoder) struct cdn_dp_device *dp = encoder_to_dp(encoder); dp->dpms_mode = DRM_MODE_DPMS_OFF; + hdmi_event_disconnect(dp->dev); } static int cdn_dp_encoder_atomic_check(struct drm_encoder *encoder, -- 1.9.1 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 1/2] drm/rockchip: cdn-dp: support audio hot-plug @ 2016-09-06 4:48 ` Chris Zhong 0 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-06 4:48 UTC (permalink / raw) To: linux-arm-kernel Issue hot-plug detection, EDID update, and ELD update notifications from DP drivers. Signed-off-by: Chris Zhong <zyw@rock-chips.com> --- drivers/gpu/drm/rockchip/cdn-dp-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index 530b7ba..e0055a9 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -23,6 +23,7 @@ #include <linux/component.h> #include <linux/extcon.h> #include <linux/firmware.h> +#include <linux/hdmi-notifier.h> #include <linux/regmap.h> #include <linux/reset.h> #include <linux/mfd/syscon.h> @@ -185,6 +186,7 @@ static int cdn_dp_connector_get_modes(struct drm_connector *connector) drm_mode_connector_update_edid_property(connector, edid); drm_edid_to_eld(connector, edid); + hdmi_event_new_eld(dp->dev, connector->eld); } kfree(edid); } @@ -345,6 +347,7 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder) if (dp->dpms_mode != DRM_MODE_DPMS_ON) cdn_dp_commit(encoder); + hdmi_event_connect(dp->dev); } static void cdn_dp_encoder_disable(struct drm_encoder *encoder) @@ -352,6 +355,7 @@ static void cdn_dp_encoder_disable(struct drm_encoder *encoder) struct cdn_dp_device *dp = encoder_to_dp(encoder); dp->dpms_mode = DRM_MODE_DPMS_OFF; + hdmi_event_disconnect(dp->dev); } static int cdn_dp_encoder_atomic_check(struct drm_encoder *encoder, -- 1.9.1 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 1/2] drm/rockchip: cdn-dp: support audio hot-plug @ 2016-09-06 4:48 ` Chris Zhong 0 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-06 4:48 UTC (permalink / raw) To: dianders, heiko, zhengxing, cychiang Cc: linux-kernel, dri-devel, linux-rockchip, Chris Zhong, linux-arm-kernel Issue hot-plug detection, EDID update, and ELD update notifications from DP drivers. Signed-off-by: Chris Zhong <zyw@rock-chips.com> --- drivers/gpu/drm/rockchip/cdn-dp-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index 530b7ba..e0055a9 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -23,6 +23,7 @@ #include <linux/component.h> #include <linux/extcon.h> #include <linux/firmware.h> +#include <linux/hdmi-notifier.h> #include <linux/regmap.h> #include <linux/reset.h> #include <linux/mfd/syscon.h> @@ -185,6 +186,7 @@ static int cdn_dp_connector_get_modes(struct drm_connector *connector) drm_mode_connector_update_edid_property(connector, edid); drm_edid_to_eld(connector, edid); + hdmi_event_new_eld(dp->dev, connector->eld); } kfree(edid); } @@ -345,6 +347,7 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder) if (dp->dpms_mode != DRM_MODE_DPMS_ON) cdn_dp_commit(encoder); + hdmi_event_connect(dp->dev); } static void cdn_dp_encoder_disable(struct drm_encoder *encoder) @@ -352,6 +355,7 @@ static void cdn_dp_encoder_disable(struct drm_encoder *encoder) struct cdn_dp_device *dp = encoder_to_dp(encoder); dp->dpms_mode = DRM_MODE_DPMS_OFF; + hdmi_event_disconnect(dp->dev); } static int cdn_dp_encoder_atomic_check(struct drm_encoder *encoder, -- 1.9.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver 2016-09-06 4:48 ` Chris Zhong @ 2016-09-06 4:48 ` Chris Zhong -1 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-06 4:48 UTC (permalink / raw) To: dianders, heiko, zhengxing, cychiang Cc: linux-rockchip, Chris Zhong, Jaroslav Kysela, devicetree, alsa-devel, Liam Girdwood, Mark Brown, linux-kernel, Takashi Iwai, Rob Herring, Mark Rutland, linux-arm-kernel This patch adds DP audio output support to the rk3300-gru machine driver. Signed-off-by: Chris Zhong <zyw@rock-chips.com> hychao@chromium.org, broonie@kernel.org --- .../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 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver @ 2016-09-06 4:48 ` Chris Zhong 0 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-06 4:48 UTC (permalink / raw) To: linux-arm-kernel This patch adds DP audio output support to the rk3300-gru machine driver. Signed-off-by: Chris Zhong <zyw@rock-chips.com> hychao at chromium.org, broonie at kernel.org --- .../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 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [v2 PATCH 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver 2016-09-06 4:48 ` Chris Zhong @ 2016-09-06 17:09 ` Chris Zhong -1 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-06 17:09 UTC (permalink / raw) To: dianders, heiko, zhengxing, cychiang Cc: linux-rockchip, zyw, perex, devicetree, alsa-devel, lgirdwood, broonie, linux-kernel, tiwai, robh+dt, mark.rutland, linux-arm-kernel 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 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [v2 PATCH 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver @ 2016-09-06 17:09 ` Chris Zhong 0 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-06 17:09 UTC (permalink / raw) To: linux-arm-kernel 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 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver @ 2016-09-09 4:43 ` Chris Zhong 0 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-09 4:43 UTC (permalink / raw) To: dianders, heiko, zhengxing, cychiang, hychao, broonie Cc: linux-rockchip, perex, devicetree, alsa-devel, lgirdwood, linux-kernel, tiwai, robh+dt, mark.rutland, linux-arm-kernel, Chris Zhong This patch adds DP audio output support to the rk3399-gru machine driver. Signed-off-by: Chris Zhong <zyw@rock-chips.com> --- Changes in v3: - change spdif to i2s2 Changes in v2: - correct the commit message .../bindings/sound/rockchip,rk3399-gru-sound.txt | 11 +-- sound/soc/rockchip/rk3399_gru_sound.c | 93 ++++++++++++++++++++++ 2 files changed, 99 insertions(+), 5 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..83af540 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 +- rockchip,cpu: The phandle of the Rockchip I2S controller controller that's connected to the codecs -- rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs +- 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 &i2s2>; + rockchip,codec = <&max98357a &rt5514 &da7219 &cdn_dp>; }; diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 164b6da..d9aa2e0 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> @@ -214,6 +215,65 @@ static int rockchip_sound_da7219_init(struct snd_soc_pcm_runtime *rtd) return 0; } + +static int rockchip_sound_cdndp_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + int mclk, ret; + + /* in bypass mode, the mclk has to be one of the frequencies below */ + switch (params_rate(params)) { + case 8000: + case 16000: + case 24000: + case 32000: + case 48000: + case 64000: + case 96000: + mclk = 12288000; + break; + case 11025: + case 22050: + case 44100: + case 88200: + mclk = 11289600; + break; + default: + return -EINVAL; + } + + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, + SND_SOC_CLOCK_OUT); + if (ret < 0) { + dev_err(codec_dai->dev, "Can't set cpu clock out %d\n", ret); + return ret; + } + + return 0; +} + +static struct snd_soc_jack cdn_dp_card_jack; + +static int rockchip_sound_cdndp_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); +} + static struct snd_soc_ops rockchip_sound_max98357a_ops = { .hw_params = rockchip_sound_max98357a_hw_params, }; @@ -226,10 +286,15 @@ static struct snd_soc_ops rockchip_sound_da7219_ops = { .hw_params = rockchip_sound_da7219_hw_params, }; +static struct snd_soc_ops rockchip_sound_cdndp_ops = { + .hw_params = rockchip_sound_cdndp_hw_params, +}; + enum { DAILINK_MAX98357A, DAILINK_RT5514, DAILINK_DA7219, + DAILINK_CDNDP, DAILINK_RT5514_DSP, }; @@ -264,6 +329,15 @@ 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 = "i2s-hifi", + .init = rockchip_sound_cdndp_init, + .ops = &rockchip_sound_cdndp_ops, + .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 +408,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 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver @ 2016-09-09 4:43 ` Chris Zhong 0 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-09 4:43 UTC (permalink / raw) To: linux-arm-kernel This patch adds DP audio output support to the rk3399-gru machine driver. Signed-off-by: Chris Zhong <zyw@rock-chips.com> --- Changes in v3: - change spdif to i2s2 Changes in v2: - correct the commit message .../bindings/sound/rockchip,rk3399-gru-sound.txt | 11 +-- sound/soc/rockchip/rk3399_gru_sound.c | 93 ++++++++++++++++++++++ 2 files changed, 99 insertions(+), 5 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..83af540 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 +- rockchip,cpu: The phandle of the Rockchip I2S controller controller that's connected to the codecs -- rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs +- 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 &i2s2>; + rockchip,codec = <&max98357a &rt5514 &da7219 &cdn_dp>; }; diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 164b6da..d9aa2e0 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> @@ -214,6 +215,65 @@ static int rockchip_sound_da7219_init(struct snd_soc_pcm_runtime *rtd) return 0; } + +static int rockchip_sound_cdndp_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + int mclk, ret; + + /* in bypass mode, the mclk has to be one of the frequencies below */ + switch (params_rate(params)) { + case 8000: + case 16000: + case 24000: + case 32000: + case 48000: + case 64000: + case 96000: + mclk = 12288000; + break; + case 11025: + case 22050: + case 44100: + case 88200: + mclk = 11289600; + break; + default: + return -EINVAL; + } + + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, + SND_SOC_CLOCK_OUT); + if (ret < 0) { + dev_err(codec_dai->dev, "Can't set cpu clock out %d\n", ret); + return ret; + } + + return 0; +} + +static struct snd_soc_jack cdn_dp_card_jack; + +static int rockchip_sound_cdndp_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); +} + static struct snd_soc_ops rockchip_sound_max98357a_ops = { .hw_params = rockchip_sound_max98357a_hw_params, }; @@ -226,10 +286,15 @@ static struct snd_soc_ops rockchip_sound_da7219_ops = { .hw_params = rockchip_sound_da7219_hw_params, }; +static struct snd_soc_ops rockchip_sound_cdndp_ops = { + .hw_params = rockchip_sound_cdndp_hw_params, +}; + enum { DAILINK_MAX98357A, DAILINK_RT5514, DAILINK_DA7219, + DAILINK_CDNDP, DAILINK_RT5514_DSP, }; @@ -264,6 +329,15 @@ 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 = "i2s-hifi", + .init = rockchip_sound_cdndp_init, + .ops = &rockchip_sound_cdndp_ops, + .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 +408,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 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver @ 2016-09-09 4:43 ` Chris Zhong 0 siblings, 0 replies; 19+ messages in thread From: Chris Zhong @ 2016-09-09 4:43 UTC (permalink / raw) To: dianders-F7+t8E8rja9g9hUCZPvPmw, heiko-4mtYJXux2i+zQB+pC5nmwQ, zhengxing-TNX95d0MmH7DzftRWevZcw, cychiang-F7+t8E8rja9g9hUCZPvPmw, hychao-F7+t8E8rja9g9hUCZPvPmw, broonie-DgEjT+Ai2ygdnm+yROfE0A Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, perex-/Fr2/VpizcU, devicetree-u79uwXL29TY76Z2rM5mHXA, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, linux-kernel-u79uwXL29TY76Z2rM5mHXA, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Chris Zhong This patch adds DP audio output support to the rk3399-gru machine driver. Signed-off-by: Chris Zhong <zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org> --- Changes in v3: - change spdif to i2s2 Changes in v2: - correct the commit message .../bindings/sound/rockchip,rk3399-gru-sound.txt | 11 +-- sound/soc/rockchip/rk3399_gru_sound.c | 93 ++++++++++++++++++++++ 2 files changed, 99 insertions(+), 5 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..83af540 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 +- rockchip,cpu: The phandle of the Rockchip I2S controller controller that's connected to the codecs -- rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs +- 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 &i2s2>; + rockchip,codec = <&max98357a &rt5514 &da7219 &cdn_dp>; }; diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 164b6da..d9aa2e0 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> @@ -214,6 +215,65 @@ static int rockchip_sound_da7219_init(struct snd_soc_pcm_runtime *rtd) return 0; } + +static int rockchip_sound_cdndp_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + int mclk, ret; + + /* in bypass mode, the mclk has to be one of the frequencies below */ + switch (params_rate(params)) { + case 8000: + case 16000: + case 24000: + case 32000: + case 48000: + case 64000: + case 96000: + mclk = 12288000; + break; + case 11025: + case 22050: + case 44100: + case 88200: + mclk = 11289600; + break; + default: + return -EINVAL; + } + + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, + SND_SOC_CLOCK_OUT); + if (ret < 0) { + dev_err(codec_dai->dev, "Can't set cpu clock out %d\n", ret); + return ret; + } + + return 0; +} + +static struct snd_soc_jack cdn_dp_card_jack; + +static int rockchip_sound_cdndp_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); +} + static struct snd_soc_ops rockchip_sound_max98357a_ops = { .hw_params = rockchip_sound_max98357a_hw_params, }; @@ -226,10 +286,15 @@ static struct snd_soc_ops rockchip_sound_da7219_ops = { .hw_params = rockchip_sound_da7219_hw_params, }; +static struct snd_soc_ops rockchip_sound_cdndp_ops = { + .hw_params = rockchip_sound_cdndp_hw_params, +}; + enum { DAILINK_MAX98357A, DAILINK_RT5514, DAILINK_DA7219, + DAILINK_CDNDP, DAILINK_RT5514_DSP, }; @@ -264,6 +329,15 @@ 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 = "i2s-hifi", + .init = rockchip_sound_cdndp_init, + .ops = &rockchip_sound_cdndp_ops, + .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 +408,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 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v3 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver @ 2016-09-09 10:29 ` Mark Brown 0 siblings, 0 replies; 19+ messages in thread From: Mark Brown @ 2016-09-09 10:29 UTC (permalink / raw) To: Chris Zhong Cc: dianders, heiko, zhengxing, cychiang, hychao, linux-rockchip, perex, devicetree, alsa-devel, lgirdwood, linux-kernel, tiwai, robh+dt, mark.rutland, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 296 bytes --] On Thu, Sep 08, 2016 at 09:43:55PM -0700, Chris Zhong wrote: > This patch adds DP audio output support to the rk3399-gru machine > driver. Please don't resend or update single patches in the middle of a patch series, it makes things very confusing. Please send the entire patch series at once. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver @ 2016-09-09 10:29 ` Mark Brown 0 siblings, 0 replies; 19+ messages in thread From: Mark Brown @ 2016-09-09 10:29 UTC (permalink / raw) To: linux-arm-kernel On Thu, Sep 08, 2016 at 09:43:55PM -0700, Chris Zhong wrote: > This patch adds DP audio output support to the rk3399-gru machine > driver. Please don't resend or update single patches in the middle of a patch series, it makes things very confusing. Please send the entire patch series at once. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 473 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160909/e5a76945/attachment.sig> ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver @ 2016-09-09 10:29 ` Mark Brown 0 siblings, 0 replies; 19+ messages in thread From: Mark Brown @ 2016-09-09 10:29 UTC (permalink / raw) To: Chris Zhong Cc: mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, heiko-4mtYJXux2i+zQB+pC5nmwQ, zhengxing-TNX95d0MmH7DzftRWevZcw, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, linux-kernel-u79uwXL29TY76Z2rM5mHXA, tiwai-IBi9RG/b67k, dianders-F7+t8E8rja9g9hUCZPvPmw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, perex-/Fr2/VpizcU, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, hychao-F7+t8E8rja9g9hUCZPvPmw, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, cychiang-F7+t8E8rja9g9hUCZPvPmw [-- Attachment #1.1: Type: text/plain, Size: 296 bytes --] On Thu, Sep 08, 2016 at 09:43:55PM -0700, Chris Zhong wrote: > This patch adds DP audio output support to the rk3399-gru machine > driver. Please don't resend or update single patches in the middle of a patch series, it makes things very confusing. Please send the entire patch series at once. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 473 bytes --] [-- Attachment #2: Type: text/plain, Size: 200 bytes --] _______________________________________________ Linux-rockchip mailing list Linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org http://lists.infradead.org/mailman/listinfo/linux-rockchip ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver @ 2016-09-24 19:13 ` Mark Brown 0 siblings, 0 replies; 19+ messages in thread From: Mark Brown @ 2016-09-24 19:13 UTC (permalink / raw) To: Chris Zhong Cc: dianders, heiko, zhengxing, cychiang, hychao, linux-rockchip, perex, devicetree, alsa-devel, lgirdwood, linux-kernel, tiwai, robh+dt, mark.rutland, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 206 bytes --] On Thu, Sep 08, 2016 at 09:43:55PM -0700, Chris Zhong wrote: > This patch adds DP audio output support to the rk3399-gru machine > driver. This doesn't apply against current code, please check and resend. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 455 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver @ 2016-09-24 19:13 ` Mark Brown 0 siblings, 0 replies; 19+ messages in thread From: Mark Brown @ 2016-09-24 19:13 UTC (permalink / raw) To: linux-arm-kernel On Thu, Sep 08, 2016 at 09:43:55PM -0700, Chris Zhong wrote: > This patch adds DP audio output support to the rk3399-gru machine > driver. This doesn't apply against current code, please check and resend. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 455 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160924/e1cfac10/attachment.sig> ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 2/2] ASoC: rockchip: Add DP dai-links to the rk3399-gru machine driver @ 2016-09-24 19:13 ` Mark Brown 0 siblings, 0 replies; 19+ messages in thread From: Mark Brown @ 2016-09-24 19:13 UTC (permalink / raw) To: Chris Zhong Cc: mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, heiko-4mtYJXux2i+zQB+pC5nmwQ, zhengxing-TNX95d0MmH7DzftRWevZcw, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, linux-kernel-u79uwXL29TY76Z2rM5mHXA, tiwai-IBi9RG/b67k, dianders-F7+t8E8rja9g9hUCZPvPmw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, perex-/Fr2/VpizcU, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, hychao-F7+t8E8rja9g9hUCZPvPmw, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, cychiang-F7+t8E8rja9g9hUCZPvPmw [-- Attachment #1.1: Type: text/plain, Size: 206 bytes --] On Thu, Sep 08, 2016 at 09:43:55PM -0700, Chris Zhong wrote: > This patch adds DP audio output support to the rk3399-gru machine > driver. This doesn't apply against current code, please check and resend. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 455 bytes --] [-- Attachment #2: Type: text/plain, Size: 200 bytes --] _______________________________________________ Linux-rockchip mailing list Linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org http://lists.infradead.org/mailman/listinfo/linux-rockchip ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2016-09-25 6:06 UTC | newest] Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 ` Chris Zhong 2016-09-06 4:48 ` 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 ` Chris Zhong 2016-09-06 4:48 ` 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 4:48 ` Chris Zhong 2016-09-06 17:09 ` [v2 PATCH " Chris Zhong 2016-09-06 17:09 ` Chris Zhong 2016-09-09 4:43 ` [PATCH v3 " Chris Zhong 2016-09-09 4:43 ` Chris Zhong 2016-09-09 4:43 ` Chris Zhong 2016-09-09 10:29 ` Mark Brown 2016-09-09 10:29 ` Mark Brown 2016-09-09 10:29 ` Mark Brown 2016-09-24 19:13 ` Mark Brown 2016-09-24 19:13 ` Mark Brown 2016-09-24 19:13 ` Mark Brown
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.