All of lore.kernel.org
 help / color / mirror / Atom feed
* From snd_kcontrol_new_t to amixer
@ 2008-05-13 18:12 Peter Wurmsdobler
  2008-05-14  9:08 ` Clemens Ladisch
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Wurmsdobler @ 2008-05-13 18:12 UTC (permalink / raw)
  To: alsa-devel

Hello,

I am puzzled by an observation that runs against my common sense. The 
pmic-alsa-mixer.c provides 6 (six) snd_kcontrol_new_t controls with 
their callback functions, name and other members, then registers 
themusing snd_ctl_add(...). However, amixer shows only 5 (five), and all 
with different names. What is the process of generating these names if 
not from the kernel structures?

By looking through the mixer related code in alsa-utils and alsa-libs, I 
see that somehow the library loads the mixer controls and possibly 
retrieves all the information provided by them, including their names. 
Either some piece of code shortens the names defined in the driver, or 
it maps them to some generic controls. Any suggestions?

The system I am working on uses a Freescale imx27 in conjunction with an 
MC13783 power management IC, also responsible for audio (it provides a 
voice codec and a stereo dac). The kernel used is a 2.6.19.2 as part of 
ltib from Freescale. amixer tells me:

mx27# amixer
Simple mixer control 'Master',0
   Capabilities: pvolume pvolume-joined cvolume
   Playback channels: Mono
   Capture channels: Mono
   Limits: Playback 0 - 100 Capture 0 - 100
   Mono: Playback 0 [0%] Capture 0 [0%]
Simple mixer control 'Master Balance',0
   Capabilities: pvolume pvolume-joined
   Playback channels: Mono
   Limits: Playback 0 - 100
   Mono: Playback 50 [50%]
Simple mixer control 'Master Input',0
   Capabilities: cvolume
   Capture channels: Mono
   Limits: Capture 0 - 7
   Mono: Capture 1 [14%]
Simple mixer control 'Master Monoconfig',0
   Capabilities: pvolume pvolume-joined
   Playback channels: Mono
   Limits: Playback 0 - 3
   Mono: Playback 0 [0%]
Simple mixer control 'Master Output',0
   Capabilities: pvolume pvolume-joined
   Playback channels: Mono
   Limits: Playback 0 - 15
   Mono: Playback 12 [80%]


snd_kcontrol_new_t pmic_control_pb_vol __devinitdata = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "Master Playback Volume",
	.index = 0x00,
	.info = pmic_pb_volume_info,
	.get = pmic_pb_volume_get,
	.put = pmic_pb_volume_put,
	.private_value = 0xffab1,
};

snd_kcontrol_new_t pmic_control_pb_bal __devinitdata = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "Master Balance Playback Volume",
	.index = 0x00,
	.info = pmic_pb_balance_info,
	.get = pmic_pb_balance_get,
	.put = pmic_pb_balance_put,
	.private_value = 0xffab2,
};
snd_kcontrol_new_t pmic_control_pb_mono __devinitdata = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "Master Monoconfig Playback Volume",
	.index = 0x00,
	.info = pmic_pb_monoconfig_info,
	.get = pmic_pb_monoconfig_get,
	.put = pmic_pb_monoconfig_put,
	.private_value = 0xffab2,
};
snd_kcontrol_new_t pmic_control_op_sw __devinitdata = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "Master Output Playback Volume",
	.index = 0x00,
	.info = pmic_mixer_output_info,
	.get = pmic_mixer_output_get,
	.put = pmic_mixer_output_put,
	.private_value = 0xffab4,
};

snd_kcontrol_new_t pmic_control_cap_vol __devinitdata = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "Master Capture Volume",
	.index = 0x00,
	.info = pmic_cap_volume_info,
	.get = pmic_cap_volume_get,
	.put = pmic_cap_volume_put,
	.private_value = 0xffab5,
};
snd_kcontrol_new_t pmic_control_ip_sw __devinitdata = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "Master Input Capture Volume",
	.index = 0x00,
	.info = pmic_cap_input_info,
	.get = pmic_cap_input_get,
	.put = pmic_cap_input_put,
	.private_value = 0xffab5,
};

int mxc_alsa_create_ctl(snd_card_t * card, void *p_value)
{
	int err = 0;

	if ((err = snd_ctl_add(card,
		snd_ctl_new1(&pmic_control_op_sw, p_value))) < 0)
		return err;

	if ((err = snd_ctl_add(card,
		snd_ctl_new1(&pmic_control_pb_vol, p_value))) < 0)
		return err;
	
	if ((err = snd_ctl_add(card,
		snd_ctl_new1(&pmic_control_pb_mono, p_value))) < 0)
		return err;
	
	if ((err = snd_ctl_add(card,
		snd_ctl_new1(&pmic_control_pb_bal, p_value))) < 0)
		return err;
	
	if ((err = snd_ctl_add(card,
		snd_ctl_new1(&pmic_control_cap_vol, p_value))) < 0)
		return err;
	
	if ((err = snd_ctl_add(card,
		snd_ctl_new1(&pmic_control_ip_sw, p_value))) < 0)
		return err;

	return 0;
}

Cheers,
peter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: From snd_kcontrol_new_t to amixer
  2008-05-13 18:12 From snd_kcontrol_new_t to amixer Peter Wurmsdobler
@ 2008-05-14  9:08 ` Clemens Ladisch
  0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2008-05-14  9:08 UTC (permalink / raw)
  To: Peter Wurmsdobler; +Cc: alsa-devel

Peter Wurmsdobler wrote:
> I am puzzled by an observation that runs against my common sense. The
> pmic-alsa-mixer.c provides 6 (six) snd_kcontrol_new_t controls with
> their callback functions, name and other members, then registers
> themusing snd_ctl_add(...). However, amixer shows only 5 (five), and all
> with different names. What is the process of generating these names if
> not from the kernel structures?

There is an additional layer (the "simple" mixer layer) on top of the
kernel mixer layer.

Use "amixer controls" or "amixer contents" to see the kernel controls.


HTH
Clemens

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-14  9:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-13 18:12 From snd_kcontrol_new_t to amixer Peter Wurmsdobler
2008-05-14  9:08 ` Clemens Ladisch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.