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

Commit 0b88c87e authored by Tony Lijo Jose's avatar Tony Lijo Jose Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: csiphy: Fallback to SCM6 on Failure



Sometimes TZ side images won't have support for SCM7 call in this cases
we need to fallback to SCM6 call.

Change-Id: I276547cfddfc1c12784f43f790440f8c5ed53330
Signed-off-by: default avatarTony Lijo Jose <tjose@codeaurora.org>
parent 4d59850f
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, 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
@@ -31,6 +31,7 @@ static int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev,
	bool protect, int32_t offset)
{
	struct scm_desc desc = {0};
	int result = -1;

	if (offset >= CSIPHY_MAX_INSTANCES)
		return -EINVAL;
@@ -38,8 +39,19 @@ static int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev,
	desc.args[0] = protect;
	desc.args[1] = csiphy_dev->csiphy_cpas_cp_reg_mask[offset];

	if (scm_call2(SCM_SIP_FNID(SCM_SVC_CAMERASS, SECURE_SYSCALL_ID_2),
		&desc)) {
	/*
	 * If SECURE_SYSCALL_ID_2 is not supported
	 * then fallback to SECURE_SYSCALL_ID
	 */
	result = scm_call2(SCM_SIP_FNID(SCM_SVC_CAMERASS, SECURE_SYSCALL_ID_2),
		&desc);
	if (result == -EOPNOTSUPP) {
		desc.args[1] = csiphy_dev->soc_info.index;
		CAM_ERR(CAM_CSIPHY, "SCM CALL 7 not supported fallback to 6");
		result = scm_call2(SCM_SIP_FNID(SCM_SVC_CAMERASS,
						SECURE_SYSCALL_ID), &desc);
	}
	if (result) {
		CAM_ERR(CAM_CSIPHY, "scm call to hypervisor failed");
		return -EINVAL;
	}