Commit Graph

62 Commits

Author SHA1 Message Date
Heiner Kallweit a24de38de8 ALSA: control-led: Integrate mute led trigger
This driver is the only one calling ledtrig_audio_set(), therefore
the LED audio trigger isn't usable standalone. So it makes sense
to fully integrate LED audio triger handling here.

The module aliases ensure that the driver is auto-loaded (if built
as module) if a LED device has one of the two audio triggers as
default trigger.

In addition disable building the old audio mute LED trigger.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/107634e6-d9ad-4a9f-881d-1eb72ea1a5a7@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28 10:39:50 +00:00
Ivan Orlov 6da404e78d ALSA: core: Fix dependencies for SND_CORE_TEST
Select CONFIG_SND_PCM when enabling CONFIG_SND_CORE_TEST, as the test
uses symbols from 'pcm_misc.c'.

Fixes: 3e39acf56e ("ALSA: core: Add sound core KUnit test")
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20240201221122.16627-1-ivan.orlov0322@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-02 09:16:46 +01:00
Ivan Orlov 3e39acf56e ALSA: core: Add sound core KUnit test
At the moment, we have a decent amount of integration tests (selftests)
covering different aspects of the sound subsystem. However, a lot of
of sound-related in-kernel functions remains uncovered. This patch
introduces the KUnit test for the core part of the sound subsystem.
It includes 10 test cases:

- Coverage of the format-related inline functions from 'pcm.h' header
file: snd_pcm_format_physical_width, snd_pcm_format_width,
snd_pcm_format_signed, test_format_endianness

- Coverage of the available bytes counting functions from 'pcm.h'
header: snd_pcm_capture_avail, snd_pcm_playback_avail

- Coverage of functions from pcm_misc: snd_pcm_format_set_silence,
snd_pcm_format_name

- Coverage of card-related functions from init.c: snd_card_set_id,
snd_component_add

This patch depends on the previous patches in this patch series as they
contain fix for the bug, which was found during the test development.
Without them, the test doesn't pass.

Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20240125223522.1122765-3-ivan.orlov0322@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-01-30 14:11:37 +01:00
Takashi Iwai 0b5288f5fe ALSA: ump: Add legacy raw MIDI support
This patch extends the UMP core code to support the legacy MIDI 1.0
rawmidi devices.  When the new kconfig CONFIG_SND_UMP_LEGACY_RAWMIDI
is set, the UMP core allows to attach an additional rawmidi device for
each UMP Endpoint.  The rawmidi device contains 16 substreams where
each substream corresponds to a UMP Group belonging to the EP.  The
device reads/writes the legacy MIDI 1.0 byte streams and translates
from/to UMP packets.

The legacy rawmidi devices are exclusive with the UMP rawmidi devices,
hence both of them can't be opened at the same time unless the UMP
rawmidi is opened in APPEND mode.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230523075358.9672-15-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-23 12:11:09 +02:00
Takashi Iwai e3a8a5b726 ALSA: rawmidi: UMP support
This patch adds the support helpers for UMP (Universal MIDI Packet) in
ALSA core.

The basic design is that a rawmidi instance is assigned to each UMP
Endpoint.  A UMP Endpoint provides a UMP stream, typically
bidirectional (but can be also uni-directional, too), which may hold
up to 16 UMP Groups, where each UMP (input/output) Group corresponds
to the traditional MIDI I/O Endpoint.

Additionally, the ALSA UMP abstraction provides the multiple UMP
Blocks that can be assigned to each UMP Endpoint.  A UMP Block is a
metadata to hold the UMP Group clusters, and can represent the
functions assigned to each UMP Group.  A typical implementation of UMP
Block is the Group Terminal Blocks of USB MIDI 2.0 specification.

For distinguishing from the legacy byte-stream MIDI device, a new
device "umpC*D*" will be created, instead of the standard (MIDI 1.0)
devices "midiC*D*".  The UMP instance can be identified by the new
rawmidi info bit SNDRV_RAWMIDI_INFO_UMP, too.

A UMP rawmidi device reads/writes only in 4-bytes words alignment,
stored in CPU native endianness.

The transmit and receive functions take care of the input/out data
alignment, and may return zero or aligned size, and the params ioctl
may return -EINVAL when the given input/output buffer size isn't
aligned.

A few new UMP-specific ioctls are added for obtaining the new UMP
endpoint and block information.

