1
0
Fork 0
Commit Graph

752471 Commits (3d6246173798fc7a81a69ad3fd0dd55fa1779068)

Author SHA1 Message Date
Colin Ian King 3d62461737 ALSA: xen-front: remove redundant error check on ret
The error for a -ve value in ret is redundant as all previous
assignments to ret have an associated -ve check and hence it
is impossible for ret to be less that zero at the point of the
check.  Remove this redundant error check.

Detected by CoveritScan, CID#1469407 ("Logically Dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-28 11:28:44 +02:00
Joe Perches 6a73cf46ce sound: Use octal not symbolic permissions
Convert the S_<FOO> symbolic permissions to their octal equivalents as
using octal and not symbolic permissions is preferred by many as more
readable.

see: https://lkml.org/lkml/2016/8/2/1945

Done with automated conversion via:
$ ./scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace <files...>

Miscellanea:

o Wrapped one multi-line call to a single line

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-28 11:27:20 +02:00
Takashi Sakamoto 84eaaef2ae ALSA: dice: unuse second stream for MIDI conformant data channel for TC Electronic models
At present, all of models produced by TC Electronic except for Konnekt Live
are supported with hard-coded their stream formats. Studio Konnekt 48 is
sore model to support dual streams for both directions. The second stream
has no MIDI conformant data channel in its data block. But current
implementation transfers the second stream with MIDI conformant data
channel.

This commit fixes this issue.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-27 08:32:08 +02:00
Takashi Sakamoto 1ceb506d63 ALSA: dice: fix stream format parameters for TC Electronic Studio Konnekt 48
TC Electronic Studio Konnekt 48 is an application of combination of
WaveFront Dice II STD and TC Applied Technologies (TCAT) TCD2210 (Dice
Mini). The latter is on a board with BNC and optical interfaces, thus
used for signal processing for word clock, S/PDIF and ADAT. This model
doesn't support TCAT extended application protocol. For such devices,
ALSA dice driver needs to have hard-coded parameters for stream formats.

This commit fixes stream format parameters for this model. Unfortunately, at
sampling transmission frequencies over 48.0kHz, I confirmed that current
ALSA dice driver doesn't drive the device appropriately to generate sounds
(silence). I guess that this comes from timestamping quirk of Dice-based
devices, which I reported.

[alsa-devel] Dice packet sequence quirk and ALSA firewire stack in Linux 4.6
http://mailman.alsa-project.org/pipermail/alsa-devel/2016-May/107715.html

$ cd linux-firewire-utils/src
$ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  04044a26  bus_info_length 4, crc_length 4, crc 18982
404  31333934  bus_name "1394"
408  e0ff8112  irmc 1, cmc 1, isc 1, bmc 0, pmc 0, cyc_clk_acc 255,
               max_rec 8 (512), max_rom 1, gen 1, spd 2 (S400)
40c  00016604  company_id 000166     |
410  08a65810  device_id 0408a65810  | EUI-64 0001660408a65810

               root directory
               -----------------------------------------------------------------
414  00062ab9  directory_length 6, crc 10937
418  03000166  vendor
41c  8100000a  --> descriptor leaf at 444
420  17000022  model
424  8100000f  --> descriptor leaf at 460
428  0c0087c0  node capabilities per IEEE 1394
42c  d1000001  --> unit directory at 430

               unit directory at 430
               -----------------------------------------------------------------
430  0004d5c5  directory_length 4, crc 54725
434  12000166  specifier id
438  13000001  version
43c  17000022  model
440  8100000f  --> descriptor leaf at 47c

               descriptor leaf at 444
               -----------------------------------------------------------------
444  0006c490  leaf_length 6, crc 50320
448  00000000  textual descriptor
44c  00000000  minimal ASCII
450  54432045  "TC E"
454  6c656374  "lect"
458  726f6e69  "roni"
45c  63000000  "c"

               descriptor leaf at 460
               -----------------------------------------------------------------
460  0006e08e  leaf_length 6, crc 57486
464  00000000  textual descriptor
468  00000000  minimal ASCII
46c  53747564  "Stud"
470  696f4b6f  "ioKo"
474  6e6e656b  "nnek"
478  74343800  "t48"

               descriptor leaf at 47c
               -----------------------------------------------------------------
