pvrusb2-i2c-track.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. *
  3. *
  4. * Copyright (C) 2005 Mike Isely <isely@pobox.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. */
  20. #ifndef __PVRUSB2_I2C_TRACK_H
  21. #define __PVRUSB2_I2C_TRACK_H
  22. #include <linux/list.h>
  23. #include <linux/i2c.h>
  24. struct pvr2_hdw;
  25. struct pvr2_i2c_client;
  26. struct pvr2_i2c_handler;
  27. struct pvr2_i2c_handler_functions;
  28. struct pvr2_i2c_op;
  29. struct pvr2_i2c_op_functions;
  30. struct pvr2_i2c_client {
  31. struct i2c_client *client;
  32. struct pvr2_i2c_handler *handler;
  33. struct list_head list;
  34. struct pvr2_hdw *hdw;
  35. int detected_flag;
  36. int recv_enable;
  37. unsigned long pend_mask;
  38. unsigned long ctl_mask;
  39. void (*status_poll)(struct pvr2_i2c_client *);
  40. };
  41. struct pvr2_i2c_handler {
  42. void *func_data;
  43. const struct pvr2_i2c_handler_functions *func_table;
  44. };
  45. struct pvr2_i2c_handler_functions {
  46. void (*detach)(void *);
  47. int (*check)(void *);
  48. void (*update)(void *);
  49. unsigned int (*describe)(void *,char *,unsigned int);
  50. };
  51. struct pvr2_i2c_op {
  52. int (*check)(struct pvr2_hdw *);
  53. void (*update)(struct pvr2_hdw *);
  54. const char *name;
  55. };
  56. void pvr2_i2c_track_init(struct pvr2_hdw *);
  57. void pvr2_i2c_track_done(struct pvr2_hdw *);
  58. void pvr2_i2c_track_attach_inform(struct i2c_client *);
  59. void pvr2_i2c_track_detach_inform(struct i2c_client *);
  60. int pvr2_i2c_client_cmd(struct pvr2_i2c_client *,unsigned int cmd,void *arg);
  61. int pvr2_i2c_core_cmd(struct pvr2_hdw *,unsigned int cmd,void *arg);
  62. int pvr2_i2c_core_check_stale(struct pvr2_hdw *);
  63. void pvr2_i2c_core_sync(struct pvr2_hdw *);
  64. void pvr2_i2c_core_status_poll(struct pvr2_hdw *);
  65. unsigned int pvr2_i2c_report(struct pvr2_hdw *,char *buf,unsigned int maxlen);
  66. #define PVR2_I2C_DETAIL_DEBUG 0x0001
  67. #define PVR2_I2C_DETAIL_HANDLER 0x0002
  68. #define PVR2_I2C_DETAIL_CTLMASK 0x0004
  69. #define PVR2_I2C_DETAIL_ALL (\
  70. PVR2_I2C_DETAIL_DEBUG |\
  71. PVR2_I2C_DETAIL_HANDLER |\
  72. PVR2_I2C_DETAIL_CTLMASK)
  73. void pvr2_i2c_probe(struct pvr2_hdw *,struct pvr2_i2c_client *);
  74. const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx);
  75. #endif /* __PVRUSB2_I2C_CORE_H */
  76. /*
  77. Stuff for Emacs to see, in order to encourage consistent editing style:
  78. *** Local Variables: ***
  79. *** mode: c ***
  80. *** fill-column: 75 ***
  81. *** tab-width: 8 ***
  82. *** c-basic-offset: 8 ***
  83. *** End: ***
  84. */