From patchwork Thu May 17 11:32:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikash Garodia X-Patchwork-Id: 10406655 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 81DD660230 for ; Thu, 17 May 2018 11:34:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70CD828A43 for ; Thu, 17 May 2018 11:34:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65A9328A6A; Thu, 17 May 2018 11:34:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1389128A43 for ; Thu, 17 May 2018 11:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752130AbeEQLdS (ORCPT ); Thu, 17 May 2018 07:33:18 -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= 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;