History log of /sound/core/jack.c
Revision Date Author Comments
eeda276bef36026fce3029e6423e1a09a50c359e 21-Feb-2011 Lu Guanqun <guanqun.lu@intel.com> ALSA: fix one memory leak in sound jack

Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
ebb812cb8df48e299b3d4ab75cbb0042384ef70d 17-Mar-2010 Mark Brown <broonie@opensource.wolfsonmicro.com> ALSA: Add support for key reporting via the jack interface

Some devices provide support for detection of a small number of
buttons on their jacks. One common implementation provides a single
button, implemented by shorting the microphone to ground and detected
along with microphone presence detection by detecting varying current
draws on the microphone bias signal.

Provide support for up to three buttons via the jack interface. These
default to reporting BTN_n but an API is provided to allow these to
be remapped to other keys by the machine driver where it knows what
the keys are. More keys can be added with ease if required.

This is only intended to support simple accessory button designs. If
the interface is limiting then either creating a child device for the
accessory or accessing the input device in the jack directly is
recommended.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
1c6e555c3a66af29a51690748ca54314e62c16d5 17-Mar-2010 Mark Brown <broonie@opensource.wolfsonmicro.com> ALSA: Rename jack switch table in preparation for button support

Avoids confusion when we have button support.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
1f3fff7bda95b75a6be5a02c2a6902573d8c18e6 10-Jun-2009 Kay Sievers <kay.sievers@vrfy.org> ALSA: use card device as parent for jack input-devices

This moves the jack devices from the PCI device into the ALSA card device, which
makes it easier for userspace to find all devices belonging to a specific card
while granting access to logged-in users.

Jack input devices from sound cards can now simply be matched with udev by doing:
SUBSYSTEM="input", SUBSYSTEMS="sound", ...

ls -l /sys/devices/pci0000:00/0000:00:1b.0/sound/card0
controlC0
device -> ../../../0000:00:1b.0
id
input10
input11
input8
input9
number
pcmC0D0c
pcmC0D0p
pcmC0D1p
power
subsystem -> ../../../../../class/sound
uevent

Cc: Lennart Poettering <lennart@0pointer.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9d59065cd6fae841ca56c281189d5b8d0817d35f 14-Apr-2009 Takashi Iwai <tiwai@suse.de> ALSA: add private_data to struct snd_jack

Added private_data and private_free fields to struct snd_jack so that
the caller can assign the data. It'll be helpful for avoiding the
double-free of the jack instance.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2678f60d2bc05a12580b93eb36f089f0e55693e0 18-Feb-2009 Takashi Iwai <tiwai@suse.de> ALSA: jack - Use card->shortname for input name

Currently the jack layer refers to card->longname as a part of
its input device name string. However, longname is often really long
and way too ugly as an identifier, such as,
"HDA Intel at 0xf8400000 irq 21".

This patch changes the code to use card->shortname instead.
The shortname string contains usually the h/w vendor and product
names but without messy I/O port or IRQ numbers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
d506fc322ec2af04fc47be83d796a1c9e1a16022 07-Jan-2009 Jani Nikula <ext-jani.1.nikula@nokia.com> ALSA: Add support for video out to the jack reporting API

Add support for reporting new jack types SND_JACK_VIDEOOUT and
SND_JACK_AVOUT (a combination of LINEOUT and VIDEOOUT) to the jack
reporting API.

Also add the corresponding SW_VIDEOOUT_INSERT switch to the input system
header.

Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
bd8a71a7b0f50da9350d202d325c3926ffd6b189 03-Jan-2009 Mark Brown <broonie@opensource.wolfsonmicro.com> ALSA: Reduce boilerplate for new jack types

Use a lookup table rather than explicit code to map input subsystem jack
types into ASoC ones, implemented as suggested by Takashi Iwai.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
cdc693643271b2e6a693cf8f6afb258cce01f058 10-Dec-2008 Mark Brown <broonie@opensource.wolfsonmicro.com> ALSA: Add support for mechanical jack insertion

Some systems support both mechanical and electrical jack detection,
allowing them to report that a jack is physically present but does
not have any functioning connections. Add a new jack type for these,
allowing user space to report faulty connections.

Thanks to Guillem Jover for the suggestion.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
a53ccab3ccac9e8676a683df9822a2daec83ef54 25-Oct-2008 Matthew Ranostay <mranostay@embeddedalley.com> ALSA: jack: lineout support to jack abstraction layer

This patch introduces support for reporting SW_LINEOUT_INSERT detection events
via the jack abstraction layer.

Also adds a SND_JACK_LINEOUT define to the input system header.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
282cd76ffca781013151344c4b0f9229e9ea3c35 25-Oct-2008 Matthew Ranostay <mranostay@embeddedalley.com> ALSA: hda: dynamic jack id

This patch duplicates the jack->id pointer with kstrdup() to prevent
scoping issues from calling autoprobing functions from the HDA section.

Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9a3f371e9962749e5bdcf45a3bebdba555651a2b 15-Oct-2008 Mark Brown <broonie@opensource.wolfsonmicro.com> ALSA: Handle NULL jacks in snd_jack_report()

Facilitate drivers that wish to carry on if they can't create a jack
input device by handling attempts to report the state of a NULL jack,
removing the need to check for initialisation before use.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
e76d8ceaaff9d7fc1ba2b1963a9f34151832223b 28-Jul-2008 Mark Brown <broonie@opensource.wolfsonmicro.com> ALSA: Add jack reporting API

Currently very few systems provide information about jack status to user
space, even though many have hardware facilities to do detection. Those
systems that do use an input device with the existing SW_HEADPHONE_INSERT
switch type to do so, often independently of ALSA.

This patch introduces a standard method for representing jacks to user
space into ALSA. It allows drivers to register jacks for a sound card with
the input subsystem, binding the input device to the card to help user
space associate the input devices with their sound cards. The created
input devices are named in the form "card longname jack" where jack is
provided by the driver when allocating a jack. By default the parent for
the input device is the sound card but this can be overridden by the
card driver.

The existing user space API with SW_HEADPHONE_INSERT is preserved.

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>