OSDN Git Service

uclinux-h8/linux.git
10 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Tue, 3 Jun 2014 06:14:47 +0000 (08:14 +0200)]
Merge branch 'for-linus' into for-next

Just to catch up a few small fixes for HD-audio and DMA engine.

10 years agoALSA: firewire-lib: Remove a comment about restriction of asynchronous operation
Takashi Sakamoto [Tue, 3 Jun 2014 05:45:37 +0000 (14:45 +0900)]
ALSA: firewire-lib: Remove a comment about restriction of asynchronous operation

The comment for fcp_avc_transaction() describes it doesn't support this type
of operation. But it was already supported by this commit.

00a7bb81c20f3e81711e28e0f6c08cee8fd18514
ALSA: firewire-lib: Add support for deferred transaction

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda/realtek - Fix COEF widget NID for ALC260 replacer fixup
Takashi Iwai [Mon, 2 Jun 2014 13:16:07 +0000 (15:16 +0200)]
ALSA: hda/realtek - Fix COEF widget NID for ALC260 replacer fixup

The conversion to a fixup table for Replacer model with ALC260 in
commit 20f7d928 took the wrong widget NID for COEF setups.  Namely,
NID 0x1a should have been used instead of NID 0x20, which is the
common node for all Realtek codecs but ALC260.

