From: Lars-Peter Clausen <lars@metafoo.de>
To: Barry Song <21cnbao@gmail.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
Liam Girdwood <lgirdwood@gmail.com>,
DL-SHA-WorkGroupLinux <workgroup.linux@csr.com>,
Rongjun Ying <Rongjun.Ying@csr.com>,
Mark Brown <broonie@kernel.org>, Barry Song <Baohua.Song@csr.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 2/6] ASoC: sirf: add I2S CPU DAI driver
Date: Mon, 28 Oct 2013 09:48:46 +0100 [thread overview]
Message-ID: <526E24EE.70402@metafoo.de> (raw)
In-Reply-To: <CAGsJ_4xHHD9XqLMdepUgRL7_X5Xg3_AQ2K83pbCxiFhV8cX4zg@mail.gmail.com>
On 10/28/2013 09:32 AM, Barry Song wrote:
> 2013/10/28 Lars-Peter Clausen <lars@metafoo.de>:
>> On 10/27/2013 11:37 PM, Barry Song wrote:
>>> +struct snd_soc_dai_ops sirfsoc_i2s_dai_ops = {
>>
>> static const
>>
>> Building your driver with sparse (`make C=2 ...`) will tell you these things.
>>
>>> + .startup = sirf_i2s_startup,
>>> + .shutdown = sirf_i2s_shutdown,
>>> + .trigger = sirf_i2s_trigger,
>>> + .hw_params = sirf_i2s_hw_params,
>>> + .set_fmt = sirf_i2s_set_dai_fmt,
>>> + .set_clkdiv = sirf_i2s_set_clkdiv,
>>> +};
>>> +
>> [...]
>>> +
>>> +static int sirf_i2s_probe(struct platform_device *pdev)
>>> +{
>>> + struct sirf_i2s *si2s;
>>> + u32 rx_dma_ch, tx_dma_ch;
>>> + int ret;
>>> + struct resource mem_res;
>>> +
>>> + si2s = devm_kzalloc(&pdev->dev, sizeof(struct sirf_i2s),
>>> + GFP_KERNEL);
>>> + if (!si2s)
>>> + return -ENOMEM;
>>> +
>>> + si2s->sirf_pcm_pdev = platform_device_register_simple("sirf-pcm-audio",
>>> + 0, NULL, 0);
>>> + if (IS_ERR(si2s->sirf_pcm_pdev))
>>> + return PTR_ERR(si2s->sirf_pcm_pdev);
>>> +
>>> + platform_set_drvdata(pdev, si2s);
>>> +
>>> + spin_lock_init(&si2s->lock);
>>> +
>>> + ret = of_property_read_u32(pdev->dev.of_node,
>>> + "sirf,i2s-dma-rx-channel", &rx_dma_ch);
>>> + if (ret < 0) {
>>> + dev_err(&pdev->dev, "Unable to USP0 rx dma channel\n");
>>> + return ret;
>>> + }
>>> + ret = of_property_read_u32(pdev->dev.of_node,
>>> + "sirf,i2s-dma-tx-channel", &tx_dma_ch);
>>> + if (ret < 0) {
>>> + dev_err(&pdev->dev, "Unable to USP0 tx dma channel\n");
>>> + return ret;
>>> + }
>>> +
>>> + dma_data[0].filter_data = (void *)tx_dma_ch;
>>> + dma_data[1].filter_data = (void *)rx_dma_ch;
>>
>> This should be using the standard DMA OF bindings. This combind with the
>> recent changes to the generic dmaengine PCM driver, which added support for
>> querying certain parameters (like max period length) from the dmaengine
>> driver, will allow you to completely remove your custom PCM code. You'd
>> basically just need to call "snd_dmaengine_pcm_register(&pdev->dev, NULL)"
>> here in the I2S driver.
>>
>> This will require some changes to your dmaengine driver though. You need to
>> implement the of_xlate callback for the generic DMA bindings and the
>> device_slave_caps API for being able to query the capabilities from the driver.
>
> i am really happy to have that as for clock, gpio, pinctrl, all of
> them we have the binding.
> here the problem is we can't implement this in this driver as there
> are still many drivers depending on the sirf-dma changes.
>
> so our point is keeping the things as is here. and we have another
> patchset of dt binding for sirf-dma and all drivers depending sirf-dma
> driver.
I don't think this is a good idea. Adding of_xlate support to the DMA driver
is a 10 line patch at most. And there is no compile time dependency between
the DMA driver changes and using the generic DMA bindings in this driver, so
this driver does not have to wait for the changes to the DMA driver to be
merged first.
I'm fine with having the device_slave_caps stuff added in a later patch, but
adding custom DMA bindings at this point is in my opinion a no-go.
Especially if you consider that DT bindings are considered ABI by some people.
Btw. the DT bindings documentation for this driver seems to be missing.
- Lars
WARNING: multiple messages have this Message-ID (diff)
From: lars@metafoo.de (Lars-Peter Clausen)
To: linux-arm-kernel@lists.infradead.org
Subject: [alsa-devel] [PATCH v2 2/6] ASoC: sirf: add I2S CPU DAI driver
Date: Mon, 28 Oct 2013 09:48:46 +0100 [thread overview]
Message-ID: <526E24EE.70402@metafoo.de> (raw)
In-Reply-To: <CAGsJ_4xHHD9XqLMdepUgRL7_X5Xg3_AQ2K83pbCxiFhV8cX4zg@mail.gmail.com>
On 10/28/2013 09:32 AM, Barry Song wrote:
> 2013/10/28 Lars-Peter Clausen <lars@metafoo.de>:
>> On 10/27/2013 11:37 PM, Barry Song wrote:
>>> +struct snd_soc_dai_ops sirfsoc_i2s_dai_ops = {
>>
>> static const
>>
>> Building your driver with sparse (`make C=2 ...`) will tell you these things.
>>
>>> + .startup = sirf_i2s_startup,
>>> + .shutdown = sirf_i2s_shutdown,
>>> + .trigger = sirf_i2s_trigger,
>>> + .hw_params = sirf_i2s_hw_params,
>>> + .set_fmt = sirf_i2s_set_dai_fmt,
>>> + .set_clkdiv = sirf_i2s_set_clkdiv,
>>> +};
>>> +
>> [...]
>>> +
>>> +static int sirf_i2s_probe(struct platform_device *pdev)
>>> +{
>>> + struct sirf_i2s *si2s;
>>> + u32 rx_dma_ch, tx_dma_ch;
>>> + int ret;
>>> + struct resource mem_res;
>>> +
>>> + si2s = devm_kzalloc(&pdev->dev, sizeof(struct sirf_i2s),
>>> + GFP_KERNEL);
>>> + if (!si2s)
>>> + return -ENOMEM;
>>> +
>>> + si2s->sirf_pcm_pdev = platform_device_register_simple("sirf-pcm-audio",
>>> + 0, NULL, 0);
>>> + if (IS_ERR(si2s->sirf_pcm_pdev))
>>> + return PTR_ERR(si2s->sirf_pcm_pdev);
>>> +
>>> + platform_set_drvdata(pdev, si2s);
>>> +
>>> + spin_lock_init(&si2s->lock);
>>> +
>>> + ret = of_property_read_u32(pdev->dev.of_node,
>>> + "sirf,i2s-dma-rx-channel", &rx_dma_ch);
>>> + if (ret < 0) {
>>> + dev_err(&pdev->dev, "Unable to USP0 rx dma channel\n");
>>> + return ret;
>>> + }
>>> + ret = of_property_read_u32(pdev->dev.of_node,
>>> + "sirf,i2s-dma-tx-channel", &tx_dma_ch);
>>> + if (ret < 0) {
>>> + dev_err(&pdev->dev, "Unable to USP0 tx dma channel\n");
>>> + return ret;
>>> + }
>>> +
>>> + dma_data[0].filter_data = (void *)tx_dma_ch;
>>> + dma_data[1].filter_data = (void *)rx_dma_ch;
>>
>> This should be using the standard DMA OF bindings. This combind with the
>> recent changes to the generic dmaengine PCM driver, which added support for
>> querying certain parameters (like max period length) from the dmaengine
>> driver, will allow you to completely remove your custom PCM code. You'd
>> basically just need to call "snd_dmaengine_pcm_register(&pdev->dev, NULL)"
>> here in the I2S driver.
>>
>> This will require some changes to your dmaengine driver though. You need to
>> implement the of_xlate callback for the generic DMA bindings and the
>> device_slave_caps API for being able to query the capabilities from the driver.
>
> i am really happy to have that as for clock, gpio, pinctrl, all of
> them we have the binding.
> here the problem is we can't implement this in this driver as there
> are still many drivers depending on the sirf-dma changes.
>
> so our point is keeping the things as is here. and we have another
> patchset of dt binding for sirf-dma and all drivers depending sirf-dma
> driver.
I don't think this is a good idea. Adding of_xlate support to the DMA driver
is a 10 line patch at most. And there is no compile time dependency between
the DMA driver changes and using the generic DMA bindings in this driver, so
this driver does not have to wait for the changes to the DMA driver to be
merged first.
I'm fine with having the device_slave_caps stuff added in a later patch, but
adding custom DMA bindings at this point is in my opinion a no-go.
Especially if you consider that DT bindings are considered ABI by some people.
Btw. the DT bindings documentation for this driver seems to be missing.
- Lars
next prev parent reply other threads:[~2013-10-28 8:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-27 22:37 [PATCH v2 2/6] ASoC: sirf: add I2S CPU DAI driver Barry Song
2013-10-27 22:37 ` Barry Song
2013-10-28 3:41 ` Timur Tabi
2013-10-28 3:41 ` [alsa-devel] " Timur Tabi
2013-10-28 6:48 ` Lars-Peter Clausen
2013-10-28 6:48 ` [alsa-devel] " Lars-Peter Clausen
2013-10-28 8:32 ` Barry Song
2013-10-28 8:32 ` [alsa-devel] " Barry Song
2013-10-28 8:48 ` Lars-Peter Clausen [this message]
2013-10-28 8:48 ` Lars-Peter Clausen
2013-10-28 8:58 ` Barry Song
2013-10-28 8:58 ` [alsa-devel] " Barry Song
2013-10-28 16:21 ` Mark Brown
2013-10-28 16:21 ` 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=526E24EE.70402@metafoo.de \
--to=lars@metafoo.de \
--cc=21cnbao@gmail.com \
--cc=Baohua.Song@csr.com \
--cc=Rongjun.Ying@csr.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=workgroup.linux@csr.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 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.