From: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
To: jianqun <xjq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
perex-/Fr2/VpizcU@public.gmane.org,
tiwai-l3A5Bk7waGM@public.gmane.org,
grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: huangtao-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
yzq-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
cf-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
kfx-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
hj-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
zhenfu.fang-TNX95d0MmH7DzftRWevZcw@public.gmane.org
Subject: Re: [alsa-devel] [PATCH 2/2] ASoC: add driver for Rockchip RK3xxx I2S controller
Date: Tue, 01 Jul 2014 11:51:37 +0200 [thread overview]
Message-ID: <53B284A9.6050608@metafoo.de> (raw)
In-Reply-To: <1404204458-30881-1-git-send-email-xjq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
On 07/01/2014 10:47 AM, jianqun wrote:
[...]
> new file mode 100644
> index 0000000..946b60c
> --- /dev/null
> +++ b/sound/soc/rockchip/Kconfig
> @@ -0,0 +1,16 @@
> +config SND_SOC_ROCKCHIP
> + tristate "ASoC support for Rockchip"
> + depends on SND_SOC && ARCH_ROCKCHIP
No need for SND_SOC this is implicit for all drivers in sound/soc/. Also
allow the driver to be select when COMPILE_TEST is selected.
> + select SND_SOC_GENERIC_DMAENGINE_PCM
> + select SND_ROCKCHIP_PCM
> + select SND_ROCKCHIP_I2S
> + help
> + Say Y or M if you want to add support for codecs attached to
> + the Rockchip SoCs' Audio interfaces. You will also need to
> + select the audio interfaces to support below.
> +
[...]
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/interrupt.h>
> +#include <linux/device.h>
> +#include <linux/delay.h>
> +#include <linux/clk.h>
> +#include <linux/version.h>
> +#include <linux/of.h>
> +#include <linux/of_gpio.h>
> +#include <linux/clk.h>
> +#include <linux/io.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +#include <linux/io.h>
> +#include <linux/spinlock.h>
> +#include <linux/workqueue.h>
> +#include <asm/dma.h>
> +#include <sound/core.h>
> +#include <sound/pcm.h>
> +#include <sound/pcm_params.h>
> +#include <sound/initval.h>
> +#include <sound/soc.h>
> +#include <sound/dmaengine_pcm.h>
Are you sure that you need all of these includes?
> +
[...]
> +static struct snd_soc_dai_ops rockchip_i2s_dai_ops = {
const
> + .trigger = rockchip_i2s_trigger,
> + .hw_params = rockchip_i2s_hw_params,
> + .set_fmt = rockchip_i2s_set_fmt,
> + .set_clkdiv = rockchip_i2s_set_clkdiv,
> + .set_sysclk = rockchip_i2s_set_sysclk,
> +};
[...]
> +static int rockchip_i2s_probe(struct platform_device *pdev)
> +{
[...]
> + /* Try to set the I2S Channel id from dt */
> + pdev->id = of_alias_get_id(np, "i2s");
> + dev_set_name(&pdev->dev, "%s.%d",
> + pdev->dev.driver->name,
> + pdev->id);
A device should not change its id or name.
> +
> + i2s->dev = &pdev->dev;
> + dev_set_drvdata(&pdev->dev, i2s);
> +
> + ret = devm_snd_soc_register_component(&pdev->dev,
> + &rockchip_i2s_component,
> + &rockchip_i2s_dai[pdev->id], 1);
If those are two instances of the same I2S core just use one
snd_soc_dai_driver struct. There is no need for the driver to know or care
about how many instances of the core the system has.
[...]
> +
> +static const struct snd_pcm_hardware rockchip_pcm_hardware = {
> + .info = SNDRV_PCM_INFO_INTERLEAVED |
> + SNDRV_PCM_INFO_BLOCK_TRANSFER |
> + SNDRV_PCM_INFO_MMAP |
> + SNDRV_PCM_INFO_MMAP_VALID |
> + SNDRV_PCM_INFO_PAUSE |
> + SNDRV_PCM_INFO_RESUME,
> + .formats = SNDRV_PCM_FMTBIT_S24_LE |
> + SNDRV_PCM_FMTBIT_S20_3LE |
> + SNDRV_PCM_FMTBIT_S16_LE,
> + .channels_min = 2,
> + .channels_max = 8,
> + .buffer_bytes_max = 128*1024,
> + .period_bytes_min = 64,
> + .period_bytes_max = 2048*4,
> + .periods_min = 3,
> + .periods_max = 128,
> + .fifo_size = 16,
> +};
> +
> +static const struct snd_dmaengine_pcm_config rockchip_dmaengine_pcm_config = {
> + .pcm_hardware = &rockchip_pcm_hardware,
> + .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
> + .compat_filter_fn = NULL,
> + .prealloc_buffer_size = PAGE_SIZE * 8,
> +};
> +
> +int rockchip_pcm_platform_register(struct device *dev)
> +{
> + return snd_dmaengine_pcm_register(dev, &rockchip_dmaengine_pcm_config,
> + SND_DMAENGINE_PCM_FLAG_COMPAT|
> + SND_DMAENGINE_PCM_FLAG_NO_RESIDUE);
We should try to avoid adding new users of the generic dmaengine pcm driver
that manually specify a snd_pcm_hardware struct. We now have the
infrastructure to autodiscover the capabilities of the DMA via the dmaengine
API.
New drivers really should just do snd_dmaengine_pcm_register(dev, NULL, 0);
- Lars
--
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:[~2014-07-01 9:51 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 8:37 [PATCH 0/2] add rockchip i2s driver jianqun
[not found] ` <1404203860-30712-1-git-send-email-xjq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-07-01 8:37 ` [PATCH 1/2] ASoC: dt-bindings: add rockchip i2s bindings jianqun
[not found] ` <1404203860-30712-2-git-send-email-xjq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-07-01 8:54 ` Mark Rutland
2014-07-01 10:08 ` jianqun
2014-07-04 7:26 ` [PATCH v2 " jianqun
[not found] ` <1404458796-6818-1-git-send-email-xjq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-07-04 16:55 ` Mark Rutland
2014-07-05 11:10 ` [PATCH v3 " jianqun
[not found] ` <1404558638-1739-1-git-send-email-xjq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-07-09 7:40 ` Mark Brown
2014-07-01 8:47 ` [PATCH 2/2] ASoC: add driver for Rockchip RK3xxx I2S controller jianqun
[not found] ` <1404204458-30881-1-git-send-email-xjq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-07-01 9:01 ` Mark Rutland
2014-07-01 9:51 ` Lars-Peter Clausen [this message]
2014-07-01 17:07 ` Mark Brown
2014-07-02 1:01 ` Huang Tao
[not found] ` <53B359FD.3080809-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-07-02 10:23 ` Mark Brown
2014-07-02 10:57 ` Jianqun
2014-07-02 11:16 ` Mark Brown
2014-07-04 7:29 ` [PATCH v2 " jianqun
2014-07-05 11:13 ` [PATCH v3 " jianqun
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=53B284A9.6050608@metafoo.de \
--to=lars-qo5elluwu/uelga04laivw@public.gmane.org \
--cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=cf-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
--cc=hj-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=huangtao-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=kfx-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=perex-/Fr2/VpizcU@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=tiwai-l3A5Bk7waGM@public.gmane.org \
--cc=xjq-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=yzq-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=zhenfu.fang-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
--cc=zyw-TNX95d0MmH7DzftRWevZcw@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).