OSDN Git Service

tomoyo/tomoyo-test1.git
4 years agoALSA: Allow const arrays for legacy resource management helpers
Takashi Iwai [Sun, 5 Jan 2020 14:47:16 +0000 (15:47 +0100)]
ALSA: Allow const arrays for legacy resource management helpers

Declare the arrays passed to the helper functions for legacy resources
(mostly for ISA drivers) as const, so that each caller can make its
static data as const for minor optimizations, too.

Link: https://lore.kernel.org/r/20200105144823.29547-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb-audio: Use lower hex numbers for IDs
Takashi Iwai [Sun, 5 Jan 2020 08:19:00 +0000 (09:19 +0100)]
ALSA: usb-audio: Use lower hex numbers for IDs

For consistency reason, make all hex numbers with lower alphabets for
USB ID entries.  It improves grep-ability and reduces careless
mistakes.

Link: https://lore.kernel.org/r/20200105081900.21870-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Sun, 5 Jan 2020 08:19:24 +0000 (09:19 +0100)]
Merge branch 'for-linus' into for-next

Merge 5.5-rc devel branch back for applying the conflicting USB-audio
fix.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda/realtek - Apply mic mute LED quirk for Dell E7xx laptops, too
Takashi Iwai [Sun, 5 Jan 2020 08:11:19 +0000 (09:11 +0100)]
ALSA: hda/realtek - Apply mic mute LED quirk for Dell E7xx laptops, too

Dell E7xx laptops have also mic mute LED that is driven by the
dell-laptop platform driver.  Bind it with the capture control as
already done for other models.

A caveat is that the fixup hook for the mic mute LED has to be applied
at last, otherwise it results in the invalid override of the callback.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205529
Link: https://lore.kernel.org/r/20200105081119.21396-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb-audio: Apply the sample rate quirk for Bose Companion 5
Takashi Iwai [Sat, 4 Jan 2020 11:09:36 +0000 (12:09 +0100)]
ALSA: usb-audio: Apply the sample rate quirk for Bose Companion 5

Bose Companion 5 (with USB ID 05a7:1020) doesn't seem supporting
reading back the sample rate, so the existing quirk is needed.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206063
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200104110936.14288-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: sh: Fix unused variable warnings
Takashi Iwai [Sat, 4 Jan 2020 11:00:57 +0000 (12:00 +0100)]
ALSA: sh: Fix unused variable warnings

Remove unused variables that are left over after the conversion of new
PCM ops:
  sound/sh/sh_dac_audio.c:166:26: warning: unused variable 'runtime'
  sound/sh/sh_dac_audio.c:186:26: warning: unused variable 'runtime'
  sound/sh/sh_dac_audio.c:205:26: warning: unused variable 'runtime'

Fixes: 1cc2f8ba0b3e ("ALSA: sh: Convert to the new PCM ops")
Link: https://lore.kernel.org/r/20200104110057.13875-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: control: Add verification for kctl accesses
Takashi Iwai [Sat, 4 Jan 2020 08:35:56 +0000 (09:35 +0100)]
ALSA: control: Add verification for kctl accesses

The current implementation of ALSA control API fully relies on the
callbacks of each driver, and there is no verification of the values
passed via API.  This patch is an attempt to improve the situation
slightly by adding the validation code for the values stored via info
and get callbacks.

The patch adds a new kconfig, CONFIG_SND_CTL_VALIDATION.  It depends
on CONFIG_SND_DEBUG and off as default since the validation would
require a slight overhead including the additional call of info
callback at each get callback invocation.

When this config is enabled, the values stored by each info callback
invocation are verified, namely:
- Whether the info type is valid
- Whether the number of enum items is non-zero
- Whether the given info count is within the allowed boundary

Similarly, the values stored at each get callback are verified as
well:
- Whether the values are within the given range
- Whether the values are aligned with the given step
- Whether any further changes are seen in the data array over the
  given info count

The last point helps identifying a possibly invalid data type access,
typically a case where the info callback declares the type being
SNDRV_CTL_ELEM_TYPE_ENUMERATED while the get/put callbacks store
the values in value.integer.value[] array.

When a validation fails, the ALSA core logs an error message including
the device and the control ID, and the API call also returns an
error.  So, with the new validation turned on, the driver behavior
difference may be visible on user-space, too -- it's intentional,
though, so that we can catch an error more clearly.

The patch also introduces a new ctl access type,
SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK.  A driver may pass this flag with
other access bits to indicate that the ctl element won't be verified.
It's useful when a driver code is specially written to access the data
greater than info->count size by some reason.  For example, this flag
is actually set now in HD-audio HDMI codec driver which needs to clear
the data array in the case of the disconnected monitor.

Also, the PCM channel-map helper code is slightly modified to avoid
the false-positive hit by this validation code, too.

Link: https://lore.kernel.org/r/20200104083556.27789-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda/realtek - Add new codec supported for ALCS1200A
Kailang Yang [Fri, 3 Jan 2020 08:24:06 +0000 (16:24 +0800)]
ALSA: hda/realtek - Add new codec supported for ALCS1200A

Add ALCS1200A supported.
It was similar as ALC900.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/a9bd3cdaa02d4fa197623448d5c51e50@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda - constify and cleanup static NodeID tables
Michał Mirosław [Fri, 3 Jan 2020 09:23:48 +0000 (10:23 +0100)]
ALSA: hda - constify and cleanup static NodeID tables

Make hda_nid_t tables static const, as they are not intended to be
modified by callees.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/5150c94101c9534f4c8e987324f6912c16d459f6.1578043216.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pci: Constify snd_pci_quirk tables
Takashi Iwai [Fri, 3 Jan 2020 08:17:14 +0000 (09:17 +0100)]
ALSA: pci: Constify snd_pci_quirk tables

