aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-04-25 09:45:00 -0400
committerTakashi Iwai <tiwai@suse.de>2014-05-26 08:23:36 -0400
commitb5b04336015e76eb52ffc188e16c9cee01821c7c (patch)
tree2d916b5061735b45c26edabb09b53e2aadec4ef4
parent1017abed18ae7087e7f3e256c48421d09d83176e (diff)
ALSA: fireworks: Add skelton for Fireworks based devices
This commit adds a new driver for devices based on Fireworks. This driver just creates/removes card instance according to callbacks. Fireworks is a board module which Echo Audio produced. This module consists of three chipsets: - Communication chipset for IEEE1394 PHY/Link and IEC 61883-1/6 - DSP or/and FPGA for signal processing - Flash Memory to store firmwares Current supported devices: - Mackie Onyx 400F/1200F - Echo AudioFire12/8(until 2009 July) - Echo AudioFire2/4/Pre8/8(since 2009 July) - Echo Fireworks 8/HDMI - Gibson Robot Interface pack/GoldTop Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/firewire/Kconfig14
-rw-r--r--sound/firewire/Makefile1
-rw-r--r--sound/firewire/fireworks/Makefile2
-rw-r--r--sound/firewire/fireworks/fireworks.c182
-rw-r--r--sound/firewire/fireworks/fireworks.h41
5 files changed, 240 insertions, 0 deletions
diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig
index b3e274fe4a77..8cd4f1f940b0 100644
--- a/sound/firewire/Kconfig
+++ b/sound/firewire/Kconfig
@@ -61,4 +61,18 @@ config SND_SCS1X
61 To compile this driver as a module, choose M here: the module 61 To compile this driver as a module, choose M here: the module
62 will be called snd-scs1x. 62 will be called snd-scs1x.
63 63
64config SND_FIREWORKS
65 tristate "Echo Fireworks board module support"
66 help
67 Say Y here to include support for FireWire devices based
68 on Echo Digital Audio Fireworks board:
69 * Mackie Onyx 400F/1200F
70 * Echo AudioFire12/8(until 2009 July)
71 * Echo AudioFire2/4/Pre8/8(since 2009 July)
72 * Echo Fireworks 8/HDMI
73 * Gibson Robot Interface Pack/GoldTop
74
75 To compile this driver as a module, choose M here: the module
76 will be called snd-fireworks.
77
64endif # SND_FIREWIRE 78endif # SND_FIREWIRE
diff --git a/sound/firewire/Makefile b/sound/firewire/Makefile
index 509955061d30..5cd39dce037f 100644
--- a/sound/firewire/Makefile
+++ b/sound/firewire/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_SND_DICE) += snd-dice.o
10obj-$(CONFIG_SND_FIREWIRE_SPEAKERS) += snd-firewire-speakers.o 10obj-$(CONFIG_SND_FIREWIRE_SPEAKERS) += snd-firewire-speakers.o
11obj-$(CONFIG_SND_ISIGHT) += snd-isight.o 11obj-$(CONFIG_SND_ISIGHT) += snd-isight.o
12obj-$(CONFIG_SND_SCS1X) += snd-scs1x.o 12obj-$(CONFIG_SND_SCS1X) += snd-scs1x.o
13obj-$(CONFIG_SND_FIREWORKS) += fireworks/
diff --git a/sound/firewire/fireworks/Makefile b/sound/firewire/fireworks/Makefile
new file mode 100644
index 000000000000..99f6fc385a45
--- /dev/null
+++ b/sound/firewire/fireworks/Makefile
@@ -0,0 +1,2 @@
1snd-fireworks-objs := fireworks.o
2obj-m += snd-fireworks.o
diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c
new file mode 100644
index 000000000000..ad719a1d5353
--- /dev/null
+++ b/sound/firewire/fireworks/fireworks.c
@@ -0,0 +1,182 @@
1/*
2 * fireworks.c - a part of driver for Fireworks based devices
3 *
4 * Copyright (c) 2009-2010 Clemens Ladisch
5 * Copyright (c) 2013-2014 Takashi Sakamoto
6 *
7 * Licensed under the terms of the GNU General Public License, version 2.
8 */
9
10/*
11 * Fireworks is a board module which Echo Audio produced. This module consists
12 * of three chipsets:
13 * - Communication chipset for IEEE1394 PHY/Link and IEC 61883-1/6
14 * - DSP or/and FPGA for signal processing
15 * - Flash Memory to store firmwares
16 */
17
18#include "fireworks.h"
19
20MODULE_DESCRIPTION("Echo Fireworks driver");
21MODULE_AUTHOR("Takashi Sakamoto <o-takashi@sakamocchi.jp>");
22MODULE_LICENSE("GPL v2");
23
24static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
25static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
26static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
27
28module_param_array(index, int, NULL, 0444);
29MODULE_PARM_DESC(index, "card index");
30module_param_array(id, charp, NULL, 0444);
31MODULE_PARM_DESC(id, "ID string");
32module_param_array(enable, bool, NULL, 0444);
33MODULE_PARM_DESC(enable, "enable Fireworks sound card");
34
35static DEFINE_MUTEX(devices_mutex);
36static DECLARE_BITMAP(devices_used, SNDRV_CARDS);
37
38#define VENDOR_LOUD 0x000ff2
39#define MODEL_MACKIE_400F 0x00400f
40#define MODEL_MACKIE_1200F 0x01200f
41
42#define VENDOR_ECHO 0x001486
43#define MODEL_ECHO_AUDIOFIRE_12 0x00af12
44#define MODEL_ECHO_AUDIOFIRE_12HD 0x0af12d
45#define MODEL_ECHO_AUDIOFIRE_12_APPLE 0x0af12a
46/* This is applied for AudioFire8 (until 2009 July) */
47#define MODEL_ECHO_AUDIOFIRE_8 0x000af8
48#define MODEL_ECHO_AUDIOFIRE_2 0x000af2
49#define MODEL_ECHO_AUDIOFIRE_4 0x000af4
50/* AudioFire9 is applied for AudioFire8(since 2009 July) and AudioFirePre8 */
51#define MODEL_ECHO_AUDIOFIRE_9 0x000af9
52/* unknown as product */
53#define MODEL_ECHO_FIREWORKS_8 0x0000f8
54#define MODEL_ECHO_FIREWORKS_HDMI 0x00afd1
55
56#define VENDOR_GIBSON 0x00075b
57/* for Robot Interface Pack of Dark Fire, Dusk Tiger, Les Paul Standard 2010 */
58#define MODEL_GIBSON_RIP 0x00afb2
59/* unknown as product */
60#define MODEL_GIBSON_GOLDTOP 0x00afb9
61
62static void
63efw_card_free(struct snd_card *card)
64{
65 struct snd_efw *efw = card->private_data;
66
67 if (efw->card_index >= 0) {
68 mutex_lock(&devices_mutex);
69 clear_bit(efw->card_index, devices_used);
70 mutex_unlock(&devices_mutex);
71 }
72
73 mutex_destroy(&efw->mutex);
74}
75
76static int
77efw_probe(struct fw_unit *unit,
78 const struct ieee1394_device_id *entry)
79{
80 struct snd_card *card;
81 struct snd_efw *efw;
82 int card_index, err;
83
84 mutex_lock(&devices_mutex);
85
86 /* check registered cards */
87 for (card_index = 0; card_index < SNDRV_CARDS; ++card_index) {
88 if (!test_bit(card_index, devices_used) && enable[card_index])
89 break;
90 }
91 if (card_index >= SNDRV_CARDS) {
92 err = -ENOENT;
93 goto end;
94 }
95
96 err = snd_card_new(&unit->device, index[card_index], id[card_index],
97 THIS_MODULE, sizeof(struct snd_efw), &card);
98 if (err < 0)
99 goto end;
100 efw = card->private_data;
101 efw->card_index = card_index;
102 set_bit(card_index, devices_used);
103 card->private_free = efw_card_free;
104
105 efw->card = card;
106 efw->unit = unit;
107 mutex_init(&efw->mutex);
108 spin_lock_init(&efw->lock);
109
110 strcpy(efw->card->driver, "Fireworks");
111 strcpy(efw->card->shortname, efw->card->driver);
112 strcpy(efw->card->longname, efw->card->driver);
113 strcpy(efw->card->mixername, efw->card->driver);
114
115 err = snd_card_register(card);
116 if (err < 0)
117 goto error;
118 dev_set_drvdata(&unit->device, efw);
119end:
120 mutex_unlock(&devices_mutex);
121 return err;
122error:
123 mutex_unlock(&devices_mutex);
124 snd_card_free(card);
125 return err;
126}
127
128static void efw_update(struct fw_unit *unit)
129{
130 return;
131}
132
133static void efw_remove(struct fw_unit *unit)
134{
135 struct snd_efw *efw = dev_get_drvdata(&unit->device);
136 snd_card_disconnect(efw->card);
137 snd_card_free_when_closed(efw->card);
138}
139
140static const struct ieee1394_device_id efw_id_table[] = {
141 SND_EFW_DEV_ENTRY(VENDOR_LOUD, MODEL_MACKIE_400F),
142 SND_EFW_DEV_ENTRY(VENDOR_LOUD, MODEL_MACKIE_1200F),
143 SND_EFW_DEV_ENTRY(VENDOR_ECHO, MODEL_ECHO_AUDIOFIRE_8),
144 SND_EFW_DEV_ENTRY(VENDOR_ECHO, MODEL_ECHO_AUDIOFIRE_12),
145 SND_EFW_DEV_ENTRY(VENDOR_ECHO, MODEL_ECHO_AUDIOFIRE_12HD),
146 SND_EFW_DEV_ENTRY(VENDOR_ECHO, MODEL_ECHO_AUDIOFIRE_12_APPLE),
147 SND_EFW_DEV_ENTRY(VENDOR_ECHO, MODEL_ECHO_AUDIOFIRE_2),
148 SND_EFW_DEV_ENTRY(VENDOR_ECHO, MODEL_ECHO_AUDIOFIRE_4),
149 SND_EFW_DEV_ENTRY(VENDOR_ECHO, MODEL_ECHO_AUDIOFIRE_9),
150 SND_EFW_DEV_ENTRY(VENDOR_ECHO, MODEL_ECHO_FIREWORKS_8),
151 SND_EFW_DEV_ENTRY(VENDOR_ECHO, MODEL_ECHO_FIREWORKS_HDMI),
152 SND_EFW_DEV_ENTRY(VENDOR_GIBSON, MODEL_GIBSON_RIP),
153 SND_EFW_DEV_ENTRY(VENDOR_GIBSON, MODEL_GIBSON_GOLDTOP),
154 {}
155};
156MODULE_DEVICE_TABLE(ieee1394, efw_id_table);
157
158static struct fw_driver efw_driver = {
159 .driver = {
160 .owner = THIS_MODULE,
161 .name = "snd-fireworks",
162 .bus = &fw_bus_type,
163 },
164 .probe = efw_probe,
165 .update = efw_update,
166 .remove = efw_remove,
167 .id_table = efw_id_table,
168};
169
170static int __init snd_efw_init(void)
171{
172 return driver_register(&efw_driver.driver);
173}
174
175static void __exit snd_efw_exit(void)
176{
177 driver_unregister(&efw_driver.driver);
178 mutex_destroy(&devices_mutex);
179}
180
181module_init(snd_efw_init);
182module_exit(snd_efw_exit);
diff --git a/sound/firewire/fireworks/fireworks.h b/sound/firewire/fireworks/fireworks.h
new file mode 100644
index 000000000000..9dfeb8210e71
--- /dev/null
+++ b/sound/firewire/fireworks/fireworks.h
@@ -0,0 +1,41 @@
1/*
2 * fireworks.h - a part of driver for Fireworks based devices
3 *
4 * Copyright (c) 2009-2010 Clemens Ladisch
5 * Copyright (c) 2013-2014 Takashi Sakamoto
6 *
7 * Licensed under the terms of the GNU General Public License, version 2.
8 */
9#ifndef SOUND_FIREWORKS_H_INCLUDED
10#define SOUND_FIREWORKS_H_INCLUDED
11
12#include <linux/compat.h>
13#include <linux/device.h>
14#include <linux/firewire.h>
15#include <linux/firewire-constants.h>
16#include <linux/module.h>
17#include <linux/mod_devicetable.h>
18#include <linux/delay.h>
19#include <linux/slab.h>
20
21#include <sound/core.h>
22#include <sound/initval.h>
23
24struct snd_efw {
25 struct snd_card *card;
26 struct fw_unit *unit;
27 int card_index;
28
29 struct mutex mutex;
30 spinlock_t lock;
31};
32
33#define SND_EFW_DEV_ENTRY(vendor, model) \
34{ \
35 .match_flags = IEEE1394_MATCH_VENDOR_ID | \
36 IEEE1394_MATCH_MODEL_ID, \
37 .vendor_id = vendor,\
38 .model_id = model \
39}
40
41#endif