aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Baradon <kevin.baradon@gmail.com>2013-02-18 12:42:47 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-21 17:34:25 -0400
commit26ccbec44a7c62de4fef4f33bb858963e501921d (patch)
treeb85b4a3409e906a970ad7d833b5ff0258d9b43e9
parent15170025ee26946dc61f3c21e54652c6db4a0326 (diff)
[media] media/rc/imon.c: make send_packet() delay larger for 15c2:0036
Some imon devices (like 15c2:0036) need a higher delay between send_packet calls. Default value is still 5ms to avoid regressions on already working hardware. Also use interruptible wait to avoid load average going too high (and let caller handle signals). Signed-off-by: Kevin Baradon <kevin.baradon@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/rc/imon.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index dec203bb06f6..178b94660b58 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -112,6 +112,7 @@ struct imon_context {
112 bool tx_control; 112 bool tx_control;
113 unsigned char usb_rx_buf[8]; 113 unsigned char usb_rx_buf[8];
114 unsigned char usb_tx_buf[8]; 114 unsigned char usb_tx_buf[8];
115 unsigned int send_packet_delay;
115 116
116 struct tx_t { 117 struct tx_t {
117 unsigned char data_buf[35]; /* user data buffer */ 118 unsigned char data_buf[35]; /* user data buffer */
@@ -185,6 +186,10 @@ enum {
185 IMON_KEY_PANEL = 2, 186 IMON_KEY_PANEL = 2,
186}; 187};
187 188
189enum {
190 IMON_NEED_20MS_PKT_DELAY = 1
191};
192
188/* 193/*
189 * USB Device ID for iMON USB Control Boards 194 * USB Device ID for iMON USB Control Boards
190 * 195 *
@@ -215,7 +220,7 @@ static struct usb_device_id imon_usb_id_table[] = {
215 /* SoundGraph iMON OEM Touch LCD (IR & 4.3" VGA LCD) */ 220 /* SoundGraph iMON OEM Touch LCD (IR & 4.3" VGA LCD) */
216 { USB_DEVICE(0x15c2, 0x0035) }, 221 { USB_DEVICE(0x15c2, 0x0035) },
217 /* SoundGraph iMON OEM VFD (IR & VFD) */ 222 /* SoundGraph iMON OEM VFD (IR & VFD) */
218 { USB_DEVICE(0x15c2, 0x0036) }, 223 { USB_DEVICE(0x15c2, 0x0036), .driver_info = IMON_NEED_20MS_PKT_DELAY },
219 /* device specifics unknown */ 224 /* device specifics unknown */
220 { USB_DEVICE(0x15c2, 0x0037) }, 225 { USB_DEVICE(0x15c2, 0x0037) },
221 /* SoundGraph iMON OEM LCD (IR & LCD) */ 226 /* SoundGraph iMON OEM LCD (IR & LCD) */
@@ -535,12 +540,12 @@ static int send_packet(struct imon_context *ictx)
535 kfree(control_req); 540 kfree(control_req);
536 541
537 /* 542 /*
538 * Induce a mandatory 5ms delay before returning, as otherwise, 543 * Induce a mandatory delay before returning, as otherwise,
539 * send_packet can get called so rapidly as to overwhelm the device, 544 * send_packet can get called so rapidly as to overwhelm the device,
540 * particularly on faster systems and/or those with quirky usb. 545 * particularly on faster systems and/or those with quirky usb.
541 */ 546 */
542 timeout = msecs_to_jiffies(5); 547 timeout = msecs_to_jiffies(ictx->send_packet_delay);
543 set_current_state(TASK_UNINTERRUPTIBLE); 548 set_current_state(TASK_INTERRUPTIBLE);
544 schedule_timeout(timeout); 549 schedule_timeout(timeout);
545 550
546 return retval; 551 return retval;
@@ -2335,6 +2340,10 @@ static int imon_probe(struct usb_interface *interface,
2335 2340
2336 } 2341 }
2337 2342
2343 /* default send_packet delay is 5ms but some devices need more */
2344 ictx->send_packet_delay = id->driver_info & IMON_NEED_20MS_PKT_DELAY ?
2345 20 : 5;
2346
2338 usb_set_intfdata(interface, ictx); 2347 usb_set_intfdata(interface, ictx);
2339 2348
2340 if (ifnum == 0) { 2349 if (ifnum == 0) {