ALSA: firewire-tascam: add a structure for model-dependent parameters.
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Thu, 1 Oct 2015 13:02:12 +0000 (22:02 +0900)
committerTakashi Iwai <tiwai@suse.de>
Fri, 2 Oct 2015 16:17:00 +0000 (18:17 +0200)
TASCAM FireWire series doesn't tell drivers their capabilities, thus
the drivers should have model-dependent parameters and apply it to
detected devices.

This commit adds a structure to represent such parameters.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/tascam/tascam.c
sound/firewire/tascam/tascam.h

index 9f2d2a33f58ab2dc713d7aa41bf68b14b9168e7a..9ac09cbb3b05b9603a4f6b879fdca1e3fe245298 100644 (file)
@@ -12,6 +12,39 @@ MODULE_DESCRIPTION("TASCAM FireWire series Driver");
 MODULE_AUTHOR("Takashi Sakamoto <o-takashi@sakamocchi.jp>");
 MODULE_LICENSE("GPL v2");
 
+static struct snd_tscm_spec model_specs[] = {
+       {
+               .name = "FW-1884",
+               .has_adat = true,
+               .has_spdif = true,
+               .pcm_capture_analog_channels = 8,
+               .pcm_playback_analog_channels = 8,
+               .midi_capture_ports = 4,
+               .midi_playback_ports = 4,
+               .is_controller = true,
+       },
+       {
+               .name = "FW-1804",
+               .has_adat = true,
+               .has_spdif = true,
+               .pcm_capture_analog_channels = 8,
+               .pcm_playback_analog_channels = 2,
+               .midi_capture_ports = 2,
+               .midi_playback_ports = 4,
+               .is_controller = false,
+       },
+       {
+               .name = "FW-1082",
+               .has_adat = false,
+               .has_spdif = true,
+               .pcm_capture_analog_channels = 8,
+               .pcm_playback_analog_channels = 2,
+               .midi_capture_ports = 2,
+               .midi_playback_ports = 2,
+               .is_controller = true,
+       },
+};
+
 static int check_name(struct snd_tscm *tscm)
 {
        struct fw_device *fw_dev = fw_parent_device(tscm->unit);
@@ -72,6 +105,7 @@ static int snd_tscm_probe(struct fw_unit *unit,
        tscm = card->private_data;
        tscm->card = card;
        tscm->unit = fw_unit_get(unit);
+       tscm->spec = (const struct snd_tscm_spec *)entry->driver_data;
 
        mutex_init(&tscm->mutex);
 
@@ -113,6 +147,7 @@ static const struct ieee1394_device_id snd_tscm_id_table[] = {
                .vendor_id = 0x00022e,
                .specifier_id = 0x00022e,
                .version = 0x800003,
+               .driver_data = (kernel_ulong_t)&model_specs[2],
        },
        /* FW-1884 */
        {
@@ -122,6 +157,7 @@ static const struct ieee1394_device_id snd_tscm_id_table[] = {
                .vendor_id = 0x00022e,
                .specifier_id = 0x00022e,
                .version = 0x800000,
+               .driver_data = (kernel_ulong_t)&model_specs[0],
        },
        /* FW-1804 mey be supported if IDs are clear. */
        /* FE-08 requires reverse-engineering because it just has faders. */
index d2f4f67cf636e32cf2656cd29e68bace0d4f94ce..e12f8b55b8cd0c11095224a6b6db0fd0d2b83271 100644 (file)
 
 #include "../lib.h"
 
+struct snd_tscm_spec {
+       const char *const name;
+       bool has_adat;
+       bool has_spdif;
+       unsigned int pcm_capture_analog_channels;
+       unsigned int pcm_playback_analog_channels;
+       unsigned int midi_capture_ports;
+       unsigned int midi_playback_ports;
+       bool is_controller;
+};
+
 struct snd_tscm {
        struct snd_card *card;
        struct fw_unit *unit;
 
        struct mutex mutex;
+
+       const struct snd_tscm_spec *spec;
 };
 
 #endif