linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Xiubo Li <Li.Xiubo@freescale.com>
Cc: mark.rutland@arm.com, alsa-devel@alsa-project.org,
	linux-doc@vger.kernel.org, tiwai@suse.de, b18965@freescale.com,
	timur@tabi.org, perex@perex.cz, r65073@freescale.com,
	LW@KARO-electronics.de, linux@arm.linux.org.uk,
	b42378@freescale.com, linux-arm-kernel@lists.infradead.org,
	grant.likely@linaro.org, devicetree@vger.kernel.org,
	ian.campbell@citrix.com, pawel.moll@arm.com,
	swarren@wwwdotorg.org, rob.herring@calxeda.com, oskar@scara.com,
	fabio.estevam@freescale.com, lgirdwood@gmail.com,
	linux-kernel@vger.kernel.org, rob@landley.net,
	r64188@freescale.com, shawn.guo@linaro.org,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCHv1 1/8] ALSA: Add SAI SoC Digital Audio Interface driver.
Date: Thu, 24 Oct 2013 12:05:43 +0100	[thread overview]
Message-ID: <20131024110543.GA18506@sirena.org.uk> (raw)
In-Reply-To: <1382000477-17304-2-git-send-email-Li.Xiubo@freescale.com>

[-- Attachment #1: Type: text/plain, Size: 2866 bytes --]

On Thu, Oct 17, 2013 at 05:01:10PM +0800, Xiubo Li wrote:

> +static struct snd_pcm_hardware snd_fsl_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_S16_LE,
> +	.rate_min = 8000,
> +	.channels_min = 2,
> +	.channels_max = 2,
> +	.buffer_bytes_max = FSL_SAI_DMABUF_SIZE,
> +	.period_bytes_min = 4096,
> +	.period_bytes_max = FSL_SAI_DMABUF_SIZE / TCD_NUMBER,
> +	.periods_min = TCD_NUMBER,
> +	.periods_max = TCD_NUMBER,
> +	.fifo_size = 0,
> +};

There's a patch in -next that lets the generic dmaengine code figure out
some settings from the dmacontroller rather than requiring the driver to
explicitly provide configuration - it's "ASoC: dmaengine-pcm: Provide
default config".  Please update your driver to use this, or let's work
out what it doesn't do any try to fix it.

> +	ret = fsl_sai_set_dai_sysclk_tr(cpu_dai, clk_id, freq,
> +					FSL_FMT_TRANSMITTER);
> +	if (ret) {
> +		dev_err(cpu_dai->dev,
> +				"Cannot set sai's transmitter sysclk: %d\n",
> +				ret);
> +		return ret;
> +	}
> +
> +	ret = fsl_sai_set_dai_sysclk_tr(cpu_dai, clk_id, freq,
> +					FSL_FMT_RECEIVER);

As other people have commented these should be exposed as separate
clocks rather than set in sync, unless there's some hardware reason they
need to be identical.  If that is the case then a comment explaining the
limitation would be good.

Similarly with several of the other functions.

