Commit Graph

75 Commits

Author SHA1 Message Date
Rusty Russell a67ff6a540 ALSA: module_param: make bool parameters really bool
module_param(bool) used to counter-intuitively take an int.  In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option.  For this version
it'll simply give a warning, but it'll break next kernel version.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-19 10:34:41 +01:00
Paul Gortmaker 65a772172b sound: fix drivers needing module.h not moduleparam.h
The implicit presence of module.h lured several users into
incorrectly thinking that they only needed/used modparam.h
but once we clean up the module.h presence, these will show
up as build failures, so fix 'em now.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:31:19 -04:00
Clemens Ladisch dba8b46992 ALSA: mpu401: clean up interrupt specification
The semantics of snd_mpu401_uart_new()'s interrupt parameters are
somewhat counterintuitive:  To prevent the function from allocating its
own interrupt, either the irq number must be invalid, or the irq_flags
parameter must be zero.  At the same time, the irq parameter being
invalid specifies that the mpu401 code has to work without an interrupt
allocated by the caller.  This implies that, if there is an interrupt
and it is allocated by the caller, the irq parameter must be set to
a valid-looking number which then isn't actually used.

With the removal of IRQF_DISABLED, zero becomes a valid irq_flags value,
which forces us to handle the parameters differently.

This patch introduces a new flag MPU401_INFO_IRQ_HOOK for when the
device interrupt is handled by the caller, and makes the allocation of
the interrupt to depend only on the irq parameter.  As suggested by
Takashi, the irq_flags parameter was dropped because, when used, it had
the constant value IRQF_DISABLED.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-09-14 11:00:51 +02:00
Takashi Iwai 934c2b6d0c ALSA: use KBUILD_MODNAME for request_irq argument in sound/pci/*
The name argument of request_irq() appears in /proc/interrupts, and
it's quite ugly when the name entry contains a space or special letters.
In general, it's simpler and more readable when the module name appears
there, so let's replace all entries with KBUILD_MODNAME.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-10 16:36:37 +02:00
Takashi Iwai 3733e424c4 ALSA: Use KBUILD_MODNAME for pci_driver.name entries
The convention for pci_driver.name entry in kernel drivers seem to be
the module name or equivalent ones.  But, so far, almost all PCI sound
drivers use more verbose name like "ABC Xyz (12)", and these are fairly
confusing when appearing as a file name.

This patch converts the all pci_driver.name entries in sound/pci/* to
use KBUILD_MODNAME for more unified appearance.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-10 16:20:20 +02:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Clemens Ladisch 60c4ce4a0c ALSA: cmipci: use enum control info helper
Simplify info callbacks by using the snd_ctl_enum_info() helper function.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-01-10 16:47:00 +01:00
Clemens Ladisch 1c583063a5 ALSA: cmipci: work around invalid PCM pointer
When the CMI8738 FRAME2 register is read, the chip sometimes (probably
when wrapping around) returns an invalid value that would be outside the
programmed DMA buffer. This leads to an inconsistent PCM pointer that is
likely to result in an underrun.

To work around this, read the register multiple times until we get a
valid value; the error state seems to be very short-lived.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Reported-and-tested-by: Matija Nalis <mnalis-alsadev@voyager.hr>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-03-24 08:02:11 +01:00
Alexey Dobriyan cebe41d4b8 sound: use DEFINE_PCI_DEVICE_TABLE
Use DEFINE_PCI_DEVICE_TABLE() to make PCI device ids go to
.devinit.rodata section, so they can be discarded in some cases,
and make them const.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-02-09 11:08:33 +01:00
Jaroslav Kysela d355c82a01 ALSA: rename "PC Speaker" and "PC Beep" controls to "Beep"
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>
2009-11-05 09:00:18 +01:00
Joe Perches 28d27aae94 sound: Use PCI_VDEVICE
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-06-25 08:52:49 +02:00
Subrata Modak 395a434e39 ALSA: Fix Trivial Warnining in sound/pci/cmipci.c
Fixed the compile warning below by initializatin iomidi variable properly.
  sound/pci/cmipci.c: In function ‘snd_cmipci_probe’:
  sound/pci/cmipci.c:3017: warning: ‘iomidi’ may be used uninitialized in this function

Signed-off-by: Subrata Modak <subrata@linux.vnet.ibm.com>
Cc: linux-pci <linux-pci@atrey.karlin.mff.cuni.cz>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Sachin P Sant <sachinp@linux.vnet.ibm.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-04-27 13:53:13 +02:00
Takashi Iwai e58de7baf7 ALSA: Convert to snd_card_create() in sound/pci/*
Convert from snd_card_new() to the new snd_card_create() function
in sound/pci/*.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-12 15:20:55 +01:00
Takashi Iwai da3cec35dd ALSA: Kill snd_assert() in sound/pci/*
Kill snd_assert() in sound/pci/*, either removed or replaced with
if () with snd_BUG_ON().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-13 11:46:38 +02:00
Jeff Garzik f000fd8093 [ALSA] Fix synchronize_irq() bugs, redundancies
free_irq() calls synchronize_irq() for you, so there is no need for
drivers to manually do the same thing (again).  Thus, calls where
sync-irq immediately precedes free-irq can be simplified.

However, during this audit several bugs were noticed, where free-irq is
preceded by a "irq >= 0" check... but the sync-irq call is not covered
by the same check.

So, where sync-irq could not be eliminated completely, the missing check
was added.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:40 +02:00
Harvey Harrison 7dfa31ed5e [ALSA] sound: cmipci.c fix shadowed variable warning
A temporary variable for each mixer element is used in an initialization
loop, use the name elem_id.

sound/pci/cmipci.c:2747:26: warning: symbol 'id' shadows an earlier one
sound/pci/cmipci.c:56:13: originally declared here

[tiwai - fixed a coding style issue as well]

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:16 +02:00
Takashi Iwai 9004acc70e [ALSA] Remove sound/driver.h
This header file exists only for some hacks to adapt alsa-driver
tree.  It's useless for building in the kernel.  Let's move a few
lines in it to sound/core.h and remove it.
With this patch, sound/driver.h isn't removed but has just a single
compile warning to include it.  This should be really killed in
future.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:48 +01:00
Clemens Ladisch 25543fa785 [ALSA] cmipci: document 'Modem' control version check
Add a comment that explains why the 'Modem' control doesn't work with
newer chips.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:31 +01:00
Clemens Ladisch 69a07304d5 [ALSA] cmipci: disable 'Modem' control on version 39 or newer chips
On version 39 or newer chips, we better remove the 'Modem' control
because this register bit now mutes the front channels of the
multichannel stream.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:31 +01:00
Timofei Bondarenko b46be72728 [ALSA] cmipci - allow capture of raw spdif subframes
Enable capturing of raw 32bit IEC958_SUBFRAME.
The 24-bits PCM data can be obtained using iec958 plugin.
Known problem: captured stream may begin with either left or right
subframe. Since the iec958 plugin doesn't decode preamble it may swap
the channels sometime.

Signed-off-by: Timofei Bondarenko <tim@ipi.ac.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:19 +01:00
Timofei Bondarenko feb77712b0 [ALSA] cmipci - utilize ADC48K44K bit
Setting the ADC48K44K greatly improves capture quality at 48k sampling rate.
With this bit clear ADC does ZOH interpolation of every 22th sample at 48k.
At frequencies higher than 48k there ADC performs a little better with
ADC48K44K bit set.
At 44.1k ADC performs a little better with this bit clear.
At frequencies below 44.1k there is no difference.

Signed-off-by: Timofei Bondarenko <tim@ipi.ac.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:19 +01:00
Timofei Bondarenko 755c48abd8 [ALSA] cmipci at 96kHz
This patch adds support for 88.2k, 96k, and 128k samplerates
on cmi8738-55 chip.
Analog playback works fine on all channels.
Analog capture works well too, though the extra samples seems
interpolated by hardware.
spdif playback and capture works fine.

Signed-off-by: Timofei Bondarenko <tim@ipi.ac.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:15 +01:00
Clemens Ladisch 56c36ca3b2 [ALSA] cmipci: fix FLINKON/OFF bits
Fix the definitions of the CM_FLINKON/CM_FLINKOFF register bits that
were garbled in the last 'update register definitions' patch.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-11-19 18:38:32 +01:00
Clemens Ladisch c36fd8c3cd [ALSA] cmipci: fix distortion on rear channels
When playing multichannel data, the rear channels can get distorted if
the last sample of the last played stereo stream was not zero.  To avoid
this, add a hack to play a few silence samples after the stream is
stopped.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:36 +02:00
Clemens Ladisch ebe9e289d8 [ALSA] cmipci: clean up struct cmipci_pcm
Remove some unused field from the struct cmipci_pcm, and change the type
of some others to save some space.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:35 +02:00
Clemens Ladisch 0f28eca32b [ALSA] cmipci: fix lookup of double rates
When using one of the double sampling rates, use half the sample rate to
look up in the rates[] table, otherwise we stumble over the BUG().

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:34 +02:00
Clemens Ladisch 8ffbc01e2c [ALSA] cmipci: reorganize set_dac_channels()
By reorganizing the code that sets the CHB3DxC bits we can not only
simplify this code but also fix the bug where the CHB3D8C bit was not
reset when playing a stereo stream after a 7.1 stream.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:33 +02:00
Clemens Ladisch 35add1c295 [ALSA] cmipci: remove 5.0 format
Disallow playback of five channels because the hardware does not support
it (or nobody knows how to do it).

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:32 +02:00
Clemens Ladisch 22a22f5aac [ALSA] cmipci: allow 96 kHz playback on non-multichannel rear
Move the code that enables 96 kHz out of the if() that checks for
availability of both DMA channels so that it is enabled even when
another stream is playing on the front channels.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:31 +02:00
Clemens Ladisch 4ee7271718 [ALSA] cmipci: initialize 0x90 registers
Initialize the registers at 0x90 and 0x91 with some undocumented values.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:30 +02:00
Clemens Ladisch 3042ef7520 [ALSA] cmipci: reset the chip when initializing
When the chip is initialized, reset it.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:30 +02:00
Clemens Ladisch 54d030cc40 [ALSA] cmipci: show more registers in proc file
Show a dump of all registers in the 0x00-0x27 and 0x90-0x93 ranges in
the 'cmipci' proc file.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:29 +02:00
Clemens Ladisch a839a33d85 [ALSA] cmipci: update register definitions
Update comments for many register symbols, add some new register
symbols, and rename a few ones.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:28 +02:00
Clemens Ladisch 6935e68877 [ALSA] cmipci: fix version 37 detection
Use the proper value for the bit that identifies chip version 37.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:27 +02:00
Clemens Ladisch 57bd68b8b1 [ALSA] cmipci: add msbits constraint for 24-bit format
Add a msbits constraint to the SPDIF output device to indicate that
S32_LE samples use only 24 bits for data.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:49:14 +02:00
Clemens Ladisch b7e054a76f [ALSA] cmipci: show real chip name in card name
The '-MCx' suffix that is expected by alsa-lib is only needed in the
card driver string, so we can show the actual chip name in the
shortname.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:46 +02:00
Clemens Ladisch 88039815d8 [ALSA] cmipci: check that the legacy MIDI port works
Check that the UART_EN bit actually enabled the MPU-401 port.
Apparently, C-Media thinks that it is a good idea to be paranoid here.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:45 +02:00
Clemens Ladisch c78c950d28 [ALSA] cmipci: do not check for integrated FM/MIDI ports with chip version 37
Integrated MPU-401/OPL3 ports are available with chip version 39 and
later, so we do not test for the port with version 37.
Now that the test is known to work, we can again enable the MIDI port by
default.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:44 +02:00
Clemens Ladisch 8992e18db3 [ALSA] cmipci: add 96 kHz support
Add support for 88.2 kHz and 96 kHz analog and digital playback on
CMI8768/CMI8770 chips.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:43 +02:00
Clemens Ladisch f19a82a119 [ALSA] cmipci: remove invalid channels constraint
Remove the constraint that sets the channel limit for the first playback
device to that of the second one; the first device supports only stereo.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:42 +02:00
Clemens Ladisch d6426257d2 [ALSA] cmipci: show actual chip name in card longname
Show the actual name of CMI8762/CMI8768/CMI8769/CMI8770 chips in the
card longname instead of just using 'CMI8738' for all of them.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:30 +02:00
Clemens Ladisch b080ebbf92 [ALSA] cmipci: remove has_dual_dac
Remove the has_dual_dac variable because it was always set.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:29 +02:00
Clemens Ladisch 133271fef5 [ALSA] cmipci: reorganize chip version detection
Add a case for chip version 39 where no bit is set in register 0Ch, and
move the detection of version 39 before that of 8768.  This makes the
logic more compatible with the driver on that other OS.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:28 +02:00
Clemens Ladisch c9116ae45b [ALSA] cmipci: make the test for integrated MIDI port address more robust
Unused bytes in the I/O register range are likely to have the value 0x00
instead of 0xff, so test against both values when checking for the
presence of the integrated MIDI port.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:27 +02:00
Clemens Ladisch 45c41b4868 [ALSA] cmipci: fix handling of FM/MIDI port addresses
Make sure that the MPU-401 MIDI and OPL-3 FM devices are used only on
those chips where they are supported, and that the correct port
addresses are used.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:22 +02:00
Clemens Ladisch 1e02d6ea85 [ALSA] cmipci: fix MIDI device name
Initialize card->shortname early enough so that the MIDI device can pick
it up and does not need to have a generic name.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:20 +02:00
Takashi Iwai a5ce88909d [ALSA] Clean up with common snd_ctl_boolean_*_info callbacks
Clean up codes using the new common snd_ctl_boolean_*_info() callbacks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:57:45 +02:00
Takashi Iwai 2f24d159d5 [ALSA] cmipci - Allow to disable integrated FM port
The driver didn't allow to disable the integrated FM port (if available),
and this annoyed people who don't want FM port.  Now fm_port=0 disables
the FM port unconditionally.  fm_port=1 is used for enabling the integrated
FM port (as default).
Also fixed the documentation about this option.
Fix ALSA bug#2491.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-03-06 11:03:53 +01:00
Timofei V. Bondarenko 8c67071422 [ALSA] _snd_cmipci_uswitch_put doesn't set zero flags
Playing with spdif output on cmipci i've noticed the SPDO5V option does
not change appropriate bits the register.
The _snd_cmipci_uswitch_put checks the change in flags in wrong way.
If 'active' state of an option corresponds to a _zero_ bits in a hw
register then function fails. The SPDO5V is the sample.
In the most cases 'active' state of option is set through an non-zerio
bits in a register. This case works fine.
The fix attached.
Unfortunately i was unable to change spdif output voltage anyway.
Although the register changes right at least.
From: Timofei V. Bondarenko <tim@ipi.ac.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-01-09 09:06:18 +01:00
Takashi Iwai 437a5a4606 [ALSA] Remove IRQF_DISABLED for shared PCI irqs
Fix IRQ flags for PCI devices.
The shared IRQs for PCI devices shouldn't be allocated with
IRQF_DISABLED.  Also, when MSI is enabled, IRQF_SHARED shouldn't
be used.
The patch removes unnecessary cast in request_irq and free_irq,
too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-12-20 08:55:57 +01:00