From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: David Lambert <dlambert@ti.com>
Cc: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
Liam Girdwood <lrg@slimlogic.co.uk>,
Tony Lindgren <tony@atomide.com>, Paul Walmsley <paul@pwsan.com>
Subject: Re: [PATCH 1/5] ASoC: DMIC: Adding the OMAP DMIC driver
Date: Tue, 28 Dec 2010 14:18:00 +0000 [thread overview]
Message-ID: <20101228141759.GA31883@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1293509826-23253-2-git-send-email-dlambert@ti.com>
On Mon, Dec 27, 2010 at 10:17:02PM -0600, David Lambert wrote:
> + case 19200000:
> + if (div == 5)
> + div_sel = 0x1;
> + else if (div == 8)
> + div_sel = 0x0;
> + break;
A switch statement for the valid div values would feel more natural,
together with a default case to report errors though that's handled
below so could be skipped.
> + /* Acknowledge irq event */
> + omap_dmic_write(dmic, OMAP_DMIC_IRQSTATUS, irq_status);
> + if (irq_status & OMAP_DMIC_IRQ_FULL)
Blank line between these two.
> + dev_dbg(dmic->dev, "DMIC FIFO error %x\n", irq_status);
> +
> + if (irq_status & OMAP_DMIC_IRQ_EMPTY)
> + dev_dbg(dmic->dev, "DMIC FIFO error %x\n", irq_status);
I'd expect these errors to be displayed by default.
> + if (irq_status & OMAP_DMIC_IRQ)
> + dev_dbg(dmic->dev, "DMIC write request\n");
A comment explaining why we don't actually do anything with the request
would be helpful. Given that we're ignoring the event it'd seem better
to just leave it masked and not take the interrupt in the first place.
> +static int omap_dmic_dai_startup(struct snd_pcm_substream *substream,
> + struct snd_soc_dai *dai)
> +{
> + struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
> +
> + if (!dmic->active++)
> + pm_runtime_get_sync(dmic->dev);
The pm_runtime API does refcounting for you so you should be able to
just skip the active count check here, IIRC there's a pm_runtime API you
could use to query if the DMIC is enabled so you could skip the local
refcount entirely.
> +static int omap_dmic_dai_hw_free(struct snd_pcm_substream *substream,
> + struct snd_soc_dai *dai)
> +{
> + struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
> + struct omap_dmic_link *link = dmic->link;
> + int ret = 0;
> +
> + if (dmic->active == 1) {
> + ret = omap_dmic_close(dmic);
> + link->channels = 0;
> + }
I'd feel a bit more happy if this were done in the same place as the
drop of the refcount though this should actually be OK I think.
> + switch (freq) {
> + case 19200000:
> + case 24000000:
> + case 24576000:
> + case 12000000:
> + dmic->clk_freq = freq;
> + break;
> + default:
> + dev_err(dai->dev, "clk freq not supported %d\n", freq);
> + ret = -EINVAL;
> + goto err_freq;
> + }
Can't you ask the parent clock what rate it's set to?
> + ret = request_threaded_irq(dmic->irq, NULL, omap_dmic_irq_handler,
> + IRQF_ONESHOT, "DMIC", (void *)dmic);
> + if (ret) {
> + dev_err(dmic->dev, "irq request failed\n");
> + goto err_irq;
> + }
Does this really need to be a threaded IRQ - the IRQ was just reading
from CPU registers as far as I remember?
> +MODULE_AUTHOR("David Lambert <dlambert@ti.com>");
> +MODULE_DESCRIPTION("OMAP DMIC SoC Interface");
> +MODULE_LICENSE("GPL");
Should have a MODULE_ALIAS too in case it gets built modular.
next prev parent reply other threads:[~2010-12-28 14:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-28 4:17 [PATCH 0/5] Adding OMAP DMIC driver to kernel David Lambert
2010-12-28 4:17 ` [PATCH 1/5] ASoC: DMIC: Adding the OMAP DMIC driver David Lambert
2010-12-28 11:14 ` Felipe Balbi
2010-12-29 1:13 ` Lambert, David
2010-12-29 9:47 ` Felipe Balbi
2010-12-29 10:35 ` Liam Girdwood
2010-12-29 10:44 ` Felipe Balbi
2010-12-29 11:52 ` Liam Girdwood
2010-12-29 11:56 ` Mark Brown
2010-12-29 11:59 ` Felipe Balbi
2010-12-29 12:11 ` Mark Brown
2010-12-29 12:04 ` Felipe Balbi
2010-12-29 13:00 ` Liam Girdwood
2010-12-29 13:07 ` Felipe Balbi
2010-12-28 14:18 ` Mark Brown [this message]
2011-01-05 13:56 ` Lambert, David
2011-01-05 14:03 ` Mark Brown
2010-12-28 4:17 ` [PATCH 2/5] ASoC: DMIC codec: Adding a generic DMIC codec David Lambert
2010-12-28 14:29 ` Mark Brown
2010-12-28 4:17 ` [PATCH 3/5] ASoC: DMIC: Adding OMAP DMIC driver to build David Lambert
2010-12-28 11:40 ` Mark Brown
2010-12-29 2:21 ` Lambert, David
2010-12-28 4:17 ` [PATCH 4/5] OMAP4: hwmod: add entries for DMIC driver David Lambert
2010-12-28 4:17 ` [PATCH 5/5] MAP4: DMIC: Add DMIC codec platform devices David Lambert
2010-12-28 11:23 ` Felipe Balbi
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=20101228141759.GA31883@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=dlambert@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
--cc=paul@pwsan.com \
--cc=tony@atomide.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).