As of this commit, no ALSA sequencer instance is attached to UMP
devices yet.  They will be supported by later patches.

Along with those changes, the protocol version for rawmidi is bumped
to 2.0.3.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230523075358.9672-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-23 12:10:54 +02:00
Takashi Iwai f5e829f92a ALSA: control: Add input validation
This patch adds a new feature to enable the validation of input data
to control elements in the ALSA core side.  When
CONFIG_SND_CTL_INPUT_VALIDATION is set, ALSA core verifies whether the
each input value via control API is in the defined ranges, also checks
whether it's aligned to the defined steps.  If an invalid value is
detected, ALSA core returns -EINVAL error immediately without passing
further to the driver's callback.  So this is a kind of hardening for
(badly written) drivers that have no proper error checks, at the cost
of a slight performance overhead.

Technically seen, this reuses a part of the existing validation code
for CONFIG_SND_CTL_DEBUG case with a slight modification to suppress
error prints for the input validation.

Link: https://lore.kernel.org/r/20220609120219.3937-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-06-15 07:45:28 +02:00
Takashi Iwai 1b7ec5143c ALSA: control: Rename CONFIG_SND_CTL_VALIDATION to CONFIG_SND_CTL_DEBUG
The purpose of CONFIG_SND_CTL_VALIDATION is rather to enable the
debugging feature for the control API.  The validation is only a part
of it.  Let's rename it to be more explicit and intuitive.

While we're at it, let's advertise, give more comment to recommend
this feature for development in the kconfig help text.

Link: https://lore.kernel.org/r/20220609120219.3937-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-06-15 07:45:27 +02:00
Takashi Iwai c27e1efb61 ALSA: control: Use xarray for faster lookups
The control elements are managed in a single linked list and we
traverse the whole list for matching each numid or ctl id per every
inquiry of a control element.  This is OK-ish for a small number of
elements but obviously it doesn't scale.  Especially the matching with
the ctl id takes time because it checks each field of the snd_ctl_id
element, e.g. the name string is matched with strcmp().

This patch adds the hash tables with Xarray for improving the lookup
speed of a control element.  There are two xarray tables added to the
card; one for numid and another for ctl id.  For the numid, we use the
numid as the index, while for the ctl id, we calculate a hash key.

The lookup is done via a single xa_load() execution.  As long as the
given control element is found on the Xarray table, that's fine, we
can give back a quick lookup result.  The problem is when no entry
hits on the table, and for this case, we have a slight optimization.
Namely, the driver checks whether we had a collision on Xarray table,
and do a fallback search (linear lookup of the full entries) only if a
hash key collision happened beforehand.
So, in theory, the inquiry for a non-existing element might take still
time even with this patch in a worst case, but this must be pretty
rare.

The feature is enabled via CONFIG_SND_CTL_FAST_LOOKUP, which is turned
on as default.  For simplicity, the option can be turned off only when
CONFIG_EXPERT is set ("You are expert? Then you manage 1000 knobs").

Link: https://lore.kernel.org/r/20211028130027.18764-1-tiwai@suse.de
Link: https://lore.kernel.org/r/20220609180504.775-1-tiwai@suse.de
Link: https://lore.kernel.org/all/cover.1653813866.git.quic_rbankapu@quicinc.com/
Link: https://lore.kernel.org/r/20220610064537.18660-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-06-15 07:44:55 +02:00
Elijah Harding a893b7fc7b ALSA: core: Fix typo in 'PCM Timer Interface' help
Signed-off-by: Elijah Harding <eharding830@gmail.com>
Link: https://lore.kernel.org/r/20220318015201.30871-1-eharding830@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-18 09:19:37 +01:00
Jaroslav Kysela 22d8de62f1 ALSA: control - add generic LED trigger module as the new control layer
The recent laptops have usually two LEDs assigned to reflect
the speaker and microphone mute state. This implementation
adds a tiny layer on top of the control API which calculates
the state for those LEDs using the driver callbacks.

Two new access flags are introduced to describe the controls
which affects the audio path settings (an easy code change
for drivers).

The LED resource can be shared with multiple sound cards with
this code. The user space controls may be added to the state
chain on demand, too.

