高通camera驅動 camx相關內容 (二)

camx

編譯環境中的driver文件的相關位置

  • sensor driver XML files : chi-cdk/vendor/sensor/default/<sensor_name>/<sensor_name)_sensor.xml.
  • Module configuration files : chi-cdk/vendor/module/<module_name>_module.xml.
  • Kernel dts files : kernel/msm-4.9/arch/arm64/boot/dts/qcom/<target_name>-camera-sensor-<platform>.dtsi.
  • Submodule driver XML files : chi-cdk/vendor/sensor/default/<sub-module_name>/< sub-module _name_sub-module>.xml. For example, chi-cdk/vendor/sensor/default/actuator/<actuator_name>_actuator.xml.
  • The driver binary in the device vendor makefile to be included in the build is at vendor/qcom/proprietary/common/config/device-vendor.mk. For example, MM_CAMERA +=com.qti.sensormodule.<sensor_name>.bin.

Sensor information nodes (sensor 信息節點)

slaveInfo: XML文件中的slaveInfo節點保存驅動程序在 probe sensor 時使用的信息,包括I2C地址 I2C頻率 sensor寄存器地址 sensor寄存器值 上下電時序等,注意需要完全按照廠商提供的sensor spec填寫

                                                                  Sensor slave information node

節點 描述
slaveInfo Contains the sensor slave information and power settings.
sensorName Name of the sensor.
Example: imx230
slaveAddress 8 bit or 10 bit slave address
Example: 32
For 0x20 slave address, the field value is 32.
regAddrType  Register address/data size in bytes.
Example:
  • 1 = Byte address
  • 2 = Word address
  • 3 = 3 byte address
  • 4 = Address type max
regDataType

Register address/data size in bytes.
Example:

  • 1 = Byte data
  • 2 = Word data
  • 3 = Double word data
  • 4 = Data type max
sensorIdRegAddr Register address for sensor ID.
Example: 22
sensorId Sensor ID.
Example: 560
sensorIDMask  Mask for sensor ID. Sensor ID may only be a few bits.
Example: 4294967295
i2cFrequencyMode I2C Frequency mode of slave.
Example: FAST
Supported modes are:
  • STANDARD (100 kHz)
  • FAST (400 kHz)
  • FAST_PLUS (1 MHz)
  • CUSTOM (custom frequency in DTSI)
powerUpSequence Contains the power-up configuration sequence required to control the
power to the device while turning it on.
Example:
<powerUpSequence>
<powerSetting>
<configType>RESET</configType>
<configValue>0</configValue>
<delayMs>0</delayMs>
</powerSetting>
</ powerUpSequence>
powerSetting Contains power configuration type, value, and delay.
configType Power configuration type.
Example: MCLK
Supported types are:
  • MCLK
  • VANA
  • VDIG
  • VIO
  • VAF
  • RESET
  • STANDBY
configValue  Power configuration type.
Example: 24000000
delayMs Delay in milliseconds.
Example: 1
powerDownSequence Contains the power-down configuration sequence that is required to control the power to the device while closing it.
Example:
<powerDownSequence>
<powerSetting>
<configType>RESET</configType>
<configValue>0</configValue>
<delayMs>0</delayMs>
</powerSetting>
</ powerDownSequence>

refAddrInfo : register information節點包含用於設置gain, frame length lines, and test pattern generation等各種傳感器功能的配置寄存器地址。

