alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Rajeev Kumar <rajeev-dlh.kumar@st.com>
Cc: tiwai@suse.de, alsa-devel@alsa-project.org, lrg@slimlogic.co.uk,
	spear-devel@list.st.com
Subject: Re: [PATCH 1/8] sound:asoc: Add support for STA529 Audio Codec
Date: Tue, 20 Mar 2012 15:25:49 +0000	[thread overview]
Message-ID: <20120320152547.GB3445@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <a5a4d4490442b863f6ef916f74f068e2303b382b.1332242166.git.rajeev-dlh.kumar@st.com>


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

On Tue, Mar 20, 2012 at 05:03:45PM +0530, Rajeev Kumar wrote:
> This patch adds the support for STA529 audio codec.
> Details of the audio codec can be seen here:
> http://www.st.com/internet/imag_video/product/159187.jsp

Please use subject lines appropriate for the subsystem.  If your commits
look visually different to all the other commits in the log that's not a
good sign.

> +config SND_SOC_STA529
> +	tristate
> +	depends on I2C
> +

Drop the dependency, none of the other CODECs have this for a reason...

> +#include <linux/platform_device.h>

If you need this something went wrong...

> +static const u8 sta529_reg[STA529_CACHEREGNUM] = {

Use regmap for register I/O.

> +struct sta529 {
> +	unsigned int sysclk;
> +	enum snd_soc_control_type control_type;
> +	void *control_data;

Your device only supports I2C, no need for the infrastructure for other
buses (though this will go away with regmap).

> +static const char *pwm_mode_text[] = { "binary", "headphone", "ternary",
> +	"phase-shift"};
> +static const char *interface_mode_text[] = { "slave", "master"};

ALSA controls always use capitalisation.

> +	case SND_SOC_BIAS_PREPARE:
> +		snd_soc_update_bits(codec, STA529_FFXCFG0, POWER_CNTLMSAK,
> +				POWER_UP);
> +		snd_soc_update_bits(codec, STA529_MISC, 1, 0x01);

One of these has magic numbers and the other doesn't, and the magic
numbers are a little confusing as the mask is written in decimal but the
binary in hex.

> +	switch (params_format(params)) {
> +	case SNDRV_PCM_FORMAT_S16_LE:
> +		pdata = 1;
> +		break;
> +	case SNDRV_PCM_FORMAT_S24_LE:
> +		pdata = 2;
> +		break;
> +	case SNDRV_PCM_FORMAT_S32_LE:
> +		pdata = 3;
> +		break;
> +	}

Return an error on unsupported sample sizes.

> +	default:
> +		printk(KERN_WARNING, "bad rate\n");
> +		return -EINVAL;
> +	}

dev_warn() - always use the dev_ prints where possible.

> +	sta529_set_bias_level(codec, SND_SOC_BIAS_PREPARE);
> +	mdelay(10);

Absolutely no - why are you doing this?

> +static int sta529_mute(struct snd_soc_dai *dai, int mute)
> +{
> +	struct snd_soc_codec *codec = dai->codec;
> +
> +	u8 mute_reg = snd_soc_read(codec, STA529_FFXCFG0) & ~CODEC_MUTE_VAL;
> +
> +	if (mute)
> +		mute_reg |= CODEC_MUTE_VAL;
> +
> +	snd_soc_update_bits(codec, STA529_FFXCFG0, 0x80, 00);

You're always setting the same value here...

> +	snd_soc_add_controls(codec, sta529_snd_controls,
> +			ARRAY_SIZE(sta529_snd_controls));
> +
> +	snd_soc_add_controls(codec, sta529_new_snd_controls,
> +			ARRAY_SIZE(sta529_new_snd_controls));

Use the initialisers in the card struct.

> +	sta529 = kzalloc(sizeof(struct sta529), GFP_KERNEL);
> +	if (sta529 == NULL)
> +		return -ENOMEM;

devm_kzalloc().

> +static int __init sta529_modinit(void)

module_i2c_driver().

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

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



  reply	other threads:[~2012-03-20 15:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-20 11:33 [PATCH 0/8] Add ASoC drivers for SPEAr platform Rajeev Kumar
2012-03-20 11:33 ` [PATCH 1/8] sound:asoc: Add support for STA529 Audio Codec Rajeev Kumar
2012-03-20 15:25   ` Mark Brown [this message]
2012-03-23  3:42     ` Rajeev kumar
2012-03-23  9:07       ` Lars-Peter Clausen
2012-03-23  9:20         ` Rajeev kumar
2012-03-20 17:57   ` Lars-Peter Clausen
2012-03-23  4:00     ` Rajeev kumar
2012-03-23  8:51       ` Lars-Peter Clausen
2012-03-23  9:15         ` Rajeev kumar
2012-03-20 11:33 ` [PATCH 2/8] sound:asoc: Add support for synopsys i2s controller as per ASoC framework Rajeev Kumar
2012-03-20 15:44   ` Mark Brown
2012-03-26  9:03     ` Rajeev kumar
2012-03-26 11:10       ` Mark Brown
2012-03-27  3:51         ` Rajeev kumar
2012-03-20 11:33 ` [PATCH 3/8] sound:asoc: Add support for SPEAr ASoC pcm layer Rajeev Kumar
2012-03-20 15:50   ` Mark Brown
2012-03-20 11:33 ` [PATCH 4/8] sound:asoc:spdif_in: Add spdif IN support Rajeev Kumar
2012-03-20 15:55   ` Mark Brown
2012-03-27  9:25     ` Rajeev kumar
2012-03-20 11:33 ` [PATCH 5/8] sound:asoc:spdif_out: Add spdif out support Rajeev Kumar
2012-03-20 11:33 ` [PATCH 6/8] sound:asoc: Add support for SPEAr ASoC machine driver Rajeev Kumar
2012-03-20 16:00   ` Mark Brown
2012-03-20 11:33 ` [PATCH 7/8] sound:asoc: Add Kconfig and Makefile to support SPEAr audio driver Rajeev Kumar
2012-03-20 11:33 ` [PATCH 8/8] sound:asoc: Update Kconfig and Makefile(sound/soc/) to support SPEAr audio Rajeev Kumar

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=20120320152547.GB3445@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=rajeev-dlh.kumar@st.com \
    --cc=spear-devel@list.st.com \
    --cc=tiwai@suse.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;
as well as URLs for NNTP newsgroup(s).