123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- #include "img-ir-hw.h"
- static int img_ir_sanyo_scancode(int len, u64 raw, u64 enabled_protocols,
- struct img_ir_scancode_req *request)
- {
- unsigned int addr, addr_inv, data, data_inv;
-
- if (!len)
- return IMG_IR_REPEATCODE;
- if (len != 42)
- return -EINVAL;
- addr = (raw >> 0) & 0x1fff;
- addr_inv = (raw >> 13) & 0x1fff;
- data = (raw >> 26) & 0xff;
- data_inv = (raw >> 34) & 0xff;
-
- if ((data_inv ^ data) != 0xff)
- return -EINVAL;
-
- if ((addr_inv ^ addr) != 0x1fff)
- return -EINVAL;
-
- request->protocol = RC_TYPE_SANYO;
- request->scancode = addr << 8 | data;
- return IMG_IR_SCANCODE;
- }
- static int img_ir_sanyo_filter(const struct rc_scancode_filter *in,
- struct img_ir_filter *out, u64 protocols)
- {
- unsigned int addr, addr_inv, data, data_inv;
- unsigned int addr_m, data_m;
- data = in->data & 0xff;
- data_m = in->mask & 0xff;
- data_inv = data ^ 0xff;
- if (in->data & 0xff700000)
- return -EINVAL;
- addr = (in->data >> 8) & 0x1fff;
- addr_m = (in->mask >> 8) & 0x1fff;
- addr_inv = addr ^ 0x1fff;
- out->data = (u64)data_inv << 34 |
- (u64)data << 26 |
- addr_inv << 13 |
- addr;
- out->mask = (u64)data_m << 34 |
- (u64)data_m << 26 |
- addr_m << 13 |
- addr_m;
- return 0;
- }
- struct img_ir_decoder img_ir_sanyo = {
- .type = RC_BIT_SANYO,
- .control = {
- .decoden = 1,
- .code_type = IMG_IR_CODETYPE_PULSEDIST,
- },
-
- .unit = 562500,
- .timings = {
-
- .ldr = {
- .pulse = { 16 },
- .space = { 8 },
- },
-
- .s00 = {
- .pulse = { 1 },
- .space = { 1 },
- },
-
- .s01 = {
- .pulse = { 1 },
- .space = { 3 },
- },
-
- .ft = {
- .minlen = 42,
- .maxlen = 42,
- .ft_min = 10,
- },
- },
-
- .repeat = 108,
- .rtimings = {
-
- .ldr = {
- .space = { 4 },
- },
-
- .ft = {
- .minlen = 0,
- .maxlen = 0,
- },
- },
-
- .scancode = img_ir_sanyo_scancode,
- .filter = img_ir_sanyo_filter,
- };
|