public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Stefan Roese <sr@denx.de>
Cc: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
	Thorsten Eisbein <thorsten.eisbein@head-acoustics.de>,
	Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: Re: [PATCH 3/5] ASoC: omap: Add HA (HEAD acoustics) DSP add-on card audio driver for TAO3530
Date: Tue, 29 Apr 2014 11:54:59 -0700	[thread overview]
Message-ID: <20140429185459.GJ15125@sirena.org.uk> (raw)
In-Reply-To: <1398687476-10829-3-git-send-email-sr@denx.de>


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

On Mon, Apr 28, 2014 at 02:17:54PM +0200, Stefan Roese wrote:

> +	switch (params_channels(params)) {
> +	case 2:
> +	case 4:
> +	case 8:
> +	case 16:
> +		fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF;
> +		break;
> +	default:
> +		return -EINVAL;
> +	}

Why is this "conditional" on the number of channels (though the same
value is always chosen)?

> +		/*
> +		 * Calculate McBSP SRG divisor in McBSP master mode
> +		 */
> +		div = 96000000 / params_rate(params) / params_channels(params);
> +		switch (params_format(params)) {
> +		case SNDRV_PCM_FORMAT_S16_LE:
> +			div /= 16;
> +			break;
> +		case SNDRV_PCM_FORMAT_S24_LE:
> +		case SNDRV_PCM_FORMAT_S32_LE:
> +			div /= 32;
> +			break;
> +		};

params_width().

> +		ret = snd_soc_dai_set_clkdiv(cpu_dai, OMAP_MCBSP_CLKGDV, div);
> +		if (ret < 0) {
> +			pr_err("can't set SRG clock divider\n");
> +			return ret;
> +		}

Why not put this code into the DAI driver for the SoC - what's board
specific about the calcuation?  I'd expect this to be handlable by
set_sysclk().

> +	if (!node) {
> +		dev_err(&pdev->dev, "No DT node provided\n");
> +		return -ENODEV;
> +	}

You've got something with a DT binding here but no binding document,
documentation is mandatory for new DT bindings.

> +	priv->slave = of_property_read_bool(node, "ha_dsp_codec_slave");
> +	if (priv->slave)
> +		dev_info(&pdev->dev, "Using slave mode for testing!\n");

This seems like something that shouldn't be in production code, or
perhaps a build time option if the testing is valuable?

> +	if (snd_soc_of_parse_card_name(card, "ti,model")) {
> +		dev_err(&pdev->dev, "Card name is not provided\n");
> +		ret = -ENODEV;
> +		goto err;
> +	}

Why not have a default?

> +	ret = snd_soc_register_card(card);
> +	if (ret) {
> +		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
> +			ret);
> +		goto err;
> +	}

devm_snd_soc_register_card().

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

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



  parent reply	other threads:[~2014-04-29 18:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28 12:17 [PATCH 1/5] ASoC: Add support for machine specific trigger callback Stefan Roese
2014-04-28 12:17 ` [PATCH 2/5] ASoC: Add HA (HEAD acoustics) DSP codec driver template Stefan Roese
2014-04-28 14:45   ` [alsa-devel] " Lars-Peter Clausen
2014-04-28 17:32   ` Jarkko Nikula
2014-04-29 18:47   ` Mark Brown
2014-04-28 12:17 ` [PATCH 3/5] ASoC: omap: Add HA (HEAD acoustics) DSP add-on card audio driver for TAO3530 Stefan Roese
2014-04-28 17:35   ` Jarkko Nikula
2014-04-28 17:39   ` Jarkko Nikula
2014-04-29 18:54   ` Mark Brown [this message]
2014-04-28 12:17 ` [PATCH 4/5] DT: Add vendor prefix for HEAD acoustics Stefan Roese
2014-04-28 12:17 ` [PATCH 5/5] ASoC: omap: Add DT bindings documentation for HA DSP audio driver Stefan Roese
2014-04-29 19:05 ` [PATCH 1/5] ASoC: Add support for machine specific trigger callback 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=20140429185459.GJ15125@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=jarkko.nikula@bitmer.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=sr@denx.de \
    --cc=thorsten.eisbein@head-acoustics.de \
    /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