ccs.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. .. SPDX-License-Identifier: GPL-2.0-only
  2. .. include:: <isonum.txt>
  3. .. _media-ccs-uapi:
  4. MIPI CCS camera sensor driver
  5. =============================
  6. The MIPI CCS camera sensor driver is a generic driver for `MIPI CCS
  7. <https://www.mipi.org/specifications/camera-command-set>`_ compliant
  8. camera sensors. It exposes three sub-devices representing the pixel array,
  9. the binner and the scaler.
  10. As the capabilities of individual devices vary, the driver exposes
  11. interfaces based on the capabilities that exist in hardware.
  12. Also see :ref:`the CCS driver kernel documentation <media-ccs-driver>`.
  13. Pixel Array sub-device
  14. ----------------------
  15. The pixel array sub-device represents the camera sensor's pixel matrix, as well
  16. as analogue crop functionality present in many compliant devices. The analogue
  17. crop is configured using the ``V4L2_SEL_TGT_CROP`` on the source pad (0) of the
  18. entity. The size of the pixel matrix can be obtained by getting the
  19. ``V4L2_SEL_TGT_NATIVE_SIZE`` target.
  20. Binner
  21. ------
  22. The binner sub-device represents the binning functionality on the sensor. For
  23. that purpose, selection target ``V4L2_SEL_TGT_COMPOSE`` is supported on the
  24. sink pad (0).
  25. Additionally, if a device has no scaler or digital crop functionality, the
  26. source pad (1) exposes another digital crop selection rectangle that can only
  27. crop at the end of the lines and frames.
  28. Scaler
  29. ------
  30. The scaler sub-device represents the digital crop and scaling functionality of
  31. the sensor. The V4L2 selection target ``V4L2_SEL_TGT_CROP`` is used to
  32. configure the digital crop on the sink pad (0) when digital crop is supported.
  33. Scaling is configured using selection target ``V4L2_SEL_TGT_COMPOSE`` on the
  34. sink pad (0) as well.
  35. Additionally, if the scaler sub-device exists, its source pad (1) exposes
  36. another digital crop selection rectangle that can only crop at the end of the
  37. lines and frames.
  38. Digital and analogue crop
  39. -------------------------
  40. Digital crop functionality is referred to as cropping that effectively works by
  41. dropping some data on the floor. Analogue crop, on the other hand, means that
  42. the cropped information is never retrieved. In case of camera sensors, the
  43. analogue data is never read from the pixel matrix that are outside the
  44. configured selection rectangle that designates crop. The difference has an
  45. effect in device timing and likely also in power consumption.
  46. Private controls
  47. ----------------
  48. The MIPI CCS driver implements a number of private controls under
  49. ``V4L2_CID_USER_BASE_CCS`` to control the MIPI CCS compliant camera sensors.
  50. Analogue gain model
  51. ~~~~~~~~~~~~~~~~~~~
  52. The CCS defines an analogue gain model where the gain can be calculated using
  53. the following formula:
  54. gain = m0 * x + c0 / (m1 * x + c1)
  55. Either m0 or c0 will be zero. The constants that are device specific, can be
  56. obtained from the following controls:
  57. V4L2_CID_CCS_ANALOGUE_GAIN_M0
  58. V4L2_CID_CCS_ANALOGUE_GAIN_M1
  59. V4L2_CID_CCS_ANALOGUE_GAIN_C0
  60. V4L2_CID_CCS_ANALOGUE_GAIN_C1
  61. The analogue gain (``x`` in the formula) is controlled through
  62. ``V4L2_CID_ANALOGUE_GAIN`` in this case.
  63. Alternate analogue gain model
  64. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  65. The CCS defines another analogue gain model called alternate analogue gain. In
  66. this case, the formula to calculate actual gain consists of linear and
  67. exponential parts:
  68. gain = linear * 2 ^ exponent
  69. The ``linear`` and ``exponent`` factors can be set using the
  70. ``V4L2_CID_CCS_ANALOGUE_LINEAR_GAIN`` and
  71. ``V4L2_CID_CCS_ANALOGUE_EXPONENTIAL_GAIN`` controls, respectively
  72. Shading correction
  73. ~~~~~~~~~~~~~~~~~~
  74. The CCS standard supports lens shading correction. The feature can be controlled
  75. using ``V4L2_CID_CCS_SHADING_CORRECTION``. Additionally, the luminance
  76. correction level may be changed using
  77. ``V4L2_CID_CCS_LUMINANCE_CORRECTION_LEVEL``, where value 0 indicates no
  78. correction and 128 indicates correcting the luminance in corners to 10 % less
  79. than in the centre.
  80. Shading correction needs to be enabled for luminance correction level to have an
  81. effect.
  82. **Copyright** |copy| 2020 Intel Corporation