Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: line6: add Pod HD300 support

The Pod HD device family uses new MIDI SysEx messages and therefore
cannot reuse the existing Pod code. Instead of hardcoding Pod HD MIDI
messages into the driver, leave MIDI up to userspace. This driver
simply presents MIDI and pcm ALSA devices.

This device is similar to the Pod except that it has 48 kHz audio and
does not respond to Pod SysEx messages.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Stefan Hajnoczi and committed by
Greg Kroah-Hartman
16dc1040 982d6ab5

+216 -2
+2 -1
drivers/staging/line6/Makefile
··· 12 12 playback.o \ 13 13 pod.o \ 14 14 toneport.o \ 15 - variax.o 15 + variax.o \ 16 + podhd.o
+23 -1
drivers/staging/line6/driver.c
··· 21 21 #include "midi.h" 22 22 #include "playback.h" 23 23 #include "pod.h" 24 + #include "podhd.h" 24 25 #include "revision.h" 25 26 #include "toneport.h" 26 27 #include "usbdefs.h" ··· 50 49 {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX1)}, 51 50 {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX2)}, 52 51 {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_VARIAX)}, 52 + {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODHD300)}, 53 53 {}, 54 54 }; 55 55 ··· 74 72 { "TonePortGX", "TonePort GX", LINE6_BIT_TONEPORT_GX, LINE6_BIT_PCM }, 75 73 { "TonePortUX1", "TonePort UX1", LINE6_BIT_TONEPORT_UX1, LINE6_BIT_PCM }, 76 74 { "TonePortUX2", "TonePort UX2", LINE6_BIT_TONEPORT_UX2, LINE6_BIT_PCM }, 77 - { "Variax", "Variax Workbench", LINE6_BIT_VARIAX, LINE6_BIT_CONTROL } 75 + { "Variax", "Variax Workbench", LINE6_BIT_VARIAX, LINE6_BIT_CONTROL }, 76 + { "PODHD300", "POD HD300", LINE6_BIT_PODHD300, LINE6_BIT_CONTROL_PCM_HWMON }, 78 77 }; 79 78 /* *INDENT-ON* */ 80 79 ··· 439 436 line6_pod_process_message((struct usb_line6_pod *) 440 437 line6); 441 438 break; 439 + 440 + case LINE6_DEVID_PODHD300: 441 + break; /* let userspace handle MIDI */ 442 442 443 443 case LINE6_DEVID_PODXTLIVE: 444 444 switch (line6->interface_number) { ··· 818 812 case LINE6_DEVID_BASSPODXTPRO: 819 813 case LINE6_DEVID_PODXT: 820 814 case LINE6_DEVID_PODXTPRO: 815 + case LINE6_DEVID_PODHD300: 821 816 alternate = 5; 822 817 break; 823 818 ··· 868 861 case LINE6_DEVID_PODXT: 869 862 case LINE6_DEVID_PODXTPRO: 870 863 size = sizeof(struct usb_line6_pod); 864 + ep_read = 0x84; 865 + ep_write = 0x03; 866 + break; 867 + 868 + case LINE6_DEVID_PODHD300: 869 + size = sizeof(struct usb_line6_podhd); 871 870 ep_read = 0x84; 872 871 ep_write = 0x03; 873 872 break; ··· 1030 1017 ret = line6_pod_init(interface, (struct usb_line6_pod *)line6); 1031 1018 break; 1032 1019 1020 + case LINE6_DEVID_PODHD300: 1021 + ret = line6_podhd_init(interface, 1022 + (struct usb_line6_podhd *)line6); 1023 + break; 1024 + 1033 1025 case LINE6_DEVID_PODXTLIVE: 1034 1026 switch (interface_number) { 1035 1027 case PODXTLIVE_INTERFACE_POD: ··· 1155 1137 case LINE6_DEVID_PODXT: 1156 1138 case LINE6_DEVID_PODXTPRO: 1157 1139 line6_pod_disconnect(interface); 1140 + break; 1141 + 1142 + case LINE6_DEVID_PODHD300: 1143 + line6_podhd_disconnect(interface); 1158 1144 break; 1159 1145 1160 1146 case LINE6_DEVID_PODXTLIVE:
+1
drivers/staging/line6/pcm.c
··· 403 403 case LINE6_DEVID_PODXT: 404 404 case LINE6_DEVID_PODXTLIVE: 405 405 case LINE6_DEVID_PODXTPRO: 406 + case LINE6_DEVID_PODHD300: 406 407 ep_read = 0x82; 407 408 ep_write = 0x01; 408 409 break;
+158
drivers/staging/line6/podhd.c
··· 1 + /* 2 + * Line6 Pod HD 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 + 12 + #include <sound/core.h> 13 + #include <sound/pcm.h> 14 + 15 + #include "audio.h" 16 + #include "driver.h" 17 + #include "pcm.h" 18 + #include "podhd.h" 19 + 20 + #define PODHD_BYTES_PER_FRAME 6 /* 24bit audio (stereo) */ 21 + 22 + static struct snd_ratden podhd_ratden = { 23 + .num_min = 48000, 24 + .num_max = 48000, 25 + .num_step = 1, 26 + .den = 1, 27 + }; 28 + 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 | 36 + #ifdef CONFIG_PM 37 + SNDRV_PCM_INFO_RESUME | 38 + #endif 39 + SNDRV_PCM_INFO_SYNC_START), 40 + .formats = SNDRV_PCM_FMTBIT_S24_3LE, 41 + .rates = SNDRV_PCM_RATE_48000, 42 + .rate_min = 48000, 43 + .rate_max = 48000, 44 + .channels_min = 2, 45 + .channels_max = 2, 46 + .buffer_bytes_max = 60000, 47 + .period_bytes_min = 64, 48 + .period_bytes_max = 8192, 49 + .periods_min = 1, 50 + .periods_max = 1024}, 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 | 56 + #ifdef CONFIG_PM 57 + SNDRV_PCM_INFO_RESUME | 58 + #endif 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}, 71 + .snd_line6_rates = { 72 + .nrats = 1, 73 + .rats = &podhd_ratden}, 74 + .bytes_per_frame = PODHD_BYTES_PER_FRAME 75 + }; 76 + 77 + /* 78 + POD HD destructor. 79 + */ 80 + static void podhd_destruct(struct usb_interface *interface) 81 + { 82 + struct usb_line6_podhd *podhd = usb_get_intfdata(interface); 83 + struct usb_line6 *line6; 84 + 85 + if (podhd == NULL) 86 + return; 87 + line6 = &podhd->line6; 88 + if (line6 == NULL) 89 + return; 90 + line6_cleanup_audio(line6); 91 + } 92 + 93 + /* 94 + Try to init POD HD device. 95 + */ 96 + static int podhd_try_init(struct usb_interface *interface, 97 + struct usb_line6_podhd *podhd) 98 + { 99 + int err; 100 + struct usb_line6 *line6 = &podhd->line6; 101 + 102 + if ((interface == NULL) || (podhd == NULL)) 103 + return -ENODEV; 104 + 105 + /* initialize audio system: */ 106 + err = line6_init_audio(line6); 107 + if (err < 0) 108 + return err; 109 + 110 + /* initialize MIDI subsystem: */ 111 + err = line6_init_midi(line6); 112 + if (err < 0) 113 + return err; 114 + 115 + /* initialize PCM subsystem: */ 116 + err = line6_init_pcm(line6, &podhd_pcm_properties); 117 + if (err < 0) 118 + return err; 119 + 120 + /* register USB audio system: */ 121 + err = line6_register_audio(line6); 122 + return err; 123 + } 124 + 125 + /* 126 + Init POD HD device (and clean up in case of failure). 127 + */ 128 + int line6_podhd_init(struct usb_interface *interface, 129 + struct usb_line6_podhd *podhd) 130 + { 131 + int err = podhd_try_init(interface, podhd); 132 + 133 + if (err < 0) 134 + podhd_destruct(interface); 135 + 136 + return err; 137 + } 138 + 139 + /* 140 + POD HD device disconnected. 141 + */ 142 + void line6_podhd_disconnect(struct usb_interface *interface) 143 + { 144 + struct usb_line6_podhd *podhd; 145 + 146 + if (interface == NULL) 147 + return; 148 + podhd = usb_get_intfdata(interface); 149 + 150 + if (podhd != NULL) { 151 + struct snd_line6_pcm *line6pcm = podhd->line6.line6pcm; 152 + 153 + if (line6pcm != NULL) 154 + line6_pcm_disconnect(line6pcm); 155 + } 156 + 157 + podhd_destruct(interface); 158 + }
+30
drivers/staging/line6/podhd.h
··· 1 + /* 2 + * Line6 Pod HD 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 + 12 + #ifndef PODHD_H 13 + #define PODHD_H 14 + 15 + #include <linux/usb.h> 16 + 17 + #include "driver.h" 18 + 19 + struct usb_line6_podhd { 20 + /** 21 + Generic Line6 USB data. 22 + */ 23 + struct usb_line6 line6; 24 + }; 25 + 26 + extern void line6_podhd_disconnect(struct usb_interface *interface); 27 + extern int line6_podhd_init(struct usb_interface *interface, 28 + struct usb_line6_podhd *podhd); 29 + 30 + #endif /* PODHD_H */
+2
drivers/staging/line6/usbdefs.h
··· 36 36 #define LINE6_DEVID_TONEPORT_UX1 0x4141 37 37 #define LINE6_DEVID_TONEPORT_UX2 0x4142 38 38 #define LINE6_DEVID_VARIAX 0x534d 39 + #define LINE6_DEVID_PODHD300 0x5057 39 40 40 41 #define LINE6_BIT_BASSPODXT (1 << 0) 41 42 #define LINE6_BIT_BASSPODXTLIVE (1 << 1) ··· 55 54 #define LINE6_BIT_TONEPORT_UX1 (1 << 14) 56 55 #define LINE6_BIT_TONEPORT_UX2 (1 << 15) 57 56 #define LINE6_BIT_VARIAX (1 << 16) 57 + #define LINE6_BIT_PODHD300 (1 << 17) 58 58 59 59 #define LINE6_BITS_PRO (LINE6_BIT_BASSPODXTPRO | \ 60 60 LINE6_BIT_PODXTPRO)