OSDN Git Service

tomoyo/tomoyo-test1.git
5 years agoALSA: oxfw: configure packet format in pcm.hw_params callback
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:21 +0000 (17:44 +0900)]
ALSA: oxfw: configure packet format in pcm.hw_params callback

This commit is a part of preparation to perform allocation/release
of isochronous resources in pcm.hw_params/hw_free callbacks.

At present, several operations are done in pcm.prepare callback. To
reduce load of the callback, This commit splits out an operation to
set packet format in pcm.hw_params callback.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: unify substreams counter
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:20 +0000 (17:44 +0900)]
ALSA: oxfw: unify substreams counter

In former commits, two isochronous contexts are handles at the same
time. This commit unifies stream counters to obsolete them.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: rename helper functions for duplex streams
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:19 +0000 (17:44 +0900)]
ALSA: oxfw: rename helper functions for duplex streams

In former commits, ALSA oxfw driver handles two isochronous contexts
at the same time, except for some devices which supports one endpoint
of isochronous packet stream.

This commit renames some helper functions so that they handles duplex
streams.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: expand stop procedure for packet streaming
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:18 +0000 (17:44 +0900)]
ALSA: oxfw: expand stop procedure for packet streaming

The helper function stop packet streaming is not enough useful. This
commit obsoletes it and expands its code.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: break packet streaming at bus-reset handler
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:17 +0000 (17:44 +0900)]
ALSA: oxfw: break packet streaming at bus-reset handler

In most cases, recovery from bus reset is not successful. This commit
aborts packet streaming in bus reset handler.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: start duplex streams if supported
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:16 +0000 (17:44 +0900)]
ALSA: oxfw: start duplex streams if supported

It's inconvenient to handle two isochronous context separately
each other. This commit unifies the counters to handle the two
at the same time.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: set packet parameter according to current configuration
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:15 +0000 (17:44 +0900)]
ALSA: oxfw: set packet parameter according to current configuration

After a call of pcm.hw_params, the state of target device is expected
for applications. This commit retrieves the state and start packet
streaming.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: code refactoring for stop condition of packet streaming
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:14 +0000 (17:44 +0900)]
ALSA: oxfw: code refactoring for stop condition of packet streaming

This commit unifies stop condition due to queueing error and unmatched
state of the target device.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: fireworks: don't set XRUN in stop streaming
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:13 +0000 (17:44 +0900)]
ALSA: fireworks: don't set XRUN in stop streaming

When stopping packet streaming, no need to stop PCM substream with XRUN
state. This commit suppresses it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: fireworks: configure stream parameters in pcm.hw_params callback
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:12 +0000 (17:44 +0900)]
ALSA: fireworks: configure stream parameters in pcm.hw_params callback

This commit is a part of preparation to perform allocation/release
of isochronous resources in pcm.hw_params/hw_free callbacks.

This commit splits out an operation to configure stream parameters into
pcm.hw_params callback. In pcm.prepare callback, establishing
connections and start isochronous contexts.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: fireworks: configure sampling transfer frequency in pcm.hw_params callback
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:11 +0000 (17:44 +0900)]
ALSA: fireworks: configure sampling transfer frequency in pcm.hw_params callback

This commit is a part of preparation to perform allocation/release
of isochronous resources in pcm.hw_params/hw_free callbacks.

At present, several operations are done in pcm.prepare callback. To
reduce load of the callback, This commit splits out an operation to
set sampling transfer frequency in pcm.hw_params callback.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: fireworks: code refactoring for pcm.hw_params/hw_free
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:10 +0000 (17:44 +0900)]
ALSA: fireworks: code refactoring for pcm.hw_params/hw_free

Two sets of callbacks for pcm.hw_params/hw_free but they have the same
codes. This commit unifies each of the callbacks.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: fireworks: code refactoring for rawmidi.open/close
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:09 +0000 (17:44 +0900)]
ALSA: fireworks: code refactoring for rawmidi.open/close

Two sets of callbacks for rawmidi.open/close but they have the same
codes. This commit unifies each of the callbacks.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: fireworks: unify substream counter
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:08 +0000 (17:44 +0900)]
ALSA: fireworks: unify substream counter

