Commit Graph

839651 Commits

Author SHA1 Message Date
Takashi Sakamoto d8f291b7b8 ALSA: firewire-tascam: code refactoring for pcm.hw_params/hw_free callbacks
The pairs of pcm.hw_params callbacks and .hw_free callbacks for both
direction have no differences.

This commit unifies the pairs.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-11 11:36:21 +02:00
Takashi Sakamoto ece92831f0 ALSA: firewire-tascam: minor code refactoring to finish streaming session
The operation to finish packet streaming corresponds to stopping
isochronous contexts.

This commit applies code refactoring to move codes to stop into
a helper function to finish the session.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-11 11:36:21 +02:00
Takashi Sakamoto a0c049a647 ALSA: firewire-tascam: update isochronous resources when starting packet streaming after bus reset
After bus reset, isochronous resource manager releases all of allocated
isochronous resources. The nodes to restart packet streaming should
request reallocation of the resources.

However, between the bus-reset and invocation of 'struct fw_driver.update'
handler, ALSA PCM application can detect this situation by XRUN because
the target device cancelled to transmit packets once bus-reset occurs.

Due to the above mechanism, ALSA firewire-tascam driver just stops
packet streaming in the update handler, thus pcm.prepare handler
should request the reallocation.

This commit requests the reallocation in pcm.prepare callback when
bus generation is changed.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-11 11:36:20 +02:00
Takashi Sakamoto 07b266424d ALSA: firewire-tascam: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks
Once allocated, isochronous resources are available for packet
streaming, even if the streaming is cancelled. For this reason,
current implementation handles allocation of the resources and
starting packet streaming at the same time. However, this brings
complicated procedure to start packet streaming.

This commit separates the allocation and starting. The allocation is
done in pcm.hw_params callback and available till pcm.hw_free callback.
Even if any XRUN occurs, pcm.prepare callback is done to restart
packet streaming for allocated the resources.

There are two points to stop packet streaming; in pcm.hw_params and
pcm.prepare callbacks.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-11 11:36:19 +02:00
Takashi Sakamoto a364af2eec ALSA: firewire-tascam: code refactoring for release of isochronous resources
This commit is a part of preparation to perform allocation/release
of isochronous channels in pcm.hw_params/hw_free callbacks.

This commit obsoletes a helper function to release isochronous resources
for both direction.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-11 11:36:19 +02:00
Takashi Sakamoto 810b37ff29 ALSA: firewire-tascam: code refactoring for reservation of isochronous resources
This commit is a part of preparation to perform allocation/release
of isochronous channels in pcm.hw_params/hw_free callbacks.

This commit applies minor code refactoring for a helper function to
allocate isochronous resources.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-11 11:36:18 +02:00
Takashi Sakamoto 2ef0b7cf16 ALSA: firewire-tascam: code refactoring for registration of isochronous channels
This commit is a part of preparation to perform allocation/release
of isochronous channels in pcm.hw_params/hw_free callbacks.

The registration of isochronous channels is done just after allocation
of isochronous resources. This commit separates the registration just
before starting packet streaming.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-11 11:36:17 +02:00
YueHaibing d670d44582 ALSA: lx6464es - Remove set but not used variables 'orun_mask, urun_mask'
Fixes gcc '-Wunused-but-set-variable' warning:

sound/pci/lx6464es/lx_core.c: In function 'lx_interrupt_handle_async_events':
sound/pci/lx6464es/lx_core.c:990:6: warning:
 variable 'urun_mask' set but not used [-Wunused-but-set-variable]
sound/pci/lx6464es/lx_core.c:989:6: warning:
 variable 'orun_mask' set but not used [-Wunused-but-set-variable]

They are never used, so can be removed.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-11 11:35:04 +02:00
Takashi Iwai e046b64b15 ALSA: hda/ca0132: Use struct_size()
For code simplification and safety, use struct_size() macro for
calculating the dsp_image_seg object size.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-31 11:47:24 +02:00
Takashi Iwai a2d4560f0b ALSA: hda: Use struct_size()
For code simplification and safety, use struct_size() macro for
calculating the hda_conn_list object size with the variable array.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-31 11:46:49 +02:00
Takashi Iwai 65be958088 ALSA: control: Use struct_size()
For code simplification and safety, use struct_size() macro for
calculating the snd_kcontrol object size with the variable array.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-31 11:44:44 +02:00
Takashi Iwai c86ccfba17 Merge branch 'topic/hda-polling-mode' into for-next
A follow-up fix for the HD-audio previous polling mode changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-30 11:01:24 +02:00
Bard Liao ee8829dc60 ALSA: hda: fix: lock reg_lock before calling snd_hdac_bus_update_rirb
The patch is to fix commit 5e13cf6cd6
(ALSA: hda: add polling mode in snd_hdac_bus_get_response)
spin_lock_irq should be called before snd_hdac_bus_update_rirb.

