sched: Remove double_rq_lock() from __migrate_task()
[linux/fpc-iii.git] / drivers / media / rc / img-ir / img-ir-jvc.c
blob10209d200efb58c7046eb58c1effef88f49a9c4b
1 /*
2 * ImgTec IR Decoder setup for JVC protocol.
4 * Copyright 2012-2014 Imagination Technologies Ltd.
5 */
7 #include "img-ir-hw.h"
9 /* Convert JVC data to a scancode */
10 static int img_ir_jvc_scancode(int len, u64 raw, int *scancode, u64 protocols)
12 unsigned int cust, data;
14 if (len != 16)
15 return -EINVAL;
17 cust = (raw >> 0) & 0xff;
18 data = (raw >> 8) & 0xff;
20 *scancode = cust << 8 | data;
21 return IMG_IR_SCANCODE;
24 /* Convert JVC scancode to JVC data filter */
25 static int img_ir_jvc_filter(const struct rc_scancode_filter *in,
26 struct img_ir_filter *out, u64 protocols)
28 unsigned int cust, data;
29 unsigned int cust_m, data_m;
31 cust = (in->data >> 8) & 0xff;
32 cust_m = (in->mask >> 8) & 0xff;
33 data = (in->data >> 0) & 0xff;
34 data_m = (in->mask >> 0) & 0xff;
36 out->data = cust | data << 8;
37 out->mask = cust_m | data_m << 8;
39 return 0;
43 * JVC decoder
44 * See also http://www.sbprojects.com/knowledge/ir/jvc.php
45 * http://support.jvc.com/consumer/support/documents/RemoteCodes.pdf
47 struct img_ir_decoder img_ir_jvc = {
48 .type = RC_BIT_JVC,
49 .control = {
50 .decoden = 1,
51 .code_type = IMG_IR_CODETYPE_PULSEDIST,
53 /* main timings */
54 .unit = 527500, /* 527.5 us */
55 .timings = {
56 /* leader symbol */
57 .ldr = {
58 .pulse = { 16 /* 8.44 ms */ },
59 .space = { 8 /* 4.22 ms */ },
61 /* 0 symbol */
62 .s00 = {
63 .pulse = { 1 /* 527.5 us +-60 us */ },
64 .space = { 1 /* 527.5 us */ },
66 /* 1 symbol */
67 .s01 = {
68 .pulse = { 1 /* 527.5 us +-60 us */ },
69 .space = { 3 /* 1.5825 ms +-40 us */ },
71 /* free time */
72 .ft = {
73 .minlen = 16,
74 .maxlen = 16,
75 .ft_min = 10, /* 5.275 ms */
78 /* scancode logic */
79 .scancode = img_ir_jvc_scancode,
80 .filter = img_ir_jvc_filter,