blob: d8564354debb4391a0193997280653a2cd288bc7 [file] [log] [blame]
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -08001#ifndef _IR_I2C
2#define _IR_I2C
3
Mauro Carvalho Chehab6bda9642010-11-17 13:28:38 -03004#include <media/rc-core.h>
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -08005
Mauro Carvalho Chehabc72ba8e2010-09-23 01:23:10 -03006#define DEFAULT_POLLING_INTERVAL 100 /* ms */
7
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -08008struct IR_i2c;
9
10struct IR_i2c {
Mauro Carvalho Chehab02858ee2010-04-02 20:01:00 -030011 char *ir_codes;
Jean Delvarec668f322009-05-13 16:48:50 -030012 struct i2c_client *c;
David Härdemand8b4b582010-10-29 16:08:23 -030013 struct rc_dev *rc;
David Härdeman62c65032010-10-29 16:08:07 -030014
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -080015 /* Used to avoid fast repeating */
16 unsigned char old;
17
Mauro Carvalho Chehabc72ba8e2010-09-23 01:23:10 -030018 u32 polling_interval; /* in ms */
19
Jean Delvarec1089bd2009-03-07 07:43:43 -030020 struct delayed_work work;
Jean Delvare1df8e982009-05-13 16:48:07 -030021 char name[32];
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -080022 char phys[32];
David Härdeman4dd9bb92014-04-03 20:31:25 -030023 int (*get_key)(struct IR_i2c *ir, enum rc_type *protocol,
24 u32 *scancode, u8 *toggle);
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -080025};
Jean Delvare4d7a2d62009-05-13 16:49:32 -030026
Andy Walls1b6e59e2009-07-28 11:44:05 -030027enum ir_kbd_get_key_fn {
28 IR_KBD_GET_KEY_CUSTOM = 0,
29 IR_KBD_GET_KEY_PIXELVIEW,
Andy Walls1b6e59e2009-07-28 11:44:05 -030030 IR_KBD_GET_KEY_HAUP,
31 IR_KBD_GET_KEY_KNC1,
32 IR_KBD_GET_KEY_FUSIONHDTV,
33 IR_KBD_GET_KEY_HAUP_XVR,
34 IR_KBD_GET_KEY_AVERMEDIA_CARDBUS,
35};
36
Jean Delvare4d7a2d62009-05-13 16:49:32 -030037/* Can be passed when instantiating an ir_video i2c device */
38struct IR_i2c_init_data {
Mauro Carvalho Chehab02858ee2010-04-02 20:01:00 -030039 char *ir_codes;
Mauro Carvalho Chehabc72ba8e2010-09-23 01:23:10 -030040 const char *name;
David Härdemanc003ab12012-10-11 19:11:54 -030041 u64 type; /* RC_BIT_RC5, etc */
Mauro Carvalho Chehabc72ba8e2010-09-23 01:23:10 -030042 u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */
David Härdeman62c65032010-10-29 16:08:07 -030043
Andy Walls1b6e59e2009-07-28 11:44:05 -030044 /*
45 * Specify either a function pointer or a value indicating one of
46 * ir_kbd_i2c's internal get_key functions
47 */
David Härdeman4dd9bb92014-04-03 20:31:25 -030048 int (*get_key)(struct IR_i2c *ir, enum rc_type *protocol,
49 u32 *scancode, u8 *toggle);
Andy Walls1b6e59e2009-07-28 11:44:05 -030050 enum ir_kbd_get_key_fn internal_get_key_func;
Mauro Carvalho Chehab2eb25832010-11-12 09:02:40 -030051
52 struct rc_dev *rc_dev;
Jean Delvare4d7a2d62009-05-13 16:49:32 -030053};
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -080054#endif