alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Timur Tabi <timur@freescale.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 5/5] ASoC: add support for the Freescale / iVeia P1022 RDK reference board
Date: Tue, 18 Sep 2012 22:32:59 -0400	[thread overview]
Message-ID: <20120919023259.GB8832@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1347657278-25295-5-git-send-email-timur@freescale.com>

On Fri, Sep 14, 2012 at 04:14:38PM -0500, Timur Tabi wrote:

>  sound/soc/fsl/Kconfig     |   14 ++
>  sound/soc/fsl/Makefile    |    4 +
>  sound/soc/fsl/p1022_rdk.c |  455 +++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 473 insertions(+), 0 deletions(-)
>  create mode 100644 sound/soc/fsl/p1022_rdk.c

This adds a new device tree binding so it should be documented.

> +	/* Tell the codec driver what the serial protocol is. */
> +	ret = snd_soc_dai_set_fmt(rtd->codec_dai, mdata->dai_format);
> +	if (ret < 0) {
> +		dev_err(dev, "could not set codec driver audio format\n");
> +		return ret;
> +	}

This should normally be done via the dai_fmt member of the dai_link
structure.

> +	ret = snd_soc_dai_set_pll(rtd->codec_dai, 0, 0, mdata->clk_frequency,
> +		mdata->clk_frequency);
> +	if (ret < 0) {
> +		dev_err(dev, "could not set codec PLL frequency\n");
> +		return ret;
> +	}

We never stop the PLL - normally you'd want to stop it when the audio
stops.  But..

> +	/* Tell the WM8960 to set SYSCLK equal to MCLK input (bypass PLL) */
> +	ret = snd_soc_dai_set_clkdiv(rtd->codec_dai, WM8960_SYSCLKDIV,
> +		WM8960_SYSCLK_MCLK | WM8960_SYSCLK_DIV_1);
> +	if (ret < 0) {
> +		dev_err(dev, "could not set codec driver clock source\n");
> +		return ret;
> +	}

...we don't appear to use the PLL output anyway so why not just leave it
off?  As this is fixed it's better style to do the setup in late_init()
or the init function for the DAI link.

Also we should log the return codes when we log failures.

> +	/* Get the serial format and clock direction. */
> +	sprop = of_get_property(np, "fsl,mode", NULL);
> +	if (!sprop) {
> +		dev_err(&pdev->dev, "fsl,mode property not found\n");
> +		ret = -EINVAL;
> +		goto error;
> +	}
> +
> +	if (strcasecmp(sprop, "i2s-slave") == 0) {
> +		mdata->dai_format = SND_SOC_DAIFMT_NB_NF |
> +			SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM;
> +		mdata->codec_clk_direction = SND_SOC_CLOCK_OUT;
> +		mdata->cpu_clk_direction = SND_SOC_CLOCK_IN;

Why would this be something that individual systems would want to
change, and if it is something it's useful to vary why not at runtime?
I suspect the best thing here is just to pick a format and use it, if
there is a reason to vary this it's probably a higher level thing.

> +	snd_soc_unregister_card(card);
> +	kfree(mdata);

devm_kzalloc().

  reply	other threads:[~2012-09-19  2:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14 21:14 [PATCH 1/5] [v3] ASoC: fsl: use snd_soc_register_card to register the card Timur Tabi
2012-09-14 21:14 ` [PATCH 2/5] ASoC: fsl: move machine drivers to late_initcall() Timur Tabi
2012-09-19  2:35   ` Mark Brown
2012-09-14 21:14 ` [PATCH 3/5] ASoC: fsl: remove unnecessary call to dma_unmap_single Timur Tabi
2012-09-19  2:35   ` Mark Brown
2012-09-14 21:14 ` [PATCH 4/5] ASoC: wm8960: add support for big-endian audio samples Timur Tabi
2012-09-19  2:34   ` Mark Brown
2012-09-19  2:58     ` Tabi Timur-B04825
2012-09-19  3:13       ` Mark Brown
2012-09-14 21:14 ` [PATCH 5/5] ASoC: add support for the Freescale / iVeia P1022 RDK reference board Timur Tabi
2012-09-19  2:32   ` Mark Brown [this message]
2012-09-19  2:47     ` Tabi Timur-B04825
2012-09-19  3:12       ` Mark Brown
2012-09-19 15:17         ` Timur Tabi
2012-09-19  2:35 ` [PATCH 1/5] [v3] ASoC: fsl: use snd_soc_register_card to register the card 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=20120919023259.GB8832@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=timur@freescale.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;
as well as URLs for NNTP newsgroup(s).