hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/media/rc/ir-rc6-decoder.c
....@@ -1,15 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* ir-rc6-decoder.c - A decoder for the RC6 IR protocol
23 *
34 * 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.
135 */
146
157 #include "rc-core-priv.h"
....@@ -23,7 +15,7 @@
2315 * RC6-6A-32 (MCE version with toggle bit in body)
2416 */
2517
26
-#define RC6_UNIT 444444 /* nanosecs */
18
+#define RC6_UNIT 444 /* microseconds */
2719 #define RC6_HEADER_NBITS 4 /* not including toggle bit */
2820 #define RC6_0_NBITS 16
2921 #define RC6_6A_32_NBITS 32
....@@ -40,6 +32,7 @@
4032 #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */
4133 #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */
4234 #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */
35
+#define RC6_6A_ZOTAC_CC 0x80340000 /* Zotac customer code */
4336 #define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */
4437 #ifndef CHAR_BIT
4538 #define CHAR_BIT 8 /* Normally in <limits.h> */
....@@ -71,7 +64,7 @@
7164 case 6:
7265 if (!data->toggle)
7366 return RC6_MODE_6A;
74
- /* fall through */
67
+ fallthrough;
7568 default:
7669 return RC6_MODE_UNKNOWN;
7770 }
....@@ -102,7 +95,7 @@
10295
10396 again:
10497 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));
10699
107100 if (!geq_margin(ev.duration, RC6_UNIT, RC6_UNIT / 2))
108101 return 0;
....@@ -246,6 +239,7 @@
246239 switch (scancode & RC6_6A_LCC_MASK) {
247240 case RC6_6A_MCE_CC:
248241 case RC6_6A_KATHREIN_CC:
242
+ case RC6_6A_ZOTAC_CC:
249243 protocol = RC_PROTO_RC6_MCE;
250244 toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK);
251245 scancode &= ~RC6_6A_MCE_TOGGLE_MASK;
....@@ -276,7 +270,7 @@
276270
277271 out:
278272 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));
280274 data->state = STATE_INACTIVE;
281275 return -EINVAL;
282276 }