x86/mm/pat: Don't report PAT on CPUs that don't support it
[linux/fpc-iii.git] / drivers / media / rc / img-ir / img-ir-rc5.c
bloba8a28a377eee95d06941632c9e1a1d04231df517
1 /*
2 * ImgTec IR Decoder setup for Philips RC-5 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 RC5 data to a scancode */
15 static int img_ir_rc5_scancode(int len, u64 raw, u64 enabled_protocols,
16 struct img_ir_scancode_req *request)
18 unsigned int addr, cmd, tgl, start;
20 /* Quirk in the decoder shifts everything by 2 to the left. */
21 raw >>= 2;
23 start = (raw >> 13) & 0x01;
24 tgl = (raw >> 11) & 0x01;
25 addr = (raw >> 6) & 0x1f;
26 cmd = raw & 0x3f;
28 * 12th bit is used to extend the command in extended RC5 and has
29 * no effect on standard RC5.
31 cmd += ((raw >> 12) & 0x01) ? 0 : 0x40;
33 if (!start)
34 return -EINVAL;
36 request->protocol = RC_TYPE_RC5;
37 request->scancode = addr << 8 | cmd;
38 request->toggle = tgl;
39 return IMG_IR_SCANCODE;
42 /* Convert RC5 scancode to RC5 data filter */
43 static int img_ir_rc5_filter(const struct rc_scancode_filter *in,
44 struct img_ir_filter *out, u64 protocols)
46 /* Not supported by the hw. */
47 return -EINVAL;
51 * RC-5 decoder
52 * see http://www.sbprojects.com/knowledge/ir/rc5.php
54 struct img_ir_decoder img_ir_rc5 = {
55 .type = RC_BIT_RC5,
56 .control = {
57 .bitoriend2 = 1,
58 .code_type = IMG_IR_CODETYPE_BIPHASE,
59 .decodend2 = 1,
61 /* main timings */
62 .tolerance = 16,
63 .unit = 888888, /* 1/36k*32=888.888microseconds */
64 .timings = {
65 /* 10 symbol */
66 .s10 = {
67 .pulse = { 1 },
68 .space = { 1 },
71 /* 11 symbol */
72 .s11 = {
73 .pulse = { 1 },
74 .space = { 1 },
77 /* free time */
78 .ft = {
79 .minlen = 14,
80 .maxlen = 14,
81 .ft_min = 5,
85 /* scancode logic */
86 .scancode = img_ir_rc5_scancode,
87 .filter = img_ir_rc5_filter,