This code should replace the LED code in the HDA driver and
add a possibility to easy extend the other drivers (ASoC
codecs etc.).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210317172945.842280-4-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-30 15:33:58 +02:00
Hui Wang 2d670ea2bd ALSA: jack: implement software jack injection via debugfs
This change adds audio jack injection feature through debugfs, with
this feature, we could validate alsa userspace changes by injecting
plugin or plugout events to the non-phantom audio jacks.

With this change, the sound core will build the folders
$debugfs_mount_dir/sound/cardN if SND_DEBUG and DEBUG_FS are enabled.
And if users also enable the SND_JACK_INJECTION_DEBUG, the jack
injection nodes will be built in the folder cardN like below:

$tree $debugfs_mount_dir/sound
$debugfs_mount_dir/sound
├── card0
│   ├── HDMI_DP_pcm_10_Jack
│   │   ├── jackin_inject
│   │   ├── kctl_id
│   │   ├── mask_bits
│   │   ├── status
│   │   ├── sw_inject_enable
│   │   └── type
...
│   └── HDMI_DP_pcm_9_Jack
│       ├── jackin_inject
│       ├── kctl_id
│       ├── mask_bits
│       ├── status
│       ├── sw_inject_enable
│       └── type
└── card1
    ├── HDMI_DP_pcm_5_Jack
    │   ├── jackin_inject
    │   ├── kctl_id
    │   ├── mask_bits
    │   ├── status
    │   ├── sw_inject_enable
    │   └── type
    ...
    ├── Headphone_Jack
    │   ├── jackin_inject
    │   ├── kctl_id
    │   ├── mask_bits
    │   ├── status
    │   ├── sw_inject_enable
    │   └── type
    └── Headset_Mic_Jack
        ├── jackin_inject
        ├── kctl_id
        ├── mask_bits
        ├── status
        ├── sw_inject_enable
        └── type

The nodes kctl_id, mask_bits, status and type are read-only, users
could check jack or jack_kctl's information through them.

The nodes sw_inject_enable and jackin_inject are directly used for
injection. The sw_inject_enable is read-write, users could check if
software injection is enabled or not on this jack, and users could
echo 1 or 0 to enable or disable software injection on this jack. Once
the injection is enabled, the jack will not change by hardware events
anymore, once the injection is disabled, the jack will restore the
last reported hardware events to the jack. The jackin_inject is
write-only, if the injection is enabled, users could echo 1 or 0 to
this node to inject plugin or plugout events to this jack.

For the detailed usage information on these nodes, please refer to
Documentation/sound/designs/jack-injection.rst.

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20210127085639.74954-2-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-02-02 10:37:07 +01:00
Takashi Iwai fbd3eb7f66 ALSA: control: Add verification for kctl accesses
The current implementation of ALSA control API fully relies on the
callbacks of each driver, and there is no verification of the values
passed via API.  This patch is an attempt to improve the situation
slightly by adding the validation code for the values stored via info
and get callbacks.

The patch adds a new kconfig, CONFIG_SND_CTL_VALIDATION.  It depends
on CONFIG_SND_DEBUG and off as default since the validation would
require a slight overhead including the additional call of info
callback at each get callback invocation.

When this config is enabled, the values stored by each info callback
invocation are verified, namely:
- Whether the info type is valid
- Whether the number of enum items is non-zero
- Whether the given info count is within the allowed boundary

Similarly, the values stored at each get callback are verified as
well:
- Whether the values are within the given range
- Whether the values are aligned with the given step
- Whether any further changes are seen in the data array over the
  given info count

The last point helps identifying a possibly invalid data type access,
typically a case where the info callback declares the type being
SNDRV_CTL_ELEM_TYPE_ENUMERATED while the get/put callbacks store
the values in value.integer.value[] array.

When a validation fails, the ALSA core logs an error message including
the device and the control ID, and the API call also returns an
error.  So, with the new validation turned on, the driver behavior
difference may be visible on user-space, too -- it's intentional,
though, so that we can catch an error more clearly.

The patch also introduces a new ctl access type,
SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK.  A driver may pass this flag with
other access bits to indicate that the ctl element won't be verified.
It's useful when a driver code is specially written to access the data
greater than info->count size by some reason.  For example, this flag
is actually set now in HD-audio HDMI codec driver which needs to clear
the data array in the case of the disconnected monitor.

Also, the PCM channel-map helper code is slightly modified to avoid
the false-positive hit by this validation code, too.