47c  0006e08e  leaf_length 6, crc 57486
480  00000000  textual descriptor
484  00000000  minimal ASCII
488  53747564  "Stud"
48c  696f4b6f  "ioKo"
490  6e6e656b  "nnek"
494  74343800  "t48"

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-27 08:32:00 +02:00
Colin Ian King 6231a895f5 ALSA: seq: fix spelling mistake "Unamed" -> "Unnamed"
Trivial fix to spelling mistake in string

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-26 23:59:32 +02:00
Takashi Iwai afe5da3eba ALSA: echoaudio: Drop superfluous macro
Drop pci_device() macro that just leads to chip->pci->dev, and pass it
directly to request_firmware().  It was introduced for allowing the
external alsa-driver kernel module builds.  Since it was discontinued
years ago, we should clean it up now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-24 11:23:02 +02:00
Takashi Iwai b6622f573e ALSA: usb-audio: Drop superfluous ifndef
Drop the superfluous #ifndef checks that had been put just for
allowing building the alsa-driver kernel modules externally.
Since the external build was discontinued years ago, let's clean up
the old kludges.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-24 11:19:42 +02:00
Takashi Iwai 96961fa048 ALSA: memalloc: Drop superfluous ifndef
Drop the superfluous #ifndef check in memalloc.h that had been put
just for allowing building the alsa-driver kernel modules externally.
Since the external build was discontinued years ago, let's clean up
the old kludges.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-24 11:14:13 +02:00
Hans de Goede 45e5fbc273 ALSA: hda: Add ASRock H81M-HDS to the power_save blacklist
Power-saving is causing plops on audio start/stop on ASRock H81M-HDS
machines, add these to the power_save blacklist.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1525104
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-23 16:01:13 +02:00
Hans de Goede 38d9c12c0a ALSA: hda: Add Gigabyte P55A-UD3 and Z87-D3HP to the power_save blacklist
Power-saving is causing plops on audio start/stop on Gigabyte
P55A-UD3 and Gigabyte Z87-D3HP machines, add these to the power_save
blacklist.

Note these 2 boards both use 1458:a002 as subsystem ids, so they share
a single entry.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1525104
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-23 16:00:17 +02:00
Hans de Goede b529ef2464 ALSA: hda: Add Clevo W35xSS_370SS to the power_save blacklist
Power-saving is causing a plop and silences the first 2 seconds
(give or take) of audio, silencing notifications sounds on Medion /
Clevo W35xSS_370SS laptops.

Add the Clevo W35xSS_370SS to the power_save blacklist.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1581607
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-23 15:59:33 +02:00
Hans de Goede dd6dd53654 ALSA: hda: Add Intel NUC7i3BNB to the power_save blacklist
Power-saving is causing a humming sound when active on the Intel
NUC7i3BNB, add it to the blacklist.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520902
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-23 15:58:50 +02:00
Takashi Iwai 09b83d107d ALSA: hda/conexant - Add hp-mic-fix model string
Add "hp-mic-fix" model string for Conexant codecs so that user can
test the quirk without recompiling.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-22 13:45:37 +02:00
Takashi Iwai f16041df4c ALSA: hda/conexant - Add fixup for HP Z2 G4 workstation
HP Z2 G4 requires the same workaround as other HP machines that have
no mic-pin detection.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-22 13:45:24 +02:00
Yisheng Xie 2cc47d31eb ALSA: oxfw: use match_string() helper
match_string() returns the index of an array for a matching string,
which can be used intead of open coded variant.

Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-22 09:25:42 +02:00
Takashi Iwai 96382b4f56 Merge branch 'topic/xen' into for-next
Merge Xen para-virtualized frontend driver from Oleksandr Andrushchenko.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-21 22:21:58 +02:00
Takashi Sakamoto d0aa590962 ALSA: dice: add stream format parameters for TC Electronic Digital Konnekt x32
TC Electronic Digital Konnekt x32 is an application of WaveFront DiceII STD
and doesn't support TCAT extended application protocol. For such devices,
ALSA dice driver needs to have hard-coded parameters for stream formats.

