alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: wm8960: Support shared LRCLK
@ 2012-09-13  3:48 Mark Brown
  2012-09-13 18:47 ` Timur Tabi
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2012-09-13  3:48 UTC (permalink / raw)
  To: Liam Girdwood, Timur Tabi; +Cc: alsa-devel, patches, Mark Brown

If the LRCLK is shared and the WM8960 is clock master then we should
enable the LRCM bit to tell the device that it should drive LRCLK when
either ADC or DAC is enabled rather than separately driving the two
LRCLKs.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 include/sound/wm8960.h    |    2 ++
 sound/soc/codecs/wm8960.c |   11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/sound/wm8960.h b/include/sound/wm8960.h
index 74e9a95..b5a1ab9e 100644
--- a/include/sound/wm8960.h
+++ b/include/sound/wm8960.h
@@ -19,6 +19,8 @@ struct wm8960_data {
 	bool capless;  /* Headphone outputs configured in capless mode */
 
 	int dres;  /* Discharge resistance for headphone outputs */
+
+	bool shared_lrclk;  /* DAC and ADC LRCLKs are wired together */
 };
 
 #endif
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 7cb0d07c..8740423 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -1029,6 +1029,7 @@ static const struct regmap_config wm8960_regmap = {
 static __devinit int wm8960_i2c_probe(struct i2c_client *i2c,
 				      const struct i2c_device_id *id)
 {
+	struct wm8960_data *pdata = dev_get_platdata(&i2c->dev);
 	struct wm8960_priv *wm8960;
 	int ret;
 
@@ -1041,6 +1042,16 @@ static __devinit int wm8960_i2c_probe(struct i2c_client *i2c,
 	if (IS_ERR(wm8960->regmap))
 		return PTR_ERR(wm8960->regmap);
 
+	if (pdata && pdata->shared_lrclk) {
+		ret = regmap_update_bits(wm8960->regmap, WM8960_ADDCTL2,
+					 0x4, 0x4);
+		if (ret != 0) {
+			dev_err(&i2c->dev, "Failed to enable LRCM: %d\n",
+				ret);
+			return ret;
+		}
+	}
+
 	i2c_set_clientdata(i2c, wm8960);
 
 	ret = snd_soc_register_codec(&i2c->dev,
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: wm8960: Support shared LRCLK
  2012-09-13  3:48 [PATCH] ASoC: wm8960: Support shared LRCLK Mark Brown
@ 2012-09-13 18:47 ` Timur Tabi
  2012-09-13 22:33   ` Timur Tabi
  0 siblings, 1 reply; 4+ messages in thread
From: Timur Tabi @ 2012-09-13 18:47 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches, Liam Girdwood

Mark Brown wrote:
> +		ret = regmap_update_bits(wm8960->regmap, WM8960_ADDCTL2,
> +					 0x4, 0x4);

This is not enough to get the codec working on my board.

What is the actual mechanism that enables the clock on the WM8960?  I
don't have an oscilloscope, not it's hard to tell what the hardware is
actually doing.  However, I suspect that the LRCLK is not running.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: wm8960: Support shared LRCLK
  2012-09-13 18:47 ` Timur Tabi
@ 2012-09-13 22:33   ` Timur Tabi
  2012-09-14 15:50     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Timur Tabi @ 2012-09-13 22:33 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches, Liam Girdwood

Timur Tabi wrote:
>> > +		ret = regmap_update_bits(wm8960->regmap, WM8960_ADDCTL2,
>> > +					 0x4, 0x4);
> This is not enough to get the codec working on my board.
> 
> What is the actual mechanism that enables the clock on the WM8960?  I
> don't have an oscilloscope, not it's hard to tell what the hardware is
> actually doing.  However, I suspect that the LRCLK is not running.

Never mind, it works now.  I understand that the DAPM controls need to be
enabled for the clocks to actually run, as described here:

http://www.alsa-project.org/main/index.php/DAPM#When_things_don.27t_work

On the #alsa-soc, I was told that I could force on the control in my
machine driver.  Specifically, I was told this:

	"in your board file you can always make an always on output in the DAPM map"

Can you tell me how to do this?  Is there an example?  I don't want to
have to rely on user-space configuration to get playback to work.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: wm8960: Support shared LRCLK
  2012-09-13 22:33   ` Timur Tabi
@ 2012-09-14 15:50     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-09-14 15:50 UTC (permalink / raw)
  To: Timur Tabi; +Cc: alsa-devel, patches, Liam Girdwood

On Thu, Sep 13, 2012 at 05:33:16PM -0500, Timur Tabi wrote:

> On the #alsa-soc, I was told that I could force on the control in my
> machine driver.  Specifically, I was told this:

> 	"in your board file you can always make an always on output in the DAPM map"

> Can you tell me how to do this?  Is there an example?  I don't want to
> have to rely on user-space configuration to get playback to work.

You can't force controls on in your machine driver.  DAPM controls only
affect routing so I'm really not sure what you're looking for here.

The advice you were given on the ASoC channel was to add a new widget
in your board that's always connected to the DAC, just define some
random output widget.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-14 15:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-13  3:48 [PATCH] ASoC: wm8960: Support shared LRCLK Mark Brown
2012-09-13 18:47 ` Timur Tabi
2012-09-13 22:33   ` Timur Tabi
2012-09-14 15:50     ` 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).