The llseek implementation is identical for existing driver implementations,
so let's merge to the common layer. The same code for the text proc file
can be used even for the binary proc file.
The driver can provide its own llseek method if needed. Then the common
code will be skipped.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Check the validity of the file position in the common info layer before
calling read or write callbacks in assumption that entry->size is set up
properly to indicate the max file size.
Removed the redundant checks from the callbacks as well.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
Fix 'else' placement in ifdef block so that build succeeds:
sound/isa/opti9xx/opti92x-ad1848.c:221: error: 'else' without a previous 'if'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
While trying to compile jazz16 isa sound driver on alpha (2.6.33+git), I
found a compile failure in jazz16.c (udelay is unknown). Fix it by
including delay.h.
Signed-foo-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The Master Control port (MC) is available as the last
PnP resource (OPT005). Use this value instead fo guessing.
Also, add some comments to the code.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The patch "sbawe: fix memory detection" fixed detection
for memoryless SB32 cards but broke detection of memory
above 512KB. This patch fixes the regression.
The patch has been tested on the SB32 card (CT3670) with
0MB, 2MB and 8MB memory installed.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Narrow the dma and irq selection after the DOS driver.
Add ALSA configuration description as well.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This is one of Sound Blaster Pro compatible chipsets which is supported
by Linux OSS driver and was missing native supoort for ALSA.
The Jazz16 audio codec is Crystal CS4216 which is capable
of playback and recording up to 48 kHz stereo.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Memory amount is increased before a successful write-read
sequence is done. Thus, 512 kB of onboard memory is detected
on memoryless cards like SB32.
Move the increasing of memory counter after successful read
is done.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use kzalloc rather than kcalloc(1,...)
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
@@
- kcalloc(1,
+ kzalloc(
...)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Convert table of pointers to mixer controls into tables
of the mixer controls. It saves about 20% of the snd-sb-common
module size reported by lsmod.
The als4000 uses part of sb16's control table.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sizeof(share_id) is just the size of the pointer. On the other hand,
block->share_id is an array, so its size seems more appropriate.
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression *x;
expression f;
type T;
@@
*f(...,(T)x,...)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
ALSA: hda - Overwrite pin config on intel DG45ID board.
intelhdmi - dont power off HDA link
ALSA: hrtimer - Fix lock-up
ALSA: intelhdmi - add channel mapping for typical configurations
ALSA: intelhdmi - channel mapping applies to Pin
ALSA: intelhdmi - accept DisplayPort pin
ALSA: hda - show HBR(High Bit Rate) pin cap in procfs
ALSA: hda - Fix LED GPIO setup for HP laptops with IDT codecs
ASoC: Fix build of OMAP sound drivers
ALSA: opti93x: fix irq releasing if the irq cannot be allocated
Add dB scale for mixer controls. Fix dB scale for
Master Volume control.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Move OPTi93x controls definitions to the opti93x driver
from the common wss-lib library module. These controls
are used only by the opti93x driver.
Also, fix capture source names. They are the same as
opl3sa2 names.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The als100 driver is so similar to the dt019x/als007 driver
that one driver's source can be used for both drivers with
only few changes. Merge the dt019x driver into the als100.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use the chip->irq to check if the irq should be released so the irq is not released
if it has not been allocated.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The PnP data on the OPTI931 and OPTI933 contains io port
range for the MC indirect registers. Use the PnP range
instead of hardwired value 0xE0E.
Also, request region of MC indirect registers so it is
marked as used to other drivers (this was missing previously).
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Remove snd_opti9xx fields which are indirect arguments to
the snd_opti9xx_configure(). Pass these values as function
arguments.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The PCM12 and PCM20 can be set into the ISA PnP mode. The PCM12 PnP
was sold as the PnP device.
Add code to handle detection of these cards using ISA PnP framework.
Tested on the PCM20 in PnP mode. The PCM12 PnP has the same MS Windows
INF file except for a card name displayed for user.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Separate common probing code in order to use it
for PnP probing.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
If a hardware is not detected there is a kernel crash
due to not initialized snd_miro->aci pointer. This pointer
is initialized after detection of the opti (miro) chip.
This bug was introduced by patches to expose
ACI mikser outside the snd-miro driver.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The ACI mixer is used to control the radio FM module
installed on the Miro PCM20 sound card. Expose ACI mixer
outside the sound card driver.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Move the miro.h header to the include/sound directory. It can
be used in the Miro PCM20 radio driver (v4l).
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Remove the snd_card pointer from the snd_miro structure and
do some small code improvements.
Also, move Opti chipset detection before detection of the
ACI mixer, so the mci_base value is set in one place only.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use db scale for all volume controls according to Crystal's datasheets.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use the fm_port and mpu_port variables directly in a probe function.
This completely eliminates a need to copy the fm_port value to
the snd_miro structure.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Update control names to be more closer to their meaning.
Change the "Mono" name to the "Beep" as this line is usually
used to forward the PC beeper signal to sound card's output.
Update names for both cs423x and wss.
Clean up cs4235 controls according to the cs4235 doc. Rename
some of the cs4235 controls to be consistent with the cs4236's
ones.
Also, delete one misnamed cs4231 register define.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
1. Set the third argument of the snd_device_new to not NULL, so there is
no warning about bug during chip detection. The third argument is not
used in this driver. It was changed in my previous patch.
2. Remove the fm_port and mpu_port fields from the snd_es18xx structure.
They can be converted to function arguments.
3. Remove the dmaN_size fields from the snd_es18xx structure. These
values are used only in pointer functions and can be easily calculated.
4. Remove the ctrl_lock spinlock which is used only in one read function
which is called once during chip initialization. There are many
writes to the same register and they are not protected on purpose
(see the comment ina the snd_es18xx_config_write()).
5. Use the first part of the text5Sources string table as the text4Soruces
table (they are the same).
6. Merge the same cases for the ES1887 and ES1888 when setting chip's caps.
7. Move the snd_es18xx_reset() to __devinit section.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The cs4236 was two step detection with call to the snd_wss_free()
between two steps. The snd_wss_free() did not free a sound device
created in the snd_wss_create(). This caused an OOPS during module
removal as the same sound device was released twice. The same OOPS
happened if the cs4236 module loading failed.
Fix this by adapting the snd_cs4236_create() to correctly work with
chips less capable then cs4236. The snd_cs4236_create() behaves the
same as the snd_wss_create() if the chip is less capable than the cs4236.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
To avoid confusion in control names for the standard analog PC Beep generator
using a small Internal PC Speaker, rename all related "PC Speaker" and "PC
Beep" controls to "Beep" only. This name is more universal and can be also
used on more platforms without confusion.
Introduce also "Internal Speaker" in ControlNames.txt for systems with
full-featured build-in internal speaker.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Remove intermediate snd_audiodrive structure between
snd_card structure and snd_es18xx. This reduces size of
source code and binary driver.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The snd_card pointer is redundant and code can be easily
changed to work without it.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The C4231 control set is a superset of the AD1848 control
set so reuse the CS4231 controls definitions for the AD1848.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Convert CS4231 mixer to dB scale after AD1848 mixer.
Also, add missing microphone boost control for the AD1848
and correct wrong bits for loopback volume on the AD1848.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fix coding style errors in the driver.
Also, add missing argument for CMD_XXX_MIDI_VOL command.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Module parameters shouldn't be marked as __devinitdata since they can be
referred via sysfs even after probing.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Old Soundscape cards (pre PnP) work only with AD1848 codecs.
If the CS4231 codec is installed it must be used in AD1848
compatible mode.
Also, add gameport support and remove an unused mpu field.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
There is no sense to limit open MIDI connections with limit
as high as ULONG_MAX.
Also, convert more messages to use the snd_printk.
Correct few old and misleading comments as well.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The conversion solves the problem that firmware size was set to 64KB
while non PnP cards have 128KB firmware files.
An additional firmware initialization code has been moved from the OSS
driver.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Move code from the OSS sscape driver in order to support old Soundscape OEM models.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
If spin_lock_irqsave is called twice in a row with the same second
argument, the interrupt state at the point of the second call overwrites
the value saved by the first call. Indeed, the second call does not need
to save the interrupt state, so it is changed to a simple spin_lock.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@
expression lock1,lock2;
expression flags;
@@
*spin_lock_irqsave(lock1,flags)
... when != flags
*spin_lock_irqsave(lock2,flags)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adding MPU-401 support to cmi8330 driver could cause a regression (non-working
sound) on a system where there is no free IRQ for the MPU-401 device (which
is not very uncommon as this card requires two separate IRQs plus a third one
for MPU-401).
When MPU-401 PnP configuration fails (mostly because of unavailable IRQ), just
ignore MPU-401 and continue without it.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
My CMI8329 had OPL3 port specified in SB16 resources. But now I found out that
it was my modification of the card's PnP EEPROM a couple of years ago (can be
done using C9SETROM.EXE utility). I did it because the OPL3 port was
completely missing from PnP data. It seems to be hardwired to 0x388 on
CMI8329.
Find OPL3 port automatically by searching in WSS and SB16 resources. If not
found, assume that it's hardwired to 0x388.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add basic support for CMI8329 cards. Makes PCM and OPL3 work.
Does not break CMI8330 (tested).
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In ALSA 1.0.20, the comments were changed to say CMI8330 instead of AD1848.
The CMI8330 chip includes two codecs - AD1848 and SB16, so the comments were
correct and are misleading now. Revert them back.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 ISA sound drivers lack their __devexit_p() markers, which would
cause build failures when the kernel is built without hotplug support.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
Add module parameter to enable or disable
joystick port (gameport) on the SC6600 and
later cards.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Added SNDRV_PCM_INFO_BATCH flag to PCM info field of some drivers that
really don't give the precise pointer value.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The last patch to handle newer cards like SC7000
broke initialization of the SC6000. Fix this.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* topic/memdup_user:
ALSA: sound/pci: use memdup_user()
ALSA: sound/usb: use memdup_user()
ALSA: sound/isa: use memdup_user()
ALSA: sound/core: use memdup_user()
Add support for later cards based on CompuMedia ASC-9408 chipsets.
These cards were produced by Gallant.
This patch make the OSS aedsp16 driver redundant.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Always use request_firmware() for loading yss225_registers image.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Add ZV port control switch.
This patch is done after solution
given in the ALSA bug #2872 report.
The patch resolves the issue.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fix the OOPS during a opl3sa2 card suspend
and resume if the driver is loaded but the card
is not found.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Two simple fixes:
1. Use the same pointer for the free_irq() and
the request_irq() calls.
2. A short name of card is appended with '2' or '3'
character depending on a detected chip. Remove
the '2' character from the short name.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Since cs4232 and cs4236 drivers are merged, there is no reason to keep
snd-cs4236-lib module separately. Let's merge it into the main driver
as well.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
cs4232 and cs4236 driver merge to solve PnP BIOS detection.
Also, the patch adds recognition if the chip is cs4236b+
or earlier part. This unifies drivers for both cs4232
and cs4236+ chips. It allows to use the PnP BIOS
detection for the cs4236+ chips. Previously, only
the snd-cs4232 could be detected by the PnP BIOS.
The cs4232+ cards reports two separate PnP BIOS ids.
The patch adds search for the second id to find out
resources assigned to a control port.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The wss_base is disuised parameter for one function.
It is converted to function parameter.
The code_type is only set but never read.
It is removed.
The midi_vol is set only to 0 so it does not work
as detection of change in midi volume. It is fixed.
The xport variable is alias to the port[dev]. Use
the port[dev] directly to increase readability.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The missing module license generates warning
during module loading.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The ess1688 driver uses the same port
for PCM audio (SB compatible) and OPL3
synthesis. It is not always right so allow to
choose a different port for OPL3 synthesis.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This is driver for Turtle Beach Multisound cards:
Classic, Fiji and Pinnacle.
Tested pcm playback and recording and MIDI playback
on Multisound Pinnacle.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Most cards have OPL3 FM synthetiser but
they do not have OPL3 interrupt wired to
a sound chip or CPU.
Do not create OPL3 timers for such cards
as the timers are useless witthout interrupt.
This patch removes OPL3 timers for following
alsa drivers: snd-ad1816a, snd-opti93x,
snd-opti92x, snd-sc6000, snd-cmi8330.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>