hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/media/rc/serial_ir.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * serial_ir.c
34 *
....@@ -10,15 +11,6 @@
1011 * Copyright (C) 1999 Christoph Bartelmus <lirc@bartelmus.de>
1112 * Copyright (C) 2007 Andrei Tanas <andrei@tanas.ca> (suspend/resume support)
1213 * Copyright (C) 2016 Sean Young <sean@mess.org> (port to rc-core)
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 2 of the License, or
16
- * (at your option) any later version.
17
- *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
2214 */
2315
2416 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -273,11 +265,11 @@
273265 {
274266 /* simple noise filter */
275267 static unsigned int ptr, pulse, space;
276
- DEFINE_IR_RAW_EVENT(ev);
268
+ struct ir_raw_event ev = {};
277269
278270 if (ptr > 0 && is_pulse) {
279271 pulse += l;
280
- if (pulse > 250000) {
272
+ if (pulse > 250) {
281273 ev.duration = space;
282274 ev.pulse = false;
283275 ir_raw_event_store_with_filter(serial_ir.rcdev, &ev);
....@@ -291,13 +283,13 @@
291283 }
292284 if (!is_pulse) {
293285 if (ptr == 0) {
294
- if (l > 20000000) {
286
+ if (l > 20000) {
295287 space = l;
296288 ptr++;
297289 return;
298290 }
299291 } else {
300
- if (l > 20000000) {
292
+ if (l > 20000) {
301293 space += pulse;
302294 if (space > IR_MAX_DURATION)
303295 space = IR_MAX_DURATION;
....@@ -361,7 +353,7 @@
361353 dcd = (status & hardware[type].signal_pin) ? 1 : 0;
362354
363355 if (dcd == last_dcd) {
364
- dev_err(&serial_ir.pdev->dev,
356
+ dev_dbg(&serial_ir.pdev->dev,
365357 "ignoring spike: %d %d %lldns %lldns\n",
366358 dcd, sense, ktime_to_ns(kt),
367359 ktime_to_ns(serial_ir.lastkt));
....@@ -384,7 +376,7 @@
384376 sense = sense ? 0 : 1;
385377 }
386378 } else {
387
- data = ktime_to_ns(delkt);
379
+ data = ktime_to_us(delkt);
388380 }
389381 frbwrite(data, !(dcd ^ sense));
390382 serial_ir.lastkt = kt;
....@@ -393,7 +385,7 @@
393385 } while (!(sinp(UART_IIR) & UART_IIR_NO_INT)); /* still pending ? */
394386
395387 mod_timer(&serial_ir.timeout_timer,
396
- jiffies + nsecs_to_jiffies(serial_ir.rcdev->timeout));
388
+ jiffies + usecs_to_jiffies(serial_ir.rcdev->timeout));
397389
398390 ir_raw_event_handle(serial_ir.rcdev);
399391
....@@ -472,10 +464,10 @@
472464
473465 static void serial_ir_timeout(struct timer_list *unused)
474466 {
475
- DEFINE_IR_RAW_EVENT(ev);
476
-
477
- ev.timeout = true;
478
- ev.duration = serial_ir.rcdev->timeout;
467
+ struct ir_raw_event ev = {
468
+ .timeout = true,
469
+ .duration = serial_ir.rcdev->timeout
470
+ };
479471 ir_raw_event_store_with_filter(serial_ir.rcdev, &ev);
480472 ir_raw_event_handle(serial_ir.rcdev);
481473 }
....@@ -536,7 +528,7 @@
536528 rcdev->min_timeout = 1;
537529 rcdev->timeout = IR_DEFAULT_TIMEOUT;
538530 rcdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
539
- rcdev->rx_resolution = 250000;
531
+ rcdev->rx_resolution = 250;
540532
541533 serial_ir.rcdev = rcdev;
542534
....@@ -555,7 +547,7 @@
555547
556548 /* Reserve io region. */
557549 if ((iommap &&
558
- (devm_request_mem_region(&dev->dev, iommap, 8 << ioshift,
550
+ (devm_request_mem_region(&dev->dev, iommap, 8UL << ioshift,
559551 KBUILD_MODNAME) == NULL)) ||
560552 (!iommap && (devm_request_region(&dev->dev, io, 8,
561553 KBUILD_MODNAME) == NULL))) {