Input: xpad - add support for Xbox1 PDP Camo series gamepad
[linux/fpc-iii.git] / drivers / media / rc / img-ir / img-ir-jvc.c
blobd3e2fc0bcfe12aa97c78385fa587ce65486496e0
1 /*
2 * ImgTec IR Decoder setup for JVC protocol.
4 * Copyright 2012-2014 Imagination Technologies Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
12 #include "img-ir-hw.h"
14 /* Convert JVC data to a scancode */
15 static int img_ir_jvc_scancode(int len, u64 raw, u64 enabled_protocols,
16 struct img_ir_scancode_req *request)
18 unsigned int cust, data;
20 if (len != 16)
21 return -EINVAL;
23 cust = (raw >> 0) & 0xff;
24 data = (raw >> 8) & 0xff;
26 request->protocol = RC_TYPE_JVC;
27 request->scancode = cust << 8 | data;
28 return IMG_IR_SCANCODE;
31 /* Convert JVC scancode to JVC data filter */
32 static int img_ir_jvc_filter(const struct rc_scancode_filter *in,
33 struct img_ir_filter *out, u64 protocols)
35 unsigned int cust, data;
36 unsigned int cust_m, data_m;
38 cust = (in->data >> 8) & 0xff;
39 cust_m = (in->mask >> 8) & 0xff;
40 data = (in->data >> 0) & 0xff;
41 data_m = (in->mask >> 0) & 0xff;
43 out->data = cust | data << 8;
44 out->mask = cust_m | data_m << 8;
46 return 0;
50 * JVC decoder
51 * See also http://www.sbprojects.com/knowledge/ir/jvc.php
52 * http://support.jvc.com/consumer/support/documents/RemoteCodes.pdf
54 struct img_ir_decoder img_ir_jvc = {
55 .type = RC_BIT_JVC,
56 .control = {
57 .decoden = 1,
58 .code_type = IMG_IR_CODETYPE_PULSEDIST,
60 /* main timings */
61 .unit = 527500, /* 527.5 us */
62 .timings = {
63 /* leader symbol */
64 .ldr = {
65 .pulse = { 16 /* 8.44 ms */ },
66 .space = { 8 /* 4.22 ms */ },
68 /* 0 symbol */
69 .s00 = {
70 .pulse = { 1 /* 527.5 us +-60 us */ },
71 .space = { 1 /* 527.5 us */ },
73 /* 1 symbol */
74 .s01 = {
75 .pulse = { 1 /* 527.5 us +-60 us */ },
76 .space = { 3 /* 1.5825 ms +-40 us */ },
78 /* free time */
79 .ft = {
80 .minlen = 16,
81 .maxlen = 16,
82 .ft_min = 10, /* 5.275 ms */
85 /* scancode logic */
86 .scancode = img_ir_jvc_scancode,
87 .filter = img_ir_jvc_filter,