From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Daniel Mack <zonque@gmail.com>
Cc: alsa-devel@alsa-project.org, lrg@slimlogic.co.uk
Subject: Re: [PATCH 1/2] ALSA: ASoC: add STA32X codec driver
Date: Wed, 15 Jun 2011 16:05:16 +0100 [thread overview]
Message-ID: <20110615150516.GC2806@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1308079626-31239-2-git-send-email-zonque@gmail.com>
On Tue, Jun 14, 2011 at 09:27:05PM +0200, Daniel Mack wrote:
> +/*
> + * The codec isn't really big-endian or little-endian, since the I2S
> + * interface requires data to be sent serially with the MSbit first.
> + * However, to support BE and LE I2S devices, we specify both here. That
> + * way, ALSA will always match the bit patterns.
> + */
The core is supposed to be fixing this up for you...
> +#if 0
> +static const char *sta32x_pwm_output_mapping[] = {
> + "Channel 1", "Channel 2", "Channel 3" };
> +#endif
Remove all the if 0 blocks in the driver or enable them.
> +static const char *sta32x_limiter_ac_release_thr[] = {
> + "-inf", "-29dB", "-20dB", "-16dB", "-14dB", "-12dB", "-10dB", "-8dB",
> + "-7dB", "-6dB", "-5dB", "-4dB", "-3dB", "-2dB", "-1dB", "0dB" };
> +static const char *sta32x_limiter_drc_attack_thr[] = {
> + "-31dB", "-29dB", "-27dB", "-25dB", "-23dB", "-21dB", "-19dB", "-17dB",
> + "-16dB", "-15dB", "-14dB", "-13dB", "-12dB", "-10dB", "-7dB", "-4dB" };
> +static const char *sta32x_limiter_drc_release_thr[] = {
> + "-inf", "-38dB", "-36dB", "-33dB", "-31dB", "-30dB", "-28dB", "-26dB",
> + "-24dB", "-22dB", "-20dB", "-18dB", "-15dB", "-12dB", "-9dB", "-6dB" };
> +
Doing these as regular volume TLVs will tend to work better in UIs.
> +SOC_SINGLE("Master Mute", STA32X_MMUTE, 0, 1, 0),
> +SOC_SINGLE("Ch1 Mute", STA32X_MMUTE, 1, 1, 0),
> +SOC_SINGLE("Ch2 Mute", STA32X_MMUTE, 2, 1, 0),
> +SOC_SINGLE("Ch3 Mute", STA32X_MMUTE, 3, 1, 0),
All Mutes should be replaced with Switch in control names.
> + if (sta32x->format == SND_SOC_DAIFMT_I2S)
> + confb |= 0x8;
> + else if (sta32x->format == SND_SOC_DAIFMT_LEFT_J)
> + confb |= 0x9;
> + else if (sta32x->format == SND_SOC_DAIFMT_RIGHT_J)
> + confb |= 0xa;
Looks like you want to use switch statements for these?
> + ret = regulator_bulk_enable(ARRAY_SIZE(sta32x->supplies),
> + sta32x->supplies);
> + if (ret != 0) {
> + dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
> + goto err_get;
> + }
If you enable the supplies when you go to standby you can just punt this
to when you set the bias level.
> + /* read reg reset values into cache */
> + for (i = 0; i < STA32X_REGISTER_COUNT; i++) {
> + unsigned int val = codec->hw_read(codec, i);
> +
Does the chip not have a specified hardware state when it comes out of
reset?
> + case STA32X_CONFA:
> + /* FIXME enable thermal warning adjustment and recovery */
> + val &= ~(STA32X_CONFA_TWAB | STA32X_CONFA_TWRB);
> + snd_soc_write(codec, i, val);
> + break;
This would be much more legible if you just did an update bits to set
the values independantly of the cache init, both from the point of view
of the open coding and also for splitting out the default changes from
the cache init.
> + snd_soc_add_controls(codec, sta32x_snd_controls,
> + ARRAY_SIZE(sta32x_snd_controls));
> +
> + snd_soc_dapm_new_controls(dapm, sta32x_dapm_widgets,
> + ARRAY_SIZE(sta32x_dapm_widgets));
> + snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
You should just add these arrays to the driver data structure and then
the core will add the controls and routes for you.
> +static const struct i2c_device_id sta32x_i2c_id[] = {
> + { "sta32x", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, sta32x_i2c_id);
If you support a range of different devices then just list them here.
> +static struct i2c_driver sta32x_i2c_driver = {
> + .driver = {
> + .name = "sta32x-codec",
Drop the -codec from the name, it's redundant.
next prev parent reply other threads:[~2011-06-15 15:05 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-14 19:27 ASoC: Patches for an STA32X and WM8782 Daniel Mack
2011-06-14 19:27 ` [PATCH 1/2] ALSA: ASoC: add STA32X codec driver Daniel Mack
2011-06-15 15:05 ` Mark Brown [this message]
2011-06-15 20:53 ` Johannes Stezenbach
2011-06-16 8:39 ` Lars-Peter Clausen
2011-06-16 9:12 ` Johannes Stezenbach
2011-06-16 9:51 ` Daniel Mack
2011-06-16 10:13 ` Mark Brown
2011-06-16 11:03 ` Daniel Mack
2011-06-16 11:11 ` Lars-Peter Clausen
2011-06-16 11:26 ` Daniel Mack
2011-06-16 11:38 ` Lars-Peter Clausen
2011-06-16 11:47 ` Daniel Mack
2011-06-16 11:51 ` Lars-Peter Clausen
2011-06-16 11:54 ` Daniel Mack
2011-06-16 8:19 ` Daniel Mack
2011-06-16 8:49 ` Liam Girdwood
2011-06-16 8:53 ` Daniel Mack
2011-06-16 12:07 ` [PATCH] " Daniel Mack
2011-06-17 8:30 ` Daniel Mack
2011-06-17 9:45 ` Mark Brown
2011-06-17 9:54 ` Daniel Mack
2011-06-22 12:54 ` Mark Brown
2011-06-22 12:59 ` [PATCH 1/2] " Daniel Mack
2011-06-22 12:59 ` [PATCH 2/2] ALSA: ASoC: add WM8782 ADC Codec Driver Daniel Mack
2011-06-22 13:26 ` [PATCH 1/2] ALSA: ASoC: add STA32X codec driver Mark Brown
2011-06-22 13:34 ` Daniel Mack
2011-06-22 13:59 ` Mark Brown
2011-06-22 14:09 ` Paul Menzel
2011-06-20 6:07 ` [PATCH] " Daniel Mack
2011-06-22 11:06 ` Daniel Mack
2011-06-22 11:12 ` Mark Brown
2011-06-22 12:10 ` Liam Girdwood
2011-06-14 19:27 ` [PATCH 2/2] ALSA: ASoC: add WM8782 ADC Codec Driver Daniel Mack
2011-06-15 15:17 ` Mark Brown
2011-06-16 8:20 ` Daniel Mack
2011-06-22 12:12 ` Liam Girdwood
2011-06-15 10:00 ` ASoC: Patches for an STA32X and WM8782 Johannes Stezenbach
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=20110615150516.GC2806@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=lrg@slimlogic.co.uk \
--cc=zonque@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox