Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp269337imm; Tue, 15 May 2018 01:11:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpMY4ODIFppm1umu5MqAi2WoQWgFe0TWFlxiG+PBx5w3ctz9tF8kgw3hq3eputawczqYfVZ X-Received: by 2002:a17:902:6045:: with SMTP id a5-v6mr13345923plt.138.1526371865556; Tue, 15 May 2018 01:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371865; cv=none; d=google.com; s=arc-20160816; b=J1gO/Oq4ME7K18L6ITwIU3axN2wI3aYLjdY94+5LJC0sIu+ZqLb+E2euGss2gz91lF by+7VgxkXVFt4pcd9o7pOUPjXo74FdVLPb5P4B0tmHKaq7TkURwi32IV/F2/CMnV2Yry HyWQ5vqBhIN1Pxwk2v59fgrpnPngaLIzcEIX9o9AgE44Wt6WKhlTdcoyPaQvb9Lhz7DY aOn+hTwG4HszMF4OJaaBtePWmmu8OXCCtDvifmTSTlcgZXxTTCZe0Qv42Y6tC2Y9/abv swVPraY3avmDYEEqCDafFiiXc7mdyS3qHETRv6KLiLjLZ74L0OEphQthl3je+cA0J6hW x3yQ== 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=dVkqRVLZfFoqB0FvZLVgL85/ireF+ESn1YcZI2Vtj7I=; b=erQr9CpESLL5LF3zEKomEtlHc4kSTIoLuKrDi/YVVvnZu+pIX3VrFQej2qnCKUxCO0 g7kiwMM6hmZWD67fx0sygLMpjFV4cbV3jjvUe8OPvIAqCdu2LBSzt76JTt3NA97gxL4J g78Imb8Yp2kZ1YJlntQSPRe8275suTTmS/A7whHWW2oYZrnYU5KpuCDQKwbGB6IEZNcx dJD2jpV2rdJaulogsGlVcv/O+qkamNC4OFZyzwR9dFmf6ebmseNP7ihvUCEaOSPjgrXP ltRi967L19Uxg3G1xERA5azYM8VB7YGogz/JmNp8q8xeaEeROfOP4KL17H9rrXZLImil xdEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uta+TgaK; 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 v2-v6si7844195pgc.129.2018.05.15.01.10.51; Tue, 15 May 2018 01:11:05 -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=Uta+TgaK; 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 S1752640AbeEOIJj (ORCPT + 99 others); Tue, 15 May 2018 04:09:39 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54951 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752539AbeEOH7k (ORCPT ); Tue, 15 May 2018 03:59:40 -0400 Received: by mail-wm0-f65.google.com with SMTP id f6-v6so17674299wmc.4 for ; Tue, 15 May 2018 00:59:39 -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=Uta+TgaKH3jiVQR9Q6RKEI3b1rU65BWj+5/sgYU/ZLXaeOEIKK8dwYkrWvgAFhXyti SUxXQ8lW93pn6J8UskgSvC3EfE6zIjBsMJN3XYoe4HXeTPjpE4yOJh5KZnbrwVih+ivN sU9fYQ1cE4Hv6Dyrf7+s5A33RAP4NYLa5cLlQ= 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=B71G+tSIf7tUNdMcD1D78/rN/M5uQMqkE6ynVXAFM0E6w/Dmo67j8SUjQ91wLGc2Ly Pb2lyAKSXAT30VJ4vhYHKCf41ym7wrtielAwbxiXtbLg688bnt5g0TSem9UyMJCGAMq9 DKp8zt+ix+1AYRWs3eO9KOmF+bSmiM0DAc3xPy5j60qMzy2oRqXItku/AF7xJ3vbPJaA FchpD0zrACOV3h9mi6v6lUjrlsCVPSpsazviv5KxchE6hHw/4+wk4GVlJTMVAQVME/9n 9P4xYZPHRWazXw0SI7hlpBdekaovD87I6f03PhAvKT2jqR4fJqDjaym+eDN5qu2TrYZy 2qUQ== X-Gm-Message-State: ALKqPwcvqWacY289CqXEMRkoMym3IOuKWMOyOhMI3CjoEipvZSdYRVX7 gllCKug64xYU56ioYJUVsQ58DULVJGk= X-Received: by 2002:a1c:7a0b:: with SMTP id v11-v6mr7401839wmc.58.1526371179017; Tue, 15 May 2018 00:59:39 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:38 -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 v2 11/29] venus: venc,vdec: adds clocks needed for venus 4xx Date: Tue, 15 May 2018 10:58:41 +0300 Message-Id: <20180515075859.17217-12-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-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 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(-) 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; } -- 2.14.1