Link: https://lore.kernel.org/r/20200104083556.27789-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-04 09:37:59 +01:00
Krzysztof Kozlowski 82e8d723e9 sound: Fix Kconfig indentation
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
    $ sed -e 's/^        /\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20191004144931.3851-1-krzk@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-07 03:53:03 +02:00
Thomas Gleixner ec8f24b7fa treewide: Add SPDX license identifier - Makefile/Kconfig
Add SPDX license identifiers to all Make/Kconfig files which:

 - Have no license information of any form

These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:

  GPL-2.0-only

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 10:50:46 +02:00
Mauro Carvalho Chehab 5fb94e9ca3 docs: Fix some broken references
As we move stuff around, some doc references are broken. Fix some of
them via this script:
	./scripts/documentation-file-ref-check --fix

Manually checked if the produced result is valid, removing a few
false-positives.

Acked-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Coly Li <colyli@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2018-06-15 18:10:01 -03:00
Takashi Iwai 111b0cdb97 ALSA: seq: Allow the modular sequencer registration
Many drivers bind the sequencer stuff in off-load by another driver
module, so that it's loaded only on demand.  In the current code, this
mechanism doesn't work when the driver is built-in while the sequencer
is module.  We check with IS_REACHABLE() and enable only when the
sequencer is in the same level of build.

However, this is basically a overshoot.  The binder code
(snd-seq-device) is an individual module from the sequencer core
(snd-seq), and we just have to make the former a built-in while
keeping the latter a module for allowing the scenario like the above.

This patch achieves that by rewriting Kconfig slightly.  Now, a driver
that provides the manual sequencer device binding should select
CONFIG_SND_SEQ_DEVICE in a way as
	select SND_SEQ_DEVICE if SND_SEQUENCER != n

Note that the "!=n" is needed here to avoid the influence of the
sequencer core is module while the driver is built-in.

