4 * Copyright (C) 2011 Stefan Hajnoczi <stefanha@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2.
12 #include <linux/usb.h>
13 #include <linux/slab.h>
14 #include <linux/module.h>
15 #include <sound/core.h>
16 #include <sound/pcm.h>
28 #define PODHD_BYTES_PER_FRAME 6 /* 24bit audio (stereo) */
30 static struct snd_ratden podhd_ratden
= {
37 static struct line6_pcm_properties podhd_pcm_properties
= {
39 .info
= (SNDRV_PCM_INFO_MMAP
|
40 SNDRV_PCM_INFO_INTERLEAVED
|
41 SNDRV_PCM_INFO_BLOCK_TRANSFER
|
42 SNDRV_PCM_INFO_MMAP_VALID
|
43 SNDRV_PCM_INFO_PAUSE
|
44 SNDRV_PCM_INFO_SYNC_START
),
45 .formats
= SNDRV_PCM_FMTBIT_S24_3LE
,
46 .rates
= SNDRV_PCM_RATE_48000
,
51 .buffer_bytes_max
= 60000,
52 .period_bytes_min
= 64,
53 .period_bytes_max
= 8192,
57 .info
= (SNDRV_PCM_INFO_MMAP
|
58 SNDRV_PCM_INFO_INTERLEAVED
|
59 SNDRV_PCM_INFO_BLOCK_TRANSFER
|
60 SNDRV_PCM_INFO_MMAP_VALID
|
61 SNDRV_PCM_INFO_SYNC_START
),
62 .formats
= SNDRV_PCM_FMTBIT_S24_3LE
,
63 .rates
= SNDRV_PCM_RATE_48000
,
68 .buffer_bytes_max
= 60000,
69 .period_bytes_min
= 64,
70 .period_bytes_max
= 8192,
75 .rats
= &podhd_ratden
},
76 .bytes_per_frame
= PODHD_BYTES_PER_FRAME
80 Try to init POD HD device.
82 static int podhd_init(struct usb_line6
*line6
,
83 const struct usb_device_id
*id
)
87 /* initialize MIDI subsystem: */
88 err
= line6_init_midi(line6
);
92 /* initialize PCM subsystem: */
93 err
= line6_init_pcm(line6
, &podhd_pcm_properties
);
97 /* register USB audio system: */
98 return snd_card_register(line6
->card
);
101 #define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod)
102 #define LINE6_IF_NUM(prod, n) USB_DEVICE_INTERFACE_NUMBER(0x0e41, prod, n)
104 /* table of devices that work with this driver */
105 static const struct usb_device_id podhd_id_table
[] = {
106 { LINE6_DEVICE(0x5057), .driver_info
= LINE6_PODHD300
},
107 { LINE6_DEVICE(0x5058), .driver_info
= LINE6_PODHD400
},
108 { LINE6_IF_NUM(0x414D, 0), .driver_info
= LINE6_PODHD500_0
},
109 { LINE6_IF_NUM(0x414D, 1), .driver_info
= LINE6_PODHD500_1
},
113 MODULE_DEVICE_TABLE(usb
, podhd_id_table
);
115 static const struct line6_properties podhd_properties_table
[] = {
119 .capabilities
= LINE6_CAP_CONTROL
131 .capabilities
= LINE6_CAP_CONTROL
140 [LINE6_PODHD500_0
] = {
143 .capabilities
= LINE6_CAP_CONTROL
152 [LINE6_PODHD500_1
] = {
155 .capabilities
= LINE6_CAP_CONTROL
169 static int podhd_probe(struct usb_interface
*interface
,
170 const struct usb_device_id
*id
)
172 return line6_probe(interface
, id
, "Line6-PODHD",
173 &podhd_properties_table
[id
->driver_info
],
174 podhd_init
, sizeof(struct usb_line6
));
177 static struct usb_driver podhd_driver
= {
178 .name
= KBUILD_MODNAME
,
179 .probe
= podhd_probe
,
180 .disconnect
= line6_disconnect
,
182 .suspend
= line6_suspend
,
183 .resume
= line6_resume
,
184 .reset_resume
= line6_resume
,
186 .id_table
= podhd_id_table
,
189 module_usb_driver(podhd_driver
);
191 MODULE_DESCRIPTION("Line 6 PODHD USB driver");
192 MODULE_LICENSE("GPL");