Fixes: 20f7d928fa6e ('ALSA: hda/realtek - Replace ALC260 model=replacer with the auto-parser')
Cc: <stable@vger.kernel.org> [v3.4+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda/realtek - Correction of fixup codes for PB V7900 laptop
Ronan Marquet [Sun, 1 Jun 2014 16:38:53 +0000 (18:38 +0200)]
ALSA: hda/realtek - Correction of fixup codes for PB V7900 laptop

Correcion of wrong fixup entries add in commit ca8f0424 to replace
static model quirk for PB V7900 laptop (will model).

[note: the removal of ALC260_FIXUP_HP_PIN_0F chain is also needed as a
 part of the fix; otherwise the pin is set up wrongly as a headphone,
 and user-space (PulseAudio) may be wrongly trying to detect the jack
 state -- tiwai]

Fixes: ca8f04247eaa ('ALSA: hda/realtek - Add the fixup codes for ALC260 model=will')
Signed-off-by: Ronan Marquet <ronan.marquet@orange.fr>
Cc: <stable@vger.kernel.org> [v3.4+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Use IEC 61883-6 compliant labels for Raw Audio data
Takashi Sakamoto [Sun, 1 Jun 2014 16:50:16 +0000 (01:50 +0900)]
ALSA: firewire-lib: Use IEC 61883-6 compliant labels for Raw Audio data

According to AM824 in IEC 61883-6:2002, 2 bits in LSB of label for Raw Audio
data means Valid Length Code (VBL). Ths value is:
- b00 for 24 bits sample (label is 0x40)
- b01 for 20 bits sample (label is 0x41)
- b10 for 16 bits sample (label is 0x42)

But current firewire-lib apply 24 bits label for both of 16/24 bits samples.

As long as developers investigate BeBoB/Fireworks/OXFW/Dice, all of them
have a behaviour to ignore the label. They can generate correct sound even
if firewire-lib gives wrong label (i.e. 0xff). On BeBoB, this is not only
for Raw Audio data channel, but also for IEC 60958 Conformant data channel.

So there is little possibility of regression.

Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: sizeof() vs ARRAY_SIZE() typo
Dan Carpenter [Wed, 28 May 2014 16:43:30 +0000 (19:43 +0300)]
ALSA: bebob: sizeof() vs ARRAY_SIZE() typo

ARRAY_SIZE() was intended here instead of sizeof().  The
"bridgeco_freq_table" array holds integers so the original condition is
never true.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: synth: emux: soundfont.c: Cleaning up memory leak
Rickard Strandqvist [Sun, 1 Jun 2014 11:35:24 +0000 (13:35 +0200)]
ALSA: synth: emux: soundfont.c: Cleaning up memory leak

There is a risk for memory leak in when something unexpected happens
and the function returns.

This was largely found by using a static code analysis program called cppcheck.

[fixed a typo of kfree() by tiwai]

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: Docs: Fix typo in tegra_hda doc.
Dylan Reid [Sat, 31 May 2014 02:15:47 +0000 (19:15 -0700)]
ALSA: Docs: Fix typo in tegra_hda doc.

The correct name of the third clock is hda2codec_2x.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire: Fix dependency on PCM and rawmidi
Takashi Iwai [Fri, 30 May 2014 08:15:58 +0000 (10:15 +0200)]
ALSA: firewire: Fix dependency on PCM and rawmidi

Now snd-firewire-lib supports rawmidi in addition to PCM, thus we need
to give a proper dependency.  For fixing and simplification, move the
selections of SND_PCM and SND_RAWMIDI into SND_FIREWIRE_LIB section.
Then each driver doesn't have to select them but only
SND_FIREWIRE_LIB.

Reported-by: Jim Davis <jim.epost@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda/analog - Fix silent output on ASUS A8JN
Takashi Iwai [Fri, 23 May 2014 07:21:06 +0000 (09:21 +0200)]
ALSA: hda/analog - Fix silent output on ASUS A8JN

ASUS A8JN with AD1986A codec seems following the normal EAPD in the
normal order (0 = off, 1 = on) unlike other machines with AD1986A.
Apply the workaround used for Toshiba laptop that showed the same
problem.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=75041
Cc: <stable@vger.kernel.org> [3.11+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: gus: remove checks for CONFIG_SND_DEBUG_ROM
Paul Bolle [Thu, 29 May 2014 16:58:25 +0000 (18:58 +0200)]
ALSA: gus: remove checks for CONFIG_SND_DEBUG_ROM

Checks for CONFIG_SND_DEBUG_ROM were added in v2.5.5 but a Kconfig
symbol SND_DEBUG_ROM was never added. These checks have always
evaluated to false. Remove them and the printk()s they hide.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agosound: remove checks for CONFIG_BCM_CS4297A_CSWARM
Paul Bolle [Thu, 29 May 2014 16:51:44 +0000 (18:51 +0200)]
sound: remove checks for CONFIG_BCM_CS4297A_CSWARM

Checks for CONFIG_BCM_CS4297A_CSWARM were added in v2.6.11. The related
Kconfig symbol was never added so these checks always evaluated to true.
Remove them.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda - move some alc662 family machines to hda_pin_quirk table
Hui Wang [Thu, 29 May 2014 07:59:19 +0000 (15:59 +0800)]
ALSA: hda - move some alc662 family machines to hda_pin_quirk table

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda - move some alc269 family machines to hda_pin_quirk table
Hui Wang [Thu, 29 May 2014 07:59:18 +0000 (15:59 +0800)]
ALSA: hda - move some alc269 family machines to hda_pin_quirk table

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoRevert "ALSA: hda - drop def association and sequence from pinconf comparing"
Hui Wang [Thu, 29 May 2014 07:59:17 +0000 (15:59 +0800)]
Revert "ALSA: hda - drop def association and sequence from pinconf comparing"

This reverts commit c687200b9d4ef60042a50f7d942cfef120cc7bf1.

Dropping the def association and sequence from pinconf comparing is a
bit risky, It will introduce a greater risk of catching unwanted
machines.

And in addition, so far no BIOS experts give us an explicit answer
whether it makes senses to compare these two fields or not.

For safety reason, we revert this commit.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: small leak on error path
Dan Carpenter [Wed, 28 May 2014 16:42:46 +0000 (19:42 +0300)]
ALSA: fireworks: small leak on error path

There was a typo here so we return directly instead of freeing "hwinfo".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: remove some stray checks
Dan Carpenter [Wed, 28 May 2014 16:42:02 +0000 (19:42 +0300)]
ALSA: fireworks: remove some stray checks

We checked "err" earlier.  These things seem to be left over code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: au1x00: Use resource_size instead of computation
Benoit Taine [Wed, 28 May 2014 15:14:06 +0000 (17:14 +0200)]
ALSA: au1x00: Use resource_size instead of computation

This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/resource_size.cocci

Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoMerge branch 'topic/firewire' into for-next
Takashi Iwai [Tue, 27 May 2014 15:38:08 +0000 (17:38 +0200)]
Merge branch 'topic/firewire' into for-next

This is a merge of big firewire audio stack updates by Takashi Sakamoto.

10 years agoALSA: bebob: Improve comments about stream format
Takashi Sakamoto [Tue, 27 May 2014 15:14:47 +0000 (00:14 +0900)]
ALSA: bebob: Improve comments about stream format

Currently bebob driver apply Raw Audio Data channel (in IEC 61883-1:2002,
Multi Bit Linear Audio Data channel in IEC 61883-6:20005) to IEC 60958
Conformant Data channel because both fireworks and bebob based devices
can handle it by ignoring each label.

This patch improves a comment about this.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Remove meaningless mutex_unlock()
Takashi Sakamoto [Tue, 27 May 2014 15:14:46 +0000 (00:14 +0900)]
ALSA: bebob: Remove meaningless mutex_unlock()

Currently mutex_unlock() is called in module's cleanup function. But after
cleaned up, this mutex is automatically released. So this function call
is meaningless.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add static specifier to identifier with file scope
Takashi Sakamoto [Tue, 27 May 2014 15:14:45 +0000 (00:14 +0900)]
ALSA: bebob: Add static specifier to identifier with file scope

Some variables were declared without static even if they're not referred
to from external files. This commit make them local symbols for better
information-hiding by file unit.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Use different names for identifiers in the same file
Takashi Sakamoto [Tue, 27 May 2014 15:14:44 +0000 (00:14 +0900)]
ALSA: bebob: Use different names for identifiers in the same file

To suppress 'sparse' warning.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks/bebob: Improve indentation
Takashi Sakamoto [Tue, 27 May 2014 15:14:43 +0000 (00:14 +0900)]
ALSA: fireworks/bebob: Improve indentation

According to coding rule.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks/bebob: Add suffix for long long integer literal
Takashi Sakamoto [Tue, 27 May 2014 15:14:42 +0000 (00:14 +0900)]
ALSA: fireworks/bebob: Add suffix for long long integer literal

This commit adds suffix to register values of each device, to supress 'sparse'
warnings. Additionally, this commit changes offset values with integer literal.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks/bebob: Use the same type of variables as function parameters
Takashi Sakamoto [Tue, 27 May 2014 15:14:41 +0000 (00:14 +0900)]
ALSA: fireworks/bebob: Use the same type of variables as function parameters

The second argument of snd_efw_command_get_sampling_rate() means sampling
rate and its type is 'unsigned int'. But 'int' variable is passed as parameter.
It's better to apply the same type for the variable as its argument.

Similally, the type of variable for snd_efw_command_get_clock_source() and
avc_bridgeco_get_plug_type() should be the same type as each argument.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks/bebob: Change type of argument for sampling rate
Takashi Sakamoto [Tue, 27 May 2014 15:14:40 +0000 (00:14 +0900)]
ALSA: fireworks/bebob: Change type of argument for sampling rate

Originally, I intent to this argument given with 'struct snd_pcm_runtime.rate'
or params_rate(). They return value of 'unsigned int'. So 'unsigned int' is
better for the type of this argument.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: Use the same prototype for functions as actual declaration
Takashi Sakamoto [Tue, 27 May 2014 15:14:39 +0000 (00:14 +0900)]
ALSA: fireworks: Use the same prototype for functions as actual declaration

There are two modes for Fireworks, IEC 61883 compliant or Windows.
So it's better to use enum type instead of int to express the intension,
even if C language specification defines to handle enum variables as usual
integer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: Fix wrong value as argument for PTR_ERR()
Takashi Sakamoto [Tue, 27 May 2014 15:14:38 +0000 (00:14 +0900)]
ALSA: fireworks: Fix wrong value as argument for PTR_ERR()

The return value of memdup_user() should be passed to return correct error.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Fix sparse warning of incorrect type in assignment
Takashi Sakamoto [Tue, 27 May 2014 15:14:37 +0000 (00:14 +0900)]
ALSA: firewire-lib: Fix sparse warning of incorrect type in assignment

__be32 value should not be assigned directly to bool value.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Use ARRAY_SIZE() instead of sizeof() for correct loop limit
Takashi Sakamoto [Tue, 27 May 2014 15:14:36 +0000 (00:14 +0900)]
ALSA: firewire-lib: Use ARRAY_SIZE() instead of sizeof() for correct loop limit

This commit fixes a big for loop count with array. The limitation of loop
count should be calcurated with the number of elements in the array, not
with the number of bytes.

Aditionally, this commit apply the same declaration as a prototype in header
for the array.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: sound/aoa/codecs/onyx.c: use static const for texts
Fabian Frederick [Tue, 27 May 2014 07:12:18 +0000 (09:12 +0200)]
ALSA: sound/aoa/codecs/onyx.c: use static const for texts

'texts' is only used as source in strcpy

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda: fix tegra build
Arnd Bergmann [Mon, 26 May 2014 19:15:20 +0000 (21:15 +0200)]
ALSA: hda: fix tegra build

When CONFIG_PM is disabled, the CONFIG_SND_HDA_POWER_SAVE_DEFAULT symbol
does not get defined, which causes a build error for the hda-tegra driver:

hda/hda_tegra.c:80:25: error: 'CONFIG_SND_HDA_POWER_SAVE_DEFAULT' undeclared here (not in a function)
 static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT;
                         ^
/git/arm-soc/sound/pci/hda/hda_tegra.c:235:13: warning: 'hda_tegra_disable_clocks' defined but not used [-Wunused-function]
 static void hda_tegra_disable_clocks(struct hda_tegra *data)
             ^

This works around the problem by not referencing that macro
when CONFIG_PM is disabled. Instead, we assume that it's disabled
unconditionally and cannot be enabled at runtime.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Dylan Reid <dgreid@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda - Pop noises fix for XPS13 9333
Gabriele Mazzotta [Mon, 26 May 2014 15:11:46 +0000 (17:11 +0200)]
ALSA: hda - Pop noises fix for XPS13 9333

When headphones are plugged in, force AFG and node 0x02
("Headphone Playback Volume") to D0 to avoid pop noises.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=76611
Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire/bebob: Add a workaround for M-Audio special Firewire series
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:30 +0000 (22:45 +0900)]
ALSA: firewire/bebob: Add a workaround for M-Audio special Firewire series

In post commit, a quirk of this firmware about transactions is reported.
This commit apply a workaround for this quirk.

They often fail transactions due to gap_count mismatch. This state is changed
by generating bus reset.

The fw_schedule_bus_reset() is an exported symbol in firewire-core. But there
are no header for public. This commit moves its prototype from
drivers/firewire/core.h to include/linux/firewire.h.

This mismatch still affects bus management before generating this bus reset.
It still takes a time to call driver's probe() because transactions are still
often failed.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Send a cue to load firmware for M-Audio Firewire series
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:29 +0000 (22:45 +0900)]
ALSA: bebob: Send a cue to load firmware for M-Audio Firewire series

Just powering on, these devices below wait to download firmware.
 - Firewire Audiophile
 - Firewire 410
 - Firewire 1814
 - ProjectMix I/O

But firmware version 5058 or later, flash memory in the device stores the
firmware. So this driver can enable these devices by sending a certain cue to
load the firmware.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add a quirk of data blocks for MIDI messages for some M-Audio devices
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:28 +0000 (22:45 +0900)]
ALSA: bebob: Add a quirk of data blocks for MIDI messages for some M-Audio devices

