History log of /linux-master/sound/pci/hda/hda_eld.c
Revision Date Author Comments
# 2fa22c3c 21-Sep-2022 Jaroslav Kysela <perex@perex.cz>

ALSA: hda/hdmi: ELD procfs - print the codec NIDs

It is useful for the debugging to print also the used HDA codec NIDs
used for the given HDMI device. With the dynamic converter assignment
the converter NID is changed dynamically.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20220921093349.82680-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 75b1a8f9 04-Jan-2021 Joe Perches <joe@perches.com>

ALSA: Convert strlcpy to strscpy when return value is unused

strlcpy is deprecated. see: Documentation/process/deprecated.rst

Change the calls that do not use the strlcpy return value to the
preferred strscpy.

Done with cocci script:

@@
expression e1, e2, e3;
@@

- strlcpy(
+ strscpy(
e1, e2, e3);

This cocci script leaves the instances where the return value is
used unchanged.

After this patch, sound/ has 3 uses of strlcpy() that need to be
manually inspected for conversion and changed one day.

$ git grep -w strlcpy sound/
sound/usb/card.c: len = strlcpy(card->longname, s, sizeof(card->longname));
sound/usb/mixer.c: return strlcpy(buf, p->name, buflen);
sound/usb/mixer.c: return strlcpy(buf, p->names[index], buflen);

Miscellenea:

o Remove trailing whitespace in conversion of sound/core/hwdep.c

Link: https://lore.kernel.org/lkml/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/22b393d1790bb268769d0bab7bacf0866dcb0c14.camel@perches.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 44eeb081 18-Feb-2020 Takashi Iwai <tiwai@suse.de>

ALSA: hda: Use scnprintf() for printing texts for sysfs/procfs

Some code in HD-audio driver calls snprintf() in a loop and still
expects that the return value were actually written size, while
snprintf() returns the expected would-be length instead. When the
given buffer limit were small, this leads to a buffer overflow.

Use scnprintf() for addressing those issues. It returns the actually
written size unlike snprintf().

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200218091409.27162-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bf82326f 05-Jan-2020 Takashi Iwai <tiwai@suse.de>

ALSA: hda: More constifications

Apply const prefix to the remaining possible places: the string
tables, the rate tables, the verb tables, the index tables, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d0fa1179 20-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 32

Based on 1 normalized pattern(s):

this driver is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this driver is distributed in the hope
that it will be useful but without any warranty without even the
implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details you
should have received a copy of the gnu general public license along
with this program if not write to the free software foundation inc
59 temple place suite 330 boston ma 02111 1307 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 18 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190520170857.186505395@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# be57bfff 22-Aug-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: hda: move hda_codec.h to include/sound

As suggested by Takashi, move this header file to make it easier
to include from e.g. the Intel Skylake driver in follow-up patches

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b4af16d6 22-Aug-2018 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: hda: move hda_codec.h to include/sound

As suggested by Takashi, move this header file to make it easier
to include from e.g. the Intel Skylake driver in follow-up patches

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# bb63f726 04-Mar-2016 Subhransu S. Prusty <subhransu.s.prusty@intel.com>

ALSA: hda - Use snd_hdac namespace prefix for chmap exported APIs

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2f6e8a85 04-Mar-2016 Subhransu S. Prusty <subhransu.s.prusty@intel.com>

ALSA: hda - Move chmap support helpers/ops to core

Chmap helpers, ops, controls are moved to core.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 18014fd7 12-Nov-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Do zero-clear in snd_hdmi_parse_eld() itself

Instead of doing in each caller side, snd_hdmi_parse_eld() does
zero-clear of the parsed data by itself. This is safer and simplifies
the upcoming code changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d5cf00c7 17-Aug-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hda/eld - Add const to possible places

Similar like the previous fix to hda_proc.c, adding const prefix will
save our world (a little bit).

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cd6a6503 27-May-2015 Jie Yang <yang.jie@intel.com>

ALSA: replace CONFIG_PROC_FS with CONFIG_SND_PROC_FS

We may disable proc fs only for sound part, to reduce ALSA
memory footprint. So add CONFIG_SND_PROC_FS and replace the
old CONFIG_PROC_FSs in alsa code.

With sound proc fs disabled, we can save about 9KB memory
size on X86_64 platform.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a11e9b16 29-Oct-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Correct kerneldoc comments

Complete the missing parameters and fix anything wrong there.
Just comment changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 79514d47 06-Jun-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Kill snd_printd*() in HDMI debug / info prints

Pass codec instance to each function that still prints info and debug
outputs via snd_printd*().

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4e76a883 24-Feb-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Replace with standard printk

Use dev_err() and co for messages from HD-audio controller and codec
drivers. The codec drivers are mostly bound with codec objects, so
some helper macros, codec_err(), codec_info(), etc, are provided.
They merely wrap the corresponding dev_xxx().

There are a few places still calling snd_printk() and its variants
as they are called without the codec or device context.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 679605c7 10-Nov-2013 Anssi Hannula <anssi.hannula@iki.fi>

ALSA: hda - hdmi: Fix wrong baseline length in ATI/AMD generated ELD

According to the HDA specification the baseline ELD length is counted in
DW of 4 bytes instead of in bytes.

Fix the code accordingly.

Baseline length is not used by the kernel so only the ELD exported to
userspace was affected. No issues have been reported.

v2: Fixed so that eld_size is adjusted upwards accordingly as well.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a5666824 10-Nov-2013 Anssi Hannula <anssi.hannula@iki.fi>

ALSA: hda - hdmi: Skip out-of-range latency values in AMD ELD generator

The ATI/AMD video/audio latencies are specified in apparent HDMI VSDB
format. In this format values above 251 are not valid (or stream
component is not supported - 255), but no checking is performed since
this was not mentioned in the AMD HDA verbs specification.

Check that the latencies are valid before using them, and add a comment
describing the formats.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 13122e6e 10-Nov-2013 Anssi Hannula <anssi.hannula@iki.fi>

ALSA: hda - hdmi: Add error-checking to some codec reads

Add error checks to HBR status reads (both generic and ATI/AMD) and
ATI/AMD codec reads for ELD generation.

Unchecked errors in these just caused more errors later on (invalid
codec writes for the HBR ones and ELD parsing errors for the ATI/AMD ELD
ones), but it is better to catch them earlier.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 89250f84 24-Oct-2013 Anssi Hannula <anssi.hannula@iki.fi>

ALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs

ATI/AMD HDMI/DP codecs do not include standard HDA ELD (EDID-like data)
support.

In place of providing access to an ELD buffer, various vendor-specific
verbs are provided to provide the relevant information. Revision ID 3
and later (0x100300 as reported by procfs codec#X) have support for
providing more information than the previous revisions (but only if
supported by the display driver).

Generate ELD from the information provided by the vendor-specific verbs
on ATI/AMD codecs.

The specification is available at:
http://www.x.org/docs/AMD/AMD_HDA_verbs_v2.pdf

v2: moved code to hda_eld.c and cleaned it up
v3: adapted to hdmi_ops infrastructure

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Peter Frühberger <fritsch@xbmc.org> # v2
Tested-by: Olivier Langlois <olivier@trillion01.com> # v2
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a4e9a38b 17-Oct-2013 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Move mutex from hda_eld to per_pin in HDMI codec driver

Since the lock is used primarily in patch_hdmi.c, it's better to move
it in the local struct instead of exporting in hda_eld. The only
functions requiring the lock in hda_eld.c are proc accessors. So in
this patch, the proc entry and its creation/deletion/accessors are
moved into patch_hdmi.c, together with the mutex lock to pin_spec
struct.

The former proc info functions are exported so that they can be called
from patch_hdmi.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2ef5692e 28-Mar-2013 Mengdong Lin <mengdong.lin@intel.com>

ALSA: hda - bug fix on return value when getting HDMI ELD info

In function snd_hdmi_get_eld(), the variable 'ret' should be initialized to 0.
Otherwise it will be returned uninitialized as non-zero after ELD info is got
successfully. Thus hdmi_present_sense() will always assume ELD info is invalid
by mistake, and /proc file system cannot show the proper ELD info.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Cc: stable@vger.kernel.org
Acked-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4bd038f9 19-Feb-2013 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - hdmi: Protect ELD buffer

Because the eld buffer can be simultaneously accessed from both
workqueue context (updating) and process context (kcontrol read),
we need to protect it with a mutex to guarantee consistency.

To avoid holding the mutex while reading the ELD info from the
codec, we introduce a temporary eld buffer.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1613d6b4 19-Feb-2013 David Henningsson <david.henningsson@canonical.com>

ALSA: hda - hdmi: Refactor hdmi_eld into parsed_hdmi_eld

For better readability, the information that is parsed out of the
ELD data is now put into a separate parsed_hdmi_eld struct.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fae3d88a 10-Apr-2012 Fengguang Wu <fengguang.wu@intel.com>

ALSA: hda - hide HDMI/ELD printks unless snd.debug=2

Also remove two warnings when CONFIG_SND_DEBUG is not set:

sound/pci/hda/patch_hdmi.c: In function ‘hdmi_intrinsic_event’:
sound/pci/hda/patch_hdmi.c:761:6: warning: unused variable ‘eldv’ [-Wunused-variable]
sound/pci/hda/patch_hdmi.c:760:6: warning: unused variable ‘pd’ [-Wunused-variable]

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 25dc16f6 13-Mar-2012 Anssi Hannula <anssi.hannula@iki.fi>

ALSA: hda - fix printing of high HDMI sample rates

A previous commit af65cbf296 (ALSA: hdmi: fix printout of SAD sampling
rates) fixed the sample rates shown in /proc/asound/cardX/eldY and
kernel log to not be entirely wrong. However, a missing rate from the
array added in the patch causes HDMI rates 88.2 kHz, 96 kHz, 176.4 kHz,
and 192 kHz to be shown as 96 kHz, 176.4 kHz, 192 kHz, and 384 kHz,
respectively.

Fix the reporting by adding the ALSA rate 64 kHz into the conversion
array between 48 kHz and 88.2 kHz.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a370fc62 22-Nov-2011 Wu Fengguang <fengguang.wu@intel.com>

ALSA: hda - fail ELD reading early

With the ELD repoll mechanism, we can (and should) fail the ELD reading
immediately when find something obviously wrong and let the caller retry
after some delay.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2d1b439b 16-Nov-2011 Wu Fengguang <fengguang.wu@intel.com>

ALSA: hda - move eld->spk_alloc fixup to hdmi_update_eld()

It looks more natural and saves two lines of code.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b95d68b8 16-Nov-2011 Wu Fengguang <fengguang.wu@intel.com>

ALSA: hda - fix ELD memory leak

memset(eld) clears eld->proc_entry which will leak the struct
snd_info_entry when unloading module.

Fix it by
- memset only the fields before eld->eld_buffer
- set eld->eld_valid to true _after_ all eld fields have been filled

Cc: <stable@kernel.org>
Cc: Pierre-louis Bossart <pierre-louis.bossart@intel.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f71ff0d7 06-Oct-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Moved snd_print_pcm_rates() back into hda_proc.c

Since hda_proc.c is now the only user of snd_print_pcm_rates(), better to
put it back locally to hda_proc.c and revert to the old style.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# af65cbf2 05-Oct-2011 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: hdmi: fix printout of SAD sampling rates

SAD sampling rate information reported in
/proc/asound/cardX/eldX is incorrect due to a mismatch
between HDA and HDMI frequencies. Add new routine to provide
relevant values.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 14bc52b8 30-Sep-2011 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: hda/hdmi: expose ELD control

Applications may want to read ELD information to
understand what codecs are supported on the HDMI
receiver and handle the a-v delay for better lip-sync.

ELD information is exposed in a device-specific
IFACE_PCM kcontrol. Tested both with amixer and
PulseAudio; with a corresponding patch passthrough modes
are enabled automagically.

ELD control size is set to zero in case of errors or
wrong configurations. No notifications are implemented
for now, it is expected that jack detection is used to
reconfigure the audio outputs.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b6acf013 20-Aug-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Don't spew too many ELD errors

Currently HD-audio driver shows the all error ELD byte as an error
in the kernel message. This is annoying when the video driver doesn't
set the correct ELD from the beginning. e.g. radeon sends a zero-byte
data, but we still check ELD with the fixed 128 byte as a workaround
for some broken devices, it spews 128-times errors.

For avoiding this, the driver aborts reading when the first byte is
invalid. In such a case, the whole data is certainly invalid.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f5b2d0ef 29-Jun-2011 Wu Fengguang <fengguang.wu@intel.com>

ALSA: HDMI - fix ELD monitor name length

I noticed that the last character of the ELD monitor name is lost,
this fixes the issue.

This fix should be confirming to the HDA spec, and works together with
the DRM part of the ELD patch.

The HDA spec does not mention that Monitor_Name_String is an '\0'
ending string, and it allows NML to be 1, which is only valid when MNL
does not count the possible ending '\0'.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2def8172 01-Jun-2011 Stephen Warren <swarren@nvidia.com>

ALSA: hda: hdmi_eld_update_pcm_info: update a stream in place

A future change won't store an entire hda_pcm_stream just to represent
the capabilities of a codec; a custom data-structure will be used. To
ease that transition, modify hdmi_eld_update_pcm_info to expect the
hda_pcm_stream to be pre-initialized with the codec's capabilities, and
to update those capabilities in-place based on the ELD.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5d44f927 24-May-2011 Stephen Warren <swarren@nvidia.com>

ALSA: HDA: Unify HDMI hotplug handling.

This change unifies the initial handling of a pin's state with the code to
update a pin's state after a hotplug (unsolicited response) event. The
initial probing, and all updates, are now routed through hdmi_present_sense.

The stored PD and ELDV status is now always derived from GetPinSense verb
execution, and not from the data in the unsolicited response. This means:

a) The WAR for NVIDIA codec's UR.PD values ("old_pin_detect") can be
removed, since this only affected the no-longer-used unsolicited
response payload.

b) In turn, this means that most NVIDIA codecs can simply use
patch_generic_hdmi instead of having a custom variant just to set
old_pin_detect.

