platform/kernel/linux-starfive.git
6 years agoALSA: hda/ca0132 - Add Recon3D input and output select commands
Connor McAdams [Wed, 8 Aug 2018 17:34:20 +0000 (13:34 -0400)]
ALSA: hda/ca0132 - Add Recon3D input and output select commands

This patch adds commands to the alternative input and output select
commands to support the Recon3D.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/ca0132 - Add DSP setup defaults for Recon3D
Connor McAdams [Wed, 8 Aug 2018 17:34:19 +0000 (13:34 -0400)]
ALSA: hda/ca0132 - Add DSP setup defaults for Recon3D

The Recon3D can use many of the same functions as the Recon3Di, so many
of the r3di prefix function remain the same, but change their names to
the more generic r3d prefix. This patch does this, and adds quirk checks
for things specific to the Recon3Di.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/ca0132 - Add Recon3D startup functions and setup
Connor McAdams [Wed, 8 Aug 2018 17:34:18 +0000 (13:34 -0400)]
ALSA: hda/ca0132 - Add Recon3D startup functions and setup

This patch adds functions for Recon3D startup, and sets values for
things such as use_pci_mmio. It also renames some functions and tables
from the sbz prefix into ca0132, as the Recon3D uses them as well.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/ca0132 - Add bool variable to enable/disable pci region2 mmio
Connor McAdams [Wed, 8 Aug 2018 17:34:17 +0000 (13:34 -0400)]
ALSA: hda/ca0132 - Add bool variable to enable/disable pci region2 mmio

This patch adds the ability to choose whether or not to map the pci
region2, which is used for things such as GPIO on the Recon3D and Sound
Blaster Z.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/ca0132 - Add Recon3D pincfg
Connor McAdams [Wed, 8 Aug 2018 17:34:16 +0000 (13:34 -0400)]
ALSA: hda/ca0132 - Add Recon3D pincfg

This patch adds pin configs from the Recon3D, taken from the Window's
driver.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/ca0132 - Add quirk ID and enum for Recon3D
Connor McAdams [Wed, 8 Aug 2018 17:34:15 +0000 (13:34 -0400)]
ALSA: hda/ca0132 - Add quirk ID and enum for Recon3D

This patch adds the PCI subsys ID for the Recon3D that has been tested,
and adds the QUIRK_R3D enumeration.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/ca0132 - Add alt_functions unsolicited response
Connor McAdams [Wed, 8 Aug 2018 17:34:14 +0000 (13:34 -0400)]
ALSA: hda/ca0132 - Add alt_functions unsolicited response

This patch fixes a previous oversight where the microphone unsolicited
response would use the wrong input selection function.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/ca0132 - Clean up ca0132_init function.
Connor McAdams [Wed, 8 Aug 2018 17:34:13 +0000 (13:34 -0400)]
ALSA: hda/ca0132 - Clean up ca0132_init function.

This patch cleans up ca0132_init by removing unnecessary commands and
ordering things better.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/ca0132 - Create mmio gpio function to make code clearer
Connor McAdams [Wed, 8 Aug 2018 17:34:12 +0000 (13:34 -0400)]
ALSA: hda/ca0132 - Create mmio gpio function to make code clearer

This patch adds a new function, ca0132_mmio_gpio_set, to clear up what
is going on with writes to mmio region 0x320.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: intel_hdmi: remove redundant variable cfg_val
Colin Ian King [Wed, 1 Aug 2018 10:47:42 +0000 (11:47 +0100)]
ALSA: intel_hdmi: remove redundant variable cfg_val

Variable cfg_val is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'cfg_val' set but not used [-Wunused-but-set-variable]

[ Background info about val_bit field from alsa-devel ML thread:
 tiwai: Actually this made me wonder what is the definition of val_bit.
It seems always 1 in the current code after the commit
964ca8083c02. Pierre?
 pbossart: This val_bit is only there for debug/test, it should be set
to one by default and has nothing to do with the lpcm_id.
This variable was set even in patches before upstream
submission and was never needed, I guess it must be a 9-yr
old issue. Good catch!
]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: echoaudio: Mark expected switch fall-throughs
Gustavo A. R. Silva [Sat, 4 Aug 2018 20:13:26 +0000 (15:13 -0500)]
ALSA: echoaudio: Mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 115156 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: emu10k1: Mark expected switch fall-throughs
Gustavo A. R. Silva [Sat, 4 Aug 2018 20:12:09 +0000 (15:12 -0500)]
ALSA: emu10k1: Mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Notice that in this particular case, I replaced the code comment with
a proper "fall through" annotation, which is what GCC is expecting
to find.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: mixart: Mark expected switch fall-through
Gustavo A. R. Silva [Sat, 4 Aug 2018 20:11:03 +0000 (15:11 -0500)]
ALSA: mixart: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/realtek - Add mute LED quirk for HP Spectre x360
Alexandru Gagniuc [Sat, 4 Aug 2018 16:44:44 +0000 (11:44 -0500)]
ALSA: hda/realtek - Add mute LED quirk for HP Spectre x360

This device has the same issues as the HP x360 wrt the MUTE LED and
the front speakers not working. This patch fixes the MUTE LED issue,
but doesn't touch the HDA verbs. The fix for the x360 does not work
on the Spectre.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: seq_oss: Mark expected switch fall-through
Gustavo A. R. Silva [Fri, 3 Aug 2018 20:53:54 +0000 (15:53 -0500)]
ALSA: seq_oss: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Warning level 2 was used: -Wimplicit-fallthrough=2

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: seq: Mark expected switch fall-through
Gustavo A. R. Silva [Fri, 3 Aug 2018 20:52:33 +0000 (15:52 -0500)]
ALSA: seq: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Notice that in this particular case, I replaced the code comment with
a proper "fall through" annotation, which is what GCC is expecting
to find.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: synth: Remove empty init and exit
Takashi Iwai [Fri, 3 Aug 2018 13:48:54 +0000 (15:48 +0200)]
ALSA: synth: Remove empty init and exit

For a sake of code simplification, remove the init and the exit
entries that do nothing.

Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry.  By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: pci: Remove empty init and exit
Takashi Iwai [Fri, 3 Aug 2018 13:48:41 +0000 (15:48 +0200)]
ALSA: pci: Remove empty init and exit

For a sake of code simplification, remove the init and the exit
entries that do nothing.

Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry.  By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: i2c: Remove empty init and exit
Takashi Iwai [Fri, 3 Aug 2018 13:48:26 +0000 (15:48 +0200)]
ALSA: i2c: Remove empty init and exit

For a sake of code simplification, remove the init and the exit
entries that do nothing.

Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry.  By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: isa: Remove empty init and exit
Takashi Iwai [Fri, 3 Aug 2018 13:44:15 +0000 (15:44 +0200)]
ALSA: isa: Remove empty init and exit

For a sake of code simplification, remove the init and the exit
entries that do nothing.

Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry.  By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: drivers: Remove empty init and exit
Takashi Iwai [Fri, 3 Aug 2018 13:42:46 +0000 (15:42 +0200)]
ALSA: drivers: Remove empty init and exit

For a sake of code simplification, remove the init and the exit
entries that do nothing.

Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry.  By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: compress: Remove empty init and exit
Takashi Iwai [Fri, 3 Aug 2018 13:40:25 +0000 (15:40 +0200)]
ALSA: compress: Remove empty init and exit

For a sake of code simplification, remove the init and the exit
entries that do nothing.

Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry.  By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: gus: fix spelling mistake "acumulator" -> "accumulator"
Colin Ian King [Fri, 3 Aug 2018 13:47:56 +0000 (14:47 +0100)]
ALSA: gus: fix spelling mistake "acumulator" -> "accumulator"

Trivial spelling mistake fix in debug message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: es18xx: mark expected switch fall-through
Gustavo A. R. Silva [Thu, 2 Aug 2018 20:42:39 +0000 (15:42 -0500)]
ALSA: es18xx: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 115075 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: opti9xx: mark expected switch fall-throughs
Gustavo A. R. Silva [Thu, 2 Aug 2018 20:41:55 +0000 (15:41 -0500)]
ALSA: opti9xx: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 402016 ("Missing break in switch")
Addresses-Coverity-ID: 1056542 ("Missing break in switch")
Addresses-Coverity-ID: 1339579 ("Missing break in switch")
Addresses-Coverity-ID: 1369526 ("Missing break in switch")
Addresses-Coverity-ID: 1369529 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: opti92x: mark expected switch fall-throughs
Gustavo A. R. Silva [Thu, 2 Aug 2018 20:41:21 +0000 (15:41 -0500)]
ALSA: opti92x: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1165394 ("Missing break in switch")
Addresses-Coverity-ID: 1167851 ("Missing break in switch")
Addresses-Coverity-ID: 402015 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: galaxy: Mark expected switch fall-throughs
Gustavo A. R. Silva [Thu, 2 Aug 2018 20:40:37 +0000 (15:40 -0500)]
ALSA: galaxy: Mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1468367 ("Missing break in switch")
Addresses-Coverity-ID: 115037 ("Missing break in switch")
Addresses-Coverity-ID: 115038 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: sb: Fix a typo
Takashi Iwai [Thu, 2 Aug 2018 05:40:19 +0000 (07:40 +0200)]
ALSA: sb: Fix a typo

There was a typo of COPY_USER in the dead code (that is disabled
as default).

Fixes: 4b83eff81c81 ("ALSA: sb: Convert to the new PCM ops")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Fix invalid use of sizeof in parse_uac_endpoint_attributes()
Wei Yongjun [Thu, 2 Aug 2018 04:31:02 +0000 (04:31 +0000)]
ALSA: usb-audio: Fix invalid use of sizeof in parse_uac_endpoint_attributes()

sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Fixes: 7edf3b5e6a45 ("ALSA: usb-audio: AudioStreaming Power Domain parsing")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: seq: Drop unused 64bit division macros
Takashi Iwai [Wed, 1 Aug 2018 14:43:56 +0000 (16:43 +0200)]
ALSA: seq: Drop unused 64bit division macros

The old ugly macros remained in the code without usage.
Rip them off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: seq: Use no intrruptible mutex_lock
Takashi Iwai [Wed, 1 Aug 2018 14:42:29 +0000 (16:42 +0200)]
ALSA: seq: Use no intrruptible mutex_lock

All usages of mutex in ALSA sequencer core would take too long, hence
we don't have to care about the user interruption that makes things
complicated.  Let's replace them with simpler mutex_lock().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: seq: Fix leftovers at probe error path
Takashi Iwai [Wed, 1 Aug 2018 14:37:02 +0000 (16:37 +0200)]
ALSA: seq: Fix leftovers at probe error path

