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

Commit 9e68a48c authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge c487910c on remote branch

Change-Id: Id0ddbf644ef4fdc44afe00922cac7325cd5e92c9
parents 0023bce1 c487910c
Loading
Loading
Loading
Loading
+85 −36
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/module.h>
@@ -1850,10 +1851,13 @@ static int __cam_req_mgr_create_subdevs(
 *
 */
static void __cam_req_mgr_destroy_subdev(
	struct cam_req_mgr_connected_device *l_device)
	struct cam_req_mgr_connected_device **l_device)
{
	kfree(l_device);
	l_device = NULL;
	CAM_DBG(CAM_CRM, "*l_device %pK", *l_device);
	if (*(l_device) != NULL) {
		kfree(*(l_device));
		*l_device = NULL;
	}
}

/**
@@ -3238,7 +3242,7 @@ static int __cam_req_mgr_unlink(struct cam_req_mgr_core_link *link)
	__cam_req_mgr_destroy_link_info(link);
	/* Free memory holding data of linked devs */

	__cam_req_mgr_destroy_subdev(link->l_dev);
	__cam_req_mgr_destroy_subdev(&link->l_dev);

	/* Destroy the link handle */
	rc = cam_destroy_device_hdl(link->link_hdl);
@@ -3269,8 +3273,12 @@ int cam_req_mgr_destroy_session(
	mutex_lock(&g_crm_core_dev->crm_lock);
	cam_session = (struct cam_req_mgr_core_session *)
		cam_get_device_priv(ses_info->session_hdl);
	if (!cam_session) {
		CAM_ERR(CAM_CRM, "failed to get session priv");
	if (!cam_session ||
		(cam_session->session_hdl != ses_info->session_hdl)) {
		CAM_ERR(CAM_CRM, "ses:%s ses_info->ses_hdl:%x ses->ses_hdl:%x",
			CAM_IS_NULL_TO_STR(cam_session), ses_info->session_hdl,
			(!cam_session) ? CAM_REQ_MGR_DEFAULT_HDL_VAL :
					 cam_session->session_hdl);
		rc = -ENOENT;
		goto end;

@@ -3330,8 +3338,13 @@ int cam_req_mgr_link(struct cam_req_mgr_ver_info *link_info)
	/* session hdl's priv data is cam session struct */
	cam_session = (struct cam_req_mgr_core_session *)
		cam_get_device_priv(link_info->u.link_info_v1.session_hdl);
	if (!cam_session) {
		CAM_DBG(CAM_CRM, "NULL pointer");
	if (!cam_session || (cam_session->session_hdl !=
				link_info->u.link_info_v1.session_hdl)) {
		CAM_ERR(CAM_CRM, "ses:%s lnk_info->ses_hdl:%x ses->ses_hdl:%x",
			CAM_IS_NULL_TO_STR(cam_session),
			link_info->u.link_info_v1.session_hdl,
			(!cam_session) ? CAM_REQ_MGR_DEFAULT_HDL_VAL :
					 cam_session->session_hdl);
		mutex_unlock(&g_crm_core_dev->crm_lock);
		return -EINVAL;
	}
@@ -3403,7 +3416,7 @@ int cam_req_mgr_link(struct cam_req_mgr_ver_info *link_info)
	mutex_unlock(&g_crm_core_dev->crm_lock);
	return rc;
setup_failed:
	__cam_req_mgr_destroy_subdev(link->l_dev);
	__cam_req_mgr_destroy_subdev(&link->l_dev);
create_subdev_failed:
	cam_destroy_device_hdl(link->link_hdl);
	link_info->u.link_info_v1.link_hdl = -1;
@@ -3439,8 +3452,13 @@ int cam_req_mgr_link_v2(struct cam_req_mgr_ver_info *link_info)
	/* session hdl's priv data is cam session struct */
	cam_session = (struct cam_req_mgr_core_session *)
		cam_get_device_priv(link_info->u.link_info_v2.session_hdl);
	if (!cam_session) {
		CAM_DBG(CAM_CRM, "NULL pointer");
	if (!cam_session || (cam_session->session_hdl !=
				link_info->u.link_info_v2.session_hdl)) {
		CAM_ERR(CAM_CRM, "ses:%s lnk_info->ses_hdl:%x ses->ses_hdl:%x",
			CAM_IS_NULL_TO_STR(cam_session),
			link_info->u.link_info_v2.session_hdl,
			(!cam_session) ? CAM_REQ_MGR_DEFAULT_HDL_VAL :
					 cam_session->session_hdl);
		mutex_unlock(&g_crm_core_dev->crm_lock);
		return -EINVAL;
	}
@@ -3513,7 +3531,7 @@ int cam_req_mgr_link_v2(struct cam_req_mgr_ver_info *link_info)
	mutex_unlock(&g_crm_core_dev->crm_lock);
	return rc;
setup_failed:
	__cam_req_mgr_destroy_subdev(link->l_dev);
	__cam_req_mgr_destroy_subdev(&link->l_dev);
create_subdev_failed:
	cam_destroy_device_hdl(link->link_hdl);
	link_info->u.link_info_v2.link_hdl = -1;
@@ -3542,16 +3560,23 @@ int cam_req_mgr_unlink(struct cam_req_mgr_unlink_info *unlink_info)
	/* session hdl's priv data is cam session struct */
	cam_session = (struct cam_req_mgr_core_session *)
		cam_get_device_priv(unlink_info->session_hdl);
	if (!cam_session) {
		CAM_ERR(CAM_CRM, "NULL pointer");
	if (!cam_session || (cam_session->session_hdl !=
				unlink_info->session_hdl)) {
		CAM_ERR(CAM_CRM, "ses:%s unlink->ses_hdl:%x ses->ses_hdl:%x",
			CAM_IS_NULL_TO_STR(cam_session),
			unlink_info->session_hdl,
			(!cam_session) ? CAM_REQ_MGR_DEFAULT_HDL_VAL :
					 cam_session->session_hdl);
		mutex_unlock(&g_crm_core_dev->crm_lock);
		return -EINVAL;
	}

	/* link hdl's priv data is core_link struct */
	link = cam_get_device_priv(unlink_info->link_hdl);
	if (!link) {
		CAM_ERR(CAM_CRM, "NULL pointer");
	if (!link || (link->link_hdl != unlink_info->link_hdl)) {
		CAM_ERR(CAM_CRM, "link:%s unlink->lnk_hdl:%x link->lnk_hdl:%x",
			CAM_IS_NULL_TO_STR(link), unlink_info->link_hdl,
			(!link) ? CAM_REQ_MGR_DEFAULT_HDL_VAL : link->link_hdl);
		rc = -EINVAL;
		goto done;
	}
@@ -3583,8 +3608,10 @@ int cam_req_mgr_schedule_request(
	mutex_lock(&g_crm_core_dev->crm_lock);
	link = (struct cam_req_mgr_core_link *)
		cam_get_device_priv(sched_req->link_hdl);
	if (!link) {
		CAM_DBG(CAM_CRM, "link ptr NULL %x", sched_req->link_hdl);
	if (!link || (link->link_hdl != sched_req->link_hdl)) {
		CAM_ERR(CAM_CRM, "link:%s sched->lnk_hdl:%x link->lnk_hdl:%x",
			CAM_IS_NULL_TO_STR(link), sched_req->link_hdl,
			(!link) ? CAM_REQ_MGR_DEFAULT_HDL_VAL : link->link_hdl);
		rc = -EINVAL;
		goto end;
	}
@@ -3695,8 +3722,12 @@ int cam_req_mgr_sync_config(
	/* session hdl's priv data is cam session struct */
	cam_session = (struct cam_req_mgr_core_session *)
		cam_get_device_priv(sync_info->session_hdl);
	if (!cam_session) {
		CAM_ERR(CAM_CRM, "NULL pointer");
	if (!cam_session ||
		(cam_session->session_hdl != sync_info->session_hdl)) {
		CAM_ERR(CAM_CRM, "ses:%s sync_info->ses_hdl:%x ses->ses_hdl:%x",
			CAM_IS_NULL_TO_STR(cam_session), sync_info->session_hdl,
			(!cam_session) ?
			CAM_REQ_MGR_DEFAULT_HDL_VAL : cam_session->session_hdl);
		mutex_unlock(&g_crm_core_dev->crm_lock);
		return -EINVAL;
	}
@@ -3708,15 +3739,21 @@ int cam_req_mgr_sync_config(

	/* only two links existing per session in dual cam use case*/
	link1 = cam_get_device_priv(sync_info->link_hdls[0]);
	if (!link1) {
		CAM_ERR(CAM_CRM, "link1 NULL pointer");
	if (!link1 || (link1->link_hdl != sync_info->link_hdls[0])) {
		CAM_ERR(CAM_CRM, "lnk:%s sync_info->lnk_hdl[0]:%x lnk1_hdl:%x",
			CAM_IS_NULL_TO_STR(link1), sync_info->link_hdls[0],
			(!link1) ?
			CAM_REQ_MGR_DEFAULT_HDL_VAL : link1->link_hdl);
		rc = -EINVAL;
		goto done;
	}

	link2 = cam_get_device_priv(sync_info->link_hdls[1]);
	if (!link2) {
		CAM_ERR(CAM_CRM, "link2 NULL pointer");
	if (!link2 || (link2->link_hdl != sync_info->link_hdls[1])) {
		CAM_ERR(CAM_CRM, "lnk:%s sync_info->lnk_hdl[1]:%x lnk2_hdl:%x",
			CAM_IS_NULL_TO_STR(link2), sync_info->link_hdls[1],
			(!link2) ?
			CAM_REQ_MGR_DEFAULT_HDL_VAL : link2->link_hdl);
		rc = -EINVAL;
		goto done;
	}
@@ -3786,8 +3823,11 @@ int cam_req_mgr_flush_requests(
	/* session hdl's priv data is cam session struct */
	session = (struct cam_req_mgr_core_session *)
		cam_get_device_priv(flush_info->session_hdl);
	if (!session) {
		CAM_ERR(CAM_CRM, "Invalid session %x", flush_info->session_hdl);
	if (!session || (session->session_hdl != flush_info->session_hdl)) {
		CAM_ERR(CAM_CRM, "ses:%s flush->ses_hdl:%x ses->ses_hdl:%x",
			CAM_IS_NULL_TO_STR(session), flush_info->session_hdl,
			(!session) ? CAM_REQ_MGR_DEFAULT_HDL_VAL :
					session->session_hdl);
		rc = -EINVAL;
		goto end;
	}
@@ -3799,8 +3839,10 @@ int cam_req_mgr_flush_requests(

	link = (struct cam_req_mgr_core_link *)
		cam_get_device_priv(flush_info->link_hdl);
	if (!link) {
		CAM_DBG(CAM_CRM, "link ptr NULL %x", flush_info->link_hdl);
	if (!link || (link->link_hdl != flush_info->link_hdl)) {
		CAM_ERR(CAM_CRM, "link:%s flush->link_hdl:%x link->link_hdl:%x",
			CAM_IS_NULL_TO_STR(link), flush_info->link_hdl,
			(!link) ? CAM_REQ_MGR_DEFAULT_HDL_VAL : link->link_hdl);
		rc = -EINVAL;
		goto end;
	}
@@ -3857,9 +3899,12 @@ int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control)
	for (i = 0; i < control->num_links; i++) {
		link = (struct cam_req_mgr_core_link *)
			cam_get_device_priv(control->link_hdls[i]);
		if (!link) {
			CAM_ERR(CAM_CRM, "Link(%d) is NULL on session 0x%x",
				i, control->session_hdl);
		if (!link || (link->link_hdl != control->link_hdls[i])) {
			CAM_ERR(CAM_CRM,
				"link:%s control->lnk_hdl:%x link->lnk_hdl:%x",
				CAM_IS_NULL_TO_STR(link), control->link_hdls[i],
				(!link) ?
				CAM_REQ_MGR_DEFAULT_HDL_VAL : link->link_hdl);
			rc = -EINVAL;
			break;
		}
@@ -3934,9 +3979,11 @@ int cam_req_mgr_dump_request(struct cam_dump_req_cmd *dump_req)
	/* session hdl's priv data is cam session struct */
	session = (struct cam_req_mgr_core_session *)
	    cam_get_device_priv(dump_req->session_handle);
	if (!session) {
		CAM_ERR(CAM_CRM, "Invalid session %x",
			dump_req->session_handle);
	if (!session || (session->session_hdl != dump_req->session_handle)) {
		CAM_ERR(CAM_CRM, "ses:%s dump_req->ses_hdl:%x ses->ses_hdl:%x",
			CAM_IS_NULL_TO_STR(session), dump_req->session_handle,
			(!session) ?
			CAM_REQ_MGR_DEFAULT_HDL_VAL : session->session_hdl);
		rc = -EINVAL;
		goto end;
	}
@@ -3948,8 +3995,10 @@ 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 || link->link_hdl != dump_req->link_hdl) {
		CAM_DBG(CAM_CRM, "link ptr NULL %x", dump_req->link_hdl);
	if (!link || (link->link_hdl != dump_req->link_hdl)) {
		CAM_ERR(CAM_CRM, "link:%s dump_rq->lnk_hdl:%x link->lnk_hdl:%x",
			CAM_IS_NULL_TO_STR(link), dump_req->link_hdl,
			(!link) ? CAM_REQ_MGR_DEFAULT_HDL_VAL : link->link_hdl);
		rc = -EINVAL;
		goto end;
	}
+2 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */
#ifndef _CAM_REQ_MGR_CORE_H_
#define _CAM_REQ_MGR_CORE_H_
@@ -18,6 +19,7 @@
#define CAM_REQ_MGR_WATCHDOG_TIMEOUT_MAX      50000
#define CAM_REQ_MGR_SCHED_REQ_TIMEOUT         1000
#define CAM_REQ_MGR_SIMULATE_SCHED_REQ        30
#define CAM_REQ_MGR_DEFAULT_HDL_VAL           0

#define FORCE_DISABLE_RECOVERY  2
#define FORCE_ENABLE_RECOVERY   1
+10 −0
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) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/module.h>
@@ -992,7 +993,16 @@ static int32_t cam_eeprom_init_pkt_parser(struct cam_eeprom_ctrl_t *e_ctrl,
					rc = -EINVAL;
					goto end;
				}

				if ((num_map + 1) >=
					(MSM_EEPROM_MAX_MEM_MAP_CNT *
					MSM_EEPROM_MEMORY_MAP_MAX_SIZE)) {
					CAM_ERR(CAM_EEPROM, "OOB error");
					rc = -EINVAL;
					goto end;
				}
				/* Configure the following map slave address */

				map[num_map + 1].saddr = i2c_info->slave_addr;
				rc = cam_eeprom_update_slaveInfo(e_ctrl,
					cmd_buf);
+4 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#ifndef _CAM_DEBUG_UTIL_H_
#define _CAM_DEBUG_UTIL_H_

#define CAM_IS_NULL_TO_STR(ptr) ((ptr) ? "Non-NULL" : "NULL")

/* Module IDs used for debug logging */
#define CAM_CDM        (1 << 0)
#define CAM_CORE       (1 << 1)
#define CAM_CPAS       (1 << 2)