From: Jagadeesh Kona <quic_jkona@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Michael Turquette <mturquette@baylibre.com>,
Conor Dooley <conor+dt@kernel.org>,
"Bjorn Andersson" <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Taniya Das <quic_tdas@quicinc.com>,
<linux-arm-msm@vger.kernel.org>, <linux-clk@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/4] clk: qcom: videocc-sm8550: Add video clock controller driver for SM8550
Date: Wed, 24 May 2023 19:50:14 +0530 [thread overview]
Message-ID: <a101f5f2-4458-8284-cc7f-1ce22389c26f@quicinc.com> (raw)
In-Reply-To: <CAA8EJppn9=gPFk1RRB9y50aU_G3J6QrsOVQ9GH5gT86D_hOAgQ@mail.gmail.com>
Hi Dmitry,
Thanks for your review!
On 5/9/2023 10:45 PM, Dmitry Baryshkov wrote:
> On Tue, 9 May 2023 at 19:14, Jagadeesh Kona <quic_jkona@quicinc.com> wrote:
>>
>> Add support for the video clock controller for video clients to be able
>> to request for videocc clocks on SM8550 platform.
>>
>> Signed-off-by: Jagadeesh Kona <quic_jkona@quicinc.com>
>> Signed-off-by: Taniya Das <quic_tdas@quicinc.com>
>> ---
>> drivers/clk/qcom/Kconfig | 10 +
>> drivers/clk/qcom/Makefile | 1 +
>> drivers/clk/qcom/videocc-sm8550.c | 468 ++++++++++++++++++++++++++++++
>> 3 files changed, 479 insertions(+)
>> create mode 100644 drivers/clk/qcom/videocc-sm8550.c
>>
>> diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig
>> index 12be3e2371b3..6bb9b4aff047 100644
>> --- a/drivers/clk/qcom/Kconfig
>> +++ b/drivers/clk/qcom/Kconfig
>> @@ -925,6 +925,16 @@ config SM_VIDEOCC_8250
>> Say Y if you want to support video devices and functionality such as
>> video encode and decode.
>>
>> +config SM_VIDEOCC_8550
>> + tristate "SM8550 Video Clock Controller"
>> + select SM_GCC_8550
>> + select QCOM_GDSC
>> + help
>> + Support for the video clock controller on Qualcomm Technologies, Inc.
>> + SM8550 devices.
>> + Say Y if you want to support video devices and functionality such as
>> + video encode/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 9ff4c373ad95..f0b95fc217aa 100644
>> --- a/drivers/clk/qcom/Makefile
>> +++ b/drivers/clk/qcom/Makefile
>> @@ -127,6 +127,7 @@ obj-$(CONFIG_SM_GPUCC_8350) += gpucc-sm8350.o
>> obj-$(CONFIG_SM_TCSRCC_8550) += tcsrcc-sm8550.o
>> obj-$(CONFIG_SM_VIDEOCC_8150) += videocc-sm8150.o
>> obj-$(CONFIG_SM_VIDEOCC_8250) += videocc-sm8250.o
>> +obj-$(CONFIG_SM_VIDEOCC_8550) += videocc-sm8550.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-sm8550.c b/drivers/clk/qcom/videocc-sm8550.c
>> new file mode 100644
>> index 000000000000..10e4b2725ddf
>> --- /dev/null
>> +++ b/drivers/clk/qcom/videocc-sm8550.c
>> @@ -0,0 +1,468 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
>> + */
>> +
>> +#include <linux/clk-provider.h>
>> +#include <linux/module.h>
>> +#include <linux/of_device.h>
>> +#include <linux/pm_runtime.h>
>> +#include <linux/regmap.h>
>> +
>> +#include <dt-bindings/clock/qcom,sm8550-videocc.h>
>> +
>> +#include "clk-alpha-pll.h"
>> +#include "clk-branch.h"
>> +#include "clk-rcg.h"
>> +#include "clk-regmap.h"
>> +#include "clk-regmap-divider.h"
>> +#include "common.h"
>> +#include "gdsc.h"
>> +#include "reset.h"
>> +
>> +enum {
>> + DT_BI_TCXO,
>
> Any additional handling for gcc_video_ahb clk? It doesn't seem to be
> used as a parent. Probably you intended to use it as a pm_clk?
> Yes it is a pm_clk, but no additional handling is required from driver side.
>> +};
>> +
>> +enum {
>> + P_BI_TCXO,
>> + P_VIDEO_CC_PLL0_OUT_MAIN,
>> + P_VIDEO_CC_PLL1_OUT_MAIN,
>> +};
[skipped]
>> +static struct clk_regmap *video_cc_sm8550_clocks[] = {
>> + [VIDEO_CC_MVS0_CLK] = &video_cc_mvs0_clk.clkr,
>> + [VIDEO_CC_MVS0_CLK_SRC] = &video_cc_mvs0_clk_src.clkr,
>> + [VIDEO_CC_MVS0_DIV_CLK_SRC] = &video_cc_mvs0_div_clk_src.clkr,
>> + [VIDEO_CC_MVS0C_CLK] = &video_cc_mvs0c_clk.clkr,
>> + [VIDEO_CC_MVS0C_DIV2_DIV_CLK_SRC] = &video_cc_mvs0c_div2_div_clk_src.clkr,
>> + [VIDEO_CC_MVS1_CLK] = &video_cc_mvs1_clk.clkr,
>> + [VIDEO_CC_MVS1_CLK_SRC] = &video_cc_mvs1_clk_src.clkr,
>> + [VIDEO_CC_MVS1_DIV_CLK_SRC] = &video_cc_mvs1_div_clk_src.clkr,
>> + [VIDEO_CC_MVS1C_CLK] = &video_cc_mvs1c_clk.clkr,
>> + [VIDEO_CC_MVS1C_DIV2_DIV_CLK_SRC] = &video_cc_mvs1c_div2_div_clk_src.clkr,
>> + [VIDEO_CC_PLL0] = &video_cc_pll0.clkr,
>> + [VIDEO_CC_PLL1] = &video_cc_pll1.clkr,
>> +};
>> +
>> +static struct gdsc *video_cc_sm8550_gdscs[] = {
>> + [VIDEO_CC_MVS0C_GDSC] = &video_cc_mvs0c_gdsc,
>> + [VIDEO_CC_MVS0_GDSC] = &video_cc_mvs0_gdsc,
>> + [VIDEO_CC_MVS1C_GDSC] = &video_cc_mvs1c_gdsc,
>> + [VIDEO_CC_MVS1_GDSC] = &video_cc_mvs1_gdsc,
>> +};
>> +
>> +static const struct qcom_reset_map video_cc_sm8550_resets[] = {
>> + [CVP_VIDEO_CC_INTERFACE_BCR] = { 0x80f0 },
>> + [CVP_VIDEO_CC_MVS0_BCR] = { 0x80a0 },
>> + [CVP_VIDEO_CC_MVS0C_BCR] = { 0x8048 },
>> + [CVP_VIDEO_CC_MVS1_BCR] = { 0x80c8 },
>> + [CVP_VIDEO_CC_MVS1C_BCR] = { 0x8074 },
>
> Please rename them to start with the VIDEO_CC prefix.
>
These names are coming from hardware plan and clients will
refer to hardware plan for these names. So we would like to
keep the names intact same as from hardware plan.
>> + [VIDEO_CC_MVS0C_CLK_ARES] = { 0x8064, 2 },
>> + [VIDEO_CC_MVS1C_CLK_ARES] = { 0x8090, 2 },
>> +};
>> +
>> +static const struct regmap_config video_cc_sm8550_regmap_config = {
>> + .reg_bits = 32,
>> + .reg_stride = 4,
>> + .val_bits = 32,
>> + .max_register = 0x9f4c,
>> + .fast_io = true,
>> +};
>> +
>> +static struct qcom_cc_desc video_cc_sm8550_desc = {
>> + .config = &video_cc_sm8550_regmap_config,
>> + .clks = video_cc_sm8550_clocks,
>> + .num_clks = ARRAY_SIZE(video_cc_sm8550_clocks),
>> + .resets = video_cc_sm8550_resets,
>> + .num_resets = ARRAY_SIZE(video_cc_sm8550_resets),
>> + .gdscs = video_cc_sm8550_gdscs,
>> + .num_gdscs = ARRAY_SIZE(video_cc_sm8550_gdscs),
>> +};
>> +
>> +static const struct of_device_id video_cc_sm8550_match_table[] = {
>> + { .compatible = "qcom,sm8550-videocc" },
>> + { }
>> +};
>> +MODULE_DEVICE_TABLE(of, video_cc_sm8550_match_table);
>> +
>> +static int video_cc_sm8550_probe(struct platform_device *pdev)
>> +{
>> + struct regmap *regmap;
>> + int ret;
>> +
>> + ret = devm_pm_runtime_enable(&pdev->dev);
>> + if (ret)
>> + return ret;
>> +
>> + ret = pm_runtime_resume_and_get(&pdev->dev);
>> + if (ret)
>> + return ret;
>> +
>> + regmap = qcom_cc_map(pdev, &video_cc_sm8550_desc);
>> + if (IS_ERR(regmap)) {
>> + pm_runtime_put(&pdev->dev);
>> + return PTR_ERR(regmap);
>> + }
>> +
>> + clk_lucid_ole_pll_configure(&video_cc_pll0, regmap, &video_cc_pll0_config);
>> + clk_lucid_ole_pll_configure(&video_cc_pll1, regmap, &video_cc_pll1_config);
>> +
>> + /*
>> + * Keep clocks always enabled:
>> + * video_cc_ahb_clk
>> + * video_cc_sleep_clk
>> + * video_cc_xo_clk
>> + */
>> + regmap_update_bits(regmap, 0x80f4, BIT(0), BIT(0));
>> + regmap_update_bits(regmap, 0x8140, BIT(0), BIT(0));
>> + regmap_update_bits(regmap, 0x8124, BIT(0), BIT(0));
>> +
>> + ret = qcom_cc_really_probe(pdev, &video_cc_sm8550_desc, regmap);
>> +
>> + pm_runtime_put(&pdev->dev);
>> +
>> + return ret;
>> +}
>> +
>> +static struct platform_driver video_cc_sm8550_driver = {
>> + .probe = video_cc_sm8550_probe,
>> + .driver = {
>> + .name = "video_cc-sm8550",
>> + .of_match_table = video_cc_sm8550_match_table,
>> + },
>> +};
>> +
>> +static int __init video_cc_sm8550_init(void)
>> +{
>> + return platform_driver_register(&video_cc_sm8550_driver);
>> +}
>> +subsys_initcall(video_cc_sm8550_init);
>
> module_platform_driver() instead? There is no need to register videocc
> at the subsys level.
>
We need to evaluate and validate if module_platform_driver works for us
in all scenarios. We will post a cleanup patch once we conclude
module_platform_driver works for us in all cases.
Thanks & Regards,
Jagadeesh
next prev parent reply other threads:[~2023-05-24 14:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-09 16:12 [PATCH 0/4] Add Video Clock Controller " Jagadeesh Kona
2023-05-09 16:12 ` [PATCH 1/4] clk: qcom: clk-alpha-pll: Add support for lucid ole pll ops Jagadeesh Kona
2023-05-09 20:06 ` Konrad Dybcio
2023-05-19 12:49 ` Jagadeesh Kona
2023-05-19 13:09 ` Konrad Dybcio
2023-05-24 14:27 ` Jagadeesh Kona
2023-05-09 16:12 ` [PATCH 2/4] dt-bindings: clock: qcom: Add SM8550 video clock controller Jagadeesh Kona
2023-05-10 7:13 ` Krzysztof Kozlowski
2023-05-19 11:58 ` Jagadeesh Kona
2023-05-09 16:12 ` [PATCH 3/4] clk: qcom: videocc-sm8550: Add video clock controller driver for SM8550 Jagadeesh Kona
2023-05-09 17:15 ` Dmitry Baryshkov
2023-05-24 14:20 ` Jagadeesh Kona [this message]
2023-05-09 16:12 ` [PATCH 4/4] arm64: dts: qcom: sm8550: Add video clock controller Jagadeesh Kona
2023-05-15 12:28 ` Konrad Dybcio
2023-05-15 12:57 ` Dmitry Baryshkov
2023-05-15 13:08 ` Konrad Dybcio
2023-05-15 18:12 ` Dmitry Baryshkov
2023-05-19 11:55 ` Jagadeesh Kona
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a101f5f2-4458-8284-cc7f-1ce22389c26f@quicinc.com \
--to=quic_jkona@quicinc.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=quic_tdas@quicinc.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®