m5602_sensor.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * USB Driver for ALi m5602 based webcams
  3. *
  4. * Copyright (C) 2008 Erik Andrén
  5. * Copyright (C) 2007 Ilyes Gouta. Based on the m5603x Linux Driver Project.
  6. * Copyright (C) 2005 m5603x Linux Driver Project <m5602@x3ng.com.br>
  7. *
  8. * Portions of code to USB interface and ALi driver software,
  9. * Copyright (c) 2006 Willem Duinker
  10. * v4l2 interface modeled after the V4L2 driver
  11. * for SN9C10x PC Camera Controllers
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License as
  15. * published by the Free Software Foundation, version 2.
  16. *
  17. */
  18. #ifndef M5602_SENSOR_H_
  19. #define M5602_SENSOR_H_
  20. #include "m5602_bridge.h"
  21. #define M5602_DEFAULT_FRAME_WIDTH 640
  22. #define M5602_DEFAULT_FRAME_HEIGHT 480
  23. #define M5602_MAX_CTRLS (V4L2_CID_LASTP1 - V4L2_CID_BASE + 10)
  24. /* Enumerates all supported sensors */
  25. enum sensors {
  26. OV9650_SENSOR = 1,
  27. S5K83A_SENSOR = 2,
  28. S5K4AA_SENSOR = 3,
  29. MT9M111_SENSOR = 4,
  30. PO1030_SENSOR = 5
  31. };
  32. /* Enumerates all possible instruction types */
  33. enum instruction {
  34. BRIDGE,
  35. SENSOR,
  36. SENSOR_LONG
  37. };
  38. struct m5602_sensor {
  39. /* Defines the name of a sensor */
  40. char name[32];
  41. /* What i2c address the sensor is connected to */
  42. u8 i2c_slave_id;
  43. /* Probes if the sensor is connected */
  44. int (*probe)(struct sd *sd);
  45. /* Performs a initialization sequence */
  46. int (*init)(struct sd *sd);
  47. /* Performs a power down sequence */
  48. int (*power_down)(struct sd *sd);
  49. /* Reads a sensor register */
  50. int (*read_sensor)(struct sd *sd, const u8 address,
  51. u8 *i2c_data, const u8 len);
  52. /* Writes to a sensor register */
  53. int (*write_sensor)(struct sd *sd, const u8 address,
  54. u8 *i2c_data, const u8 len);
  55. int nctrls;
  56. struct ctrl ctrls[M5602_MAX_CTRLS];
  57. char nmodes;
  58. struct v4l2_pix_format modes[];
  59. };
  60. #endif