| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Remote Controller core header |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2009-2010 by Mauro Carvalho Chehab |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation version 2 of the License. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | 6 | */ |
|---|
| 15 | 7 | |
|---|
| 16 | 8 | #ifndef _RC_CORE |
|---|
| .. | .. |
|---|
| 136 | 128 | * @timeout: optional time after which device stops sending data |
|---|
| 137 | 129 | * @min_timeout: minimum timeout supported by device |
|---|
| 138 | 130 | * @max_timeout: maximum timeout supported by device |
|---|
| 139 | | - * @rx_resolution : resolution (in ns) of input sampler |
|---|
| 140 | | - * @tx_resolution: resolution (in ns) of output sampler |
|---|
| 131 | + * @rx_resolution : resolution (in us) of input sampler |
|---|
| 132 | + * @tx_resolution: resolution (in us) of output sampler |
|---|
| 141 | 133 | * @lirc_dev: lirc device |
|---|
| 142 | 134 | * @lirc_cdev: lirc char cdev |
|---|
| 143 | 135 | * @gap_start: time when gap starts |
|---|
| .. | .. |
|---|
| 165 | 157 | * @s_wakeup_filter: set the wakeup scancode filter. If the mask is zero |
|---|
| 166 | 158 | * then wakeup should be disabled. wakeup_protocol will be set to |
|---|
| 167 | 159 | * a valid protocol if mask is nonzero. |
|---|
| 168 | | - * @s_timeout: set hardware timeout in ns |
|---|
| 160 | + * @s_timeout: set hardware timeout in us |
|---|
| 169 | 161 | */ |
|---|
| 170 | 162 | struct rc_dev { |
|---|
| 171 | 163 | struct device dev; |
|---|
| .. | .. |
|---|
| 200 | 192 | struct timer_list timer_repeat; |
|---|
| 201 | 193 | u32 last_keycode; |
|---|
| 202 | 194 | enum rc_proto last_protocol; |
|---|
| 203 | | - u32 last_scancode; |
|---|
| 195 | + u64 last_scancode; |
|---|
| 204 | 196 | u8 last_toggle; |
|---|
| 205 | 197 | u32 timeout; |
|---|
| 206 | 198 | u32 min_timeout; |
|---|
| .. | .. |
|---|
| 292 | 284 | void rc_unregister_device(struct rc_dev *dev); |
|---|
| 293 | 285 | |
|---|
| 294 | 286 | void rc_repeat(struct rc_dev *dev); |
|---|
| 295 | | -void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u32 scancode, |
|---|
| 287 | +void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u64 scancode, |
|---|
| 296 | 288 | u8 toggle); |
|---|
| 297 | 289 | void rc_keydown_notimeout(struct rc_dev *dev, enum rc_proto protocol, |
|---|
| 298 | | - u32 scancode, u8 toggle); |
|---|
| 290 | + u64 scancode, u8 toggle); |
|---|
| 299 | 291 | void rc_keyup(struct rc_dev *dev); |
|---|
| 300 | | -u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode); |
|---|
| 292 | +u32 rc_g_keycode_from_table(struct rc_dev *dev, u64 scancode); |
|---|
| 301 | 293 | |
|---|
| 302 | 294 | /* |
|---|
| 303 | 295 | * From rc-raw.c |
|---|
| .. | .. |
|---|
| 317 | 309 | unsigned carrier_report:1; |
|---|
| 318 | 310 | }; |
|---|
| 319 | 311 | |
|---|
| 320 | | -#define DEFINE_IR_RAW_EVENT(event) struct ir_raw_event event = {} |
|---|
| 321 | | - |
|---|
| 322 | | -static inline void init_ir_raw_event(struct ir_raw_event *ev) |
|---|
| 323 | | -{ |
|---|
| 324 | | - memset(ev, 0, sizeof(*ev)); |
|---|
| 325 | | -} |
|---|
| 326 | | - |
|---|
| 327 | | -#define IR_DEFAULT_TIMEOUT MS_TO_NS(125) |
|---|
| 328 | | -#define IR_MAX_DURATION 500000000 /* 500 ms */ |
|---|
| 329 | 312 | #define US_TO_NS(usec) ((usec) * 1000) |
|---|
| 330 | 313 | #define MS_TO_US(msec) ((msec) * 1000) |
|---|
| 331 | | -#define MS_TO_NS(msec) ((msec) * 1000 * 1000) |
|---|
| 314 | +#define IR_MAX_DURATION MS_TO_US(500) |
|---|
| 315 | +#define IR_DEFAULT_TIMEOUT MS_TO_US(125) |
|---|
| 332 | 316 | |
|---|
| 333 | 317 | void ir_raw_event_handle(struct rc_dev *dev); |
|---|
| 334 | 318 | int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); |
|---|
| .. | .. |
|---|
| 344 | 328 | |
|---|
| 345 | 329 | static inline void ir_raw_event_reset(struct rc_dev *dev) |
|---|
| 346 | 330 | { |
|---|
| 347 | | - struct ir_raw_event ev = { .reset = true }; |
|---|
| 348 | | - |
|---|
| 349 | | - ir_raw_event_store(dev, &ev); |
|---|
| 331 | + ir_raw_event_store(dev, &((struct ir_raw_event) { .reset = true })); |
|---|
| 350 | 332 | dev->idle = true; |
|---|
| 351 | 333 | ir_raw_event_handle(dev); |
|---|
| 352 | 334 | } |
|---|