Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49cbe4f3 authored by Harsh Shah's avatar Harsh Shah
Browse files

msm: camera: uapi: Add new acquire/release HW IOCTLs



Add support for Acquire/Release HW IOCTL. This will be used to
decouple the IFE HW acquire from device_handle acquire. This
change will enable dynamic release and re-acquire of IFE HW
while keeping the CRM link & IFE device_handle intact.

Change-Id: I541ce5eaa2b2f20187e9097d49c346c30033a535
Signed-off-by: default avatarHarsh Shah <harshs@codeaurora.org>
parent f9781dae
Loading
Loading
Loading
Loading
+71 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,10 @@
#define CAM_FLUSH_REQ                           (CAM_COMMON_OPCODE_BASE + 0x8)
#define CAM_FLUSH_REQ                           (CAM_COMMON_OPCODE_BASE + 0x8)
#define CAM_COMMON_OPCODE_MAX                   (CAM_COMMON_OPCODE_BASE + 0x9)
#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_EXT_OPCODE_BASE                     0x200
#define CAM_CONFIG_DEV_EXTERNAL                 (CAM_EXT_OPCODE_BASE + 0x1)
#define CAM_CONFIG_DEV_EXTERNAL                 (CAM_EXT_OPCODE_BASE + 0x1)


@@ -483,6 +487,73 @@ struct cam_acquire_dev_cmd {
	uint64_t        resource_hdl;
	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

/**
 * 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;
};

#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
 * struct cam_flush_dev_cmd - Control payload for flush devices
 *
 *
+38 −0
Original line number Original line Diff line number Diff line
@@ -376,4 +376,42 @@ struct cam_isp_bw_config {
	struct cam_isp_bw_vote         rdi_vote[1];
	struct cam_isp_bw_vote         rdi_vote[1];
} __attribute__((packed));
} __attribute__((packed));



/* Acquire Device/HW v2 */

/**
 * 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;
};

#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__ */
#endif /* __UAPI_CAM_ISP_H__ */