s5p_fimc.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Samsung S5P/Exynos4 SoC series camera interface driver header
  3. *
  4. * Copyright (C) 2010 - 2013 Samsung Electronics Co., Ltd.
  5. * Sylwester Nawrocki <s.nawrocki@samsung.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef S5P_FIMC_H_
  12. #define S5P_FIMC_H_
  13. #include <media/media-entity.h>
  14. /*
  15. * Enumeration of data inputs to the camera subsystem.
  16. */
  17. enum fimc_input {
  18. FIMC_INPUT_PARALLEL_0 = 1,
  19. FIMC_INPUT_PARALLEL_1,
  20. FIMC_INPUT_MIPI_CSI2_0 = 3,
  21. FIMC_INPUT_MIPI_CSI2_1,
  22. FIMC_INPUT_WRITEBACK_A = 5,
  23. FIMC_INPUT_WRITEBACK_B,
  24. FIMC_INPUT_WRITEBACK_ISP = 5,
  25. };
  26. /*
  27. * Enumeration of the FIMC data bus types.
  28. */
  29. enum fimc_bus_type {
  30. /* Camera parallel bus */
  31. FIMC_BUS_TYPE_ITU_601 = 1,
  32. /* Camera parallel bus with embedded synchronization */
  33. FIMC_BUS_TYPE_ITU_656,
  34. /* Camera MIPI-CSI2 serial bus */
  35. FIMC_BUS_TYPE_MIPI_CSI2,
  36. /* FIFO link from LCD controller (WriteBack A) */
  37. FIMC_BUS_TYPE_LCD_WRITEBACK_A,
  38. /* FIFO link from LCD controller (WriteBack B) */
  39. FIMC_BUS_TYPE_LCD_WRITEBACK_B,
  40. /* FIFO link from FIMC-IS */
  41. FIMC_BUS_TYPE_ISP_WRITEBACK = FIMC_BUS_TYPE_LCD_WRITEBACK_B,
  42. };
  43. #define fimc_input_is_parallel(x) ((x) == 1 || (x) == 2)
  44. #define fimc_input_is_mipi_csi(x) ((x) == 3 || (x) == 4)
  45. struct i2c_board_info;
  46. /**
  47. * struct fimc_source_info - video source description required for the host
  48. * interface configuration
  49. *
  50. * @board_info: pointer to I2C subdevice's board info
  51. * @clk_frequency: frequency of the clock the host interface provides to sensor
  52. * @fimc_bus_type: FIMC camera input type
  53. * @sensor_bus_type: image sensor bus type, MIPI, ITU-R BT.601 etc.
  54. * @flags: the parallel sensor bus flags defining signals polarity (V4L2_MBUS_*)
  55. * @i2c_bus_num: i2c control bus id the sensor is attached to
  56. * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU)
  57. * @clk_id: index of the SoC peripheral clock for sensors
  58. */
  59. struct fimc_source_info {
  60. struct i2c_board_info *board_info;
  61. unsigned long clk_frequency;
  62. enum fimc_bus_type fimc_bus_type;
  63. enum fimc_bus_type sensor_bus_type;
  64. u16 flags;
  65. u16 i2c_bus_num;
  66. u16 mux_id;
  67. u8 clk_id;
  68. };
  69. /**
  70. * struct s5p_platform_fimc - camera host interface platform data
  71. *
  72. * @source_info: properties of an image source for the host interface setup
  73. * @num_clients: the number of attached image sources
  74. */
  75. struct s5p_platform_fimc {
  76. struct fimc_source_info *source_info;
  77. int num_clients;
  78. };
  79. /*
  80. * v4l2_device notification id. This is only for internal use in the kernel.
  81. * Sensor subdevs should issue S5P_FIMC_TX_END_NOTIFY notification in single
  82. * frame capture mode when there is only one VSYNC pulse issued by the sensor
  83. * at begining of the frame transmission.
  84. */
  85. #define S5P_FIMC_TX_END_NOTIFY _IO('e', 0)
  86. enum fimc_subdev_index {
  87. IDX_SENSOR,
  88. IDX_CSIS,
  89. IDX_FLITE,
  90. IDX_IS_ISP,
  91. IDX_FIMC,
  92. IDX_MAX,
  93. };
  94. struct media_pipeline;
  95. struct v4l2_subdev;
  96. struct fimc_pipeline {
  97. struct v4l2_subdev *subdevs[IDX_MAX];
  98. struct media_pipeline *m_pipeline;
  99. };
  100. /*
  101. * Media pipeline operations to be called from within the fimc(-lite)
  102. * video node when it is the last entity of the pipeline. Implemented
  103. * by corresponding media device driver.
  104. */
  105. struct fimc_pipeline_ops {
  106. int (*open)(struct fimc_pipeline *p, struct media_entity *me,
  107. bool resume);
  108. int (*close)(struct fimc_pipeline *p);
  109. int (*set_stream)(struct fimc_pipeline *p, bool state);
  110. };
  111. #define fimc_pipeline_call(f, op, p, args...) \
  112. (!(f) ? -ENODEV : (((f)->pipeline_ops && (f)->pipeline_ops->op) ? \
  113. (f)->pipeline_ops->op((p), ##args) : -ENOIOCTLCMD))
  114. #endif /* S5P_FIMC_H_ */