From: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
To: Eric Anholt <eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
Lee Jones <lee-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
Jaroslav Kysela <perex-/Fr2/VpizcU@public.gmane.org>,
Takashi Iwai <tiwai-IBi9RG/b67k@public.gmane.org>,
Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org
Subject: Re: [PATCH V2 1/3] ASoC: bcm2835: move to use the clock framework
Date: Mon, 8 Feb 2016 13:08:00 +0100 [thread overview]
Message-ID: <56B88520.5060606@martin.sperl.org> (raw)
In-Reply-To: <87vb6dfjbu.fsf-omZaPlIz5HhaEpDpdNBo/KxOck334EZe@public.gmane.org>
On 28.01.2016 23:08, Eric Anholt wrote:
> kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org writes:
>
>> From: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
>>
>> Since the move to the new clock framework with commit 94cb7f76caa0
>> ("ARM: bcm2835: Switch to using the new clock driver support.")
>> this driver was no longer functional as it was manipulating the
>> clock registers locally without going true the framework.
>>
>> This patch moves to use the new clock framework and also
>> moves away from the hardcoded address offsets for DMA getting
>> the dma-address directly from the device tree.
>>
>> Note that the optimal bclk_ratio selection to avoid jitter
>> due to the use of fractional dividers, which is in the
>> current version has been removed, because not all devices
>> support these non power of 2 sized transfers, which resulted
>> in lots of (downstream) modules that use:
>> snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2);
>>
>> Signed-off-by: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
>> ---
>> sound/soc/bcm/bcm2835-i2s.c | 284 ++++++++++---------------------------------
>> 1 file changed, 64 insertions(+), 220 deletions(-)
>>
>> diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
>> index 3303d5f..1c1f221 100644
>> --- a/sound/soc/bcm/bcm2835-i2s.c
>> +++ b/sound/soc/bcm/bcm2835-i2s.c
>
>> - dev->i2s_regmap = regmap[0];
>> - dev->clk_regmap = regmap[1];
>> + /* get the clock */
>> + dev->clk_prepared = false;
>> + dev->clk = devm_clk_get(&pdev->dev, NULL);
>> + if (IS_ERR(dev->clk)) {
>> + dev_err(&pdev->dev, "could not get clk: %ld\n",
>> + PTR_ERR(dev->clk));
>> + return PTR_ERR(dev->clk);
>> + }
>> +
>> + /* Request ioarea */
>> + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> + base = devm_ioremap_resource(&pdev->dev, mem);
>> + if (IS_ERR(base))
>> + return PTR_ERR(base);
>> +
>> + dev->i2s_regmap = devm_regmap_init_mmio(&pdev->dev, base,
>> + &bcm2835_regmap_config);
>> + if (IS_ERR(dev->i2s_regmap))
>> + return PTR_ERR(dev->i2s_regmap);
>> +
>> + /* Set the DMA address - we have to parse DT ourselves */
>> + addr = of_get_address(pdev->dev.of_node, 0, NULL, NULL);
>> + if (!addr) {
>> + dev_err(&pdev->dev, "could not get DMA-register address\n");
>> + return -EINVAL;
>> + }
>> + dma_base = be32_to_cpup(addr);
>
> Why aren't we just using mem->start like before? That seems like an
> independent change that should be justified on its own. I'd be ready to
> ack the patch if that change is removed.
>
Problem is that we need the VC4 bus-address (0x7e203000),
which is the actual <reg> value from the device tree without any
mapping.
Not the ARM MMU visible address mappings that mem->start provides
(typically 0x20203000 or 0x3f203000 for bcm2836)
Nor the mapped address (base) available in the kernel (typically
0xdc......).
This is the only way to get it correctly and has been done the same way
with spi-bcm2835.
--
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
next prev parent reply other threads:[~2016-02-08 12:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-12 12:35 [PATCH V2 0/3] ASOC: bcm2835: move bcm2835-i2s to use clock framework kernel-TqfNSX0MhmxHKSADF0wUEw
[not found] ` <1452602149-5875-1-git-send-email-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2016-01-12 12:35 ` [PATCH V2 1/3] ASoC: bcm2835: move to use the " kernel-TqfNSX0MhmxHKSADF0wUEw
[not found] ` <1452602149-5875-2-git-send-email-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2016-01-28 22:08 ` Eric Anholt
[not found] ` <87vb6dfjbu.fsf-omZaPlIz5HhaEpDpdNBo/KxOck334EZe@public.gmane.org>
2016-02-08 12:08 ` Martin Sperl [this message]
2016-02-13 0:47 ` Eric Anholt
[not found] ` <87bn7l3085.fsf-omZaPlIz5HhaEpDpdNBo/KxOck334EZe@public.gmane.org>
2016-02-13 8:51 ` Martin Sperl
2016-01-12 12:35 ` [PATCH V2 2/3] ARM: bcm2835: I2S: use new register-range and " kernel-TqfNSX0MhmxHKSADF0wUEw
[not found] ` <1452602149-5875-3-git-send-email-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2016-01-16 15:26 ` Stefan Wahren
2016-01-16 16:47 ` Martin Sperl
2016-01-28 22:16 ` Eric Anholt
2016-01-12 12:35 ` [PATCH V2 3/3] dt-bindings: bsm2835: fix bindings documentation to use new " kernel-TqfNSX0MhmxHKSADF0wUEw
[not found] ` <1452602149-5875-4-git-send-email-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2016-01-12 14:36 ` Rob Herring
2016-01-12 15:52 ` Martin Sperl
[not found] ` <2EC555E0-91B9-45AA-8804-848C445E052E-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2016-01-28 22:11 ` Eric Anholt
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=56B88520.5060606@martin.sperl.org \
--to=kernel-tqfnsx0mhmxhksadf0wuew@public.gmane.org \
--cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org \
--cc=lee-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=perex-/Fr2/VpizcU@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=tiwai-IBi9RG/b67k@public.gmane.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).