This commit is a part of preparation to perform allocation/release
of isochronous resources in pcm.hw_params/hw_free callbacks.

It's inconvenient to handle two isochronous context separately
each other. This commit unifies the counters to handle the two
at the same time.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: bebob: code refactoring to initialize/destroy stream data
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:07 +0000 (17:44 +0900)]
ALSA: bebob: code refactoring to initialize/destroy stream data

This commit changes helper functions to initialize/destroy stream
data so that it has an argument for direction.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: bebob: obsolete useless member of private structure
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:06 +0000 (17:44 +0900)]
ALSA: bebob: obsolete useless member of private structure

The private structure of this driver has 'connected' member but nowadays
it's useless. This commit removes it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: bebob: don't set XRUN in stop streaming
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:05 +0000 (17:44 +0900)]
ALSA: bebob: don't set XRUN in stop streaming

When stopping packet streaming, no need to stop PCM substream with XRUN
state. This commit suppresses it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: bebob: configure sampling transfer frequency in pcm.hw_params callback
Takashi Sakamoto [Wed, 12 Jun 2019 08:44:04 +0000 (17:44 +0900)]
ALSA: bebob: configure sampling transfer frequency in pcm.hw_params callback

This commit is a part of preparation to perform allocation/release
of isochronous resources in pcm.hw_params/hw_free callbacks.

At present, several operations are done in pcm.prepare callback. To
reduce load of the callback, This commit splits out an operation to
set sampling transfer frequency in pcm.hw_params callback.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda: fix a mask for unsolicited event tags
Guennadi Liakhovetski [Tue, 11 Jun 2019 17:09:07 +0000 (19:09 +0200)]
ALSA: hda: fix a mask for unsolicited event tags

Response tag only occupies 6 bits, not 7. This bug is harmless, since
the value has just been shifted to the right by 26 bits, so this is
only a cosmetic fix.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: dice: code refactoring for pcm.hw_params/hw_free callbacks
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:18 +0000 (22:21 +0900)]
ALSA: dice: 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>
5 years agoALSA: dice: update isochronous resources when starting packet streaming after bus...
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:17 +0000 (22:21 +0900)]
ALSA: dice: 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 transfer isochronous packet 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 fireface 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>
5 years agoALSA: dice: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:16 +0000 (22:21 +0900)]
ALSA: dice: 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 without releasing/allocating the resources.

There are two points to stop packet streaming; in pcm.hw_params and
pcm.prepare callbacks. The former point is a case that packet streaming
is already started for any MIDI substream then packet streaming is
requested with different sampling transfer frequency for any PCM
substream. The latter point is cases of any XRUN or packet queueing
error.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: dice: code refactoring to keep isochronous resources
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:15 +0000 (22:21 +0900)]
ALSA: dice: code refactoring to keep isochronous resources

This commit is a part of preparation to perform allocation/release
of isochronous resources in pcm.hw_params/hw_free callbacks.

This commit adds a helper function to allocate isochronous resources,
separated from operations to start packet streaming, I note that some
dice-based devices have two pair of endpoints for isochronous packet
straeming.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: dice: code refactoring to stop packet streaming
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:14 +0000 (22:21 +0900)]
ALSA: dice: code refactoring to stop packet streaming

This commit is a part of preparation to perform allocation/release
of isochronous resources in pcm.hw_params/hw_free callbacks.

There're three points to finish packet streaming but no helper
functions for common operations for it. This commit adds a helper
function for operations to finish packet streaming.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-digi00x: code refactoring for pcm.hw_params/hw_free callbacks
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:13 +0000 (22:21 +0900)]
ALSA: firewire-digi00x: 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>
5 years agoALSA: firewire-digi00x: update isochronous resources when starting packet streaming...
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:12 +0000 (22:21 +0900)]
ALSA: firewire-digi00x: 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 transfer isochronous packet 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 fireface 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>
5 years agoALSA: firewire-digi00x: reserve/release isochronous resources in pcm.hw_params/hw_fre...
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:11 +0000 (22:21 +0900)]
ALSA: firewire-digi00x: 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 without releasing/allocating the resources.