The firmwares for M-Audio Firewire 410/1814 and ProjectMix I/O has a quirk to
ignore MIDI messages in data blocks more than 8. This commit uses a flag which
Fireworks uses for a similar quirk.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob/firewire-lib: Add a quirk of wrong dbc in empty packet for M-Audio specia...
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:27 +0000 (22:45 +0900)]
ALSA: bebob/firewire-lib: Add a quirk of wrong dbc in empty packet for M-Audio special Firewire series

M-Audio Firewire 1814 has a quirk, ProjectMix I/O also has. They transmit
empty packet with wrong value of dbc incremented by 8 at high sampling rate.
According to IEC 61883-1, this value should be the same as the one in
previous packet.

This commit adds a flag named as CIP_EMPTY_HAS_WRONG_DBC. With flag, the value
of dbc in empty packet is overwittern by an expected value.

This is an example of this quirk:
CIP Header 0 CIP Header 1 Payload size
010D0000 9004F759 210
010D0010 90040B59 210
010D0020 90042359 210
01020028 9004FFFF 2  <-
010D0030 90043759 210
010D0040 90044B59 210
010D0050 90046359 210
01020058 9004FFFF 2  <-
010D0060 90047759 210
010D0070 90048B59 210
010D0080 9004A359 210
01020088 9004FFFF 2  <-
010D0090 9004B759 210
010D00A0 9004CB59 210
010D00B0 9004E359 210
010200B8 9004FFFF 2  <-
010D00C0 9004F759 210
010D00D0 90040B59 210
010D00E0 90042359 210

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add support for M-Audio special Firewire series
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:26 +0000 (22:45 +0900)]
ALSA: bebob: Add support for M-Audio special Firewire series

This commit allows this driver to support some models which M-Audio produces
with DM1000 but its firmware is special. They are:
 - Firewire 1814
 - ProjectMix I/O

They have heavily customized firmware. The usual operations can't be applied to
them. For this reason, this commit adds a model specific member to 'struct
snd_bebob' and some model specific functions. Some parameters are write-only so
this commit also adds control interface for applications to set them.

M-Audio special firmware quirks:
 - Just after powering on, they wait to download firmware. This state is
   changed when receiving cue. Then bus reset is generated and the device is
   recognized as a different model with the uploaded firmware.
 - They don't respond against BridgeCo AV/C extension commands. So drivers
   can't get their stream formations and so on.
 - They do not start to transmit packets only by establishing connection but
   also by receiving SIGNAL FORMAT command.
 - After booting up, they often fail to send response against driver's request
   due to mismatch of gap_count.

This module don't support to upload firmware.

Tested-by: Darren Anderson <darrena092@gmail.com> (ProjectMix I/O)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add support for M-Audio usual Firewire series
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:25 +0000 (22:45 +0900)]
ALSA: bebob: Add support for M-Audio usual Firewire series

This commit allows this driver to support some models which M-Audio produces
with DM1000/DM1000E with usual firmware. They are:
 - Firewire 410
 - Firewire AudioPhile
 - Firewire Solo
 - Ozonic
 - NRV10
 - FirewireLightBridge

According to a person who worked in BridgeCo, some models are produced with
'Pre-BeBoB'. This means that these products were released before BeBoB was
officially produced, and later BeBoB specification was formed. So these models
have some quirks.

M-Audio usual firmware quirks:
 - Just after powering on, 'Firewire 410' waits to download firmware. This
   state is changed when receiving cue. Then bus reset is generated and the
   device is recognized as a different model with the uploaded firmware.
 - 'Firewire Audiophile' also waits to download firmware but its
   vendor id/model id is the same as the one after loading firmware.
 - The information of channel mapping for MIDI conformant data channel is
   invalid against BridgeCo specification.

This commit adds some codes for these quirks but don't support to upload
firmware.

This commit also adds specific operations to get metering information. The
metering information also includes status of clock synchronization if the model
supports to switch source of clock.

The specification of FirewireLightBridge is unknown. So in this time, normal
operations are applied for this model.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add support for Focusrite Saffire/SaffirePro series
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:24 +0000 (22:45 +0900)]
ALSA: bebob: Add support for Focusrite Saffire/SaffirePro series

This commit allows this driver to support all of models which Focusrite
produces with DM1000/BeBoB. They are:
 - Saffire
 - Saffire LE
 - SaffirePro 10 I/O
 - SaffirePro 26 I/O

This commit adds Focusrite specific operations:
1. Get source of clock
2. Get/Set sampling frequency
3. Get metering information

The driver uses these functionalities to read/write specific address by async
transaction.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add support for Yamaha GO series
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:23 +0000 (22:45 +0900)]
ALSA: bebob: Add support for Yamaha GO series

