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

Commit 291818ec authored by Vivek Veenam's avatar Vivek Veenam Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: Parse streamon/off packet only once



Streamon/off settings should be stored in the i2c list
only once per camera open. Check in the config_dev if
streamon settings are already stored in the list and return.

Change-Id: I8ab386bdb15409b8a1dc9622262740cd956b54a0
Signed-off-by: default avatarVivek Veenam <vveenam@codeaurora.org>
Signed-off-by: default avatarRavi Kishore Tanuku <rktanuku@codeaurora.org>
parent 1fc99d9c
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -161,12 +161,20 @@ static int32_t cam_sensor_i2c_pkt_parse(struct cam_sensor_ctrl_t *s_ctrl,
		break;
	}
	case CAM_SENSOR_PACKET_OPCODE_SENSOR_STREAMON: {
		if (s_ctrl->streamon_count > 0)
			return 0;

		s_ctrl->streamon_count = s_ctrl->streamon_count + 1;
		i2c_reg_settings = &i2c_data->streamon_settings;
		i2c_reg_settings->request_id = 0;
		i2c_reg_settings->is_settings_valid = 1;
		break;
	}
	case CAM_SENSOR_PACKET_OPCODE_SENSOR_STREAMOFF: {
		if (s_ctrl->streamoff_count > 0)
			return 0;

		s_ctrl->streamoff_count = s_ctrl->streamoff_count + 1;
		i2c_reg_settings = &i2c_data->streamoff_settings;
		i2c_reg_settings->request_id = 0;
		i2c_reg_settings->is_settings_valid = 1;
@@ -514,6 +522,8 @@ void cam_sensor_shutdown(struct cam_sensor_ctrl_t *s_ctrl)
	kfree(power_info->power_setting);
	kfree(power_info->power_down_setting);

	s_ctrl->streamon_count = 0;
	s_ctrl->streamoff_count = 0;
	s_ctrl->sensor_state = CAM_SENSOR_INIT;
}

@@ -757,6 +767,8 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
		CAM_INFO(CAM_SENSOR,
			"CAM_RELEASE_DEV Success, sensor_id:0x%x",
			s_ctrl->sensordata->slave_info.sensor_id);
		s_ctrl->streamon_count = 0;
		s_ctrl->streamoff_count = 0;
	}
		break;
	case CAM_QUERY_CAP: {
+5 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -90,6 +90,8 @@ struct intf_params {
 * @sensor_info: Sensor query cap structure
 * @bridge_intf: Bridge interface structure
 * @device_name: Sensor device structure
 * @streamon_count: Count to hold the number of times stream on called
 * @streamoff_count: Count to hold the number of times stream off called
 */
struct cam_sensor_ctrl_t {
	struct platform_device *pdev;
@@ -109,6 +111,8 @@ struct cam_sensor_ctrl_t {
	struct  cam_sensor_query_cap sensor_info;
	struct intf_params bridge_intf;
	char device_name[20];
	uint32_t streamon_count;
	uint32_t streamoff_count;
};

#endif /* _CAM_SENSOR_DEV_H_ */