Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp287414imm; Wed, 30 May 2018 23:51:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJo3zgVOib0LWfSVpDhVtpZ7TYg3rEFA9mObP1NEQk5P385s9tKi5ABlR2d0d+lL6vMGsoH X-Received: by 2002:a17:902:5e3:: with SMTP id f90-v6mr5966287plf.175.1527749479132; Wed, 30 May 2018 23:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527749479; cv=none; d=google.com; s=arc-20160816; b=yYqnAqzljJr0QsKSipT2hGsSmCokkGtPbLfj4MlAEsqKHgTYZ7n2ewvCFP9T0ZKuPb nSle7+w/y3uQs+NXPKgrBaKZzJlD1SzwaYvXd4j04bkErVA3IIPf6entNxMuC4LtxmzC WOTryqhGOHQyHhbuAiI0xUFgyXnY77IiDHaKXEPhAeqzHd57kqLiI6O2AxFJeMHAcCAk mhFz2VyrswtHXMshPyE8PdS3I6RE73QgCsWXCLukg81Oy0Xu9/DjuYl6N2g88tZ3EH/R jrw3SFmr+LzcPq8P9PVGVRakoVKox7Q3sqxv2SN00FZbRS59d8au56F916dDHHtVKlhZ juuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=2KyqREhOKLSZDWm2BqO+vq/vXhYDSCXTunk3+nJD394=; b=YXN145GQ/qDoy2za45I8H/clxTmN5NzZnLmoCuNU0HddBKTYsHcc6mUDBs8CUQKwhT 7ItfRndIU0AOjZDgeNZA63FGWGvP0P1bZ36651ONnOV+r0IpO3UXZvLV2pPo9eoITJv1 r4fE+yxJ19lQrRTcP4ELmk2mLRUf/KW5uFHrBQdTZMoMReRPIDOPsMEbXRqOXMuGZ920 2FqAGUJ9Lm9VhifKG5mfWPNObRCwCUkd2bmWU2FUda6jTy60KoejdInau1tM98VdgH4q n07bGAqHqVAEuQV4s/cXEijFP0ATu/RBi1dKihG1ABnI33T32OvcgEPYQbaHHHi5Mmeu SCOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=T93gd3eb; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g92-v6si36772503plg.342.2018.05.30.23.51.05; Wed, 30 May 2018 23:51:19 -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=@chromium.org header.s=google header.b=T93gd3eb; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753990AbeEaGub (ORCPT + 99 others); Thu, 31 May 2018 02:50:31 -0400 Received: from mail-vk0-f68.google.com ([209.85.213.68]:39362 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753944AbeEaGu1 (ORCPT ); Thu, 31 May 2018 02:50:27 -0400 Received: by mail-vk0-f68.google.com with SMTP id y137-v6so12680548vkd.6 for ; Wed, 30 May 2018 23:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2KyqREhOKLSZDWm2BqO+vq/vXhYDSCXTunk3+nJD394=; b=T93gd3ebAFgdlfc7srwoJm0eX3PZu1iziaVzAwlRvSSGymvQUN21UwmpbAo5jLAA03 XIesZBTa5+tXIzhMZXcD4Ft6wfnW/A9zw8W9zuUA4PbmKbRA5IRNStfYJOTKOl+xwVM+ xyvcQOUFO2uWGzi4JOnA+FassKAMa89wimqXQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2KyqREhOKLSZDWm2BqO+vq/vXhYDSCXTunk3+nJD394=; b=LCL9kZVDhnxvVsDnWx8BTognRvTRd/LOqBioBraq/IzipJdMAokLoiM/sw032+69PJ CqpflYPGjUfj5xkJS6D6G/xjgCrkaQ4DLhiRjtdzvCnC4g4ivH9dHdFvC1FYRnBAuj3V kKEXXnN/ucAUcpDkQ/dceZ4e2QVHt0twmmnl5p2cxI4branNmEgYCh5XSx7uTUMaXPmT hCYGFddlmgmtPMsUGSxRfROptfN3subhC9xWPZtQd8M5wP2K4h0KZjStVXg9YvJh4Dlt 7Cjq2/bEWfNoyREUBotgmODMBr4gkpldXo2JzQi1U9C+AQo4vEnN6cHlZOUQX8CAyYop k0Mw== X-Gm-Message-State: ALKqPwdPFLGoFoLPF68MtExKnqniu6BzB/m9EsYSnxYuSCQ1QXrBIGBl uMEAohw3+lqYfEsamJxbuUdu+0Hhngw= X-Received: by 2002:a1f:8055:: with SMTP id b82-v6mr3427194vkd.157.1527749426200; Wed, 30 May 2018 23:50:26 -0700 (PDT) Received: from mail-vk0-f46.google.com (mail-vk0-f46.google.com. [209.85.213.46]) by smtp.gmail.com with ESMTPSA id f21-v6sm9289725vka.38.2018.05.30.23.50.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 23:50:25 -0700 (PDT) Received: by mail-vk0-f46.google.com with SMTP id 200-v6so10615118vkc.0 for ; Wed, 30 May 2018 23:50:25 -0700 (PDT) X-Received: by 2002:a1f:394b:: with SMTP id g72-v6mr3529611vka.97.1527749424554; Wed, 30 May 2018 23:50:24 -0700 (PDT) MIME-Version: 1.0 References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> <20180515075859.17217-12-stanimir.varbanov@linaro.org> <3a892dd5-0744-c289-e258-099d531d5abd@linaro.org> In-Reply-To: <3a892dd5-0744-c289-e258-099d531d5abd@linaro.org> From: Tomasz Figa Date: Thu, 31 May 2018 15:50:13 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 11/29] venus: venc,vdec: adds clocks needed for venus 4xx To: Stanimir Varbanov Cc: Mauro Carvalho Chehab , Hans Verkuil , Linux Media Mailing List , Linux Kernel Mailing List , linux-arm-msm , vgarodia@codeaurora.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 28, 2018 at 5:47 PM Stanimir Varbanov wrote: > > Hi Tomasz, > > On 05/24/2018 09:11 AM, Tomasz Figa wrote: > > Hi Stanimir, > > > > On Tue, May 15, 2018 at 5:10 PM Stanimir Varbanov < > > stanimir.varbanov@linaro.org> wrote: > > > >> 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); > >> + } > >> + > > > > Rather than doing this conditional dance, wouldn't it make more sense to > > just list all the clocks in variant data struct and use clk_bulk_get()? > > Do you mean the same as it is done for venus/core.c ? I mean clk_bulk_get() as in drivers/clk/clk-bulk.c. I guess venus/core.c would also benefit from switching to these helpers. > > > > >> 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); > > > > Almost every step here differs between version. I'd suggest splitting this > > into separate functions for both versions. > > I think it will be better to squash this patch with 13/29. I see. Let me review patch 13 first then. Best regards, Tomasz