All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Liam Girdwood <lrg@ti.com>, Tony Lindgren <tony@atomide.com>,
	alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
	Benoit Cousson <b-cousson@ti.com>
Subject: Re: [PATCH v2 2/5] ASoC: OMAP4: omap-dmic: Initial support for OMAP DMIC
Date: Thu, 24 Nov 2011 17:10:19 +0000	[thread overview]
Message-ID: <20111124171019.GQ8470@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1322142889-12017-3-git-send-email-peter.ujfalusi@ti.com>

On Thu, Nov 24, 2011 at 03:54:46PM +0200, Peter Ujfalusi wrote:

> +	/*
> +	 * 192KHz rate is only supported with 19.2MHz/3.84MHz clock
> +	 * configuration. Fix the dmic clock divider for 192KHz
> +	 */
> +	if (params_rate(params) == 192000) {
> +		if (dmic->fclk_freq == 19200000 && dmic->clk_div == 0x1) {
> +			dmic->clk_div = 0x6;
> +		} else {
> +			dev_err(dmic->dev,
> +				"invalid clock configuration for 192KHz\n");
> +			return -EINVAL;
> +		}
> +	}

That's a bit wierd, magic numbers there and it'll mean we're trashing
the user's configuration.  Why not just return an error if the clock
setup is broken, or alternatively aren't there other invalid
configurations we should be trapping and fixing up (looking at the
divider setting code it seems unlikely that if the user doesn't
configure things we're not going to have a valid divider setup)?

> +static int omap_dmic_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
> +				    unsigned int freq, int dir)
> +{
> +	struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
> +
> +	if (dir == SND_SOC_CLOCK_IN)
> +		return omap_dmic_select_fclk(dmic, clk_id, freq);
> +	else if (dir == SND_SOC_CLOCK_OUT)
> +		return omap_dmic_select_divider(dmic, freq);

Might be better to specify using clk_id in case the next revision of the
IP has more clocks or something.

> +	dmic = kzalloc(sizeof(struct omap_dmic), GFP_KERNEL);
> +	if (!dmic)
> +		return -ENOMEM;

devm_ would save you having to clean stuff up later.

> +static int __init snd_omap_dmic_init(void)
> +{
> +	return platform_driver_register(&asoc_dmic_driver);
> +}
> +module_init(snd_omap_dmic_init);
> +
> +static void __exit snd_omap_dmic_exit(void)
> +{
> +	platform_driver_unregister(&asoc_dmic_driver);
> +}
> +module_exit(snd_omap_dmic_exit);

module_platform_driver.

  reply	other threads:[~2011-11-24 17:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24 13:54 [PATCH v2 0/5] Support for OMAP4 Digital Microphone interface Peter Ujfalusi
2011-11-24 13:54 ` [PATCH v2 1/5] OMAP4: hwmod: Add names for DMIC memory address space Peter Ujfalusi
2011-11-24 22:24   ` Mark Brown
2011-11-24 13:54 ` [PATCH v2 2/5] ASoC: OMAP4: omap-dmic: Initial support for OMAP DMIC Peter Ujfalusi
2011-11-24 17:10   ` Mark Brown [this message]
2011-11-25  9:31     ` Péter Ujfalusi
2011-11-24 13:54 ` [PATCH v2 3/5] OMAP4: devices: Register OMAP4 DMIC platform device Peter Ujfalusi
2011-11-24 13:54 ` [PATCH v2 4/5] OMAP4: board-4430sdp: Register platform device for digimic codec Peter Ujfalusi
2011-11-24 13:54 ` [PATCH v2 5/5] ASoC: sdp4430: Add support for digital microphones Peter Ujfalusi

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=20111124171019.GQ8470@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b-cousson@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=peter.ujfalusi@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.