節點 描述
regAddrInfo Contains the information about the register addresses for various sensor settings.
xOutput Controls the program width.
Example: 844
If the register address is 0x34C then the value of this field is 844
yOutput Controls the program height.
Example: 846
frameLengthLines Programs the frame length lines.
Example: 832
lineLengthPixelClock Programs the line length pixel clock.
Example: 834
globalGainAddr  Program the gain channel.
Example: 516
digitalGainRedAddr Programs digital gain for the red channel.
This address is optional but is required if supported by sensor.
Example: 528
digitalGainGreenRedAddr Programs digital gain for the green-red channel.
This address is optional but is required if supported by sensor.
Example: 526
digitalGainBlueAddr  Register address to program digital gain for the blue channel. This address is optional but is required if supported by sensor.
Example: 530
digitalGainGreenBlueAddr  Programs digital gain for the green-blue channel. The address is optional but is required when supported by sensor.
Example: 532
testPatternRAddr Programs manual test pattern value for the red channel.
Example: 1538
testPatternGRAddr Programs manual test pattern value for the red channel.
Example: 1540
testPatternBAddr Programs manual test pattern value for the red channel.
Example: 1542
testPatternGBAddr Programs manual test pattern value for the red channel.
Example: 1544

resolutionInfo: The resolution information node 包含有關分辨率設置和配置的信息。

節點 描述
resolutionInfo This node holds the configuration and settings for all the resolutions.
resolutionData  Holds the configuration data for one resolution.
The number of sensor supported resolutions is equal to the number of resolutionData nodes.
NOTE: First node of the resolutionData should always point to the full resolution configuration of the sensor.
colorFilterArrangement Color filter arrangement of the sensor.
Example: BAYER_RGGB
Supported filter arrangements are:
  • BAYER_BGGR
  • BAYER_GBRG
  • BAYER_GRBG
  • BAYER_RGGB
  • BAYER_Y
  • YUV_UYVY
  • YUV_YUYV
streamInfo Information related to the stream configuration.
Example:
<streamInfo>
<streamConfiguration>
<vc range="[0,3]">0</vc>
<dt>43</dt>
<frameDimension>
<xStart>0</xStart>
<yStart>0</yStart>
<width>4608</width>
<height>2592</height>
</frameDimension>
<bitWidth>10</bitWidth>
<type>IMAGE</type>
</streamConfiguration>
</streamInfo>
streamConfiguration Information related to the stream data.
vc Virtual channel of the data
Example: 2
Each unique combination of virtual channel (VC) and DT should map
to a unique channel identifier (CID) value. Possible CID values for a
given VC are:
  • 0 – 0, 1, 2, 3
  • 1 – 4, 5, 6, 7
  • 2 – 8, 9, 10, 11
  • 3 – 12, 13, 14, 15
Valid values for VC are: 0, 1, 2, and 3
dt DT of the stream.
Example: 43
Default value is 0x2B (10 bit RAW)
frameDimension Frame dimension contains x and y start coordinates, and the total width and height of the image.
xStart  X coordinate of start of image.
yStart Y coordinate of start of image.
width Width of the image.
height Height of the image
bitWidth  Bit width of the data.
type

Stream type
Example: IMAGE
Supported stream types are:

  • BLOB
  • IMAGE
  • PDAF
  • HDR
  • META
lineLengthPixelClock Line length pixel clock of frame.
Typically, this value is the active width + blanking width.
frameLengthLines  Frame length lines of frame.
Typically, this value is the active height + blanking height.
minHorizontalBlanking Minimum horizontal blanking interval in pixels.
minVerticalBlanking Minimum horizontal blanking interval in lines
outputPixelClock Represents how much data comes out of the camera over MIPI lanes to set the VFE clock.
op_pixel_clk = (Total data rate from sensor)/(Bits per pixel)
For example, if the MIPI DDR clock value (speed of the clock lane of the MIPI camera sensor) is 300 MHz and the sensor transmits on four lanes, each lane has a 600 MHz data rate. Thus, the total data rate is 2400 MHz.
For 10 bits per pixel bayer data, the op_pixel_clk value is 2400/10 = 240 MHz. The values are filled in accordance with the sensor specifications.
The values are calculated based on the register settings configured for the camera sensor.
horizontalBinning Horizontal binning value.
verticalBinning Vertical binning value.
framerate Maximum frame rate
laneCount The number of data lanes on which the sensor outputs data for a given mode of operation. The maximum data lane capability (given in the datasheet) of the sensor along with the sensor register settings configured in the driver determines the value
settleTimeNs

