From patchwork Tue May 15 07:58:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 135851 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp678406lji; Tue, 15 May 2018 01:09:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoy6dv3ETF8gEMtwI9uDTJVbm4IIgEeHftKPpy0RnTRgIXpbTF94xrcVgcTu8MQw6eAl4Lr X-Received: by 2002:a17:902:3e5:: with SMTP id d92-v6mr2685694pld.104.1526371799838; Tue, 15 May 2018 01:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371799; cv=none; d=google.com; s=arc-20160816; b=Ye0PdlZC2xAoEdd39yPFx0BUPiSCIg2Kk6FD3QjxPElyNtKIKjxSLSPw0dAnmlY5uM tul04TT1O5kk9/XMccmISuRCmmVreiB5NLumBsv4l8mAQ4ddXvOZJYaxOOK1hihZlI9V ADzLItDnOIRaCcuT8+CMxWDrvE3u2zvHN5n38iRUDn/AuOy9KB5qlpGJujz8RUkRM0B9 obOgleJEEF5iv4lqVqmjVSghPRobXOV/TDpSfpnVW1Rpc0wComo5NVDZlKy+tJIGW3GH 3THQWqbIhM4cMJMtfAVib6Ewc93E7dqjYXDDOqT1rQFPX0N1pEogfFu3Sgx411S1jWsG VfUA== 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 g6-v6si9505390pgr.72.2018.05.15.01.09.59; Tue, 15 May 2018 01:09:59 -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 S1752647AbeEOIJk (ORCPT + 29 others); Tue, 15 May 2018 04:09:40 -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(-) -- 2.14.1 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; }