The sequencer core module doesn't call some destructors in the error
path of the init code, which may leave some resources.

This patch mainly fix these leaks by calling the destructors
appropriately at alsa_seq_init().  Also the patch brings a few
cleanups along with it, namely:

- Expand the old "if ((err = xxx) < 0)" coding style
- Get rid of empty seq_queue_init() and its caller
- Change snd_seq_info_done() to void

Last but not least, a couple of functions lose __exit annotation since
they are called also in alsa_seq_init().

No functional changes but minor code cleanups.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: seq: Remove dead codes
Takashi Iwai [Wed, 1 Aug 2018 12:59:07 +0000 (14:59 +0200)]
ALSA: seq: Remove dead codes

There are a few functions that have been commented out for ages.
And also there are functions that do nothing but placeholders.
Let's kill them.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: seq: Minor cleanup of MIDI event parser helpers
Takashi Iwai [Wed, 1 Aug 2018 12:38:18 +0000 (14:38 +0200)]
ALSA: seq: Minor cleanup of MIDI event parser helpers

snd_midi_event_encode_byte() can never fail, and it can return rather
true/false.  Change the return type to bool, adjust the argument to
receive a MIDI byte as unsigned char, and adjust the comment
accordingly.  This allows callers to drop error checks, which
simplifies the code.

Meanwhile, snd_midi_event_encode() helper is used only in seq_midi.c,
and it can be better folded into it.  This will reduce the total
amount of lines in the end.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb: Mark expected switch fall-through
Gustavo A. R. Silva [Wed, 1 Aug 2018 16:14:16 +0000 (11:14 -0500)]
ALSA: usb: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 115084 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: pcm: Mark expected switch fall-through
Gustavo A. R. Silva [Wed, 1 Aug 2018 15:58:25 +0000 (10:58 -0500)]
ALSA: pcm: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1357375 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: remove redundant pointer 'urb'
Colin Ian King [Wed, 1 Aug 2018 10:47:41 +0000 (11:47 +0100)]
ALSA: usb-audio: remove redundant pointer 'urb'

Pointer 'urb' is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'urb' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: sonicvibes: remove redundant pointer 'dir'
Colin Ian King [Wed, 1 Aug 2018 10:47:38 +0000 (11:47 +0100)]
ALSA: sonicvibes: remove redundant pointer 'dir'

Pointer 'dir' is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'dir' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: ens137x: remove redundant array pcm_devs
Colin Ian King [Wed, 1 Aug 2018 10:47:37 +0000 (11:47 +0100)]
ALSA: ens137x: remove redundant array pcm_devs

The array pcm_devs is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'pcm_devs' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: emu10k1: remove redundant variable attn
Colin Ian King [Wed, 1 Aug 2018 10:47:36 +0000 (11:47 +0100)]
ALSA: emu10k1: remove redundant variable attn

Variable attn is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'attn' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: cs5535audio: remove redundant pointer 'dma'
Colin Ian King [Wed, 1 Aug 2018 10:47:35 +0000 (11:47 +0100)]
ALSA: cs5535audio: remove redundant pointer 'dma'

Pointer 'dma' is being assigned but is never used hence it is
redundant and can be removed.

Cleans up two clang warnings:
warning: variable 'dma' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: asihpi: remove redundant variable max_streams
Colin Ian King [Wed, 1 Aug 2018 10:47:34 +0000 (11:47 +0100)]
ALSA: asihpi: remove redundant variable max_streams

Variable max_streams is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'max_streams' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Operate UAC3 Power Domains in PCM callbacks
Jorge Sanjuan [Tue, 31 Jul 2018 12:28:45 +0000 (13:28 +0100)]
ALSA: usb-audio: Operate UAC3 Power Domains in PCM callbacks

Make use of UAC3 Power Domains associated to an Audio Streaming
path within the PCM's logic. This means, when there is no audio
being transferred (pcm is closed), the host will set the Power Domain
associated to that substream to state D1. When audio is being transferred
(from hw_params onwards), the Power Domain will be set to D0 state.

This is the way the host lets the device know which Terminal
is going to be actively used and it is for the device to
manage its own internal resources on that UAC3 Power Domain.

Note the resume method now sets the Power Domain to D1 state as
resuming the device doesn't mean audio streaming will occur.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Add UAC3 Power Domains to suspend/resume
Jorge Sanjuan [Tue, 31 Jul 2018 12:28:44 +0000 (13:28 +0100)]
ALSA: usb-audio: Add UAC3 Power Domains to suspend/resume

Set the UAC3 Power Domain state for an Audio Streaming interface
to D2 state before suspending the device (usb_driver callback).
This lets the device know there is no intention to use any of the
Units in the Audio Function and that the host is not going to
even listen for wake-up events (interrupts) on the units.

When the usb_driver gets resumed, the state D0 (fully powered) will
be set. This ties up the UAC3 Power Domains to the runtime PM.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: AudioStreaming Power Domain parsing
Jorge Sanjuan [Tue, 31 Jul 2018 12:28:43 +0000 (13:28 +0100)]
ALSA: usb-audio: AudioStreaming Power Domain parsing

Power Domains in the UAC3 spec are mainly intended to be
associated to an Input or Output Terminal so the host
changes the power state of the entire capture or playback
path within the topology.

