blob: 76491c62c254540498c7789072d2aa13321f8a2f [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -08002#ifndef _IR_I2C
3#define _IR_I2C
4
Mauro Carvalho Chehab6bda9642010-11-17 13:28:38 -03005#include <media/rc-core.h>
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -08006
Mauro Carvalho Chehabc72ba8e2010-09-23 01:23:10 -03007#define DEFAULT_POLLING_INTERVAL 100 /* ms */
8
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -08009struct IR_i2c;
10
11struct IR_i2c {
Mauro Carvalho Chehab02858ee2010-04-02 20:01:00 -030012 char *ir_codes;
Jean Delvarec668f322009-05-13 16:48:50 -030013 struct i2c_client *c;
David Härdemand8b4b582010-10-29 16:08:23 -030014 struct rc_dev *rc;
David Härdeman62c65032010-10-29 16:08:07 -030015
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -080016 /* Used to avoid fast repeating */
17 unsigned char old;
18
Mauro Carvalho Chehabc72ba8e2010-09-23 01:23:10 -030019 u32 polling_interval; /* in ms */
20
Jean Delvarec1089bd2009-03-07 07:43:43 -030021 struct delayed_work work;
Jean Delvare1df8e982009-05-13 16:48:07 -030022 char name[32];
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -080023 char phys[32];
Sean Young6d741bf2017-08-07 16:20:58 -040024 int (*get_key)(struct IR_i2c *ir,
25 enum rc_proto *protocol,
David Härdeman4dd9bb92014-04-03 20:31:25 -030026 u32 *scancode, u8 *toggle);
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -080027};
Jean Delvare4d7a2d62009-05-13 16:49:32 -030028
Andy Walls1b6e59e32009-07-28 11:44:05 -030029enum ir_kbd_get_key_fn {
30 IR_KBD_GET_KEY_CUSTOM = 0,
31 IR_KBD_GET_KEY_PIXELVIEW,
Andy Walls1b6e59e32009-07-28 11:44:05 -030032 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
Jean Delvare4d7a2d62009-05-13 16:49:32 -030039/* Can be passed when instantiating an ir_video i2c device */
40struct IR_i2c_init_data {
Mauro Carvalho Chehab02858ee2010-04-02 20:01:00 -030041 char *ir_codes;
Mauro Carvalho Chehabc72ba8e2010-09-23 01:23:10 -030042 const char *name;
Sean Young6d741bf2017-08-07 16:20:58 -040043 u64 type; /* RC_PROTO_BIT_RC5, etc */
Mauro Carvalho Chehabc72ba8e2010-09-23 01:23:10 -030044 u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */
David Härdeman62c65032010-10-29 16:08:07 -030045
Andy Walls1b6e59e32009-07-28 11:44:05 -030046 /*
47 * Specify either a function pointer or a value indicating one of
48 * ir_kbd_i2c's internal get_key functions
49 */
Sean Young6d741bf2017-08-07 16:20:58 -040050 int (*get_key)(struct IR_i2c *ir,
51 enum rc_proto *protocol,
David Härdeman4dd9bb92014-04-03 20:31:25 -030052 u32 *scancode, u8 *toggle);
Andy Walls1b6e59e32009-07-28 11:44:05 -030053 enum ir_kbd_get_key_fn internal_get_key_func;
Mauro Carvalho Chehab2eb25832010-11-12 09:02:40 -030054
55 struct rc_dev *rc_dev;
Jean Delvare4d7a2d62009-05-13 16:49:32 -030056};
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -080057#endif