alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: dice: add stream format parameters for Weiss devices
@ 2023-07-28  9:16 Michele Perrone
  2023-07-28 13:13 ` Takashi Sakamoto
  0 siblings, 1 reply; 13+ messages in thread
From: Michele Perrone @ 2023-07-28  9:16 UTC (permalink / raw)
  To: Takashi Iwai, Takashi Sakamoto; +Cc: alsa-devel, Rolf Anderegg

Hard-coded stream format parameters are added for Weiss Engineering
FireWire devices. When the device vendor and model match, the parameters
are copied into the stream format cache. This allows for setting all
supported sampling rates up to 192kHz, and consequently adjusting the
number of available I/O channels.

Signed-off-by: Rolf Anderegg <rolf.anderegg@weiss.ch>
Signed-off-by: Michele Perrone <michele.perrone@weiss.ch>
---
  sound/firewire/dice/Makefile     |   2 +-
  sound/firewire/dice/dice-weiss.c | 120 +++++++++++++++++++++++++++++++
  sound/firewire/dice/dice.c       |  72 +++++++++++++++++++
  3 files changed, 193 insertions(+), 1 deletion(-)
  create mode 100644 sound/firewire/dice/dice-weiss.c

diff --git a/sound/firewire/dice/Makefile b/sound/firewire/dice/Makefile
index a5f3fbf28b8c..bac8712f9014 100644
--- a/sound/firewire/dice/Makefile
+++ b/sound/firewire/dice/Makefile
@@ -2,5 +2,5 @@
  snd-dice-objs := dice-transaction.o dice-stream.o dice-proc.o 
dice-midi.o \
           dice-pcm.o dice-hwdep.o dice.o dice-tcelectronic.o \
           dice-alesis.o dice-extension.o dice-mytek.o dice-presonus.o \
-         dice-harman.o dice-focusrite.o
+         dice-harman.o dice-focusrite.o dice-weiss.o
  obj-$(CONFIG_SND_DICE) += snd-dice.o
diff --git a/sound/firewire/dice/dice-weiss.c 
b/sound/firewire/dice/dice-weiss.c
new file mode 100644
index 000000000000..ad22bfafd324
--- /dev/null
+++ b/sound/firewire/dice/dice-weiss.c
@@ -0,0 +1,120 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dice-weiss.c - a part of driver for DICE based devices
+ *
+ * Copyright (c) 2023 Rolf Anderegg and Michele Perrone
+ */
+
+#include "dice.h"
+
+struct dice_weiss_spec {
+    unsigned int tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
+    unsigned int rx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
+    bool has_midi;
+};
+
+/* Weiss DAC202: 192kHz 2-channel DAC */
+static const struct dice_weiss_spec dac202 = {
+    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .has_midi   = false
+};
+
+/* Weiss MAN301: 192kHz 2-channel music archive network player */
+static const struct dice_weiss_spec man301 = {
+    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .has_midi   = false
+};
+
+/* Weiss INT202: 192kHz unidirectional 2-channel digital Firewire 
interface */
+static const struct dice_weiss_spec int202 = {
+    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .rx_pcm_chs = {{0, 0, 0}, {0, 0, 0} },
+    .has_midi   = false
+};
+
+/* Weiss INT203: 192kHz bidirectional 2-channel digital Firewire 
interface */
+static const struct dice_weiss_spec int203 = {
+    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .has_midi   = false
+};
+
+/* Weiss ADC2: 192kHz A/D converter with microphone preamps and line 
inputs */
+static const struct dice_weiss_spec adc2 = {
+    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .has_midi   = false
+};
+
+/* Weiss DAC2/Minerva: 192kHz 2-channel DAC */
+static const struct dice_weiss_spec dac2_minerva = {
+    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .has_midi   = false
+};
+
+/* Weiss Vesta: 192kHz 2-channel Firewire to AES/EBU interface */
+static const struct dice_weiss_spec vesta = {
+    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .has_midi   = false
+};
+
+/* Weiss AFI1: 192kHz 24-channel Firewire to ADAT or AES/EBU interface */
+static const struct dice_weiss_spec afi1 = {
+    .tx_pcm_chs = {{24, 16, 8}, {0, 0, 0} },
+    .rx_pcm_chs = {{24, 16, 8}, {0, 0, 0} },
+    .has_midi   = false
+};
+
+int snd_dice_detect_weiss_formats(struct snd_dice *dice)
+{
+    static const struct {
+        u32 model_id;
+        const struct dice_weiss_spec *spec;
+    } *entry, entries[] = {
+        {0x000007, &dac202},
+        {0x000008, &dac202}, /* Maya edition: same audio I/O as DAC202 */
+        {0x000006, &int202},
+        {0x00000a, &int203},
+        {0x00000b, &man301},
+        {0x000001, &adc2},
+        {0x000003, &dac2_minerva},
+        {0x000002, &vesta},
+        {0x000004, &afi1},
+    };
+    struct fw_csr_iterator it;
+    int key, val, model_id;
+    int i;
+
+    model_id = 0;
+    fw_csr_iterator_init(&it, dice->unit->directory);
+    while (fw_csr_iterator_next(&it, &key, &val)) {
+        if (key == CSR_MODEL) {
+            model_id = val;
+            break;
+        }
+    }
+
+    for (i = 0; i < ARRAY_SIZE(entries); ++i) {
+        entry = entries + i;
+        if (entry->model_id == model_id)
+            break;
+    }
+    if (i == ARRAY_SIZE(entries))
+        return -ENODEV;
+
+    memcpy(dice->tx_pcm_chs, entry->spec->tx_pcm_chs,
+           MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
+    memcpy(dice->rx_pcm_chs, entry->spec->rx_pcm_chs,
+           MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
+
+    if (entry->spec->has_midi) {
+        dice->tx_midi_ports[0] = 1;
+        dice->rx_midi_ports[0] = 1;
+    }
+
+    return 0;
+}
diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c
index 6c93e6e4982c..4bcd026a0b3f 100644
--- a/sound/firewire/dice/dice.c
+++ b/sound/firewire/dice/dice.c
@@ -396,6 +396,78 @@ static const struct ieee1394_device_id 
dice_id_table[] = {
          .match_flags = IEEE1394_MATCH_VERSION,
          .version     = DICE_INTERFACE,
      },
+    /* Weiss DAC202: 192kHz 2-channel DAC */
+    {
+        .match_flags    = IEEE1394_MATCH_VENDOR_ID |
+                  IEEE1394_MATCH_MODEL_ID,
+        .vendor_id    = OUI_WEISS,
+        .model_id    = 0x000007,
+        .driver_data = (kernel_ulong_t)snd_dice_detect_weiss_formats,
+    },
+    /* Weiss DAC202: 192kHz 2-channel DAC (Maya edition) */
+    {
+        .match_flags    = IEEE1394_MATCH_VENDOR_ID |
+                  IEEE1394_MATCH_MODEL_ID,
+        .vendor_id    = OUI_WEISS,
+        .model_id    = 0x000008,
+        .driver_data = (kernel_ulong_t)snd_dice_detect_weiss_formats,
+    },
+    /* Weiss MAN301: 192kHz 2-channel music archive network player */
+    {
+        .match_flags    = IEEE1394_MATCH_VENDOR_ID |
+                  IEEE1394_MATCH_MODEL_ID,
+        .vendor_id    = OUI_WEISS,
+        .model_id    = 0x00000b,
+        .driver_data = (kernel_ulong_t)snd_dice_detect_weiss_formats,
+    },
+    /* Weiss INT202: 192kHz unidirectional 2-channel digital Firewire 
interface */
+    {
+        .match_flags    = IEEE1394_MATCH_VENDOR_ID |
+                  IEEE1394_MATCH_MODEL_ID,
+        .vendor_id    = OUI_WEISS,
+        .model_id    = 0x000006,
+        .driver_data = (kernel_ulong_t)snd_dice_detect_weiss_formats,
+    },
+    /* Weiss INT203: 192kHz bidirectional 2-channel digital Firewire 
interface */
+    {
+        .match_flags    = IEEE1394_MATCH_VENDOR_ID |
+                  IEEE1394_MATCH_MODEL_ID,
+        .vendor_id    = OUI_WEISS,
+        .model_id    = 0x00000a,
+        .driver_data = (kernel_ulong_t)snd_dice_detect_weiss_formats,
+    },
+    /* Weiss ADC2: 192kHz A/D converter with microphone preamps and 
line inputs */
+    {
+        .match_flags    = IEEE1394_MATCH_VENDOR_ID |
+                  IEEE1394_MATCH_MODEL_ID,
+        .vendor_id    = OUI_WEISS,
+        .model_id    = 0x000001,
+        .driver_data = (kernel_ulong_t)snd_dice_detect_weiss_formats,
+    },
+    /* Weiss DAC2/Minerva: 192kHz 2-channel DAC */
+    {
+        .match_flags    = IEEE1394_MATCH_VENDOR_ID |
+                  IEEE1394_MATCH_MODEL_ID,
+        .vendor_id    = OUI_WEISS,
+        .model_id    = 0x000003,
+        .driver_data = (kernel_ulong_t)snd_dice_detect_weiss_formats,
+    },
+    /* Weiss Vesta: 192kHz 2-channel Firewire to AES/EBU interface */
+    {
+        .match_flags    = IEEE1394_MATCH_VENDOR_ID |
+                  IEEE1394_MATCH_MODEL_ID,
+        .vendor_id    = OUI_WEISS,
+        .model_id    = 0x000002,
+        .driver_data = (kernel_ulong_t)snd_dice_detect_weiss_formats,
+    },
+    /* Weiss AFI1: 192kHz 24-channel Firewire to ADAT or AES/EBU 
interface */
+    {
+        .match_flags    = IEEE1394_MATCH_VENDOR_ID |
+                  IEEE1394_MATCH_MODEL_ID,
+        .vendor_id    = OUI_WEISS,
+        .model_id    = 0x000004,
+        .driver_data = (kernel_ulong_t)snd_dice_detect_weiss_formats,
+    },
      { }
  };
  MODULE_DEVICE_TABLE(ieee1394, dice_id_table);

base-commit: 9b4469410cf9a0fcbccc92c480fd42f7c815a745
-- 
2.41.0



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

* Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
  2023-07-28  9:16 Michele Perrone
@ 2023-07-28 13:13 ` Takashi Sakamoto
  2023-07-31  8:09   ` Michele Perrone
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Sakamoto @ 2023-07-28 13:13 UTC (permalink / raw)
  To: Michele Perrone; +Cc: Takashi Iwai, alsa-devel, Rolf Anderegg

ei,

On Fri, Jul 28, 2023 at 11:16:11AM +0200, Michele Perrone wrote:
> Hard-coded stream format parameters are added for Weiss Engineering
> FireWire devices. When the device vendor and model match, the parameters
> are copied into the stream format cache. This allows for setting all
> supported sampling rates up to 192kHz, and consequently adjusting the
> number of available I/O channels.
> 
> Signed-off-by: Rolf Anderegg <rolf.anderegg@weiss.ch>
> Signed-off-by: Michele Perrone <michele.perrone@weiss.ch>
> ---
>  sound/firewire/dice/Makefile     |   2 +-
>  sound/firewire/dice/dice-weiss.c | 120 +++++++++++++++++++++++++++++++
>  sound/firewire/dice/dice.c       |  72 +++++++++++++++++++
>  3 files changed, 193 insertions(+), 1 deletion(-)
>  create mode 100644 sound/firewire/dice/dice-weiss.c

Thanks for the patch. I've been waiting so long for such patches to
support Weiss models. I welcome them.

As long as reviewing, I found some format and technical issues on the
patches:

Format issues:
1.unexpected line break
2.tab indentations are replaced with spaces

Technical issues:
3.build error due to missing snd_dice_detect_weiss_formats()
  * prototype of snd_dice_detect_weiss_formats() should be in dice.c
4. category_id in GUID
5.stream formats for INT202

I can correct 1st, 2nd, and 3rd issues. You can find the revised patch
in the top-most of my remote repository[1].

Let me confirm the 4th issue. TCAT defines 'category_id' field in GUID
value of devices. As long as I know, Weiss engineers uses 0x00 in the
field[2]. Is it still correct for the devices supported in the patch?

Next, let us discuss about INT202 stream formats.

+
+/* Weiss INT202: 192kHz unidirectional 2-channel digital Firewire interface
*/
+static const struct dice_weiss_spec int202 = {
+    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .rx_pcm_chs = {{0, 0, 0}, {0, 0, 0} },
+    .has_midi   = false
+};

(tx/rx should be device-oriented, tx = from device, rx = to device,
please correct)

I assume all of the DICE devices transmit isochronous packets to deliver
presentation time stamp and events (= PCM frames). Then driver software
utilizes the presentation time stamp and the amount of events to construct
payload of isochronous packets into the device.

I program ALSA dice driver based on the assumption, thus ALSA dice driver
doesn't work well without receiving any isochronous packet from the
device. However, the stream formats for INT202 device looks to support
uni-directional operation. Weiss engineers really use DICE chipset like
that? If so, I need to integrate the driver to support the case.


As another topic. I make collection of configuration ROMs[3] to make better
support for the devices in Linux system[4]. I'm pleased if you pick them
up from your devices and dedicate them for the collection.

[1] https://github.com/takaswie/sound/tree/topic/dice/weiss-support
[2] https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/tree/sound/firewire/dice/dice.c?h=v6.4#n59
[3] https://github.com/takaswie/am-config-roms/
[4] https://github.com/systemd/systemd/blob/main/hwdb.d/80-ieee1394-unit-function.hwdb


Thanks

Takashi Sakamoto

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

* Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
  2023-07-28 13:13 ` Takashi Sakamoto
