This patch converts the resource management in PCI au88x0 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-28-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI ali5451 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-27-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI via82xx drivers
with devres as a clean up. Each manual resource management is
converted with the corresponding devres helper, and the card object
release is managed now via card->private_free instead of a lowlevel
snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-26-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI sonicvibes driver
with devres as a clean up. Each manual resource management is
converted with the corresponding devres helper, and the card object
release is managed now via card->private_free instead of a lowlevel
snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-25-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI sis7019 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI rme96 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-23-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI rme32 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-22-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI maestro3 driver
with devres as a clean up. Each manual resource management is
converted with the corresponding devres helper, and the card object
release is managed now via card->private_free instead of a lowlevel
snd_device. Superfluous ac97 private_free callbacks were dropped,
too.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-21-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI fm801 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
Also the superfluous ac97 private_free callbacks were dropped, too.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-20-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI es1968 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-19-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI es1938 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-18-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI esn137x drivers
with devres as a clean up. Each manual resource management is
converted with the corresponding devres helper, the devres helper is
used for the DMA buffer page allocations, and the card object release
is managed now via card->private_free instead of a lowlevel
snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-17-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI cs5530 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-16-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI cs4281 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-15-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI cmipci driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI bt87x driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI azt3328 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI als4000 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI als300 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch converts the resource management in PCI ad1889 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, and the card object release is
managed now via card->private_free instead of a lowlevel snd_device.
Also, the unnecessary ac97 free callbacks are removed, too.
This should give no user-visible functional changes.
Link: https://lore.kernel.org/r/20210715075941.23332-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch is an attempt to slightly simplify the resource management
in HD-audio code, by using some device-managed APIs. Only a few
resources like PCI enablement and PCI resources managed via devres,
but most of the rest code dealing with HD-audio core stuff couldn't be
changed so much, hence the changes in this patch are pretty small in
the end. A special caveat is needed for the card object: we can't
move the card object release into devres, because the driver is
involved with the component stuff and its unregistiration doesn't work
well from devres release at all.
Link: https://lore.kernel.org/r/20210715075941.23332-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Like the previous patch, this patch converts the resource allocations
with device-managed API calls, so that we can reduce resource-free
calls.
The atiixp drivers are simpler than intel8x0, and even the irq can be
allocated with devres.
The end result is a good amount of code reduction.
Link: https://lore.kernel.org/r/20210715075941.23332-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch refactors the intel8x0 and intel8x0m driver codes using
devres and gets rid of the driver remove callback.
The conversion is fairly straightforward: each API call is replaced
with the device-managed API function, e.g. pci_enable_device() ->
pcim_enable_device(), and so on. The buffer descriptor list is
allocated with a new API, snd_devm_alloc_pages().
A slight code structure change is that the intel8x0 object is
allocated as a card's private_data instead of the own lowlevel
snd_device object. This simplifies the resource management.
And, the take-down procedure is triggered via card->private_free, and
it's registered at the end of the whole initialization, i.e. after the
all resources get properly managed.
The only not-devres-managed resource is the irq handler. Since we
need to release at suspend and re-acquire at resume (otherwise
something weird happens on some machines), this is still managed
manually. But the rest are all freed automatically.
The end result is a good amount of code reduction.
Link: https://lore.kernel.org/r/20210715075941.23332-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch adds a devres-supported helper for requesting an ISA DMA
channel that will be automatically freed at the device unbinding.
It'll be used by quite a few ISA sound drivers.
Link: https://lore.kernel.org/r/20210715075941.23332-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
As a second step for preliminary to widen the devres usages among
sound drivers, this patch adds a new ALSA core API function,
snd_devm_card_new(), to create a snd_card object via devres.
When a card object is created by this new function, snd_card_free() is
called automatically and the card object resource gets released at the
device unbinding time.
However, the story isn't that simple. A caveat is that we have to
call snd_card_free() at the very first of the whole resource release
procedure, in order to assure that the all exposed devices on
user-space are deleted and sync with processes accessing those devices
before releasing resources.
For achieving it, snd_card_register() adds a new devres action to
trigger snd_card_free() automatically when the given card object is a
"managed" one. Since usually snd_card_register() is the last step of
the initialization, this should work in most cases.
With all these tricks, some drivers can get rid of the whole driver
remove callback code.
About a bit of implementation details: the patch adds two new flags to
snd_card object: managed and releasing. The former indicates that the
object was created via snd_devm_card_new(), and the latter is used for
avoiding the double-free of snd_card_free() calls. Both flags are
fairly internal and likely uninteresting to normal users.
Link: https://lore.kernel.org/r/20210715075941.23332-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This is a preparation for allowing devres usages more widely in
various sound drivers. As a first step, this patch adds a new
allocator function, snd_devm_alloc_pages(), to manage the allocated
pages via devres, so that the pages will be automagically released as
device unbinding.
Unlike the old snd_dma_alloc_pages(), the new function returns
directly the snd_dma_buffer pointer. The caller needs NULL-check for
the allocation error appropriately.
Also, since a real device pointer is mandatory for devres,
SNDRV_DMA_TYPE_CONTINUOUS or SNDRV_DMA_TYPE_VMALLOC type can't be used
for this function.
Link: https://lore.kernel.org/r/20210715075941.23332-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
During probe the parent_clk_id is set to -1 which should not be used to
array index within hsdiv_rates[].
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20210717122820.1467-3-peter.ujfalusi@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
In case of an error within j721e_audio_startup() the domain->active must
be decremented to avoid unbalanced counter.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20210717122820.1467-2-peter.ujfalusi@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This is a Lenovo ThinkStation machine which uses the codec alc623.
There are 2 issues on this machine, the 1st one is the pop noise in
the lineout, the 2nd one is there are 2 Front Mics and pulseaudio
can't handle them, After applying the fixup of
ALC623_FIXUP_LENOVO_THINKSTATION_P340 to this machine, the 2 issues
are fixed.
Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20210719030231.6870-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
SB16 CSP driver may hit potentially a typical ABBA deadlock in two
code paths:
In snd_sb_csp_stop():
spin_lock_irqsave(&p->chip->mixer_lock, flags);
spin_lock(&p->chip->reg_lock);
In snd_sb_csp_load():
spin_lock_irqsave(&p->chip->reg_lock, flags);
spin_lock(&p->chip->mixer_lock);
Also the similar pattern is seen in snd_sb_csp_start().
Although the practical impact is very small (those states aren't
triggered in the same running state and this happens only on a real
hardware, decades old ISA sound boards -- which must be very difficult
to find nowadays), it's a real scenario and has to be fixed.
This patch addresses those deadlocks by splitting the locks in
snd_sb_csp_start() and snd_sb_csp_stop() for avoiding the nested
locks.
Reported-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/7b0fcdaf-cd4f-4728-2eae-48c151a92e10@gmail.com
Link: https://lore.kernel.org/r/20210716132723.13216-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
While using the DMIC recording, the garbled data will be captured by the
DMIC. It is caused by the critical power of PLL closed in the jack detect
function.
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Link: https://lore.kernel.org/r/20210716085853.20170-1-oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
For Stoneyridge platform, it is required to invoke DMA driver stop
first rather than invoking DWC I2S controller stop.
Enable dai_link structure stop_dma_fist flag to reverse the stop
sequence.
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20210716123015.15697-2-vijendar.mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
On stream stop, currently CPU DAI stop sequence invoked first
followed by DMA. For Few platforms, it is required to stop the
DMA first before stopping CPU DAI.
Introduced new flag in dai_link structure for reordering stop sequence.
Based on flag check, ASoC core will re-order the stop sequence.
Fixes: 4378f1fbe9 ("ASoC: soc-pcm: Use different sequence for start/stop trigger")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20210716123015.15697-1-vijendar.mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
SoundWire registers are only accessable after sdw components are succesfully
binded. Setup irqs at that point instead of doing at probe.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210716105735.6073-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
A property regex goes under 'patternProperties', not 'properties'
schema. Otherwise, the regex is interpretted as a fixed string.
Fixes: 17c2d247dd ("ASoC: dt-bindings: renesas: rsnd: tidyup properties")
Cc: Mark Brown <broonie@kernel.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210715185952.1470138-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Currently the snd_compr.lock mutex isn't initialized in the API
functions although the lock is used many places in other code in
compress offload API. It's because the object was expected to be
initialized via snd_compress_register(), but this was never used by
ASoC, which is the only user. Instead, ASoC initializes the mutex by
itself, and this is error-prone.
This patch moves the mutex initialization into the more appropriate
place, snd_compress_new(), for avoiding the missing init.
Reviewed-by: Mark Brown <broonie@kernel.org>
Acked-by: Vinod Koul <vkoul@kernel.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210714162424.4412-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
snd_compress_register() and snd_compress_deregister() API functions
have been never used by in-tree drivers.
Let's clean up the dead code.
Acked-by: Vinod Koul <vkoul@kernel.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210714162424.4412-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Recently we've added a new usb_mixer element type, USB_MIXER_BESPOKEN,
but it wasn't added in the table in snd_usb_mixer_dump_cval(). This
is no big problem since each bespoken type should have its own dump
method, but it still isn't disallowed to use the standard one, so we
should cover it as well. Along with it, define the table with the
explicit array initializer for avoiding other pitfalls.
Fixes: 785b6f29a7 ("ALSA: usb-audio: scarlett2: Fix wrong resume call")
Reported-by: Pavel Machek <pavel@denx.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210714084836.1977-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
currenlty wcd938x has only soundwire interface and depends on
symbols from wcd938x soundwire module, so make this dependency
explicit in Kconfig
Without this one of the randconfig endup setting
CONFIG_SND_SOC_WCD938X=y
CONFIG_SND_SOC_WCD938X_SDW=m
resulting in some undefined reference to wcd938x_sdw* symbols.
Reported-by: kernel test robot <lkp@intel.com>
Fixes: 0454422288 ("ASoC: codecs: wcd938x: add audio routing and Kconfig")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210713140417.23693-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
The ADL descriptor was missing an ACPI power setting, causing the DSP
to enter D3 even with a D0i1-compatible wake-on-voice/hotwording
capture stream.
Fixes: 4ad03f894b ('ASoC: SOF: Intel: Update ADL P to use its own descriptor')
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Sathya Prakash M R <sathya.prakash.m.r@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210712201620.44311-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
The ALC5631 does not like multi-write accesses, avoid them. This fixes:
rt5631 4-001a: Unable to sync registers 0x3a-0x3c. -121
errors on resume from suspend (and all registers after the registers in
the error not being synced).
Inspired by commit 2d30e9494f ("ASoC: rt5651: Fix regcache sync errors
on resume") from Hans de Geode, which fixed the same errors on ALC5651.
Signed-off-by: Maxim Schwalm <maxim.schwalm@gmail.com>
Link: https://lore.kernel.org/r/20210712005011.28536-1-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
The intel8x0 driver tries to measure the AC97 bus clock at the probe
time because there have been machines that are driven in different
rate (44.1kHz vs 48kHz). This was the past and currently most of
usages of this driver are on VM, and those are certainly fixed with
48k clock, hence it's useless and waste of time to measure.
This patch is an optimization, setting the fixed 48k rate if it's
detected to be running on a VM.
Link: https://lore.kernel.org/r/20210712093641.29079-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
On Intel platforms, we always enable all pins no matter what BIOS
sets, but for others, we still take the conservative approach, and the
HD-audio HDMI codec driver enables the streams only for the pins that
are enabled by BIOS, and skips the disabled pins. This seems not good
for some machines that have (as expected) broken BIOS, resulting in
the lack of needed outputs.
There is an allow-list in the driver code to enable all pins, but its
addition needs a recompilation. This patch adds a module option for
user's convenience to enable all pins forcibly on the fly. User can
pass snd_hda_codec_hdmi.enable_all_pins=1 option for testing, and once
confirmed, we may add a static entry in force_connect_list[].
Link: https://lore.kernel.org/r/20210712093551.29007-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The reset procedure in had_do_reset() is exactly for the recently
introduced PCM sync_stop ops. Replace the call with the new ops and
clean up the unnecessary code and flags.
Link: https://lore.kernel.org/r/20210712091915.28067-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The ice1724 driver looks for the matching card_info entry twice, once
at reading EEPROM and another for the rest tasks in the probe call.
Reduce the second one by referring to the already assigned card_info
entry.
Link: https://lore.kernel.org/r/20210712091904.28022-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The variable status is being initialized with a value that is never
read, the assignment is redundant and can be removed.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210709152938.460763-1-colin.king@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
If a 32-bit application is being used with a 64-bit kernel and is using
the mmap mechanism to write data, then the SNDRV_PCM_IOCTL_SYNC_PTR
ioctl results in calling snd_pcm_ioctl_sync_ptr_compat(). Make this use
pcm_lib_apply_appl_ptr() so that the substream's ack() method, if
defined, is called.
The snd_pcm_sync_ptr() function, used in the 64-bit ioctl case, already
uses snd_pcm_ioctl_sync_ptr_compat().
Fixes: 9027c4639e ("ALSA: pcm: Call ack() whenever appl_ptr is updated")
Signed-off-by: Alan Young <consult.awy@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/c441f18c-eb2a-3bdd-299a-696ccca2de9c@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>