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. -Pierre