This commit allows this driver to support all of models which Yamaha produced
with DM1000/BeBoB. They are:
 - GO44
 - GO46

This commit adds Yamaha specific operations. To get source of clock, AV/C Audio
Subunit command is used.

I note that their appearances are similar to some models of TerraTec; 'Go44' is
similar to 'PHASE 24 FW' and 'GO46' is similar to 'PHASE X24 FW'. But their
combination of Audio/Music subunits is a bit different.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add support for Terratec PHASE, EWS series and Aureon
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:22 +0000 (22:45 +0900)]
ALSA: bebob: Add support for Terratec PHASE, EWS series and Aureon

This commit allows this driver to support all of models which Terratec produced
with DM1000/BeBoB. They are:
 - PHASE 24 FW
 - PHASE X24 FW
 - PHASE 88 Rack FW
 - EWS MIC2
 - EWS MIC4
 - Aureon 7.1 Firewire

For Phase series, this commit adds a Terratec specific operation. To get source
of clock. AV/C Audio Subunit command is used.

For EWS series and Aureon, this module uses normal operations.

Tested-by: Maximilian Engelhardt <maxi@daemonizer.de> (PHASE 24 FW)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Prepare for device specific operations
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:21 +0000 (22:45 +0900)]
ALSA: bebob: Prepare for device specific operations

This commit is for some devices which have its own operations or quirks.

Many functionality should be implemented in user land. Then this commit adds
functionality related to stream such as sampling frequency or clock source. For
help to debug, this commit adds the functionality to get metering information
if it's available.

To help these functionalities, this commit adds some AV/C commands defined in
'AV/C Audio Subunit Specification (1394TA).

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add hwdep interface
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:20 +0000 (22:45 +0900)]
ALSA: bebob: Add hwdep interface

This interface is designed for mixer/control application. By using hwdep
interface, the application can get information about firewire node, can
lock/unlock kernel streaming and can get notification at starting/stopping
kernel streaming.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add PCM interface
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:19 +0000 (22:45 +0900)]
ALSA: bebob: Add PCM interface

This commit adds a functionality to capture/playback PCM samples.

When AMDTP stream is already running for PCM or the source of clock is not
internal, available sampling rate is limited at current one.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add MIDI interface
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:18 +0000 (22:45 +0900)]
ALSA: bebob: Add MIDI interface

This commit adds a functionality to capture/playback MIDI messages.

When no AMDTP streams are running, this module starts AMDTP stream at current
sampling rate for MIDI substream.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add proc interface for debugging purpose
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:17 +0000 (22:45 +0900)]
ALSA: bebob: Add proc interface for debugging purpose

This commit adds proc interface to get these information for debugging:
 - firmware information
 - stream formation
 - current clock source and sampling rate

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob/firewire-lib: Add a quirk for discontinuity at bus reset
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:16 +0000 (22:45 +0900)]
ALSA: bebob/firewire-lib: Add a quirk for discontinuity at bus reset

Normal BeBoB firmware has a quirk. When receiving bus reset, it transmits
packets with discontinuous value in dbc field.

This causes two situation, one is to abort streaming by firewire-lib as a
result of detecting the discontinuity. Another is to call driver's .update()
because of bus reset. These two is generated independently. (The former
depends on isochronous stream and the latter depends on IEEE1394 bus driver.)

When BeBoB driver works with XRUN-recoverable applications, this situation
looks like stream_start_duplex() call followed by stream_update_duplex() call
because applications will call snd_pcm_prepare() immediately at XRUN.

To update connections and streams at first, this commit use completion. When
queueing error occurs, stream_start_duplex() is forced to wait maximum
1000msec. During this, when .update() is called, the completion is waken and
stream_start_duplex() is processed without breaking connections.

At bus reset, stream_start_duplex() shouldn't break/establish connections and
stream_update_duplex() should update connections because a caller of
fw_iso_resources_allocate() is responsible for calling
fw_iso_resources_update() on bus reset.

This commit also adds a flag, which has an effect to skip checking continuity
for first packet. This flag is useful for BeBoB quirk to start handling packets
during streaming.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add commands and connections/streams management
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:15 +0000 (22:45 +0900)]
ALSA: bebob: Add commands and connections/streams management

This commit adds management functionality for connections and streams.
BeBoB uses CMP to manage connections and uses AMDTP for streams.

This commit also adds some BridgeCo's AV/C extension commands. There are some
BridgeCo's AV/C extension commands but this commit just uses below commands
to get device's capability and status:

 1.Extended Plug Info commands
  - Plug Channel Position Specific Data
  - Plug Type Specific Data
  - Cluster(Section) Info Specific Data
  - Plug Input Specific Data
 2.Extended Stream Format Information commands
  - Extended Stream Format Information Command - List Request

For Extended Plug Info commands for Cluster Info Specific Data, I pick up
'section' instead of 'cluster' from document to prevent from misunderstanding
because 'cluster' is also used in IEC 61883-6.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: bebob: Add skelton for BeBoB based devices
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:14 +0000 (22:45 +0900)]
ALSA: bebob: Add skelton for BeBoB based devices

This commit adds a new driver for BeBoB based devices with no specific
operations. Currently this driver just create/remove card instance according
to callbacks.

BeBoB is 'BridgeCo enhanced Breakout Box'. This is installed to firewire
devices with DM1000/DM1100/DM1500 chipset. It gives common way for host
system to handle BeBoB based devices.

Current supported devices:
 - Edirol FA-66/FA-101
 - PreSonus FIREBOX/FIREPOD/FP10/Inspire1394
 - BridgeCo RDAudio1/Audio5
 - Mackie Onyx 1220/1620/1640 (Firewire I/O Card)
 - Mackie d.2 (Firewire Option)
 - Stanton FinalScratch 2 (ScratchAmp)
 - Tascam IF-FW DM
 - Behringer XENIX UFX 1204/1604
 - Behringer Digital Mixer X32 series (X-UF Card)
 - Apogee Rosetta 200/Rosetta 400 (X-FireWire card)
 - Apogee DA-16X/AD-16X/DD-16X (X-FireWire card)
 - Apogee Ensemble
 - ESI Quotafire610
 - AcousticReality eARMasterOne
 - CME MatrixKFW
 - Phonix Helix Board 12 MkII/18 MkII/24 MkII
 - Phonic Helix Board 12 Universal/18 Universal/24 Universal
 - Lynx Aurora 8/16 (LT-FW)
 - ICON FireXon
 - PrismSound Orpheus/ADA-8XR

Devices possible to be supported if identifying IDs:
 - Apogee Mini-Me Firewire/Mini-DAC Firewire
 - Behringer F-Control Audio 610/1616
 - Cakewalk Sonar Power Studio 66
 - CME UF400e
 - ESI Quotafire XL
 - Infrasonic DewX/Windy6
 - Mackie Digital X Bus x.200/400
 - Phonic Helix Board 12/18/24
 - Phonic FireFly 202/302
 - Rolf Spuler Firewire Guitar