This commit adds stream format parameters for this model. Unfortunately, at
sampling transmission frequencies of 88.2/96.0kHz, I confirmed that current
ALSA dice driver doesn't drive the device appropriately due to detecting
packet discontinuities.

$ journalctl
kernel: snd_dice fw1.0: Detect discontinuity of CIP: 90 80

At the frequencies, the device transfers 16 data blocks per packet and 16
data channels per data block, as a result one packet includes 1032 bytes
if it's not NODATA. However, as long as I checked, the device often
postpone packet transmission and continue with truncated payload than
metadata in isochronous packet header. Below is a sample of sequence I got.

sec cycle bytes       CIP1       CIP2
 37  3314  1032 0x01100090 0x900449E2
 37  3315     8 0x011000A0 0x9004FFFF
 37  3316  1032 0x011000A0 0x900461E2
 37  3317  1032 0x011000B0 0x900475E2
 37  3318  1032 0x011000C0 0x900489E2
 37  3319     8 0x011000D0 0x9004FFFF
 37  3320  1032 0x011000D0 0x9004A1E2
 37  3321  1032 0x011000E0 0x9004B5E2
 37  3322  1032 0x011000F0 0x9004C9E2
 37  3323     8 0x01100000 0x9004FFFF
 37  3324  1032 0x01100000 0x9004E1E2
 37  3325  1032 0x01100010 0x9004F5E2
 37  3326  1032 0x01100020 0x900409E2
 37  3327     8 0x01100030 0x9004FFFF
 37  3328  1032 0x01100030 0x900421E2
 37  3329  1032 0x01100040 0x900435E2
 37  3330  (skip)
 37  3331  (skip)
 37  3332  (skip)
 37  3333  (skip)
 37  3334  (skip)
 37  3335  (skip)
 37  3336  (skip)
 37  3337  (skip)
 37  3338  (skip)
 37  3339  (skip)
 37  3340  (skip)
 37  3341  (skip)
 37  3342  (skip)
 37  3343  (skip)
 37  3344  (skip)
 37  3345  (skip)
 37  3346  (skip)
 37  3347  (skip)
 37  3348  (skip)
 37  3349  (skip)
 37  3350  (skip)
 37  3351  (skip)
 37  3352  (skip)
 37  3353  (skip)
 37  3354  (skip)
 37  3355  (skip)
 37  3356  (skip)
 37  3357  (skip)
 37  3358  (skip)
 37  3359  (skip)
 37  3360  (skip)
 37  3361  (skip)
 37  3362  (skip)
 37  3363  (skip)
 37  3364  (skip)
 37  3365  (skip)
 37  3366  (skip)
 37  3367  1032 0x01100050 0x900461E1
 37  3368  1032 0x01100060 0x900475E1
 37  3369  1032 0x01100070 0x9004A1E1
 37  3370  1032 0x01100080 0x9004A1E1 but content of payload is truncated.
 37  3371  (skip)
 37  3371  1032 0x01100080 0x9004B5E0 detect discontinuity
 37  3372  1032 0x01100090 0x9004C9E0
 37  3373  1032 0x011000A0 0x9004E1E0
 37  3374  1032 0x011000B0 0x9004F5E0
 37  3375  1032 0x011000C0 0x900409E0
 37  3376  1032 0x011000D0 0x900421E0
 37  3377  1032 0x011000E0 0x900435E0
 37  3378  1032 0x011000F0 0x900449DF
 37  3379     8 0x01100000 0x9004FFFF
 37  3380  1032 0x01100000 0x900461DF
 37  3381  1032 0x01100010 0x900475DF
 37  3382  1032 0x01100020 0x900489DF
 37  3383     8 0x01100030 0x9004FFFF
 37  3384  1032 0x01100030 0x9004A1DF
 37  3385  1032 0x01100040 0x9004B5DF
 37  3386  1032 0x01100050 0x9004C9DF
 37  3387     8 0x01100060 0x9004FFFF

