All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Ola Lilja <ola.o.lilja@stericsson.com>
Cc: alsa-devel@alsa-project.org, Liam Girdwood <lrg@ti.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH 2/3] ASoC: Ux500: Add machine-driver
Date: Mon, 11 Jun 2012 13:34:34 +0800	[thread overview]
Message-ID: <20120611053432.GP4218@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1339070437-15150-1-git-send-email-ola.o.lilja@stericsson.com>


[-- Attachment #1.1: Type: text/plain, Size: 2398 bytes --]

On Thu, Jun 07, 2012 at 02:00:37PM +0200, Ola Lilja wrote:

> +	mop500_ab8500_remove(mop500_card);
> +
> +	snd_soc_unregister_card(mop500_card);

These seem the wrong way round - we're starting to tear down the card
before we've destroyed the core and hence userspace so something might
still be using it.

> +	platform_set_drvdata(pdev, NULL);

No need to do this, it's a waste of time.

> +static inline const char *get_mclk_str(enum mclk mclk_sel)
> +{
> +	switch (mclk_sel) {
> +	case MCLK_SYSCLK:
> +		return "MCLK_SYSCLK";
> +	case MCLK_ULPCLK:
> +		return "MCLK_ULPCLK";

Why not just drop the MCLK_ from the strings?  I'd expect that'll be
implied by the context...

> +static int mclk_input_control_put(struct snd_kcontrol *kcontrol,
> +				struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
> +	struct mop500_ab8500_drvdata *drvdata =
> +				snd_soc_card_get_drvdata(codec->card);
> +	unsigned int val;
> +
> +	val = (ucontrol->value.enumerated.item[0] != 0);

Given that this is an enumeration not a bool we should be rejecting out
of bounds values rather than silently fixing them up, this would also
avoid issues if we do add new options for the clock later on for some
reason.

> +	/* Digital interface - Clocks */
> +	SOC_SINGLE("Digital Interface Master Generator Switch",
> +		AB8500_DIGIFCONF1, AB8500_DIGIFCONF1_ENMASTGEN,
> +		1, 0),

This enables and disables a 256fs (or similar ratio) clock output from
the device?

> +	SOC_SINGLE("Digital Interface 0 Bit-clock Switch",
> +		AB8500_DIGIFCONF1, AB8500_DIGIFCONF1_ENFSBITCLK0,
> +		1, 0),
> +	SOC_SINGLE("Digital Interface 1 Bit-clock Switch",
> +		AB8500_DIGIFCONF1, AB8500_DIGIFCONF1_ENFSBITCLK1,
> +		1, 0),

I suspect that these are doing what DAIFMT_CONT is for...

> +int mop500_ab8500_startup(struct snd_pcm_substream *substream)
> +{
> +	struct snd_soc_pcm_runtime *rtd = substream->private_data;
> +
> +	/* Set audio-clock source */
> +	return mop500_ab8500_set_mclk(rtd->card->dev,
> +				snd_soc_card_get_drvdata(rtd->card));

Should we be blocking MCLK changes while the interface is active?
> +	/* Setup codec depending on driver-mode */
> +	driver_mode = (channels == 8) ?
> +		DRIVERMODE_CODEC_ONLY : DRIVERMODE_NORMAL;

Ugh, just use an if or switch statement.

> +	sw_codec = (driver_mode == DRIVERMODE_NORMAL) ? sw_cpu : 20;

Again, if statement please.

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

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2012-06-11  5:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07 12:00 [PATCH 2/3] ASoC: Ux500: Add machine-driver Ola Lilja
2012-06-11  5:34 ` Mark Brown [this message]
2012-06-11 12:22   ` Ola Lilja
2012-06-11 12:27     ` Mark Brown
2012-06-11 12:35       ` Ola Lilja

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=20120611053432.GP4218@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=linus.walleij@linaro.org \
    --cc=lrg@ti.com \
    --cc=ola.o.lilja@stericsson.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.