There are two points to stop packet streaming; in pcm.hw_params and
pcm.prepare callbacks. The former point is a case that packet streaming
is already started for any MIDI substream then packet streaming is
requested with different sampling transfer frequency for any PCM
substream. The latter point is cases of any XRUN or packet queueing
error.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-digi00x: code refactoring to keep isochronous resources
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:10 +0000 (22:21 +0900)]
ALSA: firewire-digi00x: code refactoring to keep isochronous resources

This commit is a part of preparation to perform allocation/release
of isochronous resources in pcm.hw_params/hw_free callbacks.

All of models in Digidesign Digi00x family have the same formation of
data channels in isochronous packet for both directions. This commit
simplifies allocation of isochronous resources in this point.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-digi00x: simplify error path to begin streaming session
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:09 +0000 (22:21 +0900)]
ALSA: firewire-digi00x: simplify error path to begin streaming session

This commit is a part of preparation to perform allocation/release
of isochronous resources in pcm.hw_params/hw_free callbacks.

The caller of begin_session() calls finish_session() in its error path,
thus no need to call finish_session() in error path of begin_session().

This commit simplifies error path of begin_session().

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-digi00x: code refactoring to finish streaming session
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:08 +0000 (22:21 +0900)]
ALSA: firewire-digi00x: code refactoring to finish streaming session

This commit is a part of preparation to perform allocation/release
of isochronous resources in pcm.hw_params/hw_free callbacks.

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>
5 years agoALSA: firewire-digi00x: refactoring to move timing of registration for isochronous...
Takashi Sakamoto [Tue, 11 Jun 2019 13:21:07 +0000 (22:21 +0900)]
ALSA: firewire-digi00x: refactoring to move timing of registration for isochronous channel

This commit is a part of preparation to perform allocation/release
of isochronous resources 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>
5 years agoALSA: usb-audio: Enable .product_name override for Emagic, Unitor 8.
Stefan Sauer [Mon, 10 Jun 2019 09:51:46 +0000 (11:51 +0200)]
ALSA: usb-audio: Enable .product_name override for Emagic, Unitor 8.

The Emagic Unitor 8 does not provide iManufacturer and iProduct fields
in its device descriptor. These fields are used by alsa to make build the
device name. Thus uncomment the .product-name in the quirks-table.

Without this change the device shows up as 'USB Device 0x86a:0x01'.

Output of lsusb and amidi:
https://gist.github.com/ensonic/7820a102e91f31575be355da2b6b33bc

Signed-off-by: Stefan Sauer <ensonic@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: fireface: code refactoring for pcm.hw_params/hw_free callbacks
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:59 +0000 (16:12 +0900)]
ALSA: fireface: 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>
5 years agoALSA: fireface: minor code refactoring to finish streaming session
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:58 +0000 (16:12 +0900)]
ALSA: fireface: 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>
5 years agoALSA: fireface: update isochronous resources when starting packet streaming after...
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:57 +0000 (16:12 +0900)]
ALSA: fireface: 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 fireface 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>
5 years agoALSA: fireface: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:56 +0000 (16:12 +0900)]
ALSA: fireface: 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>
5 years agoALSA: fireface: support allocate_resources operation in latter protocol
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:55 +0000 (16:12 +0900)]
ALSA: fireface: support allocate_resources operation in latter protocol

This commit is a part of preparation to perform allocation/release
of isochronous channels in pcm.hw_params/hw_free callbacks.

This commit implements allocate_resources callback for the protocol
specific to latter models. The encoded values of constant table is
split into several condition statements to separate the operation
to configure sampling transfer frequency from the operation to
configure the number of data channels in rx packet.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: fireface: support allocate_resources operation in ff400 protocol
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:54 +0000 (16:12 +0900)]
ALSA: fireface: support allocate_resources operation in ff400 protocol

This commit is a part of preparation to perform allocation/release
of isochronous channels in pcm.hw_params/hw_free callbacks.

