From patchwork Tue Apr 24 12:44:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 134100 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2198787lji; Tue, 24 Apr 2018 05:53:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx49l2kBydBdVorVFrHvG67s5AlWLMNzUOLSDW55pLjRv8ZGZQY8QRpy08CjyAz/bF+b4BweR X-Received: by 10.101.96.205 with SMTP id r13mr8729782pgv.22.1524574422935; Tue, 24 Apr 2018 05:53:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574422; cv=none; d=google.com; s=arc-20160816; b=rPnLxfBTq89zWi5wEPIGak2nQbglK3LXfE63bdw/sZAsxtsSPOjNL65rv0D3zO88tw FSuW+iAXamFOYeuSxUSuYp7zd+NGvi2XxT/Flv7rXWbtdCGVYKyNRici8rquOjnKffpS eOO/G/76bicWrIblO4kvNqaUtkduecYCwvZ8wZPa5rr2yjkVmvymV5PsyC2+GZA+w1Ta ZPz3ute6HM2xEiez4rkiPl1cKdUQYCzWu+s2X9aLU8Q0Tm6jENRkjY/4DpLDA2Hng8Cw CzynW1y/JnThgOwv6q79dq6m7G6vsuO4CMY0FppCE8JpueS9AOdmOLrgRsmSpN6UmqpZ h/hQ== 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=ranS/GvgSu/hXiF+BOsHnRJTM1PZETANBozCuYa/8wA=; b=NuIdx1T5GxbJIvryNinmUL1uy65dcUj0M1dREV9dF+L+YcuQ0m1m4+9zaSRnhtezAn p8e3wu5fQFpeawrUAtnEXM1marWtdh3ZvdOZjUq0XGUA/5X2cbp4gRZIHCv7ONIDYGZf 8Bq2faCL77JAXxBN8C14zWU2Y1zkLN3w62xPQIfJoLkhgE6X1wvaX0M6F/vk/Ke0X67A pIlh8KYw3mw5p3NoSkNsk4PHSO5pXPTA5PYNoMD9q5YTNug76v3UAM1l3PirwSH1x5+u YJ1d3qGzxjgb+e1cxfQU1F9CNEs+1FlZemo2MOPUVBMQaIgHCZfDemratq8RclY3hhS0 0roA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jvv9yNgT; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 d16-v6si2278649pli.176.2018.04.24.05.53.42; Tue, 24 Apr 2018 05:53:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jvv9yNgT; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933085AbeDXMxk (ORCPT + 12 others); Tue, 24 Apr 2018 08:53:40 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:54356 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757824AbeDXMpS (ORCPT ); Tue, 24 Apr 2018 08:45:18 -0400 Received: by mail-wm0-f67.google.com with SMTP id f6so688165wmc.4 for ; Tue, 24 Apr 2018 05:45:17 -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=dVkqRVLZfFoqB0FvZLVgL85/ireF+ESn1YcZI2Vtj7I=; b=jvv9yNgTqrGmlPBAGv8lNvbyQvFr4QaH2jz1HJuCR3ruVSGi7ed6Qz45hioUoi0C6C FsdItHcTIhonZL/FVWEH+2CJ9jvLhZ197rmhq6FNhRzqVqjJpwwayrTJIbfvTjzLrpT1 xEoptOsJcZMP+3nuyN72nbfQrpJs3wC7LgnPE= 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=dVkqRVLZfFoqB0FvZLVgL85/ireF+ESn1YcZI2Vtj7I=; b=pYzMB2Ckio/V6UlDN+mu2piC81iYGtyGO3/ALob925yeFOp090k+S1UlWWwpAH4gyP rGviUC6hx5yeQ05+MHf8rUkwCXsGAGTGt/4c/v+2nmTS7m4phfiNbE6j6xMQ09f+VNDx 6HcAAEqSA2nbdbbUsD9DBwYbwTcKTikNXbHgy1h39HuGjovTEBnnwPQZe+lUJRlt502Q 4/T1Dc8vx5dZ21h/EZhzFYB1+LjLYSBG4tf9Ro9nmhg9YFGqGIY6iox2eOFSly1mA0hs BZ9olAi+SGgvr59FG8bzWf9EbEMEvFHEw3caOhJMMnP9qS99N/WvDgyqmbSJOQF+VGRf kiuQ== X-Gm-Message-State: ALQs6tBpdvEZtYnse/Tp/zMG223tdup+Dq3UBpUX/uXMvtS+QDibmxYO 29FNHTnCzONjQPsLpjBS3dD3NZBz9us= X-Received: by 10.28.237.11 with SMTP id l11mr13351498wmh.160.1524573916737; Tue, 24 Apr 2018 05:45:16 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:45:16 -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 09/28] venus: venc,vdec: adds clocks needed for venus 4xx Date: Tue, 24 Apr 2018 15:44:17 +0300 Message-Id: <20180424124436.26955-10-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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This extends the clocks number to support suspend and resume on Venus version 4xx. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 4 +-- drivers/media/platform/qcom/venus/vdec.c | 42 ++++++++++++++++++++++++++------ drivers/media/platform/qcom/venus/venc.c | 42 ++++++++++++++++++++++++++------ 3 files changed, 72 insertions(+), 16 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 8d3e150800c9..b5b9a84e9155 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -92,8 +92,8 @@ struct venus_core { void __iomem *base; int irq; struct clk *clks[VIDC_CLKS_NUM_MAX]; - struct clk *core0_clk; - struct clk *core1_clk; + struct clk *core0_clk, *core0_bus_clk; + struct clk *core1_clk, *core1_bus_clk; struct video_device *vdev_dec; struct video_device *vdev_enc; struct v4l2_device v4l2_dev; diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 261a51adeef2..c45452634e7e 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1081,12 +1081,18 @@ static int vdec_probe(struct platform_device *pdev) if (!core) return -EPROBE_DEFER; - if (core->res->hfi_version == HFI_VERSION_3XX) { + if (IS_V3(core) || IS_V4(core)) { core->core0_clk = devm_clk_get(dev, "core"); if (IS_ERR(core->core0_clk)) return PTR_ERR(core->core0_clk); } + if (IS_V4(core)) { + core->core0_bus_clk = devm_clk_get(dev, "bus"); + if (IS_ERR(core->core0_bus_clk)) + return PTR_ERR(core->core0_bus_clk); + } + platform_set_drvdata(pdev, core); vdev = video_device_alloc(); @@ -1132,12 +1138,23 @@ static __maybe_unused int vdec_runtime_suspend(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - if (core->res->hfi_version == HFI_VERSION_1XX) + if (IS_V1(core)) return 0; - writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + if (IS_V3(core)) + writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(0, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); + + if (IS_V4(core)) + clk_disable_unprepare(core->core0_bus_clk); + clk_disable_unprepare(core->core0_clk); - writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + + if (IS_V3(core)) + writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(1, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); return 0; } @@ -1147,12 +1164,23 @@ static __maybe_unused int vdec_runtime_resume(struct device *dev) struct venus_core *core = dev_get_drvdata(dev); int ret; - if (core->res->hfi_version == HFI_VERSION_1XX) + if (IS_V1(core)) return 0; - writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + if (IS_V3(core)) + writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(0, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); + ret = clk_prepare_enable(core->core0_clk); - writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + + if (IS_V4(core)) + ret |= clk_prepare_enable(core->core0_bus_clk); + + if (IS_V3(core)) + writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(1, core->base + WRAPPER_VCODEC0_MMCC_POWER_CONTROL); return ret; } diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 947001170a77..bc8c2e7a8d2c 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1225,12 +1225,18 @@ static int venc_probe(struct platform_device *pdev) if (!core) return -EPROBE_DEFER; - if (core->res->hfi_version == HFI_VERSION_3XX) { + if (IS_V3(core) || IS_V4(core)) { core->core1_clk = devm_clk_get(dev, "core"); if (IS_ERR(core->core1_clk)) return PTR_ERR(core->core1_clk); } + if (IS_V4(core)) { + core->core1_bus_clk = devm_clk_get(dev, "bus"); + if (IS_ERR(core->core1_bus_clk)) + return PTR_ERR(core->core1_bus_clk); + } + platform_set_drvdata(pdev, core); vdev = video_device_alloc(); @@ -1276,12 +1282,23 @@ static __maybe_unused int venc_runtime_suspend(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - if (core->res->hfi_version == HFI_VERSION_1XX) + if (IS_V1(core)) return 0; - writel(0, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + if (IS_V3(core)) + writel(0, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(0, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); + + if (IS_V4(core)) + clk_disable_unprepare(core->core1_bus_clk); + clk_disable_unprepare(core->core1_clk); - writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + + if (IS_V3(core)) + writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(1, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); return 0; } @@ -1291,12 +1308,23 @@ static __maybe_unused int venc_runtime_resume(struct device *dev) struct venus_core *core = dev_get_drvdata(dev); int ret; - if (core->res->hfi_version == HFI_VERSION_1XX) + if (IS_V1(core)) return 0; - writel(0, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + if (IS_V3(core)) + writel(0, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(0, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); + ret = clk_prepare_enable(core->core1_clk); - writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + + if (IS_V4(core)) + ret |= clk_prepare_enable(core->core1_bus_clk); + + if (IS_V3(core)) + writel(1, core->base + WRAPPER_VENC_VCODEC_POWER_CONTROL); + else if (IS_V4(core)) + writel(1, core->base + WRAPPER_VCODEC1_MMCC_POWER_CONTROL); return ret; }