Commit Graph

46 Commits

Author SHA1 Message Date
Eldad Zack 167d0a11d5 ALSA: asihpi: add format support check in snd_card_asihpi_capture_formats
Some Asihpi formats are not supported or invalid, and their mapping to
ALSA format is set to -1.
Before performing the format conversion into ALSA bitwise formats,
add a consistency check for the requested format, as done in
snd_card_asihpi_playback_formats().

Compile tested only.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-29 13:37:33 +02:00
Eldad Zack 74c34ca1cc ALSA: pcm_format_to_bits strong-typed conversion
Add a function to handle conversion from snd_pcm_format_t
to bitwise with proper typing.

Change such conversions to use this function and silence sparse
warnings.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-29 13:36:15 +02:00
Wei Yongjun 2e9b9a3c24 ALSA: asihpi - fix potential NULL pointer dereference
The dereference should be moved below the NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-03-12 08:34:36 +01: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
Peter Senna Tschudin 395d9dd5dd sound: Remove unnecessary semicolon
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r1@
statement S;
position p,p1;
@@
S@p1;@p

@script:python r2@
p << r1.p;
p1 << r1.p1;
@@
if p[0].line != p1[0].line_end:
        cocci.include_match(False)
@@
position r1.p;
@@
-;@p
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-06 16:47:53 +02: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 74eeb141d3 ALSA: asihpi - Fix potential Oops in snd_asihpi_cmode_info()
Dan Carpenter reported that setting 0 to uinfo->value.enumerated.items
in snd_asihpi_cmode_info() may lead to Oops.  This function should
return an error immediately in such a case instead.

Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-01-09 18:27:54 +01:00
Eliot Blennerhassett 68d5339322 ALSA: asihpi - Fix format validity check.
Sharing and not reinitialising static pcm_hardware struct resulted in
stream format validity flags being incorrectly shared between cards.
Fix and clarify by declaring locally and initialising in the open functions.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-22 08:13:11 +01:00
Eliot Blennerhassett c1d70dd9c4 ALSA: asihpi - Use valid channel count in format enumeration.
Since introduction of mono and low latency modes, fixed channel count of 2
is not always valid.  Use reported max_channels instead.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-22 08:13:10 +01:00
Eliot Blennerhassett f50efa2d9b ALSA: asihpi - Add HPI version to module description.
It is useful to know the HPI version without having to load the module,
in order to determine the matching firmware version.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-22 08:13:09 +01:00
Eliot Blennerhassett 7036b92d30 ALSA: asihpi - Remove redundant struct members.
Structs hpi_adapter and snd_card_asihpi had members that
duplicate those in underlying hpi_adapter_obj or whose info
can be retrieved using hpi_adapter_get_info().

Print less info in probe function, it can be retrieved from /proc.

Avoid name redundancy: hpi_adapter_obj.adapter_type renamed to .type

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-22 08:13:05 +01:00
Eliot Blennerhassett 502f271ae3 ALSA: asihpi - Update node types.
Add "Internal" node type.
Remove GPI and GPO node types.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-22 08:13:02 +01:00
Eliot Blennerhassett 09c728aced ALSA: asihpi - Only set sync if card supports hardware stream grouping.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-22 08:13:02 +01:00
Eliot Blennerhassett 0be55c453f ALSA: asihpi - Relax drained check for more reliable playback startup.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-22 08:13:01 +01:00
Eliot Blennerhassett cbd757daf5 ALSA: asihpi - Use snd_pcm_debug_name to get substream name.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-22 08:12:59 +01:00
Eliot Blennerhassett d4b06d23ab ALSA: asihpi - Volumes and meters may have 1 or 2 channels.
The channel count can be queried to determine which.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-22 08:12:58 +01:00
Eliot Blennerhassett c382a5da5c ALSA: asihpi - Low latency mode stream has fixed channel count.
Unlike other streams which support 1..max channels,

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-22 08:12:58 +01:00
Eliot Blennerhassett 47a74a5d1e ALSA: asihpi - fix pcm dma pointer tracking
Elapsed counter should only count data committed to snd_pcm_period_elapsed,
rather than all data available

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-12-22 08:12:52 +01: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 da155d5b40 sound: Add module.h to the previously silent sound users
Lots of sound drivers were getting module.h via the implicit presence
of it in <linux/device.h> but we are going to clean that up.  So
fix up those users now.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:31:21 -04:00
Eliot Blennerhassett acb03d440b ALSA: Make snd_pcm_debug_name usable outside pcm_lib
Formatting a PCM name is useful for module debug too.
Add snd_prefix when making function public.

