blob: 9f47d6a48cff3f4a154366b9f50f5e290ebc873a [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;
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -080022 char phys[32];
Sean Young6d741bf2017-08-07 16:20:58 -040023 int (*get_key)(struct IR_i2c *ir,
24 enum rc_proto *protocol,
David Härdeman4dd9bb92014-04-03 20:31:25 -030025 u32 *scancode, u8 *toggle);
Sean Youngacaa34b2017-10-21 08:16:47 -040026 /* tx */
27 struct i2c_client *tx_c;
28 struct mutex lock; /* do not poll Rx during Tx */
29 unsigned int carrier;
30 unsigned int duty_cycle;
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -080031};
Jean Delvare4d7a2d62009-05-13 16:49:32 -030032
Andy Walls1b6e59e32009-07-28 11:44:05 -030033enum ir_kbd_get_key_fn {
34 IR_KBD_GET_KEY_CUSTOM = 0,
35 IR_KBD_GET_KEY_PIXELVIEW,
Andy Walls1b6e59e32009-07-28 11:44:05 -030036 IR_KBD_GET_KEY_HAUP,
37 IR_KBD_GET_KEY_KNC1,
38 IR_KBD_GET_KEY_FUSIONHDTV,
39 IR_KBD_GET_KEY_HAUP_XVR,
40 IR_KBD_GET_KEY_AVERMEDIA_CARDBUS,
41};
42
Jean Delvare4d7a2d62009-05-13 16:49:32 -030043/* Can be passed when instantiating an ir_video i2c device */
44struct IR_i2c_init_data {
Mauro Carvalho Chehab02858ee2010-04-02 20:01:00 -030045 char *ir_codes;
Mauro Carvalho Chehabc72ba8e2010-09-23 01:23:10 -030046 const char *name;
Sean Young6d741bf2017-08-07 16:20:58 -040047 u64 type; /* RC_PROTO_BIT_RC5, etc */
Mauro Carvalho Chehabc72ba8e2010-09-23 01:23:10 -030048 u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */
David Härdeman62c65032010-10-29 16:08:07 -030049
Andy Walls1b6e59e32009-07-28 11:44:05 -030050 /*
51 * Specify either a function pointer or a value indicating one of
52 * ir_kbd_i2c's internal get_key functions
53 */
Sean Young6d741bf2017-08-07 16:20:58 -040054 int (*get_key)(struct IR_i2c *ir,
55 enum rc_proto *protocol,
David Härdeman4dd9bb92014-04-03 20:31:25 -030056 u32 *scancode, u8 *toggle);
Andy Walls1b6e59e32009-07-28 11:44:05 -030057 enum ir_kbd_get_key_fn internal_get_key_func;
Mauro Carvalho Chehab2eb25832010-11-12 09:02:40 -030058
59 struct rc_dev *rc_dev;
Jean Delvare4d7a2d62009-05-13 16:49:32 -030060};
Mauro Carvalho Chehabd5e52652005-11-08 21:37:32 -080061#endif