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

Commit 959ceaa5 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge c9c62bcd on remote branch

Change-Id: Ic10436ba0fb4e6c9fd6edd13afc930b118f35b89
parents 957adeaa c9c62bcd
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/delay.h>
@@ -201,6 +201,7 @@ void cam_cdm_notify_clients(struct cam_hw_info *cdm_hw,

	for (i = 0; i < CAM_PER_CDM_MAX_REGISTERED_CLIENTS; i++) {
		if (core->clients[i] != NULL) {
			mutex_lock(&cdm_hw->hw_mutex);
			client = core->clients[i];
			mutex_lock(&client->lock);
			CAM_DBG(CAM_CDM, "Found client slot %d", i);
@@ -221,6 +222,7 @@ void cam_cdm_notify_clients(struct cam_hw_info *cdm_hw,
					client->handle);
			}
			mutex_unlock(&client->lock);
			mutex_unlock(&cdm_hw->hw_mutex);
		}
	}
}
@@ -239,35 +241,34 @@ int cam_cdm_stream_ops_internal(void *hw_priv,
		return -EINVAL;

	core = (struct cam_cdm *)cdm_hw->core_info;
	mutex_lock(&cdm_hw->hw_mutex);
	client_idx = CAM_CDM_GET_CLIENT_IDX(*handle);
	client = core->clients[client_idx];
	if (!client) {
		CAM_ERR(CAM_CDM, "Invalid client %pK hdl=%x", client, *handle);
		mutex_unlock(&cdm_hw->hw_mutex);
		return -EINVAL;
	}
	cam_cdm_get_client_refcount(client);
	if (*handle != client->handle) {
		CAM_ERR(CAM_CDM, "client id given handle=%x invalid", *handle);
		cam_cdm_put_client_refcount(client);
		return -EINVAL;
		rc = -EINVAL;
		goto end;
	}
	if (operation == true) {
		if (true == client->stream_on) {
			CAM_ERR(CAM_CDM,
				"Invalid CDM client is already streamed ON");
			cam_cdm_put_client_refcount(client);
			return rc;
			goto end;
		}
	} else {
		if (client->stream_on == false) {
			CAM_ERR(CAM_CDM,
				"Invalid CDM client is already streamed Off");
			cam_cdm_put_client_refcount(client);
			return rc;
			goto end;
		}
	}

	mutex_lock(&cdm_hw->hw_mutex);
	if (operation == true) {
		if (!cdm_hw->open_count) {
			struct cam_ahb_vote ahb_vote;
+14 −13
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@
/* Max CSI Rx irq error count threshold value */
#define CAM_IFE_CSID_MAX_IRQ_ERROR_COUNT               100

/* factor to conver qtime to boottime */
static int64_t qtime_to_boottime;

static int cam_ife_csid_reset_regs(
	struct cam_ife_csid_hw *csid_hw, bool reset_hw);

@@ -3394,7 +3397,6 @@ static int cam_ife_csid_get_time_stamp(
	const struct cam_ife_csid_udi_reg_offset   *udi_reg;
	struct timespec64 ts;
	uint32_t  time_32, id;
	uint64_t  time_delta;

	time_stamp = (struct cam_csid_get_time_stamp_args  *)cmd_args;
	res = time_stamp->node_res;
@@ -3466,20 +3468,19 @@ static int cam_ife_csid_get_time_stamp(
		CAM_IFE_CSID_QTIMER_MUL_FACTOR,
		CAM_IFE_CSID_QTIMER_DIV_FACTOR);

	if (!csid_hw->prev_boot_timestamp) {
	/* use a universal qtime-2-boottime offset for all cameras
	 * this enables uniform timestamp comparision between cameras
	 */
	if (qtime_to_boottime == 0) {
		get_monotonic_boottime64(&ts);
		time_stamp->boot_timestamp =
			(uint64_t)((ts.tv_sec * 1000000000) +
			ts.tv_nsec);
		csid_hw->prev_qtimer_ts = 0;
		CAM_DBG(CAM_ISP, "timestamp:%lld",
			time_stamp->boot_timestamp);
	} else {
		time_delta = time_stamp->time_stamp_val -
			csid_hw->prev_qtimer_ts;
		time_stamp->boot_timestamp =
			csid_hw->prev_boot_timestamp + time_delta;
		qtime_to_boottime =
			(int64_t)((ts.tv_sec * 1000000000) + ts.tv_nsec) -
			(int64_t)time_stamp->time_stamp_val;
		CAM_DBG(CAM_ISP, "qtime_to_boottime:%lld", qtime_to_boottime);
	}

	time_stamp->boot_timestamp = time_stamp->time_stamp_val +
		qtime_to_boottime;
	csid_hw->prev_qtimer_ts = time_stamp->time_stamp_val;
	csid_hw->prev_boot_timestamp = time_stamp->boot_timestamp;