hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/include/media/rc-core.h
....@@ -1,16 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Remote Controller core header
34 *
45 * Copyright (C) 2009-2010 by Mauro Carvalho Chehab
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation version 2 of the License.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
146 */
157
168 #ifndef _RC_CORE
....@@ -136,8 +128,8 @@
136128 * @timeout: optional time after which device stops sending data
137129 * @min_timeout: minimum timeout supported by device
138130 * @max_timeout: maximum timeout supported by device
139
- * @rx_resolution : resolution (in ns) of input sampler
140
- * @tx_resolution: resolution (in ns) of output sampler
131
+ * @rx_resolution : resolution (in us) of input sampler
132
+ * @tx_resolution: resolution (in us) of output sampler
141133 * @lirc_dev: lirc device
142134 * @lirc_cdev: lirc char cdev
143135 * @gap_start: time when gap starts
....@@ -165,7 +157,7 @@
165157 * @s_wakeup_filter: set the wakeup scancode filter. If the mask is zero
166158 * then wakeup should be disabled. wakeup_protocol will be set to
167159 * a valid protocol if mask is nonzero.
168
- * @s_timeout: set hardware timeout in ns
160
+ * @s_timeout: set hardware timeout in us
169161 */
170162 struct rc_dev {
171163 struct device dev;
....@@ -200,7 +192,7 @@
200192 struct timer_list timer_repeat;
201193 u32 last_keycode;
202194 enum rc_proto last_protocol;
203
- u32 last_scancode;
195
+ u64 last_scancode;
204196 u8 last_toggle;
205197 u32 timeout;
206198 u32 min_timeout;
....@@ -292,12 +284,12 @@
292284 void rc_unregister_device(struct rc_dev *dev);
293285
294286 void rc_repeat(struct rc_dev *dev);
295
-void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u32 scancode,
287
+void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u64 scancode,
296288 u8 toggle);
297289 void rc_keydown_notimeout(struct rc_dev *dev, enum rc_proto protocol,
298
- u32 scancode, u8 toggle);
290
+ u64 scancode, u8 toggle);
299291 void rc_keyup(struct rc_dev *dev);
300
-u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode);
292
+u32 rc_g_keycode_from_table(struct rc_dev *dev, u64 scancode);
301293
302294 /*
303295 * From rc-raw.c
....@@ -317,18 +309,10 @@
317309 unsigned carrier_report:1;
318310 };
319311
320
-#define DEFINE_IR_RAW_EVENT(event) struct ir_raw_event event = {}
321
-
322
-static inline void init_ir_raw_event(struct ir_raw_event *ev)
323
-{
324
- memset(ev, 0, sizeof(*ev));
325
-}
326
-
327
-#define IR_DEFAULT_TIMEOUT MS_TO_NS(125)
328
-#define IR_MAX_DURATION 500000000 /* 500 ms */
329312 #define US_TO_NS(usec) ((usec) * 1000)
330313 #define MS_TO_US(msec) ((msec) * 1000)
331
-#define MS_TO_NS(msec) ((msec) * 1000 * 1000)
314
+#define IR_MAX_DURATION MS_TO_US(500)
315
+#define IR_DEFAULT_TIMEOUT MS_TO_US(125)
332316
333317 void ir_raw_event_handle(struct rc_dev *dev);
334318 int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev);
....@@ -344,9 +328,7 @@
344328
345329 static inline void ir_raw_event_reset(struct rc_dev *dev)
346330 {
347
- struct ir_raw_event ev = { .reset = true };
348
-
349
- ir_raw_event_store(dev, &ev);
331
+ ir_raw_event_store(dev, &((struct ir_raw_event) { .reset = true }));
350332 dev->idle = true;
351333 ir_raw_event_handle(dev);
352334 }