Since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d, 'device-core:
Ensure drvdata = NULL when no driver is bound', the Amstrad Delta sound
card no longer initializes correctly due to drvdata reset to NULL by an
upper layer before the codec device, required for successful card setup,
is registered. Fix this by moving the codec registration bits up, before
the card is probed for.
Created and tested against linux-3.6-rc3
Signed-off-by: Janusz Krzysztofik <[email protected]>
---
sound/soc/omap/ams-delta.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 7d4fa8e..270de9c 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -590,20 +590,22 @@ static int __init ams_delta_module_init(void)
if (!ams_delta_audio_platform_device)
return -ENOMEM;
- platform_set_drvdata(ams_delta_audio_platform_device,
- &ams_delta_audio_card);
-
- ret = platform_device_add(ams_delta_audio_platform_device);
- if (ret)
- goto err;
-
/*
* Codec platform device could be registered from elsewhere (board?),
* but I do it here as it makes sense only if used with the card.
+ * Moreover, it must be registered before the card is probed for,
+ * or the card setup fails due to drvdata reset by upper layers.
*/
cx20442_platform_device =
platform_device_register_simple("cx20442-codec", -1, NULL, 0);
- return 0;
+
+ platform_set_drvdata(ams_delta_audio_platform_device,
+ &ams_delta_audio_card);
+
+ ret = platform_device_add(ams_delta_audio_platform_device);
+ if (!ret)
+ return ret;
+
err:
platform_device_put(ams_delta_audio_platform_device);
return ret;
--
1.7.3.4
On Mon, Aug 27, 2012 at 11:28:30PM +0200, Janusz Krzysztofik wrote:
> - platform_set_drvdata(ams_delta_audio_platform_device,
> - &ams_delta_audio_card);
> -
> - ret = platform_device_add(ams_delta_audio_platform_device);
> - if (ret)
> - goto err;
The real fix here is that you should be using platform data here, not
driver data. Is there some reason not to do that?
On Mon, 27 Aug 2012 14:38:35 Mark Brown wrote:
> On Mon, Aug 27, 2012 at 11:28:30PM +0200, Janusz Krzysztofik wrote:
>
> > - platform_set_drvdata(ams_delta_audio_platform_device,
> > - &ams_delta_audio_card);
> > -
> > - ret = platform_device_add(ams_delta_audio_platform_device);
> > - if (ret)
> > - goto err;
>
> The real fix here is that you should be using platform data here, not
> driver data. Is there some reason not to do that?
Mark,
Do you think the change you propose is suitable for the rc cycle? I'm
trying to fix a regression in the first place. Converting the ams-delta
asoc to a platform driver is on my todo list and I'm going to take care
of this as soon as I have enough spare time.
Thanks,
Janusz
On Tue, Aug 28, 2012 at 05:13:05PM +0200, Janusz Krzysztofik wrote:
> On Mon, 27 Aug 2012 14:38:35 Mark Brown wrote:
> > On Mon, Aug 27, 2012 at 11:28:30PM +0200, Janusz Krzysztofik wrote:
> > > - platform_set_drvdata(ams_delta_audio_platform_device,
> > > - &ams_delta_audio_card);
> > The real fix here is that you should be using platform data here, not
> > driver data. Is there some reason not to do that?
> Do you think the change you propose is suitable for the rc cycle? I'm
> trying to fix a regression in the first place. Converting the ams-delta
> asoc to a platform driver is on my todo list and I'm going to take care
> of this as soon as I have enough spare time.
The above looks like you already have a platform driver? All I'm
suggesting is changing the above to use platform rather than driver
data.
On Tue, 28 Aug 2012 11:13:39 Mark Brown wrote:
> On Tue, Aug 28, 2012 at 05:13:05PM +0200, Janusz Krzysztofik wrote:
> > On Mon, 27 Aug 2012 14:38:35 Mark Brown wrote:
> > > On Mon, Aug 27, 2012 at 11:28:30PM +0200, Janusz Krzysztofik wrote:
>
> > > > - platform_set_drvdata(ams_delta_audio_platform_device,
> > > > - &ams_delta_audio_card);
>
> > > The real fix here is that you should be using platform data here,
not
> > > driver data. Is there some reason not to do that?
>
> > Do you think the change you propose is suitable for the rc cycle?
I'm
> > trying to fix a regression in the first place. Converting the ams-
delta
> > asoc to a platform driver is on my todo list and I'm going to take
care
> > of this as soon as I have enough spare time.
>
> The above looks like you already have a platform driver? All I'm
> suggesting is changing the above to use platform rather than driver
> data.
The ams-delta asoc driver doesn't use snd_soc_register_card() so far,
but relays solely on soc_probe() doing this for it, which in turn
expects to find a snc_soc_card structure in drvdata. How is it supposed
to find that structure if I pass it over platform data instead? Am I
missing something?
Thanks,
Janusz
On Wed, Aug 29, 2012 at 07:04:48AM +0200, Janusz Krzysztofik wrote:
> On Tue, 28 Aug 2012 11:13:39 Mark Brown wrote:
> > The above looks like you already have a platform driver? All I'm
> > suggesting is changing the above to use platform rather than driver
> > data.
> The ams-delta asoc driver doesn't use snd_soc_register_card() so far,
> but relays solely on soc_probe() doing this for it, which in turn
> expects to find a snc_soc_card structure in drvdata. How is it supposed
> to find that structure if I pass it over platform data instead? Am I
> missing something?
s/drvdata/platdata/ in the code. If you can't do this then just
referencing the data directly in the code would be better than this
bodge, it'd be much less fragile.