Tested-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: Add command/response functionality into hwdep interface
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:13 +0000 (22:45 +0900)]
ALSA: fireworks: Add command/response functionality into hwdep interface

This commit adds two functionality for hwdep interface, adds two parameters for
this driver, add a node for proc interface.

To receive responses from devices, this driver already allocate own callback
into initial memory space in host controller. This means no one can allocate
its own callback to the address. So this driver must give a way for user
applications to receive responses.

This commit adds a functionality to receive responses via hwdep interface. The
application can receive responses to read from this interface. To achieve this,
this commit adds a buffer to queue responses. The default size of this buffer is
1024 bytes. This size can be changed to give preferrable size to
'resp_buf_size' parameter for this driver. The application should notice rest
of space in this buffer because this driver don't push responses when this
buffer has no space.

Additionaly, this commit adds a functionality to transmit commands via hwdep
interface. The application can transmit commands to write into this interface.
I note that the application can transmit one command at once, but can receive
as many responses as possible untill the user-buffer is full.

When using these interfaces, the application must keep maximum number of
sequence number in command within the number in firewire.h because this driver
uses this number to distinguish the response is against the command by the
application or this driver.

Usually responses against commands which the application transmits are pushed
into this buffer. But to enable 'resp_buf_debug' parameter for this driver, all
responses are pushed into the buffer. When using this mode, I reccomend to
expand the size of buffer.

Finally this commit adds a new node into proc interface to output status of the
buffer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: Add hwdep interface
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:12 +0000 (22:45 +0900)]
ALSA: fireworks: Add hwdep interface

This interface is designed for mixer/control application. To use hwdep
interface, the application can get information about firewire node, can
lock/unlock kernel streaming and can get notification at starting/stopping
kernel streaming.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: Add PCM interface
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:11 +0000 (22:45 +0900)]
ALSA: fireworks: Add PCM interface

This commit adds a functionality to capture/playback PCM samples.

When AMDTP stream is already running for PCM or the source of clock is not
internal, available sampling rate is limited at current one.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks/firewire-lib: Add a quirk of data blocks for MIDI in out-stream
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:10 +0000 (22:45 +0900)]
ALSA: fireworks/firewire-lib: Add a quirk of data blocks for MIDI in out-stream

Fireworks has a quirk to ignore MIDI messages in data blocks more than 8.
This commit adds a flag for this quirk and codes to skip 8 or more data
blocks to transfer MIDI messages.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: Add MIDI interface
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:09 +0000 (22:45 +0900)]
ALSA: fireworks: Add MIDI interface

This commit adds a functionality to capture/playback MIDI messages.

When no AMDTP streams are running, this driver starts AMDTP stream for MIDI
stream at current sampling rate.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: Add proc interface for debugging purpose
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:08 +0000 (22:45 +0900)]
ALSA: fireworks: Add proc interface for debugging purpose

This commit adds proc interface to output infomation for debugging.
 - firmware information
 - sampling rate and clock source
 - physical metering (linear value)

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks/firewire-lib: Add a quirk to reset data block counter at bus reset
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:07 +0000 (22:45 +0900)]
ALSA: fireworks/firewire-lib: Add a quirk to reset data block counter at bus reset

Fireworks has a quirk to reset data block counter at bus reset.

This commit adds a flag of CIP_SKIP_DBC_ZERO_CHECK. This flag has an effect
to skip checking dbc continuity when dbc is zero.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks/firewire-lib: Add a quirk for fixed interval of reported dbc
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:06 +0000 (22:45 +0900)]
ALSA: fireworks/firewire-lib: Add a quirk for fixed interval of reported dbc

Fireworks firmware version 5.5 reports fix interval for dbc in each packet.

For example, AudioFire4:
CIP0     CIP1     Payload
00070000 900484FF 72
00070008 9004A8FF 72
00070008 90FFFFFF 02
00070010 9004D0FF 72
00070018 9004C4FF 72
00070020 9004E8FF 72
00070020 90FFFFFF 02
00070028 900410FE 72

The interval of each dbc should be 16 except for empty packet but it's still 8.

This commit adds a flag for this quirk and codes to refer to a fixed value.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks/firewire-lib: Add a quirk for wrong dbs in tx packets
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:05 +0000 (22:45 +0900)]
ALSA: fireworks/firewire-lib: Add a quirk for wrong dbs in tx packets

One of Fireworks firmware, named  as 'AudioFire9', seems to transmit
packets with wrong value of dbs. It's always 0x11 but actual size of
data block is different.

This commit adds a flag for this quirk and some codes to calculate
correct size.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks/firewire-lib: Add a quirk for the meaning of dbc
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:04 +0000 (22:45 +0900)]
ALSA: fireworks/firewire-lib: Add a quirk for the meaning of dbc

Fireworks has a quirk for the value of dbc field in transmitted packets.
For Fireworks, dbc means the end of events in current packet. This is out
of specification.

For example, AudioFire4:
CIP0        CIP1    Payload
01070092 90FFFFFF 02
0107009A 9001E17B 3A <-
010700A2 9001F6E5 3A
010700A2 90FFFFFF 02
010700AA 9001104F 3A <-
010700B2 900125B9 3A
010700BA 90013B23 3A
010700BA 90FFFFFF 02
010700C2 9001548E 3A <-
010700CA 900169F8 3A
010700CA 90FFFFFF 02
010700D2 90018362 3A <-
010700DA 900198CC 3A

According to IEC 61883-1/6, a packet following to empty packet has the same
value for its dbc. But for Fireworks, it's incremented and empty packet has
the same value as previous packet in dbc field.

This commit adds a flag for Fireworks and some codes to checking dbc continuity.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks/firewire-lib: Add a quirk for empty packet with TAG0
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:03 +0000 (22:45 +0900)]
ALSA: fireworks/firewire-lib: Add a quirk for empty packet with TAG0

Fireworks has a quirk to transmit empty packets with TAG0. This commit
adds handling this quirk for full duplex stream synchronization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: Add connection and stream management
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:02 +0000 (22:45 +0900)]
ALSA: fireworks: Add connection and stream management

Fireworks manages connections by CMP and can transmit/receive AMDTP streams
with a few quirks. This commit adds functionality to start/stop the streams.

Major Fireworks products don't support 'SYT-Match' clock source mode, except
for AudioFire12/8(till 2009 July) with firmware version 1.0. Already in
previous commit, this driver don't support such old firmwares. So this commit
adds support for non 'SYT-Match' clock source modes.

I note that this driver has a short gap for MIDI streams when starting PCM
stream. When AMDTP streams are running only for MIDI data and PCM data is
going to be joined at different sampling rate, then AMDTP streams are
stopped once and started again after changing sampling rate.

