hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/media/rc/ir-xmp-decoder.c
....@@ -1,15 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* ir-xmp-decoder.c - handle XMP IR Pulse/Space protocol
23 *
34 * Copyright (C) 2014 by Marcel Mol
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 * - Based on info from http://www.hifi-remote.com
157 * - Ignore Toggle=9 frames
....@@ -20,11 +12,12 @@
2012 #include <linux/module.h>
2113 #include "rc-core-priv.h"
2214
23
-#define XMP_UNIT 136000 /* ns */
24
-#define XMP_LEADER 210000 /* ns */
25
-#define XMP_NIBBLE_PREFIX 760000 /* ns */
26
-#define XMP_HALFFRAME_SPACE 13800000 /* ns */
27
-#define XMP_TRAILER_SPACE 20000000 /* should be 80ms but not all dureation supliers can go that high */
15
+#define XMP_UNIT 136 /* us */
16
+#define XMP_LEADER 210 /* us */
17
+#define XMP_NIBBLE_PREFIX 760 /* us */
18
+#define XMP_HALFFRAME_SPACE 13800 /* us */
19
+/* should be 80ms but not all duration supliers can go that high */
20
+#define XMP_TRAILER_SPACE 20000
2821
2922 enum xmp_state {
3023 STATE_INACTIVE,
....@@ -50,7 +43,7 @@
5043 }
5144
5245 dev_dbg(&dev->dev, "XMP decode started at state %d %d (%uus %s)\n",
53
- data->state, data->count, TO_US(ev.duration), TO_STR(ev.pulse));
46
+ data->state, data->count, ev.duration, TO_STR(ev.pulse));
5447
5548 switch (data->state) {
5649
....@@ -94,7 +87,7 @@
9487 n = data->durations;
9588 /*
9689 * the 4th nibble should be 15 so base the divider on this
97
- * to transform durations into nibbles. Substract 2000 from
90
+ * to transform durations into nibbles. Subtract 2000 from
9891 * the divider to compensate for fluctuations in the signal
9992 */
10093 divider = (n[3] - XMP_NIBBLE_PREFIX) / 15 - 2000;
....@@ -174,7 +167,7 @@
174167 } else if (geq_margin(ev.duration, XMP_NIBBLE_PREFIX, XMP_UNIT)) {
175168 /* store nibble raw data, decode after trailer */
176169 if (data->count == 16) {
177
- dev_dbg(&dev->dev, "to many pulses (%d) ignoring: %u\n",
170
+ dev_dbg(&dev->dev, "too many pulses (%d) ignoring: %u\n",
178171 data->count, ev.duration);
179172 data->state = STATE_INACTIVE;
180173 return -EINVAL;
....@@ -191,7 +184,7 @@
191184 }
192185
193186 dev_dbg(&dev->dev, "XMP decode failed at count %d state %d (%uus %s)\n",
194
- data->count, data->state, TO_US(ev.duration), TO_STR(ev.pulse));
187
+ data->count, data->state, ev.duration, TO_STR(ev.pulse));
195188 data->state = STATE_INACTIVE;
196189 return -EINVAL;
197190 }