[minor coding-style fixes by tiwai]

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-24 13:34:32 +02:00
Takashi Iwai 7d339ae997 Merge branch 'topic/misc' into for-linus 2011-07-22 08:43:24 +02:00
Takashi Iwai 000477a0fe ALSA: asihpi - Replace with snd_ctl_boolean_mono_info()
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-22 07:57:44 +02:00
Eliot Blennerhassett fe0aa88eec ALSA: asihpi - Add volume mute controls
Mute functionality was recently added to the DSP firmware

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-22 07:54:20 +02:00
Eliot Blennerhassett c830613574 ALSA: asihpi - Control name updates
Add names corresponding to new HPI node types.
Shorten some names so that constructed names don't overflow the
maximum name length.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-22 07:53:45 +02:00
Eliot Blennerhassett 0a17e99307 ALSA: asihpi - Revise snd_pcm_debug_name, get rid of DEBUG_NAME macro
Work towards moving the function into alsa common header.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-07-22 07:50:03 +02:00
Jesper Juhl 16866741bd ALSA: Remove unneeded version.h includes from sound/
In the sound/ directory there are two files (flagged by 'make
versioncheck'); sound/pci/asihpi/asihpi.c and
sound/soc/codecs/wm8991.c that include linux/version.h although they
don't need it. This patch removes the unneeded includes.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-24 11:28:17 +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
Takashi Iwai 02e5fbf622 Merge branch 'topic/misc' into for-linus 2011-05-22 10:01:29 +02:00
Eliot Blennerhassett b0096a6567 ALSA: asihpi: Standardise substream name generation
Define and use pcm_debug_name if CONFIG_SND_DEBUG

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-05 11:47:54 +02:00
Eliot Blennerhassett f3d145aac9 ALSA: asihpi: MMAP for non-busmaster cards
Allow older non DMA capable cards to use MMAP by
emulating the DMA using read and write functions,
and getting rid of copy & silence callbacks that
were used only by older cards.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-05 11:47:25 +02:00
Eliot Blennerhassett 0b7ce9e2bd ALSA: asihpi: Handle playback drained status better
Use the card drained status reporting for playback,
but allow it to persist for a few timer cycles before
signalling XRUN, to allow card to recover by itself.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-05 11:47:08 +02:00
Eliot Blennerhassett a6477134db ALSA: asihpi: Update debug printing
Debug print full substream ID.
Other minor debug print updates.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-05 11:46:48 +02:00
Eliot Blennerhassett 550ac6ba4e ALSA: snd-asihpi: Control naming
Clock source is neither capture nor playback,
so change 'Capture Clock' to 'Clock'.
Add spaces to control name string for consistency,
always 'PCM 0' , never 'PCM0'

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-05 11:46:06 +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
Eliot Blennerhassett b2e65c8e91 ALSA: asihpi - Update verbose debug print macros
Replace local VPRINTK1 with snd_printdd.
Create local snd_printddd instead of VPRINTK2 for most verbose debug.
In most cases let snd_printk supply default level for messages.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-25 12:43:15 +01:00
Eliot Blennerhassett 26aebef420 ALSA: asihpi - Improve non-busmaster adapter operation
Make playback silence callback a no-op, card automatically outputs
silence when written data runs out.
Increasing update interval and thus minimum period avoids xrun on startup
or because of timer jitter.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-25 12:42:45 +01:00
Eliot Blennerhassett 7bf76c33e9 ALSA: asihpi - Support single-rate no-SRC cards
Cards without settable local samplerate and without SRC
still must have a valid samplerate.
This fixed rate is determined by reading the current rate for the card.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-25 12:42:26 +01:00
Eliot Blennerhassett c4ed97d9e7 ALSA: asihpi - Fix outstream start trigger for non-mmap adapters.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-10 18:49:40 +01:00
Eliot Blennerhassett 1225367a48 ALSA: asihpi - Add snd_card_set_dev to init.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-10 18:49:32 +01:00
Eliot Blennerhassett ba94455c29 ALSA: asihpi - Remove unused subsys pointer from all HPI functions.
asihpi.c don't link playback and capture streams, there is too much
offset between them.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-10 18:49:26 +01:00
Eliot Blennerhassett e64b1a28c5 ALSA: asihpi - Rewrite PCM timer function. Update control names.
Reported samples_played from card may be inaccurate, so don't use it.
Update control names to be closer to alsa standard practice.
Also fixed some accidentally lowercased strings.

[Removed adriver.h inclusion for external module builds by tiwai]

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-10 18:48:51 +01:00
Kulikov Vasiliy 315e8f7501 ALSA: asihpi: fix sign bug
bytes_per_sec is unsigned, so if snd_pcm_format_width() return error we
would not see it.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-07-16 08:30:08 +02:00
Eliot Blennerhassett 168f1b07cc ALSA: asihpi - HPI API updates
Remove some deprecated items.
Change compander api to one function per parameter.
Add a version string define.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-07-06 08:18:27 +02:00
Takashi Iwai 21896bc010 ALSA: asihpi - Fix uninitialized variable
Initialize prev_ctl properly before reference:
  sound/pci/asihpi/asihpi.c: In function ‘snd_card_asihpi_mixer_new’:
  sound/pci/asihpi/asihpi.c:2568:30: warning: ‘prev_ctl.dst_node_index’ may be used uninitialized in this function

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-06-02 12:08:37 +02:00
Eliot Blennerhassett 719f82d398 ALSA: Add support of AudioScience ASI boards
Added the support of AudioScience ASI boards.
The driver has been tested for years on alsa-driver external tree,
now finally got merged to the kernel.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-04-22 07:21:53 +02:00