Commit Graph

72 Commits

Author SHA1 Message Date
Leon Romanovsky 6417f03132 module: remove never implemented MODULE_SUPPORTED_DEVICE
MODULE_SUPPORTED_DEVICE was added in pre-git era and never was
implemented. We can safely remove it, because the kernel has grown
to have many more reliable mechanisms to determine if device is
supported or not.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-03-17 13:16:18 -07:00
Takashi Iwai 669f65eaeb ALSA: pci: Simplify with dma_set_mask_and_coherent()
Many PCI drivers still have two explicit calls of dma_set_mask() and
dma_set_coherent_mask().

Let's simplify with dma_set_mask_and_coherent().

Link: https://lore.kernel.org/r/20210114125412.993-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-01-15 11:17:00 +01:00
Pierre-Louis Bossart 8068a5814f ALSA: pci/es1938: remove 'set but not used' warning
Fix W=1 warning. Mark the 'audiostatus' variable as __always_unused.

sound/pci/es1938.c: In function ‘snd_es1938_interrupt’:
sound/pci/es1938.c:1622:24: warning: variable ‘audiostatus’ set but
not used [-Wunused-but-set-variable]
 1622 |  unsigned char status, audiostatus;
      |                        ^~~~~~~~~~~

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200702193604.169059-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-07-07 12:11:59 +02:00
Takashi Iwai 96d5ebf25e ALSA: es1938: More constifications
Apply const prefix to the static register table and its callers.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-35-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:54 +01:00
Takashi Iwai b4e5e70775 ALSA: pci: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-38-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:28 +01:00
Takashi Iwai efb0ad25d3 ALSA: pci: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:23:56 +01:00
Takashi Iwai 6b276e6281 ALSA: es1938: Support PCM sync_stop
The driver invokes snd_pcm_period_elapsed() simply from the interrupt
handler.  Set card->sync_irq for enabling the missing sync_stop PCM
operation.  It's cleared and reset dynamically at IRQ re-acquiring for
the PM resume, too.

Link: https://lore.kernel.org/r/20191210063454.31603-19-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-11 07:25:45 +01:00
Takashi Iwai d34e1b7b9a ALSA: pci: Drop superfluous ioctl PCM ops
PCM core deals the empty ioctl field now as default(*).
Let's kill the redundant lines.

(*) commit fc033cbf6f ("ALSA: pcm: Allow NULL ioctl ops")

Link: https://lore.kernel.org/r/20191210061145.24641-16-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-11 07:25:31 +01:00
Takashi Iwai d244a1db6f ALSA: es1938: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API.
The hw_params and hw_free callbacks became superfluous and got
dropped.

Link: https://lore.kernel.org/r/20191209094943.14984-39-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-11 07:25:11 +01:00
Takashi Iwai 6974f8ad44 ALSA: pci: Avoid non-standard macro usage
Pass the device pointer from the PCI pointer directly, instead of a
non-standard macro.  The macro didn't give any better readability.

