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