This commit implements allocate_resources callback for ff400 protocol.
In this callback, sampling transfer frequency is configured to the
device as well.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: fireface: support allocate_resources operation in ff800 protocol
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:53 +0000 (16:12 +0900)]
ALSA: fireface: support allocate_resources operation in ff800 protocol

This commit is a part of preparation to perform allocation/release
of isochronous channels in pcm.hw_params/hw_free callbacks.

This commit implements allocate_resources callback for ff800 protocol.
As I noted in commit fc716397a5c7 ("ALSA: fireface: add support for
packet streaming on Fireface 800"), this unit allocates isochronous
resources for tx stream voluntarily. Therefore, this commit is to
maintain isochronous rsources for rx stream. In the callback,
sampling transfer frequency is configured to the device as well.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: fireface: add protocol-specific operation to allocate isochronous resources
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:52 +0000 (16:12 +0900)]
ALSA: fireface: add protocol-specific operation to allocate isochronous resources

This commit is a part of preparation to perform allocation/release
of isochronous channels in pcm.hw_params/hw_free callbacks.

In ALSA fireface driver, the allocation of isochronous resources is
programmed in each implementation of protocol. This commit adds
protocol-specific operation for the allocation separated from
the operation to begin session.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-tascam: code refactoring for pcm.hw_params/hw_free callbacks
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:51 +0000 (16:12 +0900)]
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>
5 years agoALSA: firewire-tascam: minor code refactoring to finish streaming session
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:50 +0000 (16:12 +0900)]
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>
5 years agoALSA: firewire-tascam: update isochronous resources when starting packet streaming...
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:49 +0000 (16:12 +0900)]
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>
5 years agoALSA: firewire-tascam: reserve/release isochronous resources in pcm.hw_params/hw_free...
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:48 +0000 (16:12 +0900)]
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>
5 years agoALSA: firewire-tascam: code refactoring for release of isochronous resources
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:47 +0000 (16:12 +0900)]
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>
5 years agoALSA: firewire-tascam: code refactoring for reservation of isochronous resources
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:46 +0000 (16:12 +0900)]
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>
5 years agoALSA: firewire-tascam: code refactoring for registration of isochronous channels
Takashi Sakamoto [Sun, 2 Jun 2019 07:12:45 +0000 (16:12 +0900)]
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>
5 years agoALSA: lx6464es - Remove set but not used variables 'orun_mask, urun_mask'
YueHaibing [Sat, 1 Jun 2019 04:12:14 +0000 (04:12 +0000)]
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>
5 years agoALSA: hda/ca0132: Use struct_size()
Takashi Iwai [Fri, 31 May 2019 09:47:24 +0000 (11:47 +0200)]
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>
5 years agoALSA: hda: Use struct_size()
Takashi Iwai [Fri, 31 May 2019 09:46:49 +0000 (11:46 +0200)]
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>
5 years agoALSA: control: Use struct_size()
Takashi Iwai [Fri, 31 May 2019 09:44:44 +0000 (11:44 +0200)]
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>
5 years agoMerge branch 'topic/hda-polling-mode' into for-next
Takashi Iwai [Thu, 30 May 2019 09:01:18 +0000 (11:01 +0200)]
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>
5 years agoALSA: hda: fix: lock reg_lock before calling snd_hdac_bus_update_rirb
Bard Liao [Wed, 29 May 2019 20:59:00 +0000 (04:59 +0800)]
ALSA: hda: fix: lock reg_lock before calling snd_hdac_bus_update_rirb

The patch is to fix commit 5e13cf6cd64c
(ALSA: hda: add polling mode in snd_hdac_bus_get_response)
spin_lock_irq should be called before snd_hdac_bus_update_rirb.

