Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3164348imm; Thu, 17 May 2018 04:34:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoVaRvWqaAGZ9ryQADaoJNgSa5/5ZfK1JKD8Wnrgf+gSHZzGEvZYgvV5LUvwyC2qD1w4S68 X-Received: by 2002:a62:f909:: with SMTP id o9-v6mr4850291pfh.256.1526556875785; Thu, 17 May 2018 04:34:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526556875; cv=none; d=google.com; s=arc-20160816; b=1KGgbKnhM7OItw20H8XXc3SwzdWqxkczWiQjENoPqo2mN7Zt4rlgDtEaZIhbEHWV6Z P70/qheYJDlPeG//S7LU2psigYF8iBjSu4bX1IjOedYvENyUdKX0Yi/QIg0lIfMDHdxG W5rJZDBchHXlnr3xkb4KG8+dXlM4/U7Kx396OwBMU7QeRJScOt/XTdmFimJFFqFzaIAs emDaCF1LcPMMpri9BOP4LEY9PyG9qFPzlciTCBiPNwLzn93aZBV8UQIwzKQNrrf69XVd EqkIvjiNTK6mnc81+gLJ6DvNbom+CTfPideHH4BTVgo5YxEBDkYubef5c11YIJOh6ft9 w7Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=9zDWPmDQwh6wQPYYYbRgehyIVG9Ag5y03RAPqvvXaxs=; b=j7sv42VI64NNup0cnZiaWJuevgc0e8RexF/gYvgX0WimB8UtnRxap9dhwRnPWdKgPd RyyqYkD7w48iS81h6KRSyPPbfSNl2izKqHbaPTTOBNxx7CO2ZpMZaXakZcUbRYJe5SQj y9Wy7RUJcm2sJPmxAfQipUirIzIQGnazdjTZugK3lhjKFqOhw/h35RZWz8X5mOkbZue/ 1SxSOkxagsWUel5wnK7Ne2R+kuIuoKgHnwM9o4DuWqjejTyuZhatuLwL1PywsQnc3AD6 zBsdMFaSAwtu48DJeSfCyDtvW/bRaX1u5qZ+aGryE7EdvS6GEfSJnGiP9nIOrv4RBMNH gH3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=mFQfUZ1o; dkim=pass header.i=@codeaurora.org header.s=default header.b=dNHbyWKl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w68-v6si5131209pfb.325.2018.05.17.04.34.21; Thu, 17 May 2018 04:34:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=mFQfUZ1o; dkim=pass header.i=@codeaurora.org header.s=default header.b=dNHbyWKl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752162AbeEQLdT (ORCPT + 99 others); Thu, 17 May 2018 07:33:19 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:60614 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751097AbeEQLdQ (ORCPT ); Thu, 17 May 2018 07:33:16 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id EAE77609D1; Thu, 17 May 2018 11:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526556795; bh=F52Un+YLDTtaYnM17SQ5Txvc3Xaupajninmgma6SlJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mFQfUZ1optwc95/h4r+dm62SMy1tLy3qguKNDXU1C3x1YihmO6MOJUYSztaGO1S48 e9en90CGm+wWA3s+8nS2D/xEqXFAR1/t1CoTeBjRVo6WVb//2d5HKe8ehwTQUvL9ZO HNVLVSkLrDcASBh+f6kt2dhXTvCvmAC4lR8qHzH0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from vgarodia-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vgarodia@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C2ED9609D1; Thu, 17 May 2018 11:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526556794; bh=F52Un+YLDTtaYnM17SQ5Txvc3Xaupajninmgma6SlJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dNHbyWKlfzgPL0i5HEC9STB7p9LUwyOJ43GXhbNBy8QT4hDJdxcrtS60+YSKEUe5J 67DkJPnQ9dHiMSGIHp3MLyfGbqoFfq4qiwGLhRMiPoprZFPo9rlBEzdAOsKAkCjobT T5iPzPFHPr+cfa6AIN4NooACU8iDg6J3a02FIJkU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C2ED9609D1 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vgarodia@codeaurora.org From: Vikash Garodia To: hverkuil@xs4all.nl, mchehab@kernel.org, andy.gross@linaro.org, bjorn.andersson@linaro.org, stanimir.varbanov@linaro.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, acourbot@google.com, Vikash Garodia Subject: [PATCH 3/4] venus: add check to make scm calls Date: Thu, 17 May 2018 17:02:19 +0530 Message-Id: <1526556740-25494-4-git-send-email-vgarodia@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1526556740-25494-1-git-send-email-vgarodia@codeaurora.org> References: <1526556740-25494-1-git-send-email-vgarodia@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to invoke scm calls, ensure that the platform has the required support to invoke the scm calls in secure world. This code is in preparation to add PIL functionality in venus driver. Signed-off-by: Vikash Garodia --- drivers/media/platform/qcom/venus/hfi_venus.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index f61d34b..9bcce94 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -27,6 +27,7 @@ #include "hfi_msgs.h" #include "hfi_venus.h" #include "hfi_venus_io.h" +#include "firmware.h" #define HFI_MASK_QHDR_TX_TYPE 0xff000000 #define HFI_MASK_QHDR_RX_TYPE 0x00ff0000 @@ -570,13 +571,19 @@ static int venus_halt_axi(struct venus_hfi_device *hdev) static int venus_power_off(struct venus_hfi_device *hdev) { int ret; + void __iomem *reg_base; if (!hdev->power_enabled) return 0; - ret = qcom_scm_set_remote_state(TZBSP_VIDEO_STATE_SUSPEND, 0); - if (ret) - return ret; + if (qcom_scm_is_available()) { + ret = qcom_scm_set_remote_state(TZBSP_VIDEO_STATE_SUSPEND, 0); + if (ret) + return ret; + } else { + reg_base = hdev->core->base; + writel_relaxed(1, reg_base + WRAPPER_A9SS_SW_RESET); + } ret = venus_halt_axi(hdev); if (ret) @@ -594,9 +601,13 @@ static int venus_power_on(struct venus_hfi_device *hdev) if (hdev->power_enabled) return 0; - ret = qcom_scm_set_remote_state(TZBSP_VIDEO_STATE_RESUME, 0); - if (ret) - goto err; + if (qcom_scm_is_available()) { + ret = qcom_scm_set_remote_state(TZBSP_VIDEO_STATE_RESUME, 0); + if (ret) + goto err; + } else { + venus_reset_hw(hdev->core); + } ret = venus_run(hdev); if (ret) @@ -607,7 +618,8 @@ static int venus_power_on(struct venus_hfi_device *hdev) return 0; err_suspend: - qcom_scm_set_remote_state(TZBSP_VIDEO_STATE_SUSPEND, 0); + if (qcom_scm_is_available()) + qcom_scm_set_remote_state(TZBSP_VIDEO_STATE_SUSPEND, 0); err: hdev->power_enabled = false; return ret; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project