Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2114232imm; Mon, 28 May 2018 01:48:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpfEDknY3ClIVIXuQXj8RHnYjw/CF7jJJyLWt8kNH4mjYU6SS2Va5p7SN0UzOkvtPd6cFK/ X-Received: by 2002:a17:902:7d87:: with SMTP id a7-v6mr13141605plm.264.1527497334966; Mon, 28 May 2018 01:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527497334; cv=none; d=google.com; s=arc-20160816; b=rGHIM4BTJ4mTSE602bzhtH4QXk74K9s28gsPk29k3YQ5QOKVOuhS3GIURp+USxdTLR GHRFffnYoTVjVuAhZ41PBqF51gKx6v0yW3JRMGm8cIgsr/LVaeDnpNpfen1djhCZIHNA Tp0rge8jrVPX1IYSP3NwuvAW1tIPFaJwS6p7PWQvLT4eiEVqL1X0v8+v37+F93Kuns38 okhYPkhFkfKcEheb/QJXqoDaUeb2t0gbrxxSUvvtT2wS6dg+JxQ8d/HV+i6G0/IJbWml RePKtqEFd1Lte3J7Zf+1jY6Sba+9z9am3QKJ4U2iKf87AJKUMwUz28bjDNuh3BrOE+q0 eaKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=a03hKdlgNR0VgTsmlYmvOCnWk0RKKb3Ma0D+jLB6piA=; b=YvULc1zvt/Mj5nzNU916yWIckylCvSEBDMPJSxuWjBINSzfbZY8Y/Ox64pfarBae2i of8mx2h0dvQsfXq/cdzMU+6AYEWfWPxF97dhIfkOykEN1+xYG0uY3o9F09ZphgSQ7Opg 4HL1DB/OXuQWN7pMVycKctUdRwhSmRrO++1jwF/utGIPnFC+XAyquddqYNKFJxB/PFNB OXyEZb9+dp3K5+b/JhSuYHUEsL9vBHvXpum3WQXWWDYkPsGvGOde3xowdD0ij4ZX/qCA sAqNqhrH5DTgcrKeteA5I8Dq95pJ36fewVKAKMoJCWwYYCjCJXNuPU+6nqkgIyYE4hKV d72w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H3lm31qd; 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 az5-v6si30055576plb.369.2018.05.28.01.48.40; Mon, 28 May 2018 01:48:54 -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=H3lm31qd; 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 S1754119AbeE1Irg (ORCPT + 99 others); Mon, 28 May 2018 04:47:36 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:53423 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754065AbeE1IrT (ORCPT ); Mon, 28 May 2018 04:47:19 -0400 Received: by mail-wm0-f67.google.com with SMTP id a67-v6so29959373wmf.3 for ; Mon, 28 May 2018 01:47:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=a03hKdlgNR0VgTsmlYmvOCnWk0RKKb3Ma0D+jLB6piA=; b=H3lm31qdqyV8mR9lenoXsvnDS2e82sCQvh9ooosn50Pl804PojlE1NuMPHpJ3D5TjC lZAnWCVBGaYXNFaAjBnhPvnps2ltFzGfd4NyeQSsbqZ6jx37+qLwBe1vFeRzdSAV3elB 0UAUMqmgnyBkVSy2tNk2KOufIuH5zNioBiatM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=a03hKdlgNR0VgTsmlYmvOCnWk0RKKb3Ma0D+jLB6piA=; b=cIBfD8d8OQd3mvGcedrbRzFBTj4dlbpO5y/QqRaTJgFPSiqJw4e++RqQ+Vh+CpJ7hP Reg9ozkzhDg4wpUkI6rE2qlDOi9luQQjgV4k3aVbBd3Xna768Qi+Uk6eaVnoA5K6jl06 w+/uOsmYT2PzqOie+NDQyosSTHMr5FjKE2W/74AuFfztR1LGkNqkXahFr5euRyKEdbdT WZjtya487LIBmQkQRliiVo8gIaNmeFGyOyVfaN+u92bYvDNCJUdEnHtN5/1RzNl7mCU2 2OiMcWm1ME7FP1X6yx2kCVEY53Z4zrtQh9FqXh5kdSC3KgZYf4SYFOIHfoyxlPrL0BJp oG5g== X-Gm-Message-State: ALKqPweNin4VrdKMfp8LAh4M73wIvz6ckxHXM1XwMFUOoDtzHYO8J6Yl N3LGC/wcMcT3IW5oW4EIBntU0g== X-Received: by 2002:a1c:2d93:: with SMTP id t141-v6mr9019876wmt.94.1527497237916; Mon, 28 May 2018 01:47:17 -0700 (PDT) Received: from [192.168.27.209] ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id v15-v6sm19670620wrp.35.2018.05.28.01.47.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 01:47:17 -0700 (PDT) Subject: Re: [PATCH v2 11/29] venus: venc,vdec: adds clocks needed for venus 4xx To: Tomasz Figa Cc: Mauro Carvalho Chehab , Hans Verkuil , Linux Media Mailing List , Linux Kernel Mailing List , linux-arm-msm , vgarodia@codeaurora.org References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> <20180515075859.17217-12-stanimir.varbanov@linaro.org> From: Stanimir Varbanov Message-ID: <3a892dd5-0744-c289-e258-099d531d5abd@linaro.org> Date: Mon, 28 May 2018 11:47:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ? > >> 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. -- regards, Stan