* [PATCH] ASoC: wm8960: Move register initialisation to I2C driver probe()
@ 2014-11-27 8:53 Zidan Wang
2014-11-27 10:19 ` Charles Keepax
2014-11-27 10:35 ` [alsa-devel][PATCH] " Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Zidan Wang @ 2014-11-27 8:53 UTC (permalink / raw)
To: broonie
Cc: alsa-devel, lars, tiwai, linux-kernel, patches, lgirdwood,
Li.Xiubo, Zidan Wang, ckeepax
We must ensure that the clocking configuration is valid as rapidly as possible.
And do software reset before the others registers updates, or the registers
will be reset to the default state.
Signed-off-by: Zidan Wang <b50113@freescale.com>
---
sound/soc/codecs/wm8960.c | 41 ++++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 21 deletions(-)
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index bc8793cd..031a1ae 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -128,7 +128,7 @@ struct wm8960_priv {
struct wm8960_data pdata;
};
-#define wm8960_reset(c) snd_soc_write(c, WM8960_RESET, 0)
+#define wm8960_reset(c) regmap_write(c, WM8960_RESET, 0)
/* enumerated controls */
static const char *wm8960_polarity[] = {"No Inversion", "Left Inverted",
@@ -947,31 +947,12 @@ static int wm8960_probe(struct snd_soc_codec *codec)
{
struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
struct wm8960_data *pdata = &wm8960->pdata;
- int ret;
if (pdata->capless)
wm8960->set_bias_level = wm8960_set_bias_level_capless;
else
wm8960->set_bias_level = wm8960_set_bias_level_out3;
- ret = wm8960_reset(codec);
- if (ret < 0) {
- dev_err(codec->dev, "Failed to issue reset\n");
- return ret;
- }
-
- /* Latch the update bits */
- snd_soc_update_bits(codec, WM8960_LINVOL, 0x100, 0x100);
- snd_soc_update_bits(codec, WM8960_RINVOL, 0x100, 0x100);
- snd_soc_update_bits(codec, WM8960_LADC, 0x100, 0x100);
- snd_soc_update_bits(codec, WM8960_RADC, 0x100, 0x100);
- snd_soc_update_bits(codec, WM8960_LDAC, 0x100, 0x100);
- snd_soc_update_bits(codec, WM8960_RDAC, 0x100, 0x100);
- snd_soc_update_bits(codec, WM8960_LOUT1, 0x100, 0x100);
- snd_soc_update_bits(codec, WM8960_ROUT1, 0x100, 0x100);
- snd_soc_update_bits(codec, WM8960_LOUT2, 0x100, 0x100);
- snd_soc_update_bits(codec, WM8960_ROUT2, 0x100, 0x100);
-
snd_soc_add_codec_controls(codec, wm8960_snd_controls,
ARRAY_SIZE(wm8960_snd_controls));
wm8960_add_widgets(codec);
@@ -1030,7 +1011,13 @@ static int wm8960_i2c_probe(struct i2c_client *i2c,
else if (i2c->dev.of_node)
wm8960_set_pdata_from_of(i2c, &wm8960->pdata);
- if (pdata && pdata->shared_lrclk) {
+ ret = wm8960_reset(wm8960->regmap);
+ if (ret != 0) {
+ dev_err(&i2c->dev, "Failed to issue reset\n");
+ return ret;
+ }
+
+ if (wm8960->pdata.shared_lrclk) {
ret = regmap_update_bits(wm8960->regmap, WM8960_ADDCTL2,
0x4, 0x4);
if (ret != 0) {
@@ -1040,6 +1027,18 @@ static int wm8960_i2c_probe(struct i2c_client *i2c,
}
}
+ /* Latch the update bits */
+ regmap_update_bits(wm8960->regmap, WM8960_LINVOL, 0x100, 0x100);
+ regmap_update_bits(wm8960->regmap, WM8960_RINVOL, 0x100, 0x100);
+ regmap_update_bits(wm8960->regmap, WM8960_LADC, 0x100, 0x100);
+ regmap_update_bits(wm8960->regmap, WM8960_RADC, 0x100, 0x100);
+ regmap_update_bits(wm8960->regmap, WM8960_LDAC, 0x100, 0x100);
+ regmap_update_bits(wm8960->regmap, WM8960_RDAC, 0x100, 0x100);
+ regmap_update_bits(wm8960->regmap, WM8960_LOUT1, 0x100, 0x100);
+ regmap_update_bits(wm8960->regmap, WM8960_ROUT1, 0x100, 0x100);
+ regmap_update_bits(wm8960->regmap, WM8960_LOUT2, 0x100, 0x100);
+ regmap_update_bits(wm8960->regmap, WM8960_ROUT2, 0x100, 0x100);
+
i2c_set_clientdata(i2c, wm8960);
ret = snd_soc_register_codec(&i2c->dev,
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: wm8960: Move register initialisation to I2C driver probe()
2014-11-27 8:53 [PATCH] ASoC: wm8960: Move register initialisation to I2C driver probe() Zidan Wang
@ 2014-11-27 10:19 ` Charles Keepax
2014-11-27 10:35 ` [alsa-devel][PATCH] " Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2014-11-27 10:19 UTC (permalink / raw)
To: Zidan Wang
Cc: alsa-devel, lars, tiwai, linux-kernel, broonie, patches,
lgirdwood, Li.Xiubo
On Thu, Nov 27, 2014 at 04:53:08PM +0800, Zidan Wang wrote:
> We must ensure that the clocking configuration is valid as rapidly as possible.
> And do software reset before the others registers updates, or the registers
> will be reset to the default state.
>
> Signed-off-by: Zidan Wang <b50113@freescale.com>
> ---
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Looks ok to me.
Thanks,
Charles
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [alsa-devel][PATCH] ASoC: wm8960: Move register initialisation to I2C driver probe()
2014-11-27 8:53 [PATCH] ASoC: wm8960: Move register initialisation to I2C driver probe() Zidan Wang
2014-11-27 10:19 ` Charles Keepax
@ 2014-11-27 10:35 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-11-27 10:35 UTC (permalink / raw)
To: Zidan Wang
Cc: lgirdwood, perex, tiwai, lars, ckeepax, Li.Xiubo, patches,
alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 276 bytes --]
On Thu, Nov 27, 2014 at 04:53:08PM +0800, Zidan Wang wrote:
> We must ensure that the clocking configuration is valid as rapidly as possible.
> And do software reset before the others registers updates, or the registers
> will be reset to the default state.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-27 10:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-27 8:53 [PATCH] ASoC: wm8960: Move register initialisation to I2C driver probe() Zidan Wang
2014-11-27 10:19 ` Charles Keepax
2014-11-27 10:35 ` [alsa-devel][PATCH] " Mark Brown
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).