devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Paul Handrigan <Paul.Handrigan-jGc1dHjMKG3QT0dZR+AlfA@public.gmane.org>
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	brian.austin-jGc1dHjMKG3QT0dZR+AlfA@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	pawel.moll-5wv7dgnIgG8@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
	galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Subject: Re: [PATCH 2/2] ASoC: Add support for CS4265 CODEC
Date: Fri, 23 May 2014 21:39:45 +0100	[thread overview]
Message-ID: <20140523203945.GN22111@sirena.org.uk> (raw)
In-Reply-To: <1400872614-21666-2-git-send-email-Paul.Handrigan-jGc1dHjMKG3QT0dZR+AlfA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2780 bytes --]

On Fri, May 23, 2014 at 02:16:54PM -0500, Paul Handrigan wrote:
> This patch adds support for the Cirrus Logic Stereo I2C CODEC

This all looks pretty clean and nice, I have got a few comments below
but they're all pretty small things.

> +	SOC_SINGLE("De-emp 44.1kHz", CS4265_DAC_CTL, 1,
> +				1, 0),
> +	SOC_SINGLE("DAC INV", CS4265_DAC_CTL2, 5,
> +				1, 0),
> +	SOC_SINGLE("DAC Zero Cross", CS4265_DAC_CTL2, 6,
> +				1, 0),
> +	SOC_SINGLE("DAC Soft Ramp", CS4265_DAC_CTL2, 7,
> +				1, 0),

All boolean controls should have Switch at the end of the name.

> +	SOC_SINGLE("ADC HPF Disable", CS4265_ADC_CTL, 1,
> +				1, 0),

Invert this one and call it ADC HPF Switch (similarly for other disable
controls).

> +
> +	for (i = 0; i < ARRAY_SIZE(clk_map_table); i++) {
> +		if (clk_map_table[i].rate == rate &&
> +			clk_map_table[i].mclk == mclk)
> +			return i;

Indent the second line of the if condition with the (.

> +static int cs4265_set_sysclk(struct snd_soc_dai *codec_dai, int clk_id,
> +			unsigned int freq, int dir)
> +{
> +	struct snd_soc_codec *codec = codec_dai->codec;
> +	struct cs4265_private *cs4265 = snd_soc_codec_get_drvdata(codec);
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(clk_map_table); i++) {
> +		if (clk_map_table[i].mclk == freq) {

It's better to check that clk_id is 0 here, just in case you think of
another clock to control in future (perhaps with a new device that can
share the same driver even if it's not possible for this one).

> +	{
> +		.name = "cs4265-spdif",
> +		.playback = {
> +			.stream_name = "SPDIF Playback",
> +			.channels_min = 1,
> +			.channels_max = 2,
> +			.rates = CS4265_SPDIF_RATES,
> +			.formats = CS4265_FORMATS,
> +		},
> +		.ops = &cs4265_ops,
> +	},

You should have separate operations for the DAC and S/PDIF DAIs and only
mute the relevant interfaces.  If you can't mute the DAC DAIs
independently just don't provide an operation and let the user control
it as they like.  This avoids problems if more than one stream is
running at once.

> +static int cs4265_probe(struct snd_soc_codec *codec)
> +{
> +	return 0;
> +}

Remove empty operations.

> +	} else {
> +		pdata = devm_kzalloc(&i2c_client->dev,
> +				     sizeof(struct cs4265_platform_data),
> +				GFP_KERNEL);
> +		if (!pdata) {
> +			dev_err(&i2c_client->dev, "could not allocate pdata\n");
> +			return -ENOMEM;
> +		}
> +		pdata->reset_gpio = of_get_named_gpio(i2c_client->dev.of_node,
> +						"reset-gpio", 0);
> +		cs4265->pdata = *pdata;
> +	}

Can you convert this to use the new gpiod_ APIs and directly request by
name?  There's also the -gpios thing I mentioned for the binding.

> +	ret =  snd_soc_register_codec(&i2c_client->dev,
> +			&soc_codec_dev_cs4265, cs4265_dai,
> +			ARRAY_SIZE(cs4265_dai));
> +	return ret;

devm_

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

  parent reply	other threads:[~2014-05-23 20:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23 19:16 [PATCH 1/2] ASoC: cs4265: bindings: sound: Add bindings for CS4265 CODEC Paul Handrigan
     [not found] ` <1400872614-21666-1-git-send-email-Paul.Handrigan-jGc1dHjMKG3QT0dZR+AlfA@public.gmane.org>
2014-05-23 19:16   ` [PATCH 2/2] ASoC: Add support " Paul Handrigan
     [not found]     ` <1400872614-21666-2-git-send-email-Paul.Handrigan-jGc1dHjMKG3QT0dZR+AlfA@public.gmane.org>
2014-05-23 20:39       ` Mark Brown [this message]
     [not found]         ` <20140523203945.GN22111-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-05-24 14:18           ` Handrigan, Paul
2014-05-31 22:08           ` Handrigan, Paul
2014-05-24 16:14     ` Lars-Peter Clausen
     [not found]       ` <5380C57A.9050603-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2014-05-27 17:09         ` [alsa-devel] " Handrigan, Paul
2014-05-23 20:28   ` [PATCH 1/2] ASoC: cs4265: bindings: sound: Add bindings " 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=20140523203945.GN22111@sirena.org.uk \
    --to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=Paul.Handrigan-jGc1dHjMKG3QT0dZR+AlfA@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=brian.austin-jGc1dHjMKG3QT0dZR+AlfA@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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).