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 59*66c3b67aSSakari AilusCCS static data 60*66c3b67aSSakari Ailus--------------- 61*66c3b67aSSakari Ailus 62*66c3b67aSSakari AilusThe MIPI CCS driver supports CCS static data for all compliant devices, 63*66c3b67aSSakari Ailusincluding not just those compliant with CCS 1.1 but also CCS 1.0 and SMIA(++). 64*66c3b67aSSakari AilusFor CCS the file names are formed as 65*66c3b67aSSakari Ailus 66*66c3b67aSSakari Ailus ccs/ccs-sensor-vvvv-mmmm-rrrr.fw (sensor) and 67*66c3b67aSSakari Ailus ccs/ccs-module-vvvv-mmmm-rrrr.fw (module). 68*66c3b67aSSakari Ailus 69*66c3b67aSSakari AilusFor SMIA++ compliant devices the corresponding file names are 70*66c3b67aSSakari Ailus 71*66c3b67aSSakari Ailus ccs/smiapp-sensor-vv-mmmm-rr.fw (sensor) and 72*66c3b67aSSakari Ailus ccs/smiapp-module-vv-mmmm-rrrr.fw (module). 73*66c3b67aSSakari Ailus 74*66c3b67aSSakari AilusFor SMIA (non-++) compliant devices the static data file name is 75*66c3b67aSSakari Ailus 76*66c3b67aSSakari Ailus ccs/smia-sensor-vv-mmmm-rr.fw (sensor). 77*66c3b67aSSakari Ailus 78*66c3b67aSSakari Ailusvvvv or vv denotes MIPI and SMIA manufacturer IDs respectively, mmmm model ID 79*66c3b67aSSakari Ailusand rrrr or rr revision number. 80*66c3b67aSSakari Ailus 814ad97bfbSSakari AilusRegister definition generator 824ad97bfbSSakari Ailus----------------------------- 834ad97bfbSSakari Ailus 843bf10ebcSSakari AilusThe ccs-regs.asc file contains MIPI CCS register definitions that are used 854ad97bfbSSakari Ailusto produce C source code files for definitions that can be better used by 864ad97bfbSSakari Ailusprograms written in C language. As there are many dependencies between the 874ad97bfbSSakari Ailusproduced files, please do not modify them manually as it's error-prone and 884ad97bfbSSakari Ailusin vain, but instead change the script producing them. 894ad97bfbSSakari Ailus 904ad97bfbSSakari AilusUsage 914ad97bfbSSakari Ailus~~~~~ 924ad97bfbSSakari Ailus 934ad97bfbSSakari AilusConventionally the script is called this way to update the CCS driver 944ad97bfbSSakari Ailusdefinitions: 954ad97bfbSSakari Ailus 964ad97bfbSSakari Ailus.. code-block:: none 974ad97bfbSSakari Ailus 984ad97bfbSSakari Ailus $ Documentation/driver-api/media/drivers/ccs/mk-ccs-regs -k \ 994ad97bfbSSakari Ailus -e drivers/media/i2c/ccs/ccs-regs.h \ 1004ad97bfbSSakari Ailus -L drivers/media/i2c/ccs/ccs-limits.h \ 1014ad97bfbSSakari Ailus -l drivers/media/i2c/ccs/ccs-limits.c \ 1023bf10ebcSSakari Ailus -c Documentation/driver-api/media/drivers/ccs/ccs-regs.asc 1034ad97bfbSSakari Ailus 10481499d33SSakari AilusCCS PLL calculator 10581499d33SSakari Ailus================== 10681499d33SSakari Ailus 10781499d33SSakari AilusThe CCS PLL calculator is used to compute the PLL configuration, given sensor's 10881499d33SSakari Ailuscapabilities as well as board configuration and user specified configuration. As 10981499d33SSakari Ailusthe configuration space that encompasses all these configurations is vast, the 11081499d33SSakari AilusPLL calculator isn't entirely trivial. Yet it is relatively simple to use for a 11181499d33SSakari Ailusdriver. 11281499d33SSakari Ailus 11381499d33SSakari AilusThe PLL model implemented by the PLL calculator corresponds to MIPI CCS 1.1. 11481499d33SSakari Ailus 11581499d33SSakari Ailus.. kernel-doc:: drivers/media/i2c/ccs-pll.h 11681499d33SSakari Ailus 1174ad97bfbSSakari Ailus**Copyright** |copy| 2020 Intel Corporation 118