Unfortunately, Fireworks is not fully compliant to IEC 61883-1/6. Some commits
following to this commit add these quirks.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: Add transaction and some commands
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:01 +0000 (22:45 +0900)]
ALSA: fireworks: Add transaction and some commands

Fireworks uses own command and response. This commit adds functionality to
transact and adds some commands required for sound card instance and kernel
streaming.

There are two ways to deliver substance of this transaction:
1.AV/C vendor dependent command for command/response
2.Async transaction to specific addresses for command/response

By way 1, I confirm AudioFire12 cannot correctly response to some commands with
firmware version 5.0 or later. This is also confirmed by FFADO. So this driver
implement way 2.

The address for response gives an issue. When this driver allocate own callback
function into the address, then no one can allocate its own callback function.
This situation is not good for applications in user-land. This issue is solved
in later commit.

I note there is a command to change the address for response if the device
supports. But this driver uses default value. So users should not execute this
command as long as hoping this driver works correctly.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: fireworks: Add skelton for Fireworks based devices
Takashi Sakamoto [Fri, 25 Apr 2014 13:45:00 +0000 (22:45 +0900)]
ALSA: fireworks: Add skelton for Fireworks based devices

This commit adds a new driver for devices based on Fireworks. This driver
just creates/removes card instance according to callbacks.

Fireworks is a board module which Echo Audio produced. This module
consists of three chipsets:
 - Communication chipset for IEEE1394 PHY/Link and IEC 61883-1/6
 - DSP or/and FPGA for signal processing
 - Flash Memory to store firmwares

Current supported devices:
 - Mackie Onyx 400F/1200F
 - Echo AudioFire12/8(until 2009 July)
 - Echo AudioFire2/4/Pre8/8(since 2009 July)
 - Echo Fireworks 8/HDMI
 - Gibson Robot Interface pack/GoldTop

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Add some AV/C general commands
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:59 +0000 (22:44 +0900)]
ALSA: firewire-lib: Add some AV/C general commands

This commit adds three commands, which may be used by some firewire device
drivers. These commands are defined in 'AV/C Digital Interface Command Set
General Specification Version 4.2 (2004006, 1394TA)'.

1. PLUG INFO command (clause 10.1)
2. INPUT PLUG SIGNAL FORMAT command (clause 10.10)
3. OUTPUT PLUG SIGNAL FORMAT command (clause 10.11)

By the command 1, the drivers can get the number of plugs for AV/C unit or
subunit.
By the command 2 and 3, the drivers can get/set sampling frequency.

The 'firewire-speakers' already uses INPUT PLUG SIGNAL FORMAT command to set
sampling rate. So this commit also affects the driver.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Add support for deferred transaction
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:58 +0000 (22:44 +0900)]
ALSA: firewire-lib: Add support for deferred transaction

Some devices based on BeBoB use this type of AV/C transaction.

'Deferred Transaction' is defined in 'AV/C Digital Interface Command Set
General Specification' and is used by targets to make a response deferred
during processing it.

If a target may not be able to complete a command within 100msec since
receiving the command, then the target shall return INTERIM response,
to which final response will follow later. CONTROL/NOTIFY commands are
allowed for deferred transaction.

In the specification, devices allow to send INTERIM response just one time.
But this commit allows to handle several INTERIM response with two reasons.
One reason is to simplify codes, and another reason is to prepare for
devices which is out of specification.

There is an issue. In the specification, the interval between INTERIM
response and final response is 'Unspecified interval'. The specification
depends on each subunit specification for this interval.

But we promise to finish this function for caller. In this reason, I use
FCP_TIMEOUT_MS for this interval. Currently it's 125msec. When we find
devices which needs more time for this interval, then let us add some codes
to apply more interval for 'Unspecified interval'.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Add a new function to check others' connection
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:57 +0000 (22:44 +0900)]
ALSA: firewire-lib: Add a new function to check others' connection

Plug Control Registers have two fields related to the number of established
connections, one is 'Broadcast connection counter' and another is
'Point-to-point connection counter'. The driver can know there are established
connections or not to check these fields.

This commit is for considering about JACK/FFADO streaming. Currently, when
JACK/FFADO starts its streaming to the device, cmp_connection_establish() is
failed expectedly. This seems to be enough but there are some devices which
needs to change sampling frequency before trying to establish connections.
For such devices, this functionality is needed.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Add handling output connection by CMP
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:56 +0000 (22:44 +0900)]
ALSA: firewire-lib: Add handling output connection by CMP

This patch adds some macros, codes with condition of direction and new functions
to handle output connection. Once cmp_connection_init() is executed with its
direction, CMP input and output connection can be handled by the same way.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Add 'direction' member to 'cmp_connection' structure
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:55 +0000 (22:44 +0900)]
ALSA: firewire-lib: Add 'direction' member to 'cmp_connection' structure

This patch adds 'direction' member to 'cmp_connection' structure to indicate
the direction of connection. This patch also adds 'direction' argument to
cmp_connection_init() function to determine the direction.

The cmp_connection_init() function is exported and used in snd-firewire-speakers
so this patch also affect it.

This patch just add them. Actual implementation will be done by followed
patches.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Rename macros, variables and functions for CMP
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:54 +0000 (22:44 +0900)]
ALSA: firewire-lib: Rename macros, variables and functions for CMP

Referring to IEC 61883-1, oMPR and iMPR, oPCR and iPCR have some fields with
the same role in the same position. This patch renames some macros, variables
and function arguments with "i" in its prefix to reuse them between oMPR and
iMPR, oPCR and iPCR.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Restrict calling flush_context_completion() when context exists
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:53 +0000 (22:44 +0900)]
ALSA: firewire-lib: Restrict calling flush_context_completion() when context exists

Currently, drivers can bring XRUN state for PCM substreams when error to
queue packets or detecting discontinuity of packet. The application may try to
recover this state by calling snd_pcm_prepare().

Depending on each driver, .prepare() includes restart streaming. Then there
is a state that PCM substreams are running but isochronous contexts are
stopped. In this case, when .pointer() is called, it refers to error pointer.

This commit is for a prevention of this bug.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib/dice/speakers: Add common PCM constraints for AMDTP streams
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:52 +0000 (22:44 +0900)]
ALSA: firewire-lib/dice/speakers: Add common PCM constraints for AMDTP streams

This commit adds common PCM constraints according to current firewire-lib
implementation.

1.Maximum width for each sample is limited by 24.
AM824 in IEC 61883-6 can deliver 24bit data.

2. Minimum time for period is 5msec.
Apply the old value. For shorter latency, further works are needed.

