All of lore.kernel.org
 help / color / mirror / Atom feed
* RME Fireface alsa driver
@ 2018-12-11 19:51 thet
  2018-12-11 20:43 ` Takashi Sakamoto
  0 siblings, 1 reply; 9+ messages in thread
From: thet @ 2018-12-11 19:51 UTC (permalink / raw)
  To: alsa-devel

I posted this a couple of weeks ago in the alsa users list but there was
no response. I hope someone here can help.

I have a FF400 and I have been using ffado with it.

It came to my attention that there exists a ALSA driver for the FF400
since the midi was working over alsa and midi is not supported in the
ffado driver.

Also my system can see the FF400 in the sound control panel without jack
or ffado running.

I am using Mint 19 cinnamon and the liquorix kernel. (though so far I
have not noticed any difference between the liquorix kernel and the
generic one except pre-empt performance).

I would like to try using just the alsa driver and not ffado. Since I'm
using the alsa midi support anyway it would be less total software to
use the alsa driver for everything - assuming it supports everything I need
for serious music recording.

However I can't get any sound out of the FF400 using the ALSA driver -
it works ok with FFADO though. Also the midi works - presumably using
the alsa driver.

I have tried using alsa directly in the sound control panel, using the
alsa output from audacious, and the alsa driver from jack.

I get an error about setting the frames/period/buffer size.

The red light on the FF400 that shows no connection to a host stays on  -
even though the system can see it is present. This light goes off if I
start ffado and jack, or if I start ffado mixer.

Is there a guide somewhere on how to set up the ALSA drivers for the FF400?

thanks!

Thet

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RME Fireface alsa driver
  2018-12-11 19:51 RME Fireface alsa driver thet
@ 2018-12-11 20:43 ` Takashi Sakamoto
       [not found]   ` <a61bd3e8-0ace-3ef1-ffa4-f56c3c67fd31@halfshavedyaks.xyz>
  0 siblings, 1 reply; 9+ messages in thread
From: Takashi Sakamoto @ 2018-12-11 20:43 UTC (permalink / raw)
  To: thet; +Cc: alsa-devel

Hi,

On Tue, Dec 11, 2018 at 07:51:25PM +0000, thet wrote:
> I posted this a couple of weeks ago in the alsa users list but there was
> no response. I hope someone here can help.
> 
> I have a FF400 and I have been using ffado with it.
> 
> It came to my attention that there exists a ALSA driver for the FF400
> since the midi was working over alsa and midi is not supported in the
> ffado driver.
> 
> Also my system can see the FF400 in the sound control panel without jack
> or ffado running.
> 
> I am using Mint 19 cinnamon and the liquorix kernel. (though so far I
> have not noticed any difference between the liquorix kernel and the
> generic one except pre-empt performance).
>
> I would like to try using just the alsa driver and not ffado. Since I'm
> using the alsa midi support anyway it would be less total software to
> use the alsa driver for everything - assuming it supports everything I need
> for serious music recording.
> 
> However I can't get any sound out of the FF400 using the ALSA driver -
> it works ok with FFADO though. Also the midi works - presumably using
> the alsa driver.
> 
> I have tried using alsa directly in the sound control panel, using the
> alsa output from audacious, and the alsa driver from jack.
> 
> I get an error about setting the frames/period/buffer size.
 
Please share the 'error' with your command line. It's the most
important. Furthermore, please check kernel message with journalctl(1).

> The red light on the FF400 that shows no connection to a host stays on  -
> even though the system can see it is present. This light goes off if I
> start ffado and jack, or if I start ffado mixer.
> 
> Is there a guide somewhere on how to set up the ALSA drivers for the FF400?

I left the device already[2] and can't regenerate this issue, but in my
memory the device can generate sound when the red LED turns on. 


Some registers on Fireface 400 for configuration are write-only. To
avoid interrupting userspace software such as ffado stuffs, ALSA
fireface driver is programmed not to touch such registers. This means
that the driver requires some assists of userspace.

The red LED labeled 'HOST' is put off when writing a byte to a register 
In a case of Fireface 400, 0x'0000'8010'03fc is the register. But this
includes some settings for output signal of S/PDIF in coaxial interface.
You can set the register with linux-firewire-utils[1], for example.

$ ./firewire-request /dev/fw1 write 0x0000801003fc 0x1f
(The unit allows block request for 1 byte access.)

Or install 'libhinawa1' and 'gir1.2-hinawa-2.0' package and run below
script.

```
#!/usr/bin/python3

