.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * winbond-cir.c - Driver for the Consumer IR functionality of Winbond |
---|
3 | 4 | * SuperI/O chips. |
---|
.. | .. |
---|
24 | 25 | * o IR Transmit |
---|
25 | 26 | * o Wake-On-CIR functionality |
---|
26 | 27 | * o Carrier detection |
---|
27 | | - * |
---|
28 | | - * This program is free software; you can redistribute it and/or modify |
---|
29 | | - * it under the terms of the GNU General Public License as published by |
---|
30 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
31 | | - * (at your option) any later version. |
---|
32 | | - * |
---|
33 | | - * This program is distributed in the hope that it will be useful, |
---|
34 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
35 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
36 | | - * GNU General Public License for more details. |
---|
37 | 28 | */ |
---|
38 | 29 | |
---|
39 | 30 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
---|
.. | .. |
---|
322 | 313 | inb(data->ebase + WBCIR_REG_ECEIR_CNT_HI) << 8; |
---|
323 | 314 | |
---|
324 | 315 | if (counter > 0 && counter < 0xffff) { |
---|
325 | | - DEFINE_IR_RAW_EVENT(ev); |
---|
326 | | - |
---|
327 | | - ev.carrier_report = 1; |
---|
328 | | - ev.carrier = DIV_ROUND_CLOSEST(counter * 1000000u, |
---|
329 | | - data->pulse_duration); |
---|
| 316 | + struct ir_raw_event ev = { |
---|
| 317 | + .carrier_report = 1, |
---|
| 318 | + .carrier = DIV_ROUND_CLOSEST(counter * 1000000u, |
---|
| 319 | + data->pulse_duration) |
---|
| 320 | + }; |
---|
330 | 321 | |
---|
331 | 322 | ir_raw_event_store(data->dev, &ev); |
---|
332 | 323 | } |
---|
.. | .. |
---|
362 | 353 | wbcir_irq_rx(struct wbcir_data *data, struct pnp_dev *device) |
---|
363 | 354 | { |
---|
364 | 355 | u8 irdata; |
---|
365 | | - DEFINE_IR_RAW_EVENT(rawir); |
---|
366 | | - unsigned duration; |
---|
| 356 | + struct ir_raw_event rawir = {}; |
---|
367 | 357 | |
---|
368 | 358 | /* Since RXHDLEV is set, at least 8 bytes are in the FIFO */ |
---|
369 | 359 | while (inb(data->sbase + WBCIR_REG_SP3_LSR) & WBCIR_RX_AVAIL) { |
---|
.. | .. |
---|
371 | 361 | if (data->rxstate == WBCIR_RXSTATE_ERROR) |
---|
372 | 362 | continue; |
---|
373 | 363 | |
---|
374 | | - duration = ((irdata & 0x7F) + 1) * |
---|
| 364 | + rawir.duration = ((irdata & 0x7F) + 1) * |
---|
375 | 365 | (data->carrier_report_enabled ? 2 : 10); |
---|
376 | 366 | rawir.pulse = irdata & 0x80 ? false : true; |
---|
377 | | - rawir.duration = US_TO_NS(duration); |
---|
378 | 367 | |
---|
379 | 368 | if (rawir.pulse) |
---|
380 | | - data->pulse_duration += duration; |
---|
| 369 | + data->pulse_duration += rawir.duration; |
---|
381 | 370 | |
---|
382 | 371 | ir_raw_event_store_with_filter(data->dev, &rawir); |
---|
383 | 372 | } |
---|
.. | .. |
---|
528 | 517 | |
---|
529 | 518 | /* Set a higher sampling resolution if carrier reports are enabled */ |
---|
530 | 519 | wbcir_select_bank(data, WBCIR_BANK_2); |
---|
531 | | - data->dev->rx_resolution = US_TO_NS(enable ? 2 : 10); |
---|
| 520 | + data->dev->rx_resolution = enable ? 2 : 10; |
---|
532 | 521 | outb(enable ? 0x03 : 0x0f, data->sbase + WBCIR_REG_SP3_BGDL); |
---|
533 | 522 | outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH); |
---|
534 | 523 | |
---|
.. | .. |
---|
1085 | 1074 | data->dev->min_timeout = 1; |
---|
1086 | 1075 | data->dev->timeout = IR_DEFAULT_TIMEOUT; |
---|
1087 | 1076 | data->dev->max_timeout = 10 * IR_DEFAULT_TIMEOUT; |
---|
1088 | | - data->dev->rx_resolution = US_TO_NS(2); |
---|
| 1077 | + data->dev->rx_resolution = 2; |
---|
1089 | 1078 | data->dev->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER; |
---|
1090 | 1079 | data->dev->allowed_wakeup_protocols = RC_PROTO_BIT_NEC | |
---|
1091 | 1080 | RC_PROTO_BIT_NECX | RC_PROTO_BIT_NEC32 | RC_PROTO_BIT_RC5 | |
---|