Takashi Iwai [Tue, 17 Aug 2021 07:46:27 +0000 (09:46 +0200)]
Merge branch 'for-linus' into for-next
Takashi Iwai [Tue, 17 Aug 2021 05:24:32 +0000 (07:24 +0200)]
ALSA: hda/via: Apply runtime PM workaround for ASUS B23E
ASUS B23E requires the same workaround like other machines with
VT1802, otherwise it looses the codec power on a few nodes and the
sound kept silence.
Fixes:
a0645daf1610 ("ALSA: HDA: Early Forbid of runtime PM")
Link: https://lore.kernel.org/r/ac2232f142efcd67fe6ac38897f704f7176bd200.camel@gmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210817052432.14751-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Imre Deak [Mon, 16 Aug 2021 17:42:59 +0000 (20:42 +0300)]
ALSA: hda: Fix hang during shutdown due to link reset
During system shutdown codecs may be still active, and resetting the
controller->codec HW link in this state - based on the bug reporter's
tests - leads to the shutdown sequence to get stuck. This happens at
least on the reporter's KBL system with an ALC662 codec.
For now fix the issue by skipping the link reset step.
Fixes:
472e18f63c42 ("ALSA: hda: Release controller display power during shutdown/reboot")
References: https://bugzilla.kernel.org/show_bug.cgi?id=214045
References: https://gitlab.freedesktop.org/drm/intel/-/issues/3618#note_1024665
Reported-and-tested-by: youling257@gmail.com
Cc: youling257@gmail.com
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://lore.kernel.org/r/20210816174259.2759103-1-imre.deak@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Kristin Paget [Sat, 14 Aug 2021 22:46:05 +0000 (15:46 -0700)]
ALSA: hda/realtek: Enable 4-speaker output for Dell XPS 15 9510 laptop
The 2021-model XPS 15 appears to use the same 4-speakers-on-ALC289 audio
setup as the Precision models, so requires the same quirk to enable woofer
output. Tested on my own 9510.
Signed-off-by: Kristin Paget <kristin@tombom.co.uk>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/e1fc95c5-c10a-1f98-a5c2-dd6e336157e1@tombom.co.uk
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 13 Aug 2021 08:12:30 +0000 (10:12 +0200)]
ALSA: hda: Nuke unused reboot_notify callback
As reboot_notify callback is no longer used by the codec core, let's
get rid of the unused code. Conexant codec needs a slight code change
as it used to call the reboot_notify at the codec removal, too.
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214045
Link: https://lore.kernel.org/r/20210813081230.4268-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 13 Aug 2021 08:12:29 +0000 (10:12 +0200)]
ALSA: hda: Suspend codec at shutdown
So far we have a few workarounds at shutdown for each codec,
e.g. turning off the display power and setting the codec to D3.
But all those are basically a part of the suspend procedure.
Moreover, the streams are still active after that call, hence it might
hit the update on the codec that has been already put to D3.
In this patch, instead of calling each reboot_notify callback, simply
put the codec into the runtime-suspended state after the manual
suspend of all PCM streams. It makes the code and the behavior more
consistent.
The reboot_notify callback is no longer used after this patch, and
will be cleaned up later.
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214045
Link: https://lore.kernel.org/r/20210813081230.4268-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 13 Aug 2021 08:12:28 +0000 (10:12 +0200)]
ALSA: hda: conexant: Turn off EAPD at suspend, too
Conexant codecs have a workaround for the noise at shutdown to turn
off EAPD, but it wasn't applied at suspend. In the later patch, we'll
switch from reboot_notify callback to the general suspend-at-shutdown,
so let's apply the workaround to the suspend case, too.
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214045
Link: https://lore.kernel.org/r/20210813081230.4268-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 13 Aug 2021 08:21:42 +0000 (10:21 +0200)]
ALSA: pcm: Add SNDRV_PCM_INFO_EXPLICIT_SYNC flag
ALSA PCM core has an optimized way to communicate with user-space for
its control and status data via mmap on the supported architectures
like x86. Depending on the situation, however, we'd rather want to
enforce user-space notifying the applptr or hwptr change explicitly
via ioctl. For example, the upcoming non-contig and non-coherent
buffer handling would need an explicit sync, and this needs to catch
the applptr and hwptr changes. Also, ASoC SOF driver will have the
SPIB support that has the similar requirement for the explicit control
of the applptr and hwptr.
This patch adds the new PCM hardware info flag,
SNDRV_PCM_INFO_EXPLICIT_SYNC. When this flag is set, PCM core
disables both the control and the status mmap, which enforces
user-space to update via SYNC_PTR ioctl. In that way, drivers can
catch the applptr and hwptr update and apply the sync operation if
needed.
Link: https://lore.kernel.org/r/20210812113818.6479-1-tiwai@suse.de
Link: https://lore.kernel.org/r/20210610205326.1176400-1-pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20210813082142.5375-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Damien Zammit [Fri, 13 Aug 2021 11:34:02 +0000 (21:34 +1000)]
ALSA: usb-audio: Input source control - digidesign mbox
This adds a second mixer control to Digidesign Mbox
to select between Analog/SPDIF capture.
Users will note that selecting the SPDIF input source
automatically switches the clock mode to sync to SPDIF,
which is a feature of the hardware.
(You can change the clock source back to internal if you want
to capture from spdif but not sync to its clock although this mode
is probably not recommended).
Unfortunately, starting the stream resets both modes
to Internally clocked and Analog input mode.
Signed-off-by: Damien Zammit <damien@zamaudio.com>
Tested-by: Damien Zammit <damien@zamaudio.com>
Link: https://lore.kernel.org/r/20210813113402.11849-1-damien@zamaudio.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 13 Aug 2021 08:16:45 +0000 (10:16 +0200)]
ALSA: memalloc: Count continuous pages in vmalloc buffer handler
This is an enhancement for the SG-style page handling in vmalloc
buffer handler to calculate the continuous pages.
When snd_sgbuf_get_chunk_size() is called for a vmalloc buffer,
currently we return only the size that fits into a single page.
However, this API call is rather supposed for obtaining the continuous
pages and most of vmalloc or noncontig buffers do have lots of
continuous pages indeed. So, in this patch, the callback now
calculates the possibly continuous pages up to the given size limit.
Note that the end address in the function is calculated from the last
byte, hence it's one byte shorter. This is because ofs + size can be
above the actual buffer size boundary.
Until now, this feature isn't really used, but it'll become useful in
a later patch that adds the non-contiguous buffer type that shares the
same callback function as vmalloc.
Link: https://lore.kernel.org/r/20210812113818.6479-1-tiwai@suse.de
Link: https://lore.kernel.org/r/20210813081645.4680-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Thu, 12 Aug 2021 18:34:32 +0000 (19:34 +0100)]
ALSA: hda/cs8409: Prevent pops and clicks during suspend
Some of the register values set for type detection cause pops during suspend,
ensure these are cleaned up after type detection completes, as well
ensuring that these are cleared when we suspend.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210812183433.6330-1-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Pierre-Louis Bossart [Thu, 12 Aug 2021 22:59:04 +0000 (17:59 -0500)]
ALSA: hda_audio_ext: fix kernel-doc
Add missing @
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20210812225904.171529-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Pierre-Louis Bossart [Thu, 12 Aug 2021 22:59:03 +0000 (17:59 -0500)]
ALSA: core: control_led: use strscpy instead of strlcpy
strlcpy is deprecated, use its safe replacement
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210812225904.171529-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:54 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Unmute/Mute codec when stream starts/stops
Codec is muted on init, and then unmuted when the stream starts.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-28-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:53 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Follow correct CS42L42 power down sequence for suspend
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-27-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:52 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Remove unnecessary delays
Since delays when starting jack detection after initialization
have been reduced/removed, it is necessary to add back in an extra
20ms delay after the init sequence to allow the CS42L42 to power up
correctly.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-26-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:51 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Use timeout rather than retries for I2C transaction waits
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-25-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:50 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Set fixed sample rate of 48kHz for CS42L42
CS42L42 is configured to use a fixed sample rate of 48kHz.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-24-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:49 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Enable Full Scale Volume for Line Out Codec on Dolphin
Headphones codec will keep reduced maximum volume.
Line Out codec will have increased maximum volume.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-23-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:48 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Add support for dolphin
Dolphin devices have CS8409 HDA Bridge connected to two CS42L42 codecs.
Codec 1 supports Headphone and Headset Mic.
Codec 2 supports Line Out.
Features:
- Front and Read Jacks appear as separate jacks; Removal or connection
of on jack should not affect the connection of the other.
- Front Jack only shows up on jack detection.
- Rear Jack is Phantom Jack.
- Separate Volume Controls for each Jack
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-22-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:47 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Add Support to disable jack type detection for CS42L42
Some hardware configurations do not support jack type detection.
Instead, for those configurations, only tip detection is supported.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-21-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:46 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Support multiple sub_codecs for Suspend/Resume/Unsol events
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-20-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:45 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Move codec properties to its own struct
To accommodate move, cs42l42_resume has been added to mirror
the existing function cs42l42_suspend.
Function cs42l42_reset is no longer required, since cs42l42_resume
and cs42l42_suspend perform the same operations.
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-19-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:44 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Separate CS8409, CS42L42 and project functions
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-18-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:43 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Support i2c bulk read/write functions
This allows mutex locks to be moved into i2c functions, as
the bulk read/write functions can lock/unlock themselves to
prevent interruption of sequence reads/writes.
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-17-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:42 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Avoid re-setting the same page as the last access
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-16-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:41 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Avoid setting the same I2C address for every access
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-15-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:40 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Dont disable I2C clock between consecutive accesses
Only disable I2C clock 25 ms after not being used.
The current implementation enables and disables the I2C clock for each
I2C transaction. Each enable/disable call requires two verb transactions.
This means each I2C transaction requires a total of four verb transactions
to enable and disable the clock.
However, if there are multiple consecutive I2C transactions, it is not
necessary to enable and disable the clock each time, instead it is more
efficient to enable the clock for the first transaction, and disable it
after the final transaction, which would improve performance.
This is achieved by using a timeout which disables the clock if no request
to enable the clock has occurred for 25 ms.
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-14-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:39 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Generalize volume controls
Use amp offsets as indexes for saved volumes.
Remove dependencies on NID inside volume control functions.
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-13-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:38 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Prevent I2C access during suspend time
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-12-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:37 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Simplify CS42L42 jack detect.
Cleanup interrupt masks.
Remove unnecessary read/writes.
Ensure Tip Sense/Type Detection interrupts are enabled/disabled
when needed.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-11-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:36 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Mask CS42L42 wake events
Wake events are not needed for jack detect.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-10-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:35 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Disable unsolicited response for the first boot
The subsequence suspend and remuse have their enable/disable
unsolicited responses at the correct place already
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-9-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:34 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Disable unsolicited responses during suspend
Ensure unsolicited responses cannot occur whilst the sub codecs are
being disabled.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-8-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:33 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Disable unnecessary Ring Sense for Cyborg/Warlock/Bullseye
Also remove unnecessary repeated register writes.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-7-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:32 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Reduce HS pops/clicks for Cyborg
Enable HSBIAS_SENSE_EN for Cyborg during jack detect to reduce
pops and clicks.
Do not enable this for Warlock/Bullseye, as it causes ESD issues.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-6-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:31 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Mask all CS42L42 interrupts on initialization
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-5-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Wed, 11 Aug 2021 18:56:30 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Use enums for register names and coefficients
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-4-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:29 +0000 (19:56 +0100)]
ALSA: hda/cs8409: Move arrays of configuration to a new file
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-3-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lucas Tanure [Wed, 11 Aug 2021 18:56:28 +0000 (19:56 +0100)]
ALSA: hda/cirrus: Move CS8409 HDA bridge to separate module
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210811185654.6837-2-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Thu, 12 Aug 2021 02:28:39 +0000 (11:28 +0900)]
ALSA: oxfw: fix functioal regression for silence in Apogee Duet FireWire
OXFW 971 has no function to use the value in syt field of received
isochronous packet for playback timing generation. In kernel prepatch for
v5.14, ALSA OXFW driver got change to send NO_INFO value in the field
instead of actual timing value. The change brings Apogee Duet FireWire to
generate no playback sound, while output meter moves.
As long as I investigate, _any_ value in the syt field takes the device to
generate sound. It's reasonable to think that the device just ignores data
blocks in packet with NO_INFO value in its syt field for audio data
processing.
This commit adds a new flag for the quirk to fix regression.
Fixes:
029ffc429440 ("ALSA: oxfw: perform sequence replay for media clock recovery")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210812022839.42043-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Wed, 11 Aug 2021 16:14:41 +0000 (18:14 +0200)]
ALSA: hda - fix the 'Capture Switch' value change notifications
The original code in the cap_put_caller() function does not
handle correctly the positive values returned from the passed
function for multiple iterations. It means that the change
notifications may be lost.
Fixes:
352f7f914ebb ("ALSA: hda - Merge Realtek parser code to generic parser")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213851
Cc: <stable@kernel.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210811161441.1325250-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jeremy Szu [Tue, 10 Aug 2021 10:08:45 +0000 (18:08 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 650 G8 Notebook PC
The HP ProBook 650 G8 Notebook PC is using ALC236 codec which is
using 0x02 to control mute LED and 0x01 to control micmute LED.
Therefore, add a quirk to make it works.
Signed-off-by: Jeremy Szu <jeremy.szu@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210810100846.65844-1-jeremy.szu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 9 Aug 2021 14:05:32 +0000 (16:05 +0200)]
ALSA: msnd: Use proper mmap method
The old ISA MSND driver basically maps the iomem as the DMA buffer.
For this type of buffer, we have already the standard mmap helper,
snd_pcm_lib_mmap_iomem(). Correct the PCM info, set the DMA address
and use the standard helper for handling the mmap on all architectures
properly.
Link: https://lore.kernel.org/r/20210809140532.11006-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 9 Aug 2021 07:18:29 +0000 (09:18 +0200)]
ALSA: pci: cs46xx: Fix set up buffer type properly
CS46xx driver switches the buffer depending on the number of periods,
and in some cases it switches to the own buffer without updating the
buffer type properly. This may cause a problem with the mmap on
exotic architectures that require the own mmap call for the coherent
DMA buffer.
This patch addresses the potential breakage by replacing the buffer
setup with the proper macro. It also simplifies the source code,
too.
Link: https://lore.kernel.org/r/20210809071829.22238-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 9 Aug 2021 07:18:28 +0000 (09:18 +0200)]
ALSA: pci: rme: Set up buffer type properly
Although the regression of the mmap was fixed in the recent commit
dc0dc8a73e8e ("ALSA: pcm: Fix mmap breakage without explicit buffer
setup"), RME9652 and HDSP drivers have still potential issues with
their mmap handling. Namely, they use the default mmap handler
without the standard buffer preallocation, and PCM core wouldn't use
the coherent DMA mapping. It's practically OK on x86, but on some
exotic architectures, it wouldn't work.
This patch addresses the potential breakage by replacing the buffer
setup with the proper macro. It also simplifies the source code,
too.
Link: https://lore.kernel.org/r/20210809071829.22238-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 9 Aug 2021 07:18:27 +0000 (09:18 +0200)]
ALSA: pcm: Check mmap capability of runtime dma buffer at first
Currently we check only the substream->dma_buffer as the preset of the
buffer configuration for verifying the availability of mmap. But a
few drivers rather set up the buffer in the own way without the
standard buffer preallocation using substream->dma_buffer, and they
miss the proper checks. (Now it's working more or less fine as most
of them are running only on x86).
Actually, they may set up the runtime dma_buffer (referred via
snd_pcm_get_dma_buf()) at the open callback, though. That is, this
could have been used as the primary source.
This patch changes the hw_support_mmap() function to check the runtime
dma buffer at first. It's usually NULL with the standard buffer
preallocation, and in that case, we continue checking
substream->dma_buffer as fallback.
Link: https://lore.kernel.org/r/20210809071829.22238-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 9 Aug 2021 07:12:50 +0000 (09:12 +0200)]
ALSA: harmony: Drop superfluous address setup
Harmony driver never uses CONTINUOUS buffer type any longer, hence the
code setting the address is superfluous. Moreover, the recent change
in the ALSA core already covered the missing address field; it's
already set up. So let's drop the superfluous line, which includes
the full hw_params callback.
Link: https://lore.kernel.org/r/20210809071250.21846-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 9 Aug 2021 05:53:22 +0000 (07:53 +0200)]
Merge branch 'for-linus' into for-next
Takashi Iwai [Sun, 8 Aug 2021 07:01:16 +0000 (09:01 +0200)]
ALSA: pcm: Fix mmap breakage without explicit buffer setup
The recent fix
c4824ae7db41 ("ALSA: pcm: Fix mmap capability check")
restricts the mmap capability only to the drivers that properly set up
the buffers, but it caused a regression for a few drivers that manage
the buffer on its own way.
For those with UNKNOWN buffer type (i.e. the uninitialized / unused
substream->dma_buffer), just assume that the driver handles the mmap
properly and blindly trust the hardware info bit.
Fixes:
c4824ae7db41 ("ALSA: pcm: Fix mmap capability check")
Reported-and-tested-by: Jeff Woods <jwoods@fnordco.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/s5him0gpghv.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Sun, 8 Aug 2021 08:00:34 +0000 (10:00 +0200)]
ALSA: memalloc: Fix mmap of SG-buffer with WC pages
The code refactoring to move the WC page handling into the common
memalloc layer caused a breakage for HD-audio HDMI. I overlooked that
the driver is using the SG-buffer, which isn't covered by the patch.
This patch adds the mmap workaround for WC pages to SG-buffer
handler. A caveat is that it falls back to the default handler by
returning an error after setting the pgprot, so it won't work in all
cases but merely for PCM (which is currently the only use case).
Fixes:
623c10108338 ("ALSA: memalloc: Fix pgprot for WC mmap on x86")
Reported-and-tested-by: Andy Lavr <andy.lavr@gmail.com>
Link: https://lore.kernel.org/r/20210808080034.20337-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Luke D Jones [Sat, 7 Aug 2021 02:58:05 +0000 (14:58 +1200)]
ALSA: hda: Add quirk for ASUS Flow x13
The ASUS GV301QH sound appears to work well with the quirk for
ALC294_FIXUP_ASUS_DUAL_SPK.
Signed-off-by: Luke D Jones <luke@ljones.dev>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210807025805.27321-1-luke@ljones.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 6 Aug 2021 15:00:51 +0000 (17:00 +0200)]
Merge tag 'asoc-fix-v5.14-rc4' of https://git./linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.14
Quite a lot of fixes here, the biggest set being for the cs42l42 driver
which is reasonably old but has seen a sudden uptick in activity.
There's also some fixes for correctly referencing PCM buffer addresses
and the removal of some driver-local bodges that had been done for the
lack of prefix handling in DAPM which were broken by the core handling
that as expected.
Richard Fitzgerald [Thu, 5 Aug 2021 16:11:07 +0000 (17:11 +0100)]
ASoC: cs42l42: Fix mono playback
I2S always has two LRCLK phases and both CH1 and CH2 of the RX
must be enabled (corresponding to the low and high phases of LRCLK.)
The selection of the valid data channels is done by setting the DAC
CHA_SEL and CHB_SEL. CHA_SEL is always the first (left) channel,
CHB_SEL depends on the number of active channels.
Previously for mono ASP CH2 was not enabled, the result was playing
mono data would not produce any audio output.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes:
621d65f3b868 ("ASoC: cs42l42: Provide finer control on playback path")
Link: https://lore.kernel.org/r/20210805161111.10410-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Richard Fitzgerald [Thu, 5 Aug 2021 16:11:06 +0000 (17:11 +0100)]
ASoC: cs42l42: Constrain sample rate to prevent illegal SCLK
The lowest valid SCLK corresponds to 44.1 kHz at 16-bit. Sample
rates less than this would produce SCLK below the minimum when using
a normal I2S frame. A constraint must be applied to prevent this.
The constraint is not applied if the machine driver sets SCLK, to
allow setups where the host generates additional bits per LRCLK
phase to increase the SCLK frequency. In these cases the machine
driver would always have to inform this driver of the actual SCLK,
and it must select a legal SCLK.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210805161111.10410-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Richard Fitzgerald [Thu, 5 Aug 2021 16:11:05 +0000 (17:11 +0100)]
ASoC: cs42l42: Fix LRCLK frame start edge
An I2S frame starts on the falling edge of LRCLK so ASP_STP must
be 0.
At the same time, move other format settings in the same register
from cs42l42_pll_config() to cs42l42_set_dai_fmt() where you'd
expect to find them, and merge into a single write.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes:
2c394ca79604 ("ASoC: Add support for CS42L42 codec")
Link: https://lore.kernel.org/r/20210805161111.10410-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Richard Fitzgerald [Thu, 5 Aug 2021 16:11:04 +0000 (17:11 +0100)]
ASoC: cs42l42: PLL must be running when changing MCLK_SRC_SEL
Both SCLK and PLL clocks must be running to drive the glitch-free mux
behind MCLK_SRC_SEL and complete the switchover.
This patch moves the writing of MCLK_SRC_SEL to when the PLL is started
and stopped, so that it only transitions while the PLL is running.
The unconditional write MCLK_SRC_SEL=0 in cs42l42_mute_stream() is safe
because if the PLL is not running MCLK_SRC_SEL is already 0.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes:
43fc357199f9 ("ASoC: cs42l42: Set clock source for both ways of stream")
Link: https://lore.kernel.org/r/20210805161111.10410-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Takashi Iwai [Thu, 5 Aug 2021 06:21:48 +0000 (08:21 +0200)]
ALSA: es1688: Avoid devres management for es1688 object creation
The recent refactoring of es1688 object creation with the use of
devres caused a problem with the non-PnP probe of GUS driver, as it
tries to probe multiple times with different parameters That is, this
object needs the immediate resource release and the devres doesn't fit
for it.
This patch reverts partially the commit for restoring the classic
resource management for es1688 object.
Fixes:
1bb11c1c7f6e ("ALSA: es1688: Allocate resources with device-managed APIs")
Reported-by: kernel test robot <oliver.sang@intel.com>
Link: https://lore.kernel.org/r/20210805032513.GA30485@xsang-OptiPlex-9020
Link: https://lore.kernel.org/r/20210805062148.30951-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Pierre-Louis Bossart [Wed, 4 Aug 2021 18:54:42 +0000 (13:54 -0500)]
ALSA: pci/korg1212: completely remove 'set but not used' warnings
Commit
6cdc01ebdfb0 ("ALSA: pci/korg1212: remove 'set but not used'
warnings") missed one __maybe_unused, add to enable make W=1 sound/
compilation with x86_64 allmodconfig
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210804185442.274057-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 4 Aug 2021 07:41:25 +0000 (09:41 +0200)]
ALSA: memalloc: Store snd_dma_buffer.addr for continuous pages, too
In the recent fix commit
eda80d7c9c4d ("ALSA: memalloc: Fix regression
with SNDRV_DMA_TYPE_CONTINUOUS"), we replaced the pfn argument of the
remap_page_pfn() call from the uninitialized dmab->addr. It was the
right fix, but it'd be more generic if we actually initialize
dmab->area for SNDRV_DMA_TYPE_CONTINOUS, too. e.g. the field is used
in the common snd_sgbuf_get_addr(), too.
This patch adds the initialization of addr field and does revert of
the previous change to refer to it again in the mmap call.
Link: https://lore.kernel.org/r/20210804074125.8170-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 4 Aug 2021 06:13:29 +0000 (08:13 +0200)]
ALSA: memalloc: Fix pgprot for WC mmap on x86
We have a special handling of WC pages on x86, and it's currently
specific to HD-audio. The last forgotten piece was the pgprot setup
for the mmap with WC pages.
This patch moves the pgprot setup for WC pages from HD-audio-specific
mmap callback to the common helper code. It allows us to remove the
superfluous mmap callback in HD-audio and its prepare_mmap
redirection.
Link: https://lore.kernel.org/r/20210804061329.29265-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:15 +0000 (09:28 +0200)]
ASoC: sprd: Use managed buffer allocation
This patch simplifies the buffer pre-allocation code of sprd driver
with the standard managed buffer helper. It uses the newly
introduced fixed-size buffer allocation helper.
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-16-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:14 +0000 (09:28 +0200)]
ASoC: qcom: qdsp6: Use managed buffer allocation
This patch simplifies the buffer pre-allocation code of qcom qdsp6
driver with the standard managed buffer helper. It uses the newly
introduced fixed-size buffer allocation helper.
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Banajit Goswami <bgoswami@codeaurora.org>
Acked-by: Mark Brown <broonie@kernel.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210802072815.13551-15-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:13 +0000 (09:28 +0200)]
ASoC: qcom: lpass: Use managed buffer allocation
This patch simplifies the buffer pre-allocation code of qcom lpass
driver with the standard managed buffer helper. It uses the newly
introduced fixed-size buffer allocation helper.
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Banajit Goswami <bgoswami@codeaurora.org>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:12 +0000 (09:28 +0200)]
ASoC: mpc5200: Use managed buffer allocation
This patch simplifies the buffer pre-allocation code of fsl mpc5200
driver with the standard managed buffer helper. It uses the newly
introduced fixed-size buffer allocation helper.
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:11 +0000 (09:28 +0200)]
ASoC: fsl_dma: Use managed buffer allocation
This patch simplifies the buffer pre-allocation code of fsl_dma
driver with the standard managed buffer helper. It uses the newly
introduced fixed-size buffer allocation helper.
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Shengjiu Wang <shengjiu.wang@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:10 +0000 (09:28 +0200)]
ASoC: fsl_asrc_dma: Use managed buffer allocation
This patch simplifies the buffer pre-allocation code of fsl_asrc_dma
driver with the standard managed buffer helper. It uses the newly
introduced fixed-size buffer allocation helper.
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Shengjiu Wang <shengjiu.wang@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:09 +0000 (09:28 +0200)]
ASoC: tegra: Use managed buffer allocation
As the standard buffer allocation helper supports WC pages now, we can
convert imx-pcm-rpmsg driver to use that. This allows us to remove
lots of superfluous code.
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:08 +0000 (09:28 +0200)]
ASoC: fsl: imx-pcm-rpmsg: Use managed buffer allocation
As the standard buffer allocation helper supports WC pages now, we can
convert imx-pcm-rpmsg driver to use that. This allows us to remove
lots of superfluous code.
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Shengjiu Wang <shengjiu.wang@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:07 +0000 (09:28 +0200)]
ASoC: fsl: imx-pcm-fiq: Use managed buffer allocation
As the standard buffer allocation helper supports WC pages now, we can
convert imx-pcm-fiq driver to use that. This allows us to remove lots
of superfluous code.
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Shengjiu Wang <shengjiu.wang@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:06 +0000 (09:28 +0200)]
ASoC: bcm: Use managed PCM buffer allocation
As the standard buffer allocation helper supports WC pages now, we can
convert bcm driver to use that. This allows us to remove lots of
superfluous code.
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:05 +0000 (09:28 +0200)]
ALSA: pxa2xx: Use managed PCM buffer allocation
Now with the recent addition of WC buffer allocation support, we can
use the standard PCM buffer allocation helpers for pxa2xx drivers.
This allows us to remove lots of superfluous code.
Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:04 +0000 (09:28 +0200)]
ALSA: memalloc: Support WC allocation on all architectures
There are the generic DMA API calls for allocating and managing the
pages with the write-combined attribute. Let's use them for all
architectures but x86; x86 still needs the special handling to
override the page attributes.
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:03 +0000 (09:28 +0200)]
ALSA: pcm: Allow exact buffer preallocation
A few drivers want to have rather the exact buffer preallocation at
the driver probe time and keep using it for the whole operations
without allowing dynamic buffer allocation. For satisfying the
demands, this patch extends the managed buffer allocation API
slightly.
Namely, when 0 is passed to max argument of the allocation helper
functions snd_pcm_set_managed_buffer*(), it treats as if the fixed
size allocation of the given size. If the pre-allocation fails in
this mode, the function returns now -ENOMEM. Otherwise, i.e. max
argument is non-zero, the function never returns -ENOMEM but tries to
fall back to the smaller chunks and allows the dynamic allocation
later -- which is still the default behavior until now.
For more intuitive use, also two new helpers are added for handling
the fixed size buffer allocation, too: snd_pcm_set_fixed_buffer() and
snd_pcm_set_fixed_buffer_all().
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:02 +0000 (09:28 +0200)]
ALSA: memalloc: Correctly name as WC
SNDRV_DMA_TYPE_DEV_UC and SNDRV_DMA_TYPE_DEV_UC_SG are incorrectly
named as if they were for the uncached memory, while actually we set
the pages as write-combined. Rename them to reflect the right
attribute.
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:28:01 +0000 (09:28 +0200)]
ALSA: memalloc: Minor refactoring
Return the pointer directly from alloc ops instead of setting
dmab->area at each place. It simplifies the code a bit.
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210802072815.13551-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Richard Fitzgerald [Tue, 3 Aug 2021 16:08:34 +0000 (17:08 +0100)]
ASoC: cs42l42: Remove duplicate control for WNF filter frequency
The driver was defining two ALSA controls that both change the same
register field for the wind noise filter corner frequency. The filter
response has two corners, at different frequencies, and the duplicate
controls most likely were an attempt to be able to set the value using
either of the frequencies.
However, having two controls changing the same field can be problematic
and it is unnecessary. Both frequencies are related to each other so
setting one implies exactly what the other would be.
Removing a control affects user-side code, but there is currently no
known use of the removed control so it would be best to remove it now
before it becomes a problem.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes:
2c394ca79604 ("ASoC: Add support for CS42L42 codec")
Link: https://lore.kernel.org/r/20210803160834.9005-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Richard Fitzgerald [Tue, 3 Aug 2021 16:08:33 +0000 (17:08 +0100)]
ASoC: cs42l42: Fix inversion of ADC Notch Switch control
The underlying register field has inverted sense (0 = enabled) so
the control definition must be marked as inverted.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes:
2c394ca79604 ("ASoC: Add support for CS42L42 codec")
Link: https://lore.kernel.org/r/20210803160834.9005-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Colin Ian King [Tue, 3 Aug 2021 12:28:39 +0000 (13:28 +0100)]
ALSA: usb-audio: make array static const, makes object smaller
Don't populate array names_to_check on the stack but instead it
static. Makes the object code smaller by 56 bytes. Also clean
up checkpatch warning by adding extra const for names_to_check
and pointer s.
Before:
text data bss dec hex filename
103512 34380 0 137892 21aa4 ./sound/usb/mixer.o
After:
text data bss dec hex filename
103264 34572 0 137836 21a6c ./sound/usb/mixer.o
(gcc version 10.2.0)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210803122839.7143-1-colin.king@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 3 Aug 2021 11:43:12 +0000 (13:43 +0200)]
ALSA: seq: Fix racy deletion of subscriber
It turned out that the current implementation of the port subscription
is racy. The subscription contains two linked lists, and we have to
add to or delete from both lists. Since both connection and
disconnection procedures perform the same order for those two lists
(i.e. src list, then dest list), when a deletion happens during a
connection procedure, the src list may be deleted before the dest list
addition completes, and this may lead to a use-after-free or an Oops,
even though the access to both lists are protected via mutex.
The simple workaround for this race is to change the access order for
the disconnection, namely, dest list, then src list. This assures
that the connection has been established when disconnecting, and also
the concurrent deletion can be avoided.
Reported-and-tested-by: folkert <folkert@vanheusden.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210801182754.GP890690@belle.intranet.vanheusden.com
Link: https://lore.kernel.org/r/20210803114312.2536-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Guennadi Liakhovetski [Mon, 2 Aug 2021 15:17:49 +0000 (10:17 -0500)]
ASoC: SOF: Intel: hda-ipc: fix reply size checking
Checking that two values don't have common bits makes no sense,
strict equality is meant.
Fixes:
f3b433e4699f ("ASoC: SOF: Implement Probe IPC API")
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210802151749.15417-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Pierre-Louis Bossart [Mon, 2 Aug 2021 15:16:28 +0000 (10:16 -0500)]
ASoC: SOF: Intel: Kconfig: fix SoundWire dependencies
The previous Kconfig cleanup added simplifications but also introduced
a new one by moving a boolean to a tristate. This leads to randconfig
problems.
This patch moves the select operations in the SOUNDWIRE_LINK_BASELINE
option. The INTEL_SOUNDWIRE config remains a tristate for backwards
compatibility with older configurations but is essentially an on/off
switch.
Fixes:
cf5807f5f814f ('ASoC: SOF: Intel: SoundWire: simplify Kconfig')
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Tested-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20210802151628.15291-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Takashi Iwai [Sat, 31 Jul 2021 08:43:31 +0000 (10:43 +0200)]
ASoC: amd: Fix reference to PCM buffer address
PCM buffers might be allocated dynamically when the buffer
preallocation failed or a larger buffer is requested, and it's not
guaranteed that substream->dma_buffer points to the actually used
buffer. The driver needs to refer to substream->runtime->dma_addr
instead for the buffer address.
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20210731084331.32225-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Takashi Iwai [Thu, 29 Jul 2021 07:44:04 +0000 (09:44 +0200)]
ALSA: doc: Add the description of quirk_flags option for snd-usb-audio
Just briefly described about the new option.
Link: https://lore.kernel.org/r/20210729074404.19728-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:44:03 +0000 (09:44 +0200)]
ALSA: usb-audio: Add quirk_flags module option
This patch adds a new module option, quirk_flags, for allowing user to
try some additional device-specific quirk behavior more easily.
When this option is set to non-zero, it overrides the quirk_flags, and
the specific workaround is applied.
Link: https://lore.kernel.org/r/20210729074404.19728-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:44:02 +0000 (09:44 +0200)]
ALSA: usb-audio: Move generic DSD raw detection into quirk_flags
The generic DSD raw detection is based on the known allow list, and we
can integrate it into quirk_flags, too.
Link: https://lore.kernel.org/r/20210729074404.19728-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:44:01 +0000 (09:44 +0200)]
ALSA: usb-audio: Move ignore_ctl_error check into quirk_flags
The mixer code has a flag ignore_ctl_error for ignoring the errors
returned from the device wrt mixer accesses, and this is set from the
entries in mixer_maps.c, as well as ignore_ctl_error module option.
Those can be well integrated into the new quirk_flags field, too.
Link: https://lore.kernel.org/r/20210729074404.19728-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:44:00 +0000 (09:44 +0200)]
ALSA: usb-audio: Move autosuspend quirk into quirk_flags
The auto-suspend suppression workaround for Lenovo machines are
handled in quirks-table.h. Now it's more easier to handle with
quirk_flags.
Link: https://lore.kernel.org/r/20210729074404.19728-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:43:59 +0000 (09:43 +0200)]
ALSA: usb-audio: Move rate validation quirk into quirk_flags
The rate validation at the device probe is applied only to the
specific devices (currently only for MOTU devices), and this check can
be moved to quirk_flags gracefully, too.
Link: https://lore.kernel.org/r/20210729074404.19728-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:38:55 +0000 (09:38 +0200)]
ALSA: usb-audio: Move interface setup delay into quirk_flags
Yet another delay is applied at switching the interface. This can be
moved to quirk_flags, too.
Link: https://lore.kernel.org/r/20210729073855.19043-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:38:54 +0000 (09:38 +0200)]
ALSA: usb-audio: Move control message delay quirk into quirk_flags
We apply some delay for the control messages on certain devices as a
workaround, and this can be moved into the quirk_flags as well.
Currently there are three different delay periods (1ms, 5ms and 20ms),
so three different quirk bits are assigned for them.
Link: https://lore.kernel.org/r/20210729073855.19043-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:38:53 +0000 (09:38 +0200)]
ALSA: usb-audio: Move ITF-USB DSD quirk handling into quirk_flags
The devices with ITF-USB DSD type are listed in another function, and
this can be integrated into the quirk_flags easily.
Link: https://lore.kernel.org/r/20210729073855.19043-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:38:52 +0000 (09:38 +0200)]
ALSA: usb-audio: Move clock setup quirk into quirk_flags
There are a couple of device-specific quirks in the clock setup code,
and those can be moved gracefully to quirk_flags, too.
Link: https://lore.kernel.org/r/20210729073855.19043-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:38:51 +0000 (09:38 +0200)]
ALSA: usb-audio: Move playback_first flag into quirk_flags
The snd_usb_audio.playback_first flag is used by the implicit feedback
mode handling, and this can be also moved to quirk_flags.
Link: https://lore.kernel.org/r/20210729073855.19043-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:38:50 +0000 (09:38 +0200)]
ALSA: usb-audio: Move tx_length quirk handling to quirk_flags
There is another quirk for the transfer, and that's currently specific
to Zoom R16/24, handled in create_standard_audio_quirk(). Let's move
this also to the new quirk_flags.
Link: https://lore.kernel.org/r/20210729073855.19043-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:38:49 +0000 (09:38 +0200)]
ALSA: usb-audio: Move txfr_quirk handling to quirk_flags
The txfr_quirk field was meant for aligning the transfer, and it's set
for certain devices in quirks-table.h. Now we can move that stuff
also to the new quirk_flags gracefully, and reduce the quirks-table.h
entries (that are exposed to module device table).
As the quirks-table.h entries are also with the name string override,
provide the corresponding entries to the usb_audio_names[] table,
too.
Link: https://lore.kernel.org/r/20210729073855.19043-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:38:48 +0000 (09:38 +0200)]
ALSA: usb-audio: Move media-controller API quirk into quirk_flags
The devices that can have media-controller API entries are currently
specified via tables in quirks-table.h, as a part of descriptor
override. This can fit better to the new quirk_flags, as we just need
a matching with the given ID and create the MC entries accordingly.
Link: https://lore.kernel.org/r/20210729073855.19043-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 29 Jul 2021 07:38:47 +0000 (09:38 +0200)]
ALSA: usb-audio: Introduce quirk_flags field
As more and more device-specific workarounds came up and gathered in
various places, it becomes harder to manage. Now it's time to clean
up and collect workarounds more consistently and make them more easily
applicable.
This patch is the first step for that: a new field quirk_flags is
introduced in snd_usb_audio struct to contain the bit flags for
various device-specific quirks. Those are separate one from the
quirks in quirks-table.h; the quirks-table.h entries are for more
intrusive stuff that needs the descriptor override, while the new
quirk_flags is for easier ones that are tied with the vendor:product
IDs.
In this patch, as the first example, we convert the list of devices
and vendors to ignore GET_SAMPLE_RATE, formerly defined in
snb_usb_get_sample_rate_quirk().
Link: https://lore.kernel.org/r/20210729073855.19043-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 2 Aug 2021 07:04:48 +0000 (09:04 +0200)]
Merge branch 'for-linus' into for-next
Takashi Iwai [Sun, 1 Aug 2021 11:38:01 +0000 (13:38 +0200)]
ALSA: memalloc: Fix regression with SNDRV_DMA_TYPE_CONTINUOUS
The recent code refactoring made the mmap of continuous pages to be
done via the own helper snd_dma_continuous_mmap() with
remap_pfn_range(). There I overlooked that dmab->addr isn't set for
the allocation with SNDRV_DMA_TYPE_CONTINUOUS. This resulted always
in an error at mmap with this buffer type on the system such as
Intel SST Baytrail driver.
This patch fixes the regression by passing the correct address.
Fixes:
30b7ba6972d5 ("ALSA: core: Add continuous and vmalloc mmap ops")
Reported-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/8d6674da-7d7b-803e-acc9-7de6cb1223fa@redhat.com
Link: https://lore.kernel.org/r/20210801113801.31290-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>