On Wed, Aug 07, 2013 at 12:47:16PM +0200, Lars-Peter Clausen wrote:
On 08/07/2013 11:36 AM, Mark Brown wrote:
Adding an event callback shouldn't be hard?
But tricky. The widget of course can have a event callback, but since the widget is created by the DAPM layer and not the codec driver there is currently no way to setup the callback. And then there is of course the question when do you want to run the callback, only if DAPM unmutes the control, if the user unmutes the control or both.
I'd expect to run any time we actually interact with the hardware.
One thing that could work is to setup SND_SOC_DAPM_{PRE,POST}_REG events for the SWITCH widget. This callback gets called whenever user changes the control (and it is not disabled by DAPM). The next step then would be to set up an internal event callback for kcontrol widgets which then again calls the event callbacks for the kcontrol's widgets like we do in dapm_widget_update(). But I'm not convinced that this is the best way to solve this. I think it makes things more complicated than they need to be. I think having a OUTDRV widget along the path that runs the mute and unmute sequence might be a better option. And then have virtual switch control to let userspace disconnect the path, so that it is still possbile to manually mute it.
This only works for mute and unmute, it won't work for things like fun sequences to do volume changes.