Received: by 10.192.165.148 with SMTP id m20csp5577345imm; Wed, 9 May 2018 07:15:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpo+TrcnwmugjGrG7mIC5Cf0AC3Fg6NhttLGNbj8HvDAfEh6V3vqSmASpHXnWcr/OJ1NnJs X-Received: by 10.167.130.208 with SMTP id f16mr29676546pfn.199.1525875325900; Wed, 09 May 2018 07:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525875325; cv=none; d=google.com; s=arc-20160816; b=insfxSJ1kt9g9hfqnnLBz/10gCKbD1RxKr+mDHPJaxCEbWxYjb/62BYRRQg83GykKN C5qKNpmmelnIiWnmMggwkU69Fc5NeRefu2XqEvfqOwHrDMck51W3o74lW34kHIqZjXzI W6st6CZKJfwOYWZQ8YvKG1W7vpwaX91H0lo9N+cwmhaDvDR83A2iwDmb7i5q/fAvuAnx +uY/gQa/p79F8w6P8z4ySSknAvKesCDIJq0qoAfJh104yk4rkWbPq9w6+Tcyg4o1h3Rq B1X6SgTnGudlHAT3Dg5Oitmmgpsm54soaZgTdmEKOco6oEqa4zyF5VBiEK0Cm7/M2vbN JzsA== 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=QoWEdK9cx6vBNTDGI1M6aJok/h4YynO21Yi7O5DwFXg=; b=ld4V5BGVCZ9JdwJrCjnstlMSoN3i3Z1vMmfNwHpW2Zz7bd11FLu0Vk9zhIFpe5I9np SN7VrHS2+JH4yg9QH/ip1XNGy/Zgi2gR1X5rv+IsFF//Hbje18WeC2G8YUxckPuutuKa TW1gZ1ymqUCdC2oPpqlndK7itkPfZ6dIb0zAG5zHLh0fYlZSDX/FqPHwq+K1yxVCxFR3 hxBiLOqNuu91Suj+AOMsqyRqglrL5E2GaxSTzfnVpSgILkbMtDP80OHfPPlEc+v7oZEu N5if5Qq4EQuQ3GRq7b0a3AUEfbf3ug9fDLwW0fGTR8ION4SArjRpyEddQ8Gt03TTG1AU +lGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Bpel/H7y; dkim=pass header.i=@codeaurora.org header.s=default header.b=Knq92/9L; 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 w189-v6si21722402pgb.602.2018.05.09.07.15.10; Wed, 09 May 2018 07:15:25 -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=Bpel/H7y; dkim=pass header.i=@codeaurora.org header.s=default header.b=Knq92/9L; 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 S1756597AbeEIOOo (ORCPT + 99 others); Wed, 9 May 2018 10:14:44 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39342 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751000AbeEIOOm (ORCPT ); Wed, 9 May 2018 10:14:42 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 21BA560C66; Wed, 9 May 2018 14:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525875282; bh=cO7qcu62Go3fWuD+De2FwbeoBWbvfpsVHjA3IKI7ih8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Bpel/H7yXosgYFSG9hSa6hCgHyuqW20HjE/MhRnpIINNPsiHxhabYcB3XDNL5qVdy ZvQ+fUnljmiEihJTXkby4e1kmCokBqY8A0M9Qr+we63mgo3HZ25eHBRGN2a69erQe1 J6y/GNnX4M/O4KITMIvPitAxX5bZ25TxCRVCQpLY= 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 8BA0960F74; Wed, 9 May 2018 14:14:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525875281; bh=cO7qcu62Go3fWuD+De2FwbeoBWbvfpsVHjA3IKI7ih8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Knq92/9LMadtVmEeO0PotlbC29GU7frE58c77NBgwYfWpcVSCAWD2TBadnVuu5OEp elNeIlK5KgHvJTt7O7NJ9U8pQypWAWF/VoVST9bbAnXwdRK5pSlas05CDvMZshrlc5 37sL4qEo0h1k1W5RlYDDfscomw+/8R4QfyX1TwPI= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Wed, 09 May 2018 19:44:41 +0530 From: Vikash Garodia To: Stanimir Varbanov Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-media-owner@vger.kernel.org Subject: Re: [PATCH 08/28] venus: hfi_venus: add suspend function for 4xx version In-Reply-To: References: <20180424124436.26955-1-stanimir.varbanov@linaro.org> <20180424124436.26955-9-stanimir.varbanov@linaro.org> <8f26cd748f283043b32da05b39f29348@codeaurora.org> Message-ID: <4bb351351a9725db42bf06da1e778290@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, On 2018-05-09 16:45, Stanimir Varbanov wrote: > Hi Vikash, > > On 05/02/2018 09:07 AM, vgarodia@codeaurora.org wrote: >> Hello Stanimir, >> >> On 2018-04-24 18:14, Stanimir Varbanov wrote: >>> This adds suspend (power collapse) function with slightly >>> different order of calls comparing with Venus 3xx. >>> >>> Signed-off-by: Stanimir Varbanov >>> --- >>>  drivers/media/platform/qcom/venus/hfi_venus.c | 52 >>> +++++++++++++++++++++++++++ >>>  1 file changed, 52 insertions(+) >>> >>> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c >>> b/drivers/media/platform/qcom/venus/hfi_venus.c >>> index 53546174aab8..f61d34bf61b4 100644 >>> --- a/drivers/media/platform/qcom/venus/hfi_venus.c >>> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c >>> @@ -1443,6 +1443,55 @@ static int venus_suspend_1xx(struct venus_core >>> *core) >>>      return 0; >>>  } >>> >>> +static int venus_suspend_4xx(struct venus_core *core) >>> +{ >>> +    struct venus_hfi_device *hdev = to_hfi_priv(core); >>> +    struct device *dev = core->dev; >>> +    u32 val; >>> +    int ret; >>> + >>> +    if (!hdev->power_enabled || hdev->suspended) >>> +        return 0; >>> + >>> +    mutex_lock(&hdev->lock); >>> +    ret = venus_is_valid_state(hdev); >>> +    mutex_unlock(&hdev->lock); >>> + >>> +    if (!ret) { >>> +        dev_err(dev, "bad state, cannot suspend\n"); >>> +        return -EINVAL; >>> +    } >>> + >>> +    ret = venus_prepare_power_collapse(hdev, false); >>> +    if (ret) { >>> +        dev_err(dev, "prepare for power collapse fail (%d)\n", ret); >>> +        return ret; >>> +    } >>> + >>> +    ret = readl_poll_timeout(core->base + CPU_CS_SCIACMDARG0, val, >>> +                 val & CPU_CS_SCIACMDARG0_PC_READY, >>> +                 POLL_INTERVAL_US, 100000); >>> +    if (ret) { >>> +        dev_err(dev, "Polling power collapse ready timed out\n"); >>> +        return ret; >>> +    } >>> + >>> +    mutex_lock(&hdev->lock); >>> + >>> +    ret = venus_power_off(hdev); >>> +    if (ret) { >>> +        dev_err(dev, "venus_power_off (%d)\n", ret); >>> +        mutex_unlock(&hdev->lock); >>> +        return ret; >>> +    } >>> + >>> +    hdev->suspended = true; >>> + >>> +    mutex_unlock(&hdev->lock); >>> + >>> +    return 0; >>> +} >>> + >>>  static int venus_suspend_3xx(struct venus_core *core) >>>  { >>>      struct venus_hfi_device *hdev = to_hfi_priv(core); >>> @@ -1507,6 +1556,9 @@ static int venus_suspend(struct venus_core >>> *core) >>>      if (core->res->hfi_version == HFI_VERSION_3XX) >>>          return venus_suspend_3xx(core); >>> >>> +    if (core->res->hfi_version == HFI_VERSION_4XX) >>> +        return venus_suspend_4xx(core); >>> + >>>      return venus_suspend_1xx(core); >>>  } >> >> Let me brief on the power collapse sequence for Venus_4xx >> 1. Host checks for ARM9 and Video core to be idle. >>    This can be done by checking for WFI bit (bit 0) in CPU status >> register for ARM9 and by checking bit 30 in Control status reg for >> video >> core/s. >> 2. Host then sends command to ARM9 to prepare for power collapse. >> 3. Host then checks for WFI bit and PC_READY bit before withdrawing >> going for power off. >> >> As per this patch, host is preparing for power collapse without >> checking >> for #1. >> Update the code to handle #3. > > This looks similar to suspend for Venus 3xx. Can you confirm that the > sequence of checks for 4xx is the same as 3xx? Do you mean the driver implementation for Suspend Venus 3xx or the hardware expectation for Venus 3xx ? If hardware expectation wise, the sequence is same for 3xx and 4xx. In the suspend implementation for 3xx, i see that the host just reads the WFI and idle status bits, but does not validate those bit value before preparing Venus for power collapse. Sequence #2 and #3 is followed for Venus 3xx implementation.