From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Henningsson Subject: Re: link between HDMI ELD and PCM devices Date: Wed, 21 Sep 2011 08:44:15 +0200 Message-ID: <4E7987BF.8000206@canonical.com> References: <1316560363.3872.14.camel@pbossart-Dell-N7010> <74CDBE0F657A3D45AFBB94109FB122FF04B73217D2@HQMAIL01.nvidia.com> <1316566711.3872.24.camel@pbossart-Dell-N7010> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by alsa0.perex.cz (Postfix) with ESMTP id BE74A1038A9 for ; Wed, 21 Sep 2011 08:44:20 +0200 (CEST) In-Reply-To: <1316566711.3872.24.camel@pbossart-Dell-N7010> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Pierre-Louis Bossart Cc: Takashi Iwai , "alsa-devel@alsa-project.org" , Wu Fengguang , Stephen Warren List-Id: alsa-devel@alsa-project.org 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. http://launchpad.net/~diwic