Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp530478imm; Wed, 4 Jul 2018 01:12:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfBREn9cYch5HmhDBqko777/JJZp+OkTB2K8UlmiaHwz1ZbLYVw2MHoWdkkUdlYq8AxT+ly X-Received: by 2002:a62:398c:: with SMTP id u12-v6mr1139449pfj.9.1530691972068; Wed, 04 Jul 2018 01:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530691972; cv=none; d=google.com; s=arc-20160816; b=KbudTqTblc5snuFVHfzgkVGmFNQT5BfhmbJx1P2u6fxip06DYd080hhOHNY0C7fWlX a5x55VhU4Iy8ukO2L4q2zF6neoQxM2OiHk2rv5AYZVMLOPDrHt9Z0riOQOuRpBBuOptR TYWasIIAJqzUgd+dZEfsSFP08YdXFWaZLM17Pmsn4tXwSNrmUlpMNx6NPAJFm5tNSUuV JOPY2Iz9wZTCmqBcBuOppJugW1K0Qwm0QtFHrGB6HYV4ByAtfM8tOsz2BIuuAUPLr4nh f0fWNjIpLqfLcO+18OlhBjZGuYCtIMot6lhk9fd2JShAnQXQKMCl+eegSS5FCgsDPNJu cAlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=Z43iO4gZRO9fiWW2cfXZroR1yCwIO1JgGMmwRXkSVBE=; b=qdKwOk1KVcHuug0JB6Pbp/FiAEFwC9OblTzHU2WrR+pjk1OMWsS97n+zbOf4QT7rdB vN1l63gDSkWmYDSukMOc9Ysx7MhI5JgbDpIKIiHy+8eWewaETxcVoAQAYnkWJjV+W4Gd gn0jbDNwT4srljKjNZxuVO11WdrG/DHRBw6BtMRS7ss+zYWmyL6Vn9ACh+9S6zbSGWkH fWWmlU9W18q+s6mKfQ5VFP/YSE4Eh1r6AGOnHTPTRu5jf1wKxZU1K7TvgmA9RteBrde2 Vcwu38l51z9YIPN6z6pKbCchEbFv4iKs+HbFA893S1TI4Qfl3GoDKQE/ZCnE9oN5zdg6 8OwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=DQNPX1f+; dkim=pass header.i=@codeaurora.org header.s=default header.b=jtHs1Z6p; 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 j6-v6si2915060pgn.416.2018.07.04.01.12.37; Wed, 04 Jul 2018 01:12:52 -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=DQNPX1f+; dkim=pass header.i=@codeaurora.org header.s=default header.b=jtHs1Z6p; 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 S933982AbeGDIKg (ORCPT + 99 others); Wed, 4 Jul 2018 04:10:36 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39784 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933581AbeGDII1 (ORCPT ); Wed, 4 Jul 2018 04:08:27 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2319660B24; Wed, 4 Jul 2018 08:08:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530691707; bh=fVpryNB8r09EDxwbPDU2TBjHO3ah4wiPNwQYPzUSjLM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DQNPX1f+UJBoO9RclzkPRI+bXyDktmdxydypNEFEA1ZzVhzYi54IYbVKVwe3HlPJU 3AoNUxxU1216aZyNOBLG+TT8V0p3Vz4k2jANEJoc3kz5DKx6r3XyJ7tknn/v74ioZR pc1H36onxKAAQpAes/m/ySjA03Jncpyb/uma3llo= 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 mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 4B65C606AC; Wed, 4 Jul 2018 08:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530691706; bh=fVpryNB8r09EDxwbPDU2TBjHO3ah4wiPNwQYPzUSjLM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jtHs1Z6pQi5+4y/uXBGQNtlaxtvR75dvn0poF4QHaAvq3iFb85wTMZKsrXa26G/w6 oK1SInXsEpHxFQpsjnbzeNJCouS695KYoVK5poh9LGQFv9e+4Fb9MM/o6kWs9S17+d 60t6bajvA274hc7XM0rCkCGulTynBYTQV3sDJSeE= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 04 Jul 2018 13:38:26 +0530 From: Vikash Garodia To: Stanimir Varbanov Cc: hverkuil@xs4all.nl, mchehab@kernel.org, robh@kernel.org, mark.rutland@arm.com, andy.gross@linaro.org, bjorn.andersson@linaro.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, acourbot@chromium.org Subject: Re: [PATCH v2 2/5] media: venus: add a routine to set venus state In-Reply-To: References: <1527884768-22392-1-git-send-email-vgarodia@codeaurora.org> <1527884768-22392-3-git-send-email-vgarodia@codeaurora.org> Message-ID: <1b9ba366cc8484e4f2ef1510a8f57b38@codeaurora.org> X-Sender: vgarodia@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stanimir, Thanks for your valuable comments. On 2018-06-04 19:20, Stanimir Varbanov wrote: > Hi Vikash, > > Thanks for the patch! > > On 1.06.2018 23:26, Vikash Garodia wrote: >> Add a new routine which abstracts the TZ call to > > Actually the new routine abstracts Venus CPU state, Isn't it? Yes, its a Venus CPU state controlled by TZ. I can mention it as an abstraction of venus CPU state. >> set the video hardware state. >> >> Signed-off-by: Vikash Garodia >> --- >> drivers/media/platform/qcom/venus/core.h | 5 +++++ >> drivers/media/platform/qcom/venus/firmware.c | 28 >> +++++++++++++++++++++++++++ >> drivers/media/platform/qcom/venus/firmware.h | 1 + >> drivers/media/platform/qcom/venus/hfi_venus.c | 13 ++++--------- >> 4 files changed, 38 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/media/platform/qcom/venus/core.h >> b/drivers/media/platform/qcom/venus/core.h >> index 85e66e2..e7bfb63 100644 >> --- a/drivers/media/platform/qcom/venus/core.h >> +++ b/drivers/media/platform/qcom/venus/core.h >> @@ -35,6 +35,11 @@ struct reg_val { >> u32 value; >> }; >> >> +enum tzbsp_video_state { >> + TZBSP_VIDEO_SUSPEND = 0, >> + TZBSP_VIDEO_RESUME >> +}; > > please move this in firmware.c, for more see below. > >> + >> struct venus_resources { >> u64 dma_mask; >> const struct freq_tbl *freq_tbl; >> diff --git a/drivers/media/platform/qcom/venus/firmware.c >> b/drivers/media/platform/qcom/venus/firmware.c >> index 7d89b5a..b4664ed 100644 >> --- a/drivers/media/platform/qcom/venus/firmware.c >> +++ b/drivers/media/platform/qcom/venus/firmware.c >> @@ -53,6 +53,34 @@ static void venus_reset_hw(struct venus_core *core) >> /* Bring Arm9 out of reset */ >> writel_relaxed(0, reg_base + WRAPPER_A9SS_SW_RESET); >> } >> + >> +int venus_set_hw_state(enum tzbsp_video_state state, struct >> venus_core *core) > > can we put this function this way: > > venus_set_state(struct venus_core *core, bool on) > > so we set the state to On when we are power-up the venus CPU and Off > when we power-down. > > by this way we really abstract the state, IMO. Good point. Will do in similar way. >> +{ >> + int ret; >> + struct device *dev = core->dev; >> + void __iomem *reg_base = core->base; > > just 'base' should be enough. Infact, comment from Jordan, we can remove it altogether. >> + >> + switch (state) { >> + case TZBSP_VIDEO_SUSPEND: >> + if (qcom_scm_is_available()) > > You really shouldn't rely on this function (see the comment from Bjorn > on first version of this patch series). > > I think we have to replace qcom_scm_is_available() with some flag which > is reflecting does the firmware subnode is exist or not. In case it is > not exist the we have to go with TZ scm calls. As we discussed, will keep it under the check for a valid firmware device. We can avoid the extra flag in that way. >> + ret = qcom_scm_set_remote_state(TZBSP_VIDEO_SUSPEND, 0); >> + else >> + writel_relaxed(1, reg_base + WRAPPER_A9SS_SW_RESET); >> + break; >> + case TZBSP_VIDEO_RESUME: >> + if (qcom_scm_is_available()) >> + ret = qcom_scm_set_remote_state(TZBSP_VIDEO_RESUME, 0); >> + else >> + venus_reset_hw(core); >> + break; >> + default: >> + dev_err(dev, "invalid state\n"); >> + break; >> + } >> + return ret; >> +} >> +EXPORT_SYMBOL_GPL(venus_set_hw_state); >> + > > regards, > Stan