From: Mark Brown <broonie@kernel.org>
To: oder_chiou@realtek.com
Cc: Bard Liao <bardliao@realtek.com>,
alsa-devel@alsa-project.org, lgirdwood@gmail.com,
flove@realtek.com
Subject: Re: [PATCH] ASoC: add RT5639 CODEC driver
Date: Tue, 25 Mar 2014 13:30:17 +0000 [thread overview]
Message-ID: <20140325133017.GY2269@sirena.org.uk> (raw)
In-Reply-To: <1395627397-6580-1-git-send-email-oder_chiou@realtek.com>
[-- Attachment #1.1: Type: text/plain, Size: 3205 bytes --]
On Mon, Mar 24, 2014 at 10:16:37AM +0800, oder_chiou@realtek.com wrote:
> From: Oder Chiou <oder_chiou@realtek.com>
>
> This patch adds the RT5639 codec driver.
Looking at the level of code similiarity between this and the rt5640
driver I can't help but think that these should be supported from a
single driver - a few quick spot checks of the register map suggests
that there's at least some overlap. There will need to be some device
specific handling but it looks like there's more shared than not shared.
What are the issues that prevent the code being shared, there may be
something I've missed?
There's also a few issues below that should be fixed, most of them
should be fixed in rt5640 too.
> + switch (params_format(params)) {
> + case SNDRV_PCM_FORMAT_S16_LE:
> + break;
> + case SNDRV_PCM_FORMAT_S20_3LE:
> + val_len |= RT5639_I2S_DL_20;
> + break;
> + case SNDRV_PCM_FORMAT_S24_LE:
> + val_len |= RT5639_I2S_DL_24;
> + break;
> + case SNDRV_PCM_FORMAT_S8:
> + val_len |= RT5639_I2S_DL_8;
> + break;
> + default:
> + return -EINVAL;
> + }
This should be converted to use params_width().
> +static int rt5639_set_bias_level(struct snd_soc_codec *codec,
> + enum snd_soc_bias_level level)
> +{
> + struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
> + switch (level) {
> + case SND_SOC_BIAS_STANDBY:
> + if (SND_SOC_BIAS_OFF == codec->dapm.bias_level) {
> + regcache_cache_only(rt5639->regmap, false);
...
> + case SND_SOC_BIAS_OFF:
> + snd_soc_write(codec, RT5639_DEPOP_M1, 0x0004);
> + snd_soc_write(codec, RT5639_DEPOP_M2, 0x1100);
> + snd_soc_update_bits(codec, RT5639_DUMMY1, 0x1, 0);
> + snd_soc_write(codec, RT5639_PWR_DIG1, 0x0000);
> + snd_soc_write(codec, RT5639_PWR_DIG2, 0x0000);
> + snd_soc_write(codec, RT5639_PWR_VOL, 0x0000);
> + snd_soc_write(codec, RT5639_PWR_MIXER, 0x0000);
> + snd_soc_write(codec, RT5639_PWR_ANLG1, 0x0000);
> + snd_soc_write(codec, RT5639_PWR_ANLG2, 0x0000);
> + break;
I'd expect to see the regmap being made cache_only in _OFF given that it
is resynced in _STANDBY when exiting _OFF, or alternatively to see the
cache restore moved to the resume to mirror where it's currently made
cache only.
> +static int rt5639_probe(struct snd_soc_codec *codec)
> +{
> + struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
> + int ret;
> +
> + rt5639->codec = codec;
> + codec->control_data = rt5639->regmap;
> +
> + ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
> + if (ret != 0) {
> + dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
> + return ret;
> + }
There have been some API changes here this release cycle, you should be
able to just remove the cache_io() and regmap setting code here.
> + if (rt5639->pdata.in1_diff)
> + regmap_update_bits(rt5639->regmap, RT5639_IN1_IN2,
> + RT5639_IN_DF1, RT5639_IN_DF1);
> +
> + if (rt5639->pdata.in2_diff)
> + regmap_update_bits(rt5639->regmap, RT5639_IN3_IN4,
> + RT5639_IN_DF2, RT5639_IN_DF2);
Why not have platform data to register if the DMICs are in use rather
than twiddling the GPIOs in an event? It'd be more idiomatic.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2014-03-25 13:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-24 2:16 [PATCH] ASoC: add RT5639 CODEC driver oder_chiou
2014-03-25 13:30 ` Mark Brown [this message]
2014-03-25 15:33 ` Stephen Warren
2014-03-25 16:57 ` Mark Brown
2014-03-26 2:57 ` Oder Chiou
2014-03-26 3:58 ` Stephen Warren
2014-03-26 7:11 ` Jarkko Nikula
2014-03-26 10:48 ` Mark Brown
2014-03-26 6:39 ` Oder Chiou
2014-03-26 10:52 ` 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=20140325133017.GY2269@sirena.org.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=bardliao@realtek.com \
--cc=flove@realtek.com \
--cc=lgirdwood@gmail.com \
--cc=oder_chiou@realtek.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