Settle time in nanoseconds.
The value is configured, based on the output characteristics of the
sensor, to ensure that the PHY transmitter of the sensor does not
have sync issues with the PHY receiver of MSM chipsets.
For 28 nm and smaller MSM parts, use the following formula to calculate the settle count:
settle_CNT=(T(HS_SETTLE)_AVG)/T(TIMER_CLK)
where,
T(HS_SETTLE)_avg = (T(HS_SETTLE)_min +
T(HS_SETTLE)_max ) / 2
as indicated by sensor datasheet.
TIMER_CLK refers to the operating frequency of PHY interface to which the camera sensor is connected (for example, CAMSS_PHY0_CSI0PHYTIMER_CLK for PHY0). This value is set in the kernel/arch/arm/boot/dts/msm/msmXXXX-camera.dtsi file,
where XXXX refers to the MSM chipset is used.

 

T(TIMER_CLK) is the duration of a clock cycle when the operating frequency is equal to TIMER_CLK, and is represented in nano second units. For example, T(TIMER_CLK) for TIMER_CLK 200
MHz is (1 × (10^9))/(200 × (10^6)) = 5 ns.

 

If the calculated value does not work as expected, try alternating the lower values between T(HS_SETTLE)_avg/T(TIMER_CLK) and T(HS_SETTLE)_min/T(TIMER_CLK) are tried.
See https://mipi.org/specifications/d-phy for more details on
T(HS_SETTLE)

is3Phase Flag to know if the sensor is a three-phase sensor (C-PHY) or one-phase sensor (D-PHY).
resSettings Sequence of register settings to configure the device with this resolution.
NOTE: Do not add stream on settings for the sensor in the
initialization settings, as this enables the sensor streaming before real software stream on and may cause PHY to miss LP sequence.
Example:
<resSettings>
<regSetting>
<registerAddr>0x114</registerAddr>
<registerData>0x3</registerData>
<regAddrType range="[1,4]">2</regAddrType>
<regDataType range="[1,4]">1</regDataType>
<operation>WRITE</operation>
<delayUs>0x0</delayUs>
</regSetting>
<resSettings>
regSetting This node holds one register configuration and forms a unit of large-resolution register settings sequence.
registerAddr Register address that is accessed.
registerData If the operation is WRITE, registerData is the data value to be written into the specified register address.
If the operation is READ, registerData is the number of bytes to be read from the specified register address.
regAddrType Type of register address.
regAddrType Type of register address.
regDataType Type of register data.
operation Type of operation
Supported values:
  • WRITE
  • READ
  • POLL
delayUs Delay in microseconds. If not explicitly specified, the delay is zero.
cropInfo Crop information of the frame.
Example:
<cropInfo>
<left>0</left>
<right>0</right>
<top>0</top>
<bottom>0</bottom>
</cropInfo>
left Left crop pixel information.
right Right crop pixel information.
top  Top crop pixel information.
bottom  Bottom crop pixel information.
capability List of features/capabilities supported by the sensor.
Supported features are:
HFR
iHDR
INSENSOR_HDR
PDAF
QUADRA_CFA
RAW_HDR
ZIGZAG_HDR

exposureControlInfo: The exposure control information node 包含曝光細節,如  maximum gain, maximum line count, and conversion formulas for gain manipulation.

