[alsa-devel] How to trigger a widget?
As I saw many examples to use the snd_soc_dapm_enable_pin() to trigger a particular widget. But I saw the widget has to be like a speaker, mic, lineout, etc. Could I use the snd_soc_dapm_enable_pin() to trigger any type of widget I want? I tried to use it to trigger a supply widget, but I never see it works even I did snd_soc_dapm_sync() after the enable_pin. Could someone provide some inputs?
Appreciated your time.
Thanks,
Kuirong Wang
On 02/20/2012 08:13 AM, Wang, Kuirong wrote:
As I saw many examples to use the snd_soc_dapm_enable_pin() to trigger a particular widget. But I saw the widget has to be like a speaker, mic, lineout, etc. Could I use the snd_soc_dapm_enable_pin() to trigger any type of widget I want? I tried to use it to trigger a supply widget, but I never see it works even I did snd_soc_dapm_sync() after the enable_pin. Could someone provide some inputs?
Appreciated your time.
Thanks,
Kuirong Wang
Hi,
snd_soc_dapm_force_enable_pin is probably what you are looking for.
- Lars
On 02/20/2012 1:08 AM, Lars-Peter Clausen wrote:
Hi,
snd_soc_dapm_force_enable_pin is probably what you are looking for.
- Lars
Thanks Lars. I tried the snd_soc_dapm_force_enable_pin, it didn't make different.
I have kcontrol to enable a function of codec on fly. With or without the function, it cannot impact the established audio routing. So I created widget as a supply, as long as the audio path is established, this supply widget is triggered. The supply widget has a callback event function. The kcontrol control has an event callback function as well which calls the enable/disable pin to trigger the widget callback event, so this particular function can be enabled or disabled.
Thanks, - Kuirong
On 02/21/2012 06:09 AM, Wang, Kuirong wrote:
On 02/20/2012 1:08 AM, Lars-Peter Clausen wrote:
Hi,
snd_soc_dapm_force_enable_pin is probably what you are looking for.
- Lars
Thanks Lars. I tried the snd_soc_dapm_force_enable_pin, it didn't make different.
I have kcontrol to enable a function of codec on fly. With or without the function, it cannot impact the established audio routing. So I created widget as a supply, as long as the audio path is established, this supply widget is triggered. The supply widget has a callback event function. The kcontrol control has an event callback function as well which calls the enable/disable pin to trigger the widget callback event, so this particular function can be enabled or disabled.
I'm not quite sure if I understand what you want to do, but a snd_soc_dapm_force_enable_pin followed by a snd_soc_dapm_sync should enable a widget regardless of whether it is currently in use or not.
Hi,
On 02/21/2012 07:09 AM, Wang, Kuirong wrote:
I have kcontrol to enable a function of codec on fly. With or without the function, it cannot impact the established audio routing. So I created widget as a supply, as long as the audio path is established, this supply widget is triggered. The supply widget has a callback event function. The kcontrol control has an event callback function as well which calls the enable/disable pin to trigger the widget callback event, so this particular function can be enabled or disabled.
Would not it be simpler if you just enable/disable the feature in the kcontrol's set callback?
Another way I would go is this:
|-> (off) ---------| [Feature switch] -| |-> [next widget] |-> (on) -> [PGA] -|
In the PGA you turn on/off the feature. If the switch changes it will not affect other items in the path, it will only make the PGA to turn on/off.
On 02/21/2012 11:28 PM, Peter Ujfalusi wrote:
Would not it be simpler if you just enable/disable the feature in the kcontrol's set callback?
Another way I would go is this:
|-> (off) ---------|
[Feature switch] -| |-> [next widget] |-> (on) -> [PGA] -|
In the PGA you turn on/off the feature. If the switch changes it will not affect other items in the path, it will only make the PGA to turn on/off.
-- Péter
Peter,
I don't want to power on this circuit related to the feature if the audio stream is not playing so if I use the kcontrol callback function to do so, it could power up even the audio stream is not playing.
I will try the way you suggested by using a switch. In the meanwhile, I will check why the enable_pin doesn't work as expected in my system.
Thanks!
Kuirong
participants (3)
-
Lars-Peter Clausen
-
Peter Ujfalusi
-
Wang, Kuirong