Link: https://lore.kernel.org/r/20191105151856.10785-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-06 15:47:43 +01:00
Thomas Gleixner 1a59d1b8e0 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation either version 2 of the license or at
  your option any later version this program is distributed in the
  hope that it will be useful but without any warranty without even
  the implied warranty of merchantability or fitness for a particular
  purpose see the gnu general public license for more details you
  should have received a copy of the gnu general public license along
  with this program if not write to the free software foundation inc
  59 temple place suite 330 boston ma 02111 1307 usa

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 1334 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30 11:26:35 -07:00
Takashi Iwai 17bc4815de ALSA: pci: Remove superfluous snd_pcm_suspend*() calls
The call of snd_pcm_suspend_all() & co became superfluous since we
call it in the PCM PM ops.  Let's remove them.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-15 17:47:15 +01:00
Bhumika Goyal dee49895b1 ALSA: pci: make snd_pcm_hardware const
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-08-12 23:31:58 +02:00
Takashi Iwai 44d715074d ALSA: es1938: Constify hw_constraints
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-06-09 10:42:52 +02:00
Takashi Iwai b96c3a1556 ALSA: es1938: Convert to the new PCM copy ops
Replace the copy ops with the new copy_user and copy_kernel ops.
It's used only for a capture stream (for some hardware workaround),
thus we need no silence operation.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-02 19:37:57 +02:00
Fabian Frederick b2fac07303 ALSA: pci: don't opencode IS_REACHABLE()
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-13 21:33:41 +01:00
Julia Lawall 6769e988b0 ALSA: constify snd_pcm_ops structures
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-09-02 11:49:10 +02:00
Quentin Lambert 412b979ccc ALSA: remove deprecated use of pci api
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-16 12:19:52 +02:00
Takashi Iwai 6cbbfe1c8d ALSA: Include linux/io.h instead of asm/io.h
Nowadays it's recommended.  Replace all in a shot.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-01-28 16:49:33 +01:00
Takashi Iwai 8c36982191 ALSA: es1938: Simplify PM callbacks
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-09 16:24:21 +01:00
Takashi Iwai 6b6b295e80 ALSA: es1938: Use snd_ctl_enum_info()
... and reduce the open codes.  Also add missing const to the text array.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-10-21 08:59:59 +02:00
Benoit Taine 9baa3c34ac PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use
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-08-12 12:15:14 -06:00
Takashi Iwai ebebecaa0a ALSA: es1938: Use standard printk helpers
Convert with dev_err() and co from snd_printk(), etc.
Some debug prints are replaced with dev_dbg(), too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-26 16:45:17 +01:00
Takashi Iwai 60c5772b50 ALSA: pci: Convert to snd_card_new() with a device pointer
Also remove superfluous snd_card_set_dev() calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-12 11:17:52 +01:00
Takashi Iwai 20a24225d8 ALSA: PCI: Remove superfluous pci_set_drvdata(pci, NULL) at remove
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-05-29 12:37:32 +02:00
Bill Pemberton e23e7a1436 ALSA: pci: remove __dev* attributes
CONFIG_HOTPLUG is going away as an option.  As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-12-07 07:20:55 +01:00
Takashi Iwai c7561cd804 ALSA: PCI: Replace CONFIG_PM with CONFIG_PM_SLEEP
Otherwise we may get compile warnings due to unused functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-14 18:12:04 +02:00
Takashi Iwai 1558eb838f Merge branch 'topic/pm-convert' into for-next
This merges the changes for converting to new PM ops for platform
and some other drivers.
Also move some header files to local places from the public
include/sound.
2012-07-19 08:21:57 +02:00
Clemens Ladisch 093eef4166 ALSA: es1938: replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE
Instead of the hard-to-mantain TLV_DB_RANGE_HEAD macro, use
DECLARE_TLV_DB_RANGE, which computes its size automatically.

(Also make this data const on the way.)

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-07-16 10:02:19 +02:00
Takashi Iwai 68cb2b5592 ALSA: Convert to new pm_ops for PCI drivers
Straightforward conversion to the new pm_ops from the legacy
suspend/resume ops.

Since we change vx222, vx_core and vxpocket have to be converted,
too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-07-03 08:23:03 +02:00
Takashi Iwai e9f66d9b9c ALSA: pci: clean up using module_pci_driver()
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-04-24 12:25:00 +02:00
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
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
Yang Hongyang 2f4f27d42a dma-mapping: replace all DMA_24BIT_MASK macro with DMA_BIT_MASK(24)
Replace all DMA_24BIT_MASK macro with DMA_BIT_MASK(24)

Signed-off-by: Yang Hongyang<yanghy@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-04-07 08:31:12 -07:00
Takashi Iwai e0d2054fd3 Merge branch 'topic/misc' into for-linus 2009-03-24 00:35:50 +01:00
Takashi Iwai ee419653a3 ALSA: Fix missing KERN_* prefix to printk in sound/pci
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-05 16:11:31 +01: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
Hermann Lauer 19e2e3c304 [ALSA] es1938 - improve capture hw pointer reads
With the Solo1 (es1938) I got a lot of xrun's during capture on my machine.
Tracing that down it seems to be comming from reading ocassionaly bad hw
pointers from the chip.  This patch uses more checking to avoid that false
pointer reads.
Failed reads are giving back the last good value read instead of spinning in
a tight loop, which seems more appropriate to me in an interrupt. I think I
saw this trick used in another driver

Signed-off-by: Hermann Lauer <Hermann.Lauer@iwr.uni-heidelberg.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:23 +01: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
Jaroslav Kysela c1017a4cdb [ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-10-16 16:51:18 +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 0cb29ea0d4 [ALSA] Add even more 'const' to everything related to TLV
Mark TLV data as 'const'
Signed-of-by: Philipp Matthias Hahn <pmhahn@pmhahn.de>

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:03:19 +01:00