]> git.ipfire.org Git - thirdparty/linux.git/blame - sound/usb/line6/podhd.c
ALSA: line6: Allow processing of raw incoming messages
[thirdparty/linux.git] / sound / usb / line6 / podhd.c
CommitLineData
16dc1040 1/*
c6fffce9 2 * Line 6 Pod HD
16dc1040
SH
3 *
4 * Copyright (C) 2011 Stefan Hajnoczi <stefanha@gmail.com>
5 *
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.
9 *
10 */
11
ccddbe4a
TI
12#include <linux/usb.h>
13#include <linux/slab.h>
14#include <linux/module.h>
16dc1040
SH
15#include <sound/core.h>
16#include <sound/pcm.h>
17
16dc1040
SH
18#include "driver.h"
19#include "pcm.h"
ccddbe4a
TI
20
21enum {
22 LINE6_PODHD300,
23 LINE6_PODHD400,
24 LINE6_PODHD500_0,
25 LINE6_PODHD500_1,
26};
27
16dc1040
SH
28static struct snd_ratden podhd_ratden = {
29 .num_min = 48000,
30 .num_max = 48000,
31 .num_step = 1,
32 .den = 1,
33};
34
35static struct line6_pcm_properties podhd_pcm_properties = {
1263f611 36 .playback_hw = {
16dc1040
SH
37 .info = (SNDRV_PCM_INFO_MMAP |
38 SNDRV_PCM_INFO_INTERLEAVED |
39 SNDRV_PCM_INFO_BLOCK_TRANSFER |
40 SNDRV_PCM_INFO_MMAP_VALID |
41 SNDRV_PCM_INFO_PAUSE |
16dc1040
SH
42 SNDRV_PCM_INFO_SYNC_START),
43 .formats = SNDRV_PCM_FMTBIT_S24_3LE,
44 .rates = SNDRV_PCM_RATE_48000,
45 .rate_min = 48000,
46 .rate_max = 48000,
47 .channels_min = 2,
48 .channels_max = 2,
49 .buffer_bytes_max = 60000,
50 .period_bytes_min = 64,
51 .period_bytes_max = 8192,
52 .periods_min = 1,
53 .periods_max = 1024},
1263f611 54 .capture_hw = {
16dc1040
SH
55 .info = (SNDRV_PCM_INFO_MMAP |
56 SNDRV_PCM_INFO_INTERLEAVED |
57 SNDRV_PCM_INFO_BLOCK_TRANSFER |
58 SNDRV_PCM_INFO_MMAP_VALID |
16dc1040
SH
59 SNDRV_PCM_INFO_SYNC_START),
60 .formats = SNDRV_PCM_FMTBIT_S24_3LE,
61 .rates = SNDRV_PCM_RATE_48000,
62 .rate_min = 48000,
63 .rate_max = 48000,
64 .channels_min = 2,
65 .channels_max = 2,
66 .buffer_bytes_max = 60000,
67 .period_bytes_min = 64,
68 .period_bytes_max = 8192,
69 .periods_min = 1,
70 .periods_max = 1024},
1263f611 71 .rates = {
16dc1040
SH
72 .nrats = 1,
73 .rats = &podhd_ratden},
97d78acf 74 .bytes_per_channel = 3 /* 24bit audio (stereo) */
16dc1040
SH
75};
76
16dc1040
SH
77/*
78 Try to init POD HD device.
79*/
f66fd990
TI
80static int podhd_init(struct usb_line6 *line6,
81 const struct usb_device_id *id)
16dc1040
SH
82{
83 int err;
16dc1040 84
16dc1040
SH
85 /* initialize MIDI subsystem: */
86 err = line6_init_midi(line6);
87 if (err < 0)
88 return err;
89
90 /* initialize PCM subsystem: */
91 err = line6_init_pcm(line6, &podhd_pcm_properties);
92 if (err < 0)
93 return err;
94
95 /* register USB audio system: */
85a9339b 96 return snd_card_register(line6->card);
16dc1040
SH
97}
98
ccddbe4a
TI
99#define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod)
100#define LINE6_IF_NUM(prod, n) USB_DEVICE_INTERFACE_NUMBER(0x0e41, prod, n)
101
102/* table of devices that work with this driver */
103static const struct usb_device_id podhd_id_table[] = {
104 { LINE6_DEVICE(0x5057), .driver_info = LINE6_PODHD300 },
105 { LINE6_DEVICE(0x5058), .driver_info = LINE6_PODHD400 },
106 { LINE6_IF_NUM(0x414D, 0), .driver_info = LINE6_PODHD500_0 },
107 { LINE6_IF_NUM(0x414D, 1), .driver_info = LINE6_PODHD500_1 },
108 {}
109};
110
111MODULE_DEVICE_TABLE(usb, podhd_id_table);
112
113static const struct line6_properties podhd_properties_table[] = {
114 [LINE6_PODHD300] = {
115 .id = "PODHD300",
116 .name = "POD HD300",
117 .capabilities = LINE6_CAP_CONTROL
118 | LINE6_CAP_PCM
119 | LINE6_CAP_HWMON,
120 .altsetting = 5,
121 .ep_ctrl_r = 0x84,
122 .ep_ctrl_w = 0x03,
123 .ep_audio_r = 0x82,
124 .ep_audio_w = 0x01,
125 },
126 [LINE6_PODHD400] = {
127 .id = "PODHD400",
128 .name = "POD HD400",
129 .capabilities = LINE6_CAP_CONTROL
130 | LINE6_CAP_PCM
131 | LINE6_CAP_HWMON,
132 .altsetting = 5,
133 .ep_ctrl_r = 0x84,
134 .ep_ctrl_w = 0x03,
135 .ep_audio_r = 0x82,
136 .ep_audio_w = 0x01,
137 },
138 [LINE6_PODHD500_0] = {
139 .id = "PODHD500",
140 .name = "POD HD500",
141 .capabilities = LINE6_CAP_CONTROL
142 | LINE6_CAP_PCM
143 | LINE6_CAP_HWMON,
144 .altsetting = 1,
145 .ep_ctrl_r = 0x81,
146 .ep_ctrl_w = 0x01,
147 .ep_audio_r = 0x86,
148 .ep_audio_w = 0x02,
149 },
150 [LINE6_PODHD500_1] = {
151 .id = "PODHD500",
152 .name = "POD HD500",
153 .capabilities = LINE6_CAP_CONTROL
154 | LINE6_CAP_PCM
155 | LINE6_CAP_HWMON,
156 .altsetting = 1,
157 .ep_ctrl_r = 0x81,
158 .ep_ctrl_w = 0x01,
159 .ep_audio_r = 0x86,
160 .ep_audio_w = 0x02,
161 },
162};
163
ccddbe4a
TI
164/*
165 Probe USB device.
166*/
167static int podhd_probe(struct usb_interface *interface,
168 const struct usb_device_id *id)
169{
12865cac 170 return line6_probe(interface, id, "Line6-PODHD",
85a9339b 171 &podhd_properties_table[id->driver_info],
b3313476 172 podhd_init, sizeof(struct usb_line6));
ccddbe4a
TI
173}
174
175static struct usb_driver podhd_driver = {
176 .name = KBUILD_MODNAME,
177 .probe = podhd_probe,
178 .disconnect = line6_disconnect,
179#ifdef CONFIG_PM
180 .suspend = line6_suspend,
181 .resume = line6_resume,
182 .reset_resume = line6_resume,
183#endif
184 .id_table = podhd_id_table,
185};
186
187module_usb_driver(podhd_driver);
188
c6fffce9 189MODULE_DESCRIPTION("Line 6 PODHD USB driver");
ccddbe4a 190MODULE_LICENSE("GPL");