Received: by 10.192.165.148 with SMTP id m20csp4734818imm; Tue, 24 Apr 2018 07:36:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/FqZsQRl1Kt3vn+sCO+PoC8ILggdetSXAUdW8JYGxp95OeSEsmTN8VVc8OPN7AOo1KUdAX X-Received: by 2002:a17:902:5697:: with SMTP id j23-v6mr23626713pli.383.1524580608914; Tue, 24 Apr 2018 07:36:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524580608; cv=none; d=google.com; s=arc-20160816; b=gAtnAII9dVKCqomeQkgBAEyGfrkXf45kyAgtZJqDGj9qnDCECEX1OQ64MlArD95VqO aQ6lrOOjbB9RW5lYQEOO0MgQAVhstOL/FfI+HqciE70X+7JewBK6HOIouayBaljd2xB0 MwyDPQg1nKIdT/LG3Y1IxFiirxOP8T4fXmFycxzcBsKoJ/UyhY/hN/4OmT0IzwT3YqcD 6stKm9IT0bUF42S1hzM+rnTTbW01LbF/nS9GV7i8AiC4Jndtgfacf1BVwBpwcoFWukLw H2bkq6RJ4a96gmsFxShoYq/3mRiC5jXQhmP4g1gJSBTI0KSr3ktID87SBk/0BgBx44tp 1LiA== 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:dkim-signature:arc-authentication-results; bh=tXBb5tYdSbXkg5a6q0eFfK/urVaFEKtwD4nw6O+n0Dw=; b=V64d9SFMgmKNnL3u+qMTZhqciW4R/vraDMa64hb0YUwWsxIdBaasht4CX1UNs/HD7F bj6iTHS5MkSN5N3kE6SBVBuvOjsjcdfy235g/HAkSql2V+c9vfgDQfVwDv6vrCDgT378 V2wJWU9idPKEkBvX1I6PzJI1lj2weaLUrwMY89DQcdGxAVAnHrzJAmFvhxCWwd4gqUyE Fha+NZlSjmpbE52SvbS6lxCZvlSQy+ejTRKCMDVvWpakfReSPOpY58PxGwl3fCmHDQ9c M0ZAXHESq0aMhN5MYIfRwe8xvgl72nz5KmcpEbtiUK7mn8IYs6WXc74n2WbVr0OEc5jT s3/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F4CgnLgm; 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 e7si11071854pgr.634.2018.04.24.07.36.34; Tue, 24 Apr 2018 07:36: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=F4CgnLgm; 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 S933270AbeDXMyj (ORCPT + 99 others); Tue, 24 Apr 2018 08:54:39 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:42929 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757823AbeDXMpR (ORCPT ); Tue, 24 Apr 2018 08:45:17 -0400 Received: by mail-wr0-f195.google.com with SMTP id s18-v6so49791766wrg.9 for ; Tue, 24 Apr 2018 05:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tXBb5tYdSbXkg5a6q0eFfK/urVaFEKtwD4nw6O+n0Dw=; b=F4CgnLgm0e0sJKuvkyC6UCBNumBvHO4YzWHD/JmYD8jFYBP7sT+XIDaNrW/rrac1o8 xkPmf05pSBNUd6plY2/G6+W54i9tcjx4uE5ulVfaC8mb9GnHR1BOiX4whxv4xUwMLZzU ISmPq0lt1cmgHSCxVpsjzGE7jxzJ5dz6UGXoU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tXBb5tYdSbXkg5a6q0eFfK/urVaFEKtwD4nw6O+n0Dw=; b=rAdd833KVgXcM409o4jAcKAkNCvXi4HtLzkjgFElEa1W8kC6pC9s+2x+egTlPkv//x PflD7jDSayVThetyeQFDJngUDuxaWeDSbRFQyYYUAgpTmQph+vQ0di/3fbPiw34nWrkr HbDSW6S2HePhpgh0oC0XhmtCQWMeinJCgDgDCvBn1i55eXClqOSC7fCVi0W3WCbF8i3O k6YcKNtyPIyHKRu+5JkbK0Mijzn2F4CGS/TYWHZs9Nl3xHzfclj/2s0rpo2anDRq1oT4 c/Dtt8AnXlhvnBsx71DBCS8fMdTAwxbEg+BAwlKdld2W/ElLSc16NOmsPwg/XzxJCQjO iuGw== X-Gm-Message-State: ALQs6tCvbAdw+l1T5d95E0dxhfakBnEjaSl4YXU1+7fDvULiorGz1asr vI9tvTFkzTUheiQqRcnv8fnjCQ== X-Received: by 2002:adf:82ce:: with SMTP id 72-v6mr20436848wrc.60.1524573915722; Tue, 24 Apr 2018 05:45:15 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id n49-v6sm22666013wrn.50.2018.04.24.05.45.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:15 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Stanimir Varbanov Subject: [PATCH 08/28] venus: hfi_venus: add suspend function for 4xx version Date: Tue, 24 Apr 2018 15:44:16 +0300 Message-Id: <20180424124436.26955-9-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180424124436.26955-1-stanimir.varbanov@linaro.org> References: <20180424124436.26955-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } -- 2.14.1