Browse Source

msm: camera: sensor: Configuring sensor pd to 1 for hfr usecase

Configuring sensor pd to 1 for hfr usecase, then the setting
of sensor can reflect on next batch.

CRs-Fixed: 3376953
Change-Id: I4a78e087aec0e46f78f40ae8c37f1086125558de
Signed-off-by: Depeng Shao <[email protected]>
Depeng Shao 2 years ago
parent
commit
305683fb02

+ 14 - 3
drivers/cam_sensor_module/cam_sensor/cam_sensor_core.c

@@ -185,6 +185,9 @@ static int cam_sensor_handle_res_info(struct cam_sensor_res_info *res_info,
 		if (res_info->valid_param_mask & CAM_SENSOR_FEATURE_MASK)
 		if (res_info->valid_param_mask & CAM_SENSOR_FEATURE_MASK)
 			s_ctrl->sensor_res[idx].feature_mask =
 			s_ctrl->sensor_res[idx].feature_mask =
 				res_info->params[0];
 				res_info->params[0];
+
+		if (res_info->valid_param_mask & CAM_SENSOR_NUM_BATCHED_FRAMES)
+			s_ctrl->num_batched_frames = res_info->params[1];
 	}
 	}
 
 
 	s_ctrl->is_res_info_updated = true;
 	s_ctrl->is_res_info_updated = true;
@@ -1265,6 +1268,7 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
 		s_ctrl->is_stopped_by_user = false;
 		s_ctrl->is_stopped_by_user = false;
 		s_ctrl->last_updated_req = 0;
 		s_ctrl->last_updated_req = 0;
 		s_ctrl->last_applied_req = 0;
 		s_ctrl->last_applied_req = 0;
+		s_ctrl->num_batched_frames = 0;
 		memset(s_ctrl->sensor_res, 0, sizeof(s_ctrl->sensor_res));
 		memset(s_ctrl->sensor_res, 0, sizeof(s_ctrl->sensor_res));
 		CAM_INFO(CAM_SENSOR,
 		CAM_INFO(CAM_SENSOR,
 			"CAM_ACQUIRE_DEV Success for %s sensor_id:0x%x,sensor_slave_addr:0x%x",
 			"CAM_ACQUIRE_DEV Success for %s sensor_id:0x%x,sensor_slave_addr:0x%x",
@@ -1394,11 +1398,12 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
 		CAM_CONVERT_TIMESTAMP_FORMAT(ts, hrs, min, sec, ms);
 		CAM_CONVERT_TIMESTAMP_FORMAT(ts, hrs, min, sec, ms);
 
 
 		CAM_INFO(CAM_SENSOR,
 		CAM_INFO(CAM_SENSOR,
-			"%llu:%llu:%llu.%llu CAM_START_DEV Success for %s sensor_id:0x%x,sensor_slave_addr:0x%x",
+			"%llu:%llu:%llu.%llu CAM_START_DEV Success for %s sensor_id:0x%x,sensor_slave_addr:0x%x num_batched_frames:%d",
 			hrs, min, sec, ms,
 			hrs, min, sec, ms,
 			s_ctrl->sensor_name,
 			s_ctrl->sensor_name,
 			s_ctrl->sensordata->slave_info.sensor_id,
 			s_ctrl->sensordata->slave_info.sensor_id,
-			s_ctrl->sensordata->slave_info.sensor_slave_addr);
+			s_ctrl->sensordata->slave_info.sensor_slave_addr,
+			s_ctrl->num_batched_frames);
 	}
 	}
 		break;
 		break;
 	case CAM_STOP_DEV: {
 	case CAM_STOP_DEV: {
@@ -1558,7 +1563,10 @@ int cam_sensor_publish_dev_info(struct cam_req_mgr_device_info *info)
 
 
 	info->dev_id = CAM_REQ_MGR_DEVICE_SENSOR;
 	info->dev_id = CAM_REQ_MGR_DEVICE_SENSOR;
 	strlcpy(info->name, CAM_SENSOR_NAME, sizeof(info->name));
 	strlcpy(info->name, CAM_SENSOR_NAME, sizeof(info->name));
-	if (s_ctrl->pipeline_delay >= 1 && s_ctrl->pipeline_delay <= 3) {
+	if (s_ctrl->num_batched_frames >= 2) {
+		info->p_delay = 1;
+		info->m_delay = s_ctrl->modeswitch_delay;
+	} else if (s_ctrl->pipeline_delay >= 1 && s_ctrl->pipeline_delay <= 3) {
 		info->p_delay = s_ctrl->pipeline_delay;
 		info->p_delay = s_ctrl->pipeline_delay;
 		info->m_delay = s_ctrl->modeswitch_delay;
 		info->m_delay = s_ctrl->modeswitch_delay;
 	} else {
 	} else {
@@ -1567,6 +1575,9 @@ int cam_sensor_publish_dev_info(struct cam_req_mgr_device_info *info)
 	}
 	}
 	info->trigger = CAM_TRIGGER_POINT_SOF;
 	info->trigger = CAM_TRIGGER_POINT_SOF;
 
 
+	CAM_DBG(CAM_REQ, "num batched frames %d p_delay is %d",
+		s_ctrl->num_batched_frames, info->p_delay);
+
 	return rc;
 	return rc;
 }
 }
 
 