The snd_pci_quirk tables are referred as read-only, hence they can be
declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-59-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda: Constify snd_pci_quirk tables
Takashi Iwai [Fri, 3 Jan 2020 08:17:13 +0000 (09:17 +0100)]
ALSA: hda: Constify snd_pci_quirk tables

The snd_pci_quirk tables are referred as read-only, hence they can be
declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-58-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: fm801: Constify snd_fm801_tea575x_gpios
Takashi Iwai [Fri, 3 Jan 2020 08:17:12 +0000 (09:17 +0100)]
ALSA: fm801: Constify snd_fm801_tea575x_gpios

The snd_fm801_tea575x_gpios table is referred as read-only, hence it
can be declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-57-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: es1968: Constify snd_es1968_tea575x_gpios
Takashi Iwai [Fri, 3 Jan 2020 08:17:11 +0000 (09:17 +0100)]
ALSA: es1968: Constify snd_es1968_tea575x_gpios

The snd_es1968_tea575x_gpios table is referred as read-only, hence it
can be declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-56-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: emu10k1: Constify snd_emu_chip_details
Takashi Iwai [Fri, 3 Jan 2020 08:17:10 +0000 (09:17 +0100)]
ALSA: emu10k1: Constify snd_emu_chip_details

The snd_emu_chip_details definitions are referred as read-only, hence
they can be declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-55-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: bt87x: Constify snd_bt87x_boards
Takashi Iwai [Fri, 3 Jan 2020 08:17:09 +0000 (09:17 +0100)]
ALSA: bt87x: Constify snd_bt87x_boards

The snd_bt87x_boards array is referred as read-only, hence it can be
declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-54-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: seq: oss: Constify snd_seq_oss_callback definitions
Takashi Iwai [Fri, 3 Jan 2020 08:17:08 +0000 (09:17 +0100)]
ALSA: seq: oss: Constify snd_seq_oss_callback definitions

The snd_seq_oss_callback items are just copied to another struct
as-is, hence they can be declared as const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-53-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usx2y: Constify struct snd_usb_audio_quirk entries
Takashi Iwai [Fri, 3 Jan 2020 08:17:07 +0000 (09:17 +0100)]
ALSA: usx2y: Constify struct snd_usb_audio_quirk entries

The quirk entries used in us122l and usx2y drivers can be declared as
const as they are read-only.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-52-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: line6: Constify snd_ratden definitions
Takashi Iwai [Fri, 3 Jan 2020 08:17:06 +0000 (09:17 +0100)]
ALSA: line6: Constify snd_ratden definitions

The snd_ratden definitions used in line6 drivers are all read-only, so
they can be marked as const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-51-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ice1712: Constify wm-specific tables
Takashi Iwai [Fri, 3 Jan 2020 08:17:05 +0000 (09:17 +0100)]
ALSA: ice1712: Constify wm-specific tables

The tables defined in wm8766.c and wm8776.c are referred as read-only,
hence they can be declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-50-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ice17xx: Constify snd_ice1712_card_info
Takashi Iwai [Fri, 3 Jan 2020 08:17:04 +0000 (09:17 +0100)]
ALSA: ice17xx: Constify snd_ice1712_card_info

The snd_ice1712_card_info objects are referred only as read-only.
Let's make them const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-49-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ca0106: Constify snd_ca0106_details
Takashi Iwai [Fri, 3 Jan 2020 08:17:03 +0000 (09:17 +0100)]
ALSA: ca0106: Constify snd_ca0106_details

The snd_ca0106_details table entries are referred only as read-only.
Let's make them const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-48-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ca0106: Constify snd_ca0106_category_str items
Takashi Iwai [Fri, 3 Jan 2020 08:17:02 +0000 (09:17 +0100)]
ALSA: ca0106: Constify snd_ca0106_category_str items

snd_ca0106_con_category array is read-only and can be marked as const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-47-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ac97: Constify snd_ac97_res_table definition
Takashi Iwai [Fri, 3 Jan 2020 08:17:01 +0000 (09:17 +0100)]
ALSA: ac97: Constify snd_ac97_res_table definition

One snd_ac97_res_table definition remains forgotten without const.
Let's add it for a bit of optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-46-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: opl3: Constify snd_opl3_drum_voice definitions
Takashi Iwai [Fri, 3 Jan 2020 08:17:00 +0000 (09:17 +0100)]
ALSA: opl3: Constify snd_opl3_drum_voice definitions

The snd_opl3_drum_voice items are all read-only, hence they can be
declared as const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-45-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: dummy: Constify snd_pcm_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:59 +0000 (09:16 +0100)]
ALSA: dummy: Constify snd_pcm_ops definitions

