blob: 4b6db7557e33c6cec3d1648f7e5b3521f9ce02b3 [file] [log] [blame]
Uri Shkolnik6d4e6972009-05-12 07:57:54 -03001/****************************************************************
2
3Siano Mobile Silicon, Inc.
4MDTV receiver kernel modules.
5Copyright (C) 2005-2009, Uri Shkolnik, Anatoly Greenblat
6
7This program is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the 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,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20****************************************************************/
Steven Toth8d4f9d02008-05-22 18:05:26 -030021
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030022#include <linux/kernel.h>
23#include <linux/init.h>
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030024#include <linux/usb.h>
25#include <linux/firmware.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090026#include <linux/slab.h>
Paul Gortmaker7a707b82011-07-03 14:03:12 -040027#include <linux/module.h>
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030028
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030029#include "smscoreapi.h"
Michael Krufky1c11d542008-06-18 22:09:55 -030030#include "sms-cards.h"
Uri Shkolnikc7ce8d32009-05-12 08:24:07 -030031#include "smsendian.h"
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030032
Michael Krufky0d02efe2009-02-27 02:42:16 -030033static int sms_dbg;
34module_param_named(debug, sms_dbg, int, 0644);
35MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))");
36
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030037#define USB1_BUFFER_SIZE 0x1000
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030038#define USB2_BUFFER_SIZE 0x2000
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030039
40#define MAX_BUFFERS 50
41#define MAX_URBS 10
42
Michael Krufky18245e12008-06-15 17:52:24 -030043struct smsusb_device_t;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030044
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030045enum smsusb_state {
46 SMSUSB_DISCONNECTED,
47 SMSUSB_SUSPENDED,
48 SMSUSB_ACTIVE
49};
50
Michael Krufky18245e12008-06-15 17:52:24 -030051struct smsusb_urb_t {
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030052 struct list_head entry;
Michael Krufky18245e12008-06-15 17:52:24 -030053 struct smscore_buffer_t *cb;
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030054 struct smsusb_device_t *dev;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030055
Michael Krufky18245e12008-06-15 17:52:24 -030056 struct urb urb;
57};
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030058
Michael Krufky18245e12008-06-15 17:52:24 -030059struct smsusb_device_t {
Michael Krufkya83ccdd2008-05-06 03:11:51 -030060 struct usb_device *udev;
Michael Krufky18245e12008-06-15 17:52:24 -030061 struct smscore_device_t *coredev;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030062
Michael Krufky18245e12008-06-15 17:52:24 -030063 struct smsusb_urb_t surbs[MAX_URBS];
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030064
Michael Krufky82237412008-06-15 15:14:13 -030065 int response_alignment;
66 int buffer_size;
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030067
68 unsigned char in_ep;
69 unsigned char out_ep;
70 enum smsusb_state state;
Michael Krufky18245e12008-06-15 17:52:24 -030071};
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030072
Michael Krufky0c071f32008-06-21 02:44:02 -030073static int smsusb_submit_urb(struct smsusb_device_t *dev,
74 struct smsusb_urb_t *surb);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030075
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030076/**
77 * Completing URB's callback handler - top half (interrupt context)
78 * adds completing sms urb to the global surbs list and activtes the worker
79 * thread the surb
80 * IMPORTANT - blocking functions must not be called from here !!!
81
82 * @param urb pointer to a completing urb object
83 */
Michael Krufky0c071f32008-06-21 02:44:02 -030084static void smsusb_onresponse(struct urb *urb)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030085{
Michael Krufky18245e12008-06-15 17:52:24 -030086 struct smsusb_urb_t *surb = (struct smsusb_urb_t *) urb->context;
87 struct smsusb_device_t *dev = surb->dev;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030088
Uri Shkolnik8f12d0a2009-05-12 11:28:41 -030089 if (urb->status == -ESHUTDOWN) {
90 sms_err("error, urb status %d (-ESHUTDOWN), %d bytes",
Michael Krufkyeb250942008-06-19 22:07:23 -030091 urb->status, urb->actual_length);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030092 return;
93 }
94
Uri Shkolnik8f12d0a2009-05-12 11:28:41 -030095 if ((urb->actual_length > 0) && (urb->status == 0)) {
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -030096 struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)surb->cb->p;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030097
Uri Shkolnik9c9c68a2009-05-14 16:27:16 -030098 smsendian_handle_message_header(phdr);
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -030099 if (urb->actual_length >= phdr->msg_length) {
100 surb->cb->size = phdr->msg_length;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300101
Michael Krufky82237412008-06-15 15:14:13 -0300102 if (dev->response_alignment &&
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300103 (phdr->msg_flags & MSG_HDR_FLAG_SPLIT_MSG)) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300104
Michael Krufky82237412008-06-15 15:14:13 -0300105 surb->cb->offset =
106 dev->response_alignment +
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300107 ((phdr->msg_flags >> 8) & 3);
Michael Krufky82237412008-06-15 15:14:13 -0300108
109 /* sanity check */
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300110 if (((int) phdr->msg_length +
Michael Krufky82237412008-06-15 15:14:13 -0300111 surb->cb->offset) > urb->actual_length) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300112 sms_err("invalid response "
113 "msglen %d offset %d "
114 "size %d",
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300115 phdr->msg_length,
Michael Krufkyeb250942008-06-19 22:07:23 -0300116 surb->cb->offset,
117 urb->actual_length);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300118 goto exit_and_resubmit;
119 }
120
Michael Krufky82237412008-06-15 15:14:13 -0300121 /* move buffer pointer and
122 * copy header to its new location */
Michael Krufky55ad3102008-05-06 03:52:44 -0300123 memcpy((char *) phdr + surb->cb->offset,
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300124 phdr, sizeof(struct sms_msg_hdr));
Michael Krufky82237412008-06-15 15:14:13 -0300125 } else
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300126 surb->cb->offset = 0;
127
Mauro Carvalho Chehab4c3bdb52013-03-09 09:27:39 -0300128 sms_debug("received %s(%d) size: %d",
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300129 smscore_translate_msg(phdr->msg_type),
130 phdr->msg_type, phdr->msg_length);
Mauro Carvalho Chehab4c3bdb52013-03-09 09:27:39 -0300131
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300132 smsendian_handle_rx_message((struct sms_msg_data *) phdr);
Mauro Carvalho Chehab80ccb512013-03-09 11:34:56 -0300133
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300134 smscore_onresponse(dev->coredev, surb->cb);
135 surb->cb = NULL;
Michael Krufky82237412008-06-15 15:14:13 -0300136 } else {
Michael Krufkyeb250942008-06-19 22:07:23 -0300137 sms_err("invalid response "
138 "msglen %d actual %d",
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300139 phdr->msg_length, urb->actual_length);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300140 }
Uri Shkolnik8f12d0a2009-05-12 11:28:41 -0300141 } else
142 sms_err("error, urb status %d, %d bytes",
143 urb->status, urb->actual_length);
144
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300145
146exit_and_resubmit:
147 smsusb_submit_urb(dev, surb);
148}
149
Michael Krufky0c071f32008-06-21 02:44:02 -0300150static int smsusb_submit_urb(struct smsusb_device_t *dev,
151 struct smsusb_urb_t *surb)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300152{
Michael Krufky82237412008-06-15 15:14:13 -0300153 if (!surb->cb) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300154 surb->cb = smscore_getbuffer(dev->coredev);
Michael Krufky82237412008-06-15 15:14:13 -0300155 if (!surb->cb) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300156 sms_err("smscore_getbuffer(...) returned NULL");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300157 return -ENOMEM;
158 }
159 }
160
161 usb_fill_bulk_urb(
162 &surb->urb,
163 dev->udev,
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300164 usb_rcvbulkpipe(dev->udev, dev->in_ep),
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300165 surb->cb->p,
166 dev->buffer_size,
167 smsusb_onresponse,
168 surb
169 );
170 surb->urb.transfer_dma = surb->cb->phys;
171 surb->urb.transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
172
173 return usb_submit_urb(&surb->urb, GFP_ATOMIC);
174}
175
Michael Krufky0c071f32008-06-21 02:44:02 -0300176static void smsusb_stop_streaming(struct smsusb_device_t *dev)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300177{
178 int i;
179
Michael Krufkyfa830e82008-06-15 15:52:43 -0300180 for (i = 0; i < MAX_URBS; i++) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300181 usb_kill_urb(&dev->surbs[i].urb);
182
Michael Krufky82237412008-06-15 15:14:13 -0300183 if (dev->surbs[i].cb) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300184 smscore_putbuffer(dev->coredev, dev->surbs[i].cb);
185 dev->surbs[i].cb = NULL;
186 }
187 }
188}
189
Michael Krufky0c071f32008-06-21 02:44:02 -0300190static int smsusb_start_streaming(struct smsusb_device_t *dev)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300191{
192 int i, rc;
193
Michael Krufkyfa830e82008-06-15 15:52:43 -0300194 for (i = 0; i < MAX_URBS; i++) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300195 rc = smsusb_submit_urb(dev, &dev->surbs[i]);
Michael Krufky82237412008-06-15 15:14:13 -0300196 if (rc < 0) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300197 sms_err("smsusb_submit_urb(...) failed");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300198 smsusb_stop_streaming(dev);
199 break;
200 }
201 }
202
203 return rc;
204}
205
Michael Krufky0c071f32008-06-21 02:44:02 -0300206static int smsusb_sendrequest(void *context, void *buffer, size_t size)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300207{
Michael Krufky18245e12008-06-15 17:52:24 -0300208 struct smsusb_device_t *dev = (struct smsusb_device_t *) context;
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300209 struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) buffer;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300210 int dummy;
211
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300212 if (dev->state != SMSUSB_ACTIVE) {
213 sms_debug("Device not active yet");
Mauro Carvalho Chehab80ccb512013-03-09 11:34:56 -0300214 return -ENOENT;
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300215 }
Mauro Carvalho Chehab80ccb512013-03-09 11:34:56 -0300216
Mauro Carvalho Chehab4c3bdb52013-03-09 09:27:39 -0300217 sms_debug("sending %s(%d) size: %d",
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300218 smscore_translate_msg(phdr->msg_type), phdr->msg_type,
219 phdr->msg_length);
Mauro Carvalho Chehab4c3bdb52013-03-09 09:27:39 -0300220
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300221 smsendian_handle_tx_message((struct sms_msg_data *) phdr);
222 smsendian_handle_message_header((struct sms_msg_hdr *)buffer);
Michael Krufky82237412008-06-15 15:14:13 -0300223 return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2),
224 buffer, size, &dummy, 1000);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300225}
226
Michael Krufky0c071f32008-06-21 02:44:02 -0300227static char *smsusb1_fw_lkup[] = {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300228 "dvbt_stellar_usb.inp",
229 "dvbh_stellar_usb.inp",
230 "tdmb_stellar_usb.inp",
231 "none",
232 "dvbt_bda_stellar_usb.inp",
233};
234
Michael Krufky1fbc3ca2008-07-01 04:35:26 -0300235static inline char *sms_get_fw_name(int mode, int board_id)
236{
237 char **fw = sms_get_board(board_id)->fw;
238 return (fw && fw[mode]) ? fw[mode] : smsusb1_fw_lkup[mode];
239}
240
241static int smsusb1_load_firmware(struct usb_device *udev, int id, int board_id)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300242{
243 const struct firmware *fw;
Michael Krufkya83ccdd2008-05-06 03:11:51 -0300244 u8 *fw_buffer;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300245 int rc, dummy;
Michael Krufky1fbc3ca2008-07-01 04:35:26 -0300246 char *fw_filename;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300247
Mauro Carvalho Chehabb00ade22013-09-12 17:04:07 -0300248 if (id < 0)
249 id = sms_get_board(board_id)->default_mode;
250
Michael Krufky82237412008-06-15 15:14:13 -0300251 if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300252 sms_err("invalid firmware id specified %d", id);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300253 return -EINVAL;
254 }
255
Michael Krufky1fbc3ca2008-07-01 04:35:26 -0300256 fw_filename = sms_get_fw_name(id, board_id);
257
258 rc = request_firmware(&fw, fw_filename, &udev->dev);
Michael Krufky82237412008-06-15 15:14:13 -0300259 if (rc < 0) {
Michael Krufky1fbc3ca2008-07-01 04:35:26 -0300260 sms_warn("failed to open \"%s\" mode %d, "
261 "trying again with default firmware", fw_filename, id);
262
263 fw_filename = smsusb1_fw_lkup[id];
264 rc = request_firmware(&fw, fw_filename, &udev->dev);
265 if (rc < 0) {
266 sms_warn("failed to open \"%s\" mode %d",
267 fw_filename, id);
268
269 return rc;
270 }
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300271 }
272
273 fw_buffer = kmalloc(fw->size, GFP_KERNEL);
Michael Krufky82237412008-06-15 15:14:13 -0300274 if (fw_buffer) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300275 memcpy(fw_buffer, fw->data, fw->size);
276
Michael Krufky82237412008-06-15 15:14:13 -0300277 rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2),
278 fw_buffer, fw->size, &dummy, 1000);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300279
Mauro Carvalho Chehab7983b772014-09-24 20:36:07 -0300280 sms_info("sent %zu(%d) bytes, rc %d", fw->size, dummy, rc);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300281
282 kfree(fw_buffer);
Michael Krufky82237412008-06-15 15:14:13 -0300283 } else {
Michael Krufkyeb250942008-06-19 22:07:23 -0300284 sms_err("failed to allocate firmware buffer");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300285 rc = -ENOMEM;
286 }
Mauro Carvalho Chehab7983b772014-09-24 20:36:07 -0300287 sms_info("read FW %s, size=%zu", fw_filename, fw->size);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300288
289 release_firmware(fw);
290
291 return rc;
292}
293
Michael Krufky0c071f32008-06-21 02:44:02 -0300294static void smsusb1_detectmode(void *context, int *mode)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300295{
Michael Krufky18245e12008-06-15 17:52:24 -0300296 char *product_string =
297 ((struct smsusb_device_t *) context)->udev->product;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300298
299 *mode = DEVICE_MODE_NONE;
300
Michael Krufky82237412008-06-15 15:14:13 -0300301 if (!product_string) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300302 product_string = "none";
Michael Krufkya0c0abc2008-06-19 20:35:21 -0300303 sms_err("product string not found");
Michael Krufky82237412008-06-15 15:14:13 -0300304 } else if (strstr(product_string, "DVBH"))
305 *mode = 1;
306 else if (strstr(product_string, "BDA"))
307 *mode = 4;
308 else if (strstr(product_string, "DVBT"))
309 *mode = 0;
310 else if (strstr(product_string, "TDMB"))
311 *mode = 2;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300312
Michael Krufkya0c0abc2008-06-19 20:35:21 -0300313 sms_info("%d \"%s\"", *mode, product_string);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300314}
315
Michael Krufky0c071f32008-06-21 02:44:02 -0300316static int smsusb1_setmode(void *context, int mode)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300317{
Mauro Carvalho Chehab28a59df2013-03-21 09:27:37 -0300318 struct sms_msg_hdr msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK,
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300319 sizeof(struct sms_msg_hdr), 0 };
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300320
Michael Krufky82237412008-06-15 15:14:13 -0300321 if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300322 sms_err("invalid firmware id specified %d", mode);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300323 return -EINVAL;
324 }
325
Mauro Carvalho Chehab28a59df2013-03-21 09:27:37 -0300326 return smsusb_sendrequest(context, &msg, sizeof(msg));
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300327}
328
Michael Krufky0c071f32008-06-21 02:44:02 -0300329static void smsusb_term_device(struct usb_interface *intf)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300330{
Joe Perches8350e152010-11-30 18:42:07 -0300331 struct smsusb_device_t *dev = usb_get_intfdata(intf);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300332
Michael Krufky82237412008-06-15 15:14:13 -0300333 if (dev) {
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300334 dev->state = SMSUSB_DISCONNECTED;
335
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300336 smsusb_stop_streaming(dev);
337
Michael Krufkyfa830e82008-06-15 15:52:43 -0300338 /* unregister from smscore */
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300339 if (dev->coredev)
340 smscore_unregister_device(dev->coredev);
341
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300342 sms_info("device 0x%p destroyed", dev);
Jesper Juhl08921ac2011-04-21 18:11:25 -0300343 kfree(dev);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300344 }
345
346 usb_set_intfdata(intf, NULL);
347}
348
Mauro Carvalho Chehab46b1e212015-01-07 08:03:03 -0300349static void siano_media_device_register(struct smsusb_device_t *dev)
350{
351#ifdef CONFIG_MEDIA_CONTROLLER_DVB
352 struct media_device *mdev;
353 struct usb_device *udev = dev->udev;
354 int board_id = smscore_get_board_id(dev->coredev);
355 struct sms_board *board = sms_get_board(board_id);
356 int ret;
357
358 mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
359 if (!mdev)
360 return;
361
362 mdev->dev = &udev->dev;
363 strlcpy(mdev->model, board->name, sizeof(mdev->model));
364 if (udev->serial)
365 strlcpy(mdev->serial, udev->serial, sizeof(mdev->serial));
366 strcpy(mdev->bus_info, udev->devpath);
367 mdev->hw_revision = le16_to_cpu(udev->descriptor.bcdDevice);
368 mdev->driver_version = LINUX_VERSION_CODE;
369
370 ret = media_device_register(mdev);
371 if (ret) {
372 sms_err("Couldn't create a media device. Error: %d\n",
373 ret);
374 kfree(mdev);
375 return;
376 }
377
378 dev->coredev->media_dev = mdev;
379
380 sms_info("media controller created");
381
382#endif
383}
384
Michael Krufky0c071f32008-06-21 02:44:02 -0300385static int smsusb_init_device(struct usb_interface *intf, int board_id)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300386{
Michael Krufky18245e12008-06-15 17:52:24 -0300387 struct smsdevice_params_t params;
388 struct smsusb_device_t *dev;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300389 int i, rc;
390
Michael Krufkyfa830e82008-06-15 15:52:43 -0300391 /* create device object */
Michael Krufky18245e12008-06-15 17:52:24 -0300392 dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL);
Michael Krufky82237412008-06-15 15:14:13 -0300393 if (!dev) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300394 sms_err("kzalloc(sizeof(struct smsusb_device_t) failed");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300395 return -ENOMEM;
396 }
397
398 memset(&params, 0, sizeof(params));
399 usb_set_intfdata(intf, dev);
400 dev->udev = interface_to_usbdev(intf);
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300401 dev->state = SMSUSB_DISCONNECTED;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300402
Michael Krufky2708e882008-06-21 05:24:38 -0300403 params.device_type = sms_get_board(board_id)->type;
Michael Krufky73104fb2008-06-14 18:27:18 -0300404
Michael Krufky2708e882008-06-21 05:24:38 -0300405 switch (params.device_type) {
Michael Krufky1c11d542008-06-18 22:09:55 -0300406 case SMS_STELLAR:
Michael Krufkyf17407a2008-06-14 00:43:26 -0300407 dev->buffer_size = USB1_BUFFER_SIZE;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300408
Michael Krufkyf17407a2008-06-14 00:43:26 -0300409 params.setmode_handler = smsusb1_setmode;
410 params.detectmode_handler = smsusb1_detectmode;
Michael Krufkyf17407a2008-06-14 00:43:26 -0300411 break;
Mauro Carvalho Chehab07bb6bd2013-03-19 12:59:50 -0300412 case SMS_UNKNOWN_TYPE:
Michael Krufky2708e882008-06-21 05:24:38 -0300413 sms_err("Unspecified sms device type!");
414 /* fall-thru */
Mauro Carvalho Chehab07bb6bd2013-03-19 12:59:50 -0300415 default:
Michael Krufkyf17407a2008-06-14 00:43:26 -0300416 dev->buffer_size = USB2_BUFFER_SIZE;
Michael Krufky82237412008-06-15 15:14:13 -0300417 dev->response_alignment =
Uri Shkolnikc7ce8d32009-05-12 08:24:07 -0300418 le16_to_cpu(dev->udev->ep_in[1]->desc.wMaxPacketSize) -
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300419 sizeof(struct sms_msg_hdr);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300420
Michael Krufkyf17407a2008-06-14 00:43:26 -0300421 params.flags |= SMS_DEVICE_FAMILY2;
422 break;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300423 }
424
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300425 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
426 if (intf->cur_altsetting->endpoint[i].desc. bEndpointAddress & USB_DIR_IN)
427 dev->in_ep = intf->cur_altsetting->endpoint[i].desc.bEndpointAddress;
428 else
429 dev->out_ep = intf->cur_altsetting->endpoint[i].desc.bEndpointAddress;
430 }
431
432 sms_info("in_ep = %02x, out_ep = %02x",
433 dev->in_ep, dev->out_ep);
434
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300435 params.device = &dev->udev->dev;
436 params.buffer_size = dev->buffer_size;
437 params.num_buffers = MAX_BUFFERS;
438 params.sendrequest_handler = smsusb_sendrequest;
439 params.context = dev;
Mauro Carvalho Chehab1722f3b2010-08-01 15:30:50 -0300440 usb_make_path(dev->udev, params.devpath, sizeof(params.devpath));
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300441
Michael Krufky82237412008-06-15 15:14:13 -0300442 /* register in smscore */
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300443 rc = smscore_register_device(&params, &dev->coredev);
Michael Krufky82237412008-06-15 15:14:13 -0300444 if (rc < 0) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300445 sms_err("smscore_register_device(...) failed, rc %d", rc);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300446 smsusb_term_device(intf);
447 return rc;
448 }
449
Michael Krufky1c11d542008-06-18 22:09:55 -0300450 smscore_set_board_id(dev->coredev, board_id);
451
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -0300452 dev->coredev->is_usb_device = true;
453
Michael Krufkyfa830e82008-06-15 15:52:43 -0300454 /* initialize urbs */
Michael Krufky82237412008-06-15 15:14:13 -0300455 for (i = 0; i < MAX_URBS; i++) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300456 dev->surbs[i].dev = dev;
457 usb_init_urb(&dev->surbs[i].urb);
458 }
459
Michael Krufkya0c0abc2008-06-19 20:35:21 -0300460 sms_info("smsusb_start_streaming(...).");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300461 rc = smsusb_start_streaming(dev);
Michael Krufky82237412008-06-15 15:14:13 -0300462 if (rc < 0) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300463 sms_err("smsusb_start_streaming(...) failed");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300464 smsusb_term_device(intf);
465 return rc;
466 }
467
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300468 dev->state = SMSUSB_ACTIVE;
469
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300470 rc = smscore_start_device(dev->coredev);
Michael Krufky82237412008-06-15 15:14:13 -0300471 if (rc < 0) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300472 sms_err("smscore_start_device(...) failed");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300473 smsusb_term_device(intf);
474 return rc;
475 }
476
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300477 sms_info("device 0x%p created", dev);
Mauro Carvalho Chehab46b1e212015-01-07 08:03:03 -0300478 siano_media_device_register(dev);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300479
480 return rc;
481}
482
Greg Kroah-Hartman4c62e972012-12-21 13:17:53 -0800483static int smsusb_probe(struct usb_interface *intf,
Michael Krufky0c071f32008-06-21 02:44:02 -0300484 const struct usb_device_id *id)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300485{
486 struct usb_device *udev = interface_to_usbdev(intf);
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300487 char devpath[32];
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300488 int i, rc;
489
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300490 sms_info("board id=%lu, interface number %d",
491 id->driver_info,
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300492 intf->cur_altsetting->desc.bInterfaceNumber);
Michael Krufkyf17407a2008-06-14 00:43:26 -0300493
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300494 if (sms_get_board(id->driver_info)->intf_num !=
495 intf->cur_altsetting->desc.bInterfaceNumber) {
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300496 sms_debug("interface %d won't be used. Expecting interface %d to popup",
497 intf->cur_altsetting->desc.bInterfaceNumber,
498 sms_get_board(id->driver_info)->intf_num);
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300499 return -ENODEV;
500 }
501
502 if (intf->num_altsetting > 1) {
503 rc = usb_set_interface(udev,
504 intf->cur_altsetting->desc.bInterfaceNumber,
505 0);
Michael Krufky82237412008-06-15 15:14:13 -0300506 if (rc < 0) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300507 sms_err("usb_set_interface failed, rc %d", rc);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300508 return rc;
509 }
510 }
511
Michael Krufkya0c0abc2008-06-19 20:35:21 -0300512 sms_info("smsusb_probe %d",
Michael Krufky82237412008-06-15 15:14:13 -0300513 intf->cur_altsetting->desc.bInterfaceNumber);
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300514 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
Michael Krufkya0c0abc2008-06-19 20:35:21 -0300515 sms_info("endpoint %d %02x %02x %d", i,
Michael Krufky82237412008-06-15 15:14:13 -0300516 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress,
517 intf->cur_altsetting->endpoint[i].desc.bmAttributes,
518 intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize);
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300519 if (intf->cur_altsetting->endpoint[i].desc.bEndpointAddress &
520 USB_DIR_IN)
521 rc = usb_clear_halt(udev, usb_rcvbulkpipe(udev,
522 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress));
523 else
524 rc = usb_clear_halt(udev, usb_sndbulkpipe(udev,
525 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress));
526 }
Michael Krufky82237412008-06-15 15:14:13 -0300527 if ((udev->actconfig->desc.bNumInterfaces == 2) &&
528 (intf->cur_altsetting->desc.bInterfaceNumber == 0)) {
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300529 sms_debug("rom interface 0 is not used");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300530 return -ENODEV;
531 }
532
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300533 if (id->driver_info == SMS1XXX_BOARD_SIANO_STELLAR_ROM) {
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300534 /* Detected a Siano Stellar uninitialized */
535
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300536 snprintf(devpath, sizeof(devpath), "usb\\%d-%s",
537 udev->bus->busnum, udev->devpath);
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300538 sms_info("stellar device in cold state was found at %s.", devpath);
539 rc = smsusb1_load_firmware(
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300540 udev, smscore_registry_getmode(devpath),
541 id->driver_info);
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300542
543 /* This device will reset and gain another USB ID */
544 if (!rc)
545 sms_info("stellar device now in warm state");
546 else
547 sms_err("Failed to put stellar in warm state. Error: %d", rc);
548
549 return rc;
550 } else {
551 rc = smsusb_init_device(intf, id->driver_info);
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300552 }
553
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300554 sms_info("Device initialized with return code %d", rc);
Michael Krufky05860f22008-08-31 17:39:58 -0300555 sms_board_load_modules(id->driver_info);
Michael Krufkyf17407a2008-06-14 00:43:26 -0300556 return rc;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300557}
558
Michael Krufky0c071f32008-06-21 02:44:02 -0300559static void smsusb_disconnect(struct usb_interface *intf)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300560{
561 smsusb_term_device(intf);
562}
563
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300564static int smsusb_suspend(struct usb_interface *intf, pm_message_t msg)
565{
Joe Perches8350e152010-11-30 18:42:07 -0300566 struct smsusb_device_t *dev = usb_get_intfdata(intf);
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300567 printk(KERN_INFO "%s Entering status %d.\n", __func__, msg.event);
568 dev->state = SMSUSB_SUSPENDED;
569 /*smscore_set_power_mode(dev, SMS_POWER_MODE_SUSPENDED);*/
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300570 smsusb_stop_streaming(dev);
571 return 0;
572}
573
574static int smsusb_resume(struct usb_interface *intf)
575{
576 int rc, i;
Joe Perches8350e152010-11-30 18:42:07 -0300577 struct smsusb_device_t *dev = usb_get_intfdata(intf);
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300578 struct usb_device *udev = interface_to_usbdev(intf);
579
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300580 printk(KERN_INFO "%s Entering.\n", __func__);
581 usb_clear_halt(udev, usb_rcvbulkpipe(udev, dev->in_ep));
582 usb_clear_halt(udev, usb_sndbulkpipe(udev, dev->out_ep));
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300583
584 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++)
585 printk(KERN_INFO "endpoint %d %02x %02x %d\n", i,
586 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress,
587 intf->cur_altsetting->endpoint[i].desc.bmAttributes,
588 intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize);
589
590 if (intf->num_altsetting > 0) {
591 rc = usb_set_interface(udev,
592 intf->cur_altsetting->desc.
593 bInterfaceNumber, 0);
594 if (rc < 0) {
Michael Krufkyb9391f42008-08-31 16:08:15 -0300595 printk(KERN_INFO "%s usb_set_interface failed, "
596 "rc %d\n", __func__, rc);
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300597 return rc;
598 }
599 }
600
601 smsusb_start_streaming(dev);
602 return 0;
603}
604
Greg Kroah-Hartmand04dbd12012-08-17 17:48:26 -0700605static const struct usb_device_id smsusb_id_table[] = {
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300606 /* This device is only present before firmware load */
Michael Krufky841a3f02008-08-31 17:03:15 -0300607 { USB_DEVICE(0x187f, 0x0010),
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300608 .driver_info = SMS1XXX_BOARD_SIANO_STELLAR_ROM },
609 /* This device pops up after firmware load */
Michael Krufky841a3f02008-08-31 17:03:15 -0300610 { USB_DEVICE(0x187f, 0x0100),
611 .driver_info = SMS1XXX_BOARD_SIANO_STELLAR },
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300612
Michael Krufky841a3f02008-08-31 17:03:15 -0300613 { USB_DEVICE(0x187f, 0x0200),
614 .driver_info = SMS1XXX_BOARD_SIANO_NOVA_A },
615 { USB_DEVICE(0x187f, 0x0201),
616 .driver_info = SMS1XXX_BOARD_SIANO_NOVA_B },
617 { USB_DEVICE(0x187f, 0x0300),
618 .driver_info = SMS1XXX_BOARD_SIANO_VEGA },
Michael Krufky841a3f02008-08-31 17:03:15 -0300619 { USB_DEVICE(0x2040, 0x1700),
620 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT },
621 { USB_DEVICE(0x2040, 0x1800),
622 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A },
623 { USB_DEVICE(0x2040, 0x1801),
624 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B },
625 { USB_DEVICE(0x2040, 0x2000),
626 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
627 { USB_DEVICE(0x2040, 0x2009),
628 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2 },
629 { USB_DEVICE(0x2040, 0x200a),
630 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
631 { USB_DEVICE(0x2040, 0x2010),
632 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
633 { USB_DEVICE(0x2040, 0x2011),
634 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
635 { USB_DEVICE(0x2040, 0x2019),
636 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
637 { USB_DEVICE(0x2040, 0x5500),
638 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
639 { USB_DEVICE(0x2040, 0x5510),
640 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
641 { USB_DEVICE(0x2040, 0x5520),
642 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
643 { USB_DEVICE(0x2040, 0x5530),
644 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
645 { USB_DEVICE(0x2040, 0x5580),
646 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
647 { USB_DEVICE(0x2040, 0x5590),
648 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Uri Shkolnikd0b661802009-05-19 09:51:41 -0300649 { USB_DEVICE(0x187f, 0x0202),
650 .driver_info = SMS1XXX_BOARD_SIANO_NICE },
651 { USB_DEVICE(0x187f, 0x0301),
652 .driver_info = SMS1XXX_BOARD_SIANO_VENICE },
Michael Krufky78c948a2009-10-21 18:27:29 -0300653 { USB_DEVICE(0x2040, 0xb900),
654 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
655 { USB_DEVICE(0x2040, 0xb910),
656 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Michael Krufky20d15a22009-11-30 18:22:10 -0300657 { USB_DEVICE(0x2040, 0xb980),
658 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
659 { USB_DEVICE(0x2040, 0xb990),
660 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Michael Krufky78c948a2009-10-21 18:27:29 -0300661 { USB_DEVICE(0x2040, 0xc000),
662 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Michael Krufky20d15a22009-11-30 18:22:10 -0300663 { USB_DEVICE(0x2040, 0xc010),
664 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
665 { USB_DEVICE(0x2040, 0xc080),
666 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
667 { USB_DEVICE(0x2040, 0xc090),
668 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Michael Krufky4d1b58b2012-03-22 13:55:05 -0300669 { USB_DEVICE(0x2040, 0xc0a0),
670 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Michael Krufky3e1141e2012-05-25 09:29:12 -0300671 { USB_DEVICE(0x2040, 0xf5a0),
672 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300673 { USB_DEVICE(0x187f, 0x0202),
674 .driver_info = SMS1XXX_BOARD_SIANO_NICE },
675 { USB_DEVICE(0x187f, 0x0301),
676 .driver_info = SMS1XXX_BOARD_SIANO_VENICE },
677 { USB_DEVICE(0x187f, 0x0302),
678 .driver_info = SMS1XXX_BOARD_SIANO_VENICE },
679 { USB_DEVICE(0x187f, 0x0310),
680 .driver_info = SMS1XXX_BOARD_SIANO_MING },
681 { USB_DEVICE(0x187f, 0x0500),
682 .driver_info = SMS1XXX_BOARD_SIANO_PELE },
683 { USB_DEVICE(0x187f, 0x0600),
684 .driver_info = SMS1XXX_BOARD_SIANO_RIO },
685 { USB_DEVICE(0x187f, 0x0700),
686 .driver_info = SMS1XXX_BOARD_SIANO_DENVER_2160 },
687 { USB_DEVICE(0x187f, 0x0800),
688 .driver_info = SMS1XXX_BOARD_SIANO_DENVER_1530 },
689 { USB_DEVICE(0x19D2, 0x0086),
690 .driver_info = SMS1XXX_BOARD_ZTE_DVB_DATA_CARD },
691 { USB_DEVICE(0x19D2, 0x0078),
692 .driver_info = SMS1XXX_BOARD_ONDA_MDTV_DATA_CARD },
Satoshi Nagahamaf61e2262014-02-10 06:45:29 -0300693 { USB_DEVICE(0x3275, 0x0080),
694 .driver_info = SMS1XXX_BOARD_SIANO_RIO },
Mauro Carvalho Chehab29bbb7b2014-08-11 18:09:32 -0300695 { USB_DEVICE(0x2013, 0x0257),
696 .driver_info = SMS1XXX_BOARD_PCTV_77E },
Uri Shkolnikd0b661802009-05-19 09:51:41 -0300697 { } /* Terminating entry */
698 };
699
Michael Krufky841a3f02008-08-31 17:03:15 -0300700MODULE_DEVICE_TABLE(usb, smsusb_id_table);
701
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300702static struct usb_driver smsusb_driver = {
Uri Shkolnikdba843a2008-08-31 00:44:04 -0300703 .name = "smsusb",
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300704 .probe = smsusb_probe,
Michael Krufky82237412008-06-15 15:14:13 -0300705 .disconnect = smsusb_disconnect,
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300706 .id_table = smsusb_id_table,
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300707
708 .suspend = smsusb_suspend,
709 .resume = smsusb_resume,
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300710};
711
Greg Kroah-Hartmanecb3b2b2011-11-18 09:46:12 -0800712module_usb_driver(smsusb_driver);
Uri Shkolnike0f14c22008-08-31 00:44:04 -0300713
Uri Shkolnik05a073762009-05-17 09:17:51 -0300714MODULE_DESCRIPTION("Driver for the Siano SMS1xxx USB dongle");
Uri Shkolnike0f14c22008-08-31 00:44:04 -0300715MODULE_AUTHOR("Siano Mobile Silicon, INC. (uris@siano-ms.com)");
716MODULE_LICENSE("GPL");