Camera: Bring over camera driver changes

Bring over camera driver changes as of msm-4.19
commit  5a5551a7 (Merge "msm: camera: reqmgr: Fix CRM
shift one req issue").

Change-Id: Ic0c2b2d74d1b3470c1c51d98228e312fb13c501a
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
This commit is contained in:
Jigarkumar Zala
2019-05-24 17:56:58 -07:00
parent 9be583aa80
commit 05349feaa2
356 changed files with 134959 additions and 10 deletions

3
include/uapi/Kbuild Normal file
View File

@@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note
header-y += media/

14
include/uapi/media/Kbuild Normal file
View File

@@ -0,0 +1,14 @@
# SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note
header-y += cam_cpas.h
header-y += cam_defs.h
header-y += cam_fd.h
header-y += cam_icp.h
header-y += cam_isp.h
header-y += cam_isp_vfe.h
header-y += cam_isp_ife.h
header-y += cam_jpeg.h
header-y += cam_req_mgr.h
header-y += cam_sensor.h
header-y += cam_sync.h
header-y += cam_lrme.h

View File

@@ -0,0 +1,89 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_CPAS_H__
#define __UAPI_CAM_CPAS_H__
#include "cam_defs.h"
#define CAM_FAMILY_CAMERA_SS 1
#define CAM_FAMILY_CPAS_SS 2
/* AXI BW Voting Version */
#define CAM_AXI_BW_VOTING_V2 2
/* AXI BW Voting Transaction Type */
#define CAM_AXI_TRANSACTION_READ 0
#define CAM_AXI_TRANSACTION_WRITE 1
/* AXI BW Voting Path Data Type */
#define CAM_AXI_PATH_DATA_IFE_START_OFFSET 0
#define CAM_AXI_PATH_DATA_IFE_LINEAR (CAM_AXI_PATH_DATA_IFE_START_OFFSET + 0)
#define CAM_AXI_PATH_DATA_IFE_VID (CAM_AXI_PATH_DATA_IFE_START_OFFSET + 1)
#define CAM_AXI_PATH_DATA_IFE_DISP (CAM_AXI_PATH_DATA_IFE_START_OFFSET + 2)
#define CAM_AXI_PATH_DATA_IFE_STATS (CAM_AXI_PATH_DATA_IFE_START_OFFSET + 3)
#define CAM_AXI_PATH_DATA_IFE_RDI0 (CAM_AXI_PATH_DATA_IFE_START_OFFSET + 4)
#define CAM_AXI_PATH_DATA_IFE_RDI1 (CAM_AXI_PATH_DATA_IFE_START_OFFSET + 5)
#define CAM_AXI_PATH_DATA_IFE_RDI2 (CAM_AXI_PATH_DATA_IFE_START_OFFSET + 6)
#define CAM_AXI_PATH_DATA_IFE_RDI3 (CAM_AXI_PATH_DATA_IFE_START_OFFSET + 7)
#define CAM_AXI_PATH_DATA_IFE_PDAF (CAM_AXI_PATH_DATA_IFE_START_OFFSET + 8)
#define CAM_AXI_PATH_DATA_IFE_PIXEL_RAW \
(CAM_AXI_PATH_DATA_IFE_START_OFFSET + 9)
#define CAM_AXI_PATH_DATA_IFE_MAX_OFFSET \
(CAM_AXI_PATH_DATA_IFE_START_OFFSET + 31)
#define CAM_AXI_PATH_DATA_IPE_START_OFFSET 32
#define CAM_AXI_PATH_DATA_IPE_RD_IN (CAM_AXI_PATH_DATA_IPE_START_OFFSET + 0)
#define CAM_AXI_PATH_DATA_IPE_RD_REF (CAM_AXI_PATH_DATA_IPE_START_OFFSET + 1)
#define CAM_AXI_PATH_DATA_IPE_WR_VID (CAM_AXI_PATH_DATA_IPE_START_OFFSET + 2)
#define CAM_AXI_PATH_DATA_IPE_WR_DISP (CAM_AXI_PATH_DATA_IPE_START_OFFSET + 3)
#define CAM_AXI_PATH_DATA_IPE_WR_REF (CAM_AXI_PATH_DATA_IPE_START_OFFSET + 4)
#define CAM_AXI_PATH_DATA_IPE_MAX_OFFSET \
(CAM_AXI_PATH_DATA_IPE_START_OFFSET + 31)
#define CAM_AXI_PATH_DATA_ALL 256
/**
* struct cam_cpas_query_cap - CPAS query device capability payload
*
* @camera_family : Camera family type
* @reserved : Reserved field for alignment
* @camera_version : Camera platform version
* @cpas_version : Camera CPAS version within camera platform
*
*/
struct cam_cpas_query_cap {
uint32_t camera_family;
uint32_t reserved;
struct cam_hw_version camera_version;
struct cam_hw_version cpas_version;
};
/**
* struct cam_axi_per_path_bw_vote - Per path bandwidth vote information
*
* @usage_data client usage data (left/right/rdi)
* @transac_type Transaction type on the path (read/write)
* @path_data_type Path for which vote is given (video, display, rdi)
* @reserved Reserved for alignment
* @camnoc_bw CAMNOC bw for this path
* @mnoc_ab_bw MNOC AB bw for this path
* @mnoc_ib_bw MNOC IB bw for this path
* @ddr_ab_bw DDR AB bw for this path
* @ddr_ib_bw DDR IB bw for this path
*/
struct cam_axi_per_path_bw_vote {
uint32_t usage_data;
uint32_t transac_type;
uint32_t path_data_type;
uint32_t reserved;
uint64_t camnoc_bw;
uint64_t mnoc_ab_bw;
uint64_t mnoc_ib_bw;
uint64_t ddr_ab_bw;
uint64_t ddr_ib_bw;
};
#endif /* __UAPI_CAM_CPAS_H__ */

View File

@@ -0,0 +1,746 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_DEFS_H__
#define __UAPI_CAM_DEFS_H__
#include <linux/videodev2.h>
#include <linux/types.h>
#include <linux/ioctl.h>
/* camera op codes */
#define CAM_COMMON_OPCODE_BASE 0x100
#define CAM_QUERY_CAP (CAM_COMMON_OPCODE_BASE + 0x1)
#define CAM_ACQUIRE_DEV (CAM_COMMON_OPCODE_BASE + 0x2)
#define CAM_START_DEV (CAM_COMMON_OPCODE_BASE + 0x3)
#define CAM_STOP_DEV (CAM_COMMON_OPCODE_BASE + 0x4)
#define CAM_CONFIG_DEV (CAM_COMMON_OPCODE_BASE + 0x5)
#define CAM_RELEASE_DEV (CAM_COMMON_OPCODE_BASE + 0x6)
#define CAM_SD_SHUTDOWN (CAM_COMMON_OPCODE_BASE + 0x7)
#define CAM_FLUSH_REQ (CAM_COMMON_OPCODE_BASE + 0x8)
#define CAM_COMMON_OPCODE_MAX (CAM_COMMON_OPCODE_BASE + 0x9)
#define CAM_COMMON_OPCODE_BASE_v2 0x150
#define CAM_ACQUIRE_HW (CAM_COMMON_OPCODE_BASE_v2 + 0x1)
#define CAM_RELEASE_HW (CAM_COMMON_OPCODE_BASE_v2 + 0x2)
#define CAM_EXT_OPCODE_BASE 0x200
#define CAM_CONFIG_DEV_EXTERNAL (CAM_EXT_OPCODE_BASE + 0x1)
/* camera handle type */
#define CAM_HANDLE_USER_POINTER 1
#define CAM_HANDLE_MEM_HANDLE 2
/* Generic Blob CmdBuffer header properties */
#define CAM_GENERIC_BLOB_CMDBUFFER_SIZE_MASK 0xFFFFFF00
#define CAM_GENERIC_BLOB_CMDBUFFER_SIZE_SHIFT 8
#define CAM_GENERIC_BLOB_CMDBUFFER_TYPE_MASK 0xFF
#define CAM_GENERIC_BLOB_CMDBUFFER_TYPE_SHIFT 0
/* Command Buffer Types */
#define CAM_CMD_BUF_DMI 0x1
#define CAM_CMD_BUF_DMI16 0x2
#define CAM_CMD_BUF_DMI32 0x3
#define CAM_CMD_BUF_DMI64 0x4
#define CAM_CMD_BUF_DIRECT 0x5
#define CAM_CMD_BUF_INDIRECT 0x6
#define CAM_CMD_BUF_I2C 0x7
#define CAM_CMD_BUF_FW 0x8
#define CAM_CMD_BUF_GENERIC 0x9
#define CAM_CMD_BUF_LEGACY 0xA
/* UBWC API Version */
#define CAM_UBWC_CFG_VERSION_1 1
#define CAM_UBWC_CFG_VERSION_2 2
#define CAM_MAX_ACQ_RES 5
#define CAM_MAX_HW_SPLIT 3
/**
* enum flush_type_t - Identifies the various flush types
*
* @CAM_FLUSH_TYPE_REQ: Flush specific request
* @CAM_FLUSH_TYPE_ALL: Flush all requests belonging to a context
* @CAM_FLUSH_TYPE_MAX: Max enum to validate flush type
*
*/
enum flush_type_t {
CAM_FLUSH_TYPE_REQ,
CAM_FLUSH_TYPE_ALL,
CAM_FLUSH_TYPE_MAX
};
/**
* struct cam_control - Structure used by ioctl control for camera
*
* @op_code: This is the op code for camera control
* @size: Control command size
* @handle_type: User pointer or shared memory handle
* @reserved: Reserved field for 64 bit alignment
* @handle: Control command payload
*/
struct cam_control {
uint32_t op_code;
uint32_t size;
uint32_t handle_type;
uint32_t reserved;
uint64_t handle;
};
/* camera IOCTL */
#define VIDIOC_CAM_CONTROL \
_IOWR('V', BASE_VIDIOC_PRIVATE, struct cam_control)
/**
* struct cam_hw_version - Structure for HW version of camera devices
*
* @major : Hardware version major
* @minor : Hardware version minor
* @incr : Hardware version increment
* @reserved : Reserved for 64 bit aligngment
*/
struct cam_hw_version {
uint32_t major;
uint32_t minor;
uint32_t incr;
uint32_t reserved;
};
/**
* struct cam_iommu_handle - Structure for IOMMU handles of camera hw devices
*
* @non_secure: Device Non Secure IOMMU handle
* @secure: Device Secure IOMMU handle
*
*/
struct cam_iommu_handle {
int32_t non_secure;
int32_t secure;
};
/* camera secure mode */
#define CAM_SECURE_MODE_NON_SECURE 0
#define CAM_SECURE_MODE_SECURE 1
/* Camera Format Type */
#define CAM_FORMAT_BASE 0
#define CAM_FORMAT_MIPI_RAW_6 1
#define CAM_FORMAT_MIPI_RAW_8 2
#define CAM_FORMAT_MIPI_RAW_10 3
#define CAM_FORMAT_MIPI_RAW_12 4
#define CAM_FORMAT_MIPI_RAW_14 5
#define CAM_FORMAT_MIPI_RAW_16 6
#define CAM_FORMAT_MIPI_RAW_20 7
#define CAM_FORMAT_QTI_RAW_8 8
#define CAM_FORMAT_QTI_RAW_10 9
#define CAM_FORMAT_QTI_RAW_12 10
#define CAM_FORMAT_QTI_RAW_14 11
#define CAM_FORMAT_PLAIN8 12
#define CAM_FORMAT_PLAIN16_8 13
#define CAM_FORMAT_PLAIN16_10 14
#define CAM_FORMAT_PLAIN16_12 15
#define CAM_FORMAT_PLAIN16_14 16
#define CAM_FORMAT_PLAIN16_16 17
#define CAM_FORMAT_PLAIN32_20 18
#define CAM_FORMAT_PLAIN64 19
#define CAM_FORMAT_PLAIN128 20
#define CAM_FORMAT_ARGB 21
#define CAM_FORMAT_ARGB_10 22
#define CAM_FORMAT_ARGB_12 23
#define CAM_FORMAT_ARGB_14 24
#define CAM_FORMAT_DPCM_10_6_10 25
#define CAM_FORMAT_DPCM_10_8_10 26
#define CAM_FORMAT_DPCM_12_6_12 27
#define CAM_FORMAT_DPCM_12_8_12 28
#define CAM_FORMAT_DPCM_14_8_14 29
#define CAM_FORMAT_DPCM_14_10_14 30
#define CAM_FORMAT_NV21 31
#define CAM_FORMAT_NV12 32
#define CAM_FORMAT_TP10 33
#define CAM_FORMAT_YUV422 34
#define CAM_FORMAT_PD8 35
#define CAM_FORMAT_PD10 36
#define CAM_FORMAT_UBWC_NV12 37
#define CAM_FORMAT_UBWC_NV12_4R 38
#define CAM_FORMAT_UBWC_TP10 39
#define CAM_FORMAT_UBWC_P010 40
#define CAM_FORMAT_PLAIN8_SWAP 41
#define CAM_FORMAT_PLAIN8_10 42
#define CAM_FORMAT_PLAIN8_10_SWAP 43
#define CAM_FORMAT_YV12 44
#define CAM_FORMAT_Y_ONLY 45
#define CAM_FORMAT_DPCM_12_10_12 46
#define CAM_FORMAT_PLAIN32 47
#define CAM_FORMAT_ARGB_16 48
#define CAM_FORMAT_MAX 49
/* camera rotaion */
#define CAM_ROTATE_CW_0_DEGREE 0
#define CAM_ROTATE_CW_90_DEGREE 1
#define CAM_RORATE_CW_180_DEGREE 2
#define CAM_ROTATE_CW_270_DEGREE 3
/* camera Color Space */
#define CAM_COLOR_SPACE_BASE 0
#define CAM_COLOR_SPACE_BT601_FULL 1
#define CAM_COLOR_SPACE_BT601625 2
#define CAM_COLOR_SPACE_BT601525 3
#define CAM_COLOR_SPACE_BT709 4
#define CAM_COLOR_SPACE_DEPTH 5
#define CAM_COLOR_SPACE_MAX 6
/* camera buffer direction */
#define CAM_BUF_INPUT 1
#define CAM_BUF_OUTPUT 2
#define CAM_BUF_IN_OUT 3
/* camera packet device Type */
#define CAM_PACKET_DEV_BASE 0
#define CAM_PACKET_DEV_IMG_SENSOR 1
#define CAM_PACKET_DEV_ACTUATOR 2
#define CAM_PACKET_DEV_COMPANION 3
#define CAM_PACKET_DEV_EEPOM 4
#define CAM_PACKET_DEV_CSIPHY 5
#define CAM_PACKET_DEV_OIS 6
#define CAM_PACKET_DEV_FLASH 7
#define CAM_PACKET_DEV_FD 8
#define CAM_PACKET_DEV_JPEG_ENC 9
#define CAM_PACKET_DEV_JPEG_DEC 10
#define CAM_PACKET_DEV_VFE 11
#define CAM_PACKET_DEV_CPP 12
#define CAM_PACKET_DEV_CSID 13
#define CAM_PACKET_DEV_ISPIF 14
#define CAM_PACKET_DEV_IFE 15
#define CAM_PACKET_DEV_ICP 16
#define CAM_PACKET_DEV_LRME 17
#define CAM_PACKET_DEV_MAX 18
/* constants */
#define CAM_PACKET_MAX_PLANES 3
/**
* struct cam_plane_cfg - Plane configuration info
*
* @width: Plane width in pixels
* @height: Plane height in lines
* @plane_stride: Plane stride in pixel
* @slice_height: Slice height in line (not used by ISP)
* @meta_stride: UBWC metadata stride
* @meta_size: UBWC metadata plane size
* @meta_offset: UBWC metadata offset
* @packer_config: UBWC packer config
* @mode_config: UBWC mode config
* @tile_config: UBWC tile config
* @h_init: UBWC horizontal initial coordinate in pixels
* @v_init: UBWC vertical initial coordinate in lines
*
*/
struct cam_plane_cfg {
uint32_t width;
uint32_t height;
uint32_t plane_stride;
uint32_t slice_height;
uint32_t meta_stride;
uint32_t meta_size;
uint32_t meta_offset;
uint32_t packer_config;
uint32_t mode_config;
uint32_t tile_config;
uint32_t h_init;
uint32_t v_init;
};
/**
* struct cam_ubwc_plane_cfg_v1 - UBWC Plane configuration info
*
* @port_type: Port Type
* @meta_stride: UBWC metadata stride
* @meta_size: UBWC metadata plane size
* @meta_offset: UBWC metadata offset
* @packer_config: UBWC packer config
* @mode_config_0: UBWC mode config 0
* @mode_config_1: UBWC 3 mode config 1
* @tile_config: UBWC tile config
* @h_init: UBWC horizontal initial coordinate in pixels
* @v_init: UBWC vertical initial coordinate in lines
*
*/
struct cam_ubwc_plane_cfg_v1 {
uint32_t port_type;
uint32_t meta_stride;
uint32_t meta_size;
uint32_t meta_offset;
uint32_t packer_config;
uint32_t mode_config_0;
uint32_t mode_config_1;
uint32_t tile_config;
uint32_t h_init;
uint32_t v_init;
};
/**
* struct cam_ubwc_plane_cfg_v2 - UBWC Plane configuration info
*
* @port_type: Port Type
* @meta_stride: UBWC metadata stride
* @meta_size: UBWC metadata plane size
* @meta_offset: UBWC metadata offset
* @packer_config: UBWC packer config
* @mode_config: UBWC mode config
* @static ctrl: UBWC static ctrl
* @ctrl_2: UBWC ctrl 2
* @tile_config: UBWC tile config
* @h_init: UBWC horizontal initial coordinate in pixels
* @v_init: UBWC vertical initial coordinate in lines
* @stats_ctrl_2: UBWC stats control
* @lossy_threshold0 UBWC lossy threshold 0
* @lossy_threshold1 UBWC lossy threshold 1
* @lossy_var_offset UBWC offset variance thrshold
*
*/
struct cam_ubwc_plane_cfg_v2 {
uint32_t port_type;
uint32_t meta_stride;
uint32_t meta_size;
uint32_t meta_offset;
uint32_t packer_config;
uint32_t mode_config_0;
uint32_t mode_config_1;
uint32_t tile_config;
uint32_t h_init;
uint32_t v_init;
uint32_t static_ctrl;
uint32_t ctrl_2;
uint32_t stats_ctrl_2;
uint32_t lossy_threshold_0;
uint32_t lossy_threshold_1;
uint32_t lossy_var_offset;
uint32_t bandwidth_limit;
uint32_t reserved[3];
};
/**
* struct cam_cmd_buf_desc - Command buffer descriptor
*
* @mem_handle: Command buffer handle
* @offset: Command start offset
* @size: Size of the command buffer in bytes
* @length: Used memory in command buffer in bytes
* @type: Type of the command buffer
* @meta_data: Data type for private command buffer
* Between UMD and KMD
*
*/
struct cam_cmd_buf_desc {
int32_t mem_handle;
uint32_t offset;
uint32_t size;
uint32_t length;
uint32_t type;
uint32_t meta_data;
};
/**
* struct cam_buf_io_cfg - Buffer io configuration for buffers
*
* @mem_handle: Mem_handle array for the buffers.
* @offsets: Offsets for each planes in the buffer
* @planes: Per plane information
* @width: Main plane width in pixel
* @height: Main plane height in lines
* @format: Format of the buffer
* @color_space: Color space for the buffer
* @color_pattern: Color pattern in the buffer
* @bpp: Bit per pixel
* @rotation: Rotation information for the buffer
* @resource_type: Resource type associated with the buffer
* @fence: Fence handle
* @early_fence: Fence handle for early signal
* @aux_cmd_buf: An auxiliary command buffer that may be
* used for programming the IO
* @direction: Direction of the config
* @batch_size: Batch size in HFR mode
* @subsample_pattern: Subsample pattern. Used in HFR mode. It
* should be consistent with batchSize and
* CAMIF programming.
* @subsample_period: Subsample period. Used in HFR mode. It
* should be consistent with batchSize and
* CAMIF programming.
* @framedrop_pattern: Framedrop pattern
* @framedrop_period: Framedrop period
* @flag: Flags for extra information
* @direction: Buffer direction: input or output
* @padding: Padding for the structure
*
*/
struct cam_buf_io_cfg {
int32_t mem_handle[CAM_PACKET_MAX_PLANES];
uint32_t offsets[CAM_PACKET_MAX_PLANES];
struct cam_plane_cfg planes[CAM_PACKET_MAX_PLANES];
uint32_t format;
uint32_t color_space;
uint32_t color_pattern;
uint32_t bpp;
uint32_t rotation;
uint32_t resource_type;
int32_t fence;
int32_t early_fence;
struct cam_cmd_buf_desc aux_cmd_buf;
uint32_t direction;
uint32_t batch_size;
uint32_t subsample_pattern;
uint32_t subsample_period;
uint32_t framedrop_pattern;
uint32_t framedrop_period;
uint32_t flag;
uint32_t padding;
};
/**
* struct cam_packet_header - Camera packet header
*
* @op_code: Camera packet opcode
* @size: Size of the camera packet in bytes
* @request_id: Request id for this camera packet
* @flags: Flags for the camera packet
* @padding: Padding
*
*/
struct cam_packet_header {
uint32_t op_code;
uint32_t size;
uint64_t request_id;
uint32_t flags;
uint32_t padding;
};
/**
* struct cam_patch_desc - Patch structure
*
* @dst_buf_hdl: Memory handle for the dest buffer
* @dst_offset: Offset byte in the dest buffer
* @src_buf_hdl: Memory handle for the source buffer
* @src_offset: Offset byte in the source buffer
*
*/
struct cam_patch_desc {
int32_t dst_buf_hdl;
uint32_t dst_offset;
int32_t src_buf_hdl;
uint32_t src_offset;
};
/**
* struct cam_packet - Camera packet structure
*
* @header: Camera packet header
* @cmd_buf_offset: Command buffer start offset
* @num_cmd_buf: Number of the command buffer in the packet
* @io_config_offset: Buffer io configuration start offset
* @num_io_configs: Number of the buffer io configurations
* @patch_offset: Patch offset for the patch structure
* @num_patches: Number of the patch structure
* @kmd_cmd_buf_index: Command buffer index which contains extra
* space for the KMD buffer
* @kmd_cmd_buf_offset: Offset from the beginning of the command
* buffer for KMD usage.
* @payload: Camera packet payload
*
*/
struct cam_packet {
struct cam_packet_header header;
uint32_t cmd_buf_offset;
uint32_t num_cmd_buf;
uint32_t io_configs_offset;
uint32_t num_io_configs;
uint32_t patch_offset;
uint32_t num_patches;
uint32_t kmd_cmd_buf_index;
uint32_t kmd_cmd_buf_offset;
uint64_t payload[1];
};
/**
* struct cam_release_dev_cmd - Control payload for release devices
*
* @session_handle: Session handle for the release
* @dev_handle: Device handle for the release
*/
struct cam_release_dev_cmd {
int32_t session_handle;
int32_t dev_handle;
};
/**
* struct cam_start_stop_dev_cmd - Control payload for start/stop device
*
* @session_handle: Session handle for the start/stop command
* @dev_handle: Device handle for the start/stop command
*
*/
struct cam_start_stop_dev_cmd {
int32_t session_handle;
int32_t dev_handle;
};
/**
* struct cam_config_dev_cmd - Command payload for configure device
*
* @session_handle: Session handle for the command
* @dev_handle: Device handle for the command
* @offset: Offset byte in the packet handle.
* @packet_handle: Packet memory handle for the actual packet:
* struct cam_packet.
*
*/
struct cam_config_dev_cmd {
int32_t session_handle;
int32_t dev_handle;
uint64_t offset;
uint64_t packet_handle;
};
/**
* struct cam_query_cap_cmd - Payload for query device capability
*
* @size: Handle size
* @handle_type: User pointer or shared memory handle
* @caps_handle: Device specific query command payload
*
*/
struct cam_query_cap_cmd {
uint32_t size;
uint32_t handle_type;
uint64_t caps_handle;
};
/**
* struct cam_acquire_dev_cmd - Control payload for acquire devices
*
* @session_handle: Session handle for the acquire command
* @dev_handle: Device handle to be returned
* @handle_type: Resource handle type:
* 1 = user pointer, 2 = mem handle
* @num_resources: Number of the resources to be acquired
* @resources_hdl: Resource handle that refers to the actual
* resource array. Each item in this
* array is device specific resource structure
*
*/
struct cam_acquire_dev_cmd {
int32_t session_handle;
int32_t dev_handle;
uint32_t handle_type;
uint32_t num_resources;
uint64_t resource_hdl;
};
/*
* In old version, while acquiring device the num_resources in
* struct cam_acquire_dev_cmd will be a valid value. During ACQUIRE_DEV
* KMD driver will return dev_handle as well as associate HW to handle.
* If num_resources is set to the constant below, we are using
* the new version and we do not acquire HW in ACQUIRE_DEV IOCTL.
* ACQUIRE_DEV will only return handle and we should receive
* ACQUIRE_HW IOCTL after ACQUIRE_DEV and that is when the HW
* is associated with the dev_handle.
*
* (Data type): uint32_t
*/
#define CAM_API_COMPAT_CONSTANT 0xFEFEFEFE
#define CAM_ACQUIRE_HW_STRUCT_VERSION_1 1
#define CAM_ACQUIRE_HW_STRUCT_VERSION_2 2
/**
* struct cam_acquire_hw_cmd_v1 - Control payload for acquire HW IOCTL (Ver 1)
*
* @struct_version: = CAM_ACQUIRE_HW_STRUCT_VERSION_1 for this struct
* This value should be the first 32-bits in any structure
* related to this IOCTL. So that if the struct needs to
* change, we can first read the starting 32-bits, get the
* version number and then typecast the data to struct
* accordingly.
* @reserved: Reserved field for 64-bit alignment
* @session_handle: Session handle for the acquire command
* @dev_handle: Device handle to be returned
* @handle_type: Tells you how to interpret the variable resource_hdl-
* 1 = user pointer, 2 = mem handle
* @data_size: Total size of data contained in memory pointed
* to by resource_hdl
* @resource_hdl: Resource handle that refers to the actual
* resource data.
*/
struct cam_acquire_hw_cmd_v1 {
uint32_t struct_version;
uint32_t reserved;
int32_t session_handle;
int32_t dev_handle;
uint32_t handle_type;
uint32_t data_size;
uint64_t resource_hdl;
};
/**
* struct cam_acquired_hw_info - Update the acquired hardware info
*
* @acquired_hw_id: Acquired hardware mask
* @acquired_hw_path: Acquired path mask for an input
* if input splits into multiple paths,
* its updated per hardware
* valid_acquired_hw: Valid num of acquired hardware
*/
struct cam_acquired_hw_info {
uint32_t acquired_hw_id[CAM_MAX_ACQ_RES];
uint32_t acquired_hw_path[CAM_MAX_ACQ_RES][CAM_MAX_HW_SPLIT];
uint32_t valid_acquired_hw;
};
/**
* struct cam_acquire_hw_cmd_v2 - Control payload for acquire HW IOCTL (Ver 2)
*
* @struct_version: = CAM_ACQUIRE_HW_STRUCT_VERSION_2 for this struct
* This value should be the first 32-bits in any structure
* related to this IOCTL. So that if the struct needs to
* change, we can first read the starting 32-bits, get the
* version number and then typecast the data to struct
* accordingly.
* @reserved: Reserved field for 64-bit alignment
* @session_handle: Session handle for the acquire command
* @dev_handle: Device handle to be returned
* @handle_type: Tells you how to interpret the variable resource_hdl-
* 1 = user pointer, 2 = mem handle
* @data_size: Total size of data contained in memory pointed
* to by resource_hdl
* @resource_hdl: Resource handle that refers to the actual
* resource data.
*/
struct cam_acquire_hw_cmd_v2 {
uint32_t struct_version;
uint32_t reserved;
int32_t session_handle;
int32_t dev_handle;
uint32_t handle_type;
uint32_t data_size;
uint64_t resource_hdl;
struct cam_acquired_hw_info hw_info;
};
#define CAM_RELEASE_HW_STRUCT_VERSION_1 1
/**
* struct cam_release_hw_cmd_v1 - Control payload for release HW IOCTL (Ver 1)
*
* @struct_version: = CAM_RELEASE_HW_STRUCT_VERSION_1 for this struct
* This value should be the first 32-bits in any structure
* related to this IOCTL. So that if the struct needs to
* change, we can first read the starting 32-bits, get the
* version number and then typecast the data to struct
* accordingly.
* @reserved: Reserved field for 64-bit alignment
* @session_handle: Session handle for the release
* @dev_handle: Device handle for the release
*/
struct cam_release_hw_cmd_v1 {
uint32_t struct_version;
uint32_t reserved;
int32_t session_handle;
int32_t dev_handle;
};
/**
* struct cam_flush_dev_cmd - Control payload for flush devices
*
* @version: Version
* @session_handle: Session handle for the acquire command
* @dev_handle: Device handle to be returned
* @flush_type: Flush type:
* 0 = flush specific request
* 1 = flush all
* @reserved: Reserved for 64 bit aligngment
* @req_id: Request id that needs to cancel
*
*/
struct cam_flush_dev_cmd {
uint64_t version;
int32_t session_handle;
int32_t dev_handle;
uint32_t flush_type;
uint32_t reserved;
int64_t req_id;
};
/**
* struct cam_ubwc_config - UBWC Configuration Payload
*
* @api_version: UBWC config api version
* @num_ports: Number of ports to be configured
* @ubwc_plane_config: Array of UBWC configurations per port
* Size [CAM_PACKET_MAX_PLANES - 1] per port
* as UBWC is supported on Y & C planes
* and therefore a max size of 2 planes
*
*/
struct cam_ubwc_config {
uint32_t api_version;
uint32_t num_ports;
struct cam_ubwc_plane_cfg_v1
ubwc_plane_cfg[1][CAM_PACKET_MAX_PLANES - 1];
};
/**
* struct cam_ubwc_config_v2 - UBWC Configuration Payload
*
* @api_version: UBWC config api version
* @num_ports: Number of ports to be configured
* @ubwc_plane_config: Array of UBWC configurations per port
* Size [CAM_PACKET_MAX_PLANES - 1] per port
* as UBWC is supported on Y & C planes
* and therefore a max size of 2 planes
*
*/
struct cam_ubwc_config_v2 {
uint32_t api_version;
uint32_t num_ports;
struct cam_ubwc_plane_cfg_v2
ubwc_plane_cfg[1][CAM_PACKET_MAX_PLANES - 1];
};
/**
* struct cam_cmd_mem_region_info -
* Cmd buffer region info
*
* @mem_handle : Memory handle of the region
* @offset : Offset if any
* @size : Size of the region
* @flags : Flags if any
*/
struct cam_cmd_mem_region_info {
int32_t mem_handle;
uint32_t offset;
uint32_t size;
uint32_t flags;
};
/**
* struct cam_cmd_mem_regions -
* List of multiple memory descriptors of
* of different regions
*
* @version : Version number
* @num_regions : Number of regions
* @map_info_array : Array of all the regions
*/
struct cam_cmd_mem_regions {
uint32_t version;
uint32_t num_regions;
struct cam_cmd_mem_region_info map_info_array[1];
};
#endif /* __UAPI_CAM_DEFS_H__ */

132
include/uapi/media/cam_fd.h Normal file
View File

@@ -0,0 +1,132 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_FD_H__
#define __UAPI_CAM_FD_H__
#include "cam_defs.h"
#define CAM_FD_MAX_FACES 35
#define CAM_FD_RAW_RESULT_ENTRIES 512
/* FD Op Codes */
#define CAM_PACKET_OPCODES_FD_FRAME_UPDATE 0x0
/* FD Command Buffer identifiers */
#define CAM_FD_CMD_BUFFER_ID_GENERIC 0x0
#define CAM_FD_CMD_BUFFER_ID_CDM 0x1
#define CAM_FD_CMD_BUFFER_ID_MAX 0x2
/* FD Blob types */
#define CAM_FD_BLOB_TYPE_SOC_CLOCK_BW_REQUEST 0x0
#define CAM_FD_BLOB_TYPE_RAW_RESULTS_REQUIRED 0x1
/* FD Resource IDs */
#define CAM_FD_INPUT_PORT_ID_IMAGE 0x0
#define CAM_FD_INPUT_PORT_ID_MAX 0x1
#define CAM_FD_OUTPUT_PORT_ID_RESULTS 0x0
#define CAM_FD_OUTPUT_PORT_ID_RAW_RESULTS 0x1
#define CAM_FD_OUTPUT_PORT_ID_WORK_BUFFER 0x2
#define CAM_FD_OUTPUT_PORT_ID_MAX 0x3
/**
* struct cam_fd_soc_clock_bw_request - SOC clock, bandwidth request info
*
* @clock_rate : Clock rate required while processing frame
* @bandwidth : Bandwidth required while processing frame
* @reserved : Reserved for future use
*/
struct cam_fd_soc_clock_bw_request {
uint64_t clock_rate;
uint64_t bandwidth;
uint64_t reserved[4];
};
/**
* struct cam_fd_face - Face properties
*
* @prop1 : Property 1 of face
* @prop2 : Property 2 of face
* @prop3 : Property 3 of face
* @prop4 : Property 4 of face
*
* Do not change this layout, this is inline with how HW writes
* these values directly when the buffer is programmed to HW
*/
struct cam_fd_face {
uint32_t prop1;
uint32_t prop2;
uint32_t prop3;
uint32_t prop4;
};
/**
* struct cam_fd_results - FD results layout
*
* @faces : Array of faces with face properties
* @face_count : Number of faces detected
* @reserved : Reserved for alignment
*
* Do not change this layout, this is inline with how HW writes
* these values directly when the buffer is programmed to HW
*/
struct cam_fd_results {
struct cam_fd_face faces[CAM_FD_MAX_FACES];
uint32_t face_count;
uint32_t reserved[3];
};
/**
* struct cam_fd_hw_caps - Face properties
*
* @core_version : FD core version
* @wrapper_version : FD wrapper version
* @raw_results_available : Whether raw results are available on this HW
* @supported_modes : Modes supported by this HW.
* @reserved : Reserved for future use
*/
struct cam_fd_hw_caps {
struct cam_hw_version core_version;
struct cam_hw_version wrapper_version;
uint32_t raw_results_available;
uint32_t supported_modes;
uint64_t reserved;
};
/**
* struct cam_fd_query_cap_cmd - FD Query capabilities information
*
* @device_iommu : FD IOMMU handles
* @cdm_iommu : CDM iommu handles
* @hw_caps : FD HW capabilities
* @reserved : Reserved for alignment
*/
struct cam_fd_query_cap_cmd {
struct cam_iommu_handle device_iommu;
struct cam_iommu_handle cdm_iommu;
struct cam_fd_hw_caps hw_caps;
uint64_t reserved;
};
/**
* struct cam_fd_acquire_dev_info - FD acquire device information
*
* @clk_bw_request : SOC clock, bandwidth request
* @priority : Priority for this acquire
* @mode : Mode in which to run FD HW.
* @get_raw_results : Whether this acquire needs face raw results
* while frame processing
* @reserved : Reserved field for 64 bit alignment
*/
struct cam_fd_acquire_dev_info {
struct cam_fd_soc_clock_bw_request clk_bw_request;
uint32_t priority;
uint32_t mode;
uint32_t get_raw_results;
uint32_t reserved[13];
};
#endif /* __UAPI_CAM_FD_H__ */

View File

@@ -0,0 +1,210 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_ICP_H__
#define __UAPI_CAM_ICP_H__
#include "cam_defs.h"
#include "cam_cpas.h"
/* icp, ipe, bps, cdm(ipe/bps) are used in querycap */
#define CAM_ICP_DEV_TYPE_A5 1
#define CAM_ICP_DEV_TYPE_IPE 2
#define CAM_ICP_DEV_TYPE_BPS 3
#define CAM_ICP_DEV_TYPE_IPE_CDM 4
#define CAM_ICP_DEV_TYPE_BPS_CDM 5
#define CAM_ICP_DEV_TYPE_MAX 5
/* definitions needed for icp aquire device */
#define CAM_ICP_RES_TYPE_BPS 1
#define CAM_ICP_RES_TYPE_IPE_RT 2
#define CAM_ICP_RES_TYPE_IPE 3
#define CAM_ICP_RES_TYPE_MAX 4
/* packet opcode types */
#define CAM_ICP_OPCODE_IPE_UPDATE 0
#define CAM_ICP_OPCODE_BPS_UPDATE 1
#define CAM_ICP_OPCODE_IPE_SETTINGS 2
#define CAM_ICP_OPCODE_BPS_SETTINGS 3
/* IPE input port resource type */
#define CAM_ICP_IPE_INPUT_IMAGE_FULL 0x0
#define CAM_ICP_IPE_INPUT_IMAGE_DS4 0x1
#define CAM_ICP_IPE_INPUT_IMAGE_DS16 0x2
#define CAM_ICP_IPE_INPUT_IMAGE_DS64 0x3
#define CAM_ICP_IPE_INPUT_IMAGE_FULL_REF 0x4
#define CAM_ICP_IPE_INPUT_IMAGE_DS4_REF 0x5
#define CAM_ICP_IPE_INPUT_IMAGE_DS16_REF 0x6
#define CAM_ICP_IPE_INPUT_IMAGE_DS64_REF 0x7
/* IPE output port resource type */
#define CAM_ICP_IPE_OUTPUT_IMAGE_DISPLAY 0x8
#define CAM_ICP_IPE_OUTPUT_IMAGE_VIDEO 0x9
#define CAM_ICP_IPE_OUTPUT_IMAGE_FULL_REF 0xA
#define CAM_ICP_IPE_OUTPUT_IMAGE_DS4_REF 0xB
#define CAM_ICP_IPE_OUTPUT_IMAGE_DS16_REF 0xC
#define CAM_ICP_IPE_OUTPUT_IMAGE_DS64_REF 0xD
#define CAM_ICP_IPE_IMAGE_MAX 0xE
/* BPS input port resource type */
#define CAM_ICP_BPS_INPUT_IMAGE 0x0
/* BPS output port resource type */
#define CAM_ICP_BPS_OUTPUT_IMAGE_FULL 0x1
#define CAM_ICP_BPS_OUTPUT_IMAGE_DS4 0x2
#define CAM_ICP_BPS_OUTPUT_IMAGE_DS16 0x3
#define CAM_ICP_BPS_OUTPUT_IMAGE_DS64 0x4
#define CAM_ICP_BPS_OUTPUT_IMAGE_STATS_BG 0x5
#define CAM_ICP_BPS_OUTPUT_IMAGE_STATS_BHIST 0x6
#define CAM_ICP_BPS_OUTPUT_IMAGE_REG1 0x7
#define CAM_ICP_BPS_OUTPUT_IMAGE_REG2 0x8
#define CAM_ICP_BPS_IO_IMAGES_MAX 0x9
/* Command meta types */
#define CAM_ICP_CMD_META_GENERIC_BLOB 0x1
/* Generic blob types */
#define CAM_ICP_CMD_GENERIC_BLOB_CLK 0x1
#define CAM_ICP_CMD_GENERIC_BLOB_CFG_IO 0x2
#define CAM_ICP_CMD_GENERIC_BLOB_FW_MEM_MAP 0x3
#define CAM_ICP_CMD_GENERIC_BLOB_FW_MEM_UNMAP 0x4
#define CAM_ICP_CMD_GENERIC_BLOB_CLK_V2 0x5
/**
* struct cam_icp_clk_bw_request_v2
*
* @budget_ns: Time required to process frame
* @frame_cycles: Frame cycles needed to process the frame
* @rt_flag: Flag to indicate real time stream
* @reserved: For memory alignment
* @num_paths: Number of axi paths in bw request
* @axi_path: Per path vote info for IPE/BPS
*/
struct cam_icp_clk_bw_request_v2 {
uint64_t budget_ns;
uint32_t frame_cycles;
uint32_t rt_flag;
uint32_t reserved;
uint32_t num_paths;
struct cam_axi_per_path_bw_vote axi_path[1];
};
/**
* struct cam_icp_clk_bw_request
*
* @budget_ns: Time required to process frame
* @frame_cycles: Frame cycles needed to process the frame
* @rt_flag: Flag to indicate real time stream
* @uncompressed_bw: Bandwidth required to process frame
* @compressed_bw: Compressed bandwidth to process frame
*/
struct cam_icp_clk_bw_request {
uint64_t budget_ns;
uint32_t frame_cycles;
uint32_t rt_flag;
uint64_t uncompressed_bw;
uint64_t compressed_bw;
};
/**
* struct cam_icp_dev_ver - Device information for particular hw type
*
* This is used to get device version info of
* ICP, IPE, BPS and CDM related IPE and BPS from firmware
* and use this info in CAM_QUERY_CAP IOCTL
*
* @dev_type: hardware type for the cap info(icp, ipe, bps, cdm(ipe/bps))
* @reserved: reserved field
* @hw_ver: major, minor and incr values of a device version
*/
struct cam_icp_dev_ver {
uint32_t dev_type;
uint32_t reserved;
struct cam_hw_version hw_ver;
};
/**
* struct cam_icp_ver - ICP version info
*
* This strcuture is used for fw and api version
* this is used to get firmware version and api version from firmware
* and use this info in CAM_QUERY_CAP IOCTL
*
* @major: FW version major
* @minor: FW version minor
* @revision: FW version increment
*/
struct cam_icp_ver {
uint32_t major;
uint32_t minor;
uint32_t revision;
uint32_t reserved;
};
/**
* struct cam_icp_query_cap_cmd - ICP query device capability payload
*
* @dev_iommu_handle: icp iommu handles for secure/non secure modes
* @cdm_iommu_handle: iommu handles for secure/non secure modes
* @fw_version: firmware version info
* @api_version: api version info
* @num_ipe: number of ipes
* @num_bps: number of bps
* @dev_ver: returned device capability array
*/
struct cam_icp_query_cap_cmd {
struct cam_iommu_handle dev_iommu_handle;
struct cam_iommu_handle cdm_iommu_handle;
struct cam_icp_ver fw_version;
struct cam_icp_ver api_version;
uint32_t num_ipe;
uint32_t num_bps;
struct cam_icp_dev_ver dev_ver[CAM_ICP_DEV_TYPE_MAX];
};
/**
* struct cam_icp_res_info - ICP output resource info
*
* @format: format of the resource
* @width: width in pixels
* @height: height in lines
* @fps: fps
*/
struct cam_icp_res_info {
uint32_t format;
uint32_t width;
uint32_t height;
uint32_t fps;
};
/**
* struct cam_icp_acquire_dev_info - An ICP device info
*
* @scratch_mem_size: Output param - size of scratch memory
* @dev_type: device type (IPE_RT/IPE_NON_RT/BPS)
* @io_config_cmd_size: size of IO config command
* @io_config_cmd_handle: IO config command for each acquire
* @secure_mode: camera mode (secure/non secure)
* @chain_info: chaining info of FW device handles
* @in_res: resource info used for clock and bandwidth calculation
* @num_out_res: number of output resources
* @out_res: output resource
*/
struct cam_icp_acquire_dev_info {
uint32_t scratch_mem_size;
uint32_t dev_type;
uint32_t io_config_cmd_size;
int32_t io_config_cmd_handle;
uint32_t secure_mode;
int32_t chain_info;
struct cam_icp_res_info in_res;
uint32_t num_out_res;
struct cam_icp_res_info out_res[1];
} __attribute__((__packed__));
#endif /* __UAPI_CAM_ICP_H__ */

View File

@@ -0,0 +1,693 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_ISP_H__
#define __UAPI_CAM_ISP_H__
#include "cam_defs.h"
#include "cam_isp_vfe.h"
#include "cam_isp_ife.h"
#include "cam_cpas.h"
/* ISP driver name */
#define CAM_ISP_DEV_NAME "cam-isp"
/* HW type */
#define CAM_ISP_HW_BASE 0
#define CAM_ISP_HW_CSID 1
#define CAM_ISP_HW_VFE 2
#define CAM_ISP_HW_IFE 3
#define CAM_ISP_HW_ISPIF 4
#define CAM_ISP_HW_MAX 5
/* Color Pattern */
#define CAM_ISP_PATTERN_BAYER_RGRGRG 0
#define CAM_ISP_PATTERN_BAYER_GRGRGR 1
#define CAM_ISP_PATTERN_BAYER_BGBGBG 2
#define CAM_ISP_PATTERN_BAYER_GBGBGB 3
#define CAM_ISP_PATTERN_YUV_YCBYCR 4
#define CAM_ISP_PATTERN_YUV_YCRYCB 5
#define CAM_ISP_PATTERN_YUV_CBYCRY 6
#define CAM_ISP_PATTERN_YUV_CRYCBY 7
#define CAM_ISP_PATTERN_MAX 8
/* Usage Type */
#define CAM_ISP_RES_USAGE_SINGLE 0
#define CAM_ISP_RES_USAGE_DUAL 1
#define CAM_ISP_RES_USAGE_MAX 2
/* Resource ID */
#define CAM_ISP_RES_ID_PORT 0
#define CAM_ISP_RES_ID_CLK 1
#define CAM_ISP_RES_ID_MAX 2
/* Resource Type - Type of resource for the resource id
* defined in cam_isp_vfe.h, cam_isp_ife.h
*/
/* Lane Type in input resource for Port */
#define CAM_ISP_LANE_TYPE_DPHY 0
#define CAM_ISP_LANE_TYPE_CPHY 1
#define CAM_ISP_LANE_TYPE_MAX 2
/* ISP Resurce Composite Group ID */
#define CAM_ISP_RES_COMP_GROUP_NONE 0
#define CAM_ISP_RES_COMP_GROUP_ID_0 1
#define CAM_ISP_RES_COMP_GROUP_ID_1 2
#define CAM_ISP_RES_COMP_GROUP_ID_2 3
#define CAM_ISP_RES_COMP_GROUP_ID_3 4
#define CAM_ISP_RES_COMP_GROUP_ID_4 5
#define CAM_ISP_RES_COMP_GROUP_ID_5 6
#define CAM_ISP_RES_COMP_GROUP_ID_MAX 6
/* ISP packet opcode for ISP */
#define CAM_ISP_PACKET_OP_BASE 0
#define CAM_ISP_PACKET_INIT_DEV 1
#define CAM_ISP_PACKET_UPDATE_DEV 2
#define CAM_ISP_PACKET_OP_MAX 3
/* ISP packet meta_data type for command buffer */
#define CAM_ISP_PACKET_META_BASE 0
#define CAM_ISP_PACKET_META_LEFT 1
#define CAM_ISP_PACKET_META_RIGHT 2
#define CAM_ISP_PACKET_META_COMMON 3
#define CAM_ISP_PACKET_META_DMI_LEFT 4
#define CAM_ISP_PACKET_META_DMI_RIGHT 5
#define CAM_ISP_PACKET_META_DMI_COMMON 6
#define CAM_ISP_PACKET_META_CLOCK 7
#define CAM_ISP_PACKET_META_CSID 8
#define CAM_ISP_PACKET_META_DUAL_CONFIG 9
#define CAM_ISP_PACKET_META_GENERIC_BLOB_LEFT 10
#define CAM_ISP_PACKET_META_GENERIC_BLOB_RIGHT 11
#define CAM_ISP_PACKET_META_GENERIC_BLOB_COMMON 12
/* DSP mode */
#define CAM_ISP_DSP_MODE_NONE 0
#define CAM_ISP_DSP_MODE_ONE_WAY 1
#define CAM_ISP_DSP_MODE_ROUND 2
/* ISP Generic Cmd Buffer Blob types */
#define CAM_ISP_GENERIC_BLOB_TYPE_HFR_CONFIG 0
#define CAM_ISP_GENERIC_BLOB_TYPE_CLOCK_CONFIG 1
#define CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG 2
#define CAM_ISP_GENERIC_BLOB_TYPE_UBWC_CONFIG 3
#define CAM_ISP_GENERIC_BLOB_TYPE_CSID_CLOCK_CONFIG 4
#define CAM_ISP_GENERIC_BLOB_TYPE_FE_CONFIG 5
#define CAM_ISP_GENERIC_BLOB_TYPE_UBWC_CONFIG_V2 6
#define CAM_ISP_GENERIC_BLOB_TYPE_IFE_CORE_CONFIG 7
#define CAM_ISP_GENERIC_BLOB_TYPE_VFE_OUT_CONFIG 8
#define CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG_V2 9
#define CAM_ISP_VC_DT_CFG 4
#define CAM_ISP_IFE0_HW 0x1
#define CAM_ISP_IFE1_HW 0x2
#define CAM_ISP_IFE0_LITE_HW 0x4
#define CAM_ISP_IFE1_LITE_HW 0x8
#define CAM_ISP_IFE2_LITE_HW 0x10
#define CAM_ISP_PXL_PATH 0x1
#define CAM_ISP_PPP_PATH 0x2
#define CAM_ISP_LCR_PATH 0x4
#define CAM_ISP_RDI0_PATH 0x8
#define CAM_ISP_RDI1_PATH 0x10
#define CAM_ISP_RDI2_PATH 0x20
#define CAM_ISP_RDI3_PATH 0x40
/* Per Path Usage Data */
#define CAM_ISP_USAGE_INVALID 0
#define CAM_ISP_USAGE_LEFT_PX 1
#define CAM_ISP_USAGE_RIGHT_PX 2
#define CAM_ISP_USAGE_RDI 3
/* Query devices */
/**
* struct cam_isp_dev_cap_info - A cap info for particular hw type
*
* @hw_type: Hardware type for the cap info
* @reserved: reserved field for alignment
* @hw_version: Hardware version
*
*/
struct cam_isp_dev_cap_info {
uint32_t hw_type;
uint32_t reserved;
struct cam_hw_version hw_version;
};
/**
* struct cam_isp_query_cap_cmd - ISP query device capability payload
*
* @device_iommu: returned iommu handles for device
* @cdm_iommu: returned iommu handles for cdm
* @num_dev: returned number of device capabilities
* @reserved: reserved field for alignment
* @dev_caps: returned device capability array
*
*/
struct cam_isp_query_cap_cmd {
struct cam_iommu_handle device_iommu;
struct cam_iommu_handle cdm_iommu;
int32_t num_dev;
uint32_t reserved;
struct cam_isp_dev_cap_info dev_caps[CAM_ISP_HW_MAX];
};
/* Acquire Device */
/**
* struct cam_isp_out_port_info - An output port resource info
*
* @res_type: output resource type defined in file
* cam_isp_vfe.h or cam_isp_ife.h
* @format: output format of the resource
* @wdith: output width in pixels
* @height: output height in lines
* @comp_grp_id: composite group id for the resource.
* @split_point: split point in pixels for the dual VFE.
* @secure_mode: flag to tell if output should be run in secure
* mode or not. See cam_defs.h for definition
* @reserved: reserved field for alignment
*
*/
struct cam_isp_out_port_info {
uint32_t res_type;
uint32_t format;
uint32_t width;
uint32_t height;
uint32_t comp_grp_id;
uint32_t split_point;
uint32_t secure_mode;
uint32_t reserved;
};
/**
* struct cam_isp_out_port_info_v2 - An output port resource info
*
* @res_type: output resource type defined in file
* cam_isp_vfe.h or cam_isp_ife.h
* @format: output format of the resource
* @wdith: output width in pixels
* @height: output height in lines
* @comp_grp_id: composite group id for the resource.
* @split_point: split point in pixels for the dual VFE.
* @secure_mode: flag to tell if output should be run in secure
* mode or not. See cam_defs.h for definition
* @wm_mode: WM mode
* @out_port_res1: Output reserved field
* @out_port_res2: Output reserved field
*
*/
struct cam_isp_out_port_info_v2 {
uint32_t res_type;
uint32_t format;
uint32_t width;
uint32_t height;
uint32_t comp_grp_id;
uint32_t split_point;
uint32_t secure_mode;
uint32_t wm_mode;
uint32_t out_port_res1;
uint32_t out_port_res2;
};
/**
* struct cam_isp_in_port_info - An input port resource info
*
* @res_type: input resource type define in file
* cam_isp_vfe.h or cam_isp_ife.h
* @lane_type: lane type: c-phy or d-phy.
* @lane_num: active lane number
* @lane_cfg: lane configurations: 4 bits per lane
* @vc: input virtual channel number
* @dt: input data type number
* @format: input format
* @test_pattern: test pattern for the testgen
* @usage_type: whether dual vfe is required
* @left_start: left input start offset in pixels
* @left_stop: left input stop offset in pixels
* @left_width: left input width in pixels
* @right_start: right input start offset in pixels.
* Only for Dual VFE
* @right_stop: right input stop offset in pixels.
* Only for Dual VFE
* @right_width: right input width in pixels.
* Only for dual VFE
* @line_start: top of the line number
* @line_stop: bottome of the line number
* @height: input height in lines
* @pixel_clk; sensor output clock
* @batch_size: batch size for HFR mode
* @dsp_mode: DSP stream mode (Defines as CAM_ISP_DSP_MODE_*)
* @hbi_cnt: HBI count for the camif input
* @reserved: Reserved field for alignment
* @num_out_res: number of the output resource associated
* @data: payload that contains the output resources
*
*/
struct cam_isp_in_port_info {
uint32_t res_type;
uint32_t lane_type;
uint32_t lane_num;
uint32_t lane_cfg;
uint32_t vc;
uint32_t dt;
uint32_t format;
uint32_t test_pattern;
uint32_t usage_type;
uint32_t left_start;
uint32_t left_stop;
uint32_t left_width;
uint32_t right_start;
uint32_t right_stop;
uint32_t right_width;
uint32_t line_start;
uint32_t line_stop;
uint32_t height;
uint32_t pixel_clk;
uint32_t batch_size;
uint32_t dsp_mode;
uint32_t hbi_cnt;
uint32_t reserved;
uint32_t num_out_res;
struct cam_isp_out_port_info data[1];
};
/**
* struct cam_isp_in_port_info_v2 - An input port resource info
*
* @res_type: input resource type define in file
* cam_isp_vfe.h or cam_isp_ife.h
* @lane_type: lane type: c-phy or d-phy.
* @lane_num: active lane number
* @lane_cfg: lane configurations: 4 bits per lane
* @vc: input virtual channel number
* @dt: input data type number
* @num_valid_vc_dt: valid vc and dt in array
* @format: input format
* @test_pattern: test pattern for the testgen
* @usage_type: whether dual vfe is required
* @left_start: left input start offset in pixels
* @left_stop: left input stop offset in pixels
* @left_width: left input width in pixels
* @right_start: right input start offset in pixels.
* Only for Dual VFE
* @right_stop: right input stop offset in pixels.
* only for Dual VFE
* @right_width: right input width in pixels.
* only for dual VFE
* @line_start: top of the line number
* @line_stop: bottome of the line number
* @height: input height in lines
* @pixel_clk; sensor output clock
* @batch_size: batch size for HFR mode
* @dsp_mode: DSP stream mode (Defines as CAM_ISP_DSP_MODE_*)
* @hbi_cnt: HBI count for the camif input
* @cust_node: if any custom HW block is present before IFE
* @num_out_res: number of the output resource associated
* @horizontal_bin: Horizontal Binning info
* @qcfa_bin: Quadra Binning info
* @csid_res_1: payload for future use
* @csid_res_2: payload for future use
* @ife_res_1: payload for future use
* @ife_res_2: payload for future use
* @data: payload that contains the output resources
*
*/
struct cam_isp_in_port_info_v2 {
uint32_t res_type;
uint32_t lane_type;
uint32_t lane_num;
uint32_t lane_cfg;
uint32_t vc[CAM_ISP_VC_DT_CFG];
uint32_t dt[CAM_ISP_VC_DT_CFG];
uint32_t num_valid_vc_dt;
uint32_t format;
uint32_t test_pattern;
uint32_t usage_type;
uint32_t left_start;
uint32_t left_stop;
uint32_t left_width;
uint32_t right_start;
uint32_t right_stop;
uint32_t right_width;
uint32_t line_start;
uint32_t line_stop;
uint32_t height;
uint32_t pixel_clk;
uint32_t batch_size;
uint32_t dsp_mode;
uint32_t hbi_cnt;
uint32_t cust_node;
uint32_t num_out_res;
uint32_t offline_mode;
uint32_t horizontal_bin;
uint32_t qcfa_bin;
uint32_t csid_res_1;
uint32_t csid_res_2;
uint32_t ife_res_1;
uint32_t ife_res_2;
struct cam_isp_out_port_info_v2 data[1];
};
/**
* struct cam_isp_resource - A resource bundle
*
* @resoruce_id: resource id for the resource bundle
* @length: length of the while resource blob
* @handle_type: type of the resource handle
* @reserved: reserved field for alignment
* @res_hdl: resource handle that points to the
* resource array;
*
*/
struct cam_isp_resource {
uint32_t resource_id;
uint32_t length;
uint32_t handle_type;
uint32_t reserved;
uint64_t res_hdl;
};
/**
* struct cam_isp_port_hfr_config - HFR configuration for this port
*
* @resource_type: Resource type
* @subsample_pattern: Subsample pattern. Used in HFR mode. It
* should be consistent with batchSize and
* CAMIF programming.
* @subsample_period: Subsample period. Used in HFR mode. It
* should be consistent with batchSize and
* CAMIF programming.
* @framedrop_pattern: Framedrop pattern
* @framedrop_period: Framedrop period
* @reserved: Reserved for alignment
*/
struct cam_isp_port_hfr_config {
uint32_t resource_type;
uint32_t subsample_pattern;
uint32_t subsample_period;
uint32_t framedrop_pattern;
uint32_t framedrop_period;
uint32_t reserved;
} __attribute__((packed));
/**
* struct cam_isp_resource_hfr_config - Resource HFR configuration
*
* @num_ports: Number of ports
* @reserved: Reserved for alignment
* @port_hfr_config: HFR configuration for each IO port
*/
struct cam_isp_resource_hfr_config {
uint32_t num_ports;
uint32_t reserved;
struct cam_isp_port_hfr_config port_hfr_config[1];
} __attribute__((packed));
/**
* struct cam_isp_dual_split_params - dual isp spilt parameters
*
* @split_point: Split point information x, where (0 < x < width)
* left ISP's input ends at x + righ padding and
* Right ISP's input starts at x - left padding
* @right_padding: Padding added past the split point for left
* ISP's input
* @left_padding: Padding added before split point for right
* ISP's input
* @reserved: Reserved filed for alignment
*
*/
struct cam_isp_dual_split_params {
uint32_t split_point;
uint32_t right_padding;
uint32_t left_padding;
uint32_t reserved;
};
/**
* struct cam_isp_dual_stripe_config - stripe config per bus client
*
* @offset: Start horizontal offset relative to
* output buffer
* In UBWC mode, this value indicates the H_INIT
* value in pixel
* @width: Width of the stripe in bytes
* @tileconfig Ubwc meta tile config. Contain the partial
* tile info
* @port_id: port id of ISP output
*
*/
struct cam_isp_dual_stripe_config {
uint32_t offset;
uint32_t width;
uint32_t tileconfig;
uint32_t port_id;
};
/**
* struct cam_isp_dual_config - dual isp configuration
*
* @num_ports Number of isp output ports
* @reserved Reserved field for alignment
* @split_params: Inpput split parameters
* @stripes: Stripe information
*
*/
struct cam_isp_dual_config {
uint32_t num_ports;
uint32_t reserved;
struct cam_isp_dual_split_params split_params;
struct cam_isp_dual_stripe_config stripes[1];
} __attribute__((packed));
/**
* struct cam_isp_clock_config - Clock configuration
*
* @usage_type: Usage type (Single/Dual)
* @num_rdi: Number of RDI votes
* @left_pix_hz: Pixel Clock for Left ISP
* @right_pix_hz: Pixel Clock for Right ISP, valid only if Dual
* @rdi_hz: RDI Clock. ISP clock will be max of RDI and
* PIX clocks. For a particular context which ISP
* HW the RDI is allocated to is not known to UMD.
* Hence pass the clock and let KMD decide.
*/
struct cam_isp_clock_config {
uint32_t usage_type;
uint32_t num_rdi;
uint64_t left_pix_hz;
uint64_t right_pix_hz;
uint64_t rdi_hz[1];
} __attribute__((packed));
/**
* struct cam_isp_csid_clock_config - CSID clock configuration
*
* @csid_clock CSID clock
*/
struct cam_isp_csid_clock_config {
uint64_t csid_clock;
} __attribute__((packed));
/**
* struct cam_isp_bw_vote - Bandwidth vote information
*
* @resource_id: Resource ID
* @reserved: Reserved field for alignment
* @cam_bw_bps: Bandwidth vote for CAMNOC
* @ext_bw_bps: Bandwidth vote for path-to-DDR after CAMNOC
*/
struct cam_isp_bw_vote {
uint32_t resource_id;
uint32_t reserved;
uint64_t cam_bw_bps;
uint64_t ext_bw_bps;
} __attribute__((packed));
/**
* struct cam_isp_bw_config - Bandwidth configuration
*
* @usage_type: Usage type (Single/Dual)
* @num_rdi: Number of RDI votes
* @left_pix_vote: Bandwidth vote for left ISP
* @right_pix_vote: Bandwidth vote for right ISP
* @rdi_vote: RDI bandwidth requirements
*/
struct cam_isp_bw_config {
uint32_t usage_type;
uint32_t num_rdi;
struct cam_isp_bw_vote left_pix_vote;
struct cam_isp_bw_vote right_pix_vote;
struct cam_isp_bw_vote rdi_vote[1];
} __attribute__((packed));
/**
* struct cam_isp_bw_config_v2 - Bandwidth configuration
*
* @usage_type: Usage type (Single/Dual)
* @num_paths: Number of axi data paths
* @axi_path Per path vote info
*/
struct cam_isp_bw_config_v2 {
uint32_t usage_type;
uint32_t num_paths;
struct cam_axi_per_path_bw_vote axi_path[1];
} __attribute__((packed));
/**
* struct cam_fe_config - Fetch Engine configuration
*
* @version: fetch engine veriosn
* @min_vbi: require min vbi
* @fs_mode: indicates if fs mode enabled
* @fs_line_sync_en: frame level sync or line level
* sync for fetch engine
* @hbi_count: hbi count
* @fs_sync_enable: indicates if fetch engine working
* wokring in sync with write engine
* @go_cmd_sel: softwrae go_cmd or hw go_cmd
* @client_enable: enable read engine
* @source_addr: adrress of buffer to read from
* @width: buffer width
* @height: buffer height
* @stride: buffer stride (here equal to width)
* @format: format of image in buffer
* @unpacker_cfg: unpacker config type
* @latency_buf_size: latency buffer for read engine
*/
struct cam_fe_config {
uint64_t version;
uint32_t min_vbi;
uint32_t fs_mode;
uint32_t fs_line_sync_en;
uint32_t hbi_count;
uint32_t fs_sync_enable;
uint32_t go_cmd_sel;
uint32_t client_enable;
uint32_t source_addr;
uint32_t width;
uint32_t height;
uint32_t stride;
uint32_t format;
uint32_t unpacker_cfg;
uint32_t latency_buf_size;
} __attribute__((packed));
/**
* struct cam_isp_core_config - ISP core registers configuration
*
* @version: Version info
* @vid_ds16_r2pd: Enables Y and C merging PD output for video DS16
* @vid_ds4_r2pd: Enables Y and C merging PD output for video DS4
* @disp_ds16_r2pd: Enables Y and C merging PD output for disp DS16
* @disp_ds4_r2pd: Enables Y and C merging PD output for disp DS4
* @dsp_streaming_tap_point: This selects source for DSP streaming interface
* @ihist_src_sel: Selects input for IHIST module
* @hdr_be_src_sel: Selects input for HDR BE module
* @hdr_bhist_src_sel: Selects input for HDR BHIST module
* @input_mux_sel_pdaf: Selects input for PDAF
* @input_mux_sel_pp: Selects input for Pixel Pipe
* @reserved: Reserved
*/
struct cam_isp_core_config {
uint32_t version;
uint32_t vid_ds16_r2pd;
uint32_t vid_ds4_r2pd;
uint32_t disp_ds16_r2pd;
uint32_t disp_ds4_r2pd;
uint32_t dsp_streaming_tap_point;
uint32_t ihist_src_sel;
uint32_t hdr_be_src_sel;
uint32_t hdr_bhist_src_sel;
uint32_t input_mux_sel_pdaf;
uint32_t input_mux_sel_pp;
uint32_t reserved;
} __attribute__((packed));
/**
* struct cam_isp_acquire_hw_info - ISP acquire HW params
*
* @common_info_version : Version of common info struct used
* @common_info_size : Size of common info struct used
* @common_info_offset : Offset of common info from start of data
* @num_inputs : Number of inputs
* @input_info_version : Version of input info struct used
* @input_info_size : Size of input info struct used
* @input_info_offset : Offset of input info from start of data
* @data : Start of data region
*/
struct cam_isp_acquire_hw_info {
uint16_t common_info_version;
uint16_t common_info_size;
uint32_t common_info_offset;
uint32_t num_inputs;
uint32_t input_info_version;
uint32_t input_info_size;
uint32_t input_info_offset;
uint64_t data;
};
/**
* struct cam_isp_vfe_wm_config - VFE write master config per port
*
* @port_type : Unique ID of output port
* @wm_mode : Write master mode
* 0x0 - Line based mode
* 0x1 - Frame based mode
* 0x2 - Index based mode, valid for BAF only
* @h_init : Horizontal starting coordinate in pixels. Must be a
* multiple of 3 for TP10 format
* @height : Height in pixels
* @width : Width in pixels
* @virtual_frame_en : Enabling virtual frame will prevent actual request from
* being sent to NOC
* @stride : Write master stride
* @offset : Write master offset
* @reserved_1 : Reserved field for Write master config
* @reserved_2 : Reserved field for Write master config
* @reserved_3 : Reserved field for Write master config
* @reserved_4 : Reserved field for Write master config
*/
struct cam_isp_vfe_wm_config {
uint32_t port_type;
uint32_t wm_mode;
uint32_t h_init;
uint32_t height;
uint32_t width;
uint32_t virtual_frame_en;
uint32_t stride;
uint32_t offset;
uint32_t reserved_1;
uint32_t reserved_2;
uint32_t reserved_3;
uint32_t reserved_4;
};
/**
* struct cam_isp_vfe_out_config - VFE write master config
*
* @num_ports : Number of ports
* @reserved : Reserved field
* @wm_config : VFE out config
*/
struct cam_isp_vfe_out_config {
uint32_t num_ports;
uint32_t reserved;
struct cam_isp_vfe_wm_config wm_config[1];
};
#define CAM_ISP_ACQUIRE_COMMON_VER0 0x1000
#define CAM_ISP_ACQUIRE_COMMON_SIZE_VER0 0x0
#define CAM_ISP_ACQUIRE_INPUT_VER0 0x2000
#define CAM_ISP_ACQUIRE_INPUT_SIZE_VER0 sizeof(struct cam_isp_in_port_info)
#define CAM_ISP_ACQUIRE_OUT_VER0 0x3000
#define CAM_ISP_ACQUIRE_OUT_SIZE_VER0 sizeof(struct cam_isp_out_port_info)
#endif /* __UAPI_CAM_ISP_H__ */

View File

@@ -0,0 +1,52 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_ISP_IFE_H__
#define __UAPI_CAM_ISP_IFE_H__
/* IFE output port resource type (global unique)*/
#define CAM_ISP_IFE_OUT_RES_BASE 0x3000
#define CAM_ISP_IFE_OUT_RES_FULL (CAM_ISP_IFE_OUT_RES_BASE + 0)
#define CAM_ISP_IFE_OUT_RES_DS4 (CAM_ISP_IFE_OUT_RES_BASE + 1)
#define CAM_ISP_IFE_OUT_RES_DS16 (CAM_ISP_IFE_OUT_RES_BASE + 2)
#define CAM_ISP_IFE_OUT_RES_RAW_DUMP (CAM_ISP_IFE_OUT_RES_BASE + 3)
#define CAM_ISP_IFE_OUT_RES_FD (CAM_ISP_IFE_OUT_RES_BASE + 4)
#define CAM_ISP_IFE_OUT_RES_PDAF (CAM_ISP_IFE_OUT_RES_BASE + 5)
#define CAM_ISP_IFE_OUT_RES_RDI_0 (CAM_ISP_IFE_OUT_RES_BASE + 6)
#define CAM_ISP_IFE_OUT_RES_RDI_1 (CAM_ISP_IFE_OUT_RES_BASE + 7)
#define CAM_ISP_IFE_OUT_RES_RDI_2 (CAM_ISP_IFE_OUT_RES_BASE + 8)
#define CAM_ISP_IFE_OUT_RES_RDI_3 (CAM_ISP_IFE_OUT_RES_BASE + 9)
#define CAM_ISP_IFE_OUT_RES_STATS_HDR_BE (CAM_ISP_IFE_OUT_RES_BASE + 10)
#define CAM_ISP_IFE_OUT_RES_STATS_HDR_BHIST (CAM_ISP_IFE_OUT_RES_BASE + 11)
#define CAM_ISP_IFE_OUT_RES_STATS_TL_BG (CAM_ISP_IFE_OUT_RES_BASE + 12)
#define CAM_ISP_IFE_OUT_RES_STATS_BF (CAM_ISP_IFE_OUT_RES_BASE + 13)
#define CAM_ISP_IFE_OUT_RES_STATS_AWB_BG (CAM_ISP_IFE_OUT_RES_BASE + 14)
#define CAM_ISP_IFE_OUT_RES_STATS_BHIST (CAM_ISP_IFE_OUT_RES_BASE + 15)
#define CAM_ISP_IFE_OUT_RES_STATS_RS (CAM_ISP_IFE_OUT_RES_BASE + 16)
#define CAM_ISP_IFE_OUT_RES_STATS_CS (CAM_ISP_IFE_OUT_RES_BASE + 17)
#define CAM_ISP_IFE_OUT_RES_STATS_IHIST (CAM_ISP_IFE_OUT_RES_BASE + 18)
#define CAM_ISP_IFE_OUT_RES_FULL_DISP (CAM_ISP_IFE_OUT_RES_BASE + 19)
#define CAM_ISP_IFE_OUT_RES_DS4_DISP (CAM_ISP_IFE_OUT_RES_BASE + 20)
#define CAM_ISP_IFE_OUT_RES_DS16_DISP (CAM_ISP_IFE_OUT_RES_BASE + 21)
#define CAM_ISP_IFE_OUT_RES_2PD (CAM_ISP_IFE_OUT_RES_BASE + 22)
#define CAM_ISP_IFE_OUT_RES_RDI_RD (CAM_ISP_IFE_OUT_RES_BASE + 23)
#define CAM_ISP_IFE_OUT_RES_LCR (CAM_ISP_IFE_OUT_RES_BASE + 24)
#define CAM_ISP_IFE_OUT_RES_MAX (CAM_ISP_IFE_OUT_RES_BASE + 25)
/* IFE input port resource type (global unique) */
#define CAM_ISP_IFE_IN_RES_BASE 0x4000
#define CAM_ISP_IFE_IN_RES_TPG (CAM_ISP_IFE_IN_RES_BASE + 0)
#define CAM_ISP_IFE_IN_RES_PHY_0 (CAM_ISP_IFE_IN_RES_BASE + 1)
#define CAM_ISP_IFE_IN_RES_PHY_1 (CAM_ISP_IFE_IN_RES_BASE + 2)
#define CAM_ISP_IFE_IN_RES_PHY_2 (CAM_ISP_IFE_IN_RES_BASE + 3)
#define CAM_ISP_IFE_IN_RES_PHY_3 (CAM_ISP_IFE_IN_RES_BASE + 4)
#define CAM_ISP_IFE_IN_RES_RD (CAM_ISP_IFE_IN_RES_BASE + 5)
#define CAM_ISP_IFE_IN_RES_MAX (CAM_ISP_IFE_IN_RES_BASE + 6)
#endif /* __UAPI_CAM_ISP_IFE_H__ */

View File

@@ -0,0 +1,49 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_ISP_VFE_H__
#define __UAPI_CAM_ISP_VFE_H__
/* VFE output port resource type (global unique) */
#define CAM_ISP_VFE_OUT_RES_BASE 0x1000
#define CAM_ISP_VFE_OUT_RES_ENC (CAM_ISP_VFE_OUT_RES_BASE + 0)
#define CAM_ISP_VFE_OUT_RES_VIEW (CAM_ISP_VFE_OUT_RES_BASE + 1)
#define CAM_ISP_VFE_OUT_RES_VID (CAM_ISP_VFE_OUT_RES_BASE + 2)
#define CAM_ISP_VFE_OUT_RES_RDI_0 (CAM_ISP_VFE_OUT_RES_BASE + 3)
#define CAM_ISP_VFE_OUT_RES_RDI_1 (CAM_ISP_VFE_OUT_RES_BASE + 4)
#define CAM_ISP_VFE_OUT_RES_RDI_2 (CAM_ISP_VFE_OUT_RES_BASE + 5)
#define CAM_ISP_VFE_OUT_RES_RDI_3 (CAM_ISP_VFE_OUT_RES_BASE + 6)
#define CAM_ISP_VFE_OUT_RES_STATS_AEC (CAM_ISP_VFE_OUT_RES_BASE + 7)
#define CAM_ISP_VFE_OUT_RES_STATS_AF (CAM_ISP_VFE_OUT_RES_BASE + 8)
#define CAM_ISP_VFE_OUT_RES_STATS_AWB (CAM_ISP_VFE_OUT_RES_BASE + 9)
#define CAM_ISP_VFE_OUT_RES_STATS_RS (CAM_ISP_VFE_OUT_RES_BASE + 10)
#define CAM_ISP_VFE_OUT_RES_STATS_CS (CAM_ISP_VFE_OUT_RES_BASE + 11)
#define CAM_ISP_VFE_OUT_RES_STATS_IHIST (CAM_ISP_VFE_OUT_RES_BASE + 12)
#define CAM_ISP_VFE_OUT_RES_STATS_SKIN (CAM_ISP_VFE_OUT_RES_BASE + 13)
#define CAM_ISP_VFE_OUT_RES_STATS_BG (CAM_ISP_VFE_OUT_RES_BASE + 14)
#define CAM_ISP_VFE_OUT_RES_STATS_BF (CAM_ISP_VFE_OUT_RES_BASE + 15)
#define CAM_ISP_VFE_OUT_RES_STATS_BE (CAM_ISP_VFE_OUT_RES_BASE + 16)
#define CAM_ISP_VFE_OUT_RES_STATS_BHIST (CAM_ISP_VFE_OUT_RES_BASE + 17)
#define CAM_ISP_VFE_OUT_RES_STATS_BF_SCALE (CAM_ISP_VFE_OUT_RES_BASE + 18)
#define CAM_ISP_VFE_OUT_RES_STATS_HDR_BE (CAM_ISP_VFE_OUT_RES_BASE + 19)
#define CAM_ISP_VFE_OUT_RES_STATS_HDR_BHIST (CAM_ISP_VFE_OUT_RES_BASE + 20)
#define CAM_ISP_VFE_OUT_RES_STATS_AEC_BG (CAM_ISP_VFE_OUT_RES_BASE + 21)
#define CAM_ISP_VFE_OUT_RES_CAMIF_RAW (CAM_ISP_VFE_OUT_RES_BASE + 22)
#define CAM_ISP_VFE_OUT_RES_IDEAL_RAW (CAM_ISP_VFE_OUT_RES_BASE + 23)
#define CAM_ISP_VFE_OUT_RES_MAX (CAM_ISP_VFE_OUT_RES_BASE + 24)
/* VFE input port_ resource type (global unique) */
#define CAM_ISP_VFE_IN_RES_BASE 0x2000
#define CAM_ISP_VFE_IN_RES_TPG (CAM_ISP_VFE_IN_RES_BASE + 0)
#define CAM_ISP_VFE_IN_RES_PHY_0 (CAM_ISP_VFE_IN_RES_BASE + 1)
#define CAM_ISP_VFE_IN_RES_PHY_1 (CAM_ISP_VFE_IN_RES_BASE + 2)
#define CAM_ISP_VFE_IN_RES_PHY_2 (CAM_ISP_VFE_IN_RES_BASE + 3)
#define CAM_ISP_VFE_IN_RES_PHY_3 (CAM_ISP_VFE_IN_RES_BASE + 4)
#define CAM_ISP_VFE_IN_RES_FE (CAM_ISP_VFE_IN_RES_BASE + 5)
#define CAM_ISP_VFE_IN_RES_MAX (CAM_ISP_VFE_IN_RES_BASE + 6)
#endif /* __UAPI_CAM_ISP_VFE_H__ */

View File

@@ -0,0 +1,122 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_JPEG_H__
#define __UAPI_CAM_JPEG_H__
#include "cam_defs.h"
/* enc, dma, cdm(enc/dma) are used in querycap */
#define CAM_JPEG_DEV_TYPE_ENC 0
#define CAM_JPEG_DEV_TYPE_DMA 1
#define CAM_JPEG_DEV_TYPE_MAX 2
#define CAM_JPEG_NUM_DEV_PER_RES_MAX 1
/* definitions needed for jpeg aquire device */
#define CAM_JPEG_RES_TYPE_ENC 0
#define CAM_JPEG_RES_TYPE_DMA 1
#define CAM_JPEG_RES_TYPE_MAX 2
/* packet opcode types */
#define CAM_JPEG_OPCODE_ENC_UPDATE 0
#define CAM_JPEG_OPCODE_DMA_UPDATE 1
/* ENC input port resource type */
#define CAM_JPEG_ENC_INPUT_IMAGE 0x0
/* ENC output port resource type */
#define CAM_JPEG_ENC_OUTPUT_IMAGE 0x1
#define CAM_JPEG_ENC_IO_IMAGES_MAX 0x2
/* DMA input port resource type */
#define CAM_JPEG_DMA_INPUT_IMAGE 0x0
/* DMA output port resource type */
#define CAM_JPEG_DMA_OUTPUT_IMAGE 0x1
#define CAM_JPEG_DMA_IO_IMAGES_MAX 0x2
#define CAM_JPEG_IMAGE_MAX 0x2
/**
* struct cam_jpeg_dev_ver - Device information for particular hw type
*
* This is used to get device version info of JPEG ENC, JPEG DMA
* from hardware and use this info in CAM_QUERY_CAP IOCTL
*
* @size : Size of struct passed
* @dev_type: Hardware type for the cap info(jpeg enc, jpeg dma)
* @hw_ver: Major, minor and incr values of a device version
*/
struct cam_jpeg_dev_ver {
uint32_t size;
uint32_t dev_type;
struct cam_hw_version hw_ver;
};
/**
* struct cam_jpeg_query_cap_cmd - JPEG query device capability payload
*
* @dev_iommu_handle: Jpeg iommu handles for secure/non secure
* modes
* @cdm_iommu_handle: Iommu handles for secure/non secure modes
* @num_enc: Number of encoder
* @num_dma: Number of dma
* @dev_ver: Returned device capability array
*/
struct cam_jpeg_query_cap_cmd {
struct cam_iommu_handle dev_iommu_handle;
struct cam_iommu_handle cdm_iommu_handle;
uint32_t num_enc;
uint32_t num_dma;
struct cam_jpeg_dev_ver dev_ver[CAM_JPEG_DEV_TYPE_MAX];
};
/**
* struct cam_jpeg_res_info - JPEG output resource info
*
* @format: Format of the resource
* @width: Width in pixels
* @height: Height in lines
* @fps: Fps
*/
struct cam_jpeg_res_info {
uint32_t format;
uint32_t width;
uint32_t height;
uint32_t fps;
};
/**
* struct cam_jpeg_acquire_dev_info - An JPEG device info
*
* @dev_type: Device type (ENC/DMA)
* @reserved: Reserved Bytes
* @in_res: In resource info
* @in_res: Iut resource info
*/
struct cam_jpeg_acquire_dev_info {
uint32_t dev_type;
uint32_t reserved;
struct cam_jpeg_res_info in_res;
struct cam_jpeg_res_info out_res;
};
/**
* struct cam_jpeg_config_inout_param_info - JPEG Config time
* input output params
*
* @clk_index: Input Param- clock selection index.(-1 default)
* @output_size: Output Param - jpeg encode/dma output size in
* bytes
*/
struct cam_jpeg_config_inout_param_info {
int32_t clk_index;
int32_t output_size;
};
#endif /* __UAPI_CAM_JPEG_H__ */

View File

@@ -0,0 +1,69 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_LRME_H__
#define __UAPI_CAM_LRME_H__
#include "cam_defs.h"
/* LRME Resource Types */
enum CAM_LRME_IO_TYPE {
CAM_LRME_IO_TYPE_TAR,
CAM_LRME_IO_TYPE_REF,
CAM_LRME_IO_TYPE_RES,
CAM_LRME_IO_TYPE_DS2,
};
#define CAM_LRME_INPUT_PORT_TYPE_TAR (1 << 0)
#define CAM_LRME_INPUT_PORT_TYPE_REF (1 << 1)
#define CAM_LRME_OUTPUT_PORT_TYPE_DS2 (1 << 0)
#define CAM_LRME_OUTPUT_PORT_TYPE_RES (1 << 1)
#define CAM_LRME_DEV_MAX 1
struct cam_lrme_hw_version {
uint32_t gen;
uint32_t rev;
uint32_t step;
};
struct cam_lrme_dev_cap {
struct cam_lrme_hw_version clc_hw_version;
struct cam_lrme_hw_version bus_rd_hw_version;
struct cam_lrme_hw_version bus_wr_hw_version;
struct cam_lrme_hw_version top_hw_version;
struct cam_lrme_hw_version top_titan_version;
};
/**
* struct cam_lrme_query_cap_cmd - LRME query device capability payload
*
* @dev_iommu_handle: LRME iommu handles for secure/non secure
* modes
* @cdm_iommu_handle: Iommu handles for secure/non secure modes
* @num_devices: number of hardware devices
* @dev_caps: Returned device capability array
*/
struct cam_lrme_query_cap_cmd {
struct cam_iommu_handle device_iommu;
struct cam_iommu_handle cdm_iommu;
uint32_t num_devices;
struct cam_lrme_dev_cap dev_caps[CAM_LRME_DEV_MAX];
};
struct cam_lrme_soc_info {
uint64_t clock_rate;
uint64_t bandwidth;
uint64_t reserved[4];
};
struct cam_lrme_acquire_args {
struct cam_lrme_soc_info lrme_soc_info;
};
#endif /* __UAPI_CAM_LRME_H__ */

View File

@@ -0,0 +1,444 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_LINUX_CAM_REQ_MGR_H
#define __UAPI_LINUX_CAM_REQ_MGR_H
#include <linux/videodev2.h>
#include <linux/types.h>
#include <linux/ioctl.h>
#include <linux/media.h>
#include "cam_defs.h"
#define CAM_REQ_MGR_VNODE_NAME "cam-req-mgr-devnode"
#define CAM_DEVICE_TYPE_BASE (MEDIA_ENT_F_OLD_BASE)
#define CAM_VNODE_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE)
#define CAM_SENSOR_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 1)
#define CAM_IFE_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 2)
#define CAM_ICP_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 3)
#define CAM_LRME_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 4)
#define CAM_JPEG_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 5)
#define CAM_FD_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 6)
#define CAM_CPAS_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 7)
#define CAM_CSIPHY_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 8)
#define CAM_ACTUATOR_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 9)
#define CAM_CCI_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 10)
#define CAM_FLASH_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 11)
#define CAM_EEPROM_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 12)
#define CAM_OIS_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 13)
/* cam_req_mgr hdl info */
#define CAM_REQ_MGR_HDL_IDX_POS 8
#define CAM_REQ_MGR_HDL_IDX_MASK ((1 << CAM_REQ_MGR_HDL_IDX_POS) - 1)
#define CAM_REQ_MGR_GET_HDL_IDX(hdl) (hdl & CAM_REQ_MGR_HDL_IDX_MASK)
/**
* Max handles supported by cam_req_mgr
* It includes both session and device handles
*/
#define CAM_REQ_MGR_MAX_HANDLES 64
#define MAX_LINKS_PER_SESSION 2
/* V4L event type which user space will subscribe to */
#define V4L_EVENT_CAM_REQ_MGR_EVENT (V4L2_EVENT_PRIVATE_START + 0)
/* Specific event ids to get notified in user space */
#define V4L_EVENT_CAM_REQ_MGR_SOF 0
#define V4L_EVENT_CAM_REQ_MGR_ERROR 1
#define V4L_EVENT_CAM_REQ_MGR_SOF_BOOT_TS 2
/* SOF Event status */
#define CAM_REQ_MGR_SOF_EVENT_SUCCESS 0
#define CAM_REQ_MGR_SOF_EVENT_ERROR 1
/* Link control operations */
#define CAM_REQ_MGR_LINK_ACTIVATE 0
#define CAM_REQ_MGR_LINK_DEACTIVATE 1
/**
* Request Manager : flush_type
* @CAM_REQ_MGR_FLUSH_TYPE_ALL: Req mgr will remove all the pending
* requests from input/processing queue.
* @CAM_REQ_MGR_FLUSH_TYPE_CANCEL_REQ: Req mgr will remove only particular
* request id from input/processing queue.
* @CAM_REQ_MGR_FLUSH_TYPE_MAX: Max number of the flush type
* @opcode: CAM_REQ_MGR_FLUSH_REQ
*/
#define CAM_REQ_MGR_FLUSH_TYPE_ALL 0
#define CAM_REQ_MGR_FLUSH_TYPE_CANCEL_REQ 1
#define CAM_REQ_MGR_FLUSH_TYPE_MAX 2
/**
* Request Manager : Sync Mode type
* @CAM_REQ_MGR_SYNC_MODE_NO_SYNC: Req mgr will apply non-sync mode for this
* request.
* @CAM_REQ_MGR_SYNC_MODE_SYNC: Req mgr will apply sync mode for this request.
*/
#define CAM_REQ_MGR_SYNC_MODE_NO_SYNC 0
#define CAM_REQ_MGR_SYNC_MODE_SYNC 1
/**
* struct cam_req_mgr_event_data
* @session_hdl: session handle
* @link_hdl: link handle
* @frame_id: frame id
* @reserved: reserved for 64 bit aligngment
* @req_id: request id
* @tv_sec: timestamp in seconds
* @tv_usec: timestamp in micro seconds
*/
struct cam_req_mgr_event_data {
int32_t session_hdl;
int32_t link_hdl;
int32_t frame_id;
int32_t reserved;
int64_t req_id;
uint64_t tv_sec;
uint64_t tv_usec;
};
/**
* struct cam_req_mgr_session_info
* @session_hdl: In/Output param - session_handle
* @opcode1: CAM_REQ_MGR_CREATE_SESSION
* @opcode2: CAM_REQ_MGR_DESTROY_SESSION
*/
struct cam_req_mgr_session_info {
int32_t session_hdl;
int32_t reserved;
};
/**
* struct cam_req_mgr_link_info
* @session_hdl: Input param - Identifier for CSL session
* @num_devices: Input Param - Num of devices to be linked
* @dev_hdls: Input param - List of device handles to be linked
* @link_hdl: Output Param -Identifier for link
* @opcode: CAM_REQ_MGR_LINK
*/
struct cam_req_mgr_link_info {
int32_t session_hdl;
uint32_t num_devices;
int32_t dev_hdls[CAM_REQ_MGR_MAX_HANDLES];
int32_t link_hdl;
};
/**
* struct cam_req_mgr_unlink_info
* @session_hdl: input param - session handle
* @link_hdl: input param - link handle
* @opcode: CAM_REQ_MGR_UNLINK
*/
struct cam_req_mgr_unlink_info {
int32_t session_hdl;
int32_t link_hdl;
};
/**
* struct cam_req_mgr_flush_info
* @brief: User can tell drivers to flush a particular request id or
* flush all requests from its pending processing queue. Flush is a
* blocking call and driver shall ensure all requests are flushed
* before returning.
* @session_hdl: Input param - Identifier for CSL session
* @link_hdl: Input Param -Identifier for link
* @flush_type: User can cancel a particular req id or can flush
* all requests in queue
* @reserved: reserved for 64 bit aligngment
* @req_id: field is valid only if flush type is cancel request
* for flush all this field value is not considered.
* @opcode: CAM_REQ_MGR_FLUSH_REQ
*/
struct cam_req_mgr_flush_info {
int32_t session_hdl;
int32_t link_hdl;
uint32_t flush_type;
uint32_t reserved;
int64_t req_id;
};
/** struct cam_req_mgr_sched_info
* @session_hdl: Input param - Identifier for CSL session
* @link_hdl: Input Param -Identifier for link
* inluding itself.
* @bubble_enable: Input Param - Cam req mgr will do bubble recovery if this
* flag is set.
* @sync_mode: Type of Sync mode for this request
* @req_id: Input Param - Request Id from which all requests will be flushed
*/
struct cam_req_mgr_sched_request {
int32_t session_hdl;
int32_t link_hdl;
int32_t bubble_enable;
int32_t sync_mode;
int64_t req_id;
};
/**
* struct cam_req_mgr_sync_mode
* @session_hdl: Input param - Identifier for CSL session
* @sync_mode: Input Param - Type of sync mode
* @num_links: Input Param - Num of links in sync mode (Valid only
* when sync_mode is one of SYNC enabled modes)
* @link_hdls: Input Param - Array of link handles to be in sync mode
* (Valid only when sync_mode is one of SYNC
* enabled modes)
* @master_link_hdl: Input Param - To dictate which link's SOF drives system
* (Valid only when sync_mode is one of SYNC
* enabled modes)
*
* @opcode: CAM_REQ_MGR_SYNC_MODE
*/
struct cam_req_mgr_sync_mode {
int32_t session_hdl;
int32_t sync_mode;
int32_t num_links;
int32_t link_hdls[MAX_LINKS_PER_SESSION];
int32_t master_link_hdl;
int32_t reserved;
};
/**
* struct cam_req_mgr_link_control
* @ops: Link operations: activate/deactive
* @session_hdl: Input param - Identifier for CSL session
* @num_links: Input Param - Num of links
* @reserved: reserved field
* @link_hdls: Input Param - Links to be activated/deactivated
*
* @opcode: CAM_REQ_MGR_LINK_CONTROL
*/
struct cam_req_mgr_link_control {
int32_t ops;
int32_t session_hdl;
int32_t num_links;
int32_t reserved;
int32_t link_hdls[MAX_LINKS_PER_SESSION];
};
/**
* cam_req_mgr specific opcode ids
*/
#define CAM_REQ_MGR_CREATE_DEV_NODES (CAM_COMMON_OPCODE_MAX + 1)
#define CAM_REQ_MGR_CREATE_SESSION (CAM_COMMON_OPCODE_MAX + 2)
#define CAM_REQ_MGR_DESTROY_SESSION (CAM_COMMON_OPCODE_MAX + 3)
#define CAM_REQ_MGR_LINK (CAM_COMMON_OPCODE_MAX + 4)
#define CAM_REQ_MGR_UNLINK (CAM_COMMON_OPCODE_MAX + 5)
#define CAM_REQ_MGR_SCHED_REQ (CAM_COMMON_OPCODE_MAX + 6)
#define CAM_REQ_MGR_FLUSH_REQ (CAM_COMMON_OPCODE_MAX + 7)
#define CAM_REQ_MGR_SYNC_MODE (CAM_COMMON_OPCODE_MAX + 8)
#define CAM_REQ_MGR_ALLOC_BUF (CAM_COMMON_OPCODE_MAX + 9)
#define CAM_REQ_MGR_MAP_BUF (CAM_COMMON_OPCODE_MAX + 10)
#define CAM_REQ_MGR_RELEASE_BUF (CAM_COMMON_OPCODE_MAX + 11)
#define CAM_REQ_MGR_CACHE_OPS (CAM_COMMON_OPCODE_MAX + 12)
#define CAM_REQ_MGR_LINK_CONTROL (CAM_COMMON_OPCODE_MAX + 13)
/* end of cam_req_mgr opcodes */
#define CAM_MEM_FLAG_HW_READ_WRITE (1<<0)
#define CAM_MEM_FLAG_HW_READ_ONLY (1<<1)
#define CAM_MEM_FLAG_HW_WRITE_ONLY (1<<2)
#define CAM_MEM_FLAG_KMD_ACCESS (1<<3)
#define CAM_MEM_FLAG_UMD_ACCESS (1<<4)
#define CAM_MEM_FLAG_PROTECTED_MODE (1<<5)
#define CAM_MEM_FLAG_CMD_BUF_TYPE (1<<6)
#define CAM_MEM_FLAG_PIXEL_BUF_TYPE (1<<7)
#define CAM_MEM_FLAG_STATS_BUF_TYPE (1<<8)
#define CAM_MEM_FLAG_PACKET_BUF_TYPE (1<<9)
#define CAM_MEM_FLAG_CACHE (1<<10)
#define CAM_MEM_FLAG_HW_SHARED_ACCESS (1<<11)
#define CAM_MEM_FLAG_CDSP_OUTPUT (1<<12)
#define CAM_MEM_MMU_MAX_HANDLE 16
/* Maximum allowed buffers in existence */
#define CAM_MEM_BUFQ_MAX 1024
#define CAM_MEM_MGR_SECURE_BIT_POS 15
#define CAM_MEM_MGR_HDL_IDX_SIZE 15
#define CAM_MEM_MGR_HDL_FD_SIZE 16
#define CAM_MEM_MGR_HDL_IDX_END_POS 16
#define CAM_MEM_MGR_HDL_FD_END_POS 32
#define CAM_MEM_MGR_HDL_IDX_MASK ((1 << CAM_MEM_MGR_HDL_IDX_SIZE) - 1)
#define GET_MEM_HANDLE(idx, fd) \
((idx & CAM_MEM_MGR_HDL_IDX_MASK) | \
(fd << (CAM_MEM_MGR_HDL_FD_END_POS - CAM_MEM_MGR_HDL_FD_SIZE))) \
#define GET_FD_FROM_HANDLE(hdl) \
(hdl >> (CAM_MEM_MGR_HDL_FD_END_POS - CAM_MEM_MGR_HDL_FD_SIZE)) \
#define CAM_MEM_MGR_GET_HDL_IDX(hdl) (hdl & CAM_MEM_MGR_HDL_IDX_MASK)
#define CAM_MEM_MGR_SET_SECURE_HDL(hdl, flag) \
((flag) ? (hdl |= (1 << CAM_MEM_MGR_SECURE_BIT_POS)) : \
((hdl) &= ~(1 << CAM_MEM_MGR_SECURE_BIT_POS)))
#define CAM_MEM_MGR_IS_SECURE_HDL(hdl) \
(((hdl) & \
(1<<CAM_MEM_MGR_SECURE_BIT_POS)) >> CAM_MEM_MGR_SECURE_BIT_POS)
/**
* memory allocation type
*/
#define CAM_MEM_DMA_NONE 0
#define CAM_MEM_DMA_BIDIRECTIONAL 1
#define CAM_MEM_DMA_TO_DEVICE 2
#define CAM_MEM_DMA_FROM_DEVICE 3
/**
* memory cache operation
*/
#define CAM_MEM_CLEAN_CACHE 1
#define CAM_MEM_INV_CACHE 2
#define CAM_MEM_CLEAN_INV_CACHE 3
/**
* struct cam_mem_alloc_out_params
* @buf_handle: buffer handle
* @fd: output buffer file descriptor
* @vaddr: virtual address pointer
*/
struct cam_mem_alloc_out_params {
uint32_t buf_handle;
int32_t fd;
uint64_t vaddr;
};
/**
* struct cam_mem_map_out_params
* @buf_handle: buffer handle
* @reserved: reserved for future
* @vaddr: virtual address pointer
*/
struct cam_mem_map_out_params {
uint32_t buf_handle;
uint32_t reserved;
uint64_t vaddr;
};
/**
* struct cam_mem_mgr_alloc_cmd
* @len: size of buffer to allocate
* @align: alignment of the buffer
* @mmu_hdls: array of mmu handles
* @num_hdl: number of handles
* @flags: flags of the buffer
* @out: out params
*/
/* CAM_REQ_MGR_ALLOC_BUF */
struct cam_mem_mgr_alloc_cmd {
uint64_t len;
uint64_t align;
int32_t mmu_hdls[CAM_MEM_MMU_MAX_HANDLE];
uint32_t num_hdl;
uint32_t flags;
struct cam_mem_alloc_out_params out;
};
/**
* struct cam_mem_mgr_map_cmd
* @mmu_hdls: array of mmu handles
* @num_hdl: number of handles
* @flags: flags of the buffer
* @fd: output buffer file descriptor
* @reserved: reserved field
* @out: out params
*/
/* CAM_REQ_MGR_MAP_BUF */
struct cam_mem_mgr_map_cmd {
int32_t mmu_hdls[CAM_MEM_MMU_MAX_HANDLE];
uint32_t num_hdl;
uint32_t flags;
int32_t fd;
uint32_t reserved;
struct cam_mem_map_out_params out;
};
/**
* struct cam_mem_mgr_map_cmd
* @buf_handle: buffer handle
* @reserved: reserved field
*/
/* CAM_REQ_MGR_RELEASE_BUF */
struct cam_mem_mgr_release_cmd {
int32_t buf_handle;
uint32_t reserved;
};
/**
* struct cam_mem_mgr_map_cmd
* @buf_handle: buffer handle
* @ops: cache operations
*/
/* CAM_REQ_MGR_CACHE_OPS */
struct cam_mem_cache_ops_cmd {
int32_t buf_handle;
uint32_t mem_cache_ops;
};
/**
* Request Manager : error message type
* @CAM_REQ_MGR_ERROR_TYPE_DEVICE: Device error message, fatal to session
* @CAM_REQ_MGR_ERROR_TYPE_REQUEST: Error on a single request, not fatal
* @CAM_REQ_MGR_ERROR_TYPE_BUFFER: Buffer was not filled, not fatal
* @CAM_REQ_MGR_ERROR_TYPE_RECOVERY: Fatal error, can be recovered
*/
#define CAM_REQ_MGR_ERROR_TYPE_DEVICE 0
#define CAM_REQ_MGR_ERROR_TYPE_REQUEST 1
#define CAM_REQ_MGR_ERROR_TYPE_BUFFER 2
#define CAM_REQ_MGR_ERROR_TYPE_RECOVERY 3
/**
* struct cam_req_mgr_error_msg
* @error_type: type of error
* @request_id: request id of frame
* @device_hdl: device handle
* @linke_hdl: link_hdl
* @resource_size: size of the resource
*/
struct cam_req_mgr_error_msg {
uint32_t error_type;
uint32_t request_id;
int32_t device_hdl;
int32_t link_hdl;
uint64_t resource_size;
};
/**
* struct cam_req_mgr_frame_msg
* @request_id: request id of the frame
* @frame_id: frame id of the frame
* @timestamp: timestamp of the frame
* @link_hdl: link handle associated with this message
* @sof_status: sof status success or fail
*/
struct cam_req_mgr_frame_msg {
uint64_t request_id;
uint64_t frame_id;
uint64_t timestamp;
int32_t link_hdl;
uint32_t sof_status;
};
/**
* struct cam_req_mgr_message
* @session_hdl: session to which the frame belongs to
* @reserved: reserved field
* @u: union which can either be error or frame message
*/
struct cam_req_mgr_message {
int32_t session_hdl;
int32_t reserved;
union {
struct cam_req_mgr_error_msg err_msg;
struct cam_req_mgr_frame_msg frame_msg;
} u;
};
#endif /* __UAPI_LINUX_CAM_REQ_MGR_H */

View File

@@ -0,0 +1,485 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_SENSOR_H__
#define __UAPI_CAM_SENSOR_H__
#include <linux/types.h>
#include <linux/ioctl.h>
#include "cam_defs.h"
#define CAM_SENSOR_PROBE_CMD (CAM_COMMON_OPCODE_MAX + 1)
#define CAM_FLASH_MAX_LED_TRIGGERS 3
#define MAX_OIS_NAME_SIZE 32
#define CAM_CSIPHY_SECURE_MODE_ENABLED 1
/**
* struct cam_sensor_query_cap - capabilities info for sensor
*
* @slot_info : Indicates about the slotId or cell Index
* @secure_camera : Camera is in secure/Non-secure mode
* @pos_pitch : Sensor position pitch
* @pos_roll : Sensor position roll
* @pos_yaw : Sensor position yaw
* @actuator_slot_id : Actuator slot id which connected to sensor
* @eeprom_slot_id : EEPROM slot id which connected to sensor
* @ois_slot_id : OIS slot id which connected to sensor
* @flash_slot_id : Flash slot id which connected to sensor
* @csiphy_slot_id : CSIphy slot id which connected to sensor
*
*/
struct cam_sensor_query_cap {
uint32_t slot_info;
uint32_t secure_camera;
uint32_t pos_pitch;
uint32_t pos_roll;
uint32_t pos_yaw;
uint32_t actuator_slot_id;
uint32_t eeprom_slot_id;
uint32_t ois_slot_id;
uint32_t flash_slot_id;
uint32_t csiphy_slot_id;
} __attribute__((packed));
/**
* struct cam_csiphy_query_cap - capabilities info for csiphy
*
* @slot_info : Indicates about the slotId or cell Index
* @version : CSIphy version
* @clk lane : Of the 5 lanes, informs lane configured
* as clock lane
* @reserved
*/
struct cam_csiphy_query_cap {
uint32_t slot_info;
uint32_t version;
uint32_t clk_lane;
uint32_t reserved;
} __attribute__((packed));
/**
* struct cam_actuator_query_cap - capabilities info for actuator
*
* @slot_info : Indicates about the slotId or cell Index
* @reserved
*/
struct cam_actuator_query_cap {
uint32_t slot_info;
uint32_t reserved;
} __attribute__((packed));
/**
* struct cam_eeprom_query_cap_t - capabilities info for eeprom
*
* @slot_info : Indicates about the slotId or cell Index
* @eeprom_kernel_probe : Indicates about the kernel or userspace probe
*/
struct cam_eeprom_query_cap_t {
uint32_t slot_info;
uint16_t eeprom_kernel_probe;
uint16_t is_multimodule_mode;
} __attribute__((packed));
/**
* struct cam_ois_query_cap_t - capabilities info for ois
*
* @slot_info : Indicates about the slotId or cell Index
*/
struct cam_ois_query_cap_t {
uint32_t slot_info;
uint16_t reserved;
} __attribute__((packed));
/**
* struct cam_cmd_i2c_info - Contains slave I2C related info
*
* @slave_addr : Slave address
* @i2c_freq_mode : 4 bits are used for I2c freq mode
* @cmd_type : Explains type of command
*/
struct cam_cmd_i2c_info {
uint32_t slave_addr;
uint8_t i2c_freq_mode;
uint8_t cmd_type;
uint16_t reserved;
} __attribute__((packed));
/**
* struct cam_ois_opcode - Contains OIS opcode
*
* @prog : OIS FW prog register address
* @coeff : OIS FW coeff register address
* @pheripheral : OIS pheripheral
* @memory : OIS memory
*/
struct cam_ois_opcode {
uint32_t prog;
uint32_t coeff;
uint32_t pheripheral;
uint32_t memory;
} __attribute__((packed));
/**
* struct cam_cmd_ois_info - Contains OIS slave info
*
* @slave_addr : OIS i2c slave address
* @i2c_freq_mode : i2c frequency mode
* @cmd_type : Explains type of command
* @ois_fw_flag : indicates if fw is present or not
* @is_ois_calib : indicates the calibration data is available
* @ois_name : OIS name
* @opcode : opcode
*/
struct cam_cmd_ois_info {
uint16_t slave_addr;
uint8_t i2c_freq_mode;
uint8_t cmd_type;
uint8_t ois_fw_flag;
uint8_t is_ois_calib;
char ois_name[MAX_OIS_NAME_SIZE];
struct cam_ois_opcode opcode;
} __attribute__((packed));
/**
* struct cam_cmd_probe - Contains sensor slave info
*
* @data_type : Slave register data type
* @addr_type : Slave register address type
* @op_code : Don't Care
* @cmd_type : Explains type of command
* @reg_addr : Slave register address
* @expected_data : Data expected at slave register address
* @data_mask : Data mask if only few bits are valid
* @camera_id : Indicates the slot to which camera
* needs to be probed
* @reserved
*/
struct cam_cmd_probe {
uint8_t data_type;
uint8_t addr_type;
uint8_t op_code;
uint8_t cmd_type;
uint32_t reg_addr;
uint32_t expected_data;
uint32_t data_mask;
uint16_t camera_id;
uint16_t reserved;
} __attribute__((packed));
/**
* struct cam_power_settings - Contains sensor power setting info
*
* @power_seq_type : Type of power sequence
* @reserved
* @config_val_low : Lower 32 bit value configuration value
* @config_val_high : Higher 32 bit value configuration value
*
*/
struct cam_power_settings {
uint16_t power_seq_type;
uint16_t reserved;
uint32_t config_val_low;
uint32_t config_val_high;
} __attribute__((packed));
/**
* struct cam_cmd_power - Explains about the power settings
*
* @count : Number of power settings follows
* @reserved
* @cmd_type : Explains type of command
* @power_settings : Contains power setting info
*/
struct cam_cmd_power {
uint32_t count;
uint8_t reserved;
uint8_t cmd_type;
uint16_t more_reserved;
struct cam_power_settings power_settings[1];
} __attribute__((packed));
/**
* struct i2c_rdwr_header - header of READ/WRITE I2C command
*
* @ count : Number of registers / data / reg-data pairs
* @ op_code : Operation code
* @ cmd_type : Command buffer type
* @ data_type : I2C data type
* @ addr_type : I2C address type
* @ reserved
*/
struct i2c_rdwr_header {
uint32_t count;
uint8_t op_code;
uint8_t cmd_type;
uint8_t data_type;
uint8_t addr_type;
} __attribute__((packed));
/**
* struct i2c_random_wr_payload - payload for I2C random write
*
* @ reg_addr : Register address
* @ reg_data : Register data
*
*/
struct i2c_random_wr_payload {
uint32_t reg_addr;
uint32_t reg_data;
} __attribute__((packed));
/**
* struct cam_cmd_i2c_random_wr - I2C random write command
* @ header : header of READ/WRITE I2C command
* @ random_wr_payload : payload for I2C random write
*/
struct cam_cmd_i2c_random_wr {
struct i2c_rdwr_header header;
struct i2c_random_wr_payload random_wr_payload[1];
} __attribute__((packed));
/**
* struct cam_cmd_read - I2C read command
* @ reg_data : Register data
* @ reserved
*/
struct cam_cmd_read {
uint32_t reg_data;
uint32_t reserved;
} __attribute__((packed));
/**
* struct cam_cmd_i2c_continuous_wr - I2C continuous write command
* @ header : header of READ/WRITE I2C command
* @ reg_addr : Register address
* @ data_read : I2C read command
*/
struct cam_cmd_i2c_continuous_wr {
struct i2c_rdwr_header header;
uint32_t reg_addr;
struct cam_cmd_read data_read[1];
} __attribute__((packed));
/**
* struct cam_cmd_i2c_random_rd - I2C random read command
* @ header : header of READ/WRITE I2C command
* @ data_read : I2C read command
*/
struct cam_cmd_i2c_random_rd {
struct i2c_rdwr_header header;
struct cam_cmd_read data_read[1];
} __attribute__((packed));
/**
* struct cam_cmd_i2c_continuous_rd - I2C continuous continuous read command
* @ header : header of READ/WRITE I2C command
* @ reg_addr : Register address
*
*/
struct cam_cmd_i2c_continuous_rd {
struct i2c_rdwr_header header;
uint32_t reg_addr;
} __attribute__((packed));
/**
* struct cam_cmd_conditional_wait - Conditional wait command
* @data_type : Data type
* @addr_type : Address type
* @op_code : Opcode
* @cmd_type : Explains type of command
* @timeout : Timeout for retries
* @reserved
* @reg_addr : Register Address
* @reg_data : Register data
* @data_mask : Data mask if only few bits are valid
* @camera_id : Indicates the slot to which camera
* needs to be probed
*
*/
struct cam_cmd_conditional_wait {
uint8_t data_type;
uint8_t addr_type;
uint16_t reserved;
uint8_t op_code;
uint8_t cmd_type;
uint16_t timeout;
uint32_t reg_addr;
uint32_t reg_data;
uint32_t data_mask;
} __attribute__((packed));
/**
* struct cam_cmd_unconditional_wait - Un-conditional wait command
* @delay : Delay
* @op_code : Opcode
* @cmd_type : Explains type of command
*/
struct cam_cmd_unconditional_wait {
int16_t delay;
int16_t reserved;
uint8_t op_code;
uint8_t cmd_type;
uint16_t reserved1;
} __attribute__((packed));
/**
* cam_csiphy_info: Provides cmdbuffer structre
* @lane_mask : Lane mask details
* @lane_assign : Lane sensor will be using
* @csiphy_3phase : Total number of lanes
* @combo_mode : Info regarding combo_mode is enable / disable
* @lane_cnt : Total number of lanes
* @secure_mode : Secure mode flag to enable / disable
* @3phase : Details whether 3Phase / 2Phase operation
* @settle_time : Settling time in ms
* @data_rate : Data rate
*
*/
struct cam_csiphy_info {
uint16_t lane_mask;
uint16_t lane_assign;
uint8_t csiphy_3phase;
uint8_t combo_mode;
uint8_t lane_cnt;
uint8_t secure_mode;
uint64_t settle_time;
uint64_t data_rate;
} __attribute__((packed));
/**
* cam_csiphy_acquire_dev_info : Information needed for
* csiphy at the time of acquire
* @combo_mode : Indicates the device mode of operation
* @reserved
*
*/
struct cam_csiphy_acquire_dev_info {
uint32_t combo_mode;
uint32_t reserved;
} __attribute__((packed));
/**
* cam_sensor_acquire_dev : Updates sensor acuire cmd
* @device_handle : Updates device handle
* @session_handle : Session handle for acquiring device
* @handle_type : Resource handle type
* @reserved
* @info_handle : Handle to additional info
* needed for sensor sub modules
*
*/
struct cam_sensor_acquire_dev {
uint32_t session_handle;
uint32_t device_handle;
uint32_t handle_type;
uint32_t reserved;
uint64_t info_handle;
} __attribute__((packed));
/**
* cam_sensor_streamon_dev : StreamOn command for the sensor
* @session_handle : Session handle for acquiring device
* @device_handle : Updates device handle
* @handle_type : Resource handle type
* @reserved
* @info_handle : Information Needed at the time of streamOn
*
*/
struct cam_sensor_streamon_dev {
uint32_t session_handle;
uint32_t device_handle;
uint32_t handle_type;
uint32_t reserved;
uint64_t info_handle;
} __attribute__((packed));
/**
* struct cam_flash_init : Init command for the flash
* @flash_type : flash hw type
* @reserved
* @cmd_type : command buffer type
*/
struct cam_flash_init {
uint8_t flash_type;
uint16_t reserved;
uint8_t cmd_type;
} __attribute__((packed));
/**
* struct cam_flash_set_rer : RedEyeReduction command buffer
*
* @count : Number of flash leds
* @opcode : Command buffer opcode
* CAM_FLASH_FIRE_RER
* @cmd_type : command buffer operation type
* @num_iteration : Number of led turn on/off sequence
* @reserved
* @led_on_delay_ms : flash led turn on time in ms
* @led_off_delay_ms : flash led turn off time in ms
* @led_current_ma : flash led current in ma
*
*/
struct cam_flash_set_rer {
uint32_t count;
uint8_t opcode;
uint8_t cmd_type;
uint16_t num_iteration;
uint32_t led_on_delay_ms;
uint32_t led_off_delay_ms;
uint32_t led_current_ma[CAM_FLASH_MAX_LED_TRIGGERS];
} __attribute__((packed));
/**
* struct cam_flash_set_on_off : led turn on/off command buffer
*
* @count : Number of Flash leds
* @opcode : command buffer opcodes
* CAM_FLASH_FIRE_LOW
* CAM_FLASH_FIRE_HIGH
* CAM_FLASH_OFF
* @cmd_type : command buffer operation type
* @led_current_ma : flash led current in ma
*
*/
struct cam_flash_set_on_off {
uint32_t count;
uint8_t opcode;
uint8_t cmd_type;
uint16_t reserved;
uint32_t led_current_ma[CAM_FLASH_MAX_LED_TRIGGERS];
} __attribute__((packed));
/**
* struct cam_flash_query_curr : query current command buffer
*
* @reserved
* @opcode : command buffer opcode
* @cmd_type : command buffer operation type
* @query_current_ma : battery current in ma
*
*/
struct cam_flash_query_curr {
uint16_t reserved;
uint8_t opcode;
uint8_t cmd_type;
uint32_t query_current_ma;
} __attribute__ ((packed));
/**
* struct cam_flash_query_cap : capabilities info for flash
*
* @slot_info : Indicates about the slotId or cell Index
* @max_current_flash : max supported current for flash
* @max_duration_flash : max flash turn on duration
* @max_current_torch : max supported current for torch
*
*/
struct cam_flash_query_cap_info {
uint32_t slot_info;
uint32_t max_current_flash[CAM_FLASH_MAX_LED_TRIGGERS];
uint32_t max_duration_flash[CAM_FLASH_MAX_LED_TRIGGERS];
uint32_t max_current_torch[CAM_FLASH_MAX_LED_TRIGGERS];
} __attribute__ ((packed));
#endif

View File

@@ -0,0 +1,139 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*/
#ifndef __UAPI_CAM_SYNC_H__
#define __UAPI_CAM_SYNC_H__
#include <linux/videodev2.h>
#include <linux/types.h>
#include <linux/ioctl.h>
#include <linux/media.h>
#define CAM_SYNC_DEVICE_NAME "cam_sync_device"
/* V4L event which user space will subscribe to */
#define CAM_SYNC_V4L_EVENT (V4L2_EVENT_PRIVATE_START + 0)
/* Specific event ids to get notified in user space */
#define CAM_SYNC_V4L_EVENT_ID_CB_TRIG 0
/* Size of opaque payload sent to kernel for safekeeping until signal time */
#define CAM_SYNC_USER_PAYLOAD_SIZE 2
/* Device type for sync device needed for device discovery */
#define CAM_SYNC_DEVICE_TYPE (MEDIA_ENT_F_OLD_BASE)
#define CAM_SYNC_GET_PAYLOAD_PTR(ev, type) \
(type *)((char *)ev.u.data + sizeof(struct cam_sync_ev_header))
#define CAM_SYNC_GET_HEADER_PTR(ev) \
((struct cam_sync_ev_header *)ev.u.data)
#define CAM_SYNC_STATE_INVALID 0
#define CAM_SYNC_STATE_ACTIVE 1
#define CAM_SYNC_STATE_SIGNALED_SUCCESS 2
#define CAM_SYNC_STATE_SIGNALED_ERROR 3
/**
* struct cam_sync_ev_header - Event header for sync event notification
*
* @sync_obj: Sync object
* @status: Status of the object
*/
struct cam_sync_ev_header {
int32_t sync_obj;
int32_t status;
};
/**
* struct cam_sync_info - Sync object creation information
*
* @name: Optional string representation of the sync object
* @sync_obj: Sync object returned after creation in kernel
*/
struct cam_sync_info {
char name[64];
int32_t sync_obj;
};
/**
* struct cam_sync_signal - Sync object signaling struct
*
* @sync_obj: Sync object to be signaled
* @sync_state: State of the sync object to which it should be signaled
*/
struct cam_sync_signal {
int32_t sync_obj;
uint32_t sync_state;
};
/**
* struct cam_sync_merge - Merge information for sync objects
*
* @sync_objs: Pointer to sync objects
* @num_objs: Number of objects in the array
* @merged: Merged sync object
*/
struct cam_sync_merge {
__u64 sync_objs;
uint32_t num_objs;
int32_t merged;
};
/**
* struct cam_sync_userpayload_info - Payload info from user space
*
* @sync_obj: Sync object for which payload has to be registered for
* @reserved: Reserved
* @payload: Pointer to user payload
*/
struct cam_sync_userpayload_info {
int32_t sync_obj;
uint32_t reserved;
__u64 payload[CAM_SYNC_USER_PAYLOAD_SIZE];
};
/**
* struct cam_sync_wait - Sync object wait information
*
* @sync_obj: Sync object to wait on
* @reserved: Reserved
* @timeout_ms: Timeout in milliseconds
*/
struct cam_sync_wait {
int32_t sync_obj;
uint32_t reserved;
uint64_t timeout_ms;
};
/**
* struct cam_private_ioctl_arg - Sync driver ioctl argument
*
* @id: IOCTL command id
* @size: Size of command payload
* @result: Result of command execution
* @reserved: Reserved
* @ioctl_ptr: Pointer to user data
*/
struct cam_private_ioctl_arg {
__u32 id;
__u32 size;
__u32 result;
__u32 reserved;
__u64 ioctl_ptr;
};
#define CAM_PRIVATE_IOCTL_CMD \
_IOWR('V', BASE_VIDIOC_PRIVATE, struct cam_private_ioctl_arg)
#define CAM_SYNC_CREATE 0
#define CAM_SYNC_DESTROY 1
#define CAM_SYNC_SIGNAL 2
#define CAM_SYNC_MERGE 3
#define CAM_SYNC_REGISTER_PAYLOAD 4
#define CAM_SYNC_DEREGISTER_PAYLOAD 5
#define CAM_SYNC_WAIT 6
#endif /* __UAPI_CAM_SYNC_H__ */