From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] drm/vc4: Add HDMI audio support
Date: Fri, 24 Feb 2017 14:09:36 +0100 [thread overview]
Message-ID: <20170224140936.4b4b8bd5@bbrezillon> (raw)
In-Reply-To: <20170207210703.7082-2-eric@anholt.net>
Hi Eric,
On Tue, 7 Feb 2017 13:07:02 -0800
Eric Anholt <eric@anholt.net> wrote:
> +static int vc4_hdmi_audio_init(struct vc4_hdmi *hdmi)
> +{
> + struct snd_soc_dai_link *dai_link = &hdmi->audio.link;
> + struct snd_soc_card *card = &hdmi->audio.card;
> + struct device *dev = &hdmi->pdev->dev;
> + const __be32 *addr;
> + int ret;
> +
> + if (!of_find_property(dev->of_node, "dmas", NULL)) {
> + dev_warn(dev,
> + "'dmas' DT property is missing, no HDMI audio\n");
> + return 0;
> + }
> +
> + /*
> + * Get the physical address of VC4_HD_MAI_DATA. We need to retrieve
> + * the bus address specified in the DT, because the physical address
> + * (the one returned by platform_get_resource()) is not appropriate
> + * for DMA transfers.
> + * This VC/MMU should probably be exposed to avoid this kind of hacks.
> + */
> + addr = of_get_address(dev->of_node, 1, NULL, NULL);
> + hdmi->audio.dma_data.addr = be32_to_cpup(addr) + VC4_HD_MAI_DATA;
> + hdmi->audio.dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> + hdmi->audio.dma_data.maxburst = 2;
> +
> + ret = devm_snd_dmaengine_pcm_register(dev, &pcm_conf, 0);
> + if (ret) {
> + dev_err(dev, "Could not register PCM component: %d\n", ret);
> + return ret;
> + }
> +
> + ret = devm_snd_soc_register_component(dev, &vc4_hdmi_audio_cpu_dai_comp,
> + &vc4_hdmi_audio_cpu_dai_drv, 1);
> + if (ret) {
> + dev_err(dev, "Could not register CPU DAI: %d\n", ret);
> + return ret;
> + }
> +
> + /* register codec and codec dai */
> + ret = snd_soc_register_codec(dev, &vc4_hdmi_audio_codec_drv,
> + &vc4_hdmi_audio_codec_dai_drv, 1);
> + if (ret) {
> + dev_err(dev, "Could not register codec: %d\n", ret);
> + return ret;
> + }
> +
> + dai_link->name = "MAI";
> + dai_link->stream_name = "MAI PCM";
> + dai_link->codec_dai_name = vc4_hdmi_audio_codec_dai_drv.name;
> + dai_link->cpu_dai_name = dev_name(dev);
> + dai_link->codec_name = dev_name(dev);
> + dai_link->platform_name = dev_name(dev);
> +
> + card->dai_link = dai_link;
> + card->num_links = 1;
> + card->name = "vc4-hdmi-audio";
I know I'm the one who chose this name, but maybe we should just change
it for "vc4-hdmi", since audio is kind of implied here ;-).
next prev parent reply other threads:[~2017-02-24 13:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-07 21:07 [PATCH 1/3] dt-bindings: Document the dmas and dma-names properties for VC4 HDMI Eric Anholt
2017-02-07 21:07 ` [PATCH 2/3] drm/vc4: Add HDMI audio support Eric Anholt
2017-02-24 13:09 ` Boris Brezillon [this message]
2017-02-07 21:07 ` [PATCH 3/3] ARM: dts: bcm283x: Add HDMI audio related properties Eric Anholt
2017-02-15 22:48 ` [PATCH 1/3] dt-bindings: Document the dmas and dma-names properties for VC4 HDMI Rob Herring
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=20170224140936.4b4b8bd5@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).