diff options
-rw-r--r-- | sound/firewire/Kconfig | 6 | ||||
-rw-r--r-- | sound/firewire/Makefile | 1 | ||||
-rw-r--r-- | sound/firewire/fireface/Makefile | 2 | ||||
-rw-r--r-- | sound/firewire/fireface/ff.c | 113 | ||||
-rw-r--r-- | sound/firewire/fireface/ff.h | 28 |
5 files changed, 150 insertions, 0 deletions
diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig index 6acfacf75daf..b75a82288f74 100644 --- a/sound/firewire/Kconfig +++ b/sound/firewire/Kconfig | |||
@@ -152,4 +152,10 @@ config SND_FIREWIRE_MOTU | |||
152 | To compile this driver as a module, choose M here: the module | 152 | To compile this driver as a module, choose M here: the module |
153 | will be called snd-firewire-motu. | 153 | will be called snd-firewire-motu. |
154 | 154 | ||
155 | config SND_FIREFACE | ||
156 | tristate "RME Fireface series support" | ||
157 | select SND_FIREWIRE_LIB | ||
158 | help | ||
159 | Say Y here to include support for RME fireface series. | ||
160 | |||
155 | endif # SND_FIREWIRE | 161 | endif # SND_FIREWIRE |
diff --git a/sound/firewire/Makefile b/sound/firewire/Makefile index 9388ded69468..1b98fa3fa3d4 100644 --- a/sound/firewire/Makefile +++ b/sound/firewire/Makefile | |||
@@ -14,3 +14,4 @@ obj-$(CONFIG_SND_BEBOB) += bebob/ | |||
14 | obj-$(CONFIG_SND_FIREWIRE_DIGI00X) += digi00x/ | 14 | obj-$(CONFIG_SND_FIREWIRE_DIGI00X) += digi00x/ |
15 | obj-$(CONFIG_SND_FIREWIRE_TASCAM) += tascam/ | 15 | obj-$(CONFIG_SND_FIREWIRE_TASCAM) += tascam/ |
16 | obj-$(CONFIG_SND_FIREWIRE_MOTU) += motu/ | 16 | obj-$(CONFIG_SND_FIREWIRE_MOTU) += motu/ |
17 | obj-$(CONFIG_SND_FIREFACE) += fireface/ | ||
diff --git a/sound/firewire/fireface/Makefile b/sound/firewire/fireface/Makefile new file mode 100644 index 000000000000..2c64ef6efacb --- /dev/null +++ b/sound/firewire/fireface/Makefile | |||
@@ -0,0 +1,2 @@ | |||
1 | snd-fireface-objs := ff.o | ||
2 | obj-$(CONFIG_SND_FIREFACE) += snd-fireface.o | ||
diff --git a/sound/firewire/fireface/ff.c b/sound/firewire/fireface/ff.c new file mode 100644 index 000000000000..358bba23deeb --- /dev/null +++ b/sound/firewire/fireface/ff.c | |||
@@ -0,0 +1,113 @@ | |||
1 | /* | ||
2 | * ff.c - a part of driver for RME Fireface series | ||
3 | * | ||
4 | * Copyright (c) 2015-2017 Takashi Sakamoto | ||
5 | * | ||
6 | * Licensed under the terms of the GNU General Public License, version 2. | ||
7 | */ | ||
8 | |||
9 | #include "ff.h" | ||
10 | |||
11 | #define OUI_RME 0x000a35 | ||
12 | |||
13 | MODULE_DESCRIPTION("RME Fireface series Driver"); | ||
14 | MODULE_AUTHOR("Takashi Sakamoto <o-takashi@sakamocchi.jp>"); | ||
15 | MODULE_LICENSE("GPL v2"); | ||
16 | |||
17 | static void name_card(struct snd_ff *ff) | ||
18 | { | ||
19 | struct fw_device *fw_dev = fw_parent_device(ff->unit); | ||
20 | const char *const model = "Fireface Skeleton"; | ||
21 | |||
22 | strcpy(ff->card->driver, "Fireface"); | ||
23 | strcpy(ff->card->shortname, model); | ||
24 | strcpy(ff->card->mixername, model); | ||
25 | snprintf(ff->card->longname, sizeof(ff->card->longname), | ||
26 | "RME %s, GUID %08x%08x at %s, S%d", model, | ||
27 | fw_dev->config_rom[3], fw_dev->config_rom[4], | ||
28 | dev_name(&ff->unit->device), 100 << fw_dev->max_speed); | ||
29 | } | ||
30 | |||
31 | static void ff_card_free(struct snd_card *card) | ||
32 | { | ||
33 | struct snd_ff *ff = card->private_data; | ||
34 | |||
35 | fw_unit_put(ff->unit); | ||
36 | |||
37 | mutex_destroy(&ff->mutex); | ||
38 | } | ||
39 | |||
40 | static int snd_ff_probe(struct fw_unit *unit, | ||
41 | const struct ieee1394_device_id *entry) | ||
42 | { | ||
43 | struct snd_card *card; | ||
44 | struct snd_ff *ff; | ||
45 | int err; | ||
46 | |||
47 | err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE, | ||
48 | sizeof(struct snd_ff), &card); | ||
49 | if (err < 0) | ||
50 | return err; | ||
51 | card->private_free = ff_card_free; | ||
52 | |||
53 | /* initialize myself */ | ||
54 | ff = card->private_data; | ||
55 | ff->card = card; | ||
56 | ff->unit = fw_unit_get(unit); | ||
57 | dev_set_drvdata(&unit->device, ff); | ||
58 | |||
59 | mutex_init(&ff->mutex); | ||
60 | |||
61 | name_card(ff); | ||
62 | |||
63 | err = snd_card_register(card); | ||
64 | if (err < 0) { | ||
65 | snd_card_free(card); | ||
66 | return err; | ||
67 | } | ||
68 | |||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | static void snd_ff_update(struct fw_unit *unit) | ||
73 | { | ||
74 | return; | ||
75 | } | ||
76 | |||
77 | static void snd_ff_remove(struct fw_unit *unit) | ||
78 | { | ||
79 | struct snd_ff *ff = dev_get_drvdata(&unit->device); | ||
80 | |||
81 | /* No need to wait for releasing card object in this context. */ | ||
82 | snd_card_free_when_closed(ff->card); | ||
83 | } | ||
84 | |||
85 | static const struct ieee1394_device_id snd_ff_id_table[] = { | ||
86 | {} | ||
87 | }; | ||
88 | MODULE_DEVICE_TABLE(ieee1394, snd_ff_id_table); | ||
89 | |||
90 | static struct fw_driver ff_driver = { | ||
91 | .driver = { | ||
92 | .owner = THIS_MODULE, | ||
93 | .name = "snd-fireface", | ||
94 | .bus = &fw_bus_type, | ||
95 | }, | ||
96 | .probe = snd_ff_probe, | ||
97 | .update = snd_ff_update, | ||
98 | .remove = snd_ff_remove, | ||
99 | .id_table = snd_ff_id_table, | ||
100 | }; | ||
101 | |||
102 | static int __init snd_ff_init(void) | ||
103 | { | ||
104 | return driver_register(&ff_driver.driver); | ||
105 | } | ||
106 | |||
107 | static void __exit snd_ff_exit(void) | ||
108 | { | ||
109 | driver_unregister(&ff_driver.driver); | ||
110 | } | ||
111 | |||
112 | module_init(snd_ff_init); | ||
113 | module_exit(snd_ff_exit); | ||
diff --git a/sound/firewire/fireface/ff.h b/sound/firewire/fireface/ff.h new file mode 100644 index 000000000000..64d488ec8264 --- /dev/null +++ b/sound/firewire/fireface/ff.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * ff.h - a part of driver for RME Fireface series | ||
3 | * | ||
4 | * Copyright (c) 2015-2017 Takashi Sakamoto | ||
5 | * | ||
6 | * Licensed under the terms of the GNU General Public License, version 2. | ||
7 | */ | ||
8 | |||
9 | #ifndef SOUND_FIREFACE_H_INCLUDED | ||
10 | #define SOUND_FIREFACE_H_INCLUDED | ||
11 | |||
12 | #include <linux/device.h> | ||
13 | #include <linux/firewire.h> | ||
14 | #include <linux/firewire-constants.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/mod_devicetable.h> | ||
17 | #include <linux/mutex.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/compat.h> | ||
20 | |||
21 | #include <sound/core.h> | ||
22 | |||
23 | struct snd_ff { | ||
24 | struct snd_card *card; | ||
25 | struct fw_unit *unit; | ||
26 | struct mutex mutex; | ||
27 | }; | ||
28 | #endif | ||