3. In blocking mode, frames per period/buffer is aligned to 32.
Each packet can include some frames depending on its sampling rate. In
blocking mode, the number equals to SYT_INTERVAL. Currently firewire-lib
can schedule snd_pcm_period_elapsed() for each packet. So, for accurate
PCM interrupt, the number of frames per period/buffer should be aligned
to SYT_INTERVAL.
Currently firewire-lib is lack of better rules to achieve this. So LCM of
each value of SYT_INTERVALs (=32) is applied. This can be improved for
further work.

[Fixed the compile error due to the missing "&" by tiwai]

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: dice/firewire-lib: Keep dualwire mode but obsolete CIP_HI_DUALWIRE
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:51 +0000 (22:44 +0900)]
ALSA: dice/firewire-lib: Keep dualwire mode but obsolete CIP_HI_DUALWIRE

In previous commit, AMDTP functionality in firewire-lib supports mapping
for PCM data channels. With this mapping, firewire-lib can obsolete
a flag, CIP_HI_DUALWIRE, but Dice driver still keeps dual wire mode.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Add support for channel mapping
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:50 +0000 (22:44 +0900)]
ALSA: firewire-lib: Add support for channel mapping

Some devices arrange the position of PCM/MIDI data channel in AMDTP packet.
This commit allows drivers to set channel mapping.

To be simple, the mapping table is an array with fixed length. Then the number
of channels for PCM is restricted by 64 channels.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Add support for duplex streams synchronization in blocking mode
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:49 +0000 (22:44 +0900)]
ALSA: firewire-lib: Add support for duplex streams synchronization in blocking mode

Generally, the devices can synchronize to handle 'presentation timestamp'
in CIP packets. This commit adds functionality to pick up this timestamp from
in-packets transmitted by the device, then use it for out packets.

In current implementation, this module generated the timestamp by itself. This
is 'SYT Match' mode. Then drivers with this module acts as synchronization
master. This commit allows this module to act as synchronization slave.

This commit restricts this mechanism is only available in blocking mode because
handling the timestamp in non-blocking mode is more complicated than in
blocking mode.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Give syt value as parameter to handle_out_packet()
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:48 +0000 (22:44 +0900)]
ALSA: firewire-lib: Give syt value as parameter to handle_out_packet()

For duplex streams with synchronization, drivers should pick up
'presentation timestamp' from in-packets and use the timestamp for
out-packets. This commit is preparation for this.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Add support for MIDI capture/playback
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:47 +0000 (22:44 +0900)]
ALSA: firewire-lib: Add support for MIDI capture/playback

For capturing/playbacking MIDI messages, this commit adds one MIDI conformant
data channel. This data channel has multiplexed 8 MIDI data streams. So this
data channel can transfer messages from/to 8 MIDI ports.

And this commit allows to set PCM format even if AMDTP streams already start.
I suppose the case that PCM substreams are going to be joined into AMDTP
streams when AMDTP streams are already started for MIDI substreams. Each
driver must count how many PCM/MIDI substreams use AMDTP streams to stop
AMDTP streams.

There are differences between specifications about MIDI conformant data.

About the multiplexing, IEC 61883-6:2002, itself, has no information. It
describes labels and bytes for MIDI messages and refers to MMA/AMEI RP-027
for 'successfull implementation'. MMA/AMEI RP-027 describes 8 MPX-MIDI data
streams for one MIDI conformant data channel. IEC 61883-6:2005 adds
'sequence multiplexing' and apply this way and describe incompatibility
between 2002 and 2005.

So this commit applies IEC 61883-6:2005. When we find some devices compliant
to IEC 61883-6:2002, then this difference should be handles as device quirk
in additional work.

About the number of bytes in an MIDI conformant data, IEC 61883-6:2002 describe
0,1,2,3 bytes. MMA/AMEI RP-027 describes 'MIDI1.0-1x-SPEED', 'MIDI1.0-2x-SPEED',
'MIDI1.0-3x-SPEED' modes and the maximum bytes for each mode corresponds to 1,
2, 3 bytes. The 'MIDI1.0-2x/3x-SPEED' modes are accompanied with 'negotiation
procedure' and 'encapsulation details' but there is no specifications for them.

So this commit implements 'MIDI1.0-1x-SPEED' mode for playback, but allows
to pick up 1-3 bytes for capturing.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Add support for AMDTP in-stream and PCM capture
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:46 +0000 (22:44 +0900)]
ALSA: firewire-lib: Add support for AMDTP in-stream and PCM capture

For capturing PCM, this commit adds the functionality to handle in-stream.
This is also applied for dual-wire mode.

Currently, capturing 32bit samples are supported.

When the sequence of in-packet has discontinuity of dbc, in-stream isn't handled
and amdtp_streaming_error() returns true.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Split some codes into functions to reuse for both streams
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:45 +0000 (22:44 +0900)]
ALSA: firewire-lib: Split some codes into functions to reuse for both streams

Some codes can be reused to handle in-stream. This commit adds new functions.
This commit also renames some functions to keep naming consistency.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Add 'direction' member to 'amdtp_stream' structure
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:44 +0000 (22:44 +0900)]
ALSA: firewire-lib: Add 'direction' member to 'amdtp_stream' structure

This patch adds 'direction' member to amdtp_stream structure to indicate its
direction. This patch also adds 'direction' argument to amdtp_stream_init()
function to determine its direction.

The amdtp_stream_init() function is exported and used by firewire-speakers and
dice so this patch also affects them.

This patch just add them. Actual implementation will be done by followed
patches.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Add macros instead of fixed value for AMDTP
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:43 +0000 (22:44 +0900)]
ALSA: firewire-lib: Add macros instead of fixed value for AMDTP

This patch adds some macros instead of fixed value for AMDTP according to
IEC 61883-1/6. These macros will also be used by followed patches.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: firewire-lib: Rename functions, structure, member for AMDTP
Takashi Sakamoto [Fri, 25 Apr 2014 13:44:42 +0000 (22:44 +0900)]
ALSA: firewire-lib: Rename functions, structure, member for AMDTP

This patch renames some functions, a structure and its member to reuse them
in both AMDTP in/out stream.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda - add an instance to use snd_hda_pick_pin_fixup
Hui Wang [Mon, 26 May 2014 08:22:44 +0000 (16:22 +0800)]
ALSA: hda - add an instance to use snd_hda_pick_pin_fixup

Just two members in the alc269_pin_fixup_tbl[] can cover more than
10 Dell laptop models.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda - drop def association and sequence from pinconf comparing
Hui Wang [Mon, 26 May 2014 08:22:43 +0000 (16:22 +0800)]
ALSA: hda - drop def association and sequence from pinconf comparing

A lot a machine have the same codec, but they have different default
pinconf setting just because the def association and sequence is
different, as a result they can't share a hda_pintbl[], to overcome
it, we don't compare def association and sequence in the pinconf
matching.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda - get subvendor from codec rather than pci_dev
Hui Wang [Mon, 26 May 2014 08:22:42 +0000 (16:22 +0800)]
ALSA: hda - get subvendor from codec rather than pci_dev

