
On 09/21/2011 03:20 PM, Pierre-Louis Bossart wrote:
This won't work - in the case of several HDMI codecs (common with NVidia) there will be more than one "HDMI 0".
No, the code doesn't use a constant,
It's actually four constants, please see generic_hdmi_pcm_names in patch_hdmi.c. But my point is that this restarts from 0 on every codec.
it's assigned in the same way as the device name. You would have HDMI 0, HDMI 1..4. I don't have this kind of hardware, it'd be good if someone could verify that the name is indeed dynamic.
On a 3.0 based kernel, here's part of my aplay -l output:
card 3: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: NVidia [HDA NVidia], device 7: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: NVidia [HDA NVidia], device 8: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: NVidia [HDA NVidia], device 9: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #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;
That's what I wanted initially, but this device field is not used/initialized, and like I said the device assignment comes after the pin sensing and all the ELD handling
A good place to do this is generic_hdmi_build_controls, both because it is normally used to add controls (which is what you do), and because it is triggered after the pcm device is assigned.
(A side note to Takashi: for some reason hda-emu has the calls to build_controls and build_pcms switched, compared to the real implementation.)