Received: by 10.192.165.148 with SMTP id m20csp5382458imm; Wed, 9 May 2018 04:15:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpjNPMgKQOkYqeZtSOALrapvH8ac5oLxDil4LHrGMPpBvNmLa/rGtP55lJMDubs5/+xoIho X-Received: by 2002:a17:902:40d:: with SMTP id 13-v6mr45280746ple.117.1525864549037; Wed, 09 May 2018 04:15:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525864548; cv=none; d=google.com; s=arc-20160816; b=FrTYXYkSvD+++Hl+GiVBeuEKIpNXrfAFukh1XelDn7IZiUPtb4E0dSP3cCmX5q3+Ij 9n5guQrZivR5CISFgDgHZH0IH4I49FML17pVaPV5aEg3pqKvgH9HfwVh4/+JufhlEf2d 51VHrJALA9xciV1e0mq9zWTzgd696pkGxZh5UqqSaqktMXhiAf348HISskFEVUfKcSa3 vVetTk9MkfyFrZDYPdlWkRLqXjQUYO16Y08Ugt1UcBxMYSLgTbYA9lF2FR6hH9aTTG/M 1Cu8CRqREXliAF4XFdXJ+lIurvkhtHYnEZW81fBilYQS2TdzPUoFHYFnXsnT9/5/eyeW cs8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=LLIDmmijnZzE5WqOgv3egJmyWVIEuLXQmQjabiL766A=; b=jEc7s3gAUcpZSSVXMa537z4w7xUxtOjD4mxqsFognMe775WuVLs0nyIogUaaZvZpDE AaaAGy7TuA1g9wW3qQmIZFEzKQRVZoPajl+5h5xXAqhY53l576n0tqCI3ICIyzzqIXrT Er/WCgnVhv0C9Fs90A42HEw51DeWofXFNEjYQTw5PIzVPw5ZLycnSMcBAba2bDsxINAL SEjKSvtk5Ak3vKQzwfnNG41C2TVRJ0f4OI3K+jTE703gobnmWdiu1ojgC4gitL2HuwI+ OM88ZVO7vs32qVdp4qkvtVdsNna+SuXZ1BD156xnw3dc6+eOEqHI394HOgWbUkoQd6nM SlxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k4F21IpT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l30-v6si26086692plg.420.2018.05.09.04.15.34; Wed, 09 May 2018 04:15:48 -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=@linaro.org header.s=google header.b=k4F21IpT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933941AbeEILPW (ORCPT + 99 others); Wed, 9 May 2018 07:15:22 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:53033 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756166AbeEILPT (ORCPT ); Wed, 9 May 2018 07:15:19 -0400 Received: by mail-wm0-f65.google.com with SMTP id w194so23874043wmf.2 for ; Wed, 09 May 2018 04:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=LLIDmmijnZzE5WqOgv3egJmyWVIEuLXQmQjabiL766A=; b=k4F21IpTMAy6NAJIIXCOMgIkajty5Q7N4kafQtdDmmHRdNHC+hC5RvL0PcHb9Z65A2 u/zU3E5Gi/Z+yVMDdYPKmWZSEMn0CsNvgkzx+GSn87uvg5tM1Gna8HrWjFZDolxlQLA3 Wl4UcV3ibwbgtzs5wYpJnuoICWajr7omMa+pA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=LLIDmmijnZzE5WqOgv3egJmyWVIEuLXQmQjabiL766A=; b=Y/ktB/SE/dxRiUR73UCzQoDfR9GV1oVt6lBonT5GJFq+h1+qMWkNgXIv2ERJUnC1iz jb2pBLYbOJqfl76/Oj/I1bbsRyx7efGf3gODfjKyrhOdm0bvGtr9fSYKWcwlrRe/loCz O9V4ysi2ww+GAMiqrM0UkajLihQs4jSm7ZB5YWGvgCJovMIDJGMJpe6JxNIf1xlNIU6J S9Bn4cUa1u3ABz8MOyTwJ4Jc+2UqRSGOh4XPfGMgtAK84aOZ9toIM2LFHTok8PuU27nX GHd1SVLNljsT+BJv7t5vlg2L/kf9A4kvXSTcbh9d7XchopH4zHUfyw5XG79A7xmht44u /HgA== X-Gm-Message-State: ALQs6tBF9R0ajx9FEjM2fjxZslswdVp+rRxyEZ2gwwTpD6i+EkIqv1qa t2J60WDpr1Uf11tVnkIrZaTZ/A== X-Received: by 2002:a50:b204:: with SMTP id o4-v6mr53580810edd.184.1525864518351; Wed, 09 May 2018 04:15:18 -0700 (PDT) Received: from [192.168.27.209] ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id m20-v6sm14446563edq.46.2018.05.09.04.15.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 04:15:17 -0700 (PDT) Subject: Re: [PATCH 08/28] venus: hfi_venus: add suspend function for 4xx version To: vgarodia@codeaurora.org, Stanimir Varbanov Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20180424124436.26955-1-stanimir.varbanov@linaro.org> <20180424124436.26955-9-stanimir.varbanov@linaro.org> <8f26cd748f283043b32da05b39f29348@codeaurora.org> From: Stanimir Varbanov Message-ID: Date: Wed, 9 May 2018 14:15:16 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <8f26cd748f283043b32da05b39f29348@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? -- regards, Stan