* [PATCH] ASoC: soc-io: Only force use regmap if the codec have it implemented
@ 2012-08-01 12:01 Peter Ujfalusi
2012-08-01 12:16 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Peter Ujfalusi @ 2012-08-01 12:01 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: alsa-devel
Some codecs (like twl4030, twl6040) can not have regmap implementation
since they are accessing to the chip via MFD core drivers.
Force the use of regmap only in cases when the regmap is actually
available for the codec.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
Hi Mark,
the following commit:
38cbf95 ASoC: core: Try to use regmap if the driver doesn't set up any I/O
broke audio for boards using twl4030 or twl6040 as codec. These devices can not
have regmap implementation in the codec driver since they rely on their MFD core
to access to the chip.
As it is now big number of OMAP based devices have broken audio. Would it be
possible to include this fix for 3.6-rc1 already?
Regards,
Peter
sound/soc/soc-io.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c
index 29183ef..26948be 100644
--- a/sound/soc/soc-io.c
+++ b/sound/soc/soc-io.c
@@ -117,9 +117,6 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
int ret;
memset(&config, 0, sizeof(config));
- codec->write = hw_write;
- codec->read = hw_read;
- codec->bulk_write_raw = snd_soc_hw_bulk_write_raw;
config.reg_bits = addr_bits;
config.val_bits = data_bits;
@@ -141,11 +138,11 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
case SND_SOC_REGMAP:
/* Device has made its own regmap arrangements */
- codec->using_regmap = true;
if (!codec->control_data)
codec->control_data = dev_get_regmap(codec->dev, NULL);
if (codec->control_data) {
+ codec->using_regmap = true;
ret = regmap_get_val_bytes(codec->control_data);
/* Errors are legitimate for non-integer byte
* multiples */
@@ -161,6 +158,13 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
if (IS_ERR(codec->control_data))
return PTR_ERR(codec->control_data);
+ /* Only override the read/write callbacks if regmap is available */
+ if (codec->control_data) {
+ codec->write = hw_write;
+ codec->read = hw_read;
+ codec->bulk_write_raw = snd_soc_hw_bulk_write_raw;
+ }
+
return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io);
--
1.7.8.6
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] ASoC: soc-io: Only force use regmap if the codec have it implemented
2012-08-01 12:01 [PATCH] ASoC: soc-io: Only force use regmap if the codec have it implemented Peter Ujfalusi
@ 2012-08-01 12:16 ` Mark Brown
2012-08-01 12:20 ` Peter Ujfalusi
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2012-08-01 12:16 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: alsa-devel, Liam Girdwood
On Wed, Aug 01, 2012 at 03:01:45PM +0300, Peter Ujfalusi wrote:
> case SND_SOC_REGMAP:
> /* Device has made its own regmap arrangements */
> - codec->using_regmap = true;
No, this is crazy.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: soc-io: Only force use regmap if the codec have it implemented
2012-08-01 12:16 ` Mark Brown
@ 2012-08-01 12:20 ` Peter Ujfalusi
2012-08-01 12:40 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Peter Ujfalusi @ 2012-08-01 12:20 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Liam Girdwood
On 08/01/2012 03:16 PM, Mark Brown wrote:
> On Wed, Aug 01, 2012 at 03:01:45PM +0300, Peter Ujfalusi wrote:
>
>> case SND_SOC_REGMAP:
>> /* Device has made its own regmap arrangements */
>> - codec->using_regmap = true;
>
> No, this is crazy.
Why?
We set it when we have confirmed that the codec actually have regmap of it's own.
--
Péter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: soc-io: Only force use regmap if the codec have it implemented
2012-08-01 12:20 ` Peter Ujfalusi
@ 2012-08-01 12:40 ` Mark Brown
2012-08-01 13:09 ` Peter Ujfalusi
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2012-08-01 12:40 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: alsa-devel, Liam Girdwood
On Wed, Aug 01, 2012 at 03:20:29PM +0300, Peter Ujfalusi wrote:
> On 08/01/2012 03:16 PM, Mark Brown wrote:
> > On Wed, Aug 01, 2012 at 03:01:45PM +0300, Peter Ujfalusi wrote:
> >> case SND_SOC_REGMAP:
> >> /* Device has made its own regmap arrangements */
> >> - codec->using_regmap = true;
> > No, this is crazy.
> Why?
> We set it when we have confirmed that the codec actually have regmap of it's own.
You're changing the function setting up register I/O to ignore what's
being set. This is silly - the soc-io code is doing exactly the right
thing here. Abstraction, folks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: soc-io: Only force use regmap if the codec have it implemented
2012-08-01 12:40 ` Mark Brown
@ 2012-08-01 13:09 ` Peter Ujfalusi
2012-08-01 13:24 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Peter Ujfalusi @ 2012-08-01 13:09 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Liam Girdwood
On 08/01/2012 03:40 PM, Mark Brown wrote:
> You're changing the function setting up register I/O to ignore what's
> being set. This is silly - the soc-io code is doing exactly the right
> thing here.
Well, it overrides the codec->read/write/bulk_write_raw callbacks, sets the
codec->using_regmap to true regardless if the codec have regmap or not.
It should only do all of these if the regmap is there IMHO.
The soc-core calls snd_soc_codec_set_cache_io() if codec->control_data is NULL
at the moment.
Reverting commit
38cbf95 ASoC: core: Try to use regmap if the driver doesn't set up any I/O
would fix the issue as well without changing the soc-io file.
We can as well return if the codec does not have the regmap and
snd_soc_codec_set_cache_io() fails in the SND_SOC_REGMAP case.
--
Péter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: soc-io: Only force use regmap if the codec have it implemented
2012-08-01 13:09 ` Peter Ujfalusi
@ 2012-08-01 13:24 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-08-01 13:24 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: alsa-devel, Liam Girdwood
On Wed, Aug 01, 2012 at 04:09:30PM +0300, Peter Ujfalusi wrote:
> On 08/01/2012 03:40 PM, Mark Brown wrote:
> > You're changing the function setting up register I/O to ignore what's
> > being set. This is silly - the soc-io code is doing exactly the right
> > thing here.
> Well, it overrides the codec->read/write/bulk_write_raw callbacks, sets the
> codec->using_regmap to true regardless if the codec have regmap or not.
> It should only do all of these if the regmap is there IMHO.
That's exactly what it's being asked to do!
> The soc-core calls snd_soc_codec_set_cache_io() if codec->control_data is NULL
> at the moment.
Right, so perhaps that's the decision which needs revisiting?
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-08-01 13:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-01 12:01 [PATCH] ASoC: soc-io: Only force use regmap if the codec have it implemented Peter Ujfalusi
2012-08-01 12:16 ` Mark Brown
2012-08-01 12:20 ` Peter Ujfalusi
2012-08-01 12:40 ` Mark Brown
2012-08-01 13:09 ` Peter Ujfalusi
2012-08-01 13:24 ` 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).