Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp532401pxk; Wed, 23 Sep 2020 09:13:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznGlgCBWXx77Ce3R9Mz8zzP8MYJzme1SyIfc1UpKOa3K8LX7YjTsTSmGciMDw8GlIII1bx X-Received: by 2002:a50:bb62:: with SMTP id y89mr20394ede.261.1600877620273; Wed, 23 Sep 2020 09:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600877620; cv=none; d=google.com; s=arc-20160816; b=M+USGJeYOtEVJoBdW1sqV19yeBitVTuE1/AmSq3XV5Pv4968cdcZZINgH5g/blk32G R+GlAlt4OTpCDMD+rU/N5rt7RPJ2wQX+zZ/sflgm7seaERJuMvO/FGDVCugLaitITBAN 2CCf9F3yR7OR48b+Lmpd777WbSngKUhCWSptxlxTQGrK3LiEpCsaNeToa0hjg6Tibsu8 pVYJwQ8U5DqaAz5ghZNexIMy1+jW1dTp4sP9bMaVJg8uMg593ew5Ed4luqbMbjfH8dA7 YvUqa2zkb2M3VzBwpAsbrPN/3DONgv+RrX+r/teRRhECv8kEg05nQJfIwjQJUAoVWyok 0W7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=6AhmEhoJKFtZgkPr3wt8u+Go1C07WkmomwQKmNs/qUM=; b=OSJyb8+9IxTMHjsMGfIQ+CKso+2MHvA3Gb42hi8QBToqra+tDLN1Cy0z9d6Suz2qpI /qTULO2mmWd9RZYNhXMavsUdKDRZHq2GHBzLdxdFJU9HfWYiJZaR84FmDrDq4XT+HNjY Nrhdw+wZrlrqcdkHa2m9URQNuZcQfi0G55Dq0WJ94tPQHFCtLzK9f9k2B+0fmwWXCdCF Fov1/ht8paxQGTm2YiSojvMkUipMQWP/SJSm7XsIYnjgzHwX7EpgOGW5z0fwy3t/01zr JFKM6wzKS1eK11mNfXXbbpRLZS2W6hrmLvvyJB9/Al8iFH5aVxbzsl1bl/rPBthaI4xm NVdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marek-ca.20150623.gappssmtp.com header.s=20150623 header.b=XrJbrIo3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si247716ejk.68.2020.09.23.09.13.14; Wed, 23 Sep 2020 09:13:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@marek-ca.20150623.gappssmtp.com header.s=20150623 header.b=XrJbrIo3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726773AbgIWQIp (ORCPT + 99 others); Wed, 23 Sep 2020 12:08:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgIWQIo (ORCPT ); Wed, 23 Sep 2020 12:08:44 -0400 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2639C0613CE for ; Wed, 23 Sep 2020 09:08:44 -0700 (PDT) Received: by mail-qt1-x843.google.com with SMTP id k25so324615qtu.4 for ; Wed, 23 Sep 2020 09:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marek-ca.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6AhmEhoJKFtZgkPr3wt8u+Go1C07WkmomwQKmNs/qUM=; b=XrJbrIo3osTb6a4fWmk3C934RubXjCWAy8d5fjuEM6+yRb8mu8iERyHearweM84CVu z57wm5v+OL36pSH805KtT3ttIul67kx8DzBhgbfB8sCGc7ZBuI//+e2O4xg9d3oS+Pwm 1Cbnfx5ktVP/i75R/r+M5fHrhzAowDD8p++KmUgzimOzKpi0iTQIuoCJx/NhpiadcRXd 7zcHKx0g25qsXbXkQEmCTFS8o6KNrwcVZ7IaudMjTfGyNRZmr95obFcS1tfit1fxDRgu 3c8ERDeJHV51IMAsBfIYZqsx5dF1jVGrQ/kRpiPDQZgnuA5y3tTnKgOB/GtgmF90CEdH 4pHg== 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=6AhmEhoJKFtZgkPr3wt8u+Go1C07WkmomwQKmNs/qUM=; b=fMBHOxMvi3Oo02+ukovMdQfogNeoKaODiO/AjDcFBhPR/Bv0g+jTo8mQv8Ka800iTV fFzZkxMdXlXgp+IFkj3vpZr+eD/Fxnik74cKcKvL3KnfJgfnPApFwX0V1TceG+kJQJxI hcSWaS72Ro8XuHTQMi2f8UcYjrfbl83E04r3dWMJ28Ey/BMkfgpZrcfXjn52wwwncAWg tZyVm41iaRUNDV9S7ChqHRNzE0Alv3DCYY5Yv0qAfryAAgiUPB+cB+bbj3GVJw5Yomha F09Kw/KzwWBWmt/HtM7ZzmmH4QdXihYbtdPH8t4cTsfAZ2wZ6AMKjeIrO/kxrqrPNBK0 459g== X-Gm-Message-State: AOAM530FIvlhSgcJgIR/y7hANffW4oqk0It9qIw44NbtvtbfjIY/3hYi q7U/FmUCaMBoQwy4eHpVv5GUyA== X-Received: by 2002:ac8:60d1:: with SMTP id i17mr818976qtm.272.1600877322690; Wed, 23 Sep 2020 09:08:42 -0700 (PDT) Received: from [192.168.0.189] ([147.253.86.153]) by smtp.gmail.com with ESMTPSA id c70sm250037qkg.4.2020.09.23.09.08.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Sep 2020 09:08:42 -0700 (PDT) Subject: Re: [PATCH v2 5/5] clk: qcom: add video clock controller driver for SM8250 To: Stephen Boyd , linux-arm-msm@vger.kernel.org Cc: Andy Gross , Bjorn Andersson , Michael Turquette , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org References: <20200904030958.13325-1-jonathan@marek.ca> <20200904030958.13325-6-jonathan@marek.ca> <160080040123.310579.8471841951357841843@swboyd.mtv.corp.google.com> From: Jonathan Marek Message-ID: <0ce9fdb6-e224-ced7-ec32-fe67b2ca6127@marek.ca> Date: Wed, 23 Sep 2020 12:07:16 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <160080040123.310579.8471841951357841843@swboyd.mtv.corp.google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/22/20 2:46 PM, Stephen Boyd wrote: > Quoting Jonathan Marek (2020-09-03 20:09:54) >> Add support for the video clock controller found on SM8250 based devices. >> >> Derived from the downstream driver. >> >> Signed-off-by: Jonathan Marek >> --- >> drivers/clk/qcom/Kconfig | 9 + >> drivers/clk/qcom/Makefile | 1 + >> drivers/clk/qcom/videocc-sm8250.c | 518 ++++++++++++++++++++++++++++++ >> 3 files changed, 528 insertions(+) >> create mode 100644 drivers/clk/qcom/videocc-sm8250.c >> >> diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig >> index 40d7ee9886c9..95efa38211d5 100644 >> --- a/drivers/clk/qcom/Kconfig >> +++ b/drivers/clk/qcom/Kconfig >> @@ -453,6 +453,15 @@ config SM_VIDEOCC_8150 >> Say Y if you want to support video devices and functionality such as >> video encode and decode. >> >> +config SM_VIDEOCC_8250 >> + tristate "SM8250 Video Clock Controller" >> + select SDM_GCC_8250 >> + select QCOM_GDSC >> + help >> + Support for the video clock controller on SM8250 devices. >> + Say Y if you want to support video devices and functionality such as >> + video encode and decode. >> + >> config SPMI_PMIC_CLKDIV >> tristate "SPMI PMIC clkdiv Support" >> depends on SPMI || COMPILE_TEST >> diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile >> index 6f4c580d2728..55fb20800b66 100644 >> --- a/drivers/clk/qcom/Makefile >> +++ b/drivers/clk/qcom/Makefile >> @@ -69,6 +69,7 @@ obj-$(CONFIG_SM_GCC_8250) += gcc-sm8250.o >> obj-$(CONFIG_SM_GPUCC_8150) += gpucc-sm8150.o >> obj-$(CONFIG_SM_GPUCC_8250) += gpucc-sm8250.o >> obj-$(CONFIG_SM_VIDEOCC_8150) += videocc-sm8150.o >> +obj-$(CONFIG_SM_VIDEOCC_8250) += videocc-sm8250.o >> obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o >> obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o >> obj-$(CONFIG_QCOM_HFPLL) += hfpll.o >> diff --git a/drivers/clk/qcom/videocc-sm8250.c b/drivers/clk/qcom/videocc-sm8250.c >> new file mode 100644 >> index 000000000000..a814d10945c4 >> --- /dev/null >> +++ b/drivers/clk/qcom/videocc-sm8250.c >> @@ -0,0 +1,518 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> + >> +#include >> + > [...] >> +static struct clk_rcg2 video_cc_ahb_clk_src = { >> + .cmd_rcgr = 0xbd4, >> + .mnd_width = 0, >> + .hid_width = 5, >> + .parent_map = video_cc_parent_map_0, >> + .freq_tbl = ftbl_video_cc_ahb_clk_src, >> + .clkr.hw.init = &(struct clk_init_data){ >> + .name = "video_cc_ahb_clk_src", >> + .parent_data = video_cc_parent_data_0, >> + .num_parents = ARRAY_SIZE(video_cc_parent_data_0), >> + .flags = CLK_SET_RATE_PARENT, >> + .ops = &clk_rcg2_shared_ops, >> + }, >> +}; >> + >> +static struct clk_rcg2 video_cc_xo_clk_src = { >> + .cmd_rcgr = 0xecc, >> + .mnd_width = 0, >> + .hid_width = 5, >> + .parent_map = video_cc_parent_map_0, >> + .freq_tbl = ftbl_video_cc_ahb_clk_src, >> + .clkr.hw.init = &(struct clk_init_data){ >> + .name = "video_cc_xo_clk_src", >> + .parent_data = video_cc_parent_data_0, >> + .num_parents = ARRAY_SIZE(video_cc_parent_data_0), >> + .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT, > > Similar critical clk comment, see below. > >> + .ops = &clk_rcg2_ops, >> + }, >> +}; >> + >> +static struct clk_branch video_cc_ahb_clk = { >> + .halt_reg = 0xe58, >> + .halt_check = BRANCH_HALT, >> + .clkr = { >> + .enable_reg = 0xe58, >> + .enable_mask = BIT(0), >> + .hw.init = &(struct clk_init_data){ >> + .name = "video_cc_ahb_clk", >> + .parent_data = &(const struct clk_parent_data){ >> + .hw = &video_cc_ahb_clk_src.clkr.hw, >> + }, >> + .num_parents = 1, >> + .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT, > > Similar critical clk comment, see below. > >> + .ops = &clk_branch2_ops, >> + }, >> + }, >> +}; >> + >> +static struct clk_branch video_cc_mvs0_clk = { >> + .halt_reg = 0xd34, >> + .halt_check = BRANCH_HALT_SKIP, /* TODO: hw gated ? */ > > Is this resolved? > Downstream has this clock as BRANCH_HALT_VOTED, but with the upstream venus driver (with patches to enable sm8250), that results in a "video_cc_mvs0_clk status stuck at 'off" error. AFAIK venus enables/disables this clock on its own (venus still works without touching this clock), but I didn't want to remove this in case it might be needed. I removed these clocks in the v3 I just sent. >> + .clkr = { >> + .enable_reg = 0xd34, >> + .enable_mask = BIT(0), >> + .hw.init = &(struct clk_init_data){ >> + .name = "video_cc_mvs0_clk", >> + .parent_data = &(const struct clk_parent_data){ >> + .hw = &video_cc_mvs0_div_clk_src.clkr.hw, >> + }, >> + .num_parents = 1, >> + .flags = CLK_SET_RATE_PARENT, >> + .ops = &clk_branch2_ops, >> + }, >> + }, >> +}; >> + > [...] >> + >> +static struct clk_branch video_cc_xo_clk = { >> + .halt_reg = 0xeec, >> + .halt_check = BRANCH_HALT, >> + .clkr = { >> + .enable_reg = 0xeec, >> + .enable_mask = BIT(0), >> + .hw.init = &(struct clk_init_data){ >> + .name = "video_cc_xo_clk", >> + .parent_data = &(const struct clk_parent_data){ >> + .hw = &video_cc_xo_clk_src.clkr.hw, >> + }, >> + .num_parents = 1, >> + .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT, > > Please add a coment why it's critical. If no consumer of this clk exists > it's preferred to move the enabling to probe and not waste memory > modeling it in software. > >> + .ops = &clk_branch2_ops, >> + }, >> + }, >> +}; >> +