| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for Amlogic Meson IR remote receiver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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/>. |
|---|
| 12 | 6 | */ |
|---|
| 13 | 7 | |
|---|
| 14 | 8 | #include <linux/device.h> |
|---|
| .. | .. |
|---|
| 86 | 80 | { |
|---|
| 87 | 81 | struct meson_ir *ir = dev_id; |
|---|
| 88 | 82 | u32 duration, status; |
|---|
| 89 | | - DEFINE_IR_RAW_EVENT(rawir); |
|---|
| 83 | + struct ir_raw_event rawir = {}; |
|---|
| 90 | 84 | |
|---|
| 91 | 85 | spin_lock(&ir->lock); |
|---|
| 92 | 86 | |
|---|
| 93 | 87 | duration = readl_relaxed(ir->reg + IR_DEC_REG1); |
|---|
| 94 | 88 | duration = FIELD_GET(REG1_TIME_IV_MASK, duration); |
|---|
| 95 | | - rawir.duration = US_TO_NS(duration * MESON_TRATE); |
|---|
| 89 | + rawir.duration = duration * MESON_TRATE; |
|---|
| 96 | 90 | |
|---|
| 97 | 91 | status = readl_relaxed(ir->reg + IR_DEC_STATUS); |
|---|
| 98 | 92 | rawir.pulse = !!(status & STATUS_IR_DEC_IN); |
|---|
| .. | .. |
|---|
| 119 | 113 | |
|---|
| 120 | 114 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 121 | 115 | 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)) |
|---|
| 124 | 117 | return PTR_ERR(ir->reg); |
|---|
| 125 | | - } |
|---|
| 126 | 118 | |
|---|
| 127 | 119 | irq = platform_get_irq(pdev, 0); |
|---|
| 128 | | - if (irq < 0) { |
|---|
| 129 | | - dev_err(dev, "no irq resource\n"); |
|---|
| 120 | + if (irq < 0) |
|---|
| 130 | 121 | return irq; |
|---|
| 131 | | - } |
|---|
| 132 | 122 | |
|---|
| 133 | 123 | ir->rc = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW); |
|---|
| 134 | 124 | if (!ir->rc) { |
|---|
| .. | .. |
|---|
| 143 | 133 | map_name = of_get_property(node, "linux,rc-map-name", NULL); |
|---|
| 144 | 134 | ir->rc->map_name = map_name ? map_name : RC_MAP_EMPTY; |
|---|
| 145 | 135 | 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; |
|---|
| 147 | 137 | ir->rc->min_timeout = 1; |
|---|
| 148 | 138 | ir->rc->timeout = IR_DEFAULT_TIMEOUT; |
|---|
| 149 | 139 | ir->rc->max_timeout = 10 * IR_DEFAULT_TIMEOUT; |
|---|