xref: /openbmc/linux/Documentation/driver-api/media/drivers/ccs/ccs.rst (revision 81499d338995fa288464c585f49211cfaa6ffdce)
14ad97bfbSSakari Ailus.. SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
24ad97bfbSSakari Ailus
34ad97bfbSSakari Ailus.. include:: <isonum.txt>
44ad97bfbSSakari Ailus
54ad97bfbSSakari AilusMIPI CCS camera sensor driver
64ad97bfbSSakari Ailus=============================
74ad97bfbSSakari Ailus
84ad97bfbSSakari AilusThe MIPI CCS camera sensor driver is a generic driver for `MIPI CCS
94ad97bfbSSakari Ailus<https://www.mipi.org/specifications/camera-command-set>`_ compliant
104ad97bfbSSakari Ailuscamera sensors. It exposes three sub-devices representing the pixel array,
114ad97bfbSSakari Ailusthe binner and the scaler.
124ad97bfbSSakari Ailus
134ad97bfbSSakari AilusAs the capabilities of individual devices vary, the driver exposes
144ad97bfbSSakari Ailusinterfaces based on the capabilities that exist in hardware.
154ad97bfbSSakari Ailus
164ad97bfbSSakari AilusPixel Array sub-device
174ad97bfbSSakari Ailus----------------------
184ad97bfbSSakari Ailus
194ad97bfbSSakari AilusThe pixel array sub-device represents the camera sensor's pixel matrix, as well
204ad97bfbSSakari Ailusas analogue crop functionality present in many compliant devices. The analogue
214ad97bfbSSakari Ailuscrop is configured using the ``V4L2_SEL_TGT_CROP`` on the source pad (0) of the
224ad97bfbSSakari Ailusentity. The size of the pixel matrix can be obtained by getting the
234ad97bfbSSakari Ailus``V4L2_SEL_TGT_NATIVE_SIZE`` target.
244ad97bfbSSakari Ailus
254ad97bfbSSakari AilusBinner
264ad97bfbSSakari Ailus------
274ad97bfbSSakari Ailus
284ad97bfbSSakari AilusThe binner sub-device represents the binning functionality on the sensor. For
294ad97bfbSSakari Ailusthat purpose, selection target ``V4L2_SEL_TGT_COMPOSE`` is supported on the
304ad97bfbSSakari Ailussink pad (0).
314ad97bfbSSakari Ailus
324ad97bfbSSakari AilusAdditionally, if a device has no scaler or digital crop functionality, the
334ad97bfbSSakari Ailussource pad (1) expses another digital crop selection rectangle that can only
344ad97bfbSSakari Ailuscrop at the end of the lines and frames.
354ad97bfbSSakari Ailus
364ad97bfbSSakari AilusScaler
374ad97bfbSSakari Ailus------
384ad97bfbSSakari Ailus
394ad97bfbSSakari AilusThe scaler sub-device represents the digital crop and scaling functionality of
404ad97bfbSSakari Ailusthe sensor. The V4L2 selection target ``V4L2_SEL_TGT_CROP`` is used to
414ad97bfbSSakari Ailusconfigure the digital crop on the sink pad (0) when digital crop is supported.
424ad97bfbSSakari AilusScaling is configured using selection target ``V4L2_SEL_TGT_COMPOSE`` on the
434ad97bfbSSakari Ailussink pad (0) as well.
444ad97bfbSSakari Ailus
454ad97bfbSSakari AilusAdditionally, if the scaler sub-device exists, its source pad (1) exposes
464ad97bfbSSakari Ailusanother digital crop selection rectangle that can only crop at the end of the
474ad97bfbSSakari Ailuslines and frames.
484ad97bfbSSakari Ailus
494ad97bfbSSakari AilusDigital and analogue crop
504ad97bfbSSakari Ailus-------------------------
514ad97bfbSSakari Ailus
524ad97bfbSSakari AilusDigital crop functionality is referred to as cropping that effectively works by
534ad97bfbSSakari Ailusdropping some data on the floor. Analogue crop, on the other hand, means that
544ad97bfbSSakari Ailusthe cropped information is never retrieved. In case of camera sensors, the
554ad97bfbSSakari Ailusanalogue data is never read from the pixel matrix that are outside the
564ad97bfbSSakari Ailusconfigured selection rectangle that designates crop. The difference has an
574ad97bfbSSakari Ailuseffect in device timing and likely also in power consumption.
584ad97bfbSSakari Ailus
594ad97bfbSSakari AilusRegister definition generator
604ad97bfbSSakari Ailus-----------------------------
614ad97bfbSSakari Ailus
623bf10ebcSSakari AilusThe ccs-regs.asc file contains MIPI CCS register definitions that are used
634ad97bfbSSakari Ailusto produce C source code files for definitions that can be better used by
644ad97bfbSSakari Ailusprograms written in C language. As there are many dependencies between the
654ad97bfbSSakari Ailusproduced files, please do not modify them manually as it's error-prone and
664ad97bfbSSakari Ailusin vain, but instead change the script producing them.
674ad97bfbSSakari Ailus
684ad97bfbSSakari AilusUsage
694ad97bfbSSakari Ailus~~~~~
704ad97bfbSSakari Ailus
714ad97bfbSSakari AilusConventionally the script is called this way to update the CCS driver
724ad97bfbSSakari Ailusdefinitions:
734ad97bfbSSakari Ailus
744ad97bfbSSakari Ailus.. code-block:: none
754ad97bfbSSakari Ailus
764ad97bfbSSakari Ailus	$ Documentation/driver-api/media/drivers/ccs/mk-ccs-regs -k \
774ad97bfbSSakari Ailus		-e drivers/media/i2c/ccs/ccs-regs.h \
784ad97bfbSSakari Ailus		-L drivers/media/i2c/ccs/ccs-limits.h \
794ad97bfbSSakari Ailus		-l drivers/media/i2c/ccs/ccs-limits.c \
803bf10ebcSSakari Ailus		-c Documentation/driver-api/media/drivers/ccs/ccs-regs.asc
814ad97bfbSSakari Ailus
82*81499d33SSakari AilusCCS PLL calculator
83*81499d33SSakari Ailus==================
84*81499d33SSakari Ailus
85*81499d33SSakari AilusThe CCS PLL calculator is used to compute the PLL configuration, given sensor's
86*81499d33SSakari Ailuscapabilities as well as board configuration and user specified configuration. As
87*81499d33SSakari Ailusthe configuration space that encompasses all these configurations is vast, the
88*81499d33SSakari AilusPLL calculator isn't entirely trivial. Yet it is relatively simple to use for a
89*81499d33SSakari Ailusdriver.
90*81499d33SSakari Ailus
91*81499d33SSakari AilusThe PLL model implemented by the PLL calculator corresponds to MIPI CCS 1.1.
92*81499d33SSakari Ailus
93*81499d33SSakari Ailus.. kernel-doc:: drivers/media/i2c/ccs-pll.h
94*81499d33SSakari Ailus
954ad97bfbSSakari Ailus**Copyright** |copy| 2020 Intel Corporation
96