c) When PD && ELDV becomes true, no extra verbs are executed, because the
GetPinSense that was previously executed by snd_hdmi_get_eld (really,
hdmi_eld_valid) has simply moved into hdmi_present_sense.

d) When PD && ELDV becomes false, there is a single extra GetPinSense verb
executed for codecs where old_pin_detect wasn't set, i.e. some NVIDIA,
and all ATI/AMD and Intel codecs. I doubt this will be a performance
issue.

The new unified code in hdmi_present_sense also ensures that eld->eld_valid
is not set unless eld->monitor_present is also set. This protects against
potential invalid combinations of PD and ELDV received from HW, and
transitively from a graphics driver.

Also, print the derived PD/ELDV bits from hdmi_present_sense so the kernel
log always displays the actual state stored, which will differ from the
values in the unsolicited response for NVIDIA HW where old_pin_detect was
previously set.

Finally, a couple of small tweaks originally by Takashi:

* Clear the ELD content to zero before reading it, so that if it's not
read (i.e. when !(PD && ELDV)) it's in a known state.

* Don't show ELD fields in /proc ELD files when the ELD isn't valid.

The only possibility I can see for regression here is a codec where the
GetPinSense verb returns incorrect data. However, we're already exposed
to that, since that data is used (a) from hdmi_add_pin to set up the
initial pin state, and (b) within snd_hda_input_jack_report to query
a pin's presence value. As such, I don't believe any HW has bugs here.

