aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/ttusbir.c
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2012-08-13 07:59:47 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-13 15:19:12 -0400
commitb83bfd1b0127b0963fcac39280280e365e7e04d8 (patch)
tree3a7d76ffb8844af1ce9ffb5299d6f2726699c3e5 /drivers/media/rc/ttusbir.c
parent0938069fa08970f1c898970c1331a029efe9a1ce (diff)
[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.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
index 71f03acabac8..1aee57fd2f32 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)
121 */ 121 */
122static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf) 122static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf)
123{ 123{
124 struct ir_raw_event rawir;
124 unsigned i, v, b; 125 unsigned i, v, b;
125 DEFINE_IR_RAW_EVENT(rawir); 126 bool event = false;
126 127
127 init_ir_raw_event(&rawir); 128 init_ir_raw_event(&rawir);
128 129
@@ -132,12 +133,14 @@ static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf)
132 case 0xfe: 133 case 0xfe:
133 rawir.pulse = false; 134 rawir.pulse = false;
134 rawir.duration = NS_PER_BYTE; 135 rawir.duration = NS_PER_BYTE;
135 ir_raw_event_store_with_filter(tt->rc, &rawir); 136 if (ir_raw_event_store_with_filter(tt->rc, &rawir))
137 event = true;
136 break; 138 break;
137 case 0: 139 case 0:
138 rawir.pulse = true; 140 rawir.pulse = true;
139 rawir.duration = NS_PER_BYTE; 141 rawir.duration = NS_PER_BYTE;
140 ir_raw_event_store_with_filter(tt->rc, &rawir); 142 if (ir_raw_event_store_with_filter(tt->rc, &rawir))
143 event = true;
141 break; 144 break;
142 default: 145 default:
143 /* one edge per byte */ 146 /* one edge per byte */
@@ -150,16 +153,20 @@ static void ttusbir_process_ir_data(struct ttusbir *tt, uint8_t *buf)
150 } 153 }
151 154
152 rawir.duration = NS_PER_BIT * (8 - b); 155 rawir.duration = NS_PER_BIT * (8 - b);
153 ir_raw_event_store_with_filter(tt->rc, &rawir); 156 if (ir_raw_event_store_with_filter(tt->rc, &rawir))
157 event = true;
154 158
155 rawir.pulse = !rawir.pulse; 159 rawir.pulse = !rawir.pulse;
156 rawir.duration = NS_PER_BIT * b; 160 rawir.duration = NS_PER_BIT * b;
157 ir_raw_event_store_with_filter(tt->rc, &rawir); 161 if (ir_raw_event_store_with_filter(tt->rc, &rawir))
162 event = true;
158 break; 163 break;
159 } 164 }
160 } 165 }
161 166
162 ir_raw_event_handle(tt->rc); 167 /* don't wakeup when there's nothing to do */
168 if (event)
169 ir_raw_event_handle(tt->rc);
163} 170}
164 171
165static void ttusbir_urb_complete(struct urb *urb) 172static void ttusbir_urb_complete(struct urb *urb)