import gi
gi.require_version('Hinawa', '2.0')
from gi.repository import Hinawa

unit = Hinawa.FwUnit()
unit.open('/dev/fw1')
unit.listen()

req = Hinawa.FwReq()
req.append(0x1f)
req.write(unit, 0x0000801003fc, 0x1f)
```

[1] https://github.com/cladisch/linux-firewire-utils
[2] http://mailman.alsa-project.org/pipermail/alsa-devel/2015-December/102261.html


Regards

Takashi Sakamoto

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RME Fireface alsa driver
       [not found]   ` <a61bd3e8-0ace-3ef1-ffa4-f56c3c67fd31@halfshavedyaks.xyz>
@ 2018-12-17 14:16     ` Takashi Sakamoto
  2018-12-18 23:38       ` thet
  0 siblings, 1 reply; 9+ messages in thread
From: Takashi Sakamoto @ 2018-12-17 14:16 UTC (permalink / raw)
  To: thet; +Cc: alsa-devel

Hi,
(C.C.ed to alsa-devel)

At first, I apologize that ALSA fireface driver since Linux kernel v4.12 
includes some bugs for its packet handling for PCM capture substream[1].
This bug can brings disorder of jackd process.

Furthermore, even if handling rx packets correctly, Fireface 400 cannot 
generate sounds because audio data frame is not picked up from 
isochronous packets to DSP[2].

I've already posted some patches to fix these bugs. The patches were 
already merged to ALSA upstream and they'll be going to mainline in next 
merge window for v4.21 kernel. They were also posted for stable kernel and 
later you can receive patched kernel image if you use any stable kernels.

If you'll test these patches in current your environment, please get 
recent code from my remote repository for backport to Linux v4.17 or later:
https://github.com/takaswie/snd-firewire-improve

