On Mon, Aug 22, 2011 at 02:34:23PM +0300, Péter Ujfalusi wrote:
On Friday 19 August 2011 10:49:08 Lars-Peter Clausen wrote:
sorry: struct omap_mcpdm *mcpdm = snd_soc_platform_get_drvdata(w->platform);
This would avoid having to add the private_data field to the widget struct. In it's current form it will only really work, if there is just one instance of the driver using the widget. And if that's the case you can use a global variable directly anyway.
The other option was to use global variable to get the *mcpdm for the widget. Generally I try to avoid global variables as much as I can, since the use of them looks really hackish. There could be some way to reach the CPU dai via pointers/lookups from the widget, but it does looked really ugly, and I was only half way there.
The widget will have a DAPM context associated with it, should we perhaps add this facility to the DAPM context where it'd then work for everything? If we're getting fancy the context could look up the CODEC context rather than use a local one if it's for a CODEC.