@ 2023-07-31  8:09   ` Michele Perrone
  2023-07-31 14:06     ` Takashi Sakamoto
  0 siblings, 1 reply; 13+ messages in thread
From: Michele Perrone @ 2023-07-31  8:09 UTC (permalink / raw)
  To: Takashi Sakamoto
  Cc: Takashi Iwai, alsa-devel, Rolf Anderegg, Isabelle Kernhof

Dear Mr. Sakamoto,

thank you very much for the prompt feedback, and also for your 
contributions to
the Linux audio Firewire stack during the last decade.

We at Weiss Engineering would like to improve Linux support for our Firewire
devices in order to extend their lifetimes. We have also occasionally 
received
requests for Linux compatibility from some customers.

This is also motivated by the fact that the old DICE Apple driver, which was
originally developed by TCAT, is not maintained anymore and does not work on
Apple Silicon computers. Therefore, we would like to give the alternative of
running our devices on Linux if the customers decide to do.

We are also working on a update for our old music archive network player
(MAN301), which uses a DICE chip to interface with its DAC; so it seemed 
only
fair that owners of all Weiss devices based on DICE benefited from this.

Sorry for mistakes 1, 2, and 3 (you can tell it's my first kernel patch).
And I indeed forgot to include the snd_dice_detect_weiss_formats() prototype
into the patch submittal.

About the 4th issue, yes, the 'category_id' is still correct [1].

About the 5th issue, you are right both about the wrong tx/rx direction and
the absence of isochronous packets from the device. I checked the DICE
firmware code for the INT202 and we are indeed sending isochronous 
packets from
the device. Therefore, the correct stream formats should look like this:

+/* Weiss INT202: 192kHz unidirectional 2-channel digital Firewire interface
*/
+static const struct dice_weiss_spec int202 = {
+    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+    .has_midi   = false
+};

I tested this configuration with XLR and RCA outputs, and it works 
correctly.
Sorry for the mistake, I don't have a deep knowledge about the old DICE
firmware because I've started working at Weiss Engineering only recently.

About the configuration ROMs, that shouldn't be an issue; let me get back to
you as soon as I speak with my colleague, Rolf Anderegg. He has worked 
on our
DICE devices in the past but he's on vacation right now.

Yet another topic is AVC support. We used to have support for it for the 
DICE
driver in the 3.x kernel, and we are in the process of re-adapting that 
code.
But this should be probably discussed in a separate e-mail.

[1]: 
https://github.com/torvalds/linux/commit/a471fcde8c2c4b65f110bb4210af3513ee4deeb8

Kind regards,
Michele Perrone


On 28/07/23 15:13, Takashi Sakamoto wrote:
> ei,
>
> On Fri, Jul 28, 2023 at 11:16:11AM +0200, Michele Perrone wrote:
>> Hard-coded stream format parameters are added for Weiss Engineering
>> FireWire devices. When the device vendor and model match, the parameters
>> are copied into the stream format cache. This allows for setting all
>> supported sampling rates up to 192kHz, and consequently adjusting the
>> number of available I/O channels.
>>
>> Signed-off-by: Rolf Anderegg <rolf.anderegg@weiss.ch>
>> Signed-off-by: Michele Perrone <michele.perrone@weiss.ch>
>> ---
>>   sound/firewire/dice/Makefile     |   2 +-
>>   sound/firewire/dice/dice-weiss.c | 120 +++++++++++++++++++++++++++++++
>>   sound/firewire/dice/dice.c       |  72 +++++++++++++++++++
>>   3 files changed, 193 insertions(+), 1 deletion(-)
>>   create mode 100644 sound/firewire/dice/dice-weiss.c
> Thanks for the patch. I've been waiting so long for such patches to
> support Weiss models. I welcome them.
>
> As long as reviewing, I found some format and technical issues on the
> patches:
>
> Format issues:
> 1.unexpected line break
> 2.tab indentations are replaced with spaces
>
> Technical issues:
> 3.build error due to missing snd_dice_detect_weiss_formats()
>    * prototype of snd_dice_detect_weiss_formats() should be in dice.c
> 4. category_id in GUID
> 5.stream formats for INT202
>
> I can correct 1st, 2nd, and 3rd issues. You can find the revised patch
> in the top-most of my remote repository[1].
>
> Let me confirm the 4th issue. TCAT defines 'category_id' field in GUID
> value of devices. As long as I know, Weiss engineers uses 0x00 in the
> field[2]. Is it still correct for the devices supported in the patch?
>
> Next, let us discuss about INT202 stream formats.
>
> +
> +/* Weiss INT202: 192kHz unidirectional 2-channel digital Firewire interface
> */
> +static const struct dice_weiss_spec int202 = {
> +    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +    .rx_pcm_chs = {{0, 0, 0}, {0, 0, 0} },
> +    .has_midi   = false
> +};
>
> (tx/rx should be device-oriented, tx = from device, rx = to device,
> please correct)
>
> I assume all of the DICE devices transmit isochronous packets to deliver
> presentation time stamp and events (= PCM frames). Then driver software
> utilizes the presentation time stamp and the amount of events to construct
> payload of isochronous packets into the device.
>
> I program ALSA dice driver based on the assumption, thus ALSA dice driver
> doesn't work well without receiving any isochronous packet from the
> device. However, the stream formats for INT202 device looks to support
> uni-directional operation. Weiss engineers really use DICE chipset like
> that? If so, I need to integrate the driver to support the case.
>
>
> As another topic. I make collection of configuration ROMs[3] to make better
> support for the devices in Linux system[4]. I'm pleased if you pick them
> up from your devices and dedicate them for the collection.
>
> [1] https://github.com/takaswie/sound/tree/topic/dice/weiss-support
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/tree/sound/firewire/dice/dice.c?h=v6.4#n59
> [3] https://github.com/takaswie/am-config-roms/
> [4] https://github.com/systemd/systemd/blob/main/hwdb.d/80-ieee1394-unit-function.hwdb
>
>
> Thanks
>
> Takashi Sakamoto

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

* Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
  2023-07-31  8:09   ` Michele Perrone
@ 2023-07-31 14:06     ` Takashi Sakamoto
  2023-08-08  8:34       ` Michele Perrone
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Sakamoto @ 2023-07-31 14:06 UTC (permalink / raw)
  To: Michele Perrone; +Cc: Takashi Iwai, alsa-devel, Rolf Anderegg, Isabelle Kernhof

Hi Mr. Michele,

On Mon, Jul 31, 2023 at 10:09:14AM +0200, Michele Perrone wrote:
> Dear Mr. Sakamoto,
> 
> thank you very much for the prompt feedback, and also for your
> contributions to the Linux audio Firewire stack during the last decade.

Thanks. Nowadays I also maintain Linux FireWire subsystem itself[1][2][3].

> We at Weiss Engineering would like to improve Linux support for our
> Firewire devices in order to extend their lifetimes. We have also
> occasionally received requests for Linux compatibility from some
> customers.
>
> This is also motivated by the fact that the old DICE Apple driver, which was
> originally developed by TCAT, is not maintained anymore and does not work on
> Apple Silicon computers. Therefore, we would like to give the alternative of
> running our devices on Linux if the customers decide to do.

I know that no driver for 1394 OHCI hardware itself is included in recent
MacOS anymore, regardless of hardware (x86_64/arm64). Your customer has no
choice when continuing using their Weiss products.

> We are also working on a update for our old music archive network player
> (MAN301), which uses a DICE chip to interface with its DAC; so it seemed
> only fair that owners of all Weiss devices based on DICE benefited from
> this.

That sounds great... However, let me note that the maintenance of Linux
FireWire subsystem will be end in 2029, 6 years later (see the first
reference link).

> Sorry for mistakes 1, 2, and 3 (you can tell it's my first kernel patch).
> And I indeed forgot to include the snd_dice_detect_weiss_formats() prototype
> into the patch submittal.
>
> About the 4th issue, yes, the 'category_id' is still correct [1].

Okay. ALSA dice driver has the mechanism to check category_id field
against known values, while the check is skipped for explicit device
entries which the patch adds. So this is just from my curiosity
(I forgot the mechanism in the last message).

> About the 5th issue, you are right both about the wrong tx/rx direction and
> the absence of isochronous packets from the device. I checked the DICE
> firmware code for the INT202 and we are indeed sending isochronous packets
> from
> the device. Therefore, the correct stream formats should look like this:
> 
> +/* Weiss INT202: 192kHz unidirectional 2-channel digital Firewire interface
> */
> +static const struct dice_weiss_spec int202 = {
> +    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +    .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +    .has_midi   = false
> +};
> 
> I tested this configuration with XLR and RCA outputs, and it works
> correctly.

Good. I revised the patch and force-pushed to the remote repository
(747ddada9f4f).

> Sorry for the mistake, I don't have a deep knowledge about the old DICE
> firmware because I've started working at Weiss Engineering only
> recently.
 
You would have more resources about DICE chipset, and get more helps from
your colleague than me. No worry about it, I guess. 

The rest of my concern is that TCAT protocol extension (EAP) support. In
the extension, software can retrieve all of available stream format
from the target device without switching mode of transmission frequency.
If the device supports EAP, we do not necessarily to add hard-coded stream
formats (please refer to the device entry with
'snd_dice_detect_extension_formats()'). I would like you to check
specification of each Weiss product whether EAP is supported or not.

> About the configuration ROMs, that shouldn't be an issue; let me get
> back to you as soon as I speak with my colleague, Rolf Anderegg. He has
> worked on our DICE devices in the past but he's on vacation right now.

Once connecting device to IEEE 1394 bus, the content of configuration
ROM is exposed in sysfs node of Linux system. You can make a file to
contain it by redirecting the output to the file, like:

$ cat /sys/bus/firewire/devices/fw1/config_rom > rom.img

> Yet another topic is AVC support. We used to have support for it for the
> DICE driver in the 3.x kernel, and we are in the process of re-adapting
> that code.
> But this should be probably discussed in a separate e-mail.
 
Okay. For your information, I write user space program names as
'snd-dice-ctl-service' as the part of 'snd-firewire-ctl-services'[4]. At
present, it has no support for Weiss products[5], so I'm pleased if getting
any help in your side.

[1] https://git.kernel.org/torvalds/c/f3948874c340
[2] https://www.phoronix.com/news/Linux-Firewire-New-Maintainer
[3] https://www.phoronix.com/news/Linux-6.5-Firewire
[4] https://github.com/alsa-project/snd-firewire-ctl-services
[5] https://docs.rs/firewire-dice-protocols/0.2.0/firewire_dice_protocols/


Thanks

Takashi Sakamoto

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

* Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
  2023-07-31 14:06     ` Takashi Sakamoto
@ 2023-08-08  8:34       ` Michele Perrone
  2023-08-08 15:25         ` Takashi Sakamoto
  0 siblings, 1 reply; 13+ messages in thread
From: Michele Perrone @ 2023-08-08  8:34 UTC (permalink / raw)
  To: Takashi Sakamoto
  Cc: alsa-devel, Takashi Iwai, Rolf Anderegg, Isabelle Kernhof

Dear Mr. Sakamoto,

sorry for the late reply.

I was aware of the fact that you maintain the Linux Firewire subsystem,
but I didn't know about the deprecation notice, so thanks for sending it.

So if I understand correctly, 2029 will be the last year when Firewire
functionality is supported by Linux? Does this mean that Firewire
functionality is going to be removed altogether after that?

Back to our devices - our firmware doesn't support TCAT protocol extension
unfortunately. That's why I had to write this patch in the first place:
only 44.1kHz and 48kHz could be selected.

About AVC, I had noticed your 'snd-firewire-ctl-services' project before.
I also compiled it and played with it, but since I was able to re-use our
old kernel-space AVC code with relatively little effort, I am currently
working on that option.
Nevertheless, I would be glad to assist you and making Weiss devices
supported by 'snd-firewire-ctl-services'.
Is there something else that you would need, apart from the configuration
ROMs? And also what is the preferred way for sending you the ROMs? Should
I open a pull request on your 'am-config-roms' repository on GitHub?

Kind regards,
Michele Perrone

On 31/07/23 16:06, Takashi Sakamoto wrote:
> Hi Mr. Michele,
>
> On Mon, Jul 31, 2023 at 10:09:14AM +0200, Michele Perrone wrote:
>> Dear Mr. Sakamoto,
>>
>> thank you very much for the prompt feedback, and also for your
>> contributions to the Linux audio Firewire stack during the last decade.
> Thanks. Nowadays I also maintain Linux FireWire subsystem itself[1][2][3].
>
>> We at Weiss Engineering would like to improve Linux support for our
>> Firewire devices in order to extend their lifetimes. We have also
>> occasionally received requests for Linux compatibility from some
>> customers.
>>
>> This is also motivated by the fact that the old DICE Apple driver, which was
>> originally developed by TCAT, is not maintained anymore and does not work on
>> Apple Silicon computers. Therefore, we would like to give the alternative of
>> running our devices on Linux if the customers decide to do.
> I know that no driver for 1394 OHCI hardware itself is included in recent
> MacOS anymore, regardless of hardware (x86_64/arm64). Your customer has no
> choice when continuing using their Weiss products.
>
>> We are also working on a update for our old music archive network player
>> (MAN301), which uses a DICE chip to interface with its DAC; so it seemed
>> only fair that owners of all Weiss devices based on DICE benefited from
>> this.
> That sounds great... However, let me note that the maintenance of Linux
> FireWire subsystem will be end in 2029, 6 years later (see the first
> reference link).
>
>> Sorry for mistakes 1, 2, and 3 (you can tell it's my first kernel patch).
>> And I indeed forgot to include the snd_dice_detect_weiss_formats() prototype
>> into the patch submittal.
>>
>> About the 4th issue, yes, the 'category_id' is still correct [1].
> Okay. ALSA dice driver has the mechanism to check category_id field
> against known values, while the check is skipped for explicit device
> entries which the patch adds. So this is just from my curiosity
> (I forgot the mechanism in the last message).
>
>> About the 5th issue, you are right both about the wrong tx/rx direction and
>> the absence of isochronous packets from the device. I checked the DICE
>> firmware code for the INT202 and we are indeed sending isochronous packets
>> from
>> the device. Therefore, the correct stream formats should look like this:
>>
>> +/* Weiss INT202: 192kHz unidirectional 2-channel digital Firewire interface
>> */
>> +static const struct dice_weiss_spec int202 = {
>> +    .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
>> +    .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
>> +    .has_midi   = false
>> +};
>>
>> I tested this configuration with XLR and RCA outputs, and it works
>> correctly.
> Good. I revised the patch and force-pushed to the remote repository
> (747ddada9f4f).
>
>> Sorry for the mistake, I don't have a deep knowledge about the old DICE
>> firmware because I've started working at Weiss Engineering only
>> recently.
>   
> You would have more resources about DICE chipset, and get more helps from
> your colleague than me. No worry about it, I guess.
>
> The rest of my concern is that TCAT protocol extension (EAP) support. In
> the extension, software can retrieve all of available stream format
> from the target device without switching mode of transmission frequency.
> If the device supports EAP, we do not necessarily to add hard-coded stream
> formats (please refer to the device entry with
> 'snd_dice_detect_extension_formats()'). I would like you to check
> specification of each Weiss product whether EAP is supported or not.
>
>> About the configuration ROMs, that shouldn't be an issue; let me get
>> back to you as soon as I speak with my colleague, Rolf Anderegg. He has
>> worked on our DICE devices in the past but he's on vacation right now.
> Once connecting device to IEEE 1394 bus, the content of configuration
> ROM is exposed in sysfs node of Linux system. You can make a file to
> contain it by redirecting the output to the file, like:
>
> $ cat /sys/bus/firewire/devices/fw1/config_rom > rom.img
>
>> Yet another topic is AVC support. We used to have support for it for the
>> DICE driver in the 3.x kernel, and we are in the process of re-adapting
>> that code.
>> But this should be probably discussed in a separate e-mail.
>   
> Okay. For your information, I write user space program names as
> 'snd-dice-ctl-service' as the part of 'snd-firewire-ctl-services'[4]. At
> present, it has no support for Weiss products[5], so I'm pleased if getting
> any help in your side.
>
> [1] https://git.kernel.org/torvalds/c/f3948874c340
> [2] https://www.phoronix.com/news/Linux-Firewire-New-Maintainer
> [3] https://www.phoronix.com/news/Linux-6.5-Firewire
> [4] https://github.com/alsa-project/snd-firewire-ctl-services
> [5] https://docs.rs/firewire-dice-protocols/0.2.0/firewire_dice_protocols/
>
>
> Thanks
>
> Takashi Sakamoto

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

* Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
  2023-08-08  8:34       ` Michele Perrone
@ 2023-08-08 15:25         ` Takashi Sakamoto
  0 siblings, 0 replies; 13+ messages in thread
From: Takashi Sakamoto @ 2023-08-08 15:25 UTC (permalink / raw)
  To: Michele Perrone; +Cc: alsa-devel, Takashi Iwai, Rolf Anderegg, Isabelle Kernhof

Hi,

On Tue, Aug 08, 2023 at 10:34:38AM +0200, Michele Perrone wrote:
> Dear Mr. Sakamoto,
> 
> sorry for the late reply.
> 
> I was aware of the fact that you maintain the Linux Firewire subsystem,
> but I didn't know about the deprecation notice, so thanks for sending it.
>
> So if I understand correctly, 2029 will be the last year when Firewire
> functionality is supported by Linux? Does this mean that Firewire
> functionality is going to be removed altogether after that?
 
Let me avoid professing about it, but it is better not to continue using
Linux FireWire subsystem anymore beyond the 3 years migration period.

> Back to our devices - our firmware doesn't support TCAT protocol extension
> unfortunately. That's why I had to write this patch in the first place:
> only 44.1kHz and 48kHz could be selected.
 
Okay. I'll post the revised version of patch to the list, then requests
the maintainer of sound subsystem to apply it to his tree for v6.5-rc6.

> About AVC, I had noticed your 'snd-firewire-ctl-services' project before.
> I also compiled it and played with it, but since I was able to re-use our
> old kernel-space AVC code with relatively little effort, I am currently
> working on that option.
> Nevertheless, I would be glad to assist you and making Weiss devices
> supported by 'snd-firewire-ctl-services'.

As a policy to maintain current ALSA firewire stack, any code for control
function is out of kernel land, thus your AVC function can not to be
merged to Linux upstream as is.

I think the most convenient way is to provide source code for the
AVC function to me. Then I re-implement it by Rust language for
snd-dice-ctl-service program. As long as interpreting original code, we
have no license issue for the new code.

But As a first step, I would like you to assist my support for DICE common
controls in your models. When ALSA dice driver is loaded, it adds an
procfs node to dump information by TCAT general protocol, like:

$ cat /proc/asound/card2/firewire/dice
sections:
  global: offset 10, size 90
  tx: offset 100, size 142
  rx: offset 242, size 282
  ext_sync: offset 524, size 4
  unused2: offset 0, size 0
global:
  owner: ffc1:000100000000
  notification: 00000010
  nick name: DesktopKonnekt6
  clock select: internal 48000
  enable: 0
  status: locked 48000
  ext status: 00000000
  sample rate: 48000
  version: 1.0.4.0
  clock caps: 44100 48000 88200 96000 176400 192000 arx1 arx2 internal
  clock source names: Unused\Unused\Unused\Unused\Unused\Unused\Unused\Unused\Unused\Unused\Unused\Unused\INTERNAL\\
...

I need the `clock caps` and `clock source names` fields to implement the
common controls for your device in snd-firewire-ctl-services.

> Is there something else that you would need, apart from the configuration
> ROMs? And also what is the preferred way for sending you the ROMs? Should
> I open a pull request on your 'am-config-roms' repository on GitHub?

I don't mind which way to use.

In my point of view, we need to decide license under which the file of
configuration ROM image is public. I think CC0[0] is bette for our case.

I'm planning to move the repository under git.kernel.org, and have talked
with admin about it. The admin said that I need to declare the license
of included files. I'm under re-classifying these files and not finished
yet.

So when you contribute the files for your models, please use CC0 by
declaring in commit/request message.

[0] https://creativecommons.org/publicdomain/zero/1.0/


Regards

Takashi Sakamoto

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

* [PATCH] ALSA: dice: add stream format parameters for Weiss devices
@ 2023-08-09  0:26 Takashi Sakamoto
  2023-08-09 14:03 ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Sakamoto @ 2023-08-09  0:26 UTC (permalink / raw)
  To: tiwai; +Cc: alsa-devel, Rolf Anderegg, Michele Perrone

This patch is for kernel prepatch v6.5.

Hard-coded stream format parameters are added for Weiss Engineering
FireWire devices. When the device vendor and model match, the parameters
are copied into the stream format cache. This allows for setting all
supported sampling rates up to 192kHz, and consequently adjusting the
number of available I/O channels.

Signed-off-by: Rolf Anderegg <rolf.anderegg@weiss.ch>
Signed-off-by: Michele Perrone <michele.perrone@weiss.ch>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/dice/Makefile     |   2 +-
 sound/firewire/dice/dice-weiss.c | 104 +++++++++++++++++++++++++++++++
 sound/firewire/dice/dice.c       |  63 +++++++++++++++++++
 sound/firewire/dice/dice.h       |   1 +
 4 files changed, 169 insertions(+), 1 deletion(-)
 create mode 100644 sound/firewire/dice/dice-weiss.c

diff --git a/sound/firewire/dice/Makefile b/sound/firewire/dice/Makefile
index a5f3fbf28b8c..bac8712f9014 100644
--- a/sound/firewire/dice/Makefile
+++ b/sound/firewire/dice/Makefile
@@ -2,5 +2,5 @@
 snd-dice-objs := dice-transaction.o dice-stream.o dice-proc.o dice-midi.o \
 		 dice-pcm.o dice-hwdep.o dice.o dice-tcelectronic.o \
 		 dice-alesis.o dice-extension.o dice-mytek.o dice-presonus.o \
-		 dice-harman.o dice-focusrite.o
+		 dice-harman.o dice-focusrite.o dice-weiss.o
 obj-$(CONFIG_SND_DICE) += snd-dice.o
diff --git a/sound/firewire/dice/dice-weiss.c b/sound/firewire/dice/dice-weiss.c
new file mode 100644
index 000000000000..129d43408956
--- /dev/null
+++ b/sound/firewire/dice/dice-weiss.c
@@ -0,0 +1,104 @@
+// SPDX-License-Identifier: GPL-2.0
+// dice-weiss.c - a part of driver for DICE based devices
+//
+// Copyright (c) 2023 Rolf Anderegg and Michele Perrone
+
+#include "dice.h"
+
+struct dice_weiss_spec {
+	unsigned int tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
+	unsigned int rx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
+};
+
+// Weiss DAC202: 192kHz 2-channel DAC
+static const struct dice_weiss_spec dac202 = {
+	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+};
+
+// Weiss MAN301: 192kHz 2-channel music archive network player
+static const struct dice_weiss_spec man301 = {
+	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+};
+
+// Weiss INT202: 192kHz unidirectional 2-channel digital Firewire nterface
+static const struct dice_weiss_spec int202 = {
+	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+};
+
+// Weiss INT203: 192kHz bidirectional 2-channel digital Firewire nterface
+static const struct dice_weiss_spec int203 = {
+	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+};
+
+// Weiss ADC2: 192kHz A/D converter with microphone preamps and line nputs
+static const struct dice_weiss_spec adc2 = {
+	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+};
+
+// Weiss DAC2/Minerva: 192kHz 2-channel DAC
+static const struct dice_weiss_spec dac2_minerva = {
+	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+};
+
+// Weiss Vesta: 192kHz 2-channel Firewire to AES/EBU interface
+static const struct dice_weiss_spec vesta = {
+	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
+};
+
+// Weiss AFI1: 192kHz 24-channel Firewire to ADAT or AES/EBU interface
+static const struct dice_weiss_spec afi1 = {
+	.tx_pcm_chs = {{24, 16, 8}, {0, 0, 0} },
+	.rx_pcm_chs = {{24, 16, 8}, {0, 0, 0} },
+};
+
+int snd_dice_detect_weiss_formats(struct snd_dice *dice)
+{
+	static const struct {
+		u32 model_id;
+		const struct dice_weiss_spec *spec;
+	} *entry, entries[] = {
+		{0x000007, &dac202},
+		{0x000008, &dac202}, // Maya edition: same audio I/O as DAC202.
+		{0x000006, &int202},
+		{0x00000a, &int203},
+		{0x00000b, &man301},
+		{0x000001, &adc2},
+		{0x000003, &dac2_minerva},
+		{0x000002, &vesta},
+		{0x000004, &afi1},
+	};
+	struct fw_csr_iterator it;
+	int key, val, model_id;
+	int i;
+
+	model_id = 0;
+	fw_csr_iterator_init(&it, dice->unit->directory);
+	while (fw_csr_iterator_next(&it, &key, &val)) {
+		if (key == CSR_MODEL) {
+			model_id = val;
+			break;
+		}
+	}
+
+	for (i = 0; i < ARRAY_SIZE(entries); ++i) {
+		entry = entries + i;
+		if (entry->model_id == model_id)
+			break;
+	}
+	if (i == ARRAY_SIZE(entries))
+		return -ENODEV;
+
+	memcpy(dice->tx_pcm_chs, entry->spec->tx_pcm_chs,
+	       MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
+	memcpy(dice->rx_pcm_chs, entry->spec->rx_pcm_chs,
+	       MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
+
+	return 0;
+}
diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c
index 6c93e6e4982c..d362e4251c68 100644
--- a/sound/firewire/dice/dice.c
+++ b/sound/firewire/dice/dice.c
@@ -392,6 +392,69 @@ static const struct ieee1394_device_id dice_id_table[] = {
 		.model_id	= 0x0000de,
 		.driver_data	= (kernel_ulong_t)snd_dice_detect_focusrite_pro40_tcd3070_formats,
 	},
+	// Weiss DAC202: 192kHz 2-channel DAC
+	{
+		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
+		.vendor_id	= OUI_WEISS,
+		.model_id	= 0x000007,
+		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
+	},
+	// Weiss DAC202: 192kHz 2-channel DAC (Maya edition)
+	{
+		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
+		.vendor_id	= OUI_WEISS,
+		.model_id	= 0x000008,
+		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
+	},
+	// Weiss MAN301: 192kHz 2-channel music archive network player
+	{
+		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
+		.vendor_id	= OUI_WEISS,
+		.model_id	= 0x00000b,
+		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
+	},
+	// Weiss INT202: 192kHz unidirectional 2-channel digital Firewire face
+	{
+		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
+		.vendor_id	= OUI_WEISS,
+		.model_id	= 0x000006,
+		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
+	},
+	// Weiss INT203: 192kHz bidirectional 2-channel digital Firewire face
+	{
+		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
+		.vendor_id	= OUI_WEISS,
+		.model_id	= 0x00000a,
+		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
+	},
+	// Weiss ADC2: 192kHz A/D converter with microphone preamps and inputs
+	{
+		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
+		.vendor_id	= OUI_WEISS,
+		.model_id	= 0x000001,
+		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
+	},
+	// Weiss DAC2/Minerva: 192kHz 2-channel DAC
+	{
+		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
+		.vendor_id	= OUI_WEISS,
+		.model_id	= 0x000003,
+		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
+	},
+	// Weiss Vesta: 192kHz 2-channel Firewire to AES/EBU interface
+	{
+		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
+		.vendor_id	= OUI_WEISS,
+		.model_id	= 0x000002,
+		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
+	},
+	// Weiss AFI1: 192kHz 24-channel Firewire to ADAT or AES/EBU face
+	{
+		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
+		.vendor_id	= OUI_WEISS,
+		.model_id	= 0x000004,
+		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
+	},
 	{
 		.match_flags = IEEE1394_MATCH_VERSION,
 		.version     = DICE_INTERFACE,
diff --git a/sound/firewire/dice/dice.h b/sound/firewire/dice/dice.h
index 674f7d552c2e..4c0ad7335998 100644
--- a/sound/firewire/dice/dice.h
+++ b/sound/firewire/dice/dice.h
@@ -232,5 +232,6 @@ int snd_dice_detect_mytek_formats(struct snd_dice *dice);
 int snd_dice_detect_presonus_formats(struct snd_dice *dice);
 int snd_dice_detect_harman_formats(struct snd_dice *dice);
 int snd_dice_detect_focusrite_pro40_tcd3070_formats(struct snd_dice *dice);
+int snd_dice_detect_weiss_formats(struct snd_dice *dice);
 
 #endif
-- 
2.39.2


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

* Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
  2023-08-09  0:26 [PATCH] ALSA: dice: add stream format parameters for Weiss devices Takashi Sakamoto
@ 2023-08-09 14:03 ` Takashi Iwai
  2023-08-09 14:18   ` Takashi Sakamoto
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2023-08-09 14:03 UTC (permalink / raw)
  To: Takashi Sakamoto; +Cc: alsa-devel, Rolf Anderegg, Michele Perrone

On Wed, 09 Aug 2023 02:26:31 +0200,
Takashi Sakamoto wrote:
> 
> This patch is for kernel prepatch v6.5.

Why it must be included in 6.5?  This sounds more like a new
implementation, rather than an urgent but fix that is needed for rc.


thanks,

Takashi

> Hard-coded stream format parameters are added for Weiss Engineering
> FireWire devices. When the device vendor and model match, the parameters
> are copied into the stream format cache. This allows for setting all
> supported sampling rates up to 192kHz, and consequently adjusting the
> number of available I/O channels.
> 
> Signed-off-by: Rolf Anderegg <rolf.anderegg@weiss.ch>
> Signed-off-by: Michele Perrone <michele.perrone@weiss.ch>
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> ---
>  sound/firewire/dice/Makefile     |   2 +-
>  sound/firewire/dice/dice-weiss.c | 104 +++++++++++++++++++++++++++++++
>  sound/firewire/dice/dice.c       |  63 +++++++++++++++++++
>  sound/firewire/dice/dice.h       |   1 +
>  4 files changed, 169 insertions(+), 1 deletion(-)
>  create mode 100644 sound/firewire/dice/dice-weiss.c
> 
> diff --git a/sound/firewire/dice/Makefile b/sound/firewire/dice/Makefile
> index a5f3fbf28b8c..bac8712f9014 100644
> --- a/sound/firewire/dice/Makefile
> +++ b/sound/firewire/dice/Makefile
> @@ -2,5 +2,5 @@
>  snd-dice-objs := dice-transaction.o dice-stream.o dice-proc.o dice-midi.o \
>  		 dice-pcm.o dice-hwdep.o dice.o dice-tcelectronic.o \
>  		 dice-alesis.o dice-extension.o dice-mytek.o dice-presonus.o \
> -		 dice-harman.o dice-focusrite.o
> +		 dice-harman.o dice-focusrite.o dice-weiss.o
>  obj-$(CONFIG_SND_DICE) += snd-dice.o
> diff --git a/sound/firewire/dice/dice-weiss.c b/sound/firewire/dice/dice-weiss.c
> new file mode 100644
> index 000000000000..129d43408956
> --- /dev/null
> +++ b/sound/firewire/dice/dice-weiss.c
> @@ -0,0 +1,104 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// dice-weiss.c - a part of driver for DICE based devices
> +//
> +// Copyright (c) 2023 Rolf Anderegg and Michele Perrone
> +
> +#include "dice.h"
> +
> +struct dice_weiss_spec {
> +	unsigned int tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
> +	unsigned int rx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
> +};
> +
> +// Weiss DAC202: 192kHz 2-channel DAC
> +static const struct dice_weiss_spec dac202 = {
> +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +};
> +
> +// Weiss MAN301: 192kHz 2-channel music archive network player
> +static const struct dice_weiss_spec man301 = {
> +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +};
> +
> +// Weiss INT202: 192kHz unidirectional 2-channel digital Firewire nterface
> +static const struct dice_weiss_spec int202 = {
> +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +};
> +
> +// Weiss INT203: 192kHz bidirectional 2-channel digital Firewire nterface
> +static const struct dice_weiss_spec int203 = {
> +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +};
> +
> +// Weiss ADC2: 192kHz A/D converter with microphone preamps and line nputs
> +static const struct dice_weiss_spec adc2 = {
> +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +};
> +
> +// Weiss DAC2/Minerva: 192kHz 2-channel DAC
> +static const struct dice_weiss_spec dac2_minerva = {
> +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +};
> +
> +// Weiss Vesta: 192kHz 2-channel Firewire to AES/EBU interface
> +static const struct dice_weiss_spec vesta = {
> +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> +};
> +
> +// Weiss AFI1: 192kHz 24-channel Firewire to ADAT or AES/EBU interface
> +static const struct dice_weiss_spec afi1 = {
> +	.tx_pcm_chs = {{24, 16, 8}, {0, 0, 0} },
> +	.rx_pcm_chs = {{24, 16, 8}, {0, 0, 0} },
> +};
> +
> +int snd_dice_detect_weiss_formats(struct snd_dice *dice)
> +{
> +	static const struct {
> +		u32 model_id;
> +		const struct dice_weiss_spec *spec;
> +	} *entry, entries[] = {
> +		{0x000007, &dac202},
> +		{0x000008, &dac202}, // Maya edition: same audio I/O as DAC202.
> +		{0x000006, &int202},
> +		{0x00000a, &int203},
> +		{0x00000b, &man301},
> +		{0x000001, &adc2},
> +		{0x000003, &dac2_minerva},
> +		{0x000002, &vesta},
> +		{0x000004, &afi1},
> +	};
> +	struct fw_csr_iterator it;
> +	int key, val, model_id;
> +	int i;
> +
> +	model_id = 0;
> +	fw_csr_iterator_init(&it, dice->unit->directory);
> +	while (fw_csr_iterator_next(&it, &key, &val)) {
> +		if (key == CSR_MODEL) {
> +			model_id = val;
> +			break;
> +		}
> +	}
> +
> +	for (i = 0; i < ARRAY_SIZE(entries); ++i) {
> +		entry = entries + i;
> +		if (entry->model_id == model_id)
> +			break;
> +	}
> +	if (i == ARRAY_SIZE(entries))
> +		return -ENODEV;
> +
> +	memcpy(dice->tx_pcm_chs, entry->spec->tx_pcm_chs,
> +	       MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
> +	memcpy(dice->rx_pcm_chs, entry->spec->rx_pcm_chs,
> +	       MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
> +
> +	return 0;
> +}
> diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c
> index 6c93e6e4982c..d362e4251c68 100644
> --- a/sound/firewire/dice/dice.c
> +++ b/sound/firewire/dice/dice.c
> @@ -392,6 +392,69 @@ static const struct ieee1394_device_id dice_id_table[] = {
>  		.model_id	= 0x0000de,
>  		.driver_data	= (kernel_ulong_t)snd_dice_detect_focusrite_pro40_tcd3070_formats,
>  	},
> +	// Weiss DAC202: 192kHz 2-channel DAC
> +	{
> +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> +		.vendor_id	= OUI_WEISS,
> +		.model_id	= 0x000007,
> +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> +	},
> +	// Weiss DAC202: 192kHz 2-channel DAC (Maya edition)
> +	{
> +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> +		.vendor_id	= OUI_WEISS,
> +		.model_id	= 0x000008,
> +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> +	},
> +	// Weiss MAN301: 192kHz 2-channel music archive network player
> +	{
> +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> +		.vendor_id	= OUI_WEISS,
> +		.model_id	= 0x00000b,
> +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> +	},
> +	// Weiss INT202: 192kHz unidirectional 2-channel digital Firewire face
> +	{
> +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> +		.vendor_id	= OUI_WEISS,
> +		.model_id	= 0x000006,
> +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> +	},
> +	// Weiss INT203: 192kHz bidirectional 2-channel digital Firewire face
> +	{
> +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> +		.vendor_id	= OUI_WEISS,
> +		.model_id	= 0x00000a,
> +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> +	},
> +	// Weiss ADC2: 192kHz A/D converter with microphone preamps and inputs
> +	{
> +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> +		.vendor_id	= OUI_WEISS,
> +		.model_id	= 0x000001,
> +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> +	},
> +	// Weiss DAC2/Minerva: 192kHz 2-channel DAC
> +	{
> +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> +		.vendor_id	= OUI_WEISS,
> +		.model_id	= 0x000003,
> +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> +	},
> +	// Weiss Vesta: 192kHz 2-channel Firewire to AES/EBU interface
> +	{
> +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> +		.vendor_id	= OUI_WEISS,
> +		.model_id	= 0x000002,
> +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> +	},
> +	// Weiss AFI1: 192kHz 24-channel Firewire to ADAT or AES/EBU face
> +	{
> +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> +		.vendor_id	= OUI_WEISS,
> +		.model_id	= 0x000004,
> +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> +	},
>  	{
>  		.match_flags = IEEE1394_MATCH_VERSION,
>  		.version     = DICE_INTERFACE,
> diff --git a/sound/firewire/dice/dice.h b/sound/firewire/dice/dice.h
> index 674f7d552c2e..4c0ad7335998 100644
> --- a/sound/firewire/dice/dice.h
> +++ b/sound/firewire/dice/dice.h
> @@ -232,5 +232,6 @@ int snd_dice_detect_mytek_formats(struct snd_dice *dice);
>  int snd_dice_detect_presonus_formats(struct snd_dice *dice);
>  int snd_dice_detect_harman_formats(struct snd_dice *dice);
>  int snd_dice_detect_focusrite_pro40_tcd3070_formats(struct snd_dice *dice);
> +int snd_dice_detect_weiss_formats(struct snd_dice *dice);
>  
>  #endif
> -- 
> 2.39.2
> 

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

* Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
  2023-08-09 14:03 ` Takashi Iwai
@ 2023-08-09 14:18   ` Takashi Sakamoto
  2023-08-09 14:39     ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Sakamoto @ 2023-08-09 14:18 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Rolf Anderegg, Michele Perrone

Hi,

On Wed, Aug 09, 2023 at 04:03:00PM +0200, Takashi Iwai wrote:
> On Wed, 09 Aug 2023 02:26:31 +0200,
> Takashi Sakamoto wrote:
> > 
> > This patch is for kernel prepatch v6.5.
> 
> Why it must be included in 6.5?  This sounds more like a new
> implementation, rather than an urgent but fix that is needed for rc.

Thanks for your notice to the patch. Indeed, it is neither urgent nor
bug fix. It is a kind of 'adding support for new device with slight
change', like adding new entries in mod device table. The overall change
and new lines are quite typical in ALSA dice driver, like TC Electronic
devices in 'sound/firewire/dice/dice-tcelectronic.c'. Things are
prepared and not brand-new.

Precisely, current ALSA dice driver supports the Weiss models already,
while the functionality is limited that the part of sampling transfer
frequencies are available as the initial author said (e.g. when 44.1/48.0
kHz are available, 88.2/96.0 kHz are not, vise versa). The patch extends
the functionality by hard-coding stream formats following to the design
of ALSA dice driver.

Of cource, I don't mind postponing the patch to v6.6 kernel, but in my
point of view, it is worth to v6.5 since users got benefits from the
code which is not so novel.


Thanks

Takashi Sakamoto

> > Hard-coded stream format parameters are added for Weiss Engineering
> > FireWire devices. When the device vendor and model match, the parameters
> > are copied into the stream format cache. This allows for setting all
> > supported sampling rates up to 192kHz, and consequently adjusting the
> > number of available I/O channels.
> > 
> > Signed-off-by: Rolf Anderegg <rolf.anderegg@weiss.ch>
> > Signed-off-by: Michele Perrone <michele.perrone@weiss.ch>
> > Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> > ---
> >  sound/firewire/dice/Makefile     |   2 +-
> >  sound/firewire/dice/dice-weiss.c | 104 +++++++++++++++++++++++++++++++
> >  sound/firewire/dice/dice.c       |  63 +++++++++++++++++++
> >  sound/firewire/dice/dice.h       |   1 +
> >  4 files changed, 169 insertions(+), 1 deletion(-)
> >  create mode 100644 sound/firewire/dice/dice-weiss.c
> > 
> > diff --git a/sound/firewire/dice/Makefile b/sound/firewire/dice/Makefile
> > index a5f3fbf28b8c..bac8712f9014 100644
> > --- a/sound/firewire/dice/Makefile
> > +++ b/sound/firewire/dice/Makefile
> > @@ -2,5 +2,5 @@
> >  snd-dice-objs := dice-transaction.o dice-stream.o dice-proc.o dice-midi.o \
> >  		 dice-pcm.o dice-hwdep.o dice.o dice-tcelectronic.o \
> >  		 dice-alesis.o dice-extension.o dice-mytek.o dice-presonus.o \
> > -		 dice-harman.o dice-focusrite.o
> > +		 dice-harman.o dice-focusrite.o dice-weiss.o
> >  obj-$(CONFIG_SND_DICE) += snd-dice.o
> > diff --git a/sound/firewire/dice/dice-weiss.c b/sound/firewire/dice/dice-weiss.c
> > new file mode 100644
> > index 000000000000..129d43408956
> > --- /dev/null
> > +++ b/sound/firewire/dice/dice-weiss.c
> > @@ -0,0 +1,104 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +// dice-weiss.c - a part of driver for DICE based devices
> > +//
> > +// Copyright (c) 2023 Rolf Anderegg and Michele Perrone
> > +
> > +#include "dice.h"
> > +
> > +struct dice_weiss_spec {
> > +	unsigned int tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
> > +	unsigned int rx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
> > +};
> > +
> > +// Weiss DAC202: 192kHz 2-channel DAC
> > +static const struct dice_weiss_spec dac202 = {
> > +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +};
> > +
> > +// Weiss MAN301: 192kHz 2-channel music archive network player
> > +static const struct dice_weiss_spec man301 = {
> > +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +};
> > +
> > +// Weiss INT202: 192kHz unidirectional 2-channel digital Firewire nterface
> > +static const struct dice_weiss_spec int202 = {
> > +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +};
> > +
> > +// Weiss INT203: 192kHz bidirectional 2-channel digital Firewire nterface
> > +static const struct dice_weiss_spec int203 = {
> > +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +};
> > +
> > +// Weiss ADC2: 192kHz A/D converter with microphone preamps and line nputs
> > +static const struct dice_weiss_spec adc2 = {
> > +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +};
> > +
> > +// Weiss DAC2/Minerva: 192kHz 2-channel DAC
> > +static const struct dice_weiss_spec dac2_minerva = {
> > +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +};
> > +
> > +// Weiss Vesta: 192kHz 2-channel Firewire to AES/EBU interface
> > +static const struct dice_weiss_spec vesta = {
> > +	.tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +	.rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
> > +};
> > +
> > +// Weiss AFI1: 192kHz 24-channel Firewire to ADAT or AES/EBU interface
> > +static const struct dice_weiss_spec afi1 = {
> > +	.tx_pcm_chs = {{24, 16, 8}, {0, 0, 0} },
> > +	.rx_pcm_chs = {{24, 16, 8}, {0, 0, 0} },
> > +};
> > +
> > +int snd_dice_detect_weiss_formats(struct snd_dice *dice)
> > +{
> > +	static const struct {
> > +		u32 model_id;
> > +		const struct dice_weiss_spec *spec;
> > +	} *entry, entries[] = {
> > +		{0x000007, &dac202},
> > +		{0x000008, &dac202}, // Maya edition: same audio I/O as DAC202.
> > +		{0x000006, &int202},
> > +		{0x00000a, &int203},
> > +		{0x00000b, &man301},
> > +		{0x000001, &adc2},
> > +		{0x000003, &dac2_minerva},
> > +		{0x000002, &vesta},
> > +		{0x000004, &afi1},
> > +	};
> > +	struct fw_csr_iterator it;
> > +	int key, val, model_id;
> > +	int i;
> > +
> > +	model_id = 0;
> > +	fw_csr_iterator_init(&it, dice->unit->directory);
> > +	while (fw_csr_iterator_next(&it, &key, &val)) {
> > +		if (key == CSR_MODEL) {
> > +			model_id = val;
> > +			break;
> > +		}
> > +	}
> > +
> > +	for (i = 0; i < ARRAY_SIZE(entries); ++i) {
> > +		entry = entries + i;
> > +		if (entry->model_id == model_id)
> > +			break;
> > +	}
> > +	if (i == ARRAY_SIZE(entries))
> > +		return -ENODEV;
> > +
> > +	memcpy(dice->tx_pcm_chs, entry->spec->tx_pcm_chs,
> > +	       MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
> > +	memcpy(dice->rx_pcm_chs, entry->spec->rx_pcm_chs,
> > +	       MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
> > +
> > +	return 0;
> > +}
> > diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c
> > index 6c93e6e4982c..d362e4251c68 100644
> > --- a/sound/firewire/dice/dice.c
> > +++ b/sound/firewire/dice/dice.c
> > @@ -392,6 +392,69 @@ static const struct ieee1394_device_id dice_id_table[] = {
> >  		.model_id	= 0x0000de,
> >  		.driver_data	= (kernel_ulong_t)snd_dice_detect_focusrite_pro40_tcd3070_formats,
> >  	},
> > +	// Weiss DAC202: 192kHz 2-channel DAC
> > +	{
> > +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> > +		.vendor_id	= OUI_WEISS,
> > +		.model_id	= 0x000007,
> > +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> > +	},
> > +	// Weiss DAC202: 192kHz 2-channel DAC (Maya edition)
> > +	{
> > +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> > +		.vendor_id	= OUI_WEISS,
> > +		.model_id	= 0x000008,
> > +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> > +	},
> > +	// Weiss MAN301: 192kHz 2-channel music archive network player
> > +	{
> > +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> > +		.vendor_id	= OUI_WEISS,
> > +		.model_id	= 0x00000b,
> > +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> > +	},
> > +	// Weiss INT202: 192kHz unidirectional 2-channel digital Firewire face
> > +	{
> > +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> > +		.vendor_id	= OUI_WEISS,
> > +		.model_id	= 0x000006,
> > +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> > +	},
> > +	// Weiss INT203: 192kHz bidirectional 2-channel digital Firewire face
> > +	{
> > +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> > +		.vendor_id	= OUI_WEISS,
> > +		.model_id	= 0x00000a,
> > +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> > +	},
> > +	// Weiss ADC2: 192kHz A/D converter with microphone preamps and inputs
> > +	{
> > +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> > +		.vendor_id	= OUI_WEISS,
> > +		.model_id	= 0x000001,
> > +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> > +	},
> > +	// Weiss DAC2/Minerva: 192kHz 2-channel DAC
> > +	{
> > +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> > +		.vendor_id	= OUI_WEISS,
> > +		.model_id	= 0x000003,
> > +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> > +	},
> > +	// Weiss Vesta: 192kHz 2-channel Firewire to AES/EBU interface
> > +	{
> > +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> > +		.vendor_id	= OUI_WEISS,
> > +		.model_id	= 0x000002,
> > +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> > +	},
> > +	// Weiss AFI1: 192kHz 24-channel Firewire to ADAT or AES/EBU face
> > +	{
> > +		.match_flags	= IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID,
> > +		.vendor_id	= OUI_WEISS,
> > +		.model_id	= 0x000004,
> > +		.driver_data	= (kernel_ulong_t)snd_dice_detect_weiss_formats,
> > +	},
> >  	{
> >  		.match_flags = IEEE1394_MATCH_VERSION,
> >  		.version     = DICE_INTERFACE,
> > diff --git a/sound/firewire/dice/dice.h b/sound/firewire/dice/dice.h
> > index 674f7d552c2e..4c0ad7335998 100644
> > --- a/sound/firewire/dice/dice.h
> > +++ b/sound/firewire/dice/dice.h
> > @@ -232,5 +232,6 @@ int snd_dice_detect_mytek_formats(struct snd_dice *dice);
> >  int snd_dice_detect_presonus_formats(struct snd_dice *dice);
> >  int snd_dice_detect_harman_formats(struct snd_dice *dice);
> >  int snd_dice_detect_focusrite_pro40_tcd3070_formats(struct snd_dice *dice);
> > +int snd_dice_detect_weiss_formats(struct snd_dice *dice);
> >  
> >  #endif
> > -- 
> > 2.39.2
> > 

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

* Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
  2023-08-09 14:18   ` Takashi Sakamoto
@ 2023-08-09 14:39     ` Takashi Iwai
  2023-08-09 22:57       ` Takashi Sakamoto
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2023-08-09 14:39 UTC (permalink / raw)
  To: Takashi Sakamoto; +Cc: alsa-devel, Rolf Anderegg, Michele Perrone

On Wed, 09 Aug 2023 16:18:54 +0200,
Takashi Sakamoto wrote:
> 
> Hi,
> 
> On Wed, Aug 09, 2023 at 04:03:00PM +0200, Takashi Iwai wrote:
> > On Wed, 09 Aug 2023 02:26:31 +0200,
> > Takashi Sakamoto wrote:
> > > 
> > > This patch is for kernel prepatch v6.5.
> > 
> > Why it must be included in 6.5?  This sounds more like a new
> > implementation, rather than an urgent but fix that is needed for rc.
> 
> Thanks for your notice to the patch. Indeed, it is neither urgent nor
> bug fix. It is a kind of 'adding support for new device with slight
> change', like adding new entries in mod device table. The overall change
> and new lines are quite typical in ALSA dice driver, like TC Electronic
> devices in 'sound/firewire/dice/dice-tcelectronic.c'. Things are
> prepared and not brand-new.
> 
> Precisely, current ALSA dice driver supports the Weiss models already,
> while the functionality is limited that the part of sampling transfer
> frequencies are available as the initial author said (e.g. when 44.1/48.0
> kHz are available, 88.2/96.0 kHz are not, vise versa). The patch extends
> the functionality by hard-coding stream formats following to the design
> of ALSA dice driver.
> 
> Of cource, I don't mind postponing the patch to v6.6 kernel, but in my
> point of view, it is worth to v6.5 since users got benefits from the
> code which is not so novel.

OK, then I'd rather put it to 6.6.
If it were for rc2, I could take it.  But it's already in a second
half turn, and I'd rather like to limit the changes for later rcs.


Takashi

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

* Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
  2023-08-09 14:39     ` Takashi Iwai
@ 2023-08-09 22:57       ` Takashi Sakamoto
  2023-08-10  6:36         ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Sakamoto @ 2023-08-09 22:57 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Rolf Anderegg, Michele Perrone

On Wed, Aug 09, 2023 at 04:39:55PM +0200, Takashi Iwai wrote:
> On Wed, 09 Aug 2023 16:18:54 +0200,
> Takashi Sakamoto wrote:
> > 
> > Hi,
> > 
> > On Wed, Aug 09, 2023 at 04:03:00PM +0200, Takashi Iwai wrote:
> > > On Wed, 09 Aug 2023 02:26:31 +0200,
> > > Takashi Sakamoto wrote:
> > > > 
> > > > This patch is for kernel prepatch v6.5.
> > > 
> > > Why it must be included in 6.5?  This sounds more like a new
> > > implementation, rather than an urgent but fix that is needed for rc.
> > 
> > Thanks for your notice to the patch. Indeed, it is neither urgent nor
> > bug fix. It is a kind of 'adding support for new device with slight
> > change', like adding new entries in mod device table. The overall change
> > and new lines are quite typical in ALSA dice driver, like TC Electronic
> > devices in 'sound/firewire/dice/dice-tcelectronic.c'. Things are
> > prepared and not brand-new.
> > 
> > Precisely, current ALSA dice driver supports the Weiss models already,
> > while the functionality is limited that the part of sampling transfer
> > frequencies are available as the initial author said (e.g. when 44.1/48.0
> > kHz are available, 88.2/96.0 kHz are not, vise versa). The patch extends
> > the functionality by hard-coding stream formats following to the design
> > of ALSA dice driver.
> > 
> > Of cource, I don't mind postponing the patch to v6.6 kernel, but in my
> > point of view, it is worth to v6.5 since users got benefits from the
> > code which is not so novel.
> 
> OK, then I'd rather put it to 6.6.
> If it were for rc2, I could take it.  But it's already in a second
> half turn, and I'd rather like to limit the changes for later rcs.

It sounds reasonable. So should I post the patch on your for-next branch?


Thanks

Takashi Sakamoto

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

* Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
  2023-08-09 22:57       ` Takashi Sakamoto
@ 2023-08-10  6:36         ` Takashi Iwai
  2023-08-10 11:06           ` Takashi Sakamoto
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2023-08-10  6:36 UTC (permalink / raw)
  To: Takashi Sakamoto; +Cc: alsa-devel, Rolf Anderegg, Michele Perrone

On Thu, 10 Aug 2023 00:57:22 +0200,
Takashi Sakamoto wrote:
> 
> On Wed, Aug 09, 2023 at 04:39:55PM +0200, Takashi Iwai wrote:
> > On Wed, 09 Aug 2023 16:18:54 +0200,
> > Takashi Sakamoto wrote:
> > > 
> > > Hi,
> > > 
> > > On Wed, Aug 09, 2023 at 04:03:00PM +0200, Takashi Iwai wrote:
> > > > On Wed, 09 Aug 2023 02:26:31 +0200,
> > > > Takashi Sakamoto wrote:
> > > > > 
> > > > > This patch is for kernel prepatch v6.5.
> > > > 
> > > > Why it must be included in 6.5?  This sounds more like a new
> > > > implementation, rather than an urgent but fix that is needed for rc.
> > > 
> > > Thanks for your notice to the patch. Indeed, it is neither urgent nor
> > > bug fix. It is a kind of 'adding support for new device with slight
> > > change', like adding new entries in mod device table. The overall change
> > > and new lines are quite typical in ALSA dice driver, like TC Electronic
> > > devices in 'sound/firewire/dice/dice-tcelectronic.c'. Things are
> > > prepared and not brand-new.
> > > 
> > > Precisely, current ALSA dice driver supports the Weiss models already,
> > > while the functionality is limited that the part of sampling transfer
> > > frequencies are available as the initial author said (e.g. when 44.1/48.0
> > > kHz are available, 88.2/96.0 kHz are not, vise versa). The patch extends
> > > the functionality by hard-coding stream formats following to the design
> > > of ALSA dice driver.
> > > 
> > > Of cource, I don't mind postponing the patch to v6.6 kernel, but in my
> > > point of view, it is worth to v6.5 since users got benefits from the
> > > code which is not so novel.
> > 
> > OK, then I'd rather put it to 6.6.
> > If it were for rc2, I could take it.  But it's already in a second
> > half turn, and I'd rather like to limit the changes for later rcs.
> 
> It sounds reasonable. So should I post the patch on your for-next branch?

No need for that, the patch itself is applicable cleanly.
I just need to drop the commit log line indicating 6.5-rc.


thanks,

Takashi

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

* Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
  2023-08-10  6:36         ` Takashi Iwai
@ 2023-08-10 11:06           ` Takashi Sakamoto
  0 siblings, 0 replies; 13+ messages in thread
From: Takashi Sakamoto @ 2023-08-10 11:06 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Rolf Anderegg, Michele Perrone

On Thu, Aug 10, 2023 at 08:36:20AM +0200, Takashi Iwai wrote:
> On Thu, 10 Aug 2023 00:57:22 +0200,
> Takashi Sakamoto wrote:
> > 
> > On Wed, Aug 09, 2023 at 04:39:55PM +0200, Takashi Iwai wrote:
> > > On Wed, 09 Aug 2023 16:18:54 +0200,
> > > Takashi Sakamoto wrote:
> > > > 
> > > > Hi,
> > > > 
> > > > On Wed, Aug 09, 2023 at 04:03:00PM +0200, Takashi Iwai wrote:
> > > > > On Wed, 09 Aug 2023 02:26:31 +0200,
> > > > > Takashi Sakamoto wrote:
> > > > > > 
> > > > > > This patch is for kernel prepatch v6.5.
> > > > > 
> > > > > Why it must be included in 6.5?  This sounds more like a new
> > > > > implementation, rather than an urgent but fix that is needed for rc.
> > > > 
> > > > Thanks for your notice to the patch. Indeed, it is neither urgent nor
> > > > bug fix. It is a kind of 'adding support for new device with slight
> > > > change', like adding new entries in mod device table. The overall change
> > > > and new lines are quite typical in ALSA dice driver, like TC Electronic
> > > > devices in 'sound/firewire/dice/dice-tcelectronic.c'. Things are
> > > > prepared and not brand-new.
> > > > 
> > > > Precisely, current ALSA dice driver supports the Weiss models already,
> > > > while the functionality is limited that the part of sampling transfer
> > > > frequencies are available as the initial author said (e.g. when 44.1/48.0
> > > > kHz are available, 88.2/96.0 kHz are not, vise versa). The patch extends
> > > > the functionality by hard-coding stream formats following to the design
> > > > of ALSA dice driver.
> > > > 
> > > > Of cource, I don't mind postponing the patch to v6.6 kernel, but in my
> > > > point of view, it is worth to v6.5 since users got benefits from the
> > > > code which is not so novel.
> > > 
> > > OK, then I'd rather put it to 6.6.
> > > If it were for rc2, I could take it.  But it's already in a second
> > > half turn, and I'd rather like to limit the changes for later rcs.
> > 
> > It sounds reasonable. So should I post the patch on your for-next branch?
> 
> No need for that, the patch itself is applicable cleanly.
> I just need to drop the commit log line indicating 6.5-rc.

Okay, thank you for your application to for-next branch.

(I see no log in public sound.git tree yet, while I guess that it is in
your local tree. It is the reason to ask you in the previous message.)


Thanks

Takashi Sakamoto

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

end of thread, other threads:[~2023-08-10 11:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-09  0:26 [PATCH] ALSA: dice: add stream format parameters for Weiss devices Takashi Sakamoto
2023-08-09 14:03 ` Takashi Iwai
2023-08-09 14:18   ` Takashi Sakamoto
2023-08-09 14:39     ` Takashi Iwai
2023-08-09 22:57       ` Takashi Sakamoto
2023-08-10  6:36         ` Takashi Iwai
2023-08-10 11:06           ` Takashi Sakamoto
  -- strict thread matches above, loose matches on Subject: below --
2023-07-28  9:16 Michele Perrone
2023-07-28 13:13 ` Takashi Sakamoto
2023-07-31  8:09   ` Michele Perrone
2023-07-31 14:06     ` Takashi Sakamoto
2023-08-08  8:34       ` Michele Perrone
2023-08-08 15:25         ` Takashi Sakamoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).