Fixes: 5e13cf6cd64c ("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>
5 years agoMerge branch 'topic/line6-cleanup' into for-next
Takashi Iwai [Tue, 28 May 2019 07:42:23 +0000 (09:42 +0200)]
Merge branch 'topic/line6-cleanup' into for-next

Pull LINE6 driver cleanups and fixes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: line6: Use container_of()
Takashi Iwai [Tue, 28 May 2019 07:05:31 +0000 (09:05 +0200)]
ALSA: line6: Use container_of()

... instead of unconditional cast.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: line6: Drop superfluous timer helper function
Takashi Iwai [Wed, 8 May 2019 13:56:29 +0000 (15:56 +0200)]
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>
5 years agoALSA: line6: variax: Rewrite complex timer & work combo with a delayed work
Takashi Iwai [Wed, 8 May 2019 13:55:36 +0000 (15:55 +0200)]
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>
5 years agoALSA: line6: podhd: Rewrite complex timer & work combo with a delayed work
Takashi Iwai [Wed, 8 May 2019 13:31:00 +0000 (15:31 +0200)]
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>
5 years agoALSA: line6: pod: Rewrite complex timer & work combo with a delayed work
Takashi Iwai [Wed, 8 May 2019 13:24:00 +0000 (15:24 +0200)]
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>
5 years agoALSA: line6: Assure canceling delayed work at disconnection
Takashi Iwai [Tue, 28 May 2019 06:39:44 +0000 (08:39 +0200)]
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: 7f84ff68be05 ("ALSA: line6: toneport: Fix broken usage of timer for delayed execution")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoMerge branch 'topic/hda-polling-mode' into for-next
Takashi Iwai [Tue, 28 May 2019 05:53:38 +0000 (07:53 +0200)]
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>
5 years agoASoC: SOF: Force polling mode on CFL and CNL
Bard Liao [Sun, 26 May 2019 16:58:36 +0000 (00:58 +0800)]
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>
5 years agoALSA: hda - Force polling mode on CNL for fixing codec communication
Bard Liao [Sun, 26 May 2019 16:58:32 +0000 (00:58 +0800)]
ALSA: hda - Force polling mode on CNL for fixing codec communication

We observed the same issue as reported by commit a8d7bde23e7130686b7662
("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>
5 years agoALSA: hda: add polling mode in snd_hdac_bus_get_response
Bard Liao [Sun, 26 May 2019 16:58:35 +0000 (00:58 +0800)]
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>
5 years agoALSA: hda: move polling_mode flag to struct hdac_bus
Bard Liao [Sun, 26 May 2019 16:58:34 +0000 (00:58 +0800)]
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>
5 years agoALSA: hda: assign polling_mode after azx_bus_init
Bard Liao [Sun, 26 May 2019 16:58:33 +0000 (00:58 +0800)]
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>
5 years agoALSA: firewire-lib: refactoring to obsolete IR packet handler
Takashi Sakamoto [Fri, 24 May 2019 09:03:42 +0000 (18:03 +0900)]
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>
5 years agoALSA: firewire-lib: refactoring to obsolete IT packet handler
Takashi Sakamoto [Fri, 24 May 2019 09:03:41 +0000 (18:03 +0900)]
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>
5 years agoALSA: firewire-lib: fix inverted node IDs for amdtp_packet events
Takashi Sakamoto [Fri, 24 May 2019 09:03:40 +0000 (18:03 +0900)]
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: 8d3f1fdf5211 ("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>
5 years agoALSA: firewire-lib: fix data block counter for incoming packet without CIP header
Takashi Sakamoto [Fri, 24 May 2019 09:03:39 +0000 (18:03 +0900)]
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: 947b437e1263 ("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>
5 years agoALSA: firewire-lib: use 8 byte packet header for IT context to separate CIP header...
Takashi Sakamoto [Thu, 23 May 2019 15:14:40 +0000 (00:14 +0900)]
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>
5 years agoALSA: firewire-lib: code refactoring to queueing packets
Takashi Sakamoto [Thu, 23 May 2019 15:14:39 +0000 (00:14 +0900)]
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>
5 years agoALSA: firewire-lib: unify packet handler for IT context
Takashi Sakamoto [Thu, 23 May 2019 15:14:38 +0000 (00:14 +0900)]
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>
5 years agoALSA: firewire-lib: split helper function to generate CIP header
Takashi Sakamoto [Thu, 23 May 2019 15:14:37 +0000 (00:14 +0900)]
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>
5 years agoALSA: hda/realtek - Enable micmute LED for Huawei laptops
Ayman Bagabas [Thu, 23 May 2019 09:30:11 +0000 (05:30 -0400)]
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: 8ac51bbc4cfe ("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>
5 years agoALSA: hdspm: Fix single speed ADAT capture and playback with RME HDSPe AIO
Philippe Bekaert [Thu, 23 May 2019 21:56:49 +0000 (23:56 +0200)]
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>
5 years agoALSA: pcm: oss: Use struct_size() helper
Gustavo A. R. Silva [Thu, 23 May 2019 20:29:17 +0000 (15:29 -0500)]
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>
5 years agoALSA: firewire-lib: unify packet handler for IR context
Takashi Sakamoto [Wed, 22 May 2019 14:17:08 +0000 (23:17 +0900)]
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>
5 years agoALSA: firewire-lib: use 16 bytes IR context header to separate CIP header
Takashi Sakamoto [Wed, 22 May 2019 14:17:07 +0000 (23:17 +0900)]
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>
5 years agoALSA: firewire-lib: split helper function to check incoming CIP header
Takashi Sakamoto [Wed, 22 May 2019 14:17:06 +0000 (23:17 +0900)]
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>
5 years agoALSA: firewire-lib: compute pointer to payload buffer in context handler
Takashi Sakamoto [Wed, 22 May 2019 14:17:05 +0000 (23:17 +0900)]
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>
5 years agoALSA: firewire-lib: calculate the length of packet payload in packet handler
Takashi Sakamoto [Wed, 22 May 2019 14:17:04 +0000 (23:17 +0900)]
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>
5 years agoALSA: firewire-lib: use clear name for variable of CIP header
Takashi Sakamoto [Wed, 22 May 2019 14:17:03 +0000 (23:17 +0900)]
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>
5 years agoALSA: hda/realtek - Set default power save node to 0
Kailang Yang [Thu, 23 May 2019 06:43:04 +0000 (14:43 +0800)]
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>
5 years agoALSA: hda/realtek - Check headset type by unplug and resume
Kailang Yang [Thu, 16 May 2019 08:10:44 +0000 (16:10 +0800)]
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>
5 years agoALSA: firewire-lib: use IT context header to compute cycle count for scheduling packet
Takashi Sakamoto [Tue, 21 May 2019 14:57:37 +0000 (23:57 +0900)]
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>
5 years agoALSA: firewire-lib: obsolete macro for header of IT context
Takashi Sakamoto [Tue, 21 May 2019 14:57:36 +0000 (23:57 +0900)]
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>
5 years agoALSA: firewire-lib: add helper function to cancel context inner callback handler
Takashi Sakamoto [Tue, 21 May 2019 14:57:35 +0000 (23:57 +0900)]
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>
5 years agoALSA: firewire-lib: use union for directional parameters
Takashi Sakamoto [Tue, 21 May 2019 14:57:34 +0000 (23:57 +0900)]
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>
5 years agoALSA: firewire-lib: unify tracing events to 'amdtp_packet' event
Takashi Sakamoto [Sun, 19 May 2019 10:01:09 +0000 (19:01 +0900)]
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>
5 years agoALSA: firewire-lib: use dynamic array for CIP header of tracing events
Takashi Sakamoto [Sun, 19 May 2019 10:01:08 +0000 (19:01 +0900)]
ALSA: firewire-lib: use dynamic array for CIP header of tracing events

This modules handles two types of isochronous packet; one has CIP header
in IEC 61883-1/6 and another doesn't. The module also have tracing events
corresponding to the types of packet. To unify the events, one event
should be probed with or without CIP header.

This commit uses dynamic array for the events to be available for the
types of packet.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-lib: use the same unit for payload argument in tracing events
Takashi Sakamoto [Sun, 19 May 2019 10:01:07 +0000 (19:01 +0900)]
ALSA: firewire-lib: use the same unit for payload argument in tracing events

The most of tracing event in this module have the size of payload in
byte unit, however 'in_packet_without_header' event have the argument
in quadlet unit.

This commit change the unit for argument to be consistent.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-lib: add data_blocks/data_block_counter parameter to in_packet/out_pac...
Takashi Sakamoto [Sun, 19 May 2019 10:01:06 +0000 (19:01 +0900)]
ALSA: firewire-lib: add data_blocks/data_block_counter parameter to in_packet/out_packet tracing events

Tracing events for packets without CIP header have a parameter of
data_blocks/data_block_counter, but events for packets with CIP header
don't. This is not good to unify these events.

This commit adds the missing parameters to the events. In timing to
probe 'in_packet' event, data_blocks and data_block_counter are not
calculated yet. This commit also changes the timing.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-lib: use the same type of argument for CIP header for tracing event
Takashi Sakamoto [Sun, 19 May 2019 10:01:05 +0000 (19:01 +0900)]
ALSA: firewire-lib: use the same type of argument for CIP header for tracing event

An argument for CIP header in 'in_packet' event is not the same type in
'out_packet' event. This is not good to unify these events.

This commit uses the same type of argument for these events.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: dice: add stream format parameters for PreSonus FireStudio
Takashi Sakamoto [Fri, 17 May 2019 02:56:22 +0000 (11:56 +0900)]
ALSA: dice: add stream format parameters for PreSonus FireStudio

FireStudio was launched by PreSonus 2009. This model consists of three
ICs for its packet processing on IEEE 1394 bus:

 - Texus Instruments TSB41AB2 for physical layer of IEEE 1394 bus
 - WaveFront semiconductor, Dice II STD ASIC for link layer of IEEE 1394
   bus and protocol layer
 - Xilinx Spartan XG3S500E FPGA for signal processing

This model don't support TCAT extended application protocol. For such
devices, ALSA dice driver needs to have hard-coded parameters for stream
formats.

This commit adds hard-coded table for this model. As a result, sampling
transfer frequencies of 88.2/96.0 kHz are supported. I note that this
patch can be backported to Linux kernel v4.18 and later.

$ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  04042eda  bus_info_length 4, crc_length 4, crc 11994
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  000a9204  company_id 000a92     |
410  023a8b7f  device_id 04023a8b7f  | EUI-64 000a9204023a8b7f

               root directory
               -----------------------------------------------------------------
414  000661b6  directory_length 6, crc 25014
418  03000a92  vendor
41c  8100000a  --> descriptor leaf at 444
420  17000008  model
424  8100000d  --> descriptor leaf at 458
428  0c0087c0  node capabilities per IEEE 1394
42c  d1000001  --> unit directory at 430

               unit directory at 430
               -----------------------------------------------------------------
430  00041c75  directory_length 4, crc 7285
434  12000a92  specifier id
438  13000001  version
43c  17000008  model
440  8100000c  --> descriptor leaf at 470

               descriptor leaf at 444
               -----------------------------------------------------------------
444  00047c11  leaf_length 4, crc 31761
448  00000000  textual descriptor
44c  00000000  minimal ASCII
450  50726553  "PreS"
454  6f6e7573  "onus"

               descriptor leaf at 458
               -----------------------------------------------------------------
458  0005d7b3  leaf_length 5, crc 55219
45c  00000000  textual descriptor
460  00000000  minimal ASCII
464  46495245  "FIRE"
468  53545544  "STUD"
46c  494f0000  "IO"

               descriptor leaf at 470
               -----------------------------------------------------------------
470  0005d7b3  leaf_length 5, crc 55219
474  00000000  textual descriptor
478  00000000  minimal ASCII
47c  46495245  "FIRE"
480  53545544  "STUD"
484  494f0000  "IO"

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoLinux 5.2-rc1 v5.2-rc1
Linus Torvalds [Sun, 19 May 2019 22:47:09 +0000 (15:47 -0700)]
Linux 5.2-rc1

5 years agoMerge tag 'upstream-5.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw...
Linus Torvalds [Sun, 19 May 2019 22:22:03 +0000 (15:22 -0700)]
Merge tag 'upstream-5.2-rc2' of git://git./linux/kernel/git/rw/ubifs

Pull UBIFS fixes from Richard Weinberger:

 - build errors wrt xattrs

 - mismerge which lead to a wrong Kconfig ifdef

 - missing endianness conversion

* tag 'upstream-5.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
  ubifs: Convert xattr inum to host order
  ubifs: Use correct config name for encryption
  ubifs: Fix build error without CONFIG_UBIFS_FS_XATTR

5 years agoMerge branch 'akpm' (patches from Andrew)
Linus Torvalds [Sun, 19 May 2019 19:15:32 +0000 (12:15 -0700)]
Merge branch 'akpm' (patches from Andrew)

Merge yet more updates from Andrew Morton:
 "A few final bits:

   - large changes to vmalloc, yielding large performance benefits

   - tweak the console-flush-on-panic code

   - a few fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  panic: add an option to replay all the printk message in buffer
  initramfs: don't free a non-existent initrd
  fs/writeback.c: use rcu_barrier() to wait for inflight wb switches going into workqueue when umount
  mm/compaction.c: correct zone boundary handling when isolating pages from a pageblock
  mm/vmap: add DEBUG_AUGMENT_LOWEST_MATCH_CHECK macro
  mm/vmap: add DEBUG_AUGMENT_PROPAGATE_CHECK macro
  mm/vmalloc.c: keep track of free blocks for vmap allocation

5 years agoMerge tag 'kbuild-v5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
Linus Torvalds [Sun, 19 May 2019 18:53:58 +0000 (11:53 -0700)]
Merge tag 'kbuild-v5.2-2' of git://git./linux/kernel/git/masahiroy/linux-kbuild

Pull more Kbuild updates from Masahiro Yamada:

 - remove unneeded use of cc-option, cc-disable-warning, cc-ldoption

 - exclude tracked files from .gitignore

 - re-enable -Wint-in-bool-context warning

 - refactor samples/Makefile

 - stop building immediately if syncconfig fails

 - do not sprinkle error messages when $(CC) does not exist

 - move arch/alpha/defconfig to the configs subdirectory

 - remove crappy header search path manipulation

 - add comment lines to .config to clarify the end of menu blocks

 - check uniqueness of module names (adding new warnings intentionally)

* tag 'kbuild-v5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (24 commits)
  kconfig: use 'else ifneq' for Makefile to improve readability
  kbuild: check uniqueness of module names
  kconfig: Terminate menu blocks with a comment in the generated config
  kbuild: add LICENSES to KBUILD_ALLDIRS
  kbuild: remove 'addtree' and 'flags' magic for header search paths
  treewide: prefix header search paths with $(srctree)/
  media: prefix header search paths with $(srctree)/
  media: remove unneeded header search paths
  alpha: move arch/alpha/defconfig to arch/alpha/configs/defconfig
  kbuild: terminate Kconfig when $(CC) or $(LD) is missing
  kbuild: turn auto.conf.cmd into a mandatory include file
  .gitignore: exclude .get_maintainer.ignore and .gitattributes
  kbuild: add all Clang-specific flags unconditionally
  kbuild: Don't try to add '-fcatch-undefined-behavior' flag
  kbuild: add some extra warning flags unconditionally
  kbuild: add -Wvla flag unconditionally
  arch: remove dangling asm-generic wrappers
  samples: guard sub-directories with CONFIG options
  kbuild: re-enable int-in-bool-context warning
  MAINTAINERS: kbuild: Add pattern for scripts/*vmlinux*
  ...

5 years agoMerge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Sun, 19 May 2019 18:47:03 +0000 (11:47 -0700)]
Merge branch 'i2c/for-next' of git://git./linux/kernel/git/wsa/linux

Pull i2c updates from Wolfram Sang:
 "Some I2C core API additions which are kind of simple but enhance error
  checking for users a lot, especially by returning errno now.

  There are wrappers to still support the old API but it will be removed
  once all users are converted"

* 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: core: add device-managed version of i2c_new_dummy
  i2c: core: improve return value handling of i2c_new_device and i2c_new_dummy