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

Commit b2351642 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: csiphy: Fallback to SCM6 on Failure"

parents 53c718f6 0b88c87e
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;
	}