Fixes: 5e13cf6cd6 ("ALSA: hda: add polling mode in snd_hdac_bus_get_response")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-30 11:00:21 +02:00
Takashi Iwai 968e8e9fde Merge branch 'topic/line6-cleanup' into for-next
Pull LINE6 driver cleanups and fixes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 09:42:29 +02:00
Takashi Iwai f23a09eea1 ALSA: line6: Use container_of()
... instead of unconditional cast.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 09:05:31 +02:00
Takashi Iwai be8fd484e9 ALSA: line6: Drop superfluous timer helper function
Now all timer usages in line6 drivers are gone, we can get rid of some
helper macro and function that became superfluous.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 08:59:27 +02:00
Takashi Iwai 6ea53391c0 ALSA: line6: variax: Rewrite complex timer & work combo with a delayed work
Variax driver had a very complex and staged startup sequence using
multiple timers and a work.  This patch simplifies the procedure to a
single delayed work.

Now the startup stage consists of:
- VARIAX_STARTUP_VERSIONREQ:
  requesting the version and the message handler raises up to the next
  stage upon receiving the reply.  The request is repeated until a
  reply arrives.
- VARIAX_STARTUP_ACTIVATE:
  does activation, and queue for the next stage.
- VARIAX_STARTUP_SETUP:
  registers the card.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 08:59:26 +02:00
Takashi Iwai a91c1da77c ALSA: line6: podhd: Rewrite complex timer & work combo with a delayed work
POD HD driver had a complex staged startup sequence with both timer
and work.  This patch simplifies it to a single delayed work with a
single stage.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 08:59:23 +02:00
Takashi Iwai 516d3d1bed ALSA: line6: pod: Rewrite complex timer & work combo with a delayed work
The POD driver had a complex staged startup procedure using both timer
and work.  This patch simplifies it via a single delayed work with the
reduced stages.

Now basically only two intermediate stages:
- POD_STARTUP_VERSIONREQ:
  requesting the version information and the process_message callback
  triggers the next stage,
- POD_STARTUP_SETUP:
  registering the actual card object.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 08:56:59 +02:00
Takashi Iwai 0b074ab7fc ALSA: line6: Assure canceling delayed work at disconnection
The current code performs the cancel of a delayed work at the late
stage of disconnection procedure, which may lead to the access to the
already cleared state.

This patch assures to call cancel_delayed_work_sync() at the beginning
of the disconnection procedure for avoiding that race.  The delayed
work object is now assigned in the common line6 object instead of its
derivative, so that we can call cancel_delayed_work_sync().

Along with the change, the startup function is called via the new
callback instead.  This will make it easier to port other LINE6
drivers to use the delayed work for startup in later patches.

Reported-by: syzbot+5255458d5e0a2b10bbb9@syzkaller.appspotmail.com
Fixes: 7f84ff68be ("ALSA: line6: toneport: Fix broken usage of timer for delayed execution")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 08:42:45 +02:00
Takashi Iwai 213ed4b807 Merge branch 'topic/hda-polling-mode' into for-next
Pull the HD-audio polling mode changes, moving the stuff into HD-audio
core for re-using it in ASoC.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 07:53:49 +02:00
Bard Liao 64ca9d9fcb ASoC: SOF: Force polling mode on CFL and CNL
There is a workaround in legacy HDA codec for too long time respone
with CFL machine. We need the same workaround on SOF driver. The same
issue is also seen on CNL machine.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 07:52:02 +02:00
Bard Liao fa763f1b28 ALSA: hda - Force polling mode on CNL for fixing codec communication
We observed the same issue as reported by commit a8d7bde23e
("ALSA: hda - Force polling mode on CFL for fixing codec communication")
We don't have a better solution. So apply the same workaround to CNL.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 07:52:02 +02:00
Bard Liao 5e13cf6cd6 ALSA: hda: add polling mode in snd_hdac_bus_get_response
Polling mode is useful if a machine somehow missed an expected IRQ.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 07:52:02 +02:00
Bard Liao 8af42130b5 ALSA: hda: move polling_mode flag to struct hdac_bus
polling mode is a useful function in the get_response function. Move
polling_mode flag from struct azx to struct hdac_bus so people can
implement polling mode in their own get_response function without
adding a polling_mode flag in their local chip structure.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 07:52:02 +02:00
Bard Liao bd2956e40e ALSA: hda: assign polling_mode after azx_bus_init
We will move the polling_mode flag from struct azx to struct hdac_bus,
and the flag should be assigned after bus init.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-28 07:52:02 +02:00
Takashi Sakamoto 98e3e43b59 ALSA: firewire-lib: refactoring to obsolete IR packet handler
As a result of heavy refactoring based on IR context header, the packet
handler becomes simpler.

