When a device is plugged over HDMI, it passes some information in ELD
including the supported PCM parameters like formats, rates, channels.
This patch adds the check to PCM open callback of HDMI streams so that
only valid parameters the device supports are used.
When no device is plugged, the parameters the codec supports are used;
it's mostly all parameters the hardware can work. This is for apps
that are started before device plugging and do probing (e.g. a sound
daemon), so that at least, probing would work even before the device
plugging.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Passing IEC 61937 encapsulated compressed audio at bitrates over 6.144
Mbps (i.e. more than a single 2-channel 16-bit 192kHz IEC 60958 link)
over HDMI requires the use of HBR Audio Stream Packets instead of Audio
Sample Packets.
Enable HBR mode when the stream has 8 channels and the Non-PCM bit is
set.
If the audio converter is not connected to any HBR-capable pins, return
-EINVAL in prepare().
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use the full chipset codename as codec name.
They are more user friendly than the spec abbrs.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Create patch_hdmi.c to hold common code from intelhdmi and nvhdmi.
For now the patch_hdmi.c file is simply included by patch_intelhdmi.c
and patch_nvhdmi.c, and does not represent a real codec.
There are no behavior changes to intelhdmi. However nvhdmi made several
changes when copying code out of intelhdmi, which are all reverted in
this patch. Wei Ni confirmed that the reverted code actually works fine.
Tested-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
For codecs without EPSS support (G45/IbexPeak), the hotplug event will
be lost if the HDA is powered off during the time. After that the pin
presence detection verb returns inaccurate info.
So always power-on HDA link for !EPSS codecs.
KarL offers the fact and Takashi recommends to flag hda_bus. Thanks!
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
IbexPeak is the first Intel HDMI audio codec to support channel mapping.
Currently the outstanding problem is, the HDMI channel order do not
agree with that of ALSA. This patch presents workaround for some
typical use cases. It gives priority to the typical ALSA surround
configurations, and defines channel mapping for them.
We may need better kernel+userspace interactive channel mapping scheme.
For example, in current scheme if user plays with the surround50 device,
the kernel is unaware of this and will still select the surround41
channel allocation and channel mapping..
Thanks to Marcin for offering good tips!
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
HDA036-A specifies that the Audio Sample Packet (ASP) Channel Mapping
verbs apply to Digital Display Pin Complex instead of Converter.
With this fix, channel mapping is working as expected for IbexPeak.
Thanks to Marcin for pointing this out!
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
HDA036 spec states:
DP (Display Port) indicates whether the Pin Complex Widget supports
connection to a Display Port sink. Supported if set to 1. Note that
it is possible for the pin widget to support more than one digital
display connection type, e.g. HDMI and DP bit are both set to 1.
Also export the DP pin cap in procfs.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
We tracked down the first-0.5s-hdmi-audio-samples-lost problem to the
AC_VERB_SET_CHANNEL_STREAMID command. It is suspected that many HDMI
sinks need some time to adapt to the new state.
The workaround is to avoid changing stream id/format whenever possible.
Proposed by David.
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Remember the active infoframe, so as to avoid stop/restart infoframe
transmission when switching between audio clips of the same format.
Proposed by Shang and David.
CC: Shane W <shane-alsa@csy.ca>
CC: David Härdeman <david@hardeman.nu>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
And make it right when called for more than one times.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This avoids lost of presence info on module reloading.
The presence info used to be only updated at the (rare) hotplug events.
Proposed by David, thanks!
CC: David Härdeman <david@hardeman.nu>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Added a proper ifdef CONFIG_SND_DEBUG_VERBOSE to avoid a compile warning:
sound/pci/hda/patch_intelhdmi.c:406: warning: ‘hdmi_get_channel_count’ defined but not used
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The Intel IbexPeak HDMI codec supports 2 converters and 3 pins,
which requires converting the cvt_nid/pin_nid to arrays.
The active pin number (the one connected with a live HDMI monitor/sink)
will be dynamically identified on hotplug events.
It exports two HDMI devices, so that user space can choose the A/V pipe
for sending the audio samples.
It's still undefined behavior when there are two active monitors
connected and routed to the same audio converter.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
An earlier patch merely adds id for 0x80862804.
It has 2/3 cvt/pin nodes and shall be tied to the IbexPeak handler.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The new IbexPeak HDMI codec has 3 pin nodes and 2 converter nodes.
Here we assume only the first ones will be used.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Here are the new sound enabling patches for IbexPeak.
Summary of tested features:
- playback
- Front Headphone: OK
- 8 channel audio: Front/Rear/CLFE/Side all OK
- recording
- Front Mic/Rear Mic: both OK
(front/rear/line mics are selectable in the "Input source" alsamixer control)
- Line In: not working
(in 6ch mode, its amp/mute, direction and route all looks fine,
so I'm a little puzzled)
(hopefully no one will care this feature)
- digital SPDIF input/output: not tested (no equipment)
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
We found that enabling/disabling HDMI audio pin out at stream start/stop
time will kill the leading 500ms or so sound samples. Avoid this by enabling
pin out once and for ever at module loading time.
The leading ~500ms audio samples will still be lost when switching from
X-channel playback to Y-channel playback where X != Y. However there's no
much we can do about it: the audio infoframe has to change and it looks like
either G45 or YAMAHA requires some time to switch the configuration.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The YAMAHA AV-X1800 requires audio infoframe to include speaker-channel
mapping to play >2 channel HDMI audio. In theory that mapping should be
derived from its speaker configurations contained in its ELD. However we
currently cannot get ELD in console before the KMS functionalities are ready.
This is a more or less general issue at least in the near future. As a
workaround, we propose to allow playback of mult-channel audio when ELD
is not available.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Split the monolithc HD-audio driver into several pieces:
- snd-hda-intel HD-audio PCI controller driver; loaded via udev
- snd-hda-codec HD-audio codec bus driver
- snd-hda-codec-* Specific HD-audio codec drivers
When built as modules, snd-hda-codec (that is invoked by snd-hda-intel)
looks up the codec vendor ID and loads the corresponding codec module
automatically via request_module().
When built in a kernel, each codec drivers are statically hooked up
before probing the PCI.
This patch adds appropriate EXPORT_SYMBOL_GPL()'s and the module
information for each driver, and driver-linking codes between
codec-bus and codec drivers.
TODO:
- Avoid EXPORT_SYMBOL*() when built-in kernel
- Restore __devinit appropriately depending on the condition
Signed-off-by: Takashi Iwai <tiwai@suse.de>
- make some messages more user friendly
- add message prefix "HDMI:" to indicate the problem's domain
(also easier to do `dmesg | grep HDMI` ;-)
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Print some CA selecting info, which could be valuable for debugging when
something goes wrong.
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Refactor the channel mapping code for consistent naming
and make it more informed about channel allocations.
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
To play a 3+ channels LPCM/DSD stream via HDMI,
- HDMI sink must tell HDMI source about its speaker placements
(via ELD, speaker-allocation field)
- HDMI source must tell the HDMI sink about channel allocation
(via audio infoframe, channel-allocation field)
(related docs: HDMI 1.3a spec section 7.4, CEA-861-D section 7.5.3 and 6.6)
This patch attempts to set the CA(channel-allocation) byte in the audio infoframe
according to
- the number of channels in the current stream
- the speakers attached to the HDMI sink
A channel_allocations[] line must meet the following two criteria to be
considered as a valid candidate for CA:
1) its number of allocated channels = substream->runtime->channels
2) its speakers are a subset of the available ones on the sink side
If there are multiple candidates, the first one is selected. This simple
policy shall cheat the sink into playing music, but may direct data to the
wrong speakers.
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
code refactor: make a standalone function hdmi_fill_audio_infoframe().
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Create /proc/asound/card<card_no>/eld#<codec_no> to reflect the audio
configurations and capabilities of the attached HDMI sink.
Some notes:
- Shall we show an empty file if the ELD content is not valid?
Well it's not that simple. There could be partially populated ELD,
and there may be malformed ELD provided by buggy drivers/monitors.
So expose ELD as it is.
- The ELD retrieval routines rely on the Intel HDA interface,
others are/could be universal and independent ones.
- How do we name the proc file?
If there are going to be two HDMI pins per codec, then the current naming
scheme (eld#<codec no>) will fail. Luckily the user space dependencies should
be minimal, so it would be trivial to do the rename if that happens.
- The ELD proc file content is designed to be easy for scripts and human reading.
Its lines all have the pattern:
<item_name>\t[\t]*<item_value>
where <item_name> is a keyword in c language, while <item_value> could be any
contents, including white spaces. <item_value> could also be a null value.
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ELD handling routines can be shared by all HDMI codecs,
and they are large enough to make a standalone source file.
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reorder HDMI audio enabling sequence so that
1) the sink knows about the coming audio stream
2) unmute
3) start transferring audio samples
The theory is that in the path A=>B=>C, we first make C ready, and then
enable B, and lastly allow A to send audio samples.
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Move the handling of SiI1392 HDMI codec from patch_atihdmi.c to
patch_intelhdmi.c, which makes our ASUS P5E-VM HDMI board work.
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add a proper ifdef to shut out a compile warning:
CC [M] sound/pci/hda/patch_intelhdmi.o
sound/pci/hda/patch_intelhdmi.c:286: warning: ‘hdmi_get_dip_index’ defined but \
not used
Signed-off-by: Takashi Iwai <tiwai@suse.de>