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

Commit 92825d12 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge 66de6dd5 on remote branch

Change-Id: I0114fa5ec87ad5a86a65b3b4cf58f9fba6a55e94
parents e1397606 66de6dd5
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/delay.h>
@@ -180,12 +181,10 @@ void cam_cdm_notify_clients(struct cam_hw_info *cdm_hw,
			(struct cam_cdm_bl_cb_request_entry *)data;

		client_idx = CAM_CDM_GET_CLIENT_IDX(node->client_hdl);
		mutex_lock(&cdm_hw->hw_mutex);
		client = core->clients[client_idx];
		if ((!client) || (client->handle != node->client_hdl)) {
			CAM_ERR(CAM_CDM, "Invalid client %pK hdl=%x", client,
				node->client_hdl);
			mutex_unlock(&cdm_hw->hw_mutex);
			return;
		}
		cam_cdm_get_client_refcount(client);
@@ -204,7 +203,6 @@ void cam_cdm_notify_clients(struct cam_hw_info *cdm_hw,
		}
		mutex_unlock(&client->lock);
		cam_cdm_put_client_refcount(client);
		mutex_unlock(&cdm_hw->hw_mutex);
		return;
	} else if (status == CAM_CDM_CB_STATUS_HW_RESET_DONE ||
			status == CAM_CDM_CB_STATUS_HW_FLUSH ||
@@ -242,7 +240,6 @@ 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];
			cam_cdm_get_client_refcount(client);
			mutex_lock(&client->lock);
@@ -265,7 +262,6 @@ void cam_cdm_notify_clients(struct cam_hw_info *cdm_hw,
			}
			mutex_unlock(&client->lock);
			cam_cdm_put_client_refcount(client);
			mutex_unlock(&cdm_hw->hw_mutex);
		}
	}
}
+7 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/delay.h>
@@ -1236,8 +1237,8 @@ static void cam_hw_cdm_work(struct work_struct *work)
			return;
		}

		mutex_lock(&core->bl_fifo[fifo_idx]
			.fifo_lock);
		mutex_lock(&cdm_hw->hw_mutex);
		mutex_lock(&core->bl_fifo[fifo_idx].fifo_lock);

		if (atomic_read(&core->bl_fifo[fifo_idx].work_record))
			atomic_dec(
@@ -1251,6 +1252,7 @@ static void cam_hw_cdm_work(struct work_struct *work)
				core->arbitration);
			mutex_unlock(&core->bl_fifo[fifo_idx]
					.fifo_lock);
			mutex_unlock(&cdm_hw->hw_mutex);
			return;
		}

@@ -1292,6 +1294,7 @@ static void cam_hw_cdm_work(struct work_struct *work)
		}
		mutex_unlock(&core->bl_fifo[payload->fifo_idx]
			.fifo_lock);
		mutex_unlock(&cdm_hw->hw_mutex);
	}

	if (payload->irq_status &
@@ -1387,11 +1390,12 @@ static void cam_hw_cdm_iommu_fault_handler(struct iommu_domain *domain,
			CAM_INFO(CAM_CDM, "CDM hw is power in off state");
		for (i = 0; i < core->offsets->reg_data->num_bl_fifo; i++)
			mutex_unlock(&core->bl_fifo[i].fifo_lock);
		mutex_unlock(&cdm_hw->hw_mutex);

		CAM_ERR_RATE_LIMIT(CAM_CDM, "Page fault iova addr %pK",
			(void *)iova);
		cam_cdm_notify_clients(cdm_hw, CAM_CDM_CB_STATUS_PAGEFAULT,
			(void *)iova);
		mutex_unlock(&cdm_hw->hw_mutex);
		clear_bit(CAM_CDM_ERROR_HW_STATUS, &core->cdm_status);
	} else {
		CAM_ERR(CAM_CDM, "Invalid token");
+21 −20
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/uaccess.h>
@@ -19,6 +20,7 @@
#include <media/cam_defs.h>
#include <media/cam_ope.h>
#include <media/cam_cpas.h>
#include <linux/math64.h>

#include "cam_sync_api.h"
#include "cam_packet_util.h"
@@ -621,8 +623,8 @@ static bool cam_ope_check_req_delay(struct cam_ope_ctx *ctx_data,
		ts.tv_nsec);

	if (ts_ns - req_time <
		((OPE_REQUEST_TIMEOUT -
			OPE_REQUEST_TIMEOUT / 10) * 1000000)) {
		((ctx_data->req_timer_timeout -
			div_u64(ctx_data->req_timer_timeout, 10)) * 1000000)) {
		CAM_INFO(CAM_OPE, "ctx: %d, ts_ns : %llu",
		ctx_data->ctx_id, ts_ns);
		cam_ope_req_timer_reset(ctx_data);
@@ -845,7 +847,7 @@ static int cam_ope_start_req_timer(struct cam_ope_ctx *ctx_data)
	int rc = 0;

	rc = crm_timer_init(&ctx_data->req_watch_dog,
		OPE_REQUEST_TIMEOUT, ctx_data, &cam_ope_req_timer_cb);
		ctx_data->req_timer_timeout, ctx_data, &cam_ope_req_timer_cb);
	if (rc)
		CAM_ERR(CAM_OPE, "Failed to start timer");

@@ -2615,11 +2617,15 @@ static int cam_ope_mgr_acquire_hw(void *hw_priv, void *hw_acquire_args)
		goto end;
	}
	strlcpy(cdm_acquire->identifier, "ope", sizeof("ope"));
	if (ctx->ope_acquire.dev_type == OPE_DEV_TYPE_OPE_RT)
	if (ctx->ope_acquire.dev_type == OPE_DEV_TYPE_OPE_RT) {
		cdm_acquire->priority = CAM_CDM_BL_FIFO_3;
		ctx->req_timer_timeout = OPE_REQUEST_RT_TIMEOUT;
	}
	else if (ctx->ope_acquire.dev_type ==
		OPE_DEV_TYPE_OPE_NRT)
		OPE_DEV_TYPE_OPE_NRT) {
		cdm_acquire->priority = CAM_CDM_BL_FIFO_0;
		ctx->req_timer_timeout = OPE_REQUEST_NRT_TIMEOUT;
	}
	else
		goto free_cdm_acquire;