I cannot confirm this quirks with Windows driver. ALSA dice driver has a
cause if assumed differences between these two drivers are ways of
timestampling to RX packets from the drivers to the device. I've already
reported timestamping quirk of Dice-based devices and this might bring
this issue.

[alsa-devel] Dice packet sequence quirk and ALSA firewire stack in Linux 4.6
http://mailman.alsa-project.org/pipermail/alsa-devel/2016-May/107715.html

Well, nevertheless, I enable ALSA dice driver to work at the frequencies.
This may brings inconvenience to users but I expect developers and users
to fix it.

$ cd linux-firewire-utils/src
$ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  040423bb  bus_info_length 4, crc_length 4, crc 9147
404  31333934  bus_name "1394"
408  e0ff8112  irmc 1, cmc 1, isc 1, bmc 0, pmc 0, cyc_clk_acc 255,
               max_rec 8 (512), max_rom 1, gen 1, spd 2 (S400)
40c  00016604  company_id 000166     |
410  0c232c28  device_id 040c232c28  | EUI-64 000166040c232c28

               root directory
               -----------------------------------------------------------------
414  0006b6cb  directory_length 6, crc 46795
418  03000166  vendor
41c  8100000a  --> descriptor leaf at 444
420  17000030  model
424  8100000f  --> descriptor leaf at 460
428  0c0087c0  node capabilities per IEEE 1394
42c  d1000001  --> unit directory at 430

               unit directory at 430
               -----------------------------------------------------------------
430  000476c2  directory_length 4, crc 30402
434  12000166  specifier id
438  13000001  version
43c  17000030  model
440  81000010  --> descriptor leaf at 480

               descriptor leaf at 444
               -----------------------------------------------------------------
444  0006c490  leaf_length 6, crc 50320
448  00000000  textual descriptor
44c  00000000  minimal ASCII
450  54432045  "TC E"
454  6c656374  "lect"
458  726f6e69  "roni"
45c  63000000  "c"

               descriptor leaf at 460
               -----------------------------------------------------------------
460  000772b4  leaf_length 7, crc 29364
464  00000000  textual descriptor
468  00000000  minimal ASCII
46c  44696769  "Digi"
470  74616c4b  "talK"
474  6f6e6e65  "onne"
478  6b747833  "ktx3"
47c  32000000  "2"

               descriptor leaf at 480
               -----------------------------------------------------------------
480  000772b4  leaf_length 7, crc 29364
484  00000000  textual descriptor
488  00000000  minimal ASCII
48c  44696769  "Digi"
490  74616c4b  "talK"
494  6f6e6e65  "onne"
498  6b747833  "ktx3"
49c  32000000  "2"

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-21 11:33:37 +02:00
Dan Carpenter ed1812c44c ALSA: dice: fix a bounds check in snd_dice_detect_tcelectronic_formats()
The "entry" pointer is always non-NULL so this test for out of bounds
won't work.

Fixes: f1f0f330b1 ("ALSA: dice: add parameters of stream formats for models produced by TC Electronic")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-18 13:38:34 +02:00
Takashi Iwai ed14d9ae53 Merge branch 'topic/timer-fixes' into for-next
Pull the fixes for possible races in the resolution callback.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-18 08:55:36 +02:00
Melvin Vermeeren 7c1543f6b5 ALSA: dice: add stream format parameters for Mytek devices
--nextPart3916812.EicPReet6m
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

Mytek manufactures some equipment with DICE-based firewire ports. These
devices contain old versions of DICE firmware which lacks detailed
stream format reporting for all sampling clock modes.

Building upon the recent work by Takashi Sakamoto, hard-coded parameters
are added for the Stereo 192 DSD-DAC. When the device vendor and model
match the coded parameters are copied into the stream format cache.

