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

Commit d2b38c6c authored by Jigarkumar Zala's avatar Jigarkumar Zala
Browse files

msm: camera: Add state support for streamon without release



Sensor should start streamon from acquire and config state, in case
of dual camera usecase. At the time of start session INIT/RES config
packets are received to both sensors, but in the same session switching
between different sensor will not be getting INIT/RES setting. Adding
acquire state as a valid state to streamon will allow sensor to start
streamon. Update the config state as valid state to release flash
device, as there can be usecase where flash is called release after
changing to config state and before start. Also, changing return code
to 0, when sensor/flash is getting NOP/Update packets between stop and
release device.

Change-Id: Ie27d9793a1dc71bc776e2322a9fd635bbf578fd0
Signed-off-by: default avatarJigarkumar Zala <jzala@codeaurora.org>
parent 82ef231d
Loading
Loading
Loading
Loading
+33 −34
Original line number Diff line number Diff line
@@ -612,9 +612,16 @@ int cam_flash_parser(struct cam_flash_ctrl *fctrl, void *arg)
		case CAMERA_SENSOR_FLASH_CMD_TYPE_FIRE: {
			CAM_DBG(CAM_FLASH,
				"CAMERA_FLASH_CMD_TYPE_OPS case called");
			if ((fctrl->flash_state == CAM_FLASH_STATE_START) ||
			if ((fctrl->flash_state == CAM_FLASH_STATE_INIT) ||
				(fctrl->flash_state ==
					CAM_FLASH_STATE_CONFIG)) {
					CAM_FLASH_STATE_ACQUIRE)) {
				CAM_WARN(CAM_FLASH,
					"Rxed Flash fire ops without linking");
				fctrl->per_frame[frame_offset].
					cmn_attr.is_settings_valid = false;
				return 0;
			}

			flash_operation_info =
				(struct cam_flash_set_on_off *) cmd_buf;
			if (!flash_operation_info) {
@@ -633,16 +640,8 @@ int cam_flash_parser(struct cam_flash_ctrl *fctrl, void *arg)
					led_current_ma[i]
					= flash_operation_info->
					led_current_ma[i];

			} else {
				CAM_ERR(CAM_FLASH,
					"Rxed Update packets without linking");
				fctrl->per_frame[frame_offset].
					cmn_attr.is_settings_valid = false;
				return -EINVAL;
			}
			break;
		}
		default:
			CAM_ERR(CAM_FLASH, "Wrong cmd_type = %d",
				cmn_hdr->cmd_type);
