/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* * CCS static data in-memory data structure definitions * * Copyright 2019--2020 Intel Corporation */ #ifndef __CCS_DATA_H__ #define __CCS_DATA_H__ #include <linux/types.h> struct device; /** * struct ccs_data_block_version - CCS static data version * @version_major: Major version number * @version_minor: Minor version number * @date_year: Year * @date_month: Month * @date_day: Day */ struct ccs_data_block_version { … }; /** * struct ccs_reg - CCS register value * @addr: The 16-bit address of the register * @len: Length of the data * @value: Data */ struct ccs_reg { … }; /** * struct ccs_if_rule - CCS static data if rule * @addr: Register address * @value: Register value * @mask: Value applied to both actual register value and @value */ struct ccs_if_rule { … }; /** * struct ccs_frame_format_desc - CCS frame format descriptor * @pixelcode: The pixelcode; CCS_DATA_BLOCK_FFD_PIXELCODE_* * @value: Value related to the pixelcode */ struct ccs_frame_format_desc { … }; /** * struct ccs_frame_format_descs - A series of CCS frame format descriptors * @num_column_descs: Number of column descriptors * @num_row_descs: Number of row descriptors * @column_descs: Column descriptors * @row_descs: Row descriptors */ struct ccs_frame_format_descs { … }; /** * struct ccs_pdaf_readout - CCS PDAF data readout descriptor * @pdaf_readout_info_order: PDAF readout order * @ffd: Frame format of PDAF data */ struct ccs_pdaf_readout { … }; /** * struct ccs_rule - A CCS static data rule * @num_if_rules: Number of if rules * @if_rules: If rules * @num_read_only_regs: Number of read-only registers * @read_only_regs: Read-only registers * @num_manufacturer_regs: Number of manufacturer-specific registers * @manufacturer_regs: Manufacturer-specific registers * @frame_format: Frame format * @pdaf_readout: PDAF readout */ struct ccs_rule { … }; /** * struct ccs_pdaf_pix_loc_block_desc - PDAF pixel location block descriptor * @block_type_id: Block type identifier, from 0 to n * @repeat_x: Number of times this block is repeated to right */ struct ccs_pdaf_pix_loc_block_desc { … }; /** * struct ccs_pdaf_pix_loc_block_desc_group - PDAF pixel location block * descriptor group * @repeat_y: Number of times the group is repeated down * @num_block_descs: Number of block descriptors in @block_descs * @block_descs: Block descriptors */ struct ccs_pdaf_pix_loc_block_desc_group { … }; /** * struct ccs_pdaf_pix_loc_pixel_desc - PDAF pixel location block descriptor * @pixel_type: Type of the pixel; CCS_DATA_PDAF_PIXEL_TYPE_* * @small_offset_x: offset X coordinate * @small_offset_y: offset Y coordinate */ struct ccs_pdaf_pix_loc_pixel_desc { … }; /** * struct ccs_pdaf_pix_loc_pixel_desc_group - PDAF pixel location pixel * descriptor group * @num_descs: Number of descriptors in @descs * @descs: PDAF pixel location pixel descriptors */ struct ccs_pdaf_pix_loc_pixel_desc_group { … }; /** * struct ccs_pdaf_pix_loc - PDAF pixel locations * @main_offset_x: Start X coordinate of PDAF pixel blocks * @main_offset_y: Start Y coordinate of PDAF pixel blocks * @global_pdaf_type: PDAF pattern type * @block_width: Width of a block in pixels * @block_height: Heigth of a block in pixels * @num_block_desc_groups: Number of block descriptor groups * @block_desc_groups: Block descriptor groups * @num_pixel_desc_grups: Number of pixel descriptor groups * @pixel_desc_groups: Pixel descriptor groups */ struct ccs_pdaf_pix_loc { … }; /** * struct ccs_data_container - In-memory CCS static data * @version: CCS static data version * @num_sensor_read_only_regs: Number of the read-only registers for the sensor * @sensor_read_only_regs: Read-only registers for the sensor * @num_sensor_manufacturer_regs: Number of the manufacturer-specific registers * for the sensor * @sensor_manufacturer_regs: Manufacturer-specific registers for the sensor * @num_sensor_rules: Number of rules for the sensor * @sensor_rules: Rules for the sensor * @num_module_read_only_regs: Number of the read-only registers for the module * @module_read_only_regs: Read-only registers for the module * @num_module_manufacturer_regs: Number of the manufacturer-specific registers * for the module * @module_manufacturer_regs: Manufacturer-specific registers for the module * @num_module_rules: Number of rules for the module * @module_rules: Rules for the module * @sensor_pdaf: PDAF data for the sensor * @module_pdaf: PDAF data for the module * @license_length: Lenght of the license data * @license: License data * @end: Whether or not there's an end block * @backing: Raw data, pointed to from elsewhere so keep it around */ struct ccs_data_container { … }; int ccs_data_parse(struct ccs_data_container *ccsdata, const void *data, size_t len, struct device *dev, bool verbose); #endif /* __CCS_DATA_H__ */