It is safer for non-pci situation.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda - Add a new quirk match based on default pin configuration
David Henningsson [Mon, 26 May 2014 08:22:41 +0000 (16:22 +0800)]
ALSA: hda - Add a new quirk match based on default pin configuration

Normally, we match on pci ssid only. This works but needs new code
for every machine. To catch more machines in the same quirk, let's add
a new type of quirk, where we match on
 1) PCI Subvendor ID (i e, not device, just vendor)
 2) Codec ID
 3) Pin configuration default

If all these three match, we could be reasonably certain that the
quirk should apply to the machine even though it might not be the
exact same device.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda - Add fixup_forced flag
David Henningsson [Mon, 26 May 2014 08:22:40 +0000 (16:22 +0800)]
ALSA: hda - Add fixup_forced flag

The "fixup_forced" flag will indicate whether a specific fixup
(or nofixup) has been set by the user, to override the driver's
default.
This flag will help future patches.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: snd-usb: mixer: remove error messages on failed kmalloc()
Daniel Mack [Sat, 24 May 2014 08:58:17 +0000 (10:58 +0200)]
ALSA: snd-usb: mixer: remove error messages on failed kmalloc()

If kmalloc() fails, warnings will be loud enough. We can safely just
return -ENOMEM in such cases.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: snd-usb: mixer: coding style fixups
Daniel Mack [Sat, 24 May 2014 08:58:16 +0000 (10:58 +0200)]
ALSA: snd-usb: mixer: coding style fixups

Shorten some over-long lines, multi-line comments, spurious whitespaces,
curly brakets etc.  No functional change.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: Remove deprecated snd_card_create()
Takashi Iwai [Fri, 23 May 2014 07:57:55 +0000 (09:57 +0200)]
ALSA: Remove deprecated snd_card_create()

Now all calls have been fixed, let's get rid of the old definition.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoALSA: hda - Fix onboard audio on Intel H97/Z97 chipsets
Takashi Iwai [Fri, 23 May 2014 07:02:44 +0000 (09:02 +0200)]
ALSA: hda - Fix onboard audio on Intel H97/Z97 chipsets

The recent Intel H97/Z97 chipsets need the similar setups like other
Intel chipsets for snooping, etc.  Especially without snooping, the
audio playback stutters or gets corrupted.  This fix patch just adds
the corresponding PCI ID entry with the proper flags.

Reported-and-tested-by: Arthur Borsboom <arthurborsboom@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoMerge tag 'asoc-v3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound...
Takashi Iwai [Thu, 22 May 2014 15:50:00 +0000 (17:50 +0200)]
Merge tag 'asoc-v3.16' of git://git./linux/kernel/git/broonie/sound into for-next

ASoC: Updates for v3.16

Lots of cleanup work going on in the core this release but very little
visible to external users except for the new drivers that have been
added.

 - Support for specifying aux CODECs in DT.
 - Removal of the deprecated mux and enum macros.
 - More moves towards full componentisation.
 - Removal of some unused I/O code.
 - Lots of cleanups, fixes and enhancements to the davinci, Freescale,
   Haswell and Realtek drivers.
 - Several drivers exposed directly in Kconfig for use with simple-card.
 - New drivers for Cirrus CS42L56, Realtek RT5639, RT5642 and RT5651 and
   ST STA350.

10 years agoALSA: Replace DEFINE_PCI_DEVICE_TABLE macro use
Benoit Taine [Thu, 22 May 2014 15:08:54 +0000 (17:08 +0200)]
ALSA: Replace DEFINE_PCI_DEVICE_TABLE macro use

We should prefer `const struct pci_device_id` over
`DEFINE_PCI_DEVICE_TABLE` to meet kernel coding style guidelines.
This issue was reported by checkpatch.

A simplified version of the semantic patch that makes this change is as
follows (http://coccinelle.lip6.fr/):

// <smpl>

@@
identifier i;
declarer name DEFINE_PCI_DEVICE_TABLE;
initializer z;
@@

- DEFINE_PCI_DEVICE_TABLE(i)
+ const struct pci_device_id i[]
= z;

// </smpl>

It has been tested by compilation.

Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
10 years agoMerge remote-tracking branches 'asoc/topic/ux500', 'asoc/topic/wm8731', 'asoc/topic...
Mark Brown [Wed, 21 May 2014 23:24:04 +0000 (00:24 +0100)]
Merge remote-tracking branches 'asoc/topic/ux500', 'asoc/topic/wm8731', 'asoc/topic/wm8804', 'asoc/topic/wm8955' and 'asoc/topic/wm8985' into asoc-next

10 years agoMerge remote-tracking branches 'asoc/topic/rt5651', 'asoc/topic/samsung', 'asoc/topic...
Mark Brown [Wed, 21 May 2014 23:24:00 +0000 (00:24 +0100)]
Merge remote-tracking branches 'asoc/topic/rt5651', 'asoc/topic/samsung', 'asoc/topic/sgtl5000', 'asoc/topic/sh', 'asoc/topic/simple', 'asoc/topic/sirf', 'asoc/topic/sta350' and 'asoc/topic/tlv320dac33' into asoc-next

10 years agoMerge remote-tracking branches 'asoc/topic/nuc900', 'asoc/topic/omap', 'asoc/topic...
Mark Brown [Wed, 21 May 2014 23:23:57 +0000 (00:23 +0100)]
Merge remote-tracking branches 'asoc/topic/nuc900', 'asoc/topic/omap', 'asoc/topic/pxa', 'asoc/topic/rcar', 'asoc/topic/rt5640' and 'asoc/topic/rt5645' into asoc-next

10 years agoMerge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', 'asoc/topic...
Mark Brown [Wed, 21 May 2014 23:23:54 +0000 (00:23 +0100)]
Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next

10 years agoMerge remote-tracking branches 'asoc/topic/devm', 'asoc/topic/fsl', 'asoc/topic/fsl...
Mark Brown [Wed, 21 May 2014 23:23:51 +0000 (00:23 +0100)]
Merge remote-tracking branches 'asoc/topic/devm', 'asoc/topic/fsl', 'asoc/topic/fsl-esai', 'asoc/topic/fsl-sai', 'asoc/topic/fsl-spdif' and 'asoc/topic/fsl-ssi' into asoc-next

10 years agoMerge remote-tracking branches 'asoc/topic/cs42l56', 'asoc/topic/cs42xx8' and 'asoc...
Mark Brown [Wed, 21 May 2014 23:23:49 +0000 (00:23 +0100)]
Merge remote-tracking branches 'asoc/topic/cs42l56', 'asoc/topic/cs42xx8' and 'asoc/topic/davinci' into asoc-next