In 'replace' event data, numerical ID of control is always invalid. This
commit fix this bug so as the event data has renewed numerical ID for
control.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Don't use generic snapshot of trigger_tstamp if low-level driver or
hardware can get a more precise value for better audio/system time
synchronization.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
timestamp in RUNNING mode is already taken in update_hw_ptr routine,
getting a new timestamp introduces offset between hw_ptr, audio_tstamp
and system time
Add else condition to read timestamp as fallback and only when
enabled
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Currently when adding a new control, the assigned numerical ID is not
set for event data, thus userspace applications cannot realize it just
by event data.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
For assigning sysfs entries for a card device from the driver,
introduce a new helper function, snd_card_add_dev_attr(). In this
way, we can avoid the possible race between the device registration
and the sysfs addition / removal.
The driver can pass a new attribute group to add freely. This has to
be called before snd_card_register().
Currently, up to two extra groups can be added. More than that, it'll
return an error.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
More updates for v3.20:
- Lots of refactoring from Lars-Peter Clausen, moving drivers to more
data driven initialization and rationalizing a lot of DAPM usage.
- Much improved handling of CDCLK clocks on Samsung I2S controllers.
- Lots of driver specific cleanups and feature improvements.
- CODEC support for TI PCM514x and TLV320AIC3104 devices.
- Board support for Tegra systems with Realtek RT5677.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAABAgAGBQJU0ok8AAoJECTWi3JdVIfQ3ccH/2zb+b477H4GNhUw5AEzdHtC
L7CI+5Q9VOGJQmZTjayRdUcPUHx4sTpYdQVTI56Q6CJk0OFljKNJcRrbzPqNgJ46
yOrMTIpNvzFEv46f7rX2uKfvAFOVRAA2f+gl34AMLXqxL5aydbZZBtoe2jP9lL8z
fIZ/s7qXHn3xnvxqNwOz3pnu6wFDrxbG34lXZaTaFQOueZ3fsthWLsz0xtO6a7aI
J9tA+wejd9qf+D3i6svsi+MhB6OehYMh9Fbm+ODj6NMWZGCIA3SJ/PD+gbCg318+
Xo0FNOyiw0fSAeBcHrEcfoaWBJrswxXjXaNbrIXc1/0gTj8AOJHCRus3w0OQU+Q=
=Yw2l
-----END PGP SIGNATURE-----
Merge tag 'asoc-v3.20-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Updates for v3.20
More updates for v3.20:
- Lots of refactoring from Lars-Peter Clausen, moving drivers to more
data driven initialization and rationalizing a lot of DAPM usage.
- Much improved handling of CDCLK clocks on Samsung I2S controllers.
- Lots of driver specific cleanups and feature improvements.
- CODEC support for TI PCM514x and TLV320AIC3104 devices.
- Board support for Tegra systems with Realtek RT5677.
Conflicts:
sound/soc/intel/sst-mfld-platform-pcm.c
Since the device is no longer hidden but embedded into each component,
we no longer need snd_get_device(). Let's drop it and relevant codes.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Now that all callers have been replaced with
snd_device_register_for_dev(), let's drop the obsolete device
registration code and concentrate only on the code handling struct
device directly. That said,
- remove the old snd_device_register(),
- rename snd_device_register_for_dev() with snd_device_register(),
- drop superfluous arguments from snd_device_register(),
- change snd_unregister_device() to pass the device pointer directly
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Like previous patches, this one embeds the struct device into struct
snd_compr. As the dev field wasn't used beforehand, it's reused as
the new device struct.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Like the previous change for the timer device, this patch changes the
device management for the ALSA sequencer device using the struct
device directly.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This is a relatively straightforward change, using the struct device
directly for managing the ALSA timer device.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
... instead of card's device. This will be helpful to distinguish
errors from multiple rawmidi devices on a single card.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Like previous patches, this changes the device management for rawmidi,
embedding the struct device into struct snd_rawmidi. The required
change is more or less same as hwdep device.
The currently unused dev field is reused as the new embedded struct
field now.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Like previous patches, at this time we embed the struct device into
PCM object. However, this needs a bit more caution: struct snd_pcm
doesn't own one device but two, for both playback and capture! Thus
not struct snd_pcm but struct snd_pcm_str object contains the device.
Along with this change, pcm->dev field is dropped for avoiding
confusion. It was meant to point to a non-standard parent. But,
since now we can touch each struct device directly, we can manipulate
the parent field easily there, too.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Like the previous patch, this one embeds the device object into hwdep
object. For a proper object lifecycle, it's freed in the release
callback.
This also allows us to create sysfs entries via passing to the groups
field of the device without explicit function calls. Since each
driver can see the device and touch its groups field directly, we
don't need to delegate in hwdep core any longer. So, remove the
groups field from snd_hwdep, and let the user (in this case only
hda_hwdep.c) modify the device groups.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch embeds a struct device for the control device into the card
object and avoid the device creation at registration time.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Introduce a new helper function snd_device_initialize() to initialize
the device object for sound devices.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Instead of open-coding the search over the control file loop, provide
a helper function for the preferred subdevice assigned to the current
process.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This is a preliminary patch for the further work on embedding struct
device into each sound device instance. It changes
snd_register_device*() helpers to receive the device object directly
for skipping creating a device there.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add helper functions to allow drivers to specify several disjoint
ranges for a variable. In particular, there is a codec (PCM512x) that
has a hole in its supported range of rates, due to PLL and divider
restrictions.
This is like snd_pcm_hw_constraint_list(), but for ranges instead of
points.
Signed-off-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Due to SNDRV_SEQ_ADDRESS_BROADCAST, not all 256 port number values can
be used.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When the last subscriber to a "Through" port has been removed, the
subscribed destination ports might still be active, so it would be
wrong to send "all sounds off" and "reset controller" events to them.
The proper place for such a shutdown would be the closing of the actual
MIDI port (and close_substream() in rawmidi.c already can do this).
This also fixes a deadlock when dummy_unuse() tries to send events to
its own port that is already locked because it is being freed.
Reported-by: Peter Billam <peter@www.pjb.com.au>
Cc: <stable@vger.kernel.org>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The snd_midi_event_free() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add SNDRV_PCM_TRIGGER_DRAIN trigger for pcm drain.
Some audio devices require notification of drain events
in order to properly drain and shutdown an audio stream.
Signed-off-by: Libin Yang <libin.yang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Instead of opencoding them use the standard roundup_pow_of_two() and
rounddown_pow_of_two() helper functions. This gets rids one of the few users
of the custom ld2() function and also makes it a bit more obvious what the
code does.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Currently the msbits constraints requires to specify a specific sample
format width for which the constraint should be applied. But often the
number of most significant bits is not sample format specific, but rather a
absolute limit. E.g. the PCM interface might accept 32-bit and 24-bit
samples, but the DAC has a 16-bit resolution and throws away the LSBs. In
this case for both 32-bit and 24-bit format msbits should be set to 16. This
patch extends snd_pcm_hw_constraint_msbits() so that a wildcard constraint
can be setup that is applied for all formats with a sample width larger than
the specified msbits. Choosing the wildcard constraint is done by setting
the sample width parameter of the function to 0.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
If the sound card is made up of discrete components, each with their own
driver (e.g. like in the ASoC case), we might end up with multiple msbits
constraint rules installed. Currently this will result in msbits being set
to whatever the last rule set it to.
This patch updates the behavior of the rule to choose the minimum (other
than zero) of all the installed rules.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The commit [7a2e9ddc: ALSA: usb-audio: Add native DSD support for
Denon/Marantz DACs] requires the new format definition that has
landed only in for-next branch.
The functions snd_seq_oss_timer_delete() and vunmap() perform also input
parameter validation. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch fixes XMOS DSD sample format to DSD_U32_BE and also adds
DSD_U16_BE and DSD_U32_BE sample formats.
Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Acked-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fix a copy & paste error:
Warning(sound/core/pcm_native.c:1112): Excess function parameter 'state' description in 'snd_pcm_stop_xrun'
The state argument was dropped from snd_pcm_stop_xrun().
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add a new helper function snd_pcm_stop_xrun() to the standard sequnce
lock/snd_pcm_stop(XRUN)/unlock by a single call, and replace the
existing open codes with this helper.
The function checks the PCM running state to prevent setting the wrong
state, too, for more safety.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
We want to know the offset for the id that was passed to the function, not
the offset of the first id of the control (which is always 0).
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Some state changes (e.g. snd_pcm_stop()) sets the runtime state after
calling snd_timer_notify(). This is basically racy, since the
notification may wakes up the user even before the state change.
Although the possibility is low, we should set the state before the
notifications.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This merges the USB-audio disconnect fix and resolves the conflicts
so that we can continue working on development of usb-audio stuff.
Conflicts:
sound/usb/card.c
This patch adds a new proc entry for PCM substreams to inject an
XRUN. When a PCM substream is running and any value is written to its
xrun_injection proc file, the driver triggers XRUN. This is a useful
feature for debugging XRUN and error handling code paths.
Note that this entry is enabled only when CONFIG_SND_PCM_XRUN_DEBUG is
set.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA PCM core has a mechanism tracking the PCM hwptr updates for
analyzing XRUNs. But its log is limited (up to 10) and its log output
is a kernel message, which is hard to handle.
In this patch, the hwptr logging is moved to the tracing
infrastructure instead of its own. Not only the hwptr updates but
also XRUN and hwptr errors are recorded on the trace log, so that user
can see such events at the exact timing.
The new "snd_pcm" entry will appear in the tracing events:
# ls -F /sys/kernel/debug/tracing/events/snd_pcm
enable filter hw_ptr_error/ hwptr/ xrun/
The hwptr is for the regular hwptr update events. An event trace
looks like:
aplay-26187 [004] d..3 4012.834761: hwptr: pcmC0D0p/sub0: POS: pos=488, old=0, base=0, period=1024, buf=16384
"POS" shows the hwptr update by the explicit position update call and
"IRQ" means the hwptr update by the interrupt,
i.e. snd_pcm_period_elapsed() call. The "pos" is the passed
ring-buffer offset by the caller, "old" is the previous hwptr, "base"
is the hwptr base position, "period" and "buf" are period- and
buffer-size of the target PCM substream.
(Note that the hwptr position displayed here isn't the ring-buffer
offset. It increments up to the PCM position boundary.)
The XRUN event appears similarly, but without "pos" field.
The hwptr error events appear with the PCM identifier and its reason
string, such as "Lost interrupt?".
The XRUN and hwptr error reports on kernel message are still left, can
be turned on/off via xrun_debug proc like before. But the bit 3, 4, 5
and 6 bits of xrun_debug proc are dropped by this patch. Also, along
with the change, the message strings have been reformatted to be a bit
more consistent.
Last but not least, the hwptr reporting is enabled only when
CONFIG_SND_PCM_XRUN_DEBUG is set.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
While converting to dev_*(), the message showing the invalid PCM
position was wrongly tagged as if an XRUN although it's actually a
BUG. This patch corrects the message again.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The function snd_pcm_action_lock_irq() can be much simplified by
simply wrapping snd_pcm_action() with the stream lock. This was
rather the original idea, but later it was open coded for
optimization. However, looking at the optimization part closely, one
notices that the probability of the optimized path is quite low; in
normal situations, the linked stream action happens only for the
triggered substream, thus the operation becomes identical. So the
code simplification has a clear win, especially because we have now
doubly codes for both atomic and non-atomic locks.
Signed-off-by: Takashi Iwai <tiwai@suse.de>