aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1 (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-08-22Merge branch 'for-linus' into for-nextTakashi Iwai1-3/+11
Conflicts: sound/core/control.c
2017-08-18ALSA: emu10k1: Fix forgotten user-copy conversion in init codeTakashi Iwai1-3/+11
The commit d42fe63d5839 ("ALSA: emu10k1: Get rid of set_fs() usage") converted the user-space copy hack with set_fs() to the direct memcpy(), but one place was forgotten. This resulted in the error from snd_emu10k1_init_efx(), eventually failed to load the driver. Fix the missing piece. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196687 Fixes: d42fe63d5839 ("ALSA: emu10k1: Get rid of set_fs() usage") Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-12ALSA: emu10k1: make snd_pcm_hardware constBhumika Goyal3-9/+9
Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-12ALSA: seq: Allow the modular sequencer registrationTakashi Iwai1-1/+1
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-09ALSA: emu10k1: Constify hw_constraintsTakashi Iwai1-4/+4
snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-25ALSA: emu10k1: Deliver indirect-PCM transfer errorTakashi Iwai1-2/+2
Now that the indirect-PCM transfer helper gives back an error, we should return the error from ack callbacks. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-17ALSA: emu10k1: Get rid of set_fs() usageTakashi Iwai1-54/+73
Instead of set_fs() hackery, do the straight memcpy() by passing a flag indicating the kernel space operation. Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-21ALSA: pci: constify snd_kcontrol_new structuresBhumika Goyal3-19/+19
Declare snd_kcontrol_new structures as const as they are only passed as an argument to the function snd_ctl_new1. This argument is of type const, so snd_kcontrol_new structures having the same property can be made const too. Done using Coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct snd_kcontrol_new i@p = {...}; @ok1@ identifier r1.i; position p; expression e1; @@ snd_ctl_new1(&i@p,e1) @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct snd_kcontrol_new i; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-19ALSA: emu10k1: constify snd_emux_operators structureBhumika Goyal1-1/+1
Declare snd_emux_operators structure as const as it is only copied into another structure. So, snd_emux_operators structures having this property can be made const. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-01-12ALSA: pci: Constify snd_rawmidi_opsTakashi Iwai2-4/+4
Now snd_rawmidi_ops is maintained as a const pointer in snd_rawmidi, we can constify the definitions. Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-15ALSA: emu10k1: Use workqueue instead of kthread for emu1010 fw pollingTakashi Iwai2-76/+65
This patch is a cleanup of EMU1010 dock probing code in emu10k1 driver to use work instead of kthread in a loop. The work is lighter and easier to control than kthread, in general. Instead of a loop with the explicit sleep, we do simply delayed-schedule the work. At suspend/resume callbacks, the work is canceled and restarted, respectively. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-15ALSA: emu10k1: Simplify firmware loader codeTakashi Iwai1-62/+40
The EMU1010 support in emu10k1 driver has two request_firmware() calls, one for the main board and one for the dock. Both call patterns are fairly similar, and we can simplify it by introducing a helper function and a table instead of the open switch/case. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-15ALSA: emu10k1: Fix emu1010 dock attach checkTakashi Iwai1-6/+6
The emu1010_firmware_thread() checks the previous dock status, but a wrong register is recorded as the last status when the dock is plugged in. Usually this isn't a big issue since this value gets overwritten by the next loop after one second. But when a dock is unplugged immediately after plugging, it means essentially missing undock handling. This patch addresses it by remembering the correct register value. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-13ALSA: pci: don't opencode IS_REACHABLE()Fabian Frederick1-1/+1
Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-09-07ALSA: squash lines for simple wrapper functionsMasahiro Yamada1-12/+4
Remove unneeded variables and assignments. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-09-02ALSA: constify snd_pcm_ops structuresJulia Lawall3-10/+10
Check for snd_pcm_ops structures that are only stored in the ops field of a snd_soc_platform_driver structure or passed as the third argument to snd_pcm_set_ops. The corresponding field or parameter is declared const, so snd_pcm_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct snd_pcm_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_platform_driver e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i; expression e1, e2; position p; @@ snd_pcm_set_ops(e1, e2, &i@p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_pcm_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_pcm_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-01-29ALSA: emu10k1: correctly handling failed thread creationInsu Yun1-0/+8
Since kthread_create can be failed, it needs to check whether error occurred and return error code. Signed-off-by: Insu Yun <wuninsu@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-08ALSA: emu10k1: rename Audigy Analog Capture Boost controlMaciej S. Szmigiero1-1/+1
Audigy has "Analog Capture Boost" mixer control, however now this only controls mic level, not other analog sources. It applies also both to playback and capture, so rename it to something more descriptive. Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-08ALSA: emu10k1: enable TAD mic out on AudigyMaciej S. Szmigiero1-5/+7
Enable TAD output on Audigy naming it "Phone Output", to be consistent with TAD input which is called "Phone". According to Creative doc ( http://support.creative.com/kb/ShowArticle.aspx?sid=3026 ) this should output just mic signal. Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-08ALSA: emu10k1: remove unused AC'97 mixer controls on AudigyMaciej S. Szmigiero1-5/+6
AC'97 Headphone output and EAPD control aren't used on Audigy so remove them from mixer. Also remove AC'97 3D control as the driver is already doing for Audigys with 1361T ADC. Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-29ALSA: emu10k1: Fix/cleanup ifdef CONFIG_PROC_FSTakashi Iwai3-4/+3
Build emuproc.o conditionally and drop the unneeded ifdefs. Some are replaced with the new CONFIG_SND_PROC_FS. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-29Merge branch 'for-linus' into for-nextTakashi Iwai4-13/+21
Conflicts: sound/pci/emu10k1/emu10k1_main.c Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-29ALSA: emu10k1: Emu10k2 32 bit DMA modePeter Zubaj4-13/+21
Looks like audigy emu10k2 (probably emu10k1 - sb live too) support two modes for DMA. Second mode is useful for 64 bit os with more then 2 GB of ram (fixes problems with big soundfont loading) 1) 32MB from 2 GB address space using 8192 pages (used now as default) 2) 16MB from 4 GB address space using 4096 pages Mode is set using HCFG_EXPANDED_MEM flag in HCFG register. Also format of emu10k2 page table is then different. Signed-off-by: Peter Zubaj <pzubaj@marticonet.sk> Tested-by: Takashi Iwai <tiwai@suse.de> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-27Merge branch 'for-4.2' into for-nextTakashi Iwai1-2/+2
2015-04-27ALSA: emu10k1: Fix card shortname string buffer overflowTakashi Iwai2-4/+6
Some models provide too long string for the shortname that has 32bytes including the terminator, and it results in a non-terminated string exposed to the user-space. This isn't too critical, though, as the string is stopped at the succeeding longname string. This patch fixes such entries by dropping "SB" prefix (it's enough to fit within 32 bytes, so far). Meanwhile, it also changes strcpy() with strlcpy() to make sure that this kind of problem won't happen in future, too. Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16ALSA: remove deprecated use of pci apiQuentin Lambert1-2/+2
Replace occurences of the pci api by appropriate call to the dma api. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr) @deprecated@ idexpression id; position p; @@ ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @bad1@ idexpression id; position deprecated.p; @@ ...when != &id->dev when != pci_get_drvdata ( id ) when != pci_enable_device ( id ) ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @depends on !bad1@ idexpression id; expression direction; position deprecated.p; @@ ( - pci_dma_supported@p ( id, + dma_supported ( &id->dev, ... + , GFP_ATOMIC ) | - pci_alloc_consistent@p ( id, + dma_alloc_coherent ( &id->dev, ... + , GFP_ATOMIC ) ) Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-13Merge branch 'for-next' into for-linusTakashi Iwai3-20/+158
2015-04-11ALSA: emu10k1: add toggles for E-mu 1010 optical portsMichael Gernoth1-0/+118
The optical ports on the E-mu 1010 (and dock) can be configured for ADAT- or S/PDIF-mode, which is currently hardcoded to ADAT. Add two mixer elements to expose this setting. Tested on an E-mu 1010 PCIe with connected Micro Dock. Signed-off-by: Michael Gernoth <michael@gernoth.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-11ALSA: emu10k1: handle dock disconnectsMichael Gernoth1-0/+9
When the dock on an E-mu 1010 card is disconnected, all outputs get muted by the hardware. Add logic to detect a disconnect and unmute. Signed-off-by: Michael Gernoth <michael@gernoth.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-10ALSA: emu10k1: don't deadlock in proc-functionsMichael Gernoth1-12/+0
The functions snd_emu10k1_proc_spdif_read and snd_emu1010_fpga_read acquire the emu_lock before accessing the FPGA. The function used to access the FPGA (snd_emu1010_fpga_read) also tries to take the emu_lock which causes a deadlock. Remove the outer locking in the proc-functions (guarding only the already safe fpga read) to prevent this deadlock. [removed superfluous flags variables too -- tiwai] Signed-off-by: Michael Gernoth <michael@gernoth.net> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-05ALSA: emu10k1: add Audigy 5/RxMichael Gernoth1-0/+16
The Audigy 5/Rx is essentially an Audigy 4 behind a PLX PCIe- bridge with an additional TOSLINK output. Signed-off-by: Michael Gernoth <michael@gernoth.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-12ALSA: seq: Define driver object in each driverTakashi Iwai1-20/+15
This patch moves the driver object initialization and allocation to each driver's module init/exit code like other normal drivers. The snd_seq_driver struct is now published in seq_device.h, and each driver is responsible to define it with proper driver attributes (name, probe and remove) with snd_seq_driver specific attributes as id and argsize fields. The helper functions snd_seq_driver_register(), snd_seq_driver_unregister() and module_snd_seq_driver() are used for simplifying codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-11Merge branch 'topic/pci-cleanup' into for-nextTakashi Iwai1-15/+0
2015-01-09ALSA: emu10k1: Simplify PM callbacksTakashi Iwai1-15/+0
This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801: PCI core handles power state for us]. Since pci_set_power_state(), pci_save_state() and pci_restore_state() are already done in the PCI core side, so we don't need to it doubly. Also, pci_enable_device(), pci_disable_device() and pci_set_master() calls in PM callbacks are superfluous nowadays, too, so get rid of them as well. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-04ALSA: emu10k1: Delete an unnecessary check before the function call "kfree"Markus Elfring1-5/+2
The kfree() 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>
2015-01-02ALSA: emu10k1: Remove always NULL parametersLars-Peter Clausen5-61/+17
The various PCM and hwdep allocation functions in this driver take a pointer to a pointer of a PCM/hwdep where if this parameter is provided the newly allocated object is stored. All callers pass NULL though, so remove the parameter. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-11ALSA: Fix invalid kerneldoc markersTakashi Iwai1-1/+1
They are no real kerneldoc comments, so drop such markers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-03ALSA: emu10k1: Deletion of unnecessary checks before three function callsMarkus Elfring2-8/+4
The functions kfree(), release_firmware() and snd_util_memhdr_free() test whether their argument is NULL and then return 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>
2014-10-21ALSA: emu10k1: Use snd_ctl_enum_info()Takashi Iwai2-61/+17
... and reduce the open codes. Also add missing const to text arrays. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-10-14ALSA: emu10k1: Fix deadlock in synth voice lookupTakashi Iwai1-4/+2
The emu10k1 voice allocator takes voice_lock spinlock. When there is no empty stream available, it tries to release a voice used by synth, and calls get_synth_voice. The callback function, snd_emu10k1_synth_get_voice(), however, also takes the voice_lock, thus it deadlocks. The fix is simply removing the voice_lock holds in snd_emu10k1_synth_get_voice(), as this is always called in the spinlock context. Reported-and-tested-by: Arthur Marsh <arthur.marsh@internode.on.net> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-08-12PCI: Remove DEFINE_PCI_DEVICE_TABLE macro useBenoit Taine2-2/+2
We should prefer `struct pci_device_id` over `DEFINE_PCI_DEVICE_TABLE` to meet kernel coding style guidelines. This issue was reported by checkpatch. A simplified version of the semantic patch that makes this change is as follows (http://coccinelle.lip6.fr/): // <smpl> @@ identifier i; declarer name DEFINE_PCI_DEVICE_TABLE; initializer z; @@ - DEFINE_PCI_DEVICE_TABLE(i) + const struct pci_device_id i[] = z; // </smpl> [bhelgaas: add semantic patch] Signed-off-by: Benoit Taine <benoit.taine@lip6.fr> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2014-03-05ALSA: emu10k1: Fix possible NULL dereferenceTakashi Iwai1-4/+1
The previous dev_err() conversion resulted in a code that may give NULL dereference in snd_emu10k1_ptr_write(). Since it's a sanity check, better to be replaced with a debug macro like other places in this driver. Fixes: 6f002b02166c ('ALSA: emu10k1: Use standard printk helpers') Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-26ALSA: emu10k1: Use standard printk helpersTakashi Iwai13-93/+137
Convert with dev_err() and co from snd_printk(), etc. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-26ALSA: emu10k1x: Use standard printk helpersTakashi Iwai1-9/+18
Convert with dev_err() and co from snd_printk(), etc. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-12ALSA: pci: Convert to snd_card_new() with a device pointerTakashi Iwai3-5/+4
Also remove superfluous snd_card_set_dev() calls. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-18ALSA: emu10k1: code refactoringGeyslan G. Bem1-31/+45
Partially restructures _snd_emu10k1_audigy_init_efx() and _snd_emu10k1_init_efx() functions. Be noted that the cast is demanded to use '__user'. So, in these cases, avoid patches based on the coccinelle 'drop_kmalloc_cast' semantic patch. Signed-off-by: Geyslan G. Bem <geyslan@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-29ALSA: PCI: Remove superfluous pci_set_drvdata(pci, NULL) at removeTakashi Iwai2-2/+0
As drvdata is cleared to NULL at probe failure or at removal by the driver core, we don't have to call pci_set_drvdata(pci, NULL) any longer in each driver. The only remaining pci_set_drvdata(NULL) is in azx_firmware_cb() in hda_intel.c. Since this function itself releases the card instance, we need to clear drvdata here as well, so that it won't be released doubly in the remove callback. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-24ALSA: emu10k1: Fix dock firmware loadingTakashi Iwai1-6/+33
The commit [b209c4df: ALSA: emu10k1: cache emu1010 firmware] broke the firmware loading of the dock, just (mistakenly) ignoring a different firmware for docks on some models. This patch revives them again. Bugzilla: https://bugs.archlinux.org/task/34865 Reported-and-tested-by: Tobias Powalowski <tobias.powalowski@googlemail.com> Cc: <stable@vger.kernel.org> [v3.8+] Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-25ALSA: emu10k1: Allow to switch hardware sampe rate on EMUMihail Zenkov1-2/+6
Commit 57e5c63007955838043e34c732d224b2cbbb128f "emu10k1: allow to disable the SRC" force hardware use only one rate (48000 hz). EMU 0404/1010/1616 have support two hardware sampling rates (44100 and 48000 hz). This patch add check if we have EMU 0404/1010/1616 and choose correct sample rate to restrict. Signed-off-by: Mihail Zenkov <mihail.zenkov@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-25ALSA: emu10k1: Load firmware when it was already cachedFlorian Zeitz1-5/+6
This expands the regression fix from d28215996b0c3a900411769039aa3c54cf7008ab. The firmware also needs to be loaded when it was already cached. Signed-off-by: Florian Zeitz <florob@babelmonkeys.de> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>