Signed-off-by: Melvin Vermeeren <mail@mel.vin>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-18 08:53:51 +02:00
Takashi Iwai 9d4d207d13 ALSA: timer: Assure timer resolution access always locked
There are still many places calling the timer's hw.c_resolution
callback without lock, and this may lead to some races, as we faced in
the commit a820ccbe21 ("ALSA: pcm: Fix UAF at PCM release via PCM
timer access").

This patch changes snd_timer_resolution() to take the timer->lock for
avoiding the races.  A place calling this function already inside the
lock (from the notifier) is replaced with the
snd_timer_hw_resolution() accordingly, as well as wrapping with the
lock around another place calling snd_timer_hw_resolution(), too.

Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-18 08:49:13 +02:00
Takashi Iwai 21244e3d6a ALSA: seq: Avoid open-code for getting timer resolution
Instead of open-coding for getting the timer resolution, use the
standard snd_timer_resolution() helper.

The original code falls back to the callback function when the
resolution is zero, but it must be always so when the callback
function is defined.  So this should be no functional change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-18 08:49:13 +02:00
Takashi Iwai fdcb5761c1 ALSA: timer: Simplify timer hw resolution calls
There multiple open-codes to get the hardware timer resolution.
Make a local helper function snd_timer_hw_resolution() and call it
from all relevant places.

There is no functional change by this, just a preliminary work for the
following timer resolution hardening patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-18 08:49:12 +02:00
Ben Hutchings 3ae1809725 ALSA: timer: Fix pause event notification
Commit f65e0d2998 ("ALSA: timer: Call notifier in the same spinlock")
combined the start/continue and stop/pause functions, and in doing so
changed the event code for the pause case to SNDRV_TIMER_EVENT_CONTINUE.
Change it back to SNDRV_TIMER_EVENT_PAUSE.

Fixes: f65e0d2998 ("ALSA: timer: Call notifier in the same spinlock")
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-18 08:43:59 +02:00
Ruslan Bilovol 6cd17ea70b ALSA: usb: stream: fix potential memory leak during uac3 interface parsing
UAC3 channel map is created during interface parsing,
and in some cases was not freed in failure paths.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-18 08:40:40 +02:00
Takashi Iwai 11d42c8103 ALSA: emu10k1: Rate-limit error messages about page errors
The error messages at sanity checks of memory pages tend to repeat too
many times once when it hits, and without the rate limit, it may flood
and become unreadable.  Replace such messages with the *_ratelimited()
variant.

Bugzilla: http://bugzilla.opensuse.org/show_bug.cgi?id=1093027
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-17 20:02:23 +02:00
Colin Ian King bf8b47fe20 ALSA: emu10k1: fix spelling mistake: "Caputre" -> "Capture"
Trivial fix to spelling mistakes in audigy_outs arrays.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-17 10:06:02 +02:00
Takashi Iwai dc82e52492 ALSA: core: Assure control device to be registered at last
The commit 289ca025ee ("ALSA: Use priority list for managing device
list") changed the way to register/disconnect/free devices via a
single priority list.  This helped to make behavior consistent, but it
also changed a slight behavior change: namely, the control device is
registered earlier than others, while it was supposed to be the very
last one.

I've put SNDRV_DEV_CONTROL in the current position as the release of
ctl elements often conflict with the private ctl elements some PCM or
other components may create, which often leads to a double-free.
But, the order of register and disconnect should be indeed fixed as
expected in the early days: the control device gets registered at
last, and disconnected at first.

This patch changes the priority list order to move SNDRV_DEV_CONTROL
as the last guy to assure the register / disconnect order.  Meanwhile,
for keeping the messy resource release order, manually treat the
control and lowlevel devices as last freed one.

Additional note:
The lowlevel device is the device where a card driver creates at
probe.  And, we still keep the release order control -> lowlevel, as
there might  be link from a control element back to a lowlevel object.

Fixes: 289ca025ee ("ALSA: Use priority list for managing device list")
Reported-by: Tzung-Bi Shih <tzungbi@google.com>
Tested-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-17 08:21:23 +02:00
Takashi Iwai 377a879d98 ALSA: usb-audio: Apply rate limit to warning messages in URB complete callback
retire_capture_urb() may print warning messages when the given URB
doesn't align, and this may flood the system log easily.
Put the rate limit to the message for avoiding it.

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1093485
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-16 20:07:18 +02:00
Oleksandr Andrushchenko 190a5f2e08 MAINTAINERS: Add ALSA: xen-front: maintainer entry
Add myself as sound/xen maintainer.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-16 12:59:57 +02:00
Oleksandr Andrushchenko 1cee559351 ALSA: xen-front: Implement ALSA virtual sound driver
Implement essential initialization of the sound driver:
  - introduce required data structures
  - handle driver registration
  - handle sound card registration
  - register sound driver on backend connection
  - remove sound driver on backend disconnect

Initialize virtual sound card with streams according to the
Xen store configuration.

Implement ALSA driver operations including:
  - manage frontend/backend shared buffers
  - manage Xen bus event channel states

Implement requests from front to back for ALSA
PCM operations.
  - report ALSA period elapsed event: handle XENSND_EVT_CUR_POS
    notifications from the backend when stream position advances
    during playback/capture. The event carries a value of how
    many octets were played/captured at the time of the event.
  - implement explicit stream parameter negotiation between
    backend and frontend: handle XENSND_OP_HW_PARAM_QUERY request
    to read/update configuration space for the parameter given:
    request passes desired parameter interval and the response to
    this request returns min/max interval for the parameter to be used.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-16 12:59:57 +02:00
Oleksandr Andrushchenko d6e0fbb82e ALSA: xen-front: Implement handling of shared buffers
Implement shared buffer handling according to the
para-virtualized sound device protocol at xen/interface/io/sndif.h:
  - manage buffer memory
  - handle granted references
  - handle page directories

[ Fixed missing linux/kernel.h inclusion -- tiwai ]

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-16 12:59:50 +02:00
Oleksandr Andrushchenko 788ef64a2c ALSA: xen-front: Implement Xen event channel handling
Handle Xen event channels:
  - create for all configured streams and publish
    corresponding ring references and event channels in Xen store,
    so backend can connect
  - implement event channels interrupt handlers
  - create and destroy event channels with respect to Xen bus state

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-16 12:58:41 +02:00
Oleksandr Andrushchenko fd3b36045c ALSA: xen-front: Read sound driver configuration from Xen store
Read configuration values from Xen store according
to xen/interface/io/sndif.h protocol:
  - introduce configuration structures for different
    components, e.g. sound card, device, stream
  - read PCM HW parameters, e.g rate, format etc.
  - detect stream type (capture/playback)
  - read device and card parameters

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-16 12:58:39 +02:00
Oleksandr Andrushchenko cc3196ae19 ALSA: xen-front: Introduce Xen para-virtualized sound frontend driver
Introduce skeleton of the para-virtualized Xen sound
frontend driver.

Initial handling for Xen bus states: implement
Xen bus state machine for the frontend driver according to
the state diagram and recovery flow from sound para-virtualized
protocol: xen/interface/io/sndif.h.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-16 12:58:36 +02:00
Takashi Sakamoto 862154bbd7 ALSA: hda/ca0132: constify parameter table for effects
This module has a table for parameters of each effects. This table is
read-only and can have 'const' qualifier.

This commit adds this optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-15 18:05:30 +02:00
Takashi Sakamoto 0cc1aa7162 ALSA: hda/ca0132: merge strings just for printk
This module has some function-local strings just for printk therefore
it can be merged into format string.

This commit applies this optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-15 18:05:29 +02:00
Takashi Sakamoto 3a03f83b16 ALSA: hda/ca0132: constify read-only members of string array
This module has some strings just for printk therefore they can be
read-only.

This commit applies this optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-15 18:05:28 +02:00
Takashi Sakamoto b0eaa0721d ALSA: hda/ca0132: constify templates for control element set
An array of templates for control element set is passed as an
argument for snd_hda_add_new_ctls(). This argument has 'const'
qualifier therefore the passed array can have the qualifier.

This commit adds this optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-15 18:05:27 +02:00
Jorge Sanjuan 710669455d ALSA: usb-audio: UAC3: Parse Input Terminal number of channels.
Obtain the number of channels for the Input Terminal from the
Logical Cluster Descriptor. This achieves a useful minimal parsing
of this unit so it can be used in other units in the topology.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Reviewed-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Tested-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-15 07:36:06 +02:00
Jorge Sanjuan 1d38f5d828 ALSA: usb-audio: UAC3 Add support for connector insertion.
This adds support for the UAC3 insertion controls. The status
is reported as a boolean value in the same way it used to do
for UAC2. Hence, the presence of any connector in the response
will make the control saying the jack is connected.

The UAC2 support for this control has been moved to a dedicated
control for connectors as both UAC2 and UAC3 follow a specific
Control Request Parameter Block for this control. This parameter
block for UAC3 could not be read in the same simplistic
manner as in UAC2.

This implementation is not requesting additional information
from the HIGH CAPABILITY Connectors descriptor.

Tested with an UAC3 device with UAC2 as legacy configuration.
The connector status can be read with `amixer` and the interrupt
is also caught with `alsactl monitor`.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Reviewed-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Tested-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-15 07:35:34 +02:00
Jorge Sanjuan 6cfd839ae7 ALSA: usb-audio: UAC3. Add support for mixer unit.
This adds support for the MIXER UNIT in UAC3. All the information
is obtained from the (HIGH CAPABILITY) Cluster's header. We don't
read the rest of the logical cluster to obtain the channel config
as that wont make any difference in the current mixer behaviour.

The name of the mixer unit is not yet requested as there is not
support for the UAC3 Class Specific String requests.

Tested in an UAC3 device working as a HEADSET with a basic mixer
unit (same as the one in the BADD spec) with no controls.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Reviewed-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Tested-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-15 07:32:50 +02:00
Takashi Iwai 8def12d9cd Merge branch 'for-linus' into for-next
Back-merge of UAC3 fixes for applying further enhancements.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-15 07:30:23 +02:00
Jorge Sanjuan c99f0802e4 ALSA: usb-audio: Use Class Specific EP for UAC3 devices.
bmAtributes offset doesn't exist in the UAC3 CS_EP descriptor.
Hence, checking for pitch control as if it was UAC2 doesn't make
any sense. Use the defined UAC3 offsets instead.

Fixes: 9a2fe9b801 ("ALSA: usb: initial USB Audio Device Class 3.0 support")
Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Reviewed-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-15 07:29:10 +02:00
Fengguang Wu c5f13d75fb ALSA: hda/ca0132: fix array_size.cocci warnings
sound/pci/hda/patch_ca0132.c:5062:50-51: WARNING: Use ARRAY_SIZE
sound/pci/hda/patch_ca0132.c:5092:50-51: WARNING: Use ARRAY_SIZE

 Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element

Semantic patch information:
 This makes an effort to find cases where ARRAY_SIZE can be used such as
 where there is a division of sizeof the array by the sizeof its first
 element or by any indexed element or the element type. It replaces the
 division of the two sizeofs by ARRAY_SIZE.

Generated by: scripts/coccinelle/misc/array_size.cocci

Fixes: 47cdf76e44 ("ALSA: hda/ca0132: Add new control changes for SBZ + R3Di")
CC: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-14 21:23:51 +02:00
Takashi Sakamoto 4844f51282 ALSA: isight: use position offset macro of TLV data
A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-14 17:48:14 +02:00
Takashi Sakamoto 51cdc8b6a6 ALSA: hda: use position offset macro of TLV data
A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-14 17:47:57 +02:00
Takashi Sakamoto 841bdb7c0b ALSA: vmaster: use position offset macro of TLV data
A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-14 17:47:48 +02:00
Takashi Sakamoto e6f32bf48f ALSA: control: complement TLV macro for db-minmax and db-linear types
A commit 08f9f4485f ('ALSA: core api: define offsets for TLV items')
introduced a series of macro for offset of db-scale type of TLV, however
there are some types of TLV to add similar macros.

This commit complements macros for offset of db-minmax and db-linear types
of TLV data.

Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-14 17:47:37 +02:00
Jeremy Soller 2f0d520a1a ALSA: hda/realtek - Clevo P950ER ALC1220 Fixup
This adds support for the P950ER, which has the same required fixup as
the P950HR, but has a different PCI ID.

Signed-off-by: Jeremy Soller <jeremy@system76.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-13 18:55:46 +02:00