Includes-changes-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d757534e 25-Jan-2011 David Henningsson <david.henningsson@canonical.com>

ALSA: HDA: Fix dmesg output of HDMI supported bits

This typo caused the dmesg output of the supported bits of HDMI
to be cut off early.

Cc: stable@kernel.org
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0bbaee3a 07-Dec-2010 Anssi Hannula <anssi.hannula@iki.fi>

ALSA: hda - Reset sample sizes and max bitrates when reading ELD

When a new HDMI/DP device is plugged in, hdmi_update_short_audio_desc()
is called for every SAD (Short Audio Descriptor) in the ELD data. For
LPCM coding type SAD defines the supported sample sizes. For several
other coding types (such as AC-3), a maximum bitrate is defined.

The maximum bitrate and sample size fields are not always cleared.
Therefore, if a device is unplugged and a different one is plugged in,
and the coding types of some SAD positions differ between the devices,
the old max_bitrate or sample_bits values will persist if the new SADs
do not define those values.

The leftover max_bitrate and sample_bits do not cause any issues other
than wrongly showing up in eld#X.Y procfs file and kernel log.

Fix that by always clearing sample_bits and max_bitrate when reading
SADs.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3dc86429 07-Dec-2010 Anssi Hannula <anssi.hannula@iki.fi>