節點 描述
exposureControlInfo  This node holds the information about the exposure details such as maximum gain, maximum line count, and conversion formulas for gain manipulation.
Example:
<exposureControlInfo>
<maxAnalogGain>8</maxAnalogGain>
<maxDigitalGain>2</maxDigitalGain>
<verticalOffset>20</verticalOffset>
<maxLineCount>65515</maxLineCount>
<realToRegGain>512-(512/realGain)</realToRegGain>
<regToRealGain>512/(512-regGain)</regToRealGain>
</exposureControlInfo>
maxAnalogGain Maximum analog gain supported by the sensor.
maxDigitalGain  Maximum digital gain supported by the sensor.
verticalOffset Minimum offset to be maintained between the line count and frame length lines.
maxLineCount Maximum line count supported by the sensor.
realToRegGain  Real gain to register the gain equation.
The equation must contain realGain in the equation.
regToRealGain Register gain to real gain equation.
The equation must contain regGain in the equation.

streamOnSettings: Register settings to start streaming.

節點 描述
streamOffSettings  Sequence of register settings to configure the device to stop streaming.
Configure the following settings to match this guideline and take the clock and data lanes to LP11.
Example:
<streamOffSettings>
<regSetting>
<registerAddr>0x0100</registerAddr>
<registerData>0x0</registerData>
<regAddrType range="[1,4]">2</regAddrType>
<regDataType range="[1,4]">1</regDataType>
<operation>WRITE</operation>
<delayUs>0</delayUs>
</regSetting>
</streamOffSettings>
regSetting  Register setting configuration.
Contains: Register address, register data, register address type, register DT, operation, and delay in micro seconds
streamOffSettings Sequence of register settings to configure the device to stop streaming.
Configure the following settings to match this guideline and take the clock and data lanes to LP11.
Example:
<streamOffSettings>
<regSetting>
<registerAddr>0x0100</registerAddr>
<registerData>0x0</registerData>
<regAddrType range="[1,4]">2</regAddrType>
<regDataType range="[1,4]">1</regDataType>
<operation>WRITE</operation>
<delayUs>0</delayUs>
</regSetting>
</streamOffSettings>
regSetting Register setting configuration.
Contains: Register address, register data, register address type, register DT, operation, and delay in micro seconds

groupHoldOnSettings: Register settings to configure the device in group hold settings.

節點 描述
groupHoldOnSettings Sequence of register settings to configure the device in group hold settings.
Example:
<groupHoldOnSettings>
<regSetting>
<registerAddr>0x0104</registerAddr>
<registerData>0x1</registerData>
<regAddrType range="[1,4]">2</regAddrType>
<regDataType range="[1,4]">1</regDataType>
<operation>WRITE</operation>
<delayUs>0</delayUs>
</regSetting>
</groupHoldOnSettings>
regSetting Register setting configuration.
Contains: Register address, register data, register address type,
register data type, operation, and delay in micro seconds.
groupHoldOffSettings Sequence of register settings to configure the device to stop group hold settings.
Example:
<groupHoldOffSettings>
<regSetting>
<registerAddr>0x0104</registerAddr>
<registerData>0x0</registerData>
<regAddrType range="[1,4]">2</regAddrType>
<regDataType range="[1,4]">1</regDataType>
<operation>WRITE</operation>
<delayUs>0</delayUs>
</regSetting>
</groupHoldOffSettings>
regSetting Register setting configuration.
Contains: Register address, register data, register address type, register data type, operation, and delay in micro seconds.

initSettings: Sequence of register settings to initialize the sensor.

節點 描述
initSettings Sequence of register settings to initialize the sensor.
NOTE: Do not add stream on settings for the sensor in the
initialization settings, as this enables the sensor streaming before real software stream on and may cause PHY to miss LP sequence.
Example:
<initSettings>
<regSetting>
<registerAddr>0x136</registerAddr>
<registerData>0x18</registerData>
<regAddrType range="[1,4]">2</regAddrType>
<regDataType range="[1,4]">1</regDataType>
<operation>WRITE</operation>
<delayUs>0</delayUs>
</regSetting>
</initSettings>
regSetting Register setting configuration.
Contains: Register address, register data, register address type, register data type, operation, and delay in micro seconds.

testPatternInfo: This node contains the information about the test pattern generation register settings.

