1
2
3
4
5
6
7
8#include "img-ir-hw.h"
9
10
11static int img_ir_rc6_scancode(int len, u64 raw, u64 enabled_protocols,
12 struct img_ir_scancode_req *request)
13{
14 unsigned int addr, cmd, mode, trl1, trl2;
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 raw >>= 27;
34
35 trl1 = (raw >> 17) & 0x01;
36 trl2 = (raw >> 16) & 0x01;
37
38 mode = (raw >> 18) & 0x07;
39 addr = (raw >> 8) & 0xff;
40 cmd = raw & 0xff;
41
42
43
44
45
46 if (trl1 == trl2)
47 return -EINVAL;
48
49
50 if (mode)
51 return -EINVAL;
52
53 request->protocol = RC_PROTO_RC6_0;
54 request->scancode = addr << 8 | cmd;
55 request->toggle = trl2;
56 return IMG_IR_SCANCODE;
57}
58
59
60static int img_ir_rc6_filter(const struct rc_scancode_filter *in,
61 struct img_ir_filter *out, u64 protocols)
62{
63
64 return -EINVAL;
65}
66
67
68
69
70
71struct img_ir_decoder img_ir_rc6 = {
72 .type = RC_PROTO_BIT_RC6_0,
73 .control = {
74 .bitorien = 1,
75 .code_type = IMG_IR_CODETYPE_BIPHASE,
76 .decoden = 1,
77 .decodinpol = 1,
78 },
79
80 .tolerance = 20,
81
82
83
84
85
86 .timings = {
87
88 .ldr = {
89 .pulse = { 650 },
90 .space = { 660 },
91 },
92
93 .s00 = {
94 .pulse = { 370 },
95 .space = { 370 },
96 },
97
98 .s01 = {
99 .pulse = { 370 },
100 .space = { 370 },
101 },
102
103 .ft = {
104 .minlen = 21,
105 .maxlen = 21,
106 .ft_min = 2666,
107 },
108 },
109
110
111 .scancode = img_ir_rc6_scancode,
112 .filter = img_ir_rc6_filter,
113};
114