The snd_pcm_ops items defined in snd-dummy driver can be gracefully
declared as const.  Let's mark them for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-44-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: parisc: Constify snd_kcontrol_new items
Takashi Iwai [Fri, 3 Jan 2020 08:16:58 +0000 (09:16 +0100)]
ALSA: parisc: 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-43-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb: Constify snd_kcontrol_new items
Takashi Iwai [Fri, 3 Jan 2020 08:16:57 +0000 (09:16 +0100)]
ALSA: usb: 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-42-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: spi: Constify snd_kcontrol_new items
Takashi Iwai [Fri, 3 Jan 2020 08:16:56 +0000 (09:16 +0100)]
ALSA: spi: 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-41-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: sparc: Constify snd_kcontrol_new items
Takashi Iwai [Fri, 3 Jan 2020 08:16:55 +0000 (09:16 +0100)]
ALSA: sparc: 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-40-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ppc: Constify snd_kcontrol_new items
Takashi Iwai [Fri, 3 Jan 2020 08:16:54 +0000 (09:16 +0100)]
ALSA: ppc: 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-39-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pci: Constify snd_kcontrol_new items
Takashi Iwai [Fri, 3 Jan 2020 08:16:53 +0000 (09:16 +0100)]
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>
4 years agoALSA: hda: Constify snd_kcontrol_new items
Takashi Iwai [Fri, 3 Jan 2020 08:16:52 +0000 (09:16 +0100)]
ALSA: hda: 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-37-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: isa: Constify snd_kcontrol_new items
Takashi Iwai [Fri, 3 Jan 2020 08:16:51 +0000 (09:16 +0100)]
ALSA: isa: 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-36-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: i2c: Constify snd_kcontrol_new items
Takashi Iwai [Fri, 3 Jan 2020 08:16:50 +0000 (09:16 +0100)]
ALSA: i2c: 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-35-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: drivers: Constify snd_kcontrol_new items
Takashi Iwai [Fri, 3 Jan 2020 08:16:49 +0000 (09:16 +0100)]
ALSA: drivers: 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.
Constify snd_kcontrol_new items

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-34-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: aoa: Constify snd_kcontrol_new items
Takashi Iwai [Fri, 3 Jan 2020 08:16:48 +0000 (09:16 +0100)]
ALSA: aoa: 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-33-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: mixer: oss: Constify snd_mixer_oss_assign_table definition
Takashi Iwai [Fri, 3 Jan 2020 08:16:47 +0000 (09:16 +0100)]
ALSA: mixer: oss: Constify snd_mixer_oss_assign_table definition

The snd_mixer_oss_assign_table is read-only, and can it be declared as
const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-32-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: vx: Constify snd_vx_hardware and snd_vx_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:46 +0000 (09:16 +0100)]
ALSA: vx: Constify snd_vx_hardware and snd_vx_ops definitions

Both snd_vx_hardware and snd_vx_ops are only referred without
modification, hence they can be constified gracefully for further
optimizations.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-31-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: seq: Constify struct snd_midi_op
Takashi Iwai [Fri, 3 Jan 2020 08:16:45 +0000 (09:16 +0100)]
ALSA: seq: Constify struct snd_midi_op

Change the argument of snd_midi_process_event() to receive a const
snd_midi_op pointer and its callers respectively.  This allows further
optimizations.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-30-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: info: Make snd_info_entry_ops as const
Takashi Iwai [Fri, 3 Jan 2020 08:16:44 +0000 (09:16 +0100)]
ALSA: info: Make snd_info_entry_ops as const

The reference to snd_info_entry_ops is rather read-only, so declare it
as a const pointer.  This allows a bit more optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-29-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pci: Constify snd_ac97_bus_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:43 +0000 (09:16 +0100)]
ALSA: pci: Constify snd_ac97_bus_ops definitions

Now snd_ac97_bus() takes the const ops pointer, so we can define the
snd_ac97_bus_ops locally as const as well for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-28-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: drivers: Constify snd_ac97_bus_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:42 +0000 (09:16 +0100)]
ALSA: drivers: Constify snd_ac97_bus_ops definitions

Now snd_ac97_bus() takes the const ops pointer, so we can define the
snd_ac97_bus_ops locally as const as well for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-27-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: atmel: Constify snd_ac97_bus_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:41 +0000 (09:16 +0100)]
ALSA: atmel: Constify snd_ac97_bus_ops definitions

Now snd_ac97_bus() takes the const ops pointer, so we can define the
snd_ac97_bus_ops locally as const as well for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-26-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: arm: Constify snd_ac97_bus_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:40 +0000 (09:16 +0100)]
ALSA: arm: Constify snd_ac97_bus_ops definitions

Now snd_ac97_bus() takes the const ops pointer, so we can define the
snd_ac97_bus_ops locally as const as well for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-25-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ac97: Constify snd_ac97_bus_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:39 +0000 (09:16 +0100)]
ALSA: ac97: Constify snd_ac97_bus_ops definitions

Now snd_ac97_bus() takes the const ops pointer, so we can define the
snd_ac97_bus_ops locally as const as well for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ac97: Treat snd_ac97_bus_ops as const
Takashi Iwai [Fri, 3 Jan 2020 08:16:38 +0000 (09:16 +0100)]
ALSA: ac97: Treat snd_ac97_bus_ops as const

This is a preliminary patch to allow const for snd_ac97_bus_ops
definitions in each driver's code.  The ops reference is read-only,
hence it can be declared as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-23-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: Constify snd_timer_hardware definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:37 +0000 (09:16 +0100)]
ALSA: Constify snd_timer_hardware definitions

Most of snd_timer_hardware definitions do simply copying to another
struct as-is.  Mark them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-22-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: timer: Constify snd_timer_hardware definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:36 +0000 (09:16 +0100)]
ALSA: timer: Constify snd_timer_hardware definitions

Most of snd_timer_hardware definitions do simply copying to another
struct as-is.  Mark them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-21-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: docs: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:35 +0000 (09:16 +0100)]
ALSA: docs: Constify snd_device_ops definitions

Update the documentation for adding the const prefix to snd_device_ops
definitions as well.