@@ -741,18 +740,18 @@ int cam_flash_parser(struct cam_flash_ctrl *fctrl, void *arg)
		break;
	}
	case CAM_PKT_NOP_OPCODE: {
		if ((fctrl->flash_state == CAM_FLASH_STATE_START) ||
			(fctrl->flash_state == CAM_FLASH_STATE_CONFIG)) {
			CAM_DBG(CAM_FLASH, "NOP Packet is Received: req_id: %u",
				csl_packet->header.request_id);
			goto update_req_mgr;
		} else {
			CAM_ERR(CAM_FLASH,
				"Rxed Update packets without linking");
		if ((fctrl->flash_state == CAM_FLASH_STATE_INIT) ||
			(fctrl->flash_state == CAM_FLASH_STATE_ACQUIRE)) {
			CAM_WARN(CAM_FLASH,
				"Rxed NOP packets without linking");
			fctrl->per_frame[frame_offset].
				cmn_attr.is_settings_valid = false;
			return -EINVAL;
			return 0;
		}

		CAM_DBG(CAM_FLASH, "NOP Packet is Received: req_id: %u",
			csl_packet->header.request_id);
		goto update_req_mgr;
	}
	default:
		CAM_ERR(CAM_FLASH, "Wrong Opcode : %d",
+4 −2
Original line number Diff line number Diff line
@@ -82,7 +82,8 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl,
	}
	case CAM_RELEASE_DEV: {
		CAM_DBG(CAM_FLASH, "CAM_RELEASE_DEV");
		if (fctrl->flash_state != CAM_FLASH_STATE_ACQUIRE) {
		if ((fctrl->flash_state == CAM_FLASH_STATE_INIT) ||
			(fctrl->flash_state == CAM_FLASH_STATE_START)) {
			CAM_WARN(CAM_FLASH,
				"Cannot apply Release dev: Prev state:%d",
				fctrl->flash_state);
@@ -131,7 +132,8 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl,
	}
	case CAM_START_DEV: {
		CAM_DBG(CAM_FLASH, "CAM_START_DEV");
		if (fctrl->flash_state != CAM_FLASH_STATE_CONFIG) {
		if ((fctrl->flash_state == CAM_FLASH_STATE_INIT) ||
			(fctrl->flash_state == CAM_FLASH_STATE_START)) {
			CAM_WARN(CAM_FLASH,
				"Cannot apply Start Dev: Prev state: %d",
				fctrl->flash_state);
+33 −32
Original line number Diff line number Diff line
@@ -165,8 +165,13 @@ static int32_t cam_sensor_i2c_pkt_parse(struct cam_sensor_ctrl_t *s_ctrl,
	}

	case CAM_SENSOR_PACKET_OPCODE_SENSOR_UPDATE: {
		if ((s_ctrl->sensor_state == CAM_SENSOR_CONFIG) ||
			(s_ctrl->sensor_state == CAM_SENSOR_START)) {
		if ((s_ctrl->sensor_state == CAM_SENSOR_INIT) ||
			(s_ctrl->sensor_state == CAM_SENSOR_ACQUIRE)) {
			CAM_WARN(CAM_SENSOR,
				"Rxed Update packets without linking");
			return 0;
		}

		i2c_reg_settings =
			&i2c_data->
			per_frame[csl_packet->header.request_id %
@@ -184,23 +189,18 @@ static int32_t cam_sensor_i2c_pkt_parse(struct cam_sensor_ctrl_t *s_ctrl,
				return rc;
			}
		}
		} else {
			CAM_ERR(CAM_SENSOR,
				"Rxed Update packets without linking");
			return -EINVAL;
		}
	break;
	}
	case CAM_SENSOR_PACKET_OPCODE_SENSOR_NOP: {
		if ((s_ctrl->sensor_state == CAM_SENSOR_CONFIG) ||
			(s_ctrl->sensor_state == CAM_SENSOR_START)) {
			cam_sensor_update_req_mgr(s_ctrl, csl_packet);
		} else {
			CAM_ERR(CAM_SENSOR,
				"Rxed Update packets without linking");
			rc = -EINVAL;
		if ((s_ctrl->sensor_state == CAM_SENSOR_INIT) ||
			(s_ctrl->sensor_state == CAM_SENSOR_ACQUIRE)) {
			CAM_WARN(CAM_SENSOR,
				"Rxed NOP packets without linking");
			return 0;
		}
		return rc;

		cam_sensor_update_req_mgr(s_ctrl, csl_packet);
		return 0;
	}
	default:
		CAM_ERR(CAM_SENSOR, "Invalid Packet Header");
@@ -706,8 +706,8 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
	}
		break;
	case CAM_RELEASE_DEV: {
		if ((s_ctrl->sensor_state < CAM_SENSOR_ACQUIRE) ||
			(s_ctrl->sensor_state > CAM_SENSOR_CONFIG)) {
		if ((s_ctrl->sensor_state == CAM_SENSOR_INIT) ||
			(s_ctrl->sensor_state == CAM_SENSOR_START)) {
			rc = -EINVAL;
			CAM_WARN(CAM_SENSOR,
			"Not in right state to release : %d",
@@ -754,7 +754,8 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
		break;
	}
	case CAM_START_DEV: {
		if (s_ctrl->sensor_state != CAM_SENSOR_CONFIG) {
		if ((s_ctrl->sensor_state == CAM_SENSOR_INIT) ||
			(s_ctrl->sensor_state == CAM_SENSOR_START)) {
			rc = -EINVAL;
			CAM_WARN(CAM_SENSOR,
			"Not in right state to start : %d",