Also, since rawmidi.o may be linked with snd_seq_device.o when
built-in, we have to shuffle the code to make the linker happy.
(the kernel linker isn't smart enough yet to handle such a case.)
That is, snd_seq_device.c is moved to sound/core from sound/core/seq,
as well as Makefile.

Last but not least, the patch replaces the code using IS_REACHABLE()
with IS_ENABLED(), since now the condition meets always when enabled.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-12 08:43:33 +02:00
Takashi Iwai 0181307abc ALSA: seq: Reorganize kconfig and build
This is a slightly intensive rewrite of Kconfig and Makefile about
ALSA sequencer stuff.

The first major change is that the kconfig items for the sequencer are
moved to sound/core/seq/Kconfig.  OK, that's easy.

The substantial change is that, instead of hackish top-level module
selection in Makefile, we define a Kconfig item for each sequencer
module.  The driver that requires such sequencer components select
exclusively the kconfig items.  This is more straightforward and
standard way.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-09 22:10:06 +02:00
Takashi Iwai 3d774d5ef0 ALSA: seq: Allow the tristate build of OSS emulation
Currently OSS sequencer emulation is tied with ALSA sequencer core,
both are built in the same level; i.e. when CONFIG_SND_SEQUENCER=y,
the OSS sequencer emulation is also always built-in, even though the
functionality can be built as an individual module.

This patch changes the rule and allows users to build snd-seq-oss
module while others are built-in.  Essentially, it's just a few simple
changes in Kconfig and Makefile.  Some driver codes like opl3 need to
convert from the simple ifdef to IS_ENABLED().  But that's all.

You might wonder how about the dependency: right, it can be messy, but
it still works.  Since we rewrote the sequencer binding with the
standard bus, the driver can be bound at any time on demand.  So, the
synthesizer driver module can be loaded individually from the OSS
emulation core before/after it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-09 22:09:45 +02:00
Takashi Iwai eb3b705aae ALSA: Make CONFIG_SND_OSSEMUL user-selectable
Currently CONFIG_SND_OSSEMUL is selected by each config like
CONFIG_SND_PCM_OSS.  But, as see in the raw MIDI code that is built
conditionally with CONFIG_SND_OSSEMUL, we should rather make
CONFIG_SND_OSSEMUL user-selectable as the top kconfig item, and leave
the rest depending on it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-09 16:38:58 +02:00
Alexandre Belloni 34ce71a96d ALSA: timer: remove legacy rtctimer
There are no users of rtctimer left. Remove its code as this is the
in-kernel user of the legacy PC RTC driver that will hopefully be removed
at some point.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-04-25 10:41:46 +02:00
Takashi Iwai fe0d128c57 ALSA: jack: Allow building the jack layer without input device
Since the recent integration of kctl jack and input jack layers, we
can basically build the jack layer even without input devices.  That
is, the jack layer itself can be built with conditional to enable the
input device support or not, while the users may enable always
CONFIG_SND_JACK unconditionally.

For achieving it, this patch changes the following:
- A new Kconfig, CONFIG_SND_JACK_INPUT_DEV, was introduced to indicate
  whether the jack layer supports the input device,
- A few items in snd_jack struct and relevant codes are conditionally
  built upon CONFIG_SND_JACK_INPUT_DEV,
- The users of CONFIG_SND_JACK drop the messy dependency on
  CONFIG_INPUT.

This change also automagically fixes a potential bug in HD-audio
driver Arnd reported, where the NULL or uninitialized jack instance is
dereferenced.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-02-23 09:03:07 +01:00
Randy Dunlap ac1efcfb35 ALSA: timer: fix SND_PCM_TIMER Kconfig text
Fix spelling and typos for SND_PCM_TIMER.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-01-28 07:23:12 +01:00
Jie Yang 90bbaf66ee ALSA: timer: add config item to export PCM timer disabling for expert
PCM timer is not always used. For embedded device, we need an interface
to disable it when it is not needed, to shrink the kernel size and
memory footprint, here add CONFIG_SND_PCM_TIMER for it.

When both CONFIG_SND_PCM_TIMER and CONFIG_SND_TIMER is unselected,
about 25KB saving bonus we can get.

Please be noted that when disabled, those stubs who using pcm timer
(e.g. dmix, dsnoop & co) may work incorrectlly.

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-16 14:31:38 +02:00
Jie Yang e0ecb05a96 ALSA: Kconfig: add config item SND_PROC_FS for expert
For some embedded devices, we need reduce code size and data
footprint as much as possible, e.g. disabling procfs, hw/sw
params refinement, mmap, dpcm, dapm, compressed API...

Here add SND_PROC_FS item for expert, we can unselect it to
disable sound proc FS and reduce memory footprint.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-27 21:25:17 +02:00
Takashi Iwai 181a152a09 Merge branch 'topic/hdmi' into for-next 2015-05-22 16:04:45 +02:00
Russell King 9203dd016a ALSA: pcm: add IEC958 channel status helper
Add a helper to create the IEC958 channel status from an ALSA
snd_pcm_runtime structure, taking account of the sample rate and
sample size.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Reviwed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-22 16:01:47 +02:00
Russell King 838d1631b7 ALSA: pcm: add DRM ELD helper
Add a helper for the EDID like data structure, which is typically passed
from a HDMI adapter to its associated audio driver.  This informs the
audio driver of the capabilities of the attached HDMI sink.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-22 16:01:44 +02:00
Jie Yang 9058cbe1ee ALSA: jack: implement kctl creating for jack devices
Currently the ALSA jack core registers only input devices for each jack
registered. These jack input devices are not readable by userspace devices
that run as non root. This patch series will implement kctls inside the
core jack part, including kctls creating, status changing report, for both
HD-Audio and ASoC jack. This allows non root userspace to read jack status
and act on it.

This patch adds a new API called snd_jack_add_new_kctl(), which will create
a kcontrol, add it to the card, and also attach it to the jack kctl list.

This patch also initialises the jack kctl list after jack is newed, and
reports kctl status when jack insertion/removal events occur.

snd_jack_new() is updated in the following patches to also support creating
phantom jacks and jack kcontrols. We then remove these duplicated features
from HDA jack and have jack kctls handled by core throughout HDA and ASoC.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Modified-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Jie Yang <yang.jie@intel.com>
Reveiwed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-27 21:37:40 +02:00
Daniel Mack 903eb3187e ALSA: core: allow SND_DMAENGINE_PCM use from modules
When users of SND_DMAENGINE_PCM are built as module, the config symbol
SND_DMAENGINE_PCM must be tristate, otherwise the linker will fail.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-15 18:28:42 +01:00
Daniel Mack b7ae6f31d8 ALSA: move dmaengine implementation from ASoC to ALSA core
For the PXA DMA rework, we need the generic dmaengine implementation
that currently lives in sound/soc for standalone (non-ASoC) AC'97
support.

Move it to sound/core, and rename the Kconfig symbol.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-15 11:18:09 +01:00
Takashi Iwai 7bb2491b35 ALSA: Add kconfig to specify the max card numbers
Currently ALSA supports up to 32 card instances when the dynamic minor
is used.  While 32 cards are usually big enough for normal use cases,
there are sometimes weird requirements with more card support.

Actually, this limitation, 32, comes from the index option, where you
can pass the bit mask to assign the card.  Other than that, we can
actually give more cards up to the minor number limits (currently 256,
which can be extended more, too).

This patch adds a new Kconfig to specify the max card numbers, and
changes a few places to accept more than 32 cards.

The only incompatibility with high card numbers would be the handling
of index option.  The index option can be still used to pass the
bitmask for card assignments, but this works only up to 32 slots.
More than 32, no bitmask style option is available but only a single
slot can be specified via index option.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-24 16:41:46 +02:00
Linus Torvalds d3569d163c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: virtuoso: Xonar DS: fix polarity of front output
  ALSA: Au88x0 - Reduce the number of playback subdevices of au8830 from 32 to 16
  ALSA: Au88x0 - Support 4 channels playback when AC97 codecs has SDAC bit
  ALSA: HDA: Fix internal microphone on Dell Studio 16 XPS 1645
  ALSA: Don't prompt for CONFIG_SND_COMPRESS_OFFLOAD
  ALSA: HDA: Use LPIB position fix for Macbook Pro 7,1
2012-01-17 10:48:13 -08:00
Takashi Iwai 5c845beb42 ALSA: Don't prompt for CONFIG_SND_COMPRESS_OFFLOAD
CONFIG_SND_COMPRESS_OFFLOAD is an item to be selected by the dirver
just like CONFIG_SND_PCM, and no need to prompt for explicit
selection.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-01-13 09:53:53 +01:00
Linus Torvalds a429638cac Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (526 commits)
  ASoC: twl6040 - Add method to query optimum PDM_DL1 gain
  ALSA: hda - Fix the lost power-setup of seconary pins after PM resume
  ALSA: usb-audio: add Yamaha MOX6/MOX8 support
  ALSA: virtuoso: add S/PDIF input support for all Xonars
  ALSA: ice1724 - Support for ooAoo SQ210a
  ALSA: ice1724 - Allow card info based on model only
  ALSA: ice1724 - Create capture pcm only for ADC-enabled configurations
  ALSA: hdspm - Provide unique driver id based on card serial
  ASoC: Dynamically allocate the rtd device for a non-empty release()
  ASoC: Fix recursive dependency due to select ATMEL_SSC in SND_ATMEL_SOC_SSC
  ALSA: hda - Fix the detection of "Loopback Mixing" control for VIA codecs
  ALSA: hda - Return the error from get_wcaps_type() for invalid NIDs
  ALSA: hda - Use auto-parser for HP laptops with cx20459 codec
  ALSA: asihpi - Fix potential Oops in snd_asihpi_cmode_info()
  ALSA: hdsp - Fix potential Oops in snd_hdsp_info_pref_sync_ref()
  ALSA: hda/cirrus - support for iMac12,2 model
  ASoC: cx20442: add bias control over a platform provided regulator
  ALSA: usb-audio - Avoid flood of frame-active debug messages
  ALSA: snd-usb-us122l: Delete calls to preempt_disable
  mfd: Put WM8994 into cache only mode when suspending
  ...

Fix up trivial conflicts in:
 - arch/arm/mach-s3c64xx/mach-crag6410.c:
	renamed speyside_wm8962 to tobermory, added littlemill right
	next to it
 - drivers/base/regmap/{regcache.c,regmap.c}:
	duplicate diff that had already come in with other changes in
	the regmap tree
2012-01-12 08:00:30 -08:00
Takashi Iwai 9e4ce164ee Merge branch 'topic/hda' into for-linus 2012-01-12 09:59:18 +01:00
Vinod Koul 40741dd5c2 ALSA: core: add makefile and kconfig file for compress
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-23 10:08:38 +01:00
Takashi Iwai 35be544af3 ALSA: Introduce common helper functions for jack-detection control
Now move the helper function for creating and reporting the jack-detection
to the common place.  The driver that needs this functionality should
select CONFIG_SND_KCTL_JACK kconfig.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-11-16 11:14:03 +01:00
Paul Bolle 3f9416cacc drop "select GCD" from three Kconfig files
There is no Kconfig symbol named GCD. The three select statements for
that symbol are nops. Drop these.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-11-13 20:58:22 +01:00
Florian Fainelli a9605391cf ALSA: sound/core/pcm_timer.c: use lib/gcd.c
Make sound/core/pcm_timer.c use lib/gcd.c

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-12-22 08:24:35 +01:00
Takashi Iwai cc6a8acdee ALSA: Fix SG-buffer DMA with non-coherent architectures
Using SG-buffers with dma_alloc_coherent() is often very inefficient
on non-coherent architectures because a tracking record could be
allocated in addition for each dma_alloc_coherent() call.
Instead, simply disable SG-buffers but just allocate normal continuous
buffers on non-supported (currently all but x86) architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-08 14:20:20 +02:00
Michal Marek 0528c7494e ALSA: clean up the logic for building sequencer modules
Instead of mangling the CONFIG_* variables in the makefiles over and
over, set a few helper variables in Kconfig.

Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-29 11:49:42 +02:00
Takashi Iwai e78a37bc77 ALSA: Fix a typo in Kconfig
The previous commit bbaf5e9733 has
an obvious typo.  Fixed now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-29 16:08:01 +01:00
Takashi Iwai bbaf5e9733 ALSA: Add hrtimer backend for ALSA timer interface
Added the hrtimer backend for ALSA timer interface.
It can be used for the sequencer timer source.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-24 18:16:50 +02:00
Takashi Iwai 52948b3f7c ALSA: Add a note on dependency of RTC stuff
Added a note on the dependency of old RTC stuff, which is exclusive
with the new RTC class drivers.
    http://bugme.linux-foundation.org/show_bug.cgi?id=11430

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-10-10 13:41:55 +02:00
Tejun Heo d886e87cb8 sound: make OSS sound core optional
sound/sound_core.c implements soundcore.ko and contains two parts -
sound_class which is shared by both ALSA and OSS and device
redirection support for OSS.  It's always compiled when any sound
support is enabled although it's necessary only when OSS (the actual
one or emulation) is enabled.  This is slightly wasteful and as device
redirection always registers character device region for major 14, it
prevents alternative implementation.

