.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for ITE Tech Inc. IT8712F/IT8512 CIR |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2010 Juan Jesús García de Soria <skandalfo@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 as |
---|
8 | | - * published by the Free Software Foundation; either version 2 of the |
---|
9 | | - * License, or (at your option) any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, but |
---|
12 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
14 | | - * General Public License for more details. |
---|
15 | 6 | * |
---|
16 | 7 | * Inspired by the original lirc_it87 and lirc_ite8709 drivers, on top of the |
---|
17 | 8 | * skeleton provided by the nuvoton-cir driver. |
---|
.. | .. |
---|
173 | 164 | u32 sample_period; |
---|
174 | 165 | unsigned long *ldata; |
---|
175 | 166 | unsigned int next_one, next_zero, size; |
---|
176 | | - DEFINE_IR_RAW_EVENT(ev); |
---|
| 167 | + struct ir_raw_event ev = {}; |
---|
177 | 168 | |
---|
178 | 169 | if (length == 0) |
---|
179 | 170 | return; |
---|
.. | .. |
---|
185 | 176 | if (next_one > 0) { |
---|
186 | 177 | ev.pulse = true; |
---|
187 | 178 | ev.duration = |
---|
188 | | - ITE_BITS_TO_NS(next_one, sample_period); |
---|
| 179 | + ITE_BITS_TO_US(next_one, sample_period); |
---|
189 | 180 | ir_raw_event_store_with_filter(dev->rdev, &ev); |
---|
190 | 181 | } |
---|
191 | 182 | |
---|
192 | 183 | while (next_one < size) { |
---|
193 | 184 | next_zero = find_next_zero_bit_le(ldata, size, next_one + 1); |
---|
194 | 185 | ev.pulse = false; |
---|
195 | | - ev.duration = ITE_BITS_TO_NS(next_zero - next_one, sample_period); |
---|
| 186 | + ev.duration = ITE_BITS_TO_US(next_zero - next_one, sample_period); |
---|
196 | 187 | ir_raw_event_store_with_filter(dev->rdev, &ev); |
---|
197 | 188 | |
---|
198 | 189 | if (next_zero < size) { |
---|
.. | .. |
---|
202 | 193 | next_zero + 1); |
---|
203 | 194 | ev.pulse = true; |
---|
204 | 195 | ev.duration = |
---|
205 | | - ITE_BITS_TO_NS(next_one - next_zero, |
---|
| 196 | + ITE_BITS_TO_US(next_one - next_zero, |
---|
206 | 197 | sample_period); |
---|
207 | 198 | ir_raw_event_store_with_filter |
---|
208 | 199 | (dev->rdev, &ev); |
---|
.. | .. |
---|
397 | 388 | ite_dbg("%s called", __func__); |
---|
398 | 389 | |
---|
399 | 390 | /* clear the array just in case */ |
---|
400 | | - memset(last_sent, 0, ARRAY_SIZE(last_sent)); |
---|
| 391 | + memset(last_sent, 0, sizeof(last_sent)); |
---|
401 | 392 | |
---|
402 | 393 | spin_lock_irqsave(&dev->lock, flags); |
---|
403 | 394 | |
---|
.. | .. |
---|
521 | 512 | /* and set the carrier values for reception */ |
---|
522 | 513 | ite_set_carrier_params(dev); |
---|
523 | 514 | |
---|
524 | | - /* reenable the receiver */ |
---|
| 515 | + /* re-enable the receiver */ |
---|
525 | 516 | if (dev->in_use) |
---|
526 | 517 | dev->params.enable_rx(dev); |
---|
527 | 518 | |
---|
.. | .. |
---|
1513 | 1504 | /* initialize spinlocks */ |
---|
1514 | 1505 | spin_lock_init(&itdev->lock); |
---|
1515 | 1506 | |
---|
1516 | | - /* initialize raw event */ |
---|
1517 | | - init_ir_raw_event(&itdev->rawir); |
---|
1518 | | - |
---|
1519 | 1507 | /* set driver data into the pnp device */ |
---|
1520 | 1508 | pnp_set_drvdata(pdev, itdev); |
---|
1521 | 1509 | itdev->pdev = pdev; |
---|
.. | .. |
---|
1569 | 1557 | rdev->s_rx_carrier_range = ite_set_rx_carrier_range; |
---|
1570 | 1558 | /* FIFO threshold is 17 bytes, so 17 * 8 samples minimum */ |
---|
1571 | 1559 | rdev->min_timeout = 17 * 8 * ITE_BAUDRATE_DIVISOR * |
---|
1572 | | - itdev->params.sample_period; |
---|
| 1560 | + itdev->params.sample_period / 1000; |
---|
1573 | 1561 | rdev->timeout = IR_DEFAULT_TIMEOUT; |
---|
1574 | 1562 | rdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT; |
---|
1575 | 1563 | rdev->rx_resolution = ITE_BAUDRATE_DIVISOR * |
---|
1576 | | - itdev->params.sample_period; |
---|
| 1564 | + itdev->params.sample_period / 1000; |
---|
1577 | 1565 | rdev->tx_resolution = ITE_BAUDRATE_DIVISOR * |
---|
1578 | | - itdev->params.sample_period; |
---|
| 1566 | + itdev->params.sample_period / 1000; |
---|
1579 | 1567 | |
---|
1580 | 1568 | /* set up transmitter related values if needed */ |
---|
1581 | 1569 | if (itdev->params.hw_tx_capable) { |
---|