Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp137612rdh; Tue, 6 Feb 2024 23:20:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIZw5PgiG7dvcyx9uyE7/0vJyDYEe7fHEg7DT7qTtdDv88++ym2PCPqAhjEId8n5hbDvF1 X-Received: by 2002:a05:622a:8091:b0:42b:fa81:b59d with SMTP id js17-20020a05622a809100b0042bfa81b59dmr4389858qtb.49.1707290417713; Tue, 06 Feb 2024 23:20:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707290417; cv=pass; d=google.com; s=arc-20160816; b=kiYsfpMJ+kmvNDyHkXyRQyj4mlKS1V0sJ3ykbes/TahPAbnhdh70czVYeY+TRYvTjY kxVFcyOI2mpY0UsAbwxn9suNbsV60vGT4lWwsih8RyYZvmswu2JOyxIS9rHzW1b1v5up m0gvG4wfikmnzqZuWygQkwe3Bq4QSQ6Jxn0yTXyndh6lBSpK8hydLfi0pzLG78Gyg+UK XF52e3g38Yi+UHqejHiNsz/3XHv06x2z2mID40USvSgQZViEFeSBEIrbtvnfnIC81NWV Wz0FSxsHXWS5r1qbKUvofUxFlIC4omESNL/AElHGcDDp5peNN8NN/EhUVZubcZMjjGtw jGUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=5daENJYj4pUJ4CRHaxq/r43mZVSt748JMtHzHYSnQ7g=; fh=nKDzve4dNnCeALo4VVxUZyLZAiDJLknZNf6qw7XaPBM=; b=a60dC6NoAJ1utLhe+dyJ7DEWT9BTsD7VSLeKU5zEZeCy9px1CCDoo6ojDiLEsIdqVu xNrFF8MkjmwPE7zal9WgAF35L/O1kB0gmHUaHkkOd4z5KvbdiJzu+YKcppFISBpOJX3y LZWf6AxHU2K9M4FIGdySRTZwADA4oTmF3TaUGZAWfWYLtI5F6o92l8noVmjtNIII40TH MDwupWTsdlOXGhD9ZiCkoPZGrjmjIhMDA2FAsxNPFVBNLjOq5RE0iuOiTK8r6a0vT9Ex QVIRO+mOFYgHDI3u4mi2SLF7yPup7wefn3mzpU6d6lauUMocovXiRHQx1SInzPAixaxV C1VA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mCGiRoXg; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-56063-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56063-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCXqdGxafR7P+LPQ6yFhTqnShrukS+3dYH3nFIW197b5jkYwVSc2A81+uaYfzrgBJnjT0gRnBoHCXHKz1OHcyplQZGO1Qpv7fJY/ZKPwng== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v16-20020a05622a015000b0042c366a6041si624251qtw.104.2024.02.06.23.20.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 23:20:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56063-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mCGiRoXg; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-56063-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56063-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CAF5F1C24230 for ; Wed, 7 Feb 2024 07:20:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1BCC9200A4; Wed, 7 Feb 2024 07:19:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mCGiRoXg" Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E75E51F5F3 for ; Wed, 7 Feb 2024 07:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707290396; cv=none; b=aNYza+/AI2H0bnBDFnEzmPc7ZlQc3+KAOa90wkAZyrN8bTiZvuikC4cA23pewelcBPK3IQhUkbHn0NVd18LMBobHX5pwDuMN87+kPP/6CrpodcFkfN8asaJGPRAmy4prD5bThczB6NbpzlRH42ZcdZfL8O1aJmZVBtVGKhNLMdQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707290396; c=relaxed/simple; bh=jOWJZSzWaK4+0VT16VB+v6WWFNJFnRP4dzFsaZYfHvA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rPA7V7voUF7KbQESRw8UHPdphUJFSgwVEaZnUn5WtXEggcUSP+1LsOtK2CTY23Pd3FvOEbdkhHX/t00n/oXaRA7owNuX5FpzTEXT8QVIR7aoSUVgdNBP2tWUYmyTlCwlZlUuhxcbyA6wnmCNg/RQInIKGjN5McgDqmQ4Y6Yx92A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=mCGiRoXg; arc=none smtp.client-ip=209.85.128.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-604983ea984so296357b3.1 for ; Tue, 06 Feb 2024 23:19:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707290392; x=1707895192; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=5daENJYj4pUJ4CRHaxq/r43mZVSt748JMtHzHYSnQ7g=; b=mCGiRoXgh7v504tWIkNW9bNPgF9ivN/fmM38g03goj9J0u7gxNFUx4uHvYK7D/cPd6 zoes8ivS2yAEyd8qC2b9f98T8SNJB0FFkQS9MaK6tpcjFXTcRqnVtXXJXtRhG3MC3Fx3 58AhMD5twCw0CA5/4pNHc+dTGVylkzW2FGuX/qom79Fi34PtAUFzANKGfgxW9iZy3L3x ZAR8i+s/yeRuw2Fd6a4FDlwhIpNmkyvoGx3eHxa5cpy0C1Q6Z4n+JJaOU7wfSIXf/sm8 M+p4GmUHx318B8qD179ihCwP4WHNT0XviPrauYOU8W7A5dWBBHfY+bQwdY+bJD1znQlv aNgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707290392; x=1707895192; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5daENJYj4pUJ4CRHaxq/r43mZVSt748JMtHzHYSnQ7g=; b=WyIrijLxXWo8/k+aGnDOovwYExJWpEF8maXW67l78w0H54j3ROyBlsbIS+CF1naYcs YDPGVXO6CejRBE2qD7EpaCJSoVP1tDWGwCbicxc9nbyYYdSENUYhELOD/IKJMITKf86D 4s4/om4aPiSDCK0wZ21P/nNmESfn6Wi/jLy+pla5TAcLMBSHEzWf8H/fFSXKmLxEU09c wXzujSNi34s4Zr2DKX4yCr4J8OKLoBOlgkU0VmviJ+Vf+oWt0IrOVcmeiHR4PTSCXIfN tZhj1MZIBhBUqQgPUIBuz29SLe8Jjvo/XPOAoKp3o+R+18laGQnI/IB3aRg5bzK5u8Td eLXA== X-Gm-Message-State: AOJu0YxEm13IBlal3nO4vA0s97ZyrZHiDB1PwyziHX2SBqAFaEK99Kbn mBc4tT9kU+/YZxS4DgvE07oudUjFnEn70pcI8o5AZlIotmsiPHOk1YWWIC0rvbF5uXr/XxX7GBs 5z6cKqoa/DPMK+TtDyDoQcyNWAdlfL7p2HDW7FQ== X-Received: by 2002:a81:ee01:0:b0:604:3f5b:550c with SMTP id l1-20020a81ee01000000b006043f5b550cmr3767918ywm.17.1707290391890; Tue, 06 Feb 2024 23:19:51 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240206113145.31096-1-quic_jkona@quicinc.com> <20240206113145.31096-3-quic_jkona@quicinc.com> In-Reply-To: From: Dmitry Baryshkov Date: Wed, 7 Feb 2024 09:19:40 +0200 Message-ID: Subject: Re: [PATCH 2/5] clk: qcom: videocc-sm8550: Add support for SM8650 videocc To: Jagadeesh Kona Cc: Bjorn Andersson , Konrad Dybcio , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vladimir Zapolskiy , Taniya Das , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Imran Shaik , Ajit Pandey Content-Type: text/plain; charset="UTF-8" On Wed, 7 Feb 2024 at 08:59, Jagadeesh Kona wrote: > > > > On 2/6/2024 5:24 PM, Dmitry Baryshkov wrote: > > On Tue, 6 Feb 2024 at 13:39, Jagadeesh Kona wrote: > >> > >> Add support to the SM8650 video clock controller by extending the > >> SM8550 video clock controller, which is mostly identical but SM8650 > >> has few additional clocks and minor differences. > > > > In the past we tried merging similar clock controllers. In the end > > this results in the ugly source code. Please consider submitting a > > separate driver. > > > > Thanks Dmitry for your review. SM8650 has only few clock additions and > minor changes compared to SM8550, so I believe it is better to reuse > this existing driver and extend it. I'd say, the final decision is on Bjorn and Konrad as maintainers. > > >> > >> Signed-off-by: Jagadeesh Kona > >> --- > >> drivers/clk/qcom/videocc-sm8550.c | 160 +++++++++++++++++++++++++++++- > >> 1 file changed, 156 insertions(+), 4 deletions(-) > >> > >> diff --git a/drivers/clk/qcom/videocc-sm8550.c b/drivers/clk/qcom/videocc-sm8550.c > >> index f3c9dfaee968..cdc08f5900fc 100644 > >> --- a/drivers/clk/qcom/videocc-sm8550.c > >> +++ b/drivers/clk/qcom/videocc-sm8550.c > >> @@ -1,6 +1,6 @@ > >> // SPDX-License-Identifier: GPL-2.0-only > >> /* > >> - * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. > >> + * Copyright (c) 2023-2024, Qualcomm Innovation Center, Inc. All rights reserved. > >> */ > >> > >> #include > > > > [skipping] > > > >> static struct gdsc video_cc_mvs0c_gdsc = { > >> .gdscr = 0x804c, > >> .en_rest_wait_val = 0x2, > >> @@ -354,15 +481,20 @@ 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_MVS0_SHIFT_CLK] = &video_cc_mvs0_shift_clk.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_MVS0C_SHIFT_CLK] = &video_cc_mvs0c_shift_clk.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_MVS1_SHIFT_CLK] = &video_cc_mvs1_shift_clk.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_MVS1C_SHIFT_CLK] = &video_cc_mvs1c_shift_clk.clkr, > >> [VIDEO_CC_PLL0] = &video_cc_pll0.clkr, > >> [VIDEO_CC_PLL1] = &video_cc_pll1.clkr, > >> + [VIDEO_CC_XO_CLK_SRC] = &video_cc_xo_clk_src.clkr, > >> }; > >> > >> static struct gdsc *video_cc_sm8550_gdscs[] = { > >> @@ -380,6 +512,7 @@ static const struct qcom_reset_map video_cc_sm8550_resets[] = { > >> [CVP_VIDEO_CC_MVS1C_BCR] = { 0x8074 }, > >> [VIDEO_CC_MVS0C_CLK_ARES] = { 0x8064, 2 }, > >> [VIDEO_CC_MVS1C_CLK_ARES] = { 0x8090, 2 }, > >> + [VIDEO_CC_XO_CLK_ARES] = { 0x8124, 2 }, > > > > Is this reset applicable to videocc-sm8550? > > > > SM8550 also has above reset support in hardware, hence it is safe to > model above reset for both SM8550 and SM8650. Then, separate commit, Fixes tag. > > >> }; > >> > >> static const struct regmap_config video_cc_sm8550_regmap_config = { > >> @@ -402,6 +535,7 @@ static struct qcom_cc_desc video_cc_sm8550_desc = { > >> > >> static const struct of_device_id video_cc_sm8550_match_table[] = { > >> { .compatible = "qcom,sm8550-videocc" }, > >> + { .compatible = "qcom,sm8650-videocc" }, > >> { } > >> }; > >> MODULE_DEVICE_TABLE(of, video_cc_sm8550_match_table); > >> @@ -410,6 +544,7 @@ static int video_cc_sm8550_probe(struct platform_device *pdev) > >> { > >> struct regmap *regmap; > >> int ret; > >> + u32 offset; > >> > >> ret = devm_pm_runtime_enable(&pdev->dev); > >> if (ret) > >> @@ -425,6 +560,23 @@ static int video_cc_sm8550_probe(struct platform_device *pdev) > >> return PTR_ERR(regmap); > >> } > >> > >> + if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8550-videocc")) { > >> + video_cc_sm8550_clocks[VIDEO_CC_MVS0_SHIFT_CLK] = NULL; > >> + video_cc_sm8550_clocks[VIDEO_CC_MVS0C_SHIFT_CLK] = NULL; > >> + video_cc_sm8550_clocks[VIDEO_CC_MVS1_SHIFT_CLK] = NULL; > >> + video_cc_sm8550_clocks[VIDEO_CC_MVS1C_SHIFT_CLK] = NULL; > >> + video_cc_sm8550_clocks[VIDEO_CC_XO_CLK_SRC] = NULL; > > > > Please invert the logic. Make video_cc_sm8550_clocks reflect SM8550 > > and patch in new clocks in the SM8650-specific branch below. > > > > Sure, will add these clocks as NULL in video_cc_sm8550_clocks and patch > in new clocks here for SM8650. Then we can remove above check for SM8550. No need to set them to NULL, it is the default value. Just add them to the sm8650 branch. > > Thanks, > Jagadeesh > > >> + offset = 0x8140; > >> + } else if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8650-videocc")) { > >> + video_cc_pll0_config.l = 0x1e; > >> + video_cc_pll0_config.alpha = 0xa000; > >> + video_cc_pll1_config.l = 0x2b; > >> + video_cc_pll1_config.alpha = 0xc000; > >> + video_cc_mvs0_clk_src.freq_tbl = ftbl_video_cc_mvs0_clk_src_sm8650; > >> + video_cc_mvs1_clk_src.freq_tbl = ftbl_video_cc_mvs1_clk_src_sm8650; > >> + offset = 0x8150; > >> + } > >> + > >> 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); > >> > >> @@ -435,7 +587,7 @@ static int video_cc_sm8550_probe(struct platform_device *pdev) > >> * 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, offset, BIT(0), BIT(0)); > >> regmap_update_bits(regmap, 0x8124, BIT(0), BIT(0)); > >> > >> ret = qcom_cc_really_probe(pdev, &video_cc_sm8550_desc, regmap); > >> -- > >> 2.43.0 > >> > >> > > > > -- With best wishes Dmitry