ALSA: hda - Always allow basic audio irrespective of ELD info

Commit bbbe33900d1f3c added functionality to restrict PCM parameters
based on ELD info (derived from EDID data) of the audio sink.

However, according to CEA-861-D no SAD is needed for basic audio
(32/44.1/48kHz stereo 16-bit audio), which is instead indicated with a
basic audio flag in the CEA EDID Extension.

The flag is not present in ELD. However, as all audio capable sinks are
required to support basic audio, we can assume it to be always
available.

Fix allowed audio formats with sinks that have SADs (Short Audio
Descriptors) which do not completely overlap with the basic audio
formats (there are no reports of affected devices so far) by always
assuming that basic audio is supported.

Reported-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Cc: stable@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4b0dbdb1 07-Dec-2010 Anssi Hannula <anssi.hannula@iki.fi>

ALSA: hda - Do not wrongly restrict min_channels based on ELD

Commit bbbe33900d1f3c added functionality to restrict PCM parameters
based on ELD info (derived from EDID data) of the audio sink.

However, it wrongly assumes that the bits 0-2 of the first byte of
CEA Short Audio Descriptors mean a supported number of channels. In
reality, they mean the maximum number of channels (as per CEA-861-D
7.5.2). This means that the channel count can only be used to restrict
max_channels, not min_channels.

