2019-05-27 08:55:05 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALSA: hda: Fix potential deadlock at codec unbinding
When a codec is unbound dynamically via sysfs while its stream is in
use, we may face a potential deadlock at the proc remove or a UAF.
This happens since the hda_pcm is managed by a linked list, as it
handles the hda_pcm object release via kref.
When a PCM is opened at the unbinding time, the release of hda_pcm
gets delayed and it ends up with the close of the PCM stream releasing
the associated hda_pcm object of its own. The hda_pcm destructor
contains the PCM device release that includes the removal of procfs
entries. And, this removal has the sync of the close of all in-use
files -- which would never finish because it's called from the PCM
file descriptor itself, i.e. it's trying to shoot its foot.
For addressing the deadlock above, this patch changes the way to
manage and release the hda_pcm object. The kref of hda_pcm is
dropped, and instead a simple refcount is introduced in hda_codec for
keeping the track of the active PCM streams, and at each PCM open and
close, this refcount is adjusted accordingly. At unbinding, the
driver calls snd_device_disconnect() for each PCM stream, then
synchronizes with the refcount finish, and finally releases the object
resources.
Fixes: bbbc7e8502c9 ("ALSA: hda - Allocate hda_pcm objects dynamically")
Link: https://lore.kernel.org/r/20211116072459.18930-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-11-16 08:24:59 +01:00
|
|
|
|
2015-10-01 16:20:04 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-27 18:58:06 +02:00
|
|
|
|
2015-02-17 21:46:37 +01:00
|
|
|
|
2013-12-09 14:28:36 +01:00
|
|
|
|
ALSA: hda - Add regmap support
This patch adds an infrastructure to support regmap-based verb
accesses. Because o the asymmetric nature of HD-audio verbs,
especially the amp verbs, we need to translate the verbs as a sort of
pseudo registers to be mapped uniquely in regmap.
In this patch, a pseudo register is built from the NID, the
AC_VERB_GET_* and 8bit parameters, i.e. almost in the form to be sent
to HD-audio bus but without codec address field. OTOH, for writing,
the same pseudo register is translated to AC_VERB_SET_* automatically.
The AC_VERB_SET_AMP_* verb is re-encoded from the corresponding
AC_VERB_GET_AMP_* verb and parameter at writing.
Some verbs has a single command for read but multiple for writes. A
write for such a verb is split automatically to multiple verbs.
The patch provides also a few handy helper functions. They are
designed to be accessible even without regmap. When no regmap is set
up (e.g. before the codec device instantiation), the direct hardware
access is used. Also, it tries to avoid the unnecessary power-up.
The power up/down sequence is performed only on demand.
The codec driver needs to call snd_hdac_regmap_exit() and
snd_hdac_regmap_exit() at probe and remove if it wants the regmap
access.
There is one flag added to hdac_device. When the flag lazy_cache is
set, regmap helper ignores a write for a suspended device and returns
as if it was actually written. It reduces the hardware access pretty
much, e.g. when adjusting the mixer volume while in idle. This
assumes that the driver will sync the cache later at resume properly,
so use it carefully.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-25 14:42:38 +01:00
|
|
|
|
2008-11-10 16:24:26 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-18 18:20:52 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-09 18:04:12 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-02 23:22:59 +01:00
|
|
|
|
|
|
|
|
|
2005-11-17 14:57:47 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-08-20 09:44:36 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-11-27 14:17:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-01-16 16:09:47 +01:00
|
|
|
|
2009-06-02 01:20:22 +02:00
|
|
|
|
|
|
|
|
|
2008-11-21 09:08:06 +01:00
|
|
|
|
2009-06-02 01:16:07 +02:00
|
|
|
|
|
|
|
|
|
2013-06-06 14:20:19 +02:00
|
|
|
|
2019-01-30 17:46:03 +01:00
|
|
|
|
2019-08-27 16:37:50 +02:00
|
|
|
|
2022-04-11 13:02:09 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALSA: hda - Fix broken workaround for HDMI/SPDIF conflicts
The commit [dcda58061: ALSA: hda - Add workaround for conflicting
IEC958 controls] introduced a workaround for cards that have both
SPDIF and HDMI devices for giving device=1 to SPDIF control elements.
It turned out, however, that this workaround doesn't work well -
- The workaround checks only conflicts in a single codec, but SPDIF
and HDMI are provided by multiple codecs in many cases, and
- ALSA mixer abstraction doesn't care about the device number in ctl
elements, thus you'll get errors from amixer such as
% amixer scontrols -c 0
ALSA lib simple_none.c:1551:(simple_add1) helem (MIXER,'IEC958
Playback Switch',0,1,0) appears twice or more
amixer: Mixer hw:0 load error: Invalid argument
This patch fixes the previous broken workaround. Instead of changing
the device number of SPDIF ctl elements, shift the element indices of
such controls up to 16. Also, the conflict check is performed over
all codecs found on the bus.
HDMI devices will be put to dev=0,index=0 as before. Only the
conflicting SPDIF device is moved to a different place. The new place
of SPDIF device is supposed by the updated alsa-lib HDA-Intel.conf,
respectively.
Reported-by: Stephan Raue <stephan@openelec.tv>
Reported-by: Anssi Hannula <anssi.hannula@iki.fi>
Cc: <stable@vger.kernel.org> [v3.8]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-12 17:02:41 +01:00
|
|
|
|
|
|
|
|
|
2015-10-17 18:25:38 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-04-14 16:55:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-09 18:04:27 +02:00
|
|
|
|
2018-06-27 09:54:46 +02:00
|
|
|
|
2015-02-17 15:25:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-09 18:04:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-17 15:25:37 +01:00
|
|
|
|
2015-02-17 21:46:37 +01:00
|
|
|
|
2015-10-01 16:20:04 +02:00
|
|
|
|
2025-07-09 18:04:12 +02:00
|
|
|
|
2008-11-27 15:47:11 +01:00
|
|
|
|
|
|
|
|
|
2025-07-09 18:04:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-17 15:25:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-11-27 15:47:11 +01:00
|
|
|
|
2025-07-09 18:04:27 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-07-09 18:04:12 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-26 10:33:10 +02:00
|
|
|
|
|
|
|
|
|
2012-07-02 15:20:37 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-08-10 17:21:45 +02:00
|
|
|
|
ALSA: hda - Support advanced power state controls
This patch enables the finer power state control of each widget
depending on the jack plug state and streaming state in addition to
the existing power_down_unused power optimization. The new feature is
enabled only when codec->power_mgmt flag is set.
Two new flags, pin_enabled and stream_enabled, are introduced in
nid_path struct for marking the two individual power states: the pin
plug/unplug and DAC/ADC stream, respectively. They can be set
statically in case they are static routes (e.g. some mixer paths),
too.
The power up and down events for each pin are triggered via the
standard hda_jack table. The call order is hard-coded, relying on the
current implementation of jack event chain (a la FILO/stack order).
One point to be dealt carefully is that DAC/ADC cannot be powered
on/off while streaming. They are pinned as long as the stream is
running. For controlling the power of DAC/ADC, a new patch_ops is
added. The generic parser provides the default callback for that.
As of this patch, only IDT/Sigmatel codec driver enables the flag.
The support on other codecs will follow.
An assumption we made in this code is that the widget state (e.g. amp,
pinctl, connections) remains after the widget power transition (not
about FG power transition). This is true for IDT codecs, at least.
But if the widget state is lost at widget power transition, we'd need
to implement additional code to sync the cached amp/verbs for the
specific NID.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-16 21:32:11 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-17 14:57:47 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2005-11-17 14:57:47 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2005-11-17 14:57:47 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2005-11-17 14:57:47 +01:00
|
|
|
|
2013-04-05 07:27:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-27 16:52:19 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-17 13:05:56 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-11-08 17:12:10 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[ALSA] hda-intel - Fix PCM device number assignment
In the current scheme, PCM device numbers are assigned incrementally
in the order of codecs. This causes problems when the codec number
is irregular, e.g. codec #0 for HDMI and codec #1 for analog. Then
the HDMI becomes the first PCM, which is picked up as the default
output device. Unfortuantely this doesn't work well with normal
setups.
This patch introduced the fixed device numbers for the PCM types,
namely, analog, SPDIF, HDMI and modem. The PCM devices are assigned
according to the corresponding PCM type. After this patch, HDMI will
be always assigned to PCM #3, SPDIF to PCM #1, and the first analog
to PCM #0, etc.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-02-06 14:03:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-03 21:18:49 +08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[ALSA] hda-intel - Fix PCM device number assignment
In the current scheme, PCM device numbers are assigned incrementally
in the order of codecs. This causes problems when the codec number
is irregular, e.g. codec #0 for HDMI and codec #1 for analog. Then
the HDMI becomes the first PCM, which is picked up as the default
output device. Unfortuantely this doesn't work well with normal
setups.
This patch introduced the fixed device numbers for the PCM types,
namely, analog, SPDIF, HDMI and modem. The PCM devices are assigned
according to the corresponding PCM type. After this patch, HDMI will
be always assigned to PCM #3, SPDIF to PCM #1, and the first analog
to PCM #0, etc.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-02-06 14:03:20 +01:00
|
|
|
|
2008-07-30 15:01:44 +02:00
|
|
|
|
|
|
|
|
|
2012-07-31 11:35:35 +02:00
|
|
|
|
2015-02-27 17:43:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALSA: hda: Fix potential deadlock at codec unbinding
When a codec is unbound dynamically via sysfs while its stream is in
use, we may face a potential deadlock at the proc remove or a UAF.
This happens since the hda_pcm is managed by a linked list, as it
handles the hda_pcm object release via kref.
When a PCM is opened at the unbinding time, the release of hda_pcm
gets delayed and it ends up with the close of the PCM stream releasing
the associated hda_pcm object of its own. The hda_pcm destructor
contains the PCM device release that includes the removal of procfs
entries. And, this removal has the sync of the close of all in-use
files -- which would never finish because it's called from the PCM
file descriptor itself, i.e. it's trying to shoot its foot.
For addressing the deadlock above, this patch changes the way to
manage and release the hda_pcm object. The kref of hda_pcm is
dropped, and instead a simple refcount is introduced in hda_codec for
keeping the track of the active PCM streams, and at each PCM open and
close, this refcount is adjusted accordingly. At unbinding, the
driver calls snd_device_disconnect() for each PCM stream, then
synchronizes with the refcount finish, and finally releases the object
resources.
Fixes: bbbc7e8502c9 ("ALSA: hda - Allocate hda_pcm objects dynamically")
Link: https://lore.kernel.org/r/20211116072459.18930-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-11-16 08:24:59 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-17 21:46:37 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-02-27 16:09:22 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-02-17 15:25:37 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-10-01 16:20:04 +02:00
|
|
|
|
2008-07-30 15:01:45 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2025-07-09 18:04:12 +02:00
|
|
|
|
2015-02-27 17:43:19 +01:00
|
|
|
|
2026-06-10 17:45:33 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-18 18:20:52 +02:00
|
|
|
|
|
|
|
|
|
2009-11-13 18:41:52 +01:00
|
|
|
|
2025-02-16 22:31:03 +01:00
|
|
|
|
2008-07-18 18:20:52 +02:00
|
|
|
|
2005-11-21 16:33:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-30 15:01:45 +02:00
|
|
|
|
2009-12-08 16:13:32 +01:00
|
|
|
|
2008-07-30 15:01:45 +02:00
|
|
|
|
2013-01-03 15:25:11 +01:00
|
|
|
|
2011-04-07 15:55:15 +02:00
|
|
|
|
2006-01-16 16:34:20 +01:00
|
|
|
|
2009-01-09 16:45:24 +08:00
|
|
|
|
ALSA: hda: Allow multple SPDIF controls per codec
Currently, the data that backs the kcontrols created by
snd_hda_create_spdif_out_ctls is stored directly in struct hda_codec. When
multiple sets of these controls are stored, they will all manipulate the
same data, causing confusion. Instead, store an array of this data, one
copy per converter, to isolate the controls.
This patch would cause a behavioural change in the case where
snd_hda_create_spdif_out_ctls was called multiple times for a single codec.
As best I can tell, this is never the case for any codec.
This will be relevant at least for some HDMI audio codecs, such as the
NVIDIA GeForce 520 and Intel Ibex Peak. A future change will modify the
driver's handling of those codecs to create multiple PCMs per codec. Note
that this issue isn't affected by whether one creates a PCM-per-converter
or PCM-per-pin; there are multiple of both within a single codec in both
of those codecs.
Note that those codecs don't currently create multiple PCMs for the codec
due to the default HW mux state of all pins being to point at the same
converter, hence there is only a single converter routed to any pin, and
hence only a single PCM.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-01 11:14:17 -06:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2020-07-17 17:45:17 +02:00
|
|
|
|
2009-02-20 14:11:16 +01:00
|
|
|
|
2009-02-23 09:42:57 +01:00
|
|
|
|
2010-08-06 13:48:11 +02:00
|
|
|
|
2007-07-27 18:58:06 +02:00
|
|
|
|
2013-01-10 18:21:56 +01:00
|
|
|
|
2014-02-25 11:54:06 +01:00
|
|
|
|
2008-07-30 15:01:46 +02:00
|
|
|
|
2008-07-30 15:01:46 +02:00
|
|
|
|
2009-02-23 09:42:57 +01:00
|
|
|
|
2008-07-30 15:01:46 +02:00
|
|
|
|
2007-08-10 17:21:45 +02:00
|
|
|
|
2014-02-25 10:38:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-11 10:04:40 +02:00
|
|
|
|
ALSA: hda: intel: Allow repeatedly probing on codec configuration errors
It seems that a few recent AMD systems show the codec configuration
errors at the early boot, while loading the driver at a later stage
works magically. Although the root cause of the error isn't clear,
it's certainly not bad to allow retrying the codec probe in such a
case if that helps.
This patch adds the capability for retrying the probe upon codec probe
errors on the certain AMD platforms. The probe_work is changed to a
delayed work, and at the secondary call, it'll jump to the codec
probing.
Note that, not only adding the re-probing, this includes the behavior
changes in the codec configuration function. Namely,
snd_hda_codec_configure() won't unregister the codec at errors any
longer. Instead, its caller, azx_codec_configure() unregisters the
codecs with the probe failures *if* any codec has been successfully
configured. If all codec probe failed, it doesn't unregister but let
it re-probed -- which is the most case we're seeing and this patch
tries to improve.
Even if the driver doesn't re-probe or give up, it will go to the
"free-all" error path, hence the leftover codecs shall be disabled /
deleted in anyway.
BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1190801
Link: https://lore.kernel.org/r/20211006141940.2897-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-06 16:19:40 +02:00
|
|
|
|
2015-02-27 18:17:28 +01:00
|
|
|
|
2018-12-08 17:31:49 +01:00
|
|
|
|
2008-08-11 10:04:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-03-12 17:06:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-04-06 15:34:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-10-25 10:37:11 +02:00
|
|
|
|
2010-07-05 16:50:13 +02:00
|
|
|
|
2009-12-25 22:49:01 +01:00
|
|
|
|
2012-02-13 11:55:02 +01:00
|
|
|
|
2012-12-21 15:23:01 +01:00
|
|
|
|
2012-12-21 15:31:41 +01:00
|
|
|
|
2012-08-08 17:12:52 +02:00
|
|
|
|
2012-12-13 18:30:04 +01:00
|
|
|
|
2013-08-26 21:35:21 -04:00
|
|
|
|
2014-01-29 10:37:10 +01:00
|
|
|
|
2015-03-20 18:21:03 +01:00
|
|
|
|
2015-06-09 16:50:38 +08:00
|
|
|
|
2017-04-10 17:12:33 +02:00
|
|
|
|
2018-06-21 13:33:53 +02:00
|
|
|
|
2019-07-16 08:56:51 +02:00
|
|
|
|
2020-10-12 13:27:04 +03:00
|
|
|
|
2022-12-09 12:18:22 +02:00
|
|
|
|
2023-02-02 10:20:13 +01:00
|
|
|
|
2026-05-27 22:08:41 +08:00
|
|
|
|
2019-07-16 08:56:51 +02:00
|
|
|
|
2009-11-11 09:34:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-11-28 12:55:36 +01:00
|
|
|
|
2013-01-24 17:23:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-11-28 12:55:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-03-03 14:40:14 +01:00
|
|
|
|
2011-10-27 22:12:46 +02:00
|
|
|
|
|
|
|
|
|
2012-10-09 15:04:21 +02:00
|
|
|
|
|
|
|
|
|
2011-10-27 22:12:46 +02:00
|
|
|
|
2013-11-29 01:48:45 -05:00
|
|
|
|
|
|
|
|
|
2012-12-18 18:12:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2015-02-17 21:46:37 +01:00
|
|
|
|
|
|
|
|
|
2015-02-17 15:25:37 +01:00
|
|
|
|
2020-05-05 11:03:53 +08:00
|
|
|
|
|
|
|
|
|
2015-03-02 23:22:59 +01:00
|
|
|
|
|
|
|
|
|
2017-06-28 12:02:02 +02:00
|
|
|
|
|
|
|
|
|
2015-03-02 23:22:59 +01:00
|
|
|
|
2013-06-06 14:20:19 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-14 11:14:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-27 16:09:22 +01:00
|
|
|
|
|
|
|
|
|
2018-06-01 22:53:56 -05:00
|
|
|
|
2022-02-14 11:14:03 +01:00
|
|
|
|
|
|
|
|
|
2009-06-17 09:33:52 +02:00
|
|
|
|
2013-02-08 17:09:31 -05:00
|
|
|
|
2022-02-14 11:14:03 +01:00
|
|
|
|
|
|
|
|
|
2022-02-14 11:14:04 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-08 09:48:06 +01:00
|
|
|
|
|
|
|
|
|
2013-06-06 14:00:23 +02:00
|
|
|
|
2015-10-08 09:48:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-04-09 11:38:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-27 16:52:19 +02:00
|
|
|
|
2015-02-26 13:57:47 +01:00
|
|
|
|
2015-03-03 10:07:24 +01:00
|
|
|
|
|
|
|
|
|
2007-07-27 16:52:19 +02:00
|
|
|
|
|
|
|
|
|
2012-05-19 17:21:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-03 10:07:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-27 11:23:12 -08:00
|
|
|
|
2015-03-03 10:07:24 +01:00
|
|
|
|
2013-01-03 15:25:11 +01:00
|
|
|
|
|
|
|
|
|
2011-07-04 16:23:26 +02:00
|
|
|
|
|
|
|
|
|
2011-06-28 12:45:47 +02:00
|
|
|
|
|
|
|
|
|
2017-01-12 16:04:52 +08:00
|
|
|
|
2025-08-13 22:55:02 +02:00
|
|
|
|
|
|
|
|
|
2017-01-12 16:04:52 +08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-27 16:52:19 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-08-10 17:03:40 +02:00
|
|
|
|
ALSA: hda - Use regmap for command verb caches, too
Like the previous patches, this patch converts also to the regmap, at
this time, the cached verb writes are the target. But this conversion
needs a bit more caution than before.
- In the old code, we just record any verbs as is, and restore them at
resume. For the regmap scheme, this doesn't work, since a few verbs
like AMP or DIGI_CONVERT are asymmetrical. Such verbs are converted
either to the dedicated function (snd_hda_regmap_xxx_amp()) or
changed to the unified verb.
- Some verbs have to be declared as vendor-specific ones before
accessing via regmap.
Also, the minor optimization with codec->cached_write flag is dropped
in a few places, as this would confuse the operation. Further
optimizations will be brought in the later patches, if any.
This conversion ends up with a drop of significant amount of codes,
mostly the helper codes that are no longer used.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-26 12:34:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-02-20 14:11:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-10 08:38:04 +01:00
|
|
|
|
|
|
|
|
|
2010-07-05 16:50:13 +02:00
|
|
|
|
2009-02-20 14:11:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-27 11:18:59 +01:00
|
|
|
|
2009-02-20 14:11:16 +01:00
|
|
|
|
ALSA: hda: Allow multple SPDIF controls per codec
Currently, the data that backs the kcontrols created by
snd_hda_create_spdif_out_ctls is stored directly in struct hda_codec. When
multiple sets of these controls are stored, they will all manipulate the
same data, causing confusion. Instead, store an array of this data, one
copy per converter, to isolate the controls.
This patch would cause a behavioural change in the case where
snd_hda_create_spdif_out_ctls was called multiple times for a single codec.
As best I can tell, this is never the case for any codec.
This will be relevant at least for some HDMI audio codecs, such as the
NVIDIA GeForce 520 and Intel Ibex Peak. A future change will modify the
driver's handling of those codecs to create multiple PCMs per codec. Note
that this issue isn't affected by whether one creates a PCM-per-converter
or PCM-per-pin; there are multiple of both within a single codec in both
of those codecs.
Note that those codecs don't currently create multiple PCMs for the codec
due to the default HW mux state of all pins being to point at the same
converter, hence there is only a single converter routed to any pin, and
hence only a single PCM.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-01 11:14:17 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-01 11:14:18 -06:00
|
|
|
|
|
|
|
|
|
ALSA: hda: Allow multple SPDIF controls per codec
Currently, the data that backs the kcontrols created by
snd_hda_create_spdif_out_ctls is stored directly in struct hda_codec. When
multiple sets of these controls are stored, they will all manipulate the
same data, causing confusion. Instead, store an array of this data, one
copy per converter, to isolate the controls.
This patch would cause a behavioural change in the case where
snd_hda_create_spdif_out_ctls was called multiple times for a single codec.
As best I can tell, this is never the case for any codec.
This will be relevant at least for some HDMI audio codecs, such as the
NVIDIA GeForce 520 and Intel Ibex Peak. A future change will modify the
driver's handling of those codecs to create multiple PCMs per codec. Note
that this issue isn't affected by whether one creates a PCM-per-converter
or PCM-per-pin; there are multiple of both within a single codec in both
of those codecs.
Note that those codecs don't currently create multiple PCMs for the codec
due to the default HW mux state of all pins being to point at the same
converter, hence there is only a single converter routed to any pin, and
hence only a single PCM.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-01 11:14:17 -06:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-30 15:01:45 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-24 11:50:11 +01:00
|
|
|
|
2008-11-27 14:17:01 +01:00
|
|
|
|
2010-08-06 13:48:11 +02:00
|
|
|
|
2015-02-27 17:43:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-15 20:45:50 +03:00
|
|
|
|
|
|
|
|
|
2015-02-27 17:43:19 +01:00
|
|
|
|
|
|
|
|
|
2026-06-10 17:45:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-27 17:43:19 +01:00
|
|
|
|
|
|
|
|
|
2010-08-06 13:48:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-07-27 16:52:19 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-08-13 11:56:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-16 08:19:06 +02:00
|
|
|
|
2023-11-17 13:05:56 +01:00
|
|
|
|
|
|
|
|
|
2015-04-16 08:19:06 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-11-08 17:12:10 +01:00
|
|
|
|
|
|
|
|
|
2015-04-16 23:25:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-26 10:33:10 +02:00
|
|
|
|
2013-01-24 17:23:35 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-04-26 12:11:44 +02:00
|
|
|
|
|
|
|
|
|
2015-02-18 15:39:59 +01:00
|
|
|
|
2015-04-16 23:25:02 +02:00
|
|
|
|
2012-04-26 12:11:44 +02:00
|
|
|
|
2026-04-09 11:38:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-01 17:59:43 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-18 15:39:59 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-09-21 09:57:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-09 18:04:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-21 09:57:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-08-10 17:21:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-03 10:07:24 +01:00
|
|
|
|
ALSA: hda - Work around races of power up/down with runtime PM
Currently, snd_hdac_power_up()/down() helpers checks whether the codec
is being in pm (suspend/resume), and skips the call of runtime get/put
during it. This is needed as there are lots of power up/down
sequences called in the paths that are also used in the PM itself. An
example is found in hda_codec.c::codec_exec_verb(), where this can
power up the codec while it may be called again in its power up
sequence, too.
The above works in most cases, but sometimes we really want to wait
for the real power up. For example, the control element get/put may
want explicit power up so that the value change is assured to reach to
the hardware. Using the current snd_hdac_power_up(), however,
results in a race, e.g. when it's called during the runtime suspend is
being performed. In the worst case, as found in patch_ca0132.c, it
can even lead to the deadlock because the code assumes the power up
while it was skipped due to the check above.
For dealing with such cases, this patch makes snd_hdac_power_up() and
_down() to two variants: with and without in_pm flag check. The
version with pm flag check is named as snd_hdac_power_up_pm() while
the version without pm flag check is still kept as
snd_hdac_power_up(). (Just because the usage of the former is fewer.)
Then finally, the patch replaces each call potentially done in PM with
the new _pm() variant.
In theory, we can implement a unified version -- if we can distinguish
the current context whether it's in the pm path. But such an
implementation is cumbersome, so leave the code like this a bit messy
way for now...
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96271
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-08 11:43:14 +02:00
|
|
|
|
2015-03-03 10:07:24 +01:00
|
|
|
|
ALSA: hda - Work around races of power up/down with runtime PM
Currently, snd_hdac_power_up()/down() helpers checks whether the codec
is being in pm (suspend/resume), and skips the call of runtime get/put
during it. This is needed as there are lots of power up/down
sequences called in the paths that are also used in the PM itself. An
example is found in hda_codec.c::codec_exec_verb(), where this can
power up the codec while it may be called again in its power up
sequence, too.
The above works in most cases, but sometimes we really want to wait
for the real power up. For example, the control element get/put may
want explicit power up so that the value change is assured to reach to
the hardware. Using the current snd_hdac_power_up(), however,
results in a race, e.g. when it's called during the runtime suspend is
being performed. In the worst case, as found in patch_ca0132.c, it
can even lead to the deadlock because the code assumes the power up
while it was skipped due to the check above.
For dealing with such cases, this patch makes snd_hdac_power_up() and
_down() to two variants: with and without in_pm flag check. The
version with pm flag check is named as snd_hdac_power_up_pm() while
the version without pm flag check is still kept as
snd_hdac_power_up(). (Just because the usage of the former is fewer.)
Then finally, the patch replaces each call potentially done in PM with
the new _pm() variant.
In theory, we can implement a unified version -- if we can distinguish
the current context whether it's in the pm path. But such an
implementation is cumbersome, so leave the code like this a bit messy
way for now...
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96271
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-08 11:43:14 +02:00
|
|
|
|
2022-02-14 11:14:04 +01:00
|
|
|
|
2015-02-20 09:26:04 +01:00
|
|
|
|
2009-11-11 09:34:25 +01:00
|
|
|
|
2007-08-10 17:21:45 +02:00
|
|
|
|
ALSA: hda: Skip controller resume if not needed
The HD-audio controller does system-suspend and resume operations by
directly calling its helpers __azx_runtime_suspend() and
__azx_runtime_resume(). However, in general, we don't have to resume
always the device fully at the system resume; typically, if a device
has been runtime-suspended, we can leave it to runtime resume.
Usually for achieving this, the driver would call
pm_runtime_force_suspend() and pm_runtime_force_resume() pairs in the
system suspend and resume ops. Unfortunately, this doesn't work for
the resume path in our case. For handling the jack detection at the
system resume, a child codec device may need the (literally) forcibly
resume even if it's been runtime-suspended, and for that, the
controller device must be also resumed even if it's been suspended.
This patch is an attempt to improve the situation. It replaces the
direct __azx_runtime_suspend()/_resume() calls with with
pm_runtime_force_suspend() and pm_runtime_force_resume() with a slight
trick as we've done for the codec side. More exactly:
- azx_has_pm_runtime() check is dropped from azx_runtime_suspend() and
azx_runtime_resume(), so that it can be properly executed from the
system-suspend/resume path
- The WAKEEN handling depends on the card's power state now; it's set
and cleared only for the runtime-suspend
- azx_resume() checks whether any codec may need the forcible resume
beforehand. If the forcible resume is required, it does temporary
PM refcount up/down for actually triggering the runtime resume.
- A new helper function, hda_codec_need_resume(), is introduced for
checking whether the codec needs a forcible runtime-resume, and the
existing code is rewritten with that.
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207043
Link: https://lore.kernel.org/r/20200413082034.25166-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-04-13 10:20:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-27 09:28:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-17 09:52:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-09 12:33:28 +02:00
|
|
|
|
2009-06-17 09:52:54 +02:00
|
|
|
|
|
|
|
|
|
2012-09-20 20:29:13 -07:00
|
|
|
|
2015-04-16 23:25:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-20 20:29:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-20 20:29:19 -07:00
|
|
|
|
2012-09-20 20:29:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|