* How to implement capture_switch control?
@ 2011-06-20 7:15 Adam Jiang
2011-06-21 1:51 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Adam Jiang @ 2011-06-20 7:15 UTC (permalink / raw)
To: Alsa-devel
Hello list,
I have a device with wm8903 codec. To support mute/unmute capture
signal, I was trying to enable/disable PGA on this codec from user
space application like
snd_ctl_elem_value_set_boolean("Left Input PGA Switch", 0, 0)
That means the mute/unmute function became platform dependent. I got
the idea to support mute/unmute function with enabling/disabling
capture switch. However, the function
snd_mixer_selem_has_capture_switch()
alwasy return false. I guess something is missing in my driver. Could
you please give some bright how could I use capture switch to
mute/unmute a channel. How could I implement capture_switch control
properly? Thank you!
/Adam
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: How to implement capture_switch control? 2011-06-20 7:15 How to implement capture_switch control? Adam Jiang @ 2011-06-21 1:51 ` Mark Brown 2011-06-22 7:56 ` Adam Jiang 0 siblings, 1 reply; 5+ messages in thread From: Mark Brown @ 2011-06-21 1:51 UTC (permalink / raw) To: Adam Jiang; +Cc: Alsa-devel On Mon, Jun 20, 2011 at 04:15:38PM +0900, Adam Jiang wrote: > I have a device with wm8903 codec. To support mute/unmute capture > signal, I was trying to enable/disable PGA on this codec from user > space application like If the hardware does not physically support mute then this should be emulated in software. In the case of the WM8903 the device does not have a specific capture mute control, though extremely low gains are supported for the Capture Volume control which function as a mute so you could also set minimum Capture Volume. > alwasy return false. I guess something is missing in my driver. Could > you please give some bright how could I use capture switch to > mute/unmute a channel. How could I implement capture_switch control > properly? Thank you! Not all hardware supports all possible features. Either configure a software volume control, the softvol plugin for ALSA should be able to do this, or adjust your application to handle this in the application layer. http://alsa.opensrc.org/How_to_use_softvol_to_control_the_master_volume has some information on using softvol. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to implement capture_switch control? 2011-06-21 1:51 ` Mark Brown @ 2011-06-22 7:56 ` Adam Jiang 2011-06-22 13:06 ` Mark Brown 0 siblings, 1 reply; 5+ messages in thread From: Adam Jiang @ 2011-06-22 7:56 UTC (permalink / raw) To: Alsa-devel 2011/6/21 Mark Brown <broonie@opensource.wolfsonmicro.com>: > On Mon, Jun 20, 2011 at 04:15:38PM +0900, Adam Jiang wrote: > >> I have a device with wm8903 codec. To support mute/unmute capture >> signal, I was trying to enable/disable PGA on this codec from user >> space application like > > If the hardware does not physically support mute then this should be > emulated in software. In the case of the WM8903 the device does not > have a specific capture mute control, though extremely low gains are > supported for the Capture Volume control which function as a mute so > you could also set minimum Capture Volume. I got the idea about software emulation for mute. Would you please point me to an example about device/driver where hardware capture switch is supported? > >> alwasy return false. I guess something is missing in my driver. Could >> you please give some bright how could I use capture switch to >> mute/unmute a channel. How could I implement capture_switch control >> properly? Thank you! > > Not all hardware supports all possible features. Either configure a > software volume control, the softvol plugin for ALSA should be able to > do this, or adjust your application to handle this in the application > layer. > > http://alsa.opensrc.org/How_to_use_softvol_to_control_the_master_volume > > has some information on using softvol. > I have solved the problem by enabling/disabling PGA for analog input paths. For digital mic on wm8903, this function could be implemented by turning volume to lowest level for mute, and restore volume level for unmute. Thank you! ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to implement capture_switch control? 2011-06-22 7:56 ` Adam Jiang @ 2011-06-22 13:06 ` Mark Brown 2011-06-23 1:52 ` Adam Jiang 0 siblings, 1 reply; 5+ messages in thread From: Mark Brown @ 2011-06-22 13:06 UTC (permalink / raw) To: Adam Jiang; +Cc: Alsa-devel On Wed, Jun 22, 2011 at 04:56:26PM +0900, Adam Jiang wrote: > 2011/6/21 Mark Brown <broonie@opensource.wolfsonmicro.com>: > > On Mon, Jun 20, 2011 at 04:15:38PM +0900, Adam Jiang wrote: > > If the hardware does not physically support mute then this should be > > emulated in software. ?In the case of the WM8903 the device does not > > have a specific capture mute control, though extremely low gains are > > supported for the Capture Volume control which function as a mute so > > you could also set minimum Capture Volume. > I got the idea about software emulation for mute. Would you please > point me to an example about device/driver where hardware capture > switch is supported? grep "Capture Switch" sound/soc/codecs/*.c ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to implement capture_switch control? 2011-06-22 13:06 ` Mark Brown @ 2011-06-23 1:52 ` Adam Jiang 0 siblings, 0 replies; 5+ messages in thread From: Adam Jiang @ 2011-06-23 1:52 UTC (permalink / raw) To: Alsa-devel 2011/6/22 Mark Brown <broonie@opensource.wolfsonmicro.com>: > On Wed, Jun 22, 2011 at 04:56:26PM +0900, Adam Jiang wrote: >> 2011/6/21 Mark Brown <broonie@opensource.wolfsonmicro.com>: >> > On Mon, Jun 20, 2011 at 04:15:38PM +0900, Adam Jiang wrote: > >> > If the hardware does not physically support mute then this should be >> > emulated in software. ?In the case of the WM8903 the device does not >> > have a specific capture mute control, though extremely low gains are >> > supported for the Capture Volume control which function as a mute so >> > you could also set minimum Capture Volume. > >> I got the idea about software emulation for mute. Would you please >> point me to an example about device/driver where hardware capture >> switch is supported? > > grep "Capture Switch" sound/soc/codecs/*.c > I got wm8904 as an example. In the driver of wm8904, there is a control defined as SOC_DOUBLE_R("Capture Switch", WM8904_ANALOGUE_LEFT_INPUT_0, WM8904_ANALOGUE_RIGHT_INPUT_0, 7, 1, 0), And, there is also its peer in wm8903 defined as SOC_SINGLE("Left Input PGA Switch", WM8903_ANALOGUE_LEFT_INPUT_0, 7, 1, 1), I checked their datasheet and I found there is no difference between the registers of ANALOGUE_LEFT_INPUT_0. Both of them have one bit for mute/unmute analog input path. Comparing SOC_SINGLE and SOC_DOUBLE macro, one snd_soc_control structure is missing in former. What is exactly the difference between the two definitions. Is there any docs to describe how could I use these macros in soc.h? ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-06-23 1:52 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-06-20 7:15 How to implement capture_switch control? Adam Jiang 2011-06-21 1:51 ` Mark Brown 2011-06-22 7:56 ` Adam Jiang 2011-06-22 13:06 ` Mark Brown 2011-06-23 1:52 ` Adam Jiang
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).