This commit merges the packet handler into function for IR context
callback. The logic to parse IR context header and tracepoints event is
split to a function.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-24 11:18:03 +02:00
Takashi Sakamoto 6bc1a2699b ALSA: firewire-lib: refactoring to obsolete IT packet handler
As a result of heavy refactoring based on IT packet header, the packet
handler becomes simpler.

This commit merges the packet handler into function for IT context
callback. The logic to build IT packet header and tracepoints event is
split to a function.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-24 11:18:02 +02:00
Takashi Sakamoto e703965a12 ALSA: firewire-lib: fix inverted node IDs for amdtp_packet events
The amdtp_packet events have inverted node IDs for src/dst. This commit
fixes the bug.

Fixes: 8d3f1fdf52 ("ALSA: firewire-lib: unify tracing events to 'amdtp_packet' event")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-24 11:18:01 +02:00
Takashi Sakamoto 3c19492315 ALSA: firewire-lib: fix data block counter for incoming packet without CIP header
The value of data block counter is not calculated for incoming packet
without CIP header. This commit fixes the bug.

Fixes: 947b437e12 ("ALSA: firewire-lib: unify packet handler for IR context")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-24 11:18:01 +02:00
Takashi Sakamoto b18f0cfaf1 ALSA: firewire-lib: use 8 byte packet header for IT context to separate CIP header from CIP payload
In Linux firewire subsystem, for IT context, some quadlets of isochronous
packet payload can be indicated as a part of packet header to queue to
the context.

This commit uses the packet header to split CIP headers from CIP
payload. As a result, regardless of CIP or non-CIP, context payload
includes data blocks only.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-24 09:05:16 +02:00
Takashi Sakamoto 6007bf5460 ALSA: firewire-lib: code refactoring to queueing packets
This commit is a preparation to queue IT packet with header. To enable
packet handler to fill the header, this commit uses kernel stack for
data structure of packet parameter in several part of this file.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-24 09:05:16 +02:00
Takashi Sakamoto 16be458993 ALSA: firewire-lib: unify packet handler for IT context
The handlers for packet with CIP and without CIP include common codes.
This commit unifies them and remove an member for pointer to callback
function from data structure.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-24 09:05:15 +02:00
Takashi Sakamoto 252219c7b3 ALSA: firewire-lib: split helper function to generate CIP header
This is minor code refactoring to split a function to generate CIP
header.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-24 09:05:15 +02:00
Ayman Bagabas 0fbf21c3b3 ALSA: hda/realtek - Enable micmute LED for Huawei laptops
Since this LED is found on all Huawei laptops, we can hook it to
huawei-wmi platform driver to control it.

Also, some renames have been made to use product name instead of common
name to avoid confusions.

Fixes: 8ac51bbc4c ("ALSA: hda: fix front speakers on Huawei MBXP")
Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-24 08:00:53 +02:00
Philippe Bekaert e4e07c6cdc ALSA: hdspm: Fix single speed ADAT capture and playback with RME HDSPe AIO
By taking into account the mapping from logical to DMA channels when
enabling or disabling audio channels, ADAT channels 3 to 8 on the RME
HDSPe AIO card are now correctly captured and played back in single speed
mode.

Since the mapping is an identity mapping for all cards except AIO and
RayDAT, only those cards should be affected by this patch. It was tested on
an AIO card. The patch needs testing on other cards, in particular RayDAT.

Note: this patch does not solve ADAT capture and playback issues in double
or triple speed mode. That seems to be another problem.

Signed-off-by: Philippe Bekaert <Philippe.Bekaert@panokkel.be>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-24 08:00:10 +02:00
Gustavo A. R. Silva 92bfa664ae ALSA: pcm: oss: Use struct_size() helper
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes, in particular in the
context in which this code is being used.

So, replace the following form:

sizeof(struct rate_priv) + src_format->channels * sizeof(struct rate_channel)

with:

