diff options
author | Sean Young <sean@mess.org> | 2012-08-13 08:59:47 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-13 16:19:12 -0300 |
commit | b83bfd1b0127b0963fcac39280280e365e7e04d8 (patch) | |
tree | 3a7d76ffb8844af1ce9ffb5299d6f2726699c3e5 /drivers/media/rc/ttusbir.c | |
parent | 0938069fa08970f1c898970c1331a029efe9a1ce (diff) | |
download | op-kernel-dev-b83bfd1b0127b0963fcac39280280e365e7e04d8.zip op-kernel-dev-b83bfd1b0127b0963fcac39280280e365e7e04d8.tar.gz |
[media] rc: do not wake up rc thread unless there is something to do
The TechnoTrend USB IR Receiver sends 125 ISO URBs per second, even when
there is no IR activity. Reduce the number of wake ups from the other
drivers too.
This saves about 0.25ms/s on a 2.4GHz Core 2 according to powertop.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc/ttusbir.c')
-rw-r--r-- | drivers/media/rc/ttusbir.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c index 71f03ac..1aee57f 100644 --- a/drivers/media/rc/ttusbir.c +++ b/drivers/media/rc/ttusbir.c @@ -121,8 +121,9 @@ static void ttusbir_bulk_complete(struct urb *urb) */ static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf) { + struct ir_raw_event rawir; unsigned i, v, b; - DEFINE_IR_RAW_EVENT(rawir); + bool event = false; init_ir_raw_event(&rawir); @@ -132,12 +133,14 @@ static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf) case 0xfe: rawir.pulse = false; rawir.duration = NS_PER_BYTE; - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; break; case 0: rawir.pulse = true; rawir.duration = NS_PER_BYTE; - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; break; default: /* one edge per byte */ @@ -150,16 +153,20 @@ static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf) } rawir.duration = NS_PER_BIT * (8 - b); - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; rawir.pulse = !rawir.pulse; rawir.duration = NS_PER_BIT * b; - ir_raw_event_store_with_filter(tt->rc, &rawir); + if (ir_raw_event_store_with_filter(tt->rc, &rawir)) + event = true; break; } } - ir_raw_event_handle(tt->rc); + /* don't wakeup when there's nothing to do */ + if (event) + ir_raw_event_handle(tt->rc); } static void ttusbir_urb_complete(struct urb *urb) |