+ 2 - 0
drivers/cam_sensor_module/cam_sensor/cam_sensor_dev.h

@@ -111,6 +111,7 @@ struct cam_sensor_dev_res_info {
  * @aon_camera_id: AON Camera ID associated with this sensor
  * @aon_camera_id: AON Camera ID associated with this sensor
  * @last_applied_req: Last updated request id
  * @last_applied_req: Last updated request id
  * @last_applied_req: Last applied request id
  * @last_applied_req: Last applied request id
+ * @num_batched_frames: Number batched frames
  * @is_stopped_by_user: Indicate if sensor has been stopped by userland
  * @is_stopped_by_user: Indicate if sensor has been stopped by userland
  * @stream_off_after_eof: Indicates if sensor needs to stream off after eof
  * @stream_off_after_eof: Indicates if sensor needs to stream off after eof
  * @is_res_info_updated: Indicate if resolution info is updated
  * @is_res_info_updated: Indicate if resolution info is updated
@@ -147,6 +148,7 @@ struct cam_sensor_ctrl_t {
 	uint32_t                       aon_camera_id;
 	uint32_t                       aon_camera_id;
 	int64_t                        last_updated_req;
 	int64_t                        last_updated_req;
 	int64_t                        last_applied_req;
 	int64_t                        last_applied_req;
+	uint32_t                       num_batched_frames;
 	bool                           is_stopped_by_user;
 	bool                           is_stopped_by_user;
 	bool                           stream_off_after_eof;
 	bool                           stream_off_after_eof;
 	bool                           is_res_info_updated;
 	bool                           is_res_info_updated;

+ 7 - 1
include/uapi/camera/media/cam_sensor.h

@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
 /*
 /*
  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
  */
 
 
 #ifndef __UAPI_CAM_SENSOR_H__
 #ifndef __UAPI_CAM_SENSOR_H__
@@ -339,8 +339,14 @@ struct cam_cmd_i2c_info {
 	__u16    reserved;
 	__u16    reserved;
 } __attribute__((packed));
 } __attribute__((packed));
 
 
+/**
+ * Below macro definition is the param mask for
+ * cam_cmd_sensor_res_info.
+ */
 #define CAM_SENSOR_FEATURE_MASK                    BIT(0)
 #define CAM_SENSOR_FEATURE_MASK                    BIT(0)
+#define CAM_SENSOR_NUM_BATCHED_FRAMES              BIT(1)
 
 
+/* Below macro definition is the sub definition for CAM_SENSOR_FEATURE_MASK */
 #define CAM_SENSOR_FEATURE_NONE                    0
 #define CAM_SENSOR_FEATURE_NONE                    0
 #define CAM_SENSOR_FEATURE_AEB_ON                  BIT(0)
 #define CAM_SENSOR_FEATURE_AEB_ON                  BIT(0)
 #define CAM_SENSOR_FEATURE_AEB_UPDATE              BIT(1)
 #define CAM_SENSOR_FEATURE_AEB_UPDATE              BIT(1)