Link: https://lore.kernel.org/r/20200103081714.9560-20-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: spi: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:34 +0000 (09:16 +0100)]
ALSA: spi: 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-19-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: sh: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:33 +0000 (09:16 +0100)]
ALSA: sh: 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-18-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: sparc: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:32 +0000 (09:16 +0100)]
ALSA: sparc: 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-17-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ppc: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:31 +0000 (09:16 +0100)]
ALSA: ppc: 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-16-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pcmcia: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:30 +0000 (09:16 +0100)]
ALSA: pcmcia: 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-15-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: parisc: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:29 +0000 (09:16 +0100)]
ALSA: parisc: 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-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: mips: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:28 +0000 (09:16 +0100)]
ALSA: mips: 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-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: aoa: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:27 +0000 (09:16 +0100)]
ALSA: aoa: 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-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:26 +0000 (09:16 +0100)]
ALSA: usb: 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-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pci: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:25 +0000 (09:16 +0100)]
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>
4 years agoALSA: hda: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:24 +0000 (09:16 +0100)]
ALSA: hda: 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-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: isa: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:23 +0000 (09:16 +0100)]
ALSA: isa: 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-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: i2c: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:22 +0000 (09:16 +0100)]
ALSA: i2c: 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-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: drivers: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:21 +0000 (09:16 +0100)]
ALSA: drivers: 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-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: core: Constify snd_device_ops definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:20 +0000 (09:16 +0100)]
ALSA: core: 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-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: core: Treat snd_device_ops as const
Takashi Iwai [Fri, 3 Jan 2020 08:16:19 +0000 (09:16 +0100)]
ALSA: core: Treat snd_device_ops as const

This is a preliminary patch to allow const for snd_device_ops
definitions in each driver's code.  The ops reference is read-only,
hence it can be declared as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb: Constify snd_pcm_hardware definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:18 +0000 (09:16 +0100)]
ALSA: usb: Constify snd_pcm_hardware definitions

Most of snd_pcm_hardware definitions are just copied to another object
as-is, hence we can define them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pci: Constify snd_pcm_hardware definitions
Takashi Iwai [Fri, 3 Jan 2020 08:16:17 +0000 (09:16 +0100)]
ALSA: pci: Constify snd_pcm_hardware definitions

Most of snd_pcm_hardware definitions are just copied to another object
as-is, hence we can define them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda: constify copied structure
Julia Lawall [Wed, 1 Jan 2020 07:43:20 +0000 (08:43 +0100)]
ALSA: hda: constify copied structure

The azx_pcm_hw structure is only copied into another structure,
so make it const.

The opportunity for this change was found using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/1577864614-5543-3-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ad1816a: constify copied structure
Julia Lawall [Wed, 1 Jan 2020 07:43:19 +0000 (08:43 +0100)]
ALSA: ad1816a: constify copied structure

The snd_ad1816a_timer_table structure is only copied into
another structure, so make it const.

The opportunity for this change was found using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/1577864614-5543-2-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: uapi: Add linux/types.h include back (but carefully)
Takashi Iwai [Mon, 30 Dec 2019 21:27:42 +0000 (22:27 +0100)]
ALSA: uapi: Add linux/types.h include back (but carefully)

