From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] ASOC: mmp: add sspa support
Date: Mon, 28 May 2012 15:59:05 +0100 [thread overview]
Message-ID: <20120528145904.GK4032@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1337929863-31885-4-git-send-email-zhangfei.gao@marvell.com>
On Fri, May 25, 2012 at 03:11:02PM +0800, Zhangfei Gao wrote:
> The SSPA is a configurable multi-channel audio serial (TDM) interface.
> It's configurable at runtime to support up to 128 channels and the
> number of bits per sample: 8, 12, 16, 20, 24 and 32 bits. It also
> support stereo format: I2S, left-justified or right-justified.
Mostly looks good. A few fairly minor things...
> +static int mmp_sspa_startup(struct snd_pcm_substream *substream,
> + struct snd_soc_dai *dai)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
> + struct sspa_priv *sspa_priv = snd_soc_dai_get_drvdata(dai);
> + struct ssp_device *sspa = sspa_priv->sspa;
> + int ret = 0;
> +
> + if (!cpu_dai->active) {
> + clk_enable(sysclk);
> + clk_enable(sspa->clk);
> + }
The clock API is refcounted so you shouldn't need to worry about
multiple enables, you should just be able to unconditionally enable and
disable. If this is needed we probably have a problem we should fix.
> + switch (pll_id) {
> + case MMP_SYSCLK:
> + clk_set_rate(sysclk, freq_out);
> + break;
> + case MMP_SSPA_CLK:
> + clk_set_rate(sspa->clk, freq_out);
> + break;
You're ignoring the return values here.
> + priv->sspa->clk = clk_get(&pdev->dev, NULL);
> + if (IS_ERR(priv->sspa->clk)) {
> + ret = PTR_ERR(priv->sspa->clk);
> + goto err_free_clk;
> + }
devm_clk_get().
> + res = request_mem_region(res->start, resource_size(res),
> + pdev->name);
> + if (res == NULL) {
> + dev_err(&pdev->dev, "failed to request memory resource\n");
> + ret = -EBUSY;
> + goto err_get_res;
> + }
> +
> + priv->sspa->mmio_base = ioremap(res->start, resource_size(res));
> + if (priv->sspa->mmio_base == NULL) {
> + dev_err(&pdev->dev, "failed to ioremap() registers\n");
> + ret = -ENODEV;
> + goto err_free_mem;
> + }
devm_request_and_ioremap().
> +err_free_clk:
> + devm_kfree(&pdev->dev, priv->dma_params);
> +err_priv_dma_params:
> + devm_kfree(&pdev->dev, priv->sspa);
> +err_priv_sspa:
> + devm_kfree(&pdev->dev, priv);
The whole point of the devm_ stuff is that you don't need to do stuff
like this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120528/44c66208/attachment.sig>
next prev parent reply other threads:[~2012-05-28 14:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-25 7:10 [PATCH 0/4] mmp audio support Zhangfei Gao
2012-05-25 7:11 ` [PATCH] dmaengine: mmp_tdma: add mmp tdma support Zhangfei Gao
2012-05-25 7:11 ` [PATCH 2/4] ASoC: mmp: add audio dma support Zhangfei Gao
2012-05-25 7:53 ` Vinod Koul
2012-05-25 8:05 ` Russell King - ARM Linux
2012-05-25 8:47 ` [alsa-devel] " zhangfei gao
2012-05-25 9:42 ` Russell King - ARM Linux
2012-05-29 5:14 ` zhangfei gao
2012-05-29 5:18 ` Vinod Koul
2012-05-29 7:33 ` Russell King - ARM Linux
2012-05-29 7:57 ` zhangfei gao
2012-05-29 8:01 ` Russell King - ARM Linux
2012-05-29 9:02 ` Mark Brown
2012-05-29 9:21 ` Russell King - ARM Linux
2012-05-29 11:03 ` Lars-Peter Clausen
2012-05-29 13:14 ` Mark Brown
2012-05-29 13:46 ` Russell King - ARM Linux
2012-05-29 23:55 ` Mark Brown
2012-05-25 7:11 ` [PATCH 3/4] ASOC: mmp: add sspa support Zhangfei Gao
2012-05-28 14:59 ` Mark Brown [this message]
2012-05-29 5:23 ` [alsa-devel] " zhangfei gao
2012-05-25 7:11 ` [PATCH 4/4] ASoC: add mmp brownstone support Zhangfei Gao
2012-05-28 15:13 ` Mark Brown
2012-05-29 3:04 ` Leo Yan
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=20120528145904.GK4032@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=linux-arm-kernel@lists.infradead.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).