/**
* s5k2p7_pdaf.h
*
* Copyright (c) 2015 Qualcomm Technologies, Inc.
* All Rights Reserved.
* Confidential and Proprietary - Qualcomm Technologies, Inc.
*/
.vendor_id = QTI,
.stats_dt = 0x30,
//尾巴模式里的data type,此处的VC通道应在对应sensor驱动的h文件里配置
.orientation= PDAF_ORIENTATION_DEFAULT,
.sensor_native_pattern_info =
//有几组res支持pdaf就需要添加对应的res组,因为2p7是全尺寸和预览的半尺寸支持pdaf,所以此处配置res0和res1.
{
/* Res 0 */
{
.block_pattern = {
.pd_offset_horizontal = 16,
.pd_offset_vertical = 16,
//pd的横坐标纵坐标的偏移量
.pix_count = 32,
//一块中有多少个像素点
.block_dim = {
.width = 64,
//横块数
.height = 64,
//纵块数
},
.pix_coords =
{
//像素的坐标,A1是左点,A2是右点
{20, 23, PDAF_LEFT_PIXEL,},
{20, 27, PDAF_RIGHT_PIXEL,},
{36, 27, PDAF_LEFT_PIXEL,},
{36, 31, PDAF_RIGHT_PIXEL,},
{56, 27, PDAF_LEFT_PIXEL,},
{56, 31, PDAF_RIGHT_PIXEL,},
{72, 23, PDAF_LEFT_PIXEL,},
{72, 27, PDAF_RIGHT_PIXEL,},
{24, 43, PDAF_LEFT_PIXEL,},
{24, 39, PDAF_RIGHT_PIXEL,},
{40, 47, PDAF_LEFT_PIXEL,},
{40, 43, PDAF_RIGHT_PIXEL,},
{52, 47, PDAF_LEFT_PIXEL,},
{52, 43, PDAF_RIGHT_PIXEL,},
{68, 43, PDAF_LEFT_PIXEL,},
{68, 39, PDAF_RIGHT_PIXEL,},
{24, 59, PDAF_LEFT_PIXEL,},
{24, 63, PDAF_RIGHT_PIXEL,},
{40, 55, PDAF_LEFT_PIXEL,},
{40, 59, PDAF_RIGHT_PIXEL,},
{52, 55, PDAF_LEFT_PIXEL,},
{52, 59, PDAF_RIGHT_PIXEL,},
{68, 59, PDAF_LEFT_PIXEL,},
{68, 63, PDAF_RIGHT_PIXEL,},
{20, 79, PDAF_LEFT_PIXEL,},
{20, 75, PDAF_RIGHT_PIXEL,},
{36, 75, PDAF_LEFT_PIXEL,},
{36, 71, PDAF_RIGHT_PIXEL,},
{56, 75, PDAF_LEFT_PIXEL,},
{56, 71, PDAF_RIGHT_PIXEL,},
{72, 79, PDAF_LEFT_PIXEL,},
{72, 75, PDAF_RIGHT_PIXEL,},
},
},
.block_count_horizontal = 72,
//pd的像素范围的width/横块数
.block_count_vertical = 54,
//pd的像素范围的height/纵块数
},
/* res 1 */
{//半尺寸的配置
.block_pattern = {
.pd_offset_horizontal = 8,
.pd_offset_vertical = 8,
//这儿有写全尺寸和半尺寸的起始坐标
.pix_count = 32,
//半尺寸的像素数目和全尺寸的是一致的
.block_dim = {
//全尺寸的一半
.width = 32,
.height = 32,
},
.pix_coords =
{
//半尺寸的像素坐标
{10, 11, PDAF_LEFT_PIXEL,},
{10, 13, PDAF_RIGHT_PIXEL,},
{18, 13, PDAF_LEFT_PIXEL,},
{18, 15, PDAF_RIGHT_PIXEL,},
{28, 13, PDAF_LEFT_PIXEL,},
{28, 15, PDAF_RIGHT_PIXEL,},
{36, 11, PDAF_LEFT_PIXEL,},
{36, 13, PDAF_RIGHT_PIXEL,},
{12, 21, PDAF_LEFT_PIXEL,},
{12, 19, PDAF_RIGHT_PIXEL,},
{20, 23, PDAF_LEFT_PIXEL,},
{20, 21, PDAF_RIGHT_PIXEL,},
{26, 23, PDAF_LEFT_PIXEL,},
{26, 21, PDAF_RIGHT_PIXEL,},
{34, 21, PDAF_LEFT_PIXEL,},
{34, 19, PDAF_RIGHT_PIXEL,},
{12, 29, PDAF_LEFT_PIXEL,},
{12, 31, PDAF_RIGHT_PIXEL,},
{20, 27, PDAF_LEFT_PIXEL,},
{20, 29, PDAF_RIGHT_PIXEL,},
{26, 27, PDAF_LEFT_PIXEL,},
{26, 29, PDAF_RIGHT_PIXEL,},
{34, 29, PDAF_LEFT_PIXEL,},
{34, 31, PDAF_RIGHT_PIXEL,},
{10, 39, PDAF_LEFT_PIXEL,},
{10, 37, PDAF_RIGHT_PIXEL,},
{18, 37, PDAF_LEFT_PIXEL,},
{18, 35, PDAF_RIGHT_PIXEL,},
{28, 37, PDAF_LEFT_PIXEL,},
{28, 35, PDAF_RIGHT_PIXEL,},
{36, 39, PDAF_LEFT_PIXEL,},
{36, 37, PDAF_RIGHT_PIXEL,},
},
},
/* use estimate blk level instead of ref to chromatix */
.block_count_horizontal = 72,
//半尺寸pd有效范围的width/横块数
.block_count_vertical = 54,
//半尺寸pd有效范围的height/纵块数
},
},
.buffer_block_pattern_info =
{
//这个部分就是将tail mode里面的像素点的坐标写进来
/* Res 0 */
{
.block_pattern = {
.pix_count = 32,
//4*8
.pix_coords =
{
//如上图,先是两个左点,然后两个右点,两个左点,四个右点......最后四个左点
{
.x = 0,
.y = 0,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 0,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 1,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 1,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 2,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 2,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 3,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 3,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 4,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 4,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 5,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 5,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 6,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 6,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 7,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 7,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 8,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 8,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 9,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 9,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 10,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 10,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 11,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 11,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 12,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 12,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 13,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 13,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 14,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 14,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 15,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 15,
.flag = PDAF_LEFT_PIXEL,
},
},
.pd_offset_horizontal = 0,
.pd_offset_vertical = 0,
.block_dim = {
.width = 2,
.height = 16,
},
},
.stride = 184,//
64(一行的块数)*2(每一行有两个pd点)*10(每个点的数据都是10位的)/8(mipi打包是8位)
.buffer_data_type = PDAF_DATA_TYPE_RAW10_PACKED,
//数据打包格式
.buffer_type = PDAF_BUFFER_FLAG_SEQUENTIAL_LINE,
//PDAF_BUFFER_FLAG_SPARSE(type 3),PDAF_BUFFER_FLAG_SEQUENTIAL_LINE(type 2)
},
/* res 1 */
{
.block_pattern = {
.pix_count = 32,
//4*8
.pix_coords =
{
{
.x = 0,
.y = 0,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 0,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 1,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 1,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 2,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 2,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 3,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 3,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 4,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 4,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 5,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 5,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 6,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 6,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 7,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 7,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 8,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 8,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 9,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 9,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 10,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 10,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 11,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 11,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 12,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 12,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 13,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 1,
.y = 13,
.flag = PDAF_RIGHT_PIXEL,
},
{
.x = 0,
.y = 14,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 14,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 0,
.y = 15,
.flag = PDAF_LEFT_PIXEL,
},
{
.x = 1,
.y = 15,
.flag = PDAF_LEFT_PIXEL,
},
},
.pd_offset_horizontal = 0,
.pd_offset_vertical = 0,
.block_dim = {
.width = 2,
.height = 16,
//tail mode里像素的width和height
},
},
.stride = 184,
//同上
.buffer_data_type = PDAF_DATA_TYPE_RAW10_PACKED,
//同上
.buffer_type = PDAF_BUFFER_FLAG_SEQUENTIAL_LINE,
//同上
},
},
/* use estimate blk level instead of ref to chromatix */
.black_level = 64,
.cali_version = CALIBRATION_VERSION_2D,
.window_configure = {
.pdaf_sw_window_mode = FIXED_GRID_WINDOW,
/* ingore the floating window configuration */
.fixed_grid_window_configure =
{
.af_fix_window = {
.pdaf_address_start_hori = 0.33333,
.pdaf_address_start_ver = 0.33334,
.pdaf_address_end_hori = 0.66668,
.pdaf_address_end_ver = 0.66668,
},
.window_number_hori = 1,
.window_number_ver = 1,
},
},
.defocus_confidence_th = 200,
在sensor驱动文件里需要定义如下内容:
1:配置data type
#define
S5K2P7_CSI_PD_ISTATS 0x30
/* VC = 1, DT = 0x30 */
2:需要配置传输pd数据的VC
.sensor_stream_info_array =
{
.sensor_stream_info =
{
{
.vc_cfg_size = 2,
.vc_cfg =
{
{
.cid = 0,
.dt = CSI_RAW10,
.decode_format = CSI_DECODE_10BIT
},
{
.cid = 4,
.dt =
S5K2P7_CSI_PD_ISTATS,
.decode_format = CSI_DECODE_10BIT
},
},
.pix_data_fmt =
{
SENSOR_BAYER,
SENSOR_META,
},
},
{
.vc_cfg_size = 1,
.vc_cfg =
{
{
.cid = 0,
.dt = CSI_RAW10,
.decode_format = CSI_DECODE_10BIT,
},
},
.pix_data_fmt =
{
SENSOR_BAYER,
},
},
},
.size = 2,
},
3:支持pdaf的res需要配置相应的VC
.csid_lut_params_array =
{
.lut_params =
{
/* Res 0 */
{
.num_cid = 2,
.vc_cfg_a =
{
{
.cid = 0,
.dt = CSI_RAW10,
.decode_format = CSI_DECODE_10BIT
},
{
.cid = 4,
.dt =
S5K2P7_CSI_PD_ISTATS,
.decode_format = CSI_DECODE_10BIT
},
},
},
/* Res 1 */
{
.num_cid = 2,
.vc_cfg_a =
{
{
.cid = 0,
.dt = CSI_RAW10,
.decode_format = CSI_DECODE_10BIT
},
{
.cid = 4,
.dt =
S5K2P7_CSI_PD_ISTATS,
.decode_format = CSI_DECODE_10BIT
},
},
},
/* Res 2 */
{
.num_cid = 1,
.vc_cfg_a =
{
{
.cid = 0,
.dt = CSI_RAW10,
.decode_format = CSI_DECODE_10BIT
},
},
},
/* Res 3 */
{
.num_cid = 1,
.vc_cfg_a =
{
{
.cid = 0,
.dt = CSI_RAW10,
.decode_format = CSI_DECODE_10BIT
},
},
},
/* Res 4 */
{
.num_cid = 1,
.vc_cfg_a =
{
{
.cid = 0,
.dt = CSI_RAW10,
.decode_format = CSI_DECODE_10BIT
},
},
},
/* Res 5 */
{
.num_cid = 1,
.vc_cfg_a =
{
{
.cid = 0,
.dt = CSI_RAW10,
.decode_format = CSI_DECODE_10BIT
},
},
},
},
.size = 6,
},
4:
.meta_data_out_info_array =
{
.meta_data_out_info =
{
{
/* tail of af size*/
.width = 144,
.height = 864,
.stats_type = PD_STATS,
.dt =
S5K2P7_CSI_PD_ISTATS,
},
},
.size = 1,
},