162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * dice-mytek.c - a part of driver for DICE based devices
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2018 Melvin Vermeeren
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include "dice.h"
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cistruct dice_mytek_spec {
1162306a36Sopenharmony_ci	unsigned int tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
1262306a36Sopenharmony_ci	unsigned int rx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
1362306a36Sopenharmony_ci};
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistatic const struct dice_mytek_spec stereo_192_dsd_dac = {
1662306a36Sopenharmony_ci	/* AES, TOSLINK, SPDIF, ADAT inputs on device */
1762306a36Sopenharmony_ci	.tx_pcm_chs = {{8, 8, 8}, {0, 0, 0} },
1862306a36Sopenharmony_ci	/* PCM 44.1-192, native DSD64/DSD128 to device */
1962306a36Sopenharmony_ci	.rx_pcm_chs = {{4, 4, 4}, {0, 0, 0} }
2062306a36Sopenharmony_ci};
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/*
2362306a36Sopenharmony_ci * Mytek has a few other firewire-capable devices, though newer models appear
2462306a36Sopenharmony_ci * to lack the port more often than not. As I don't have access to any of them
2562306a36Sopenharmony_ci * they are missing here. An example is the Mytek 8x192 ADDA, which is DICE.
2662306a36Sopenharmony_ci */
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciint snd_dice_detect_mytek_formats(struct snd_dice *dice)
2962306a36Sopenharmony_ci{
3062306a36Sopenharmony_ci	int i;
3162306a36Sopenharmony_ci	const struct dice_mytek_spec *dev;
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci	dev = &stereo_192_dsd_dac;
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci	memcpy(dice->tx_pcm_chs, dev->tx_pcm_chs,
3662306a36Sopenharmony_ci	       MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
3762306a36Sopenharmony_ci	memcpy(dice->rx_pcm_chs, dev->rx_pcm_chs,
3862306a36Sopenharmony_ci	       MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci	for (i = 0; i < MAX_STREAMS; ++i) {
4162306a36Sopenharmony_ci		dice->tx_midi_ports[i] = 0;
4262306a36Sopenharmony_ci		dice->rx_midi_ports[i] = 0;
4362306a36Sopenharmony_ci	}
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci	return 0;
4662306a36Sopenharmony_ci}
47