This source file includes following definitions.
- img_ir_sharp_scancode
- img_ir_sharp_filter
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 #include "img-ir-hw.h"
   9 
  10 
  11 static int img_ir_sharp_scancode(int len, u64 raw, u64 enabled_protocols,
  12                                  struct img_ir_scancode_req *request)
  13 {
  14         unsigned int addr, cmd, exp, chk;
  15 
  16         if (len != 15)
  17                 return -EINVAL;
  18 
  19         addr = (raw >>   0) & 0x1f;
  20         cmd  = (raw >>   5) & 0xff;
  21         exp  = (raw >>  13) &  0x1;
  22         chk  = (raw >>  14) &  0x1;
  23 
  24         
  25         if (!exp)
  26                 return -EINVAL;
  27         if (chk)
  28                 
  29                 return -EINVAL;
  30 
  31         request->protocol = RC_PROTO_SHARP;
  32         request->scancode = addr << 8 | cmd;
  33         return IMG_IR_SCANCODE;
  34 }
  35 
  36 
  37 static int img_ir_sharp_filter(const struct rc_scancode_filter *in,
  38                                struct img_ir_filter *out, u64 protocols)
  39 {
  40         unsigned int addr, cmd, exp = 0, chk = 0;
  41         unsigned int addr_m, cmd_m, exp_m = 0, chk_m = 0;
  42 
  43         addr   = (in->data >> 8) & 0x1f;
  44         addr_m = (in->mask >> 8) & 0x1f;
  45         cmd    = (in->data >> 0) & 0xff;
  46         cmd_m  = (in->mask >> 0) & 0xff;
  47         if (cmd_m) {
  48                 
  49                 exp   = 1;
  50                 exp_m = 1;
  51                 chk   = 0;
  52                 chk_m = 1;
  53         }
  54 
  55         out->data = addr        |
  56                     cmd   <<  5 |
  57                     exp   << 13 |
  58                     chk   << 14;
  59         out->mask = addr_m      |
  60                     cmd_m <<  5 |
  61                     exp_m << 13 |
  62                     chk_m << 14;
  63 
  64         return 0;
  65 }
  66 
  67 
  68 
  69 
  70 
  71 struct img_ir_decoder img_ir_sharp = {
  72         .type = RC_PROTO_BIT_SHARP,
  73         .control = {
  74                 .decoden = 0,
  75                 .decodend2 = 1,
  76                 .code_type = IMG_IR_CODETYPE_PULSEDIST,
  77                 .d1validsel = 1,
  78         },
  79         
  80         .tolerance = 20,        
  81         .timings = {
  82                 
  83                 .s10 = {
  84                         .pulse = { 320   },
  85                         .space = { 680   },
  86                 },
  87                 
  88                 .s11 = {
  89                         .pulse = { 320   },
  90                         .space = { 1680  },
  91                 },
  92                 
  93                 .ft = {
  94                         .minlen = 15,
  95                         .maxlen = 15,
  96                         .ft_min = 5000, 
  97                 },
  98         },
  99         
 100         .scancode = img_ir_sharp_scancode,
 101         .filter = img_ir_sharp_filter,
 102 };