Restricting min_channels causes us to deny opening the device in stereo
mode if the sink only has SADs that declare larger numbers of channels
(like Primare SP32 AV Processor does).

Fix that by not restricting min_channels based on ELD information.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Reported-by: Jean-Yves Avenard <jyavenard@gmail.com>
Tested-by: Jean-Yves Avenard <jyavenard@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 84eb01be 06-Sep-2010 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Merge all HDMI modules into the unified module

This patch merges all three patch_*hdmi variants to the single HDMI
parser. There is only one snd-hda-codec-hdmi module now.

In this patch, the behavior of each parser isn't changed much.
The old ATI parser still doesn't use the dynamic parser yet.
In later patches, they'll be cleaned up.

Also, this patch gets rid of the individual snd-hda-eld module and
builds into snd-hda-codec-hdmi, since this is referred only from the
HDMI parser.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 274714f5 19-Aug-2010 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Fix build error with CONFIG_PROC_FS=n

hdmi_eld_update_pcm_info() must be always compiled in.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bbbe3390 13-Aug-2010 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Restrict PCM parameters per ELD information over HDMI

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>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


# dd74b465 04-Mar-2010 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Build hda_eld into snd-hda-codec module

Now two modules require hda_eld.o, so we need to put it to the common
place instead of building into two individual modules.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 864f92be 17-Nov-2009 Wu Fengguang <fengguang.wu@intel.com>

