Steven Toth | 8d4f9d0 | 2008-05-22 18:05:26 -0300 | [diff] [blame] | 1 | /* |
Michael Krufky | 8f37356 | 2008-06-28 17:09:28 -0300 | [diff] [blame] | 2 | * Driver for the Siano SMS1xxx USB dongle |
Steven Toth | 8d4f9d0 | 2008-05-22 18:05:26 -0300 | [diff] [blame] | 3 | * |
Michael Krufky | 8544706 | 2008-05-22 18:29:20 -0300 | [diff] [blame] | 4 | * author: Anatoly Greenblat |
| 5 | * |
| 6 | * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. |
Steven Toth | 8d4f9d0 | 2008-05-22 18:05:26 -0300 | [diff] [blame] | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
Michael Krufky | 09a29b7 | 2008-09-03 16:48:17 -0300 | [diff] [blame] | 9 | * it under the terms of the GNU General Public License version 2 as |
Michael Krufky | 8544706 | 2008-05-22 18:29:20 -0300 | [diff] [blame] | 10 | * published by the Free Software Foundation; |
Steven Toth | 8d4f9d0 | 2008-05-22 18:05:26 -0300 | [diff] [blame] | 11 | * |
Michael Krufky | 8544706 | 2008-05-22 18:29:20 -0300 | [diff] [blame] | 12 | * Software distributed under the License is distributed on an "AS IS" |
| 13 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. |
Steven Toth | 8d4f9d0 | 2008-05-22 18:05:26 -0300 | [diff] [blame] | 14 | * |
Michael Krufky | 8544706 | 2008-05-22 18:29:20 -0300 | [diff] [blame] | 15 | * See the GNU General Public License for more details. |
Steven Toth | 8d4f9d0 | 2008-05-22 18:05:26 -0300 | [diff] [blame] | 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 | */ |
| 21 | |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 22 | #include <linux/kernel.h> |
| 23 | #include <linux/init.h> |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 24 | #include <linux/usb.h> |
| 25 | #include <linux/firmware.h> |
| 26 | |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 27 | #include "smscoreapi.h" |
Michael Krufky | 1c11d54 | 2008-06-18 22:09:55 -0300 | [diff] [blame] | 28 | #include "sms-cards.h" |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 29 | |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 30 | #define USB1_BUFFER_SIZE 0x1000 |
| 31 | #define USB2_BUFFER_SIZE 0x4000 |
| 32 | |
| 33 | #define MAX_BUFFERS 50 |
| 34 | #define MAX_URBS 10 |
| 35 | |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 36 | struct smsusb_device_t; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 37 | |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 38 | struct smsusb_urb_t { |
| 39 | struct smscore_buffer_t *cb; |
| 40 | struct smsusb_device_t *dev; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 41 | |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 42 | struct urb urb; |
| 43 | }; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 44 | |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 45 | struct smsusb_device_t { |
Michael Krufky | a83ccdd | 2008-05-06 03:11:51 -0300 | [diff] [blame] | 46 | struct usb_device *udev; |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 47 | struct smscore_device_t *coredev; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 48 | |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 49 | struct smsusb_urb_t surbs[MAX_URBS]; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 50 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 51 | int response_alignment; |
| 52 | int buffer_size; |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 53 | }; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 54 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 55 | static int smsusb_submit_urb(struct smsusb_device_t *dev, |
| 56 | struct smsusb_urb_t *surb); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 57 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 58 | static void smsusb_onresponse(struct urb *urb) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 59 | { |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 60 | struct smsusb_urb_t *surb = (struct smsusb_urb_t *) urb->context; |
| 61 | struct smsusb_device_t *dev = surb->dev; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 62 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 63 | if (urb->status < 0) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 64 | sms_err("error, urb status %d, %d bytes", |
| 65 | urb->status, urb->actual_length); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 66 | return; |
| 67 | } |
| 68 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 69 | if (urb->actual_length > 0) { |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 70 | struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) surb->cb->p; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 71 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 72 | if (urb->actual_length >= phdr->msgLength) { |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 73 | surb->cb->size = phdr->msgLength; |
| 74 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 75 | if (dev->response_alignment && |
| 76 | (phdr->msgFlags & MSG_HDR_FLAG_SPLIT_MSG)) { |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 77 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 78 | surb->cb->offset = |
| 79 | dev->response_alignment + |
| 80 | ((phdr->msgFlags >> 8) & 3); |
| 81 | |
| 82 | /* sanity check */ |
| 83 | if (((int) phdr->msgLength + |
| 84 | surb->cb->offset) > urb->actual_length) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 85 | sms_err("invalid response " |
| 86 | "msglen %d offset %d " |
| 87 | "size %d", |
| 88 | phdr->msgLength, |
| 89 | surb->cb->offset, |
| 90 | urb->actual_length); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 91 | goto exit_and_resubmit; |
| 92 | } |
| 93 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 94 | /* move buffer pointer and |
| 95 | * copy header to its new location */ |
Michael Krufky | 55ad310 | 2008-05-06 03:52:44 -0300 | [diff] [blame] | 96 | memcpy((char *) phdr + surb->cb->offset, |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 97 | phdr, sizeof(struct SmsMsgHdr_ST)); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 98 | } else |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 99 | surb->cb->offset = 0; |
| 100 | |
| 101 | smscore_onresponse(dev->coredev, surb->cb); |
| 102 | surb->cb = NULL; |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 103 | } else { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 104 | sms_err("invalid response " |
| 105 | "msglen %d actual %d", |
| 106 | phdr->msgLength, urb->actual_length); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 107 | } |
| 108 | } |
| 109 | |
| 110 | exit_and_resubmit: |
| 111 | smsusb_submit_urb(dev, surb); |
| 112 | } |
| 113 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 114 | static int smsusb_submit_urb(struct smsusb_device_t *dev, |
| 115 | struct smsusb_urb_t *surb) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 116 | { |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 117 | if (!surb->cb) { |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 118 | surb->cb = smscore_getbuffer(dev->coredev); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 119 | if (!surb->cb) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 120 | sms_err("smscore_getbuffer(...) returned NULL"); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 121 | return -ENOMEM; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | usb_fill_bulk_urb( |
| 126 | &surb->urb, |
| 127 | dev->udev, |
| 128 | usb_rcvbulkpipe(dev->udev, 0x81), |
| 129 | surb->cb->p, |
| 130 | dev->buffer_size, |
| 131 | smsusb_onresponse, |
| 132 | surb |
| 133 | ); |
| 134 | surb->urb.transfer_dma = surb->cb->phys; |
| 135 | surb->urb.transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
| 136 | |
| 137 | return usb_submit_urb(&surb->urb, GFP_ATOMIC); |
| 138 | } |
| 139 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 140 | static void smsusb_stop_streaming(struct smsusb_device_t *dev) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 141 | { |
| 142 | int i; |
| 143 | |
Michael Krufky | fa830e8 | 2008-06-15 15:52:43 -0300 | [diff] [blame] | 144 | for (i = 0; i < MAX_URBS; i++) { |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 145 | usb_kill_urb(&dev->surbs[i].urb); |
| 146 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 147 | if (dev->surbs[i].cb) { |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 148 | smscore_putbuffer(dev->coredev, dev->surbs[i].cb); |
| 149 | dev->surbs[i].cb = NULL; |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 154 | static int smsusb_start_streaming(struct smsusb_device_t *dev) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 155 | { |
| 156 | int i, rc; |
| 157 | |
Michael Krufky | fa830e8 | 2008-06-15 15:52:43 -0300 | [diff] [blame] | 158 | for (i = 0; i < MAX_URBS; i++) { |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 159 | rc = smsusb_submit_urb(dev, &dev->surbs[i]); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 160 | if (rc < 0) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 161 | sms_err("smsusb_submit_urb(...) failed"); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 162 | smsusb_stop_streaming(dev); |
| 163 | break; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | return rc; |
| 168 | } |
| 169 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 170 | static int smsusb_sendrequest(void *context, void *buffer, size_t size) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 171 | { |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 172 | struct smsusb_device_t *dev = (struct smsusb_device_t *) context; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 173 | int dummy; |
| 174 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 175 | return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2), |
| 176 | buffer, size, &dummy, 1000); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 177 | } |
| 178 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 179 | static char *smsusb1_fw_lkup[] = { |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 180 | "dvbt_stellar_usb.inp", |
| 181 | "dvbh_stellar_usb.inp", |
| 182 | "tdmb_stellar_usb.inp", |
| 183 | "none", |
| 184 | "dvbt_bda_stellar_usb.inp", |
| 185 | }; |
| 186 | |
Michael Krufky | 1fbc3ca | 2008-07-01 04:35:26 -0300 | [diff] [blame] | 187 | static inline char *sms_get_fw_name(int mode, int board_id) |
| 188 | { |
| 189 | char **fw = sms_get_board(board_id)->fw; |
| 190 | return (fw && fw[mode]) ? fw[mode] : smsusb1_fw_lkup[mode]; |
| 191 | } |
| 192 | |
| 193 | static int smsusb1_load_firmware(struct usb_device *udev, int id, int board_id) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 194 | { |
| 195 | const struct firmware *fw; |
Michael Krufky | a83ccdd | 2008-05-06 03:11:51 -0300 | [diff] [blame] | 196 | u8 *fw_buffer; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 197 | int rc, dummy; |
Michael Krufky | 1fbc3ca | 2008-07-01 04:35:26 -0300 | [diff] [blame] | 198 | char *fw_filename; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 199 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 200 | if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 201 | sms_err("invalid firmware id specified %d", id); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 202 | return -EINVAL; |
| 203 | } |
| 204 | |
Michael Krufky | 1fbc3ca | 2008-07-01 04:35:26 -0300 | [diff] [blame] | 205 | fw_filename = sms_get_fw_name(id, board_id); |
| 206 | |
| 207 | rc = request_firmware(&fw, fw_filename, &udev->dev); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 208 | if (rc < 0) { |
Michael Krufky | 1fbc3ca | 2008-07-01 04:35:26 -0300 | [diff] [blame] | 209 | sms_warn("failed to open \"%s\" mode %d, " |
| 210 | "trying again with default firmware", fw_filename, id); |
| 211 | |
| 212 | fw_filename = smsusb1_fw_lkup[id]; |
| 213 | rc = request_firmware(&fw, fw_filename, &udev->dev); |
| 214 | if (rc < 0) { |
| 215 | sms_warn("failed to open \"%s\" mode %d", |
| 216 | fw_filename, id); |
| 217 | |
| 218 | return rc; |
| 219 | } |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | fw_buffer = kmalloc(fw->size, GFP_KERNEL); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 223 | if (fw_buffer) { |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 224 | memcpy(fw_buffer, fw->data, fw->size); |
| 225 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 226 | rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2), |
| 227 | fw_buffer, fw->size, &dummy, 1000); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 228 | |
Michael Krufky | 0f2a1ee | 2008-06-28 20:53:45 -0300 | [diff] [blame] | 229 | sms_info("sent %zd(%d) bytes, rc %d", fw->size, dummy, rc); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 230 | |
| 231 | kfree(fw_buffer); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 232 | } else { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 233 | sms_err("failed to allocate firmware buffer"); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 234 | rc = -ENOMEM; |
| 235 | } |
Michael Krufky | 1fbc3ca | 2008-07-01 04:35:26 -0300 | [diff] [blame] | 236 | sms_info("read FW %s, size=%zd", fw_filename, fw->size); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 237 | |
| 238 | release_firmware(fw); |
| 239 | |
| 240 | return rc; |
| 241 | } |
| 242 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 243 | static void smsusb1_detectmode(void *context, int *mode) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 244 | { |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 245 | char *product_string = |
| 246 | ((struct smsusb_device_t *) context)->udev->product; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 247 | |
| 248 | *mode = DEVICE_MODE_NONE; |
| 249 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 250 | if (!product_string) { |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 251 | product_string = "none"; |
Michael Krufky | a0c0abc | 2008-06-19 20:35:21 -0300 | [diff] [blame] | 252 | sms_err("product string not found"); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 253 | } else if (strstr(product_string, "DVBH")) |
| 254 | *mode = 1; |
| 255 | else if (strstr(product_string, "BDA")) |
| 256 | *mode = 4; |
| 257 | else if (strstr(product_string, "DVBT")) |
| 258 | *mode = 0; |
| 259 | else if (strstr(product_string, "TDMB")) |
| 260 | *mode = 2; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 261 | |
Michael Krufky | a0c0abc | 2008-06-19 20:35:21 -0300 | [diff] [blame] | 262 | sms_info("%d \"%s\"", *mode, product_string); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 263 | } |
| 264 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 265 | static int smsusb1_setmode(void *context, int mode) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 266 | { |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 267 | struct SmsMsgHdr_ST Msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK, |
| 268 | sizeof(struct SmsMsgHdr_ST), 0 }; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 269 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 270 | if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 271 | sms_err("invalid firmware id specified %d", mode); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 272 | return -EINVAL; |
| 273 | } |
| 274 | |
| 275 | return smsusb_sendrequest(context, &Msg, sizeof(Msg)); |
| 276 | } |
| 277 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 278 | static void smsusb_term_device(struct usb_interface *intf) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 279 | { |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 280 | struct smsusb_device_t *dev = |
| 281 | (struct smsusb_device_t *) usb_get_intfdata(intf); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 282 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 283 | if (dev) { |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 284 | smsusb_stop_streaming(dev); |
| 285 | |
Michael Krufky | fa830e8 | 2008-06-15 15:52:43 -0300 | [diff] [blame] | 286 | /* unregister from smscore */ |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 287 | if (dev->coredev) |
| 288 | smscore_unregister_device(dev->coredev); |
| 289 | |
| 290 | kfree(dev); |
| 291 | |
Michael Krufky | a0c0abc | 2008-06-19 20:35:21 -0300 | [diff] [blame] | 292 | sms_info("device %p destroyed", dev); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | usb_set_intfdata(intf, NULL); |
| 296 | } |
| 297 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 298 | static int smsusb_init_device(struct usb_interface *intf, int board_id) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 299 | { |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 300 | struct smsdevice_params_t params; |
| 301 | struct smsusb_device_t *dev; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 302 | int i, rc; |
| 303 | |
Michael Krufky | fa830e8 | 2008-06-15 15:52:43 -0300 | [diff] [blame] | 304 | /* create device object */ |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 305 | dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 306 | if (!dev) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 307 | sms_err("kzalloc(sizeof(struct smsusb_device_t) failed"); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 308 | return -ENOMEM; |
| 309 | } |
| 310 | |
| 311 | memset(¶ms, 0, sizeof(params)); |
| 312 | usb_set_intfdata(intf, dev); |
| 313 | dev->udev = interface_to_usbdev(intf); |
| 314 | |
Michael Krufky | 2708e88 | 2008-06-21 05:24:38 -0300 | [diff] [blame] | 315 | params.device_type = sms_get_board(board_id)->type; |
Michael Krufky | 73104fb | 2008-06-14 18:27:18 -0300 | [diff] [blame] | 316 | |
Michael Krufky | 2708e88 | 2008-06-21 05:24:38 -0300 | [diff] [blame] | 317 | switch (params.device_type) { |
Michael Krufky | 1c11d54 | 2008-06-18 22:09:55 -0300 | [diff] [blame] | 318 | case SMS_STELLAR: |
Michael Krufky | f17407a | 2008-06-14 00:43:26 -0300 | [diff] [blame] | 319 | dev->buffer_size = USB1_BUFFER_SIZE; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 320 | |
Michael Krufky | f17407a | 2008-06-14 00:43:26 -0300 | [diff] [blame] | 321 | params.setmode_handler = smsusb1_setmode; |
| 322 | params.detectmode_handler = smsusb1_detectmode; |
Michael Krufky | f17407a | 2008-06-14 00:43:26 -0300 | [diff] [blame] | 323 | break; |
| 324 | default: |
Michael Krufky | 2708e88 | 2008-06-21 05:24:38 -0300 | [diff] [blame] | 325 | sms_err("Unspecified sms device type!"); |
| 326 | /* fall-thru */ |
| 327 | case SMS_NOVA_A0: |
| 328 | case SMS_NOVA_B0: |
| 329 | case SMS_VEGA: |
Michael Krufky | f17407a | 2008-06-14 00:43:26 -0300 | [diff] [blame] | 330 | dev->buffer_size = USB2_BUFFER_SIZE; |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 331 | dev->response_alignment = |
| 332 | dev->udev->ep_in[1]->desc.wMaxPacketSize - |
Michael Krufky | 18245e1 | 2008-06-15 17:52:24 -0300 | [diff] [blame] | 333 | sizeof(struct SmsMsgHdr_ST); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 334 | |
Michael Krufky | f17407a | 2008-06-14 00:43:26 -0300 | [diff] [blame] | 335 | params.flags |= SMS_DEVICE_FAMILY2; |
| 336 | break; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | params.device = &dev->udev->dev; |
| 340 | params.buffer_size = dev->buffer_size; |
| 341 | params.num_buffers = MAX_BUFFERS; |
| 342 | params.sendrequest_handler = smsusb_sendrequest; |
| 343 | params.context = dev; |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 344 | snprintf(params.devpath, sizeof(params.devpath), |
| 345 | "usb\\%d-%s", dev->udev->bus->busnum, dev->udev->devpath); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 346 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 347 | /* register in smscore */ |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 348 | rc = smscore_register_device(¶ms, &dev->coredev); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 349 | if (rc < 0) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 350 | sms_err("smscore_register_device(...) failed, rc %d", rc); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 351 | smsusb_term_device(intf); |
| 352 | return rc; |
| 353 | } |
| 354 | |
Michael Krufky | 1c11d54 | 2008-06-18 22:09:55 -0300 | [diff] [blame] | 355 | smscore_set_board_id(dev->coredev, board_id); |
| 356 | |
Michael Krufky | fa830e8 | 2008-06-15 15:52:43 -0300 | [diff] [blame] | 357 | /* initialize urbs */ |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 358 | for (i = 0; i < MAX_URBS; i++) { |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 359 | dev->surbs[i].dev = dev; |
| 360 | usb_init_urb(&dev->surbs[i].urb); |
| 361 | } |
| 362 | |
Michael Krufky | a0c0abc | 2008-06-19 20:35:21 -0300 | [diff] [blame] | 363 | sms_info("smsusb_start_streaming(...)."); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 364 | rc = smsusb_start_streaming(dev); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 365 | if (rc < 0) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 366 | sms_err("smsusb_start_streaming(...) failed"); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 367 | smsusb_term_device(intf); |
| 368 | return rc; |
| 369 | } |
| 370 | |
| 371 | rc = smscore_start_device(dev->coredev); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 372 | if (rc < 0) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 373 | sms_err("smscore_start_device(...) failed"); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 374 | smsusb_term_device(intf); |
| 375 | return rc; |
| 376 | } |
| 377 | |
Michael Krufky | a0c0abc | 2008-06-19 20:35:21 -0300 | [diff] [blame] | 378 | sms_info("device %p created", dev); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 379 | |
| 380 | return rc; |
| 381 | } |
| 382 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 383 | static int smsusb_probe(struct usb_interface *intf, |
| 384 | const struct usb_device_id *id) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 385 | { |
| 386 | struct usb_device *udev = interface_to_usbdev(intf); |
| 387 | char devpath[32]; |
| 388 | int i, rc; |
| 389 | |
Michael Krufky | f17407a | 2008-06-14 00:43:26 -0300 | [diff] [blame] | 390 | rc = usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x81)); |
| 391 | rc = usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x02)); |
| 392 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 393 | if (intf->num_altsetting > 0) { |
Michael Krufky | 59bf6b8 | 2008-06-15 16:50:11 -0300 | [diff] [blame] | 394 | rc = usb_set_interface( |
| 395 | udev, intf->cur_altsetting->desc.bInterfaceNumber, 0); |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 396 | if (rc < 0) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 397 | sms_err("usb_set_interface failed, rc %d", rc); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 398 | return rc; |
| 399 | } |
| 400 | } |
| 401 | |
Michael Krufky | a0c0abc | 2008-06-19 20:35:21 -0300 | [diff] [blame] | 402 | sms_info("smsusb_probe %d", |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 403 | intf->cur_altsetting->desc.bInterfaceNumber); |
Michael Krufky | fa830e8 | 2008-06-15 15:52:43 -0300 | [diff] [blame] | 404 | for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) |
Michael Krufky | a0c0abc | 2008-06-19 20:35:21 -0300 | [diff] [blame] | 405 | sms_info("endpoint %d %02x %02x %d", i, |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 406 | intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, |
| 407 | intf->cur_altsetting->endpoint[i].desc.bmAttributes, |
| 408 | intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 409 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 410 | if ((udev->actconfig->desc.bNumInterfaces == 2) && |
| 411 | (intf->cur_altsetting->desc.bInterfaceNumber == 0)) { |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 412 | sms_err("rom interface 0 is not used"); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 413 | return -ENODEV; |
| 414 | } |
| 415 | |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 416 | if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { |
| 417 | snprintf(devpath, sizeof(devpath), "usb\\%d-%s", |
| 418 | udev->bus->busnum, udev->devpath); |
Michael Krufky | a0c0abc | 2008-06-19 20:35:21 -0300 | [diff] [blame] | 419 | sms_info("stellar device was found."); |
Michael Krufky | 59bf6b8 | 2008-06-15 16:50:11 -0300 | [diff] [blame] | 420 | return smsusb1_load_firmware( |
Michael Krufky | 1fbc3ca | 2008-07-01 04:35:26 -0300 | [diff] [blame] | 421 | udev, smscore_registry_getmode(devpath), |
| 422 | id->driver_info); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 423 | } |
| 424 | |
Michael Krufky | 1c11d54 | 2008-06-18 22:09:55 -0300 | [diff] [blame] | 425 | rc = smsusb_init_device(intf, id->driver_info); |
Michael Krufky | a0c0abc | 2008-06-19 20:35:21 -0300 | [diff] [blame] | 426 | sms_info("rc %d", rc); |
Michael Krufky | f17407a | 2008-06-14 00:43:26 -0300 | [diff] [blame] | 427 | return rc; |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 428 | } |
| 429 | |
Michael Krufky | 0c071f3 | 2008-06-21 02:44:02 -0300 | [diff] [blame] | 430 | static void smsusb_disconnect(struct usb_interface *intf) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 431 | { |
| 432 | smsusb_term_device(intf); |
| 433 | } |
| 434 | |
Uri Shkolnik | 2f56c34 | 2008-11-22 14:08:46 -0300 | [diff] [blame] | 435 | static int smsusb_suspend(struct usb_interface *intf, pm_message_t msg) |
| 436 | { |
| 437 | struct smsusb_device_t *dev = |
| 438 | (struct smsusb_device_t *)usb_get_intfdata(intf); |
| 439 | printk(KERN_INFO "%s Entering status %d.\n", __func__, msg.event); |
| 440 | smsusb_stop_streaming(dev); |
| 441 | return 0; |
| 442 | } |
| 443 | |
| 444 | static int smsusb_resume(struct usb_interface *intf) |
| 445 | { |
| 446 | int rc, i; |
| 447 | struct smsusb_device_t *dev = |
| 448 | (struct smsusb_device_t *)usb_get_intfdata(intf); |
| 449 | struct usb_device *udev = interface_to_usbdev(intf); |
| 450 | |
| 451 | printk(KERN_INFO "%s Entering.\n", __func__); |
| 452 | usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x81)); |
| 453 | usb_clear_halt(udev, usb_rcvbulkpipe(udev, 0x02)); |
| 454 | |
| 455 | for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) |
| 456 | printk(KERN_INFO "endpoint %d %02x %02x %d\n", i, |
| 457 | intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, |
| 458 | intf->cur_altsetting->endpoint[i].desc.bmAttributes, |
| 459 | intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize); |
| 460 | |
| 461 | if (intf->num_altsetting > 0) { |
| 462 | rc = usb_set_interface(udev, |
| 463 | intf->cur_altsetting->desc. |
| 464 | bInterfaceNumber, 0); |
| 465 | if (rc < 0) { |
| 466 | printk(KERN_INFO |
| 467 | "%s usb_set_interface failed, rc %d\n", |
| 468 | __func__, rc); |
| 469 | return rc; |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | smsusb_start_streaming(dev); |
| 474 | return 0; |
| 475 | } |
| 476 | |
Michael Krufky | 841a3f0 | 2008-08-31 17:03:15 -0300 | [diff] [blame] | 477 | struct usb_device_id smsusb_id_table[] = { |
| 478 | #ifdef CONFIG_DVB_SIANO_SMS1XXX_SMS_IDS |
| 479 | { USB_DEVICE(0x187f, 0x0010), |
| 480 | .driver_info = SMS1XXX_BOARD_SIANO_STELLAR }, |
| 481 | { USB_DEVICE(0x187f, 0x0100), |
| 482 | .driver_info = SMS1XXX_BOARD_SIANO_STELLAR }, |
| 483 | { USB_DEVICE(0x187f, 0x0200), |
| 484 | .driver_info = SMS1XXX_BOARD_SIANO_NOVA_A }, |
| 485 | { USB_DEVICE(0x187f, 0x0201), |
| 486 | .driver_info = SMS1XXX_BOARD_SIANO_NOVA_B }, |
| 487 | { USB_DEVICE(0x187f, 0x0300), |
| 488 | .driver_info = SMS1XXX_BOARD_SIANO_VEGA }, |
| 489 | #endif |
| 490 | { USB_DEVICE(0x2040, 0x1700), |
| 491 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT }, |
| 492 | { USB_DEVICE(0x2040, 0x1800), |
| 493 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A }, |
| 494 | { USB_DEVICE(0x2040, 0x1801), |
| 495 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B }, |
| 496 | { USB_DEVICE(0x2040, 0x2000), |
| 497 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD }, |
| 498 | { USB_DEVICE(0x2040, 0x2009), |
| 499 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2 }, |
| 500 | { USB_DEVICE(0x2040, 0x200a), |
| 501 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD }, |
| 502 | { USB_DEVICE(0x2040, 0x2010), |
| 503 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD }, |
| 504 | { USB_DEVICE(0x2040, 0x2011), |
| 505 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD }, |
| 506 | { USB_DEVICE(0x2040, 0x2019), |
| 507 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD }, |
| 508 | { USB_DEVICE(0x2040, 0x5500), |
| 509 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, |
| 510 | { USB_DEVICE(0x2040, 0x5510), |
| 511 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, |
| 512 | { USB_DEVICE(0x2040, 0x5520), |
| 513 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, |
| 514 | { USB_DEVICE(0x2040, 0x5530), |
| 515 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, |
| 516 | { USB_DEVICE(0x2040, 0x5580), |
| 517 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, |
| 518 | { USB_DEVICE(0x2040, 0x5590), |
| 519 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, |
| 520 | { } /* Terminating entry */ |
| 521 | }; |
| 522 | MODULE_DEVICE_TABLE(usb, smsusb_id_table); |
| 523 | |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 524 | static struct usb_driver smsusb_driver = { |
Uri Shkolnik | dba843a | 2008-08-31 00:44:04 -0300 | [diff] [blame] | 525 | .name = "smsusb", |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 526 | .probe = smsusb_probe, |
Michael Krufky | 8223741 | 2008-06-15 15:14:13 -0300 | [diff] [blame] | 527 | .disconnect = smsusb_disconnect, |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 528 | .id_table = smsusb_id_table, |
Uri Shkolnik | 2f56c34 | 2008-11-22 14:08:46 -0300 | [diff] [blame] | 529 | |
| 530 | .suspend = smsusb_suspend, |
| 531 | .resume = smsusb_resume, |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 532 | }; |
| 533 | |
Uri Shkolnik | e0f14c2 | 2008-08-31 00:44:04 -0300 | [diff] [blame^] | 534 | int smsusb_module_init(void) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 535 | { |
| 536 | int rc = usb_register(&smsusb_driver); |
| 537 | if (rc) |
Michael Krufky | eb25094 | 2008-06-19 22:07:23 -0300 | [diff] [blame] | 538 | sms_err("usb_register failed. Error number %d", rc); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 539 | |
Michael Krufky | a0c0abc | 2008-06-19 20:35:21 -0300 | [diff] [blame] | 540 | sms_debug(""); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 541 | |
| 542 | return rc; |
| 543 | } |
| 544 | |
Uri Shkolnik | e0f14c2 | 2008-08-31 00:44:04 -0300 | [diff] [blame^] | 545 | void smsusb_module_exit(void) |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 546 | { |
Michael Krufky | a0c0abc | 2008-06-19 20:35:21 -0300 | [diff] [blame] | 547 | sms_debug(""); |
Steven Toth | 3dd24378 | 2008-05-22 18:01:02 -0300 | [diff] [blame] | 548 | /* Regular USB Cleanup */ |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 549 | usb_deregister(&smsusb_driver); |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 550 | } |
| 551 | |
Uri Shkolnik | e0f14c2 | 2008-08-31 00:44:04 -0300 | [diff] [blame^] | 552 | module_init(smsusb_module_init); |
| 553 | module_exit(smsusb_module_exit); |
| 554 | |
| 555 | MODULE_DESCRIPTION("Driver for the Siano SMS1XXX USB dongle"); |
| 556 | MODULE_AUTHOR("Siano Mobile Silicon, INC. (uris@siano-ms.com)"); |
| 557 | MODULE_LICENSE("GPL"); |