fimc-is-sensor.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver
  3. *
  4. * Copyright (C) 2013 Samsung Electronics Co., Ltd.
  5. *
  6. * Authors: Sylwester Nawrocki <s.nawrocki@samsung.com>
  7. * Younghwan Joo <yhwan.joo@samsung.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #ifndef FIMC_IS_SENSOR_H_
  14. #define FIMC_IS_SENSOR_H_
  15. #include <linux/clk.h>
  16. #include <linux/device.h>
  17. #include <linux/kernel.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/regulator/consumer.h>
  20. #include <linux/videodev2.h>
  21. #include <media/v4l2-subdev.h>
  22. #define FIMC_IS_SENSOR_OPEN_TIMEOUT 2000 /* ms */
  23. #define FIMC_IS_SENSOR_DEF_PIX_WIDTH 1296
  24. #define FIMC_IS_SENSOR_DEF_PIX_HEIGHT 732
  25. #define S5K6A3_SENSOR_WIDTH 1392
  26. #define S5K6A3_SENSOR_HEIGHT 1392
  27. #define SENSOR_NUM_SUPPLIES 2
  28. enum fimc_is_sensor_id {
  29. FIMC_IS_SENSOR_ID_S5K3H2 = 1,
  30. FIMC_IS_SENSOR_ID_S5K6A3,
  31. FIMC_IS_SENSOR_ID_S5K4E5,
  32. FIMC_IS_SENSOR_ID_S5K3H7,
  33. FIMC_IS_SENSOR_ID_CUSTOM,
  34. FIMC_IS_SENSOR_ID_END
  35. };
  36. #define IS_SENSOR_CTRL_BUS_I2C0 0
  37. #define IS_SENSOR_CTRL_BUS_I2C1 1
  38. struct sensor_drv_data {
  39. enum fimc_is_sensor_id id;
  40. const char * const subdev_name;
  41. unsigned int width;
  42. unsigned int height;
  43. };
  44. /**
  45. * struct fimc_is_sensor - fimc-is sensor data structure
  46. * @dev: pointer to this I2C client device structure
  47. * @subdev: the image sensor's v4l2 subdev
  48. * @pad: subdev media source pad
  49. * @supplies: image sensor's voltage regulator supplies
  50. * @gpio_reset: GPIO connected to the sensor's reset pin
  51. * @drvdata: a pointer to the sensor's parameters data structure
  52. * @i2c_bus: ISP I2C bus index (0...1)
  53. * @test_pattern: true to enable video test pattern
  54. * @lock: mutex protecting the structure's members below
  55. * @format: media bus format at the sensor's source pad
  56. */
  57. struct fimc_is_sensor {
  58. struct device *dev;
  59. struct v4l2_subdev subdev;
  60. struct media_pad pad;
  61. struct regulator_bulk_data supplies[SENSOR_NUM_SUPPLIES];
  62. int gpio_reset;
  63. const struct sensor_drv_data *drvdata;
  64. unsigned int i2c_bus;
  65. bool test_pattern;
  66. struct mutex lock;
  67. struct v4l2_mbus_framefmt format;
  68. };
  69. static inline
  70. struct fimc_is_sensor *sd_to_fimc_is_sensor(struct v4l2_subdev *sd)
  71. {
  72. return container_of(sd, struct fimc_is_sensor, subdev);
  73. }
  74. int fimc_is_register_sensor_driver(void);
  75. void fimc_is_unregister_sensor_driver(void);
  76. #endif /* FIMC_IS_SENSOR_H_ */