diff options
author | Sean Young <sean@mess.org> | 2013-01-14 03:51:44 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-05 16:00:48 -0500 |
commit | c6a3ea570e5d0ca20069cce5d537c845128b70f4 (patch) | |
tree | b26f02446076bc28685a06e61e7c3e3dbb47f3e4 /drivers/media/rc/iguanair.c | |
parent | d0aab6564d12add07572141ceb34c60046e93ac3 (diff) |
[media] iguanair: intermittent initialization failure
On cold boot the device does not initialize until the first packet is
received, and that packet is not processed.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc/iguanair.c')
-rw-r--r-- | drivers/media/rc/iguanair.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c index b8b3e37e5c57..a4ab2e6b3f82 100644 --- a/drivers/media/rc/iguanair.c +++ b/drivers/media/rc/iguanair.c | |||
@@ -58,6 +58,7 @@ struct iguanair { | |||
58 | char phys[64]; | 58 | char phys[64]; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | #define CMD_NOP 0x00 | ||
61 | #define CMD_GET_VERSION 0x01 | 62 | #define CMD_GET_VERSION 0x01 |
62 | #define CMD_GET_BUFSIZE 0x11 | 63 | #define CMD_GET_BUFSIZE 0x11 |
63 | #define CMD_GET_FEATURES 0x10 | 64 | #define CMD_GET_FEATURES 0x10 |
@@ -196,6 +197,10 @@ static void iguanair_irq_out(struct urb *urb) | |||
196 | 197 | ||
197 | if (urb->status) | 198 | if (urb->status) |
198 | dev_dbg(ir->dev, "Error: out urb status = %d\n", urb->status); | 199 | dev_dbg(ir->dev, "Error: out urb status = %d\n", urb->status); |
200 | |||
201 | /* if we sent an nop packet, do not expect a response */ | ||
202 | if (urb->status == 0 && ir->packet->header.cmd == CMD_NOP) | ||
203 | complete(&ir->completion); | ||
199 | } | 204 | } |
200 | 205 | ||
201 | static int iguanair_send(struct iguanair *ir, unsigned size) | 206 | static int iguanair_send(struct iguanair *ir, unsigned size) |
@@ -219,10 +224,17 @@ static int iguanair_get_features(struct iguanair *ir) | |||
219 | { | 224 | { |
220 | int rc; | 225 | int rc; |
221 | 226 | ||
227 | /* | ||
228 | * On cold boot, the iguanair initializes on the first packet | ||
229 | * received but does not process that packet. Send an empty | ||
230 | * packet. | ||
231 | */ | ||
222 | ir->packet->header.start = 0; | 232 | ir->packet->header.start = 0; |
223 | ir->packet->header.direction = DIR_OUT; | 233 | ir->packet->header.direction = DIR_OUT; |
224 | ir->packet->header.cmd = CMD_GET_VERSION; | 234 | ir->packet->header.cmd = CMD_NOP; |
235 | iguanair_send(ir, sizeof(ir->packet->header)); | ||
225 | 236 | ||
237 | ir->packet->header.cmd = CMD_GET_VERSION; | ||
226 | rc = iguanair_send(ir, sizeof(ir->packet->header)); | 238 | rc = iguanair_send(ir, sizeof(ir->packet->header)); |
227 | if (rc) { | 239 | if (rc) { |
228 | dev_info(ir->dev, "failed to get version\n"); | 240 | dev_info(ir->dev, "failed to get version\n"); |
@@ -255,19 +267,14 @@ static int iguanair_get_features(struct iguanair *ir) | |||
255 | ir->packet->header.cmd = CMD_GET_FEATURES; | 267 | ir->packet->header.cmd = CMD_GET_FEATURES; |
256 | 268 | ||
257 | rc = iguanair_send(ir, sizeof(ir->packet->header)); | 269 | rc = iguanair_send(ir, sizeof(ir->packet->header)); |
258 | if (rc) { | 270 | if (rc) |
259 | dev_info(ir->dev, "failed to get features\n"); | 271 | dev_info(ir->dev, "failed to get features\n"); |
260 | goto out; | ||
261 | } | ||
262 | |||
263 | out: | 272 | out: |
264 | return rc; | 273 | return rc; |
265 | } | 274 | } |
266 | 275 | ||
267 | static int iguanair_receiver(struct iguanair *ir, bool enable) | 276 | static int iguanair_receiver(struct iguanair *ir, bool enable) |
268 | { | 277 | { |
269 | int rc; | ||
270 | |||
271 | ir->packet->header.start = 0; | 278 | ir->packet->header.start = 0; |
272 | ir->packet->header.direction = DIR_OUT; | 279 | ir->packet->header.direction = DIR_OUT; |
273 | ir->packet->header.cmd = enable ? CMD_RECEIVER_ON : CMD_RECEIVER_OFF; | 280 | ir->packet->header.cmd = enable ? CMD_RECEIVER_ON : CMD_RECEIVER_OFF; |
@@ -275,9 +282,7 @@ static int iguanair_receiver(struct iguanair *ir, bool enable) | |||
275 | if (enable) | 282 | if (enable) |
276 | ir_raw_event_reset(ir->rc); | 283 | ir_raw_event_reset(ir->rc); |
277 | 284 | ||
278 | rc = iguanair_send(ir, sizeof(ir->packet->header)); | 285 | return iguanair_send(ir, sizeof(ir->packet->header)); |
279 | |||
280 | return rc; | ||
281 | } | 286 | } |
282 | 287 | ||
283 | /* | 288 | /* |