This patch adds support for finding Power Domains associated
to an Audio Streaming Interface (bTerminalLink) and adds a
reference to them in the usb audio substreams (snd_usb_substream).

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Initial Power Domain support
Jorge Sanjuan [Tue, 31 Jul 2018 12:28:42 +0000 (13:28 +0100)]
ALSA: usb-audio: Initial Power Domain support

Thee USB Audio Class 3 (UAC3) introduces Power Domains as a new
feature to let a host turn individual parts of an audio function
to different power states via USB requests. This lets the device
get to know a bit amore about what the host is up to in order to
optimize power consumption efficiently.

The Power Domains are optional for UAC3 configuration but all
UAC3 devices shall include at least one BADD configuration where
the support for Power Domains is compulsory.

This patch adds a set of features/helpers to parse these power
domains and change their status.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: seq: virmidi: Use READ_ONCE/WRITE_ONCE() macros
Takashi Iwai [Mon, 30 Jul 2018 12:48:29 +0000 (14:48 +0200)]
ALSA: seq: virmidi: Use READ_ONCE/WRITE_ONCE() macros

The trigger flag in vmidi object can be referred in different contexts
concurrently, hence it's better to be put with READ_ONCE() and
WRITE_ONCE() macros to assure the accesses.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: seq: virmidi: Offload the output event processing
Takashi Iwai [Sun, 29 Jul 2018 21:03:05 +0000 (23:03 +0200)]
ALSA: seq: virmidi: Offload the output event processing

The virmidi sequencer stuff tries to translate the rawmidi bytes to
sequencer events and deliver the packets at trigger callback.  The
amount of the whole process of these translations and deliveries
depends on the incoming rawmidi bytes, and we have no limit for that;
this was the cause of a CPU soft lockup that had been reported and
fixed recently.

Although we've fixed the soft lockup by putting the temporary unlock
and cond_resched(), it's rather a quick band aid.  In this patch,
meanwhile, the event parsing and delivery process is offloaded to a
dedicated work, and the trigger callback just kicks it off.  It has
three merits, at least:

- The processing is always done in a sleepable context, which can
  assure the event delivery with non-atomic flag without hackish
  is_atomic() usage.

- Other relevant codes can be simplified, reducing the lines

- It makes me happier

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoMerge branch 'for-linus' into topic/virmidi
Takashi Iwai [Sun, 29 Jul 2018 20:38:54 +0000 (22:38 +0200)]
Merge branch 'for-linus' into topic/virmidi

Pull the latest ALSA sequencer fixes for the further development of
virmidi.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/hdmi: Use single mutex unlock in error paths
Takashi Iwai [Thu, 12 Jul 2018 21:06:51 +0000 (23:06 +0200)]
ALSA: hda/hdmi: Use single mutex unlock in error paths

Instead of calling mutex_unlock() at each error path multiple times,
take the standard goto-and-a-single-unlock approach.  This will
simplify the code and make easier to find the unbalanced mutex locks.

No functional changes, but only the code readability improvement as a
preliminary work for further changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda - Sleep for 10ms after entering D3 on Conexant codecs
Park Ju Hyung [Fri, 27 Jul 2018 18:16:42 +0000 (03:16 +0900)]
ALSA: hda - Sleep for 10ms after entering D3 on Conexant codecs

On rare occasions, we are still noticing that the internal speaker
spitting out spurious noises even after adding the problematic codec
to the list.

Adding a 10ms artificial delay before rebooting fixes the issue entirely.

Patch for Realtek codecs also adds the same amount of delay after
entering D3.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda - Turn CX8200 into D3 as well upon reboot
Park Ju Hyung [Fri, 27 Jul 2018 18:16:21 +0000 (03:16 +0900)]
ALSA: hda - Turn CX8200 into D3 as well upon reboot

As an equivalent codec with CX20724,
CX8200 is also subject to the reboot bug.

Late 2017 and 2018 LG Gram and some HP Spectre laptops are known victims
to this issue, causing extremely loud noises upon reboot.

Now that we know that this bug is subject to multiple codecs,
fix the comment as well.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: ctxfi: cthw20k2: Replace mdelay() with msleep() and usleep_range()
Jia-Ju Bai [Fri, 27 Jul 2018 09:01:43 +0000 (17:01 +0800)]
ALSA: ctxfi: cthw20k2: Replace mdelay() with msleep() and usleep_range()

hw_pll_init(), hw_dac_stop(), hw_dac_start() and hw_adc_init()
are never called in atomic context.
They call mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA:: ctxfi: cthw20k1: Replace mdelay() with msleep()
Jia-Ju Bai [Fri, 27 Jul 2018 08:57:56 +0000 (16:57 +0800)]
ALSA:: ctxfi: cthw20k1: Replace mdelay() with msleep()

hw_pll_init(), hw_reset_dac() and hw_card_init() are never
called in atomic context.
They calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: quirks: Replace mdelay() with msleep() and usleep_range()
Jia-Ju Bai [Fri, 27 Jul 2018 08:55:28 +0000 (16:55 +0800)]
ALSA: usb-audio: quirks: Replace mdelay() with msleep() and usleep_range()

snd_usb_select_mode_quirk(), snd_usb_set_interface_quirk() and
snd_usb_ctl_msg_quirk() are never called in atomic context.
They call mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep() and usleep_range().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: sb: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:14 +0000 (23:24 +0200)]
ALSA: sb: Proper endian notations

The data types defined in SB CSP driver code are all in little-endian,
hence the proper type like __le32 should be used.