A few uapi/sound/*.h headers have been corrected for recovering from
the compile errors with the existing user-space code (alsa-lib) by the
recent commits.  OTOH, these introduced another regression, as now
linux/types.h inclusion became mandatory for the uapi header checks.

As a compromise, this patch re-adds linux/types.h inclusions again,
but conditionally not to break other non-standard user-space stuff
again.

Fixes: 2e4688676392 ("ALSA: emu10k1: Make uapi/emu10k1.h compilable again")
Fixes: d63e63d42107 ("ALSA: hdsp: Make uapi/hdsp.h compilable again")
Fixes: 4fa406caf950 ("ALSA: hdspm: Drop linux/types.h inclusion in uapi header")
Reported-by: kbuild test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20191230212742.28925-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda/realtek - Enable the bass speaker of ASUS UX431FLC
Chris Chiu [Mon, 30 Dec 2019 03:11:18 +0000 (11:11 +0800)]
ALSA: hda/realtek - Enable the bass speaker of ASUS UX431FLC

ASUS reported that there's an bass speaker in addition to internal
speaker and it uses DAC 0x02. It was not enabled in the commit
436e25505f34 ("ALSA: hda/realtek - Enable internal speaker of ASUS
UX431FLC") which only enables the amplifier and the front speaker.
This commit enables the bass speaker on top of the aforementioned
work to improve the acoustic experience.

Fixes: 436e25505f34 ("ALSA: hda/realtek - Enable internal speaker of ASUS UX431FLC")
Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191230031118.95076-1-chiu@endlessm.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code
Takashi Iwai [Wed, 18 Dec 2019 19:26:06 +0000 (20:26 +0100)]
ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code

Jia-Ju Bai reported a possible sleep-in-atomic scenario in the ice1724
driver with Infrasonic Quartet support code: namely, ice->set_rate
callback gets called inside ice->reg_lock spinlock, while the callback
in quartet.c holds ice->gpio_mutex.

This patch fixes the invalid call: it simply moves the calls of
ice->set_rate and ice->set_mclk callbacks outside the spinlock.

Reported-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/5d43135e-73b9-a46a-2155-9e91d0dcdf83@gmail.com
Link: https://lore.kernel.org/r/20191218192606.12866-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb-audio: fix Corsair Virtuoso mixer label collision
Chris Boyle [Fri, 27 Dec 2019 09:40:53 +0000 (10:40 +0100)]
ALSA: usb-audio: fix Corsair Virtuoso mixer label collision

The Corsair Virtuoso RGB Wireless is a USB headset with a mic and a
sidetone feature. Label its mixer appropriately instead of all
"Headset", so that applications such as Pulseaudio don't just move
the sidetone control when they intend the main Headset control.

Signed-off-by: Chris Boyle <chris@boyle.name>
Link: https://lore.kernel.org/r/20191227094053.GA12167@nova.chris.boyle.name
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda/realtek - Add Bass Speaker and fixed dac for bass speaker
Kailang Yang [Thu, 19 Dec 2019 06:12:15 +0000 (14:12 +0800)]
ALSA: hda/realtek - Add Bass Speaker and fixed dac for bass speaker

Dell has new platform which has dual speaker connecting.
They want dual speaker which use same dac for output.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/229c7efa2b474a16b7d8a916cd096b68@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: control: Fix incompatible protocol error
Takashi Iwai [Thu, 26 Dec 2019 10:03:53 +0000 (11:03 +0100)]
ALSA: control: Fix incompatible protocol error

The recent change to bump the ALSA control API protocol version from
2.0.7 to 2.1.0 caused a regression on user-space; while the user-space
expects both the major and the minor versions to be identical with the
supported numbers, we changed the minor number from 0 to 1.

For recovering from the incompatibility, this patch changes the
protocol version again to 2.0.8, which is compatible, but yet higher
than the original number 2.0.7, indicating that the protocol change.

Fixes: bd3eb4e87eb3 ("ALSA: ctl: bump protocol version up to v2.1.0")
Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
Link: https://lore.kernel.org/r/s5h1rsr769i.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ctl: allow TLV read operation for callback type of element in locked case
Takashi Sakamoto [Mon, 23 Dec 2019 09:33:47 +0000 (18:33 +0900)]
ALSA: ctl: allow TLV read operation for callback type of element in locked case

A design of ALSA control core allows applications to execute three
operations for TLV feature; read, write and command. Furthermore, it
allows driver developers to process the operations by two ways; allocated
array or callback function. In the former, read operation is just allowed,
thus developers uses the latter when device driver supports variety of
models or the target model is expected to dynamically change information
stored in TLV container.

The core also allows applications to lock any element so that the other
applications can't perform write operation to the element for element
value and TLV information. When the element is locked, write and command
operation for TLV information are prohibited as well as element value.
Any read operation should be allowed in the case.

At present, when an element has callback function for TLV information,
TLV read operation returns EPERM if the element is locked. On the
other hand, the read operation is success when an element has allocated
array for TLV information. In both cases, read operation is success for
element value expectedly.

This commit fixes the bug. This change can be backported to v4.14
kernel or later.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20191223093347.15279-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda - Apply sync-write workaround to old Intel platforms, too
Takashi Iwai [Mon, 23 Dec 2019 22:18:16 +0000 (23:18 +0100)]
ALSA: hda - Apply sync-write workaround to old Intel platforms, too

Klaus Ethgen reported occasional high CPU usages in his system that
seem caused by HD-audio driver.  The perf output revealed that it's
in the unsolicited event handling in the workqueue, and the problem
seems triggered by some communication stall between the controller and
the codec at the runtime or system resume.

Actually a similar phenomenon was seen in the past for other Intel
platforms, and we already applied the workaround to enforce sync-write
for CORB/RIRB verbs for Skylake and newer chipsets (commit
2756d9143aa5 "ALSA: hda - Fix intermittent CORB/RIRB stall on Intel
chips").  Fortunately, the same workaround is applicable to the old
chipset, and the experiment showed the positive effect.

Based on the experiment result, this patch enables the sync-write
workaround for all Intel chipsets.  The only reason I hesitated to
apply this workaround was about the possibly slightly higher CPU usage.
But if the lack of sync causes a much severer problem even for quite
old chip, we should think this would be necessary for all Intel chips.

Reported-by: Klaus Ethgen <Klaus@ethgen.ch>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191223171833.GA17053@chua
Link: https://lore.kernel.org/r/20191223221816.32572-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ctl: bump protocol version up to v2.1.0
Takashi Sakamoto [Mon, 23 Dec 2019 02:39:21 +0000 (11:39 +0900)]
ALSA: ctl: bump protocol version up to v2.1.0

In a development period for v5.6 kernel, some changes are introduced to
structures in ALSA control interface:
 - 'tstamp' member is removed from 'struct snd_ctl_elem_value
 - 'TSTAMP' flag is removed from a set of access flags for 'struct
   snd_ctl_elem_info'
 - 'dimen' member is removed from 'struct snd_ctl_elem_info

Although these changes were introduced with enough consideration for
backward compatibility, they include slightly lose of it. This commit
bumps protocol version of ALSA control interface up to v2.1.0.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191223023921.8151-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ctl: remove dimen member from elem_info structure
Takashi Sakamoto [Mon, 23 Dec 2019 02:39:20 +0000 (11:39 +0900)]
ALSA: ctl: remove dimen member from elem_info structure

The 'dimen' member of 'struct snd_ctl_elem_info' is designed to deliver
information to use an array of value as multi-dimensional values. This
feature is used just by echoaudio PCI driver, and fortunately it's not
used by the other applications than 'echomixer' in alsa-tools.

In a previous commit, usage of 'dimen' member is removed from echoaudio
PCI driver. Nowadays no driver/application use the feature.

This commit removes the member from structure.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191223023921.8151-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pci: echoaudio: remove usage of dimen menber of elem_value structure
Takashi Sakamoto [Mon, 23 Dec 2019 02:39:19 +0000 (11:39 +0900)]
ALSA: pci: echoaudio: remove usage of dimen menber of elem_value structure

In a couple of years ago, 'echomixer' userspace application was revised
not to use 'dimen' member of 'struct snd_ctl_elem_info'.

This commit removes usage of 'dimen' member from echoaudio PCI driver so
that no implementation uses the member.

Reference: 275353bb684e ("ALSA: echoaudio: purge contradictions between dimension matrix members and total number of members")
Reference: 51db452df07b ("Revert "ALSA: echoaudio: purge contradictions between dimension matrix members and total number of members")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191223023921.8151-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ctl: remove unused macro for timestamping of elem_value
Takashi Sakamoto [Mon, 23 Dec 2019 02:39:18 +0000 (11:39 +0900)]
ALSA: ctl: remove unused macro for timestamping of elem_value

In a former commit, 'tstamp' member was removed from 'struct
snd_ctl_elem_value' in a middle way toward solution of Y2038 issue. In a
protocol of ALSA control interface, this member is designed to deliver
timestamp information in the value structure when the target element
supports SNDRV_CTL_ELEM_ACCESS_TIMESTAMP flag.

Actually, the feature is neither used by kernel space nor user space,
especiall alsa-lib has no API for the feature. Therefore it's reasonable
to remove both of them. Practically, the timestamp information
corresponds to no information about type of clock ID. It can bring
confusions to applications.

Reference: a4e7dd35b9da ("ALSA: Avoid using timespec for struct snd_ctl_elem_value")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191223023921.8151-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda/hdmi - fix atpx_present when CLASS is not VGA
Alex Deucher [Sat, 21 Dec 2019 00:17:02 +0000 (19:17 -0500)]
ALSA: hda/hdmi - fix atpx_present when CLASS is not VGA

You can't use PCI_BASE_CLASS with pci_get_class().  This
happens to work by luck on devices with PCI_CLASS_DISPLAY_VGA, but
misses PCI_CLASS_DISPLAY_OTHER.  Add a check for those as well.

Fixes: 586bc4aab878 ("ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD")
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://lore.kernel.org/r/20191221001702.1338587-1-alexander.deucher@amd.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: uapi: Drop unneeded typedefs
Takashi Iwai [Fri, 20 Dec 2019 16:15:55 +0000 (17:15 +0100)]
ALSA: uapi: Drop unneeded typedefs

We kept some typedefs in uapi/sound/*.h so that the programs in
alsa-tools can be built.  Now that alsa-lib takes these and applies
the workarounds in its own, we don't need these typedefs any longer in
the kernel uapi side.  Let's drop them.

Link: https://lore.kernel.org/r/20191220161555.20232-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: uapi: Drop asound.h inclusion from asoc.h
Takashi Iwai [Fri, 20 Dec 2019 15:34:15 +0000 (16:34 +0100)]
ALSA: uapi: Drop asound.h inclusion from asoc.h

The asound.h isn't always available while asoc.h itself is distributed
in alsa-lib package.  So we need to avoid the unnecessary inclusion of
asound.h from there.

Link: https://lore.kernel.org/r/20191220153415.2740-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: uapi: Fix typos and header inclusion in asound.h
Takashi Iwai [Fri, 20 Dec 2019 15:34:14 +0000 (16:34 +0100)]
ALSA: uapi: Fix typos and header inclusion in asound.h

The recent changes in uapi/asoundlib.h caused some build errors in
alsa-lib side because of a typo and the new included files.
Basically asound.h is supposed to be usable also on non-Linux systems,
so we've tried to avoid the Linux-specific include files.

This patch is an attempt to recover from those changes.

Fixes: 3ddee7f88aaf ("ALSA: Avoid using timespec for struct snd_pcm_status")
Fixes: 80fe7430c708 ("ALSA: add new 32-bit layout for snd_pcm_mmap_status/control")
Link: https://lore.kernel.org/r/20191220153415.2740-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hdspm: Drop linux/types.h inclusion in uapi header
Takashi Iwai [Fri, 20 Dec 2019 15:34:13 +0000 (16:34 +0100)]
ALSA: hdspm: Drop linux/types.h inclusion in uapi header

The hdspm.h uapi header has been used also from non-Linux or platforms
that don't have linux/*.h.  It was OK in the past because alsa-lib
contained the modified version of this header file, but now it tries
to the verbatim copy, so it broke the build.  This fixes it again.

Link: https://lore.kernel.org/r/20191220153415.2740-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hdsp: Make uapi/hdsp.h compilable again
Takashi Iwai [Fri, 20 Dec 2019 15:34:12 +0000 (16:34 +0100)]
ALSA: hdsp: Make uapi/hdsp.h compilable again

Recently alsa-lib updated its content of sound/hdsp.h just by copying
the latest Linus kernel uapi/*.h, and this broke the build of
alsa-tools programs.  We used to modify the headers so that they can
be built without asoundlib.h and linux kernel headers, and the
verbatim copy doesn't work as is.

This patch removes again the linux/types.h inclusion and drop __user
prefix that broke the build and adjusts the corresponding code.

Link: https://lore.kernel.org/r/20191220153415.2740-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: emu10k1: Make uapi/emu10k1.h compilable again
Takashi Iwai [Fri, 20 Dec 2019 15:34:11 +0000 (16:34 +0100)]
ALSA: emu10k1: Make uapi/emu10k1.h compilable again

Recently we updated the content in alsa-lib uapi header files by just
copying from the latest Linus kernel uapi/*.h, and noticed that it
broke the build of some alsa-tools programs.  The reason is that we
used to have a modified version in the past, so that the program can
be built without referring to the unexported stuff like
snd_ctl_elem_id or __user prefix.

This patch attempts to restore that, i.e. dropping the stuff that
can't be referred in the user-space.  For adapting the changes in
uapi/emu10k1.h, the emu10k1 driver code is also slightly modified.
Most of changes are pointer cast.

Link: https://lore.kernel.org/r/20191220153415.2740-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb-audio: fix set_format altsetting sanity check
Johan Hovold [Fri, 20 Dec 2019 09:31:34 +0000 (10:31 +0100)]
ALSA: usb-audio: fix set_format altsetting sanity check

Make sure to check the return value of usb_altnum_to_altsetting() to
avoid dereferencing a NULL pointer when the requested alternate settings
is missing.

The format altsetting number may come from a quirk table and there does
not seem to be any other validation of it (the corresponding index is
checked however).

Fixes: b099b9693d23 ("ALSA: usb-audio: Avoid superfluous usb_set_interface() calls")
Cc: stable <stable@vger.kernel.org> # 4.18
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20191220093134.1248-1-johan@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda/realtek - Add headset Mic no shutup for ALC283
Kailang Yang [Mon, 9 Dec 2019 07:56:15 +0000 (15:56 +0800)]
ALSA: hda/realtek - Add headset Mic no shutup for ALC283

Chrome machine had humming noise from external speaker plugin at
codec D3 state.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/2692449396954c6c968f5b75e2660358@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Wed, 18 Dec 2019 19:05:39 +0000 (20:05 +0100)]
Merge branch 'for-linus' into for-next

Taking the 5.5 devel branch back into the main devel branch.
A USB-audio fix needs to be adjusted to adapt the changes that have
been formerly applied for stop_sync.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb-audio: set the interface format after resume on Dell WD19
Hui Wang [Wed, 18 Dec 2019 13:26:50 +0000 (21:26 +0800)]
ALSA: usb-audio: set the interface format after resume on Dell WD19

Recently we found the headset-mic on the Dell Dock WD19 doesn't work
anymore after s3 (s2i or deep), this problem could be workarounded by
closing (pcm_close) the app and then reopening (pcm_open) the app, so
this bug is not easy to be detected by users.

When problem happens, retire_capture_urb() could still be called
periodically, but the size of captured data is always 0, it could be
a firmware bug on the dock. Anyway I found after resuming, the
snd_usb_pcm_prepare() will be called, and if we forcibly run
set_format() to set the interface and its endpoint, the capture
size will be normal again. This problem and workaound also apply to
playback.

To fix it in the kernel, add a quirk to let set_format() run
forcibly once after resume.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191218132650.6303-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usx2y: Adjust indentation in snd_usX2Y_hwdep_dsp_status
Nathan Chancellor [Wed, 18 Dec 2019 03:42:57 +0000 (20:42 -0700)]
ALSA: usx2y: Adjust indentation in snd_usX2Y_hwdep_dsp_status

Clang warns:

../sound/usb/usx2y/usX2Yhwdep.c:122:3: warning: misleading indentation;
statement is not part of the previous 'if' [-Wmisleading-indentation]
        info->version = USX2Y_DRIVER_VERSION;
        ^
../sound/usb/usx2y/usX2Yhwdep.c:120:2: note: previous statement is here
        if (us428->chip_status & USX2Y_STAT_CHIP_INIT)
        ^
1 warning generated.

This warning occurs because there is a space before the tab on this
line. Remove it so that the indentation is consistent with the Linux
kernel coding style and clang no longer warns.

This was introduced before the beginning of git history so no fixes tag.

Link: https://github.com/ClangBuiltLinux/linux/issues/831
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Link: https://lore.kernel.org/r/20191218034257.54535-1-natechancellor@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoMerge tag 'y2038-alsa-v8-signed' of git://git.kernel.org:/pub/scm/linux/kernel/git...
Takashi Iwai [Tue, 17 Dec 2019 22:12:39 +0000 (23:12 +0100)]
Merge tag 'y2038-alsa-v8-signed' of git://git./linux/kernel/git/arnd/playground into for-next

ALSA: Fix year 2038 issue for sound subsystem

This is a series I worked on with Baolin in 2017 and 2018, but we
never quite managed to finish up the last pieces. During the
ALSA developer meetup at ELC-E 2018 in Edinburgh, a decision was
made to go with this approach for keeping best compatibility
with existing source code, and then I failed to follow up by
resending the patches.

Now I have patches for all remaining time_t uses in the kernel,
so it's absolutely time to revisit them. I have done more
review of the patches myself and found a couple of minor issues
that I have fixed up, otherwise the series is still the same as
before.

Conceptually, the idea of these patches is:

- 64-bit applications should see no changes at all, neither
  compile-time nor run-time.

- 32-bit code compiled with a 64-bit time_t currently
  does not work with ALSA, and requires kernel changes and/or
  sound/asound.h changes

- Most 32-bit code using these interfaces will work correctly
  on a modified kernel, with or without the uapi header changes.

- 32-bit code using SNDRV_TIMER_IOCTL_TREAD requires the
  updated header file for 64-bit time_t support

- 32-bit i386 user space with 64-bit time_t is broken for
  SNDRV_PCM_IOCTL_STATUS, SNDRV_RAWMIDI_IOCTL_STATUS and
  SNDRV_PCM_IOCTL_SYNC_PTR because of i386 alignment. This is also
  addressed by the updated uapi header.

- PCM mmap is currently supported on native x86 kernels
  (both 32-bit and 64-bit) but not for compat mode. This series breaks
  the 32-bit native mmap support for 32-bit time_t, but instead allows
  it for 64-bit time_t on both native and compat kernels. This seems to
  be the best trade-off, as mmap support is optional already, and most
  32-bit code runs in compat mode anyway.

- I've tried to avoid breaking compilation of 32-bit code
  as much as possible. Anything that does break however is likely code
  that is already broken on 64-bit time_t and needs source changes to
  fix them.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-alsa-v8
[2] https://lore.kernel.org/lkml/CAK8P3a2Os66+iwQYf97qh05W2JP8rmWao8zmKoHiXqVHvyYAJA@mail.gmail.com/T/#m6519cb07cfda08adf1dedea6596bb98892b4d5dc

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Changes since v7: (Arnd):
 - Fix a typo found by Ben Hutchings

Changes since v6: (Arnd):
 - Add a patch to update the API versions
 - Hide a timespec reference in #ifndef __KERNEL__ to remove the
   last reference to time_t
 - Use a more readable way to do padding and describe it in the
   changelog
 - Rebase to linux-5.5-rc1, changing include/sound/soc-component.h
   and sound/drivers/aloop.c as needed.

Changes since v5 (Arnd):
 - Rebased to linux-5.4-rc4
 - Updated to completely remove timespec and time_t references from alsa
 - found and fixed a few bugs

Changes since v4 (Baolin):
 - Add patch 5 to change trigger_tstamp member of struct snd_pcm_runtime.
 - Add patch 8 to change internal timespec.
 - Add more explanation in commit message.
 - Use ktime_get_real_ts64() in patch 6.
 - Split common code out into a separate function in patch 6.
 - Fix tu->tread bug in patch 6 and remove #if __BITS_PER_LONG == 64 macro.

Changes since v3:
 - Move struct snd_pcm_status32 to pcm.h file.
 - Modify comments and commit message.
 - Add new patch2 ~ patch6.

Changes since v2:
 - Renamed all structures to make clear.
 - Remove CONFIG_X86_X32 macro and introduced new compat_snd_pcm_status64_x86_32.

Changes since v1:
 - Add one macro for struct snd_pcm_status_32 which only active in 32bits kernel.
 - Convert pcm_compat.c to use struct snd_pcm_status_64.
 - Convert pcm_native.c to use struct snd_pcm_status_64.

4 years agoMerge tag 'asoc-fix-v5.5-rc2' of https://git.kernel.org/pub/scm/linux/kernel/git...
Takashi Iwai [Tue, 17 Dec 2019 13:18:32 +0000 (14:18 +0100)]
Merge tag 'asoc-fix-v5.5-rc2' of https://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.5

A collection of fixes since the merge window, mostly driver specific but
there's a few in the core that clean up fallout from the refactorings
done in the last cycle.

4 years agoALSA: cmipci: Allow disabling MPU port via module option
Takashi Iwai [Tue, 17 Dec 2019 08:14:48 +0000 (09:14 +0100)]
ALSA: cmipci: Allow disabling MPU port via module option

Patrick May reported that his sound card with CMI8378 chip causes a
crash / reboot when accessing the MIDI port that isn't actually
present on the board.  Moreover, despite of the documentation,
passing mpu_port=0 doesn't disable the MIDI port on this board.

It implies that the chip is a newer revision and the MPU401 port is
integrated and mapped on the PCI register.  For this chip model, the
driver enables the MPU port unconditionally, so far.

Although fixing the unexpected reboot would be the best solution, it's
not so trivial to identify the cause.  So, as a plan B, this patch
extends the existing mpu_port option usage to allow disabling the port
by specifying the value 0, just like we applied for fm_port option in
commit 2f24d159d5ac ("[ALSA] cmipci - Allow to disable integrated FM
port").  As default, the MPU port is still enabled, but user can pass
mpu_port=0 to disable it.

Reported-and-tested-by: Patrick May <dusthillresident@gmail.com>
Link: https://lore.kernel.org/r/20191217081448.1144-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda - Downgrade error message for single-cmd fallback
Takashi Iwai [Mon, 16 Dec 2019 15:12:24 +0000 (16:12 +0100)]
ALSA: hda - Downgrade error message for single-cmd fallback

We made the error message for the CORB/RIRB communication clearer by
upgrading to dev_WARN() so that user can notice better.  But this
struck us like a boomerang: now it caught syzbot and reported back as
a fatal issue although it's not really any too serious bug that worth
for stopping the whole system.

OK, OK, let's be softy, downgrade it to the standard dev_err() again.

Fixes: dd65f7e19c69 ("ALSA: hda - Show the fatal CORB/RIRB error more clearly")
Reported-by: syzbot+b3028ac3933f5c466389@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20191216151224.30013-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoASoC: wm8962: fix lambda value
Shengjiu Wang [Wed, 11 Dec 2019 11:57:22 +0000 (19:57 +0800)]
ASoC: wm8962: fix lambda value

According to user manual, it is required that FLL_LAMBDA > 0
in all cases (Integer and Franctional modes).

Fixes: 9a76f1ff6e29 ("ASoC: Add initial WM8962 CODEC driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/1576065442-19763-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoALSA: hda: Comment about snd_hdac_bus_update_rirb() and spinlock
Takashi Iwai [Fri, 13 Dec 2019 16:30:05 +0000 (17:30 +0100)]
ALSA: hda: Comment about snd_hdac_bus_update_rirb() and spinlock

The call of snd_hdac_bus_update_rirb() needs the bus->reg_lock
spinlock protection for concurrency.  Comment about it more
explicitly.

Link: https://lore.kernel.org/r/20191213163005.19116-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda: Fix regression by strip mask fix
Takashi Iwai [Sat, 14 Dec 2019 17:52:17 +0000 (18:52 +0100)]
ALSA: hda: Fix regression by strip mask fix

The commit e38e486d66e2 ("ALSA: hda: Modify stream stripe mask only
when needed") tried to address the regression by the unconditional
application of the stripe mask, but this caused yet another
regression for the previously working devices.  Namely, the patch
clears the azx_dev->stripe flag at snd_hdac_stream_clear(), but this
may be called multiple times before restarting the stream, so this
ended up with clearance of the flag for the whole time.

This patch fixes the regression by moving the azx_dev->stripe flag
clearance at the counter-part, the close callback of HDMI codec
driver instead.

Fixes: e38e486d66e2 ("ALSA: hda: Modify stream stripe mask only when needed")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205855
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204477
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191214175217.31852-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>