rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef _IR_I2C |
| 3 | #define _IR_I2C |
| 4 | |
| 5 | #include <media/rc-core.h> |
| 6 | |
| 7 | #define DEFAULT_POLLING_INTERVAL 100 /* ms */ |
| 8 | |
| 9 | struct IR_i2c; |
| 10 | |
| 11 | struct IR_i2c { |
| 12 | char *ir_codes; |
| 13 | struct i2c_client *c; |
| 14 | struct rc_dev *rc; |
| 15 | |
| 16 | /* Used to avoid fast repeating */ |
| 17 | unsigned char old; |
| 18 | |
| 19 | u32 polling_interval; /* in ms */ |
| 20 | |
| 21 | struct delayed_work work; |
| 22 | char name[32]; |
| 23 | char phys[32]; |
| 24 | int (*get_key)(struct IR_i2c *ir, |
| 25 | enum rc_proto *protocol, |
| 26 | u32 *scancode, u8 *toggle); |
| 27 | }; |
| 28 | |
| 29 | enum ir_kbd_get_key_fn { |
| 30 | IR_KBD_GET_KEY_CUSTOM = 0, |
| 31 | IR_KBD_GET_KEY_PIXELVIEW, |
| 32 | IR_KBD_GET_KEY_HAUP, |
| 33 | IR_KBD_GET_KEY_KNC1, |
| 34 | IR_KBD_GET_KEY_FUSIONHDTV, |
| 35 | IR_KBD_GET_KEY_HAUP_XVR, |
| 36 | IR_KBD_GET_KEY_AVERMEDIA_CARDBUS, |
| 37 | }; |
| 38 | |
| 39 | /* Can be passed when instantiating an ir_video i2c device */ |
| 40 | struct IR_i2c_init_data { |
| 41 | char *ir_codes; |
| 42 | const char *name; |
| 43 | u64 type; /* RC_PROTO_BIT_RC5, etc */ |
| 44 | u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */ |
| 45 | |
| 46 | /* |
| 47 | * Specify either a function pointer or a value indicating one of |
| 48 | * ir_kbd_i2c's internal get_key functions |
| 49 | */ |
| 50 | int (*get_key)(struct IR_i2c *ir, |
| 51 | enum rc_proto *protocol, |
| 52 | u32 *scancode, u8 *toggle); |
| 53 | enum ir_kbd_get_key_fn internal_get_key_func; |
| 54 | |
| 55 | struct rc_dev *rc_dev; |
| 56 | }; |
| 57 | #endif |