1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * ImgTec IR Decoder setup for JVC protocol.
5 * Copyright 2012-2014 Imagination Technologies Ltd.
10 /* Convert JVC data to a scancode */
11 static int img_ir_jvc_scancode(int len
, u64 raw
, u64 enabled_protocols
,
12 struct img_ir_scancode_req
*request
)
14 unsigned int cust
, data
;
19 cust
= (raw
>> 0) & 0xff;
20 data
= (raw
>> 8) & 0xff;
22 request
->protocol
= RC_PROTO_JVC
;
23 request
->scancode
= cust
<< 8 | data
;
24 return IMG_IR_SCANCODE
;
27 /* Convert JVC scancode to JVC data filter */
28 static int img_ir_jvc_filter(const struct rc_scancode_filter
*in
,
29 struct img_ir_filter
*out
, u64 protocols
)
31 unsigned int cust
, data
;
32 unsigned int cust_m
, data_m
;
34 cust
= (in
->data
>> 8) & 0xff;
35 cust_m
= (in
->mask
>> 8) & 0xff;
36 data
= (in
->data
>> 0) & 0xff;
37 data_m
= (in
->mask
>> 0) & 0xff;
39 out
->data
= cust
| data
<< 8;
40 out
->mask
= cust_m
| data_m
<< 8;
47 * See also http://www.sbprojects.com/knowledge/ir/jvc.php
48 * http://support.jvc.com/consumer/support/documents/RemoteCodes.pdf
50 struct img_ir_decoder img_ir_jvc
= {
51 .type
= RC_PROTO_BIT_JVC
,
54 .code_type
= IMG_IR_CODETYPE_PULSEDIST
,
57 .unit
= 527500, /* 527.5 us */
61 .pulse
= { 16 /* 8.44 ms */ },
62 .space
= { 8 /* 4.22 ms */ },
66 .pulse
= { 1 /* 527.5 us +-60 us */ },
67 .space
= { 1 /* 527.5 us */ },
71 .pulse
= { 1 /* 527.5 us +-60 us */ },
72 .space
= { 3 /* 1.5825 ms +-40 us */ },
78 .ft_min
= 10, /* 5.275 ms */
82 .scancode
= img_ir_jvc_scancode
,
83 .filter
= img_ir_jvc_filter
,