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 <sound/core.h>
13 #include <sound/pcm.h>
20 #define PODHD_BYTES_PER_FRAME 6 /* 24bit audio (stereo) */
22 static struct snd_ratden podhd_ratden = {
29 static struct line6_pcm_properties podhd_pcm_properties = {
30 .snd_line6_playback_hw = {
31 .info = (SNDRV_PCM_INFO_MMAP |
32 SNDRV_PCM_INFO_INTERLEAVED |
33 SNDRV_PCM_INFO_BLOCK_TRANSFER |
34 SNDRV_PCM_INFO_MMAP_VALID |
35 SNDRV_PCM_INFO_PAUSE |
37 SNDRV_PCM_INFO_RESUME |
39 SNDRV_PCM_INFO_SYNC_START),
40 .formats = SNDRV_PCM_FMTBIT_S24_3LE,
41 .rates = SNDRV_PCM_RATE_48000,
46 .buffer_bytes_max = 60000,
47 .period_bytes_min = 64,
48 .period_bytes_max = 8192,
51 .snd_line6_capture_hw = {
52 .info = (SNDRV_PCM_INFO_MMAP |
53 SNDRV_PCM_INFO_INTERLEAVED |
54 SNDRV_PCM_INFO_BLOCK_TRANSFER |
55 SNDRV_PCM_INFO_MMAP_VALID |
57 SNDRV_PCM_INFO_RESUME |
59 SNDRV_PCM_INFO_SYNC_START),
60 .formats = SNDRV_PCM_FMTBIT_S24_3LE,
61 .rates = SNDRV_PCM_RATE_48000,
66 .buffer_bytes_max = 60000,
67 .period_bytes_min = 64,
68 .period_bytes_max = 8192,
73 .rats = &podhd_ratden},
74 .bytes_per_frame = PODHD_BYTES_PER_FRAME
80 static void podhd_destruct(struct usb_interface *interface)
82 struct usb_line6_podhd *podhd = usb_get_intfdata(interface);
86 line6_cleanup_audio(&podhd->line6);
90 Try to init POD HD device.
92 static int podhd_try_init(struct usb_interface *interface,
93 struct usb_line6_podhd *podhd)
96 struct usb_line6 *line6 = &podhd->line6;
98 if ((interface == NULL) || (podhd == NULL))
101 /* initialize audio system: */
102 err = line6_init_audio(line6);
106 /* initialize MIDI subsystem: */
107 err = line6_init_midi(line6);
111 /* initialize PCM subsystem: */
112 err = line6_init_pcm(line6, &podhd_pcm_properties);
116 /* register USB audio system: */
117 err = line6_register_audio(line6);
122 Init POD HD device (and clean up in case of failure).
124 int line6_podhd_init(struct usb_interface *interface,
125 struct usb_line6_podhd *podhd)
127 int err = podhd_try_init(interface, podhd);
130 podhd_destruct(interface);
136 POD HD device disconnected.
138 void line6_podhd_disconnect(struct usb_interface *interface)
140 struct usb_line6_podhd *podhd;
142 if (interface == NULL)
144 podhd = usb_get_intfdata(interface);
147 struct snd_line6_pcm *line6pcm = podhd->line6.line6pcm;
149 if (line6pcm != NULL)
150 line6_pcm_disconnect(line6pcm);
153 podhd_destruct(interface);