> +int fsl_sai_dai_remove(struct snd_soc_dai *dai)
> +{
> +	struct fsl_sai *sai = dev_get_drvdata(dai->dev);
> +
> +	clk_disable_unprepare(sai->clk);

It'd be a bit nicer to only enable the clock while the driver is
actively being used rather than all the time the system is powered up
but it's not a blocker for merge.

> +	ret = snd_soc_register_component(&pdev->dev, &fsl_component,
> +			&fsl_sai_dai, 1);
> +	if (ret)
> +		return ret;

There's a devm_snd_soc_register_component() in -next, please use that.

> +
> +	ret = fsl_pcm_dma_init(pdev);
> +	if (ret)
> +		goto out;
> +
> +	platform_set_drvdata(pdev, sai);

These should go before the driver is registered with the subsystem
otherwise you've got a race where something might try to use the driver
before init is finished.

> +static int fsl_sai_remove(struct platform_device *pdev)
> +{
> +	struct fsl_sai *sai = platform_get_drvdata(pdev);
> +
> +	fsl_pcm_dma_exit(pdev);
> +
> +	snd_soc_unregister_component(&pdev->dev);

Similarly here, unregister from the subsystem then clean up after.

> +#define SAI_CR5_FBT(x)		((x) << 8)
> +#define SAI_CR5_FBT_MASK	(0x1f << 8)
> +
> +/* SAI audio dividers */
> +#define FSL_SAI_TX_DIV		0
> +#define FSL_SAI_RX_DIV		1

Make the namespacing consistent please - for preference use FSL_SAI
always.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2013-10-24 11:06 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-17  9:01 [PATCHv1 0/8] ALSA: Add SAI driver and enable SGT15000 codec Xiubo Li
2013-10-17  9:01 ` [PATCHv1 1/8] ALSA: Add SAI SoC Digital Audio Interface driver Xiubo Li
2013-10-17  9:42   ` Lothar Waßmann
2013-10-18  3:19     ` Xiubo Li-B47053
2013-10-17 12:15   ` Timur Tabi
2013-10-17 12:21     ` [alsa-devel] " Lars-Peter Clausen
2013-10-17 13:22       ` Timur Tabi
2013-10-17 13:33         ` Lars-Peter Clausen
2013-10-17 13:37           ` Timur Tabi
2013-10-17 13:51             ` Lars-Peter Clausen
2013-10-17 14:10               ` Mark Brown
2013-10-18  3:42                 ` Xiubo Li-B47053
2013-10-17 17:43   ` Lars-Peter Clausen
2013-10-21  6:59     ` Xiubo Li-B47053
2013-10-22  2:20     ` Xiubo Li-B47053
2013-10-28  5:58     ` Xiubo Li-B47053
2013-11-12  5:02       ` Vinod Koul
2013-11-12  7:35         ` Li Xiubo
2013-11-12  7:59           ` Lars-Peter Clausen
2013-10-24 11:05   ` Mark Brown [this message]
2013-10-28  7:15     ` Xiubo Li-B47053
2013-10-29  4:00     ` Xiubo Li-B47053
2013-10-29  4:02       ` Nicolin Chen
2013-10-29  9:31         ` Xiubo Li-B47053
2013-10-17  9:01 ` [PATCHv1 2/8] ARM: dts: Add Freescale SAI ALSA SoC Digital Audio Interface node for VF610 Xiubo Li
2013-10-17  9:01 ` [PATCHv1 3/8] ARM: dts: Enables SAI ALSA SoC DAI device for Vybrid VF610 TOWER board Xiubo Li
2013-10-17  9:01 ` [PATCHv1 4/8] Documentation: Add device tree bindings for Freescale SAI Xiubo Li
2013-10-17  9:01 ` [PATCHv1 5/8] ASoC: sgtl5000: Revise the bugs about the sgt15000 codec Xiubo Li
2013-10-17  9:56   ` Nicolin Chen
2013-10-21  4:07     ` Xiubo Li-B47053
2013-10-17 10:17   ` Lothar Waßmann
2013-10-21  4:15     ` Xiubo Li-B47053
2013-10-21  8:11       ` Lothar Waßmann
2013-10-21 11:21       ` Timur Tabi
2013-10-18 17:28   ` Mark Brown
2013-10-28  6:07     ` Xiubo Li-B47053
2013-10-17  9:01 ` [PATCHv1 6/8] ASoC: fsl: add SGT15000 based audio machine driver Xiubo Li
2013-10-18 17:33   ` Mark Brown
2013-10-21  7:50     ` Xiubo Li-B47053
2013-10-17  9:01 ` [PATCHv1 7/8] ARM: dts: Enable SGT15000 codec based audio driver node for VF610 Xiubo Li
2013-10-17  9:01 ` [PATCHv1 8/8] Documentation: Add device tree bindings for Freescale VF610 sound Xiubo Li
2013-10-17  9:46   ` Lucas Stach
2013-10-18  3:27     ` Xiubo Li-B47053
2013-10-18 17:31   ` Mark Brown
2013-10-21  7:24     ` Xiubo Li-B47053
2013-10-22  9:47       ` Mark Brown
2013-10-17 10:22 ` [PATCHv1 0/8] ALSA: Add SAI driver and enable SGT15000 codec Lothar Waßmann

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=20131024110543.GA18506@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=LW@KARO-electronics.de \
    --cc=Li.Xiubo@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b18965@freescale.com \
    --cc=b42378@freescale.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@freescale.com \
    --cc=grant.likely@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mark.rutland@arm.com \
    --cc=oskar@scara.com \
    --cc=pawel.moll@arm.com \
    --cc=perex@perex.cz \
    --cc=r64188@freescale.com \
    --cc=r65073@freescale.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=shawn.guo@linaro.org \
    --cc=swarren@wwwdotorg.org \
    --cc=timur@tabi.org \
    --cc=tiwai@suse.de \
    /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).