Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _IR_I2C
0003 #define _IR_I2C
0004 
0005 #include <media/rc-core.h>
0006 
0007 #define DEFAULT_POLLING_INTERVAL    100 /* ms */
0008 
0009 struct IR_i2c;
0010 
0011 struct IR_i2c {
0012     char               *ir_codes;
0013     struct i2c_client      *c;
0014     struct rc_dev          *rc;
0015 
0016     /* Used to avoid fast repeating */
0017     unsigned char          old;
0018 
0019     u32                    polling_interval; /* in ms */
0020 
0021     struct delayed_work    work;
0022     char                   phys[32];
0023     int                    (*get_key)(struct IR_i2c *ir,
0024                       enum rc_proto *protocol,
0025                       u32 *scancode, u8 *toggle);
0026     /* tx */
0027     struct i2c_client      *tx_c;
0028     struct mutex           lock;    /* do not poll Rx during Tx */
0029     unsigned int           carrier;
0030     unsigned int           duty_cycle;
0031 };
0032 
0033 enum ir_kbd_get_key_fn {
0034     IR_KBD_GET_KEY_CUSTOM = 0,
0035     IR_KBD_GET_KEY_PIXELVIEW,
0036     IR_KBD_GET_KEY_HAUP,
0037     IR_KBD_GET_KEY_KNC1,
0038     IR_KBD_GET_KEY_FUSIONHDTV,
0039     IR_KBD_GET_KEY_HAUP_XVR,
0040     IR_KBD_GET_KEY_AVERMEDIA_CARDBUS,
0041 };
0042 
0043 /* Can be passed when instantiating an ir_video i2c device */
0044 struct IR_i2c_init_data {
0045     char            *ir_codes;
0046     const char      *name;
0047     u64         type; /* RC_PROTO_BIT_RC5, etc */
0048     u32         polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */
0049 
0050     /*
0051      * Specify either a function pointer or a value indicating one of
0052      * ir_kbd_i2c's internal get_key functions
0053      */
0054     int                    (*get_key)(struct IR_i2c *ir,
0055                       enum rc_proto *protocol,
0056                       u32 *scancode, u8 *toggle);
0057     enum ir_kbd_get_key_fn internal_get_key_func;
0058 
0059     struct rc_dev       *rc_dev;
0060 };
0061 #endif