Spotted by sparse, a warning like:
  sound/isa/sb/sb16_csp.c:330:14: warning: cast to restricted __le32

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: atiixp_modem: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:13 +0000 (23:24 +0200)]
ALSA: atiixp_modem: Proper endian notations

The DMA address table in atiixp modem driver is in little-endian,
hence we should define it with __le32 properly.

Spotted by sparse, a warning like:
  sound/pci/atiixp_modem.c:360:28: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: atiixp: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:12 +0000 (23:24 +0200)]
ALSA: atiixp: Proper endian notations

The DMA address table in atiixp driver is in little-endian, hence we should define it with __le32 properly.

Spotted by sparse, a warning like:
  sound/pci/atiixp.c:393:28: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: bt87x: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:11 +0000 (23:24 +0200)]
ALSA: bt87x: Proper endian notations

The RISC data in bt87x is in little-endian, hence we should define it
with __le32 properly.

Spotted by sparse, a warning like:
  sound/pci/bt87x.c:240:17: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: echoaudio: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:10 +0000 (23:24 +0200)]
ALSA: echoaudio: Proper endian notations

Many data fields defined in echoaudio drivers are in little-endian,
hence they should be defined with __le16 or __le32.  This makes it
easier to catch the forgotten conversions.

Spotted by sparse, a warning like:
  sound/pci/echoaudio/echoaudio_dsp.c:990:36: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: maestro3: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:09 +0000 (23:24 +0200)]
ALSA: maestro3: Proper endian notations

The ASSP data passed to maestro3 driver is in little-endian format,
hence the data pointer should be with __le16.

Spotted by sparse, warnings like:
  sound/pci/maestro3.c:2128:35: warning: cast to restricted __le16

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: intel8x0m: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:08 +0000 (23:24 +0200)]
ALSA: intel8x0m: Proper endian notations

The BD address tables in intel8x0m driver are in little-endian, hence
they should be represented as __le32 instead u32.

Spotted by sparse, warnings like:
  sound/pci/intel8x0m.c:406:40: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: intel8x0: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:07 +0000 (23:24 +0200)]
ALSA: intel8x0: Proper endian notations

The BD address tables in intel8x0 driver are in little-endian, hence
they should be represented as __le32 instead u32.

Spotted by sparse, warnings like:
  sound/pci/intel8x0.c:688:40: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: lola: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:06 +0000 (23:24 +0200)]
ALSA: lola: Proper endian notations

The BDL entries in lola driver are little-endian while we code them as
u32.  This leads to sparse warnings like:
  sound/pci/lola/lola.c:105:40: warning: incorrect type in assignment (different base types)
  sound/pci/lola/lola.c:105:40:    expected unsigned int [unsigned] [usertype] <noident>
  sound/pci/lola/lola.c:105:40:    got restricted __le32 [usertype] <noident>

This patch fixes the declarations to the proper __le32 type.

Also, there was a typo in the original code, where __user was used
that was intended as __iomem.  This was caused also by sparse:
  sound/pci/lola/lola_mixer.c:132:27: warning: incorrect type in assignment (different address spaces)
Fixed in this patch as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: mixart: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:05 +0000 (23:24 +0200)]
ALSA: mixart: Proper endian notations

The miXart driver deals with big-endian values as raw data, while it
declares most of variables as u32.  This leads to sparse warnings like
  sound/pci/mixart/mixart.c:1203:23: warning: cast to restricted __be32

Fix them by properly defining the structs and add the explicit cast to
macros.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: riptide: Properly endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:04 +0000 (23:24 +0200)]
ALSA: riptide: Properly endian notations

The SG descriptor of Riptide contains the little-endian values, hence
we need to define with __le32 properly.  This fixes sparse warnings
like:
  sound/pci/riptide/riptide.c:1112:40: warning: cast to restricted __le32

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: Proper endian notations for BDL pointers
Takashi Iwai [Wed, 25 Jul 2018 21:24:03 +0000 (23:24 +0200)]
ALSA: hda: Proper endian notations for BDL pointers

The BDL pointer used in snd_hdac_dsp_prepare() should be declared as
__le32, as warned by sparse:
  sound/hda/hdac_stream.c:655:47: warning: incorrect type in argument 4 (different base types)
  sound/hda/hdac_stream.c:655:47:    expected restricted __le32 [usertype] **bdlp
  sound/hda/hdac_stream.c:655:47:    got unsigned int [usertype] **<noident>

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: trident: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:02 +0000 (23:24 +0200)]
ALSA: trident: Proper endian notations

The TLB entries in Trident driver are represented in little-endian,
hence they should be declared as __le32.

This patch fixes the sparse warnings like:
  sound/pci/trident/trident_memory.c:226:17: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: ymfpci: Proper endian notations
Takashi Iwai [Wed, 25 Jul 2018 21:24:01 +0000 (23:24 +0200)]
ALSA: ymfpci: Proper endian notations

