[alsa-devel] link between HDMI ELD and PCM devices

David Henningsson david.henningsson at canonical.com
Wed Sep 21 08:44:15 CEST 2011

On 09/21/2011 02:58 AM, Pierre-Louis Bossart wrote:
>>> There is some existing code such as pin_nid_to_pin_index() in
>>> patch_hdmi.c, but I can't figure out what this pin_idx is, and how to
>>> find the related PCM device number.
>>> Any suggestions?
>> That function simply returns the index into the array spec->pins[] that
>> refers to that pin NID.
>> Judging by hinfo_to_pin_index() (e.g. used near the start ofhdmi_pcm_open),
>> that same index is valid  for spec->pcm_rec[] too, which I assume will
>> give you access to what you want, possibly through the .stream[0] field.
> Looks like the device number is assigned in hda_codec.c and there's no
> hooks to create the ELD control then...
> Instead of creating a PCM_IFACE control, it's probably simpler to create
> a MIXER control in the build_pcms routines, using the same name for the
> control and the device, eg:
>> amixer -c0 controls
> numid=1,iface=MIXER,name='ELD HDMI 0'
>> aplay -l
> card 0: Intel [HDA Intel], device 3: HDMI 0 [HDMI 0]
> That looks simple enough for apps to figure out which ELD control to
> use? Feedback welcome.

This won't work - in the case of several HDMI codecs (common with 
NVidia) there will be more than one "HDMI 0".

The solution is to actually find the device number out, like this:

	struct hdmi_spec *spec = codec->spec;
	int pcmdev = spec->pcm_rec[pin_idx].device;

(This must be run after build_pcms, e g in build_controls.)

David Henningsson, Canonical Ltd.

More information about the Alsa-devel mailing list