Your test will be great help to me because I've already left Fireface 400.
(I rented it just for two weeks and I'll leave Fireface 800 soon as well.)

On Fri, 14 Dec 2018, thet wrote:
> OK I have the FF400 set up now.

In my recent work for Fireface 800[3][4], I ensure that Fireface 800 
can generate sounds even if the HOST LED turns on. This is the same
experience with Fireface 400. Thus you can ignore whether the LED turn off
or not.

> What action should I take to create an error that is meaningful?
> ..
> when I start audacious from the terminal using the alsa output plugin
> and the FF400 selected I get:

Any GUI tools are not necessarily good for debugging. Please use 'aplay' 
insted, like:

$ aplay -v -D hw:Fireface400 -r 44100 -c 18 -f S32_LE /dev/urandom
$ aplay -v -D hw:Fireface400 -r 88200 -c 14 -f S32_LE /dev/urandom
$ aplay -v -D hw:Fireface400 -r 192000 -c 10 -f S32_LE /dev/urandom

In the above cases, I expect your unit can generate noisy sounds with the
latest code of driver.

Anyway, I note you not to drop list address (alsa-devel@alsa-project.org) 
from CC list. It's valuable to share experiences of errors/failures 
because potentially they are good information for developers to seek bugs 
in software and be going to fix them.

[1] [alsa-devel] [PATCH 1/3] ALSA: firewire-lib: fix wrong handling 
payload_length as payload_quadlet
http://mailman.alsa-project.org/pipermail/alsa-devel/2018-December/143147.html
[2] [alsa-devel] [PATCH] ALSA: fireface: fix for state to fetch PCM frames
http://mailman.alsa-project.org/pipermail/alsa-devel/2018-December/143150.html
[3] [alsa-devel] [PATCH 0/8] ALSA: fireface: add support for Fireface 800 
with MIDI functionality only
http://mailman.alsa-project.org/pipermail/alsa-devel/2018-December/142826.html
[4] [alsa-devel] [PATCH 0/5] ALSA: fireface: add support for Fireface 800 
with streaming functionality
http://mailman.alsa-project.org/pipermail/alsa-devel/2018-December/143154.html


Regards

Takashi Sakamoto

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RME Fireface alsa driver
  2018-12-17 14:16     ` Takashi Sakamoto
@ 2018-12-18 23:38       ` thet
  2018-12-19  4:22         ` Takashi Sakamoto
  0 siblings, 1 reply; 9+ messages in thread
From: thet @ 2018-12-18 23:38 UTC (permalink / raw)
  To: Takashi Sakamoto; +Cc: alsa-devel

thank you! that seems like good work.

I am not confident to do the backport, but I will test when the kernel
is available in a repo to install.

Or if you can send me a compiled kernel to test I can test it.


On 17/12/2018 14:16, Takashi Sakamoto wrote:
> Hi,
> (C.C.ed to alsa-devel)
>
> At first, I apologize that ALSA fireface driver since Linux kernel
> v4.12 includes some bugs for its packet handling for PCM capture
> substream[1].
> This bug can brings disorder of jackd process.
>
> Furthermore, even if handling rx packets correctly, Fireface 400
> cannot generate sounds because audio data frame is not picked up from
> isochronous packets to DSP[2].
>
> I've already posted some patches to fix these bugs. The patches were
> already merged to ALSA upstream and they'll be going to mainline in
> next merge window for v4.21 kernel. They were also posted for stable
> kernel and later you can receive patched kernel image if you use any
> stable kernels.
>
> If you'll test these patches in current your environment, please get
> recent code from my remote repository for backport to Linux v4.17 or
> later:
> https://github.com/takaswie/snd-firewire-improve
>
> Your test will be great help to me because I've already left Fireface
> 400.
> (I rented it just for two weeks and I'll leave Fireface 800 soon as
> well.)
>
> On Fri, 14 Dec 2018, thet wrote:
>> OK I have the FF400 set up now.
>
> In my recent work for Fireface 800[3][4], I ensure that Fireface 800
> can generate sounds even if the HOST LED turns on. This is the same
> experience with Fireface 400. Thus you can ignore whether the LED turn
> off
> or not.
>
>> What action should I take to create an error that is meaningful?
>> ..
>> when I start audacious from the terminal using the alsa output plugin
>> and the FF400 selected I get:
>
> Any GUI tools are not necessarily good for debugging. Please use
> 'aplay' insted, like:
>
> $ aplay -v -D hw:Fireface400 -r 44100 -c 18 -f S32_LE /dev/urandom
> $ aplay -v -D hw:Fireface400 -r 88200 -c 14 -f S32_LE /dev/urandom
> $ aplay -v -D hw:Fireface400 -r 192000 -c 10 -f S32_LE /dev/urandom
>
> In the above cases, I expect your unit can generate noisy sounds with the
> latest code of driver.
>
> Anyway, I note you not to drop list address
> (alsa-devel@alsa-project.org) from CC list. It's valuable to share
> experiences of errors/failures because potentially they are good
> information for developers to seek bugs in software and be going to
> fix them.
>
> [1] [alsa-devel] [PATCH 1/3] ALSA: firewire-lib: fix wrong handling
> payload_length as payload_quadlet
> http://mailman.alsa-project.org/pipermail/alsa-devel/2018-December/143147.html
>
> [2] [alsa-devel] [PATCH] ALSA: fireface: fix for state to fetch PCM
> frames
> http://mailman.alsa-project.org/pipermail/alsa-devel/2018-December/143150.html
>
> [3] [alsa-devel] [PATCH 0/8] ALSA: fireface: add support for Fireface
> 800 with MIDI functionality only
> http://mailman.alsa-project.org/pipermail/alsa-devel/2018-December/142826.html
>
> [4] [alsa-devel] [PATCH 0/5] ALSA: fireface: add support for Fireface
> 800 with streaming functionality
> http://mailman.alsa-project.org/pipermail/alsa-devel/2018-December/143154.html
>
>
>
> Regards
>
> Takashi Sakamoto
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RME Fireface alsa driver
  2018-12-18 23:38       ` thet
@ 2018-12-19  4:22         ` Takashi Sakamoto
  2018-12-19 14:51           ` thet
  0 siblings, 1 reply; 9+ messages in thread
From: Takashi Sakamoto @ 2018-12-19  4:22 UTC (permalink / raw)
  To: thet; +Cc: alsa-devel

On Tue, Dec 18, 2018 at 11:38:47PM +0000, thet wrote:
> I am not confident to do the backport, but I will test when the kernel
> is available in a repo to install.
> 
> Or if you can send me a compiled kernel to test I can test it.

I'm sorry but I have no interest in your system at all, thus I don't use
my time for something of it. I'm a software developer, not your servant.


If you voluntarily wish to compile and install out-of-tree codes in my
repository and test built driver modules, I can give you a short
instruction for them. But in this case, it's better for you to read
README[1] at first and foremost.


[1] https://github.com/takaswie/snd-firewire-improve/

Thanks

Takashi Sakamoto

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RME Fireface alsa driver
  2018-12-19  4:22         ` Takashi Sakamoto
@ 2018-12-19 14:51           ` thet
  2019-01-05  8:50             ` Takashi Sakamoto
  0 siblings, 1 reply; 9+ messages in thread
From: thet @ 2018-12-19 14:51 UTC (permalink / raw)
  To: alsa-devel

I'm sorry if I inadvertently suggested something specific to me or my
system. I did not think I was doing that.

Actually i was offering to help by testing. I'm sorry I don't have the
skills to help in the way that would be most useful for you by compiling
the kernel from source code - but that does not mean i am asking you to
do something special for me. I could also help by lending my FF400 for a
short time to a UK based developer if there is one.

I am NOT a software developer and I have very little knowledge of
kernels or hardware level coding. I don't really have time to learn.

I shouldn't even be on this list - I only asked about the status of the
FF400 driver here because there was no response on the alsa users list.

i will test the alsa driver for the FF400 when it becomes available in
one of the kernels I use through the normal repos and ppas for those.

On 19/12/2018 04:22, Takashi Sakamoto wrote:
> I'm sorry but I have no interest in your system at all, thus I don't use
> my time for something of it. I'm a software developer, not your servant.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RME Fireface alsa driver
  2018-12-19 14:51           ` thet
@ 2019-01-05  8:50             ` Takashi Sakamoto
  2019-04-17 20:59               ` RME Fireface alsa driver - improved but still not working thet
  0 siblings, 1 reply; 9+ messages in thread
From: Takashi Sakamoto @ 2019-01-05  8:50 UTC (permalink / raw)
  To: thet; +Cc: alsa-devel

Hi,

On Wed, Dec 19, 2018 at 02:51:29PM +0000, thet wrote:
> I'm sorry if I inadvertently suggested something specific to me or my
> system. I did not think I was doing that.
> 
> Actually i was offering to help by testing. I'm sorry I don't have the
> skills to help in the way that would be most useful for you by compiling
> the kernel from source code - but that does not mean i am asking you to
> do something special for me. I could also help by lending my FF400 for a
> short time to a UK based developer if there is one.
> 
> I am NOT a software developer and I have very little knowledge of
> kernels or hardware level coding. I don't really have time to learn.
> 
> I shouldn't even be on this list - I only asked about the status of the
> FF400 driver here because there was no response on the alsa users list.
> 
> i will test the alsa driver for the FF400 when it becomes available in
> one of the kernels I use through the normal repos and ppas for those.
> 
> On 19/12/2018 04:22, Takashi Sakamoto wrote:
> > I'm sorry but I have no interest in your system at all, thus I don't use
> > my time for something of it. I'm a software developer, not your servant.

Today fixes are queued to stable kernels; v4.20[1], v4.19[2], v4.14[3].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/commit/?id=980bbac3dc0c038f080d2420b00615b9995c977b
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/commit/?id=3f6f84af6cb95d81e005a5f19868487710173de8
[3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/commit/?id=199205774df4fe196065c5a6bb016158d673ea1f

Regards

Takashi Sakamoto

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RME Fireface alsa driver - improved but still not working
  2019-01-05  8:50             ` Takashi Sakamoto
@ 2019-04-17 20:59               ` thet
  2019-04-23  6:03                 ` Takashi Sakamoto
  0 siblings, 1 reply; 9+ messages in thread
From: thet @ 2019-04-17 20:59 UTC (permalink / raw)
  To: alsa-devel

I notice that the RME fireface alsa driver snd-fireface now works a
little since 4.19 I think

In earlier kernels 4.18 and below the midi worked on the FF400 but no
audio and the FF800 was not supported at all.

now the midi works on both FF400 and FF800 and the audio works a little.

the kernel I am using is 5.0.0-7.1-liquorix-amd64 #1 ZEN SMP PREEMPT
liquorix 5.0-6ubuntu1~bionic (2019-04-06) x86_64 x86_64 x86_64 GNU/Linux

(I am also happy to test with a different kernel but I am not able to
compile it myself so it would need to be available in a repo.)

The audio however does not work correctly. It is unstable, sometimes it
works for a while but other times it glitches or even becomes wildly
distorted.

I am not a kernel developer at all - but I am willing to test and post
logs if it helps - if anyone here can give me clear instructions about
how to test.

Also - is it possible for a user to disable the audio part of the driver
but still use the midi part?

This would allow me to use the audio with FFADO and the midi with alsa.
FFADO doesn't support midi on these devices so it is great that alsa
does -  but running both at once can be tricky as the alsa driver does
not let FFADO take over the device once it has it.

Can I suggest that maybe the audio and midi drivers for these devices
could be made as separate kernel modules? Then if one part has problems
it need not be loaded. I'm not sure if this is feasible but if it is it
would allow more flexibility in how they are used.

thanks

Thet



_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: RME Fireface alsa driver - improved but still not working
  2019-04-17 20:59               ` RME Fireface alsa driver - improved but still not working thet
@ 2019-04-23  6:03                 ` Takashi Sakamoto
  0 siblings, 0 replies; 9+ messages in thread
From: Takashi Sakamoto @ 2019-04-23  6:03 UTC (permalink / raw)
  To: thet; +Cc: alsa-devel

Hi,

On Thu, Apr 18, 2019, at 06:01, thet wrote:
> I notice that the RME fireface alsa driver snd-fireface now works a
> little since 4.19 I think
> 
> In earlier kernels 4.18 and below the midi worked on the FF400 but no
> audio and the FF800 was not supported at all.
 
FF400 support was firstly added to Linux v4.12, however the initial driver
includes some bugs. Below fixes were already committed to stable kernels.

 * fa9c98e4b975 ("ALSA: fireface: fix reference to wrong register for clock configuration")[1]
 * 3d16200a3e55 ("ALSA: fireface: fix for state to fetch PCM frames")[2]

If using Linux kernel v4.19.14 or later, or v4.14.92 or later, both of
audio and midi work with FF400.

> now the midi works on both FF400 and FF800 and the audio works a little.
 
> the kernel I am using is 5.0.0-7.1-liquorix-amd64 #1 ZEN SMP PREEMPT
> liquorix 5.0-6ubuntu1~bionic (2019-04-06) x86_64 x86_64 x86_64 GNU/Linux
 
FF800 support was firstly added to Linux v5.0.

> (I am also happy to test with a different kernel but I am not able to
> compile it myself so it would need to be available in a repo.)
> 
> The audio however does not work correctly. It is unstable, sometimes it
> works for a while but other times it glitches or even becomes wildly
> distorted.

Yes. I've reported this issue when posting the RFC patchset of this
driver[3]. Furthermore, I experience the issue in all of supported models;
FF400, FF800 and UCX.
 
> I am not a kernel developer at all - but I am willing to test and post
> logs if it helps - if anyone here can give me clear instructions about
> how to test.

This issue belongs to knowledge about protocol used in transmission of
data on IEEE 1394 bus, thus it's beyond to kernel development.

On RME Fireface series, unique protocol is used to transfer PCM
frames and its presentation timing[4][5][6]. This is completely
different from the standard protocol; IEC 61883-1/6. Therefore,
thorough packet analysis is required, but nobody has achieved to clear
it.

> Also - is it possible for a user to disable the audio part of the driver
> but still use the midi part?
> 
> This would allow me to use the audio with FFADO and the midi with alsa.
> FFADO doesn't support midi on these devices so it is great that alsa
> does -  but running both at once can be tricky as the alsa driver does
> not let FFADO take over the device once it has it.

I designed ALSA fireface driver with enough care for libffado, so you can
use ALSA MIDI functionality and libffado packet streaming at the same time.

For details, please read commit logs relevant to ALSA fireface driver[7]
I'll always write the logs with enough information about my commit,
especially about the way to handle the target device, unclear points,
impacts/requirements for userspace applications and so on.

> Can I suggest that maybe the audio and midi drivers for these devices
> could be made as separate kernel modules? Then if one part has problems
> it need not be loaded. I'm not sure if this is feasible but if it is it
> would allow more flexibility in how they are used.

You seem to register one of the separated modules accounting for PCM
feature to blacklist for kmod. I have a mixed feeling to this idea.

When ALSA firewire stack got a driver for devices which libffado also
supports[8], an userspace API was introduced as well. This API is
designed to disallow the kernel driver to start packet streaming.
This feature is expected to intervene kernel drivers and userspace
applications against resources of the packet streaming.

The application can disallow kernel drivers for it by a simple way
(opening ALSA FwDep character device execute ioctl(2) with
SNDRV_FIREWIRE_IOCTL_LOCK, then close).

I'll suggest you to encourage libffado developers (or yourself) to
implement it because the cost to separate kernel module is not so cheap
as you expected.


[1] https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/sound/firewire/fireface?id=fa9c98e4b975
[2] https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/sound/firewire/fireface?id=3d16200a3e55
[3] https://mailman.alsa-project.org/pipermail/alsa-devel/2015-December/102261.html
[4] https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/sound/firewire/fireface?id=53eb086750f3
[5] https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/sound/firewire/fireface?id=6fb7db902bbe
[6] https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/sound/firewire/fireface?id=4b316436ab2e
[7] https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/log/sound/firewire/fireface
[8] https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/sound/firewire?id=82fbb4f7b47683077e071
[9] https://github.com/takaswie/libhinawa/blob/master/src/snd_unit.c#L235


Regards

Takashi Sakamoto

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-04-23  6:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-11 19:51 RME Fireface alsa driver thet
2018-12-11 20:43 ` Takashi Sakamoto
     [not found]   ` <a61bd3e8-0ace-3ef1-ffa4-f56c3c67fd31@halfshavedyaks.xyz>
2018-12-17 14:16     ` Takashi Sakamoto
2018-12-18 23:38       ` thet
2018-12-19  4:22         ` Takashi Sakamoto
2018-12-19 14:51           ` thet
2019-01-05  8:50             ` Takashi Sakamoto
2019-04-17 20:59               ` RME Fireface alsa driver - improved but still not working thet
2019-04-23  6:03                 ` Takashi Sakamoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.