@@ -3217,21 +3223,12 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv,
		CAM_ERR(CAM_OPE, "Invalid ctx req slot = %d", request_idx);
		return -EINVAL;
	}
	get_monotonic_boottime64(&ts);
	ctx_data->last_req_time = (uint64_t)((ts.tv_sec * 1000000000) +
		ts.tv_nsec);
	CAM_DBG(CAM_REQ, "req_id= %llu ctx_id= %d lrt=%llu",
		packet->header.request_id, ctx_data->ctx_id,
		ctx_data->last_req_time);
	cam_ope_req_timer_modify(ctx_data, OPE_REQUEST_TIMEOUT);
	set_bit(request_idx, ctx_data->bitmap);
	ctx_data->req_list[request_idx] =
		kzalloc(sizeof(struct cam_ope_request), GFP_KERNEL);
	if (!ctx_data->req_list[request_idx]) {
		CAM_ERR(CAM_OPE, "mem allocation failed ctx:%d req_idx:%d",
			ctx_data->ctx_id, request_idx);
		rc = -ENOMEM;
		mutex_unlock(&ctx_data->ctx_mutex);
		goto req_mem_alloc_failed;
	}

@@ -3245,14 +3242,12 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv,
		CAM_ERR(CAM_OPE, "Cdm mem alloc failed ctx:%d req_idx:%d",
			ctx_data->ctx_id, request_idx);
		rc = -ENOMEM;
		mutex_unlock(&ctx_data->ctx_mutex);
		goto req_cdm_mem_alloc_failed;
	}

	rc = cam_ope_mgr_process_cmd_desc(hw_mgr, packet,
		ctx_data, &ope_cmd_buf_addr, request_idx);
	if (rc) {
		mutex_unlock(&ctx_data->ctx_mutex);
		CAM_ERR(CAM_OPE,
			"cmd desc processing failed :%d ctx: %d req_id:%d",
			rc, ctx_data->ctx_id, packet->header.request_id);
@@ -3262,7 +3257,6 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv,
	rc = cam_ope_mgr_process_io_cfg(hw_mgr, packet, prepare_args,
		ctx_data, request_idx);
	if (rc) {
		mutex_unlock(&ctx_data->ctx_mutex);
		CAM_ERR(CAM_OPE,
			"IO cfg processing failed: %d ctx: %d req_id:%d",
			rc, ctx_data->ctx_id, packet->header.request_id);
@@ -3272,7 +3266,6 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv,
	rc = cam_ope_mgr_create_kmd_buf(hw_mgr, packet, prepare_args,
		ctx_data, request_idx, ope_cmd_buf_addr);
	if (rc) {
		mutex_unlock(&ctx_data->ctx_mutex);
		CAM_ERR(CAM_OPE,
			"create kmd buf failed: %d ctx: %d request_id:%d",
			rc, ctx_data->ctx_id, packet->header.request_id);
@@ -3282,7 +3275,6 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv,
	rc = cam_ope_process_generic_cmd_buffer(packet, ctx_data,
		request_idx, NULL);
	if (rc) {
		mutex_unlock(&ctx_data->ctx_mutex);
		CAM_ERR(CAM_OPE, "Failed: %d ctx: %d req_id: %d req_idx: %d",
			rc, ctx_data->ctx_id, packet->header.request_id,
			request_idx);
@@ -3294,6 +3286,14 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv,
	prepare_args->priv = ctx_data->req_list[request_idx];
	prepare_args->pf_data->packet = packet;
	ope_req->hang_data.packet = packet;
	get_monotonic_boottime64(&ts);
	ctx_data->last_req_time = (uint64_t)((ts.tv_sec * 1000000000) +
		ts.tv_nsec);
	CAM_DBG(CAM_REQ, "req_id= %llu ctx_id= %d lrt=%llu",
		packet->header.request_id, ctx_data->ctx_id,
		ctx_data->last_req_time);
	cam_ope_req_timer_modify(ctx_data, ctx_data->req_timer_timeout);
	set_bit(request_idx, ctx_data->bitmap);
	mutex_unlock(&ctx_data->ctx_mutex);

	CAM_DBG(CAM_REQ, "Prepare Hw update Successful request_id: %d  ctx: %d",
@@ -3308,6 +3308,7 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv,
	ctx_data->req_list[request_idx] = NULL;
req_mem_alloc_failed:
	clear_bit(request_idx, ctx_data->bitmap);
	mutex_unlock(&ctx_data->ctx_mutex);
	return rc;
}

@@ -3692,7 +3693,7 @@ static int cam_ope_mgr_hw_dump(void *hw_priv, void *hw_dump_args)
	cur_ts = ktime_to_timespec64(cur_time);
	req_ts = ktime_to_timespec64(ctx_data->req_list[idx]->submit_timestamp);

	if (diff < (OPE_REQUEST_TIMEOUT * 1000)) {
	if (diff < (ctx_data->req_timer_timeout * 1000)) {
		CAM_INFO(CAM_OPE, "No Error req %llu %ld:%06ld %ld:%06ld",
			dump_args->request_id,
			req_ts.tv_sec,
+6 −2
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#ifndef CAM_OPE_HW_MGR_H
@@ -50,7 +51,7 @@
#define OPE_CMDS                  OPE_MAX_CMD_BUFS
#define CAM_MAX_IN_RES            8

#define OPE_MAX_CDM_BLS           24
#define OPE_MAX_CDM_BLS           32

#define CAM_OPE_MAX_PER_PATH_VOTES 6
#define CAM_OPE_BW_CONFIG_UNKNOWN  0
@@ -60,7 +61,8 @@
#define CLK_HW_MAX                 0x1

#define OPE_DEVICE_IDLE_TIMEOUT    400
#define OPE_REQUEST_TIMEOUT        200
#define OPE_REQUEST_RT_TIMEOUT        200
#define OPE_REQUEST_NRT_TIMEOUT        400

/**
 * struct cam_ope_clk_bw_request_v2
@@ -447,6 +449,7 @@ struct cam_ope_cdm {
 * @clk_watch_dog:   Clock watchdog
 * @clk_watch_dog_reset_counter: Reset counter
 * @last_flush_req: last flush req for this ctx
 * @req_timer_timeout: req timer timeout value
 */
struct cam_ope_ctx {
	void *context_priv;
@@ -469,6 +472,7 @@ struct cam_ope_ctx {
	struct cam_req_mgr_timer *clk_watch_dog;
	uint32_t clk_watch_dog_reset_counter;
	uint64_t last_flush_req;
	uint64_t req_timer_timeout;
};

/**
+1 −1
Original line number Diff line number Diff line
@@ -3948,7 +3948,7 @@ int cam_req_mgr_dump_request(struct cam_dump_req_cmd *dump_req)

	link = (struct cam_req_mgr_core_link *)
		cam_get_device_priv(dump_req->link_hdl);
	if (!link) {
	if (!link || link->link_hdl != dump_req->link_hdl) {
		CAM_DBG(CAM_CRM, "link ptr NULL %x", dump_req->link_hdl);
		rc = -EINVAL;
		goto end;
Loading