Browse Source

msm: camera: Add uapi definitions for camera reg dump

For debugging, there are a set of register values that user
space needs. Based on the offset and range given, values can
be dumped into an out buffer to be further processed. Add
uapi support for this reg dump.

Change-Id: I6e6f89625a505158a6bf8932ebb9d0ae78bf0129
Signed-off-by: Mukund Madhusudan Atre <[email protected]>
Mukund Madhusudan Atre 6 years ago
parent
commit
632d56473b
2 changed files with 130 additions and 13 deletions
  1. 114 0
      include/uapi/media/cam_defs.h
  2. 16 13
      include/uapi/media/cam_isp.h

+ 114 - 0
include/uapi/media/cam_defs.h

@@ -219,6 +219,18 @@ struct cam_iommu_handle {
 #define CAM_PACKET_DEV_LRME                     17
 #define CAM_PACKET_DEV_LRME                     17
 #define CAM_PACKET_DEV_MAX                      18
 #define CAM_PACKET_DEV_MAX                      18
 
 
+/* Register base type */
+#define CAM_REG_DUMP_BASE_TYPE_ISP_LEFT         1
+#define CAM_REG_DUMP_BASE_TYPE_ISP_RIGHT        2
+#define CAM_REG_DUMP_BASE_TYPE_CAMNOC           3
+
+/* Register dump read type */
+#define CAM_REG_DUMP_READ_TYPE_CONT_RANGE       1
+#define CAM_REG_DUMP_READ_TYPE_DMI              2
+
+/* Max number of config writes to read from DMI */
+#define CAM_REG_DUMP_DMI_CONFIG_MAX             5
+
 
 
 /* constants */
 /* constants */
 #define CAM_PACKET_MAX_PLANES                   3
 #define CAM_PACKET_MAX_PLANES                   3
@@ -742,5 +754,107 @@ struct cam_cmd_mem_regions {
 	struct cam_cmd_mem_region_info map_info_array[1];
 	struct cam_cmd_mem_region_info map_info_array[1];
 };
 };
 
 
+/**
+ * struct cam_reg_write_desc - Register write descriptor
+ *
+ * @offset               : Register offset at which 'value' needs to written
+ * @value                : Register value to write
+ */
+struct cam_reg_write_desc {
+	uint32_t   offset;
+	uint32_t   value;
+};
+
+/**
+ * struct cam_reg_range_read_desc - Descriptor to provide read info
+ *
+ * @offset               : Register offset address to start with
+ * @num_values           : Number of values to read
+ */
+struct cam_reg_range_read_desc {
+	uint32_t   offset;
+	uint32_t   num_values;
+};
+
+/**
+ * struct cam_dmi_read_desc - Descriptor to provide DMI read info
+ *
+ * @num_pre_writes       : Number of registers to write before reading DMI data
+ * @num_post_writes      : Number of registers to write after reading DMI data
+ * @pre_read_config      : Registers to write before reading DMI data
+ * @dmi_data_read        : DMI Register, number of values to read to dump
+ *                         DMI data
+ * @post_read_config     : Registers to write after reading DMI data
+ */
+struct cam_dmi_read_desc {
+	uint32_t                         num_pre_writes;
+	uint32_t                         num_post_writes;
+	struct cam_reg_write_desc        pre_read_config[
+						CAM_REG_DUMP_DMI_CONFIG_MAX];
+	struct cam_reg_range_read_desc   dmi_data_read;
+	struct cam_reg_write_desc        post_read_config[
+						CAM_REG_DUMP_DMI_CONFIG_MAX];
+};
+
+/**
+ * struct cam_reg_read_info - Register read info for both reg continuous read
+ *                            or DMI read
+ *
+ * @type                 : Whether Register range read or DMI read
+ * @reg_read             : Range of registers to read
+ * @dmi_read             : DMI data to read
+ */
+struct cam_reg_read_info {
+	uint32_t                                type;
+	uint32_t                                reserved;
+	union {
+		struct cam_reg_range_read_desc  reg_read;
+		struct cam_dmi_read_desc        dmi_read;
+	};
+};
+
+/**
+ * struct cam_reg_dump_out_buffer -Buffer info for dump data to be provided
+ *
+ * @req_id               : Request ID corresponding to reg dump data
+ * @bytes_written        : Number of bytes written
+ * @dump_data            : Register dump data
+ */
+struct cam_reg_dump_out_buffer {
+	uint64_t   req_id;
+	uint32_t   bytes_written;
+	uint32_t   dump_data[1];
+};
+
+/**
+ * struct cam_reg_dump_desc - Descriptor to provide dump info
+ *
+ * @reg_base_type        : Register base type, e.g. ISP_LEFT, ISP_RIGHT, CAMNOC
+ * @dump_buffer_offset   : Offset from base of mem_handle at which Register dump
+ *                         will be written for this set
+ * @dump_buffer_size     : Available size in bytes for writing dump values
+ * @num_read_range       : Number register range reads (Continuous + DMI)
+ * @read_range           : Read range info
+ */
+struct cam_reg_dump_desc {
+	uint32_t                   reg_base_type;
+	uint32_t                   dump_buffer_offset;
+	uint32_t                   dump_buffer_size;
+	uint32_t                   num_read_range;
+	struct cam_reg_read_info   read_range[1];
+};
+
+/**
+ * struct cam_reg_dump_input_info - Info about required dump sets
+ *
+ * @num_dump_sets        : Number of different dump sets (base types) given
+ * @dump_set_offsets     : Points to the given dump description structures
+ *                         (cam_reg_dump_desc)
+ */
+struct cam_reg_dump_input_info {
+	uint32_t                   num_dump_sets;
+	uint32_t                   dump_set_offsets[1];
+};
+
 
 
 #endif /* __UAPI_CAM_DEFS_H__ */
 #endif /* __UAPI_CAM_DEFS_H__ */

+ 16 - 13
include/uapi/media/cam_isp.h

@@ -69,19 +69,22 @@
 #define CAM_ISP_PACKET_OP_MAX                   3
 #define CAM_ISP_PACKET_OP_MAX                   3
 
 
 /* ISP packet meta_data type for command buffer */
 /* 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
+#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
+#define CAM_ISP_PACKET_META_REG_DUMP_PER_REQUEST  13
+#define CAM_ISP_PACKET_META_REG_DUMP_ON_FLUSH     14
+#define CAM_ISP_PACKET_META_REG_DUMP_ON_ERROR     15
 
 
 /* DSP mode */
 /* DSP mode */
 #define CAM_ISP_DSP_MODE_NONE                   0
 #define CAM_ISP_DSP_MODE_NONE                   0