struct_size(data, channels, src_format->channels)

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-24 07:59:19 +02:00
Takashi Sakamoto 947b437e12 ALSA: firewire-lib: unify packet handler for IR context
Usage of 16 bytes IR context header allows to handle context payload by
the same code for with-CIP and without-CIP packets.

This commit unifies both handlers of with-CIP and without-CIP packets.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-23 12:19:42 +02:00
Takashi Sakamoto f11453c7cc ALSA: firewire-lib: use 16 bytes IR context header to separate CIP header
In IR context, some quadlets of packet payload can be included into
context header. This is good for packet with CIP header because the
context payload buffer can includes data blocks only for with-CIP and
without-CIP pakets.

This commit uses 16 bytes IR context header for this purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-23 12:19:41 +02:00
Takashi Sakamoto e335425b65 ALSA: firewire-lib: split helper function to check incoming CIP header
A parser for CIP header in incoming packet is enough large.

This commit splits it into a helper function to better looks of packet
handler.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-23 12:19:40 +02:00
Takashi Sakamoto 8a400b9996 ALSA: firewire-lib: compute pointer to payload buffer in context handler
The value of pointer to payload buffer is computed in each packet
handler, however the pointer can be decided before call of packet
handler.

This commit adds an argument for the pointer to the packet handler to
reduce codes to compute for the pointer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-23 12:19:40 +02:00
Takashi Sakamoto 6f3c07d03c ALSA: firewire-lib: calculate the length of packet payload in packet handler
In current packet handler, the length of payload is given as an argument
of callback function, however this value is just required to process
payload of transferred isoc packet, thus just for IR context.

This commit replaces the argument for payload of packet with the
argument of context header. As a result, the length of payload is
computed in packet handler for IR context.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-23 12:19:39 +02:00
Takashi Sakamoto 07ea238ca1 ALSA: firewire-lib: use clear name for variable of CIP header
This commit is to distinguish variable of CIP header from variable of
isochronous context header.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-23 12:19:38 +02:00
Kailang Yang 317d931392 ALSA: hda/realtek - Set default power save node to 0
I measured power consumption between power_save_node=1 and power_save_node=0.
It's almost the same.
Codec will enter to runtime suspend and suspend.
That pin also will enter to D3. Don't need to enter to D3 by single pin.
So, Disable power_save_node as default. It will avoid more issues.
Windows Driver also has not this option at runtime PM.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-23 09:39:34 +02:00
Kailang Yang aeac1a0dad ALSA: hda/realtek - Check headset type by unplug and resume
When system enable HDA power save mode.
This issue will happen on new platform which DMIC connect to PCH.
In Dell headset mode, it will recheck during runtime resume when
headset was plugged.
This patch will move check headset type on unplug and system resume.

[ A few minor code cleanups by tiwai ]

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-22 14:09:00 +02:00
Takashi Sakamoto 26cd1e5850 ALSA: firewire-lib: use IT context header to compute cycle count for scheduling packet
In IT context, header includes information of cycle to have processed
queued packet.

This commit uses the per-packet information to compute the cycle for
packet to be queued, instead of callback argument. In current
implementaion of ALSA IEC 61883-1/6 packet streaming engine, 48 packets
are queued at first to skip recent cycle. When IT context calls handler,
cycle information in header plus 48 cycle means the cycle to be going
to queue packet.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-22 12:28:33 +02:00
Takashi Sakamoto df9160b914 ALSA: firewire-lib: obsolete macro for header of IT context
The header size parameter of 1394 OHCI IT context has no effect.
Besides the header size of queued packet is different from context
header.

This commit cleans codes relevant to these two headers.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-22 12:28:26 +02:00
Takashi Sakamoto fce9b013fe ALSA: firewire-lib: add helper function to cancel context inner callback handler
In callback handler of isochronous context for both direction, there're
common codes to cancel context.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-22 12:28:16 +02:00
Takashi Sakamoto d3d10a4a1b ALSA: firewire-lib: use union for directional parameters
Some parameters of struct amdtp_stream is dependent on direction.

This commit uses union for such parameters to distinguish from
common parameters.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-22 12:28:00 +02:00
Takashi Sakamoto 8d3f1fdf52 ALSA: firewire-lib: unify tracing events to 'amdtp_packet' event
Now four events of this module have the same arguments and probe timing.
This commit adds a new event, 'amdtp_packet', and replace them. Filtering
functionality of tracing framework is available to pick up events for
inbound/outbound isochronous packets.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-21 07:46:56 +02:00