hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/rc/meson-ir.c
....@@ -1,14 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Driver for Amlogic Meson IR remote receiver
34 *
45 * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * version 2 as published by the Free Software Foundation.
9
- *
10
- * You should have received a copy of the GNU General Public License
11
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
126 */
137
148 #include <linux/device.h>
....@@ -86,13 +80,13 @@
8680 {
8781 struct meson_ir *ir = dev_id;
8882 u32 duration, status;
89
- DEFINE_IR_RAW_EVENT(rawir);
83
+ struct ir_raw_event rawir = {};
9084
9185 spin_lock(&ir->lock);
9286
9387 duration = readl_relaxed(ir->reg + IR_DEC_REG1);
9488 duration = FIELD_GET(REG1_TIME_IV_MASK, duration);
95
- rawir.duration = US_TO_NS(duration * MESON_TRATE);
89
+ rawir.duration = duration * MESON_TRATE;
9690
9791 status = readl_relaxed(ir->reg + IR_DEC_STATUS);
9892 rawir.pulse = !!(status & STATUS_IR_DEC_IN);
....@@ -119,16 +113,12 @@
119113
120114 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
121115 ir->reg = devm_ioremap_resource(dev, res);
122
- if (IS_ERR(ir->reg)) {
123
- dev_err(dev, "failed to map registers\n");
116
+ if (IS_ERR(ir->reg))
124117 return PTR_ERR(ir->reg);
125
- }
126118
127119 irq = platform_get_irq(pdev, 0);
128
- if (irq < 0) {
129
- dev_err(dev, "no irq resource\n");
120
+ if (irq < 0)
130121 return irq;
131
- }
132122
133123 ir->rc = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW);
134124 if (!ir->rc) {
....@@ -143,7 +133,7 @@
143133 map_name = of_get_property(node, "linux,rc-map-name", NULL);
144134 ir->rc->map_name = map_name ? map_name : RC_MAP_EMPTY;
145135 ir->rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
146
- ir->rc->rx_resolution = US_TO_NS(MESON_TRATE);
136
+ ir->rc->rx_resolution = MESON_TRATE;
147137 ir->rc->min_timeout = 1;
148138 ir->rc->timeout = IR_DEFAULT_TIMEOUT;
149139 ir->rc->max_timeout = 10 * IR_DEFAULT_TIMEOUT;