All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: alsa-devel@alsa-project.org,
	Rolf Anderegg <rolf.anderegg@weiss.ch>,
	Michele Perrone <michele.perrone@weiss.ch>
Subject: Re: [PATCH] ALSA: dice: add stream format parameters for Weiss devices
Date: Wed, 09 Aug 2023 16:03:00 +0200	[thread overview]
Message-ID: <87msz0e2jv.wl-tiwai@suse.de> (raw)
In-Reply-To: <20230809002631.750120-1-o-takashi@sakamocchi.jp>

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
> 

  reply	other threads:[~2023-08-09 14:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09  0:26 [PATCH] ALSA: dice: add stream format parameters for Weiss devices Takashi Sakamoto
2023-08-09 14:03 ` Takashi Iwai [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msz0e2jv.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=michele.perrone@weiss.ch \
    --cc=o-takashi@sakamocchi.jp \
    --cc=rolf.anderegg@weiss.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.