節點 描述
testPatternInfo Contains the information about the test pattern generation register settings.
Example:
<testPatternInfo>
<testPatternData>
<mode>OFF</mode>
<settings>
<regSetting>
<registerAddr>0x136</registerAddr>
<registerData>0x18</registerData>
<regAddrType range="[1,4]">2</regAddrType>
<regDataType range="[1,4]">1</regDataType>
<operation>WRITE</operation>
<delayUs>0</delayUs>
</regSetting>
</settings>
</testPatternData>
</testPatternInfo>
testPatternData This node holds the register and mode settings of a particular test pattern.
Mode Supported modes are: 
OFF 
SOLID_COLOR 
COLOR_BARS 
COLOR_BARS_FADE_TO_GRAY 
PN9
CUSTOM1
settings Sequence of register settings to configure the test pattern on the sensor.
regSetting Register setting configuration.
Contains: Register address, register data, register address type, register data type, operation, and delay in micro seconds.

colorLevelInfo: The color level information node provides details about the various channels in complete dark light.

節點 描述
colorLevelInfo Color level information.
The default currents in various channels in complete dark light.
Example:
<colorLevelInfo>
<whiteLevel>1023</whiteLevel>
<rPedestal>64</rPedestal>
<grPedestal>64</grPedestal>
<bPedestal>64</bPedestal>
<gbPedestal>64</gbPedestal>
</colorLevelInfo>
whiteLevel White level value.
rPedestal Pedestal value for the red channel.
grPedestal Pedestal value for the green-red channel.
bPedestal Pedestal value for the blue channel.
gbPedestal Pedestal value for the green-blue channel.
opticalBlackRegionInfo Information about black regions.
Multiple black regions are provided, if applicable.
Example:
<opticalBlackRegionInfo>
<dimension>
<xStart>0</xStart>
<yStart>0</yStart>
<width>4608</width>
<height>2592</height>
</dimension>
</opticalBlackRegionInfo>
dimension Frame dimension: Contains xStart, yStart, width, and height
xStart X start coordinate of the region.
yStart Y start coordinate of the region.
width Width of the region.
height Height of the region.
pixelArrayInfo  Information about the pixel array.
Active dimension and dummy pixels width are provided.
activeDimension Width and height of the frame or subframe.
Example:
<activeDimension>
<xStart>0</xStart>
<yStart>0</yStart>
<width>4608</width>
<height>2592</height>
</activeDimension>
xStart Start of the X output in the frame.
yStart Start of the Y output in the frame.
width Total width of the frame in pixels.
height Total height of the frame in pixels.
dummyInfo Dummy pixels surrounding the active pixel array.
Example:
<dummyInfo>
<left>0</left>
<right>0</right>
<top>0</top>
<bottom>0</b
left Starting coordinate of the left dummy pixel.
right Starting coordinate of the right dummy pixel.
top Starting coordinate of the top dummy pixel.
bottom Starting coordinate of the bottom dummy pixel.
appDelayInfo Delay information.
linecount Number of frames required to apply the line count.
gain Number of frames required to apply the gain.
maxPipeline Maximum pipeline delay in number of frames.
frameSkip Number of initial bad frames to skip.
sensorProperty  Sensor property information.
Example:
<sensorProperty>
<pixelSize>0</pixelSize>
<cropFactor>0</cropFactor>
<sensingMethod>ONE_CHIP_COLOR_AREA</sensingMethod>
</sensorProperty>
pixelSize Pixel size in micro meters.
cropFactor Crop factor.
sensingMethod Sensing method of sensor.
Supported sensing methods:
UNDEFINED
ONE_CHIP_COLOR_AREA TWO_CHIP_COLOR_AREA
THREE_CHIP_COLOR_AREA
COLOR_SEQUENCE_AREA
TRILINEAR
COLOR_SEQUENCE_LINEAR

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章