ir-kbd-i2c.h 1.5 KB

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