| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* ir-rc6-decoder.c - A decoder for the RC6 IR protocol |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (C) 2010 by David Härdeman <david@hardeman.nu> |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 7 | | - * the Free Software Foundation version 2 of the License. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | - * GNU General Public License for more details. |
|---|
| 13 | 5 | */ |
|---|
| 14 | 6 | |
|---|
| 15 | 7 | #include "rc-core-priv.h" |
|---|
| .. | .. |
|---|
| 23 | 15 | * RC6-6A-32 (MCE version with toggle bit in body) |
|---|
| 24 | 16 | */ |
|---|
| 25 | 17 | |
|---|
| 26 | | -#define RC6_UNIT 444444 /* nanosecs */ |
|---|
| 18 | +#define RC6_UNIT 444 /* microseconds */ |
|---|
| 27 | 19 | #define RC6_HEADER_NBITS 4 /* not including toggle bit */ |
|---|
| 28 | 20 | #define RC6_0_NBITS 16 |
|---|
| 29 | 21 | #define RC6_6A_32_NBITS 32 |
|---|
| .. | .. |
|---|
| 40 | 32 | #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ |
|---|
| 41 | 33 | #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ |
|---|
| 42 | 34 | #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ |
|---|
| 35 | +#define RC6_6A_ZOTAC_CC 0x80340000 /* Zotac customer code */ |
|---|
| 43 | 36 | #define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */ |
|---|
| 44 | 37 | #ifndef CHAR_BIT |
|---|
| 45 | 38 | #define CHAR_BIT 8 /* Normally in <limits.h> */ |
|---|
| .. | .. |
|---|
| 71 | 64 | case 6: |
|---|
| 72 | 65 | if (!data->toggle) |
|---|
| 73 | 66 | return RC6_MODE_6A; |
|---|
| 74 | | - /* fall through */ |
|---|
| 67 | + fallthrough; |
|---|
| 75 | 68 | default: |
|---|
| 76 | 69 | return RC6_MODE_UNKNOWN; |
|---|
| 77 | 70 | } |
|---|
| .. | .. |
|---|
| 102 | 95 | |
|---|
| 103 | 96 | again: |
|---|
| 104 | 97 | dev_dbg(&dev->dev, "RC6 decode started at state %i (%uus %s)\n", |
|---|
| 105 | | - data->state, TO_US(ev.duration), TO_STR(ev.pulse)); |
|---|
| 98 | + data->state, ev.duration, TO_STR(ev.pulse)); |
|---|
| 106 | 99 | |
|---|
| 107 | 100 | if (!geq_margin(ev.duration, RC6_UNIT, RC6_UNIT / 2)) |
|---|
| 108 | 101 | return 0; |
|---|
| .. | .. |
|---|
| 246 | 239 | switch (scancode & RC6_6A_LCC_MASK) { |
|---|
| 247 | 240 | case RC6_6A_MCE_CC: |
|---|
| 248 | 241 | case RC6_6A_KATHREIN_CC: |
|---|
| 242 | + case RC6_6A_ZOTAC_CC: |
|---|
| 249 | 243 | protocol = RC_PROTO_RC6_MCE; |
|---|
| 250 | 244 | toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); |
|---|
| 251 | 245 | scancode &= ~RC6_6A_MCE_TOGGLE_MASK; |
|---|
| .. | .. |
|---|
| 276 | 270 | |
|---|
| 277 | 271 | out: |
|---|
| 278 | 272 | dev_dbg(&dev->dev, "RC6 decode failed at state %i (%uus %s)\n", |
|---|
| 279 | | - data->state, TO_US(ev.duration), TO_STR(ev.pulse)); |
|---|
| 273 | + data->state, ev.duration, TO_STR(ev.pulse)); |
|---|
| 280 | 274 | data->state = STATE_INACTIVE; |
|---|
| 281 | 275 | return -EINVAL; |
|---|
| 282 | 276 | } |
|---|