From: Lars-Peter Clausen <lars@metafoo.de>
To: jianqun <xjq@rock-chips.com>,
heiko@sntech.de, lgirdwood@gmail.com, broonie@kernel.org,
perex@perex.cz, tiwai@suse.de, grant.likely@linaro.org,
robh+dt@kernel.org
Cc: huangtao@rock-chips.com, devicetree@vger.kernel.org,
alsa-devel@alsa-project.org, yzq@rock-chips.com,
zhangqing@rock-chips.com, linux-kernel@vger.kernel.org,
kever.yang@rock-chips.com, cf@rock-chips.com, kfx@rock-chips.com,
zyw@rock-chips.com, hj@rock-chips.com,
zhenfu.fang@rock-chips.com
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@rock-chips.com>
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
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
2014-07-01 8:37 ` [PATCH 1/2] ASoC: dt-bindings: add rockchip i2s bindings jianqun
2014-07-01 8:54 ` Mark Rutland
2014-07-01 10:08 ` jianqun
2014-07-04 7:26 ` [PATCH v2 " jianqun
2014-07-04 16:55 ` Mark Rutland
2014-07-05 11:10 ` [PATCH v3 " jianqun
2014-07-09 7:40 ` Mark Brown
2014-07-01 8:47 ` [PATCH 2/2] ASoC: add driver for Rockchip RK3xxx I2S controller jianqun
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
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@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=cf@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=heiko@sntech.de \
--cc=hj@rock-chips.com \
--cc=huangtao@rock-chips.com \
--cc=kever.yang@rock-chips.com \
--cc=kfx@rock-chips.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=tiwai@suse.de \
--cc=xjq@rock-chips.com \
--cc=yzq@rock-chips.com \
--cc=zhangqing@rock-chips.com \
--cc=zhenfu.fang@rock-chips.com \
--cc=zyw@rock-chips.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox