pvrusb2-i2c-track.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. #include <media/v4l2-device.h>
  25. struct pvr2_hdw;
  26. struct pvr2_i2c_client;
  27. struct pvr2_i2c_handler;
  28. struct pvr2_i2c_handler_functions;
  29. struct pvr2_i2c_op;
  30. struct pvr2_i2c_op_functions;
  31. struct pvr2_i2c_client {
  32. struct i2c_client *client;
  33. struct pvr2_i2c_handler *handler;
  34. struct list_head list;
  35. struct pvr2_hdw *hdw;
  36. int detected_flag;
  37. int recv_enable;
  38. unsigned long pend_mask;
  39. unsigned long ctl_mask;
  40. void (*status_poll)(struct pvr2_i2c_client *);
  41. };
  42. struct pvr2_i2c_handler {
  43. void *func_data;
  44. const struct pvr2_i2c_handler_functions *func_table;
  45. };
  46. struct pvr2_i2c_handler_functions {
  47. void (*detach)(void *);
  48. int (*check)(void *);
  49. void (*update)(void *);
  50. unsigned int (*describe)(void *,char *,unsigned int);
  51. };
  52. struct pvr2_i2c_op {
  53. int (*check)(struct pvr2_hdw *);
  54. void (*update)(struct pvr2_hdw *);
  55. const char *name;
  56. };
  57. void pvr2_i2c_track_init(struct pvr2_hdw *);
  58. void pvr2_i2c_track_done(struct pvr2_hdw *);
  59. void pvr2_i2c_track_attach_inform(struct i2c_client *);
  60. void pvr2_i2c_track_detach_inform(struct i2c_client *);
  61. int pvr2_i2c_client_cmd(struct pvr2_i2c_client *,unsigned int cmd,void *arg);
  62. int pvr2_i2c_core_cmd(struct pvr2_hdw *,unsigned int cmd,void *arg);
  63. int pvr2_i2c_core_check_stale(struct pvr2_hdw *);
  64. void pvr2_i2c_core_sync(struct pvr2_hdw *);
  65. void pvr2_i2c_core_status_poll(struct pvr2_hdw *);
  66. unsigned int pvr2_i2c_report(struct pvr2_hdw *,char *buf,unsigned int maxlen);
  67. #define PVR2_I2C_DETAIL_DEBUG 0x0001
  68. #define PVR2_I2C_DETAIL_HANDLER 0x0002
  69. #define PVR2_I2C_DETAIL_CTLMASK 0x0004
  70. #define PVR2_I2C_DETAIL_ALL (\
  71. PVR2_I2C_DETAIL_DEBUG |\
  72. PVR2_I2C_DETAIL_HANDLER |\
  73. PVR2_I2C_DETAIL_CTLMASK)
  74. void pvr2_i2c_probe(struct pvr2_hdw *,struct pvr2_i2c_client *);
  75. const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx);
  76. void pvr2_i2c_untrack_subdev(struct pvr2_hdw *, struct v4l2_subdev *sd);
  77. #endif /* __PVRUSB2_I2C_CORE_H */
  78. /*
  79. Stuff for Emacs to see, in order to encourage consistent editing style:
  80. *** Local Variables: ***
  81. *** mode: c ***
  82. *** fill-column: 75 ***
  83. *** tab-width: 8 ***
  84. *** c-basic-offset: 8 ***
  85. *** End: ***
  86. */