This patch introduces a new config SOUND_OSS_CORE which is selected
iff OSS support is actually necessary and build the OSS core part
conditionally.

If OSS is disabled, soundcore merely contains sound_class but leaving
it that way seems to be the simplest approach as otherwise sound_class
should be in ALSA core file if OSS is disabled but should be in
soundcore if OSS is enabled.  Also, there's also the user confusion
factor.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-29 10:06:21 +02:00
Mark Brown 0d94e41abe ALSA: Build jack detection
Since jack detection requires the input subsystem which may not be
desired on small systems it is not built unless required by a driver
that is being built. Drivers using jack detection should use a pattern
like this:

config SND_FOO
        tristate "..."
        ...
        select SND_JACK if INPUT=y || INPUT=SND

to ensure that the jack detection API is enabled if the input subsystem
is.  If the input subsystem is not enabled then a stub version of the
API is provided.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-07-29 21:32:06 +02:00
Takashi Iwai 62cf872a8e [ALSA] Replace CONFIG_SND_DEBUG_DETECT with CONFIG_SND_DEBUG_VERBOSE
Replace CONFIG_SND_DEBUG_DETECT with CONFIG_SND_DEBUG_VERBOSE to
represent its meaning more better.  This config isn't provided only
for the detection but for more verbose debug prints in general.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-05-27 15:56:21 +02:00
Takashi Iwai 89fe511792 sound: Convert to menuconfig
Convert menu in sound Kconfig files to menuconfig and if.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-05-27 15:56:20 +02:00
Takashi Iwai e922b0028f [ALSA] Move vmaster code to sound core
Move the codes for virtual master controls to sound core part so that
not only hda-intel drivers can use it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:12 +02:00
Matt LaPlante a982ac06b0 misc doc and kconfig typos
Fix various typos in kernel docs and Kconfigs, 2.6.21-rc4.

Signed-off-by: Matt LaPlante <kernel1@cyberdogtech.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2007-05-09 08:58:15 +02:00