blob: 244674599878c1dd9ab655d1129a4d0bb16b2f4c [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
Mauro Carvalho Chehab5e022d12015-02-22 10:46:56 -030022#include "smscoreapi.h"
23
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030024#include <linux/kernel.h>
25#include <linux/init.h>
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030026#include <linux/usb.h>
27#include <linux/firmware.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090028#include <linux/slab.h>
Paul Gortmaker7a707b82011-07-03 14:03:12 -040029#include <linux/module.h>
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030030
Michael Krufky1c11d542008-06-18 22:09:55 -030031#include "sms-cards.h"
Uri Shkolnikc7ce8d32009-05-12 08:24:07 -030032#include "smsendian.h"
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030033
Michael Krufky0d02efe2009-02-27 02:42:16 -030034static int sms_dbg;
35module_param_named(debug, sms_dbg, int, 0644);
36MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))");
37
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030038#define USB1_BUFFER_SIZE 0x1000
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030039#define USB2_BUFFER_SIZE 0x2000
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030040
41#define MAX_BUFFERS 50
42#define MAX_URBS 10
43
Michael Krufky18245e12008-06-15 17:52:24 -030044struct smsusb_device_t;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030045
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030046enum smsusb_state {
47 SMSUSB_DISCONNECTED,
48 SMSUSB_SUSPENDED,
49 SMSUSB_ACTIVE
50};
51
Michael Krufky18245e12008-06-15 17:52:24 -030052struct smsusb_urb_t {
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030053 struct list_head entry;
Michael Krufky18245e12008-06-15 17:52:24 -030054 struct smscore_buffer_t *cb;
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030055 struct smsusb_device_t *dev;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030056
Michael Krufky18245e12008-06-15 17:52:24 -030057 struct urb urb;
58};
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030059
Michael Krufky18245e12008-06-15 17:52:24 -030060struct smsusb_device_t {
Michael Krufkya83ccdd2008-05-06 03:11:51 -030061 struct usb_device *udev;
Michael Krufky18245e12008-06-15 17:52:24 -030062 struct smscore_device_t *coredev;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030063
Michael Krufky18245e12008-06-15 17:52:24 -030064 struct smsusb_urb_t surbs[MAX_URBS];
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030065
Michael Krufky82237412008-06-15 15:14:13 -030066 int response_alignment;
67 int buffer_size;
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030068
69 unsigned char in_ep;
70 unsigned char out_ep;
71 enum smsusb_state state;
Michael Krufky18245e12008-06-15 17:52:24 -030072};
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030073
Michael Krufky0c071f32008-06-21 02:44:02 -030074static int smsusb_submit_urb(struct smsusb_device_t *dev,
75 struct smsusb_urb_t *surb);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030076
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -030077/**
78 * Completing URB's callback handler - top half (interrupt context)
79 * adds completing sms urb to the global surbs list and activtes the worker
80 * thread the surb
81 * IMPORTANT - blocking functions must not be called from here !!!
82
83 * @param urb pointer to a completing urb object
84 */
Michael Krufky0c071f32008-06-21 02:44:02 -030085static void smsusb_onresponse(struct urb *urb)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030086{
Michael Krufky18245e12008-06-15 17:52:24 -030087 struct smsusb_urb_t *surb = (struct smsusb_urb_t *) urb->context;
88 struct smsusb_device_t *dev = surb->dev;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030089
Uri Shkolnik8f12d0a2009-05-12 11:28:41 -030090 if (urb->status == -ESHUTDOWN) {
91 sms_err("error, urb status %d (-ESHUTDOWN), %d bytes",
Michael Krufkyeb250942008-06-19 22:07:23 -030092 urb->status, urb->actual_length);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030093 return;
94 }
95
Uri Shkolnik8f12d0a2009-05-12 11:28:41 -030096 if ((urb->actual_length > 0) && (urb->status == 0)) {
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -030097 struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)surb->cb->p;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -030098
Uri Shkolnik9c9c68a2009-05-14 16:27:16 -030099 smsendian_handle_message_header(phdr);
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300100 if (urb->actual_length >= phdr->msg_length) {
101 surb->cb->size = phdr->msg_length;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300102
Michael Krufky82237412008-06-15 15:14:13 -0300103 if (dev->response_alignment &&
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300104 (phdr->msg_flags & MSG_HDR_FLAG_SPLIT_MSG)) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300105
Michael Krufky82237412008-06-15 15:14:13 -0300106 surb->cb->offset =
107 dev->response_alignment +
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300108 ((phdr->msg_flags >> 8) & 3);
Michael Krufky82237412008-06-15 15:14:13 -0300109
110 /* sanity check */
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300111 if (((int) phdr->msg_length +
Michael Krufky82237412008-06-15 15:14:13 -0300112 surb->cb->offset) > urb->actual_length) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300113 sms_err("invalid response "
114 "msglen %d offset %d "
115 "size %d",
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300116 phdr->msg_length,
Michael Krufkyeb250942008-06-19 22:07:23 -0300117 surb->cb->offset,
118 urb->actual_length);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300119 goto exit_and_resubmit;
120 }
121
Michael Krufky82237412008-06-15 15:14:13 -0300122 /* move buffer pointer and
123 * copy header to its new location */
Michael Krufky55ad3102008-05-06 03:52:44 -0300124 memcpy((char *) phdr + surb->cb->offset,
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300125 phdr, sizeof(struct sms_msg_hdr));
Michael Krufky82237412008-06-15 15:14:13 -0300126 } else
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300127 surb->cb->offset = 0;
128
Mauro Carvalho Chehab4c3bdb52013-03-09 09:27:39 -0300129 sms_debug("received %s(%d) size: %d",
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300130 smscore_translate_msg(phdr->msg_type),
131 phdr->msg_type, phdr->msg_length);
Mauro Carvalho Chehab4c3bdb52013-03-09 09:27:39 -0300132
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300133 smsendian_handle_rx_message((struct sms_msg_data *) phdr);
Mauro Carvalho Chehab80ccb512013-03-09 11:34:56 -0300134
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300135 smscore_onresponse(dev->coredev, surb->cb);
136 surb->cb = NULL;
Michael Krufky82237412008-06-15 15:14:13 -0300137 } else {
Michael Krufkyeb250942008-06-19 22:07:23 -0300138 sms_err("invalid response "
139 "msglen %d actual %d",
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300140 phdr->msg_length, urb->actual_length);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300141 }
Uri Shkolnik8f12d0a2009-05-12 11:28:41 -0300142 } else
143 sms_err("error, urb status %d, %d bytes",
144 urb->status, urb->actual_length);
145
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300146
147exit_and_resubmit:
148 smsusb_submit_urb(dev, surb);
149}
150
Michael Krufky0c071f32008-06-21 02:44:02 -0300151static int smsusb_submit_urb(struct smsusb_device_t *dev,
152 struct smsusb_urb_t *surb)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300153{
Michael Krufky82237412008-06-15 15:14:13 -0300154 if (!surb->cb) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300155 surb->cb = smscore_getbuffer(dev->coredev);
Michael Krufky82237412008-06-15 15:14:13 -0300156 if (!surb->cb) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300157 sms_err("smscore_getbuffer(...) returned NULL");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300158 return -ENOMEM;
159 }
160 }
161
162 usb_fill_bulk_urb(
163 &surb->urb,
164 dev->udev,
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300165 usb_rcvbulkpipe(dev->udev, dev->in_ep),
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300166 surb->cb->p,
167 dev->buffer_size,
168 smsusb_onresponse,
169 surb
170 );
171 surb->urb.transfer_dma = surb->cb->phys;
172 surb->urb.transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
173
174 return usb_submit_urb(&surb->urb, GFP_ATOMIC);
175}
176
Michael Krufky0c071f32008-06-21 02:44:02 -0300177static void smsusb_stop_streaming(struct smsusb_device_t *dev)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300178{
179 int i;
180
Michael Krufkyfa830e82008-06-15 15:52:43 -0300181 for (i = 0; i < MAX_URBS; i++) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300182 usb_kill_urb(&dev->surbs[i].urb);
183
Michael Krufky82237412008-06-15 15:14:13 -0300184 if (dev->surbs[i].cb) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300185 smscore_putbuffer(dev->coredev, dev->surbs[i].cb);
186 dev->surbs[i].cb = NULL;
187 }
188 }
189}
190
Michael Krufky0c071f32008-06-21 02:44:02 -0300191static int smsusb_start_streaming(struct smsusb_device_t *dev)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300192{
193 int i, rc;
194
Michael Krufkyfa830e82008-06-15 15:52:43 -0300195 for (i = 0; i < MAX_URBS; i++) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300196 rc = smsusb_submit_urb(dev, &dev->surbs[i]);
Michael Krufky82237412008-06-15 15:14:13 -0300197 if (rc < 0) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300198 sms_err("smsusb_submit_urb(...) failed");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300199 smsusb_stop_streaming(dev);
200 break;
201 }
202 }
203
204 return rc;
205}
206
Michael Krufky0c071f32008-06-21 02:44:02 -0300207static int smsusb_sendrequest(void *context, void *buffer, size_t size)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300208{
Michael Krufky18245e12008-06-15 17:52:24 -0300209 struct smsusb_device_t *dev = (struct smsusb_device_t *) context;
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300210 struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) buffer;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300211 int dummy;
212
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300213 if (dev->state != SMSUSB_ACTIVE) {
214 sms_debug("Device not active yet");
Mauro Carvalho Chehab80ccb512013-03-09 11:34:56 -0300215 return -ENOENT;
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300216 }
Mauro Carvalho Chehab80ccb512013-03-09 11:34:56 -0300217
Mauro Carvalho Chehab4c3bdb52013-03-09 09:27:39 -0300218 sms_debug("sending %s(%d) size: %d",
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300219 smscore_translate_msg(phdr->msg_type), phdr->msg_type,
220 phdr->msg_length);
Mauro Carvalho Chehab4c3bdb52013-03-09 09:27:39 -0300221
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300222 smsendian_handle_tx_message((struct sms_msg_data *) phdr);
223 smsendian_handle_message_header((struct sms_msg_hdr *)buffer);
Michael Krufky82237412008-06-15 15:14:13 -0300224 return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2),
225 buffer, size, &dummy, 1000);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300226}
227
Michael Krufky0c071f32008-06-21 02:44:02 -0300228static char *smsusb1_fw_lkup[] = {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300229 "dvbt_stellar_usb.inp",
230 "dvbh_stellar_usb.inp",
231 "tdmb_stellar_usb.inp",
232 "none",
233 "dvbt_bda_stellar_usb.inp",
234};
235
Michael Krufky1fbc3ca2008-07-01 04:35:26 -0300236static inline char *sms_get_fw_name(int mode, int board_id)
237{
238 char **fw = sms_get_board(board_id)->fw;
239 return (fw && fw[mode]) ? fw[mode] : smsusb1_fw_lkup[mode];
240}
241
242static int smsusb1_load_firmware(struct usb_device *udev, int id, int board_id)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300243{
244 const struct firmware *fw;
Michael Krufkya83ccdd2008-05-06 03:11:51 -0300245 u8 *fw_buffer;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300246 int rc, dummy;
Michael Krufky1fbc3ca2008-07-01 04:35:26 -0300247 char *fw_filename;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300248
Mauro Carvalho Chehabb00ade22013-09-12 17:04:07 -0300249 if (id < 0)
250 id = sms_get_board(board_id)->default_mode;
251
Michael Krufky82237412008-06-15 15:14:13 -0300252 if (id < DEVICE_MODE_DVBT || id > DEVICE_MODE_DVBT_BDA) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300253 sms_err("invalid firmware id specified %d", id);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300254 return -EINVAL;
255 }
256
Michael Krufky1fbc3ca2008-07-01 04:35:26 -0300257 fw_filename = sms_get_fw_name(id, board_id);
258
259 rc = request_firmware(&fw, fw_filename, &udev->dev);
Michael Krufky82237412008-06-15 15:14:13 -0300260 if (rc < 0) {
Mauro Carvalho Chehab535bd1e2015-02-22 10:55:55 -0300261 pr_warn("failed to open '%s' mode %d, trying again with default firmware\n",
262 fw_filename, id);
Michael Krufky1fbc3ca2008-07-01 04:35:26 -0300263
264 fw_filename = smsusb1_fw_lkup[id];
265 rc = request_firmware(&fw, fw_filename, &udev->dev);
266 if (rc < 0) {
Mauro Carvalho Chehab535bd1e2015-02-22 10:55:55 -0300267 pr_warn("failed to open '%s' mode %d\n",
Michael Krufky1fbc3ca2008-07-01 04:35:26 -0300268 fw_filename, id);
269
270 return rc;
271 }
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300272 }
273
274 fw_buffer = kmalloc(fw->size, GFP_KERNEL);
Michael Krufky82237412008-06-15 15:14:13 -0300275 if (fw_buffer) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300276 memcpy(fw_buffer, fw->data, fw->size);
277
Michael Krufky82237412008-06-15 15:14:13 -0300278 rc = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 2),
279 fw_buffer, fw->size, &dummy, 1000);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300280
Mauro Carvalho Chehab7983b772014-09-24 20:36:07 -0300281 sms_info("sent %zu(%d) bytes, rc %d", fw->size, dummy, rc);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300282
283 kfree(fw_buffer);
Michael Krufky82237412008-06-15 15:14:13 -0300284 } else {
Michael Krufkyeb250942008-06-19 22:07:23 -0300285 sms_err("failed to allocate firmware buffer");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300286 rc = -ENOMEM;
287 }
Mauro Carvalho Chehab7983b772014-09-24 20:36:07 -0300288 sms_info("read FW %s, size=%zu", fw_filename, fw->size);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300289
290 release_firmware(fw);
291
292 return rc;
293}
294
Michael Krufky0c071f32008-06-21 02:44:02 -0300295static void smsusb1_detectmode(void *context, int *mode)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300296{
Michael Krufky18245e12008-06-15 17:52:24 -0300297 char *product_string =
298 ((struct smsusb_device_t *) context)->udev->product;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300299
300 *mode = DEVICE_MODE_NONE;
301
Michael Krufky82237412008-06-15 15:14:13 -0300302 if (!product_string) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300303 product_string = "none";
Michael Krufkya0c0abc2008-06-19 20:35:21 -0300304 sms_err("product string not found");
Michael Krufky82237412008-06-15 15:14:13 -0300305 } else if (strstr(product_string, "DVBH"))
306 *mode = 1;
307 else if (strstr(product_string, "BDA"))
308 *mode = 4;
309 else if (strstr(product_string, "DVBT"))
310 *mode = 0;
311 else if (strstr(product_string, "TDMB"))
312 *mode = 2;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300313
Michael Krufkya0c0abc2008-06-19 20:35:21 -0300314 sms_info("%d \"%s\"", *mode, product_string);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300315}
316
Michael Krufky0c071f32008-06-21 02:44:02 -0300317static int smsusb1_setmode(void *context, int mode)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300318{
Mauro Carvalho Chehab28a59df2013-03-21 09:27:37 -0300319 struct sms_msg_hdr msg = { MSG_SW_RELOAD_REQ, 0, HIF_TASK,
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300320 sizeof(struct sms_msg_hdr), 0 };
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300321
Michael Krufky82237412008-06-15 15:14:13 -0300322 if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300323 sms_err("invalid firmware id specified %d", mode);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300324 return -EINVAL;
325 }
326
Mauro Carvalho Chehab28a59df2013-03-21 09:27:37 -0300327 return smsusb_sendrequest(context, &msg, sizeof(msg));
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300328}
329
Michael Krufky0c071f32008-06-21 02:44:02 -0300330static void smsusb_term_device(struct usb_interface *intf)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300331{
Joe Perches8350e152010-11-30 18:42:07 -0300332 struct smsusb_device_t *dev = usb_get_intfdata(intf);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300333
Michael Krufky82237412008-06-15 15:14:13 -0300334 if (dev) {
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300335 dev->state = SMSUSB_DISCONNECTED;
336
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300337 smsusb_stop_streaming(dev);
338
Michael Krufkyfa830e82008-06-15 15:52:43 -0300339 /* unregister from smscore */
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300340 if (dev->coredev)
341 smscore_unregister_device(dev->coredev);
342
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300343 sms_info("device 0x%p destroyed", dev);
Jesper Juhl08921ac2011-04-21 18:11:25 -0300344 kfree(dev);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300345 }
346
347 usb_set_intfdata(intf, NULL);
348}
349
Mauro Carvalho Chehab46b1e212015-01-07 08:03:03 -0300350static void siano_media_device_register(struct smsusb_device_t *dev)
351{
352#ifdef CONFIG_MEDIA_CONTROLLER_DVB
353 struct media_device *mdev;
354 struct usb_device *udev = dev->udev;
355 int board_id = smscore_get_board_id(dev->coredev);
356 struct sms_board *board = sms_get_board(board_id);
357 int ret;
358
359 mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
360 if (!mdev)
361 return;
362
363 mdev->dev = &udev->dev;
364 strlcpy(mdev->model, board->name, sizeof(mdev->model));
365 if (udev->serial)
366 strlcpy(mdev->serial, udev->serial, sizeof(mdev->serial));
367 strcpy(mdev->bus_info, udev->devpath);
368 mdev->hw_revision = le16_to_cpu(udev->descriptor.bcdDevice);
369 mdev->driver_version = LINUX_VERSION_CODE;
370
371 ret = media_device_register(mdev);
372 if (ret) {
373 sms_err("Couldn't create a media device. Error: %d\n",
374 ret);
375 kfree(mdev);
376 return;
377 }
378
379 dev->coredev->media_dev = mdev;
380
381 sms_info("media controller created");
382
383#endif
384}
385
Michael Krufky0c071f32008-06-21 02:44:02 -0300386static int smsusb_init_device(struct usb_interface *intf, int board_id)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300387{
Michael Krufky18245e12008-06-15 17:52:24 -0300388 struct smsdevice_params_t params;
389 struct smsusb_device_t *dev;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300390 int i, rc;
391
Michael Krufkyfa830e82008-06-15 15:52:43 -0300392 /* create device object */
Michael Krufky18245e12008-06-15 17:52:24 -0300393 dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL);
Michael Krufky82237412008-06-15 15:14:13 -0300394 if (!dev) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300395 sms_err("kzalloc(sizeof(struct smsusb_device_t) failed");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300396 return -ENOMEM;
397 }
398
399 memset(&params, 0, sizeof(params));
400 usb_set_intfdata(intf, dev);
401 dev->udev = interface_to_usbdev(intf);
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300402 dev->state = SMSUSB_DISCONNECTED;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300403
Michael Krufky2708e882008-06-21 05:24:38 -0300404 params.device_type = sms_get_board(board_id)->type;
Michael Krufky73104fb2008-06-14 18:27:18 -0300405
Michael Krufky2708e882008-06-21 05:24:38 -0300406 switch (params.device_type) {
Michael Krufky1c11d542008-06-18 22:09:55 -0300407 case SMS_STELLAR:
Michael Krufkyf17407a2008-06-14 00:43:26 -0300408 dev->buffer_size = USB1_BUFFER_SIZE;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300409
Michael Krufkyf17407a2008-06-14 00:43:26 -0300410 params.setmode_handler = smsusb1_setmode;
411 params.detectmode_handler = smsusb1_detectmode;
Michael Krufkyf17407a2008-06-14 00:43:26 -0300412 break;
Mauro Carvalho Chehab07bb6bd2013-03-19 12:59:50 -0300413 case SMS_UNKNOWN_TYPE:
Michael Krufky2708e882008-06-21 05:24:38 -0300414 sms_err("Unspecified sms device type!");
415 /* fall-thru */
Mauro Carvalho Chehab07bb6bd2013-03-19 12:59:50 -0300416 default:
Michael Krufkyf17407a2008-06-14 00:43:26 -0300417 dev->buffer_size = USB2_BUFFER_SIZE;
Michael Krufky82237412008-06-15 15:14:13 -0300418 dev->response_alignment =
Uri Shkolnikc7ce8d32009-05-12 08:24:07 -0300419 le16_to_cpu(dev->udev->ep_in[1]->desc.wMaxPacketSize) -
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300420 sizeof(struct sms_msg_hdr);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300421
Michael Krufkyf17407a2008-06-14 00:43:26 -0300422 params.flags |= SMS_DEVICE_FAMILY2;
423 break;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300424 }
425
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300426 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
427 if (intf->cur_altsetting->endpoint[i].desc. bEndpointAddress & USB_DIR_IN)
428 dev->in_ep = intf->cur_altsetting->endpoint[i].desc.bEndpointAddress;
429 else
430 dev->out_ep = intf->cur_altsetting->endpoint[i].desc.bEndpointAddress;
431 }
432
433 sms_info("in_ep = %02x, out_ep = %02x",
434 dev->in_ep, dev->out_ep);
435
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300436 params.device = &dev->udev->dev;
437 params.buffer_size = dev->buffer_size;
438 params.num_buffers = MAX_BUFFERS;
439 params.sendrequest_handler = smsusb_sendrequest;
440 params.context = dev;
Mauro Carvalho Chehab1722f3b2010-08-01 15:30:50 -0300441 usb_make_path(dev->udev, params.devpath, sizeof(params.devpath));
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300442
Michael Krufky82237412008-06-15 15:14:13 -0300443 /* register in smscore */
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300444 rc = smscore_register_device(&params, &dev->coredev);
Michael Krufky82237412008-06-15 15:14:13 -0300445 if (rc < 0) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300446 sms_err("smscore_register_device(...) failed, rc %d", rc);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300447 smsusb_term_device(intf);
448 return rc;
449 }
450
Michael Krufky1c11d542008-06-18 22:09:55 -0300451 smscore_set_board_id(dev->coredev, board_id);
452
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -0300453 dev->coredev->is_usb_device = true;
454
Michael Krufkyfa830e82008-06-15 15:52:43 -0300455 /* initialize urbs */
Michael Krufky82237412008-06-15 15:14:13 -0300456 for (i = 0; i < MAX_URBS; i++) {
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300457 dev->surbs[i].dev = dev;
458 usb_init_urb(&dev->surbs[i].urb);
459 }
460
Michael Krufkya0c0abc2008-06-19 20:35:21 -0300461 sms_info("smsusb_start_streaming(...).");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300462 rc = smsusb_start_streaming(dev);
Michael Krufky82237412008-06-15 15:14:13 -0300463 if (rc < 0) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300464 sms_err("smsusb_start_streaming(...) failed");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300465 smsusb_term_device(intf);
466 return rc;
467 }
468
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300469 dev->state = SMSUSB_ACTIVE;
470
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300471 rc = smscore_start_device(dev->coredev);
Michael Krufky82237412008-06-15 15:14:13 -0300472 if (rc < 0) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300473 sms_err("smscore_start_device(...) failed");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300474 smsusb_term_device(intf);
475 return rc;
476 }
477
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300478 sms_info("device 0x%p created", dev);
Mauro Carvalho Chehab46b1e212015-01-07 08:03:03 -0300479 siano_media_device_register(dev);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300480
481 return rc;
482}
483
Greg Kroah-Hartman4c62e972012-12-21 13:17:53 -0800484static int smsusb_probe(struct usb_interface *intf,
Michael Krufky0c071f32008-06-21 02:44:02 -0300485 const struct usb_device_id *id)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300486{
487 struct usb_device *udev = interface_to_usbdev(intf);
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300488 char devpath[32];
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300489 int i, rc;
490
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300491 sms_info("board id=%lu, interface number %d",
492 id->driver_info,
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300493 intf->cur_altsetting->desc.bInterfaceNumber);
Michael Krufkyf17407a2008-06-14 00:43:26 -0300494
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300495 if (sms_get_board(id->driver_info)->intf_num !=
496 intf->cur_altsetting->desc.bInterfaceNumber) {
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300497 sms_debug("interface %d won't be used. Expecting interface %d to popup",
498 intf->cur_altsetting->desc.bInterfaceNumber,
499 sms_get_board(id->driver_info)->intf_num);
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300500 return -ENODEV;
501 }
502
503 if (intf->num_altsetting > 1) {
504 rc = usb_set_interface(udev,
505 intf->cur_altsetting->desc.bInterfaceNumber,
506 0);
Michael Krufky82237412008-06-15 15:14:13 -0300507 if (rc < 0) {
Michael Krufkyeb250942008-06-19 22:07:23 -0300508 sms_err("usb_set_interface failed, rc %d", rc);
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300509 return rc;
510 }
511 }
512
Michael Krufkya0c0abc2008-06-19 20:35:21 -0300513 sms_info("smsusb_probe %d",
Michael Krufky82237412008-06-15 15:14:13 -0300514 intf->cur_altsetting->desc.bInterfaceNumber);
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300515 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
Michael Krufkya0c0abc2008-06-19 20:35:21 -0300516 sms_info("endpoint %d %02x %02x %d", i,
Michael Krufky82237412008-06-15 15:14:13 -0300517 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress,
518 intf->cur_altsetting->endpoint[i].desc.bmAttributes,
519 intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize);
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300520 if (intf->cur_altsetting->endpoint[i].desc.bEndpointAddress &
521 USB_DIR_IN)
522 rc = usb_clear_halt(udev, usb_rcvbulkpipe(udev,
523 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress));
524 else
525 rc = usb_clear_halt(udev, usb_sndbulkpipe(udev,
526 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress));
527 }
Michael Krufky82237412008-06-15 15:14:13 -0300528 if ((udev->actconfig->desc.bNumInterfaces == 2) &&
529 (intf->cur_altsetting->desc.bInterfaceNumber == 0)) {
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300530 sms_debug("rom interface 0 is not used");
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300531 return -ENODEV;
532 }
533
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300534 if (id->driver_info == SMS1XXX_BOARD_SIANO_STELLAR_ROM) {
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300535 /* Detected a Siano Stellar uninitialized */
536
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300537 snprintf(devpath, sizeof(devpath), "usb\\%d-%s",
538 udev->bus->busnum, udev->devpath);
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300539 sms_info("stellar device in cold state was found at %s.", devpath);
540 rc = smsusb1_load_firmware(
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300541 udev, smscore_registry_getmode(devpath),
542 id->driver_info);
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300543
544 /* This device will reset and gain another USB ID */
545 if (!rc)
546 sms_info("stellar device now in warm state");
547 else
548 sms_err("Failed to put stellar in warm state. Error: %d", rc);
549
550 return rc;
551 } else {
552 rc = smsusb_init_device(intf, id->driver_info);
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300553 }
554
Mauro Carvalho Chehabf43b3962013-09-12 16:59:59 -0300555 sms_info("Device initialized with return code %d", rc);
Michael Krufky05860f22008-08-31 17:39:58 -0300556 sms_board_load_modules(id->driver_info);
Michael Krufkyf17407a2008-06-14 00:43:26 -0300557 return rc;
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300558}
559
Michael Krufky0c071f32008-06-21 02:44:02 -0300560static void smsusb_disconnect(struct usb_interface *intf)
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300561{
562 smsusb_term_device(intf);
563}
564
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300565static int smsusb_suspend(struct usb_interface *intf, pm_message_t msg)
566{
Joe Perches8350e152010-11-30 18:42:07 -0300567 struct smsusb_device_t *dev = usb_get_intfdata(intf);
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300568 printk(KERN_INFO "%s Entering status %d.\n", __func__, msg.event);
569 dev->state = SMSUSB_SUSPENDED;
570 /*smscore_set_power_mode(dev, SMS_POWER_MODE_SUSPENDED);*/
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300571 smsusb_stop_streaming(dev);
572 return 0;
573}
574
575static int smsusb_resume(struct usb_interface *intf)
576{
577 int rc, i;
Joe Perches8350e152010-11-30 18:42:07 -0300578 struct smsusb_device_t *dev = usb_get_intfdata(intf);
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300579 struct usb_device *udev = interface_to_usbdev(intf);
580
Mauro Carvalho Chehab05f0ffb2013-03-06 09:53:50 -0300581 printk(KERN_INFO "%s Entering.\n", __func__);
582 usb_clear_halt(udev, usb_rcvbulkpipe(udev, dev->in_ep));
583 usb_clear_halt(udev, usb_sndbulkpipe(udev, dev->out_ep));
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300584
585 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++)
586 printk(KERN_INFO "endpoint %d %02x %02x %d\n", i,
587 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress,
588 intf->cur_altsetting->endpoint[i].desc.bmAttributes,
589 intf->cur_altsetting->endpoint[i].desc.wMaxPacketSize);
590
591 if (intf->num_altsetting > 0) {
592 rc = usb_set_interface(udev,
593 intf->cur_altsetting->desc.
594 bInterfaceNumber, 0);
595 if (rc < 0) {
Michael Krufkyb9391f42008-08-31 16:08:15 -0300596 printk(KERN_INFO "%s usb_set_interface failed, "
597 "rc %d\n", __func__, rc);
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300598 return rc;
599 }
600 }
601
602 smsusb_start_streaming(dev);
603 return 0;
604}
605
Greg Kroah-Hartmand04dbd12012-08-17 17:48:26 -0700606static const struct usb_device_id smsusb_id_table[] = {
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300607 /* This device is only present before firmware load */
Michael Krufky841a3f02008-08-31 17:03:15 -0300608 { USB_DEVICE(0x187f, 0x0010),
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300609 .driver_info = SMS1XXX_BOARD_SIANO_STELLAR_ROM },
610 /* This device pops up after firmware load */
Michael Krufky841a3f02008-08-31 17:03:15 -0300611 { USB_DEVICE(0x187f, 0x0100),
612 .driver_info = SMS1XXX_BOARD_SIANO_STELLAR },
Mauro Carvalho Chehab811a4f62013-09-12 17:00:00 -0300613
Michael Krufky841a3f02008-08-31 17:03:15 -0300614 { USB_DEVICE(0x187f, 0x0200),
615 .driver_info = SMS1XXX_BOARD_SIANO_NOVA_A },
616 { USB_DEVICE(0x187f, 0x0201),
617 .driver_info = SMS1XXX_BOARD_SIANO_NOVA_B },
618 { USB_DEVICE(0x187f, 0x0300),
619 .driver_info = SMS1XXX_BOARD_SIANO_VEGA },
Michael Krufky841a3f02008-08-31 17:03:15 -0300620 { USB_DEVICE(0x2040, 0x1700),
621 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT },
622 { USB_DEVICE(0x2040, 0x1800),
623 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A },
624 { USB_DEVICE(0x2040, 0x1801),
625 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B },
626 { USB_DEVICE(0x2040, 0x2000),
627 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
628 { USB_DEVICE(0x2040, 0x2009),
629 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2 },
630 { USB_DEVICE(0x2040, 0x200a),
631 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
632 { USB_DEVICE(0x2040, 0x2010),
633 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
634 { USB_DEVICE(0x2040, 0x2011),
635 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
636 { USB_DEVICE(0x2040, 0x2019),
637 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
638 { USB_DEVICE(0x2040, 0x5500),
639 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
640 { USB_DEVICE(0x2040, 0x5510),
641 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
642 { USB_DEVICE(0x2040, 0x5520),
643 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
644 { USB_DEVICE(0x2040, 0x5530),
645 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
646 { USB_DEVICE(0x2040, 0x5580),
647 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
648 { USB_DEVICE(0x2040, 0x5590),
649 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Uri Shkolnikd0b661802009-05-19 09:51:41 -0300650 { USB_DEVICE(0x187f, 0x0202),
651 .driver_info = SMS1XXX_BOARD_SIANO_NICE },
652 { USB_DEVICE(0x187f, 0x0301),
653 .driver_info = SMS1XXX_BOARD_SIANO_VENICE },
Michael Krufky78c948a2009-10-21 18:27:29 -0300654 { USB_DEVICE(0x2040, 0xb900),
655 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
656 { USB_DEVICE(0x2040, 0xb910),
657 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Michael Krufky20d15a22009-11-30 18:22:10 -0300658 { USB_DEVICE(0x2040, 0xb980),
659 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
660 { USB_DEVICE(0x2040, 0xb990),
661 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Michael Krufky78c948a2009-10-21 18:27:29 -0300662 { USB_DEVICE(0x2040, 0xc000),
663 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Michael Krufky20d15a22009-11-30 18:22:10 -0300664 { USB_DEVICE(0x2040, 0xc010),
665 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
666 { USB_DEVICE(0x2040, 0xc080),
667 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
668 { USB_DEVICE(0x2040, 0xc090),
669 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Michael Krufky4d1b58b2012-03-22 13:55:05 -0300670 { USB_DEVICE(0x2040, 0xc0a0),
671 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Michael Krufky3e1141e2012-05-25 09:29:12 -0300672 { USB_DEVICE(0x2040, 0xf5a0),
673 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
Mauro Carvalho Chehab347d8f12013-03-05 22:35:44 -0300674 { USB_DEVICE(0x187f, 0x0202),
675 .driver_info = SMS1XXX_BOARD_SIANO_NICE },
676 { USB_DEVICE(0x187f, 0x0301),
677 .driver_info = SMS1XXX_BOARD_SIANO_VENICE },
678 { USB_DEVICE(0x187f, 0x0302),
679 .driver_info = SMS1XXX_BOARD_SIANO_VENICE },
680 { USB_DEVICE(0x187f, 0x0310),
681 .driver_info = SMS1XXX_BOARD_SIANO_MING },
682 { USB_DEVICE(0x187f, 0x0500),
683 .driver_info = SMS1XXX_BOARD_SIANO_PELE },
684 { USB_DEVICE(0x187f, 0x0600),
685 .driver_info = SMS1XXX_BOARD_SIANO_RIO },
686 { USB_DEVICE(0x187f, 0x0700),
687 .driver_info = SMS1XXX_BOARD_SIANO_DENVER_2160 },
688 { USB_DEVICE(0x187f, 0x0800),
689 .driver_info = SMS1XXX_BOARD_SIANO_DENVER_1530 },
690 { USB_DEVICE(0x19D2, 0x0086),
691 .driver_info = SMS1XXX_BOARD_ZTE_DVB_DATA_CARD },
692 { USB_DEVICE(0x19D2, 0x0078),
693 .driver_info = SMS1XXX_BOARD_ONDA_MDTV_DATA_CARD },
Satoshi Nagahamaf61e2262014-02-10 06:45:29 -0300694 { USB_DEVICE(0x3275, 0x0080),
695 .driver_info = SMS1XXX_BOARD_SIANO_RIO },
Mauro Carvalho Chehab29bbb7b2014-08-11 18:09:32 -0300696 { USB_DEVICE(0x2013, 0x0257),
697 .driver_info = SMS1XXX_BOARD_PCTV_77E },
Uri Shkolnikd0b661802009-05-19 09:51:41 -0300698 { } /* Terminating entry */
699 };
700
Michael Krufky841a3f02008-08-31 17:03:15 -0300701MODULE_DEVICE_TABLE(usb, smsusb_id_table);
702
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300703static struct usb_driver smsusb_driver = {
Uri Shkolnikdba843a2008-08-31 00:44:04 -0300704 .name = "smsusb",
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300705 .probe = smsusb_probe,
Michael Krufky82237412008-06-15 15:14:13 -0300706 .disconnect = smsusb_disconnect,
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300707 .id_table = smsusb_id_table,
Uri Shkolnik2f56c342008-11-22 14:08:46 -0300708
709 .suspend = smsusb_suspend,
710 .resume = smsusb_resume,
Michael Krufky2e5c1ec82008-05-19 18:56:13 -0300711};
712
Greg Kroah-Hartmanecb3b2b2011-11-18 09:46:12 -0800713module_usb_driver(smsusb_driver);
Uri Shkolnike0f14c22008-08-31 00:44:04 -0300714
Uri Shkolnik05a073762009-05-17 09:17:51 -0300715MODULE_DESCRIPTION("Driver for the Siano SMS1xxx USB dongle");
Uri Shkolnike0f14c22008-08-31 00:44:04 -0300716MODULE_AUTHOR("Siano Mobile Silicon, INC. (uris@siano-ms.com)");
717MODULE_LICENSE("GPL");