ALSA: hda - introduce snd_hda_jack_detect() and snd_hda_pin_sense()

This helps merge duplicate code.

v2: add snd_hda_jack_detect() and comments recommended by Takashi.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 23ccc2bd 17-Nov-2009 Wu Fengguang <fengguang.wu@intel.com>

ALSA: intelhdmi - export monitor-presence and ELD-valid status

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 54a25f87 30-Oct-2009 Wu Fengguang <fengguang.wu@intel.com>

ALSA: hda - vectorize intelhdmi

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>


# 78735cff 29-Jul-2009 Roel Kluin <roel.kluin@gmail.com>

ALSA: hda: fix out-of-bound hdmi_eld.sad[] write

e->sad[] is declared with size ELD_MAX_SAD=16, but the guard
allows range 0-31.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4805286b 21-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda - fix build warning when CONFIG_PROC_FS=n

Fix "defined but not used" build warning by moving eld_versoin_names[]
and cea_edid_version_names[] into hdmi_print_eld_info().

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9415e1c4 21-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda - fix DisplayPort naming

DisplayPort is a digital display interface standard put forth by
the Video Electronics Standards Association (VESA). It defines a
new license-free, royalty-free, digital audio/video interconnect,
intended to be used primarily between a computer and its display monitor,
or a computer and a home-theater system.

- From Wikipedia, the free encyclopedia

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# acb05993 21-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda - ELD proc interface write updates

- rename ELD proc write routine to hdmi_write_eld_info()
- support modifying WMAPro's profile

Write to some ELD fields (monitor_name, manufacture_id, product_id,
eld_version, edid_version) are deliberately not supported, since that
won't correct wrong behaviors and only leads to confusions.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 03284c8f 21-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda - make HDMI messages more user friendly

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


# f208dba9 21-Nov-2008 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Release ELD proc file

Release ELD proc file when reconfigured so that no leak occurs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# acdda791 20-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda - support writing to the ELD proc file

Allow users to fix quicks of ELD ROMs by writing new values to the ELD proc
interface. The format is one or more lines of "name hex_value".

Users can add/remove/modify up to 32 SAD(Short Audio Descriptor) entries.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# db742104 20-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda: modify monitor name to be consistent with other ELD proc items

Rename "monitor name" to "monitor_name" to conform with the keyword style.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 218b5ffc 20-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda - properly print ELD sample bits

Fix bugs on printing the ELD sample bits.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ae8cb4ca 19-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda: compact ELD output messages

Strip out some ELD printk messages that end user won't care,
and make the output compact.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d39b4352 19-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda: make global snd_print_pcm_bits()

Introduce a global function snd_print_pcm_bits() and use it in the ELD code.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 06f69d17 19-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda: minor output message cleanups

Some minor user visible message cleanups.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5b87ebb7 19-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda: rename sink_eld to hdmi_eld

Rename struct sink_eld to hdmi_eld.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4e19c58f 19-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda: minor code cleanups

Some minor code cleanups.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 903b21d8 18-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: hda: make global snd_print_channel_allocation()

code refactor: make a global function snd_print_channel_allocation().

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5f1e71b1 17-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: ELD proc interface for HDMI sinks

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>


# 7f4a9f43 17-Nov-2008 Wu Fengguang <wfg@linux.intel.com>

ALSA: create hda_eld.c for ELD routines and proc interface

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>