The bank values are all little-endians, so they should be defined with
__le32.  This fixes lots of sparse warnings like:
  sound/pci/ymfpci/ymfpci_main.c:315:23: warning: cast to restricted __le32
  sound/pci/ymfpci/ymfpci_main.c:342:32: warning: incorrect type in assignment (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: xen: Use standard pcm_format_to_bits() for ALSA format bits
Takashi Iwai [Wed, 25 Jul 2018 21:19:45 +0000 (23:19 +0200)]
ALSA: xen: Use standard pcm_format_to_bits() for ALSA format bits

The open codes with the bit shift in xen_snd_front_alsa.c give sparse
warnings as the PCM format type is with __bitwise.
There is already a standard macro to get the format bits, so let's use
it instead.

This fixes sparse warnings like:
  sound/xen/xen_snd_front_alsa.c:191:47: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: sb: Fix sparse warning wrt PCM format type
Takashi Iwai [Wed, 25 Jul 2018 21:19:44 +0000 (23:19 +0200)]
ALSA: sb: Fix sparse warning wrt PCM format type

The PCM format type is with __bitwise, and it can't be converted from
integer implicitly.  Instead of an ugly cast, declare the function
argument of snd_sb_csp_autoload() with the proper snd_pcm_format_t
type.

This fixes the sparse warnings like:
  sound/isa/sb/sb16_csp.c:743:22: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: sb: Fix PCM format bit calculation
Takashi Iwai [Wed, 25 Jul 2018 21:19:43 +0000 (23:19 +0200)]
ALSA: sb: Fix PCM format bit calculation

The PCM format type in snd_pcm_format_t can't be treated as integer
implicitly since it's with __bitwise.  We have already a helper
function to get the bit index of the given type, and use it in each
place instead.

This fixes sparse warnings like:
  sound/isa/sb/sb16_main.c:61:44: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: wss: Fix sparse warning wrt PCM format type
Takashi Iwai [Wed, 25 Jul 2018 21:19:42 +0000 (23:19 +0200)]
ALSA: wss: Fix sparse warning wrt PCM format type

The PCM format type is with __bitwise, and it can't be converted from
integer implicitly.  Instead of an ugly cast, declare the function
argument of snd_wss_get_format() with the proper snd_pcm_format_t
type.

This fixes the sparse warnings like:
  sound/isa/wss/wss_lib.c:551:14: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: asihpi: Fix PCM format notations
Takashi Iwai [Wed, 25 Jul 2018 21:19:41 +0000 (23:19 +0200)]
ALSA: asihpi: Fix PCM format notations

asihpi driver treats -1 as an own invalid PCM format, but this needs
a proper cast with __force prefix since PCM format type is __bitwise.
Define a constant with the proper type and use it allover.

This fixes sparse warnings like:
  sound/pci/asihpi/asihpi.c:315:9: warning: incorrect type in initializer (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: au88x0: Fix sparse warning wrt PCM format type
Takashi Iwai [Wed, 25 Jul 2018 21:19:40 +0000 (23:19 +0200)]
ALSA: au88x0: Fix sparse warning wrt PCM format type

The PCM format type is with __bitwise, and it can't be converted from
integer implicitly.  Instead of an ugly cast, declare the function
argument of vortex_alsafmt_aspfmt() with the proper snd_pcm_format_t
type.

This fixes the sparse warning like:
  sound/pci/au88x0/au88x0_core.c:2778:14: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: ad1816a: Fix sparse warning wrt PCM format type
Takashi Iwai [Wed, 25 Jul 2018 21:19:39 +0000 (23:19 +0200)]
ALSA: ad1816a: Fix sparse warning wrt PCM format type

The PCM format type is with __bitwise, and it can't be converted from
integer implicitly.  Instead of an ugly cast, declare the function
argument of snd_ad1816a_get_format() with the proper snd_pcm_format_t
type.

This fixes the sparse warning like:
  sound/isa/ad1816a/ad1816a_lib.c:93:14: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: pcm: Fix sparse warning wrt PCM format type
Takashi Iwai [Wed, 25 Jul 2018 21:19:38 +0000 (23:19 +0200)]
ALSA: pcm: Fix sparse warning wrt PCM format type

The PCM format type is with __bitwise, hence it needs the explicit
cast with __force.  It's ugly, but there is a reason for that cost...

This fixes the sparse warning:
  sound/core/oss/pcm_oss.c:1854:55: warning: incorrect type in argument 1 (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: riptide: Fix PCM format type conversion
Takashi Iwai [Wed, 25 Jul 2018 21:19:37 +0000 (23:19 +0200)]
ALSA: riptide: Fix PCM format type conversion

The PCM format type is with __bitwise, hence it needs to be explicitly
declared as snd_pcm_format_t, as warned by sparse:
  sound/pci/riptide/riptide.c:1028:34: warning: incorrect type in argument 1 (different base types)
  sound/pci/riptide/riptide.c:1028:34:    expected restricted snd_pcm_format_t [usertype] format
  sound/pci/riptide/riptide.c:1028:34:    got unsigned char [unsigned] format

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: Fix implicit PCM format type conversion
Takashi Iwai [Wed, 25 Jul 2018 21:19:36 +0000 (23:19 +0200)]
ALSA: hda: Fix implicit PCM format type conversion

The PCM format type is defined with __bitwise, hence it can't be
passed as integer but needs an explicit cast.  In this patch, instead
of the messy cast flood, define the format argument of
snd_hdac_calc_stream_format() to be the proper snd_pcm_format_t type.

This fixes sparse warnings like:
  sound/hda/hdac_device.c:760:38: warning: incorrect type in argument 1 (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: virmidi: Fix too long output trigger loop
Takashi Iwai [Thu, 26 Jul 2018 12:27:59 +0000 (14:27 +0200)]
ALSA: virmidi: Fix too long output trigger loop

The virmidi output trigger tries to parse the all available bytes and
process sequencer events as much as possible.  In a normal situation,
this is supposed to be relatively short, but a program may give a huge
buffer and it'll take a long time in a single spin lock, which may
eventually lead to a soft lockup.

This patch simply adds a workaround, a cond_resched() call in the loop
if applicable.  A better solution would be to move the event processor
into a work, but let's put a duct-tape quickly at first.

Reported-and-tested-by: Dae R. Jeong <threeearcat@gmail.com>
Reported-by: syzbot+619d9f40141d826b097e@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: trident: Suppress gcc string warning
Takashi Iwai [Thu, 26 Jul 2018 12:58:03 +0000 (14:58 +0200)]
ALSA: trident: Suppress gcc string warning

The meddlesome gcc warns about the possible shortname string in
trident driver code:
  sound/pci/trident/trident.c: In function ‘snd_trident_probe’:
  sound/pci/trident/trident.c:126:2: warning: ‘strcat’ accessing 17 or more bytes at offsets 36 and 20 may overlap 1 byte at offset 36 [-Wrestrict]
  strcat(card->shortname, card->driver);

It happens since gcc calculates the possible string size from
card->driver, but this can't be true since we did set the string just
before that, and they are much shorter.

For shutting it up, use the exactly same string set to card->driver
for strcat() to card->shortname, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: emu10k1: Fix missing __force annotation for user/kernel pointer cast
Takashi Iwai [Wed, 25 Jul 2018 21:00:57 +0000 (23:00 +0200)]
ALSA: emu10k1: Fix missing __force annotation for user/kernel pointer cast

The cast between user-space and kernel-space needs an explicit __force
prefix, but it's missing in many places in emu10k1 driver code.

Spotted by sparse as a warning like:
  sound/pci/emu10k1/emufx.c:529:33: warning: cast removes address space of expression

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: korg1212: Add __force annotation to cast in user-copy callbacks
Takashi Iwai [Wed, 25 Jul 2018 21:00:56 +0000 (23:00 +0200)]
ALSA: korg1212: Add __force annotation to cast in user-copy callbacks

The user-copy callbacks in korg1212 driver contain the explicit cast
from a user pointer to a kernel pointer, but they missed __force
prefix.  It's mandatory for converting between them.

Spotted by sparse, a warning like:
  sound/pci/korg1212/korg1212.c:1329:33: warning: cast removes address space of expression

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: pcm: Use standard lower_32_bits() and upper_32_bits()
Takashi Iwai [Wed, 25 Jul 2018 21:00:55 +0000 (23:00 +0200)]
ALSA: pcm: Use standard lower_32_bits() and upper_32_bits()

Instead of open codes, use the standard macros for obtaining the lower
and upper 32bit values.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: pcm: Add __force to cast in snd_pcm_lib_read/write()
Takashi Iwai [Wed, 25 Jul 2018 21:00:54 +0000 (23:00 +0200)]
ALSA: pcm: Add __force to cast in snd_pcm_lib_read/write()

The snd_pcm_lib_read() and snd_pcm_lib_write() inline functions have
the explicit cast from a user pointer to a kernel pointer, but they
lacks of __force prefix.

This fixes sparse warnings like:
  ./include/sound/pcm.h:1093:47: warning: cast removes address space of expression

Fixes: 68541213720d ("ALSA: pcm: Direct in-kernel read/write support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Declare the common variable in header file
Takashi Iwai [Wed, 25 Jul 2018 21:00:53 +0000 (23:00 +0200)]
ALSA: usb-audio: Declare the common variable in header file

Declare snd_usb_feature_unit_ctl properly in mixer.h.  Otherwise it's
error-prone.

This fixes the sparse warning:
  sound/usb/mixer.c:1464:25: warning: symbol 'snd_usb_feature_unit_ctl' was not declared. Should it be static?

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: opl3: Declare common variables properly
Takashi Iwai [Wed, 25 Jul 2018 21:00:52 +0000 (23:00 +0200)]
ALSA: opl3: Declare common variables properly

Move the declarations of common variables into opl3_voice.h instead of
declaring at each file multiple times, which was error-prone.

This fixes sparse warnings like:
  sound/drivers/opl3/opl3_synth.c:51:6: warning: symbol 'snd_opl3_regmap' was not declared. Should it be static?

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda - Fix a sparse warning about snd_ctl_elem_iface_t
Takashi Iwai [Wed, 25 Jul 2018 21:00:51 +0000 (23:00 +0200)]
ALSA: hda - Fix a sparse warning about snd_ctl_elem_iface_t

The knew->iface field is in snd_ctl_elem_iface_t, which is with
__bitwise, hence it can't be converted implicitly from integer.
Give an explicit cast for the invalid type.

Spotted by sparse:
  sound/pci/hda/hda_codec.c:3280:25: warning: restricted snd_ctl_elem_iface_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: msnd: Use NULL instead of 0
Takashi Iwai [Wed, 25 Jul 2018 21:00:50 +0000 (23:00 +0200)]
ALSA: msnd: Use NULL instead of 0

Fix a sparse warning:
  sound/isa/msnd/msnd_pinnacle.c:813:1: warning: Using plain integer as NULL pointer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/ca0132 - Use NULL instead of 0
Takashi Iwai [Wed, 25 Jul 2018 21:00:49 +0000 (23:00 +0200)]
ALSA: hda/ca0132 - Use NULL instead of 0

Use NULL for initializing the snd_kcontrol_new.tlv field, instead of
0, as warned by sparse:
  sound/pci/hda/patch_ca0132.c:5519:22: warning: Using plain integer as NULL pointer

Also, the driver does the same initialization twice, once for
knew.tlv.c and another for knew.tlv.p while both point to the same
address (these are union).  Drop the latter superfluous one.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: msnd: Fix the default sample sizes
Takashi Iwai [Wed, 25 Jul 2018 21:00:48 +0000 (23:00 +0200)]
ALSA: msnd: Fix the default sample sizes

The default sample sizes set by msnd driver are bogus; it sets ALSA
PCM format, not the actual bit width.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: msnd: Add missing __iomem annotations
Takashi Iwai [Wed, 25 Jul 2018 21:00:47 +0000 (23:00 +0200)]
ALSA: msnd: Add missing __iomem annotations

The io-mapped buffers used in msnd drivers need __iomem annotations.

This fixes sparse warnings like:
  sound/isa/msnd/msnd_pinnacle.c:172:45: warning: incorrect type in initializer (different address spaces)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Fix multiple definitions in AU0828_DEVICE() macro
Takashi Iwai [Wed, 25 Jul 2018 21:00:46 +0000 (23:00 +0200)]
ALSA: usb-audio: Fix multiple definitions in AU0828_DEVICE() macro

AU0828_DEVICE() macro in quirks-table.h uses USB_DEVICE_VENDOR_SPEC()
for expanding idVendor and idProduct fields.  However, the latter
macro adds also match_flags and bInterfaceClass, which are different
from the values AU0828_DEVICE() macro sets after that.

For fixing them, just expand idVendor and idProduct fields manually in
AU0828_DEVICE().

This fixes sparse warnings like:
  sound/usb/quirks-table.h:2892:1: warning: Initializer entry defined twice

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Add support for Encore mDSD USB DAC
Jeff Crukley [Wed, 25 Jul 2018 19:05:01 +0000 (15:05 -0400)]
ALSA: usb-audio: Add support for Encore mDSD USB DAC

This patch adds native DSD playback support for the Encore mDSD USB DAC by
specifying the vendor and product ID's

Signed-off-by: Jeff Crukley <jcrukley@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: cs5535audio: Fix invalid endian conversion
Takashi Iwai [Wed, 25 Jul 2018 15:59:26 +0000 (17:59 +0200)]
ALSA: cs5535audio: Fix invalid endian conversion

One place in cs5535audio_build_dma_packets() does an extra conversion
via cpu_to_le32(); namely jmpprd_addr is passed to setup_prd() ops,
which writes the value via cs_writel().  That is, the callback does
the conversion by itself, and we don't need to convert beforehand.

This patch fixes that bogus conversion.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: vxpocket: Fix invalid endian conversions
Takashi Iwai [Wed, 25 Jul 2018 15:11:38 +0000 (17:11 +0200)]
ALSA: vxpocket: Fix invalid endian conversions

The endian conversions used in vxp_dma_read() and vxp_dma_write() are
superfluous and even wrong on big-endian machines, as inw() and outw()
already do conversions.  Kill them.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: vx222: Fix invalid endian conversions
Takashi Iwai [Wed, 25 Jul 2018 15:10:11 +0000 (17:10 +0200)]
ALSA: vx222: Fix invalid endian conversions

The endian conversions used in vx2_dma_read() and vx2_dma_write() are
superfluous and even wrong on big-endian machines, as inl() and outl()
already do conversions.  Kill them.

Spotted by sparse, a warning like:
  sound/pci/vx222/vx222_ops.c:278:30: warning: incorrect type in argument 1 (different base types)

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: seq: Fix poll() error return
Takashi Iwai [Wed, 25 Jul 2018 14:34:12 +0000 (16:34 +0200)]
ALSA: seq: Fix poll() error return

The sanity checks in ALSA sequencer and OSS sequencer emulation codes
return falsely -ENXIO from poll callback.  They should be EPOLLERR
instead.

This was caught thanks to the recent change to the return value.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/i915: Allow delayed i915 audio component binding
Takashi Iwai [Wed, 11 Jul 2018 13:05:06 +0000 (15:05 +0200)]
ALSA: hda/i915: Allow delayed i915 audio component binding

Currently HD-audio i915 audio binding doesn't support any delayed
binding, and supposes that the i915 driver registers the component
immediately.  This has been OK, so far, but the work-in-progress
change in i915 may introduce the asynchronous binding, which
effectively delays the component registration.

For addressing it, implement a completion to be synced with the master
binding.  The timeout is set to 10 seconds which should be long enough
and hopefully be not too annoying if anyone boots up a debugging
session with i915 KMS turned off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Generic DSD detection for Thesycon-based implementations
Yue Wang [Mon, 23 Jul 2018 08:56:46 +0000 (01:56 -0700)]
ALSA: usb-audio: Generic DSD detection for Thesycon-based implementations

Thesycon provides solutions to XMOS chips, and has its own device
vendor id.

In this patch, we use generic method to detect DSD capability of
Thesycon-based UAC2 implementations in order to support a wide range
of current and future devices.

The patch will enable the SNDRV_PCM_FMTBIT_DSD_U32_BE bit for the DAC
hence enable native DSD playback up to DSD512 format.

Signed-off-by: Yue Wang <yuleopen@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>