From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Krishna Manikandan <quic_mkrishn@quicinc.com>,
Jonathan Marek <jonathan@marek.ca>,
Kuogee Hsieh <quic_khsieh@quicinc.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Rob Clark <robdclark@gmail.com>,
Bjorn Andersson <andersson@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
"Stephen Boyd" <sboyd@kernel.org>,
<linux-arm-msm@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>,
<freedreno@lists.freedesktop.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
Rob Clark <robdclark@chromium.org>, <linux-clk@vger.kernel.org>,
Srinivas Kandagatla <srini@kernel.org>
Subject: Re: [PATCH v5 19/24] drm/msm/dsi: Add support for SM8750
Date: Mon, 5 May 2025 14:28:39 -0700 [thread overview]
Message-ID: <65710c50-9bfc-42e8-afad-ac01c7f96a9e@quicinc.com> (raw)
In-Reply-To: <hobn3fq647z54q6uqrooapokipr4zoxfb3tztg46lwzcsof3jd@5bwn34r2v7ks>
On 5/5/2025 5:35 AM, Dmitry Baryshkov wrote:
> On Wed, Apr 30, 2025 at 03:00:49PM +0200, Krzysztof Kozlowski wrote:
>> Add support for DSI on Qualcomm SM8750 SoC with notable difference:
>>
>> DSI PHY PLLs, the parents of pixel and byte clocks, cannot be used as
>> parents before DSI PHY is configured, the PLLs are prepared and their
>> initial rate is set. Therefore assigned-clock-parents are not working
>> here and driver is responsible for reparenting clocks with proper
>> procedure: see dsi_clk_init_6g_v2_9().
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>
>> ---
>>
>> Changes in v5:
>> 1. Only reparent byte and pixel clocks while PLLs is prepared. Setting
>> rate works fine with earlier DISP CC patch for enabling their parents
>> during rate change.
>>
>> Changes in v3:
>> 1. Drop 'struct msm_dsi_config sm8750_dsi_cfg' and use sm8650 one.
>>
>> SM8750 DSI PHY also needs Dmitry's patch:
>> https://patchwork.freedesktop.org/patch/542000/?series=119177&rev=1
>> (or some other way of correct early setting of the DSI PHY PLL rate)
>> ---
>> drivers/gpu/drm/msm/dsi/dsi.h | 2 +
>> drivers/gpu/drm/msm/dsi/dsi_cfg.c | 14 +++++++
>> drivers/gpu/drm/msm/dsi/dsi_cfg.h | 1 +
>> drivers/gpu/drm/msm/dsi/dsi_host.c | 81 ++++++++++++++++++++++++++++++++++++++
>> 4 files changed, 98 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
>> index 87496db203d6c7582eadcb74e94eb56a219df292..93c028a122f3a59b1632da76472e0a3e781c6ae8 100644
>> --- a/drivers/gpu/drm/msm/dsi/dsi.h
>> +++ b/drivers/gpu/drm/msm/dsi/dsi.h
>> @@ -98,6 +98,7 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi);
>> int msm_dsi_runtime_suspend(struct device *dev);
>> int msm_dsi_runtime_resume(struct device *dev);
>> int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host);
>> +int dsi_link_clk_set_rate_6g_v2_9(struct msm_dsi_host *msm_host);
>> int dsi_link_clk_set_rate_v2(struct msm_dsi_host *msm_host);
>> int dsi_link_clk_enable_6g(struct msm_dsi_host *msm_host);
>> int dsi_link_clk_enable_v2(struct msm_dsi_host *msm_host);
>> @@ -115,6 +116,7 @@ int dsi_dma_base_get_6g(struct msm_dsi_host *msm_host, uint64_t *iova);
>> int dsi_dma_base_get_v2(struct msm_dsi_host *msm_host, uint64_t *iova);
>> int dsi_clk_init_v2(struct msm_dsi_host *msm_host);
>> int dsi_clk_init_6g_v2(struct msm_dsi_host *msm_host);
>> +int dsi_clk_init_6g_v2_9(struct msm_dsi_host *msm_host);
>> int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool is_bonded_dsi);
>> int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_bonded_dsi);
>> void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct mipi_dsi_host *host);
>> diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
>> index 7754dcec33d06e3d6eb8a9d55e53f24af073adb9..7f8a8de0897a579a525b466fd01bbcd95454c614 100644
>> --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c
>> +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
>> @@ -257,6 +257,18 @@ static const struct msm_dsi_host_cfg_ops msm_dsi_6g_v2_host_ops = {
>> .calc_clk_rate = dsi_calc_clk_rate_6g,
>> };
>>
>> +static const struct msm_dsi_host_cfg_ops msm_dsi_6g_v2_9_host_ops = {
>> + .link_clk_set_rate = dsi_link_clk_set_rate_6g_v2_9,
>> + .link_clk_enable = dsi_link_clk_enable_6g,
>> + .link_clk_disable = dsi_link_clk_disable_6g,
>> + .clk_init_ver = dsi_clk_init_6g_v2_9,
>> + .tx_buf_alloc = dsi_tx_buf_alloc_6g,
>> + .tx_buf_get = dsi_tx_buf_get_6g,
>> + .tx_buf_put = dsi_tx_buf_put_6g,
>> + .dma_base_get = dsi_dma_base_get_6g,
>> + .calc_clk_rate = dsi_calc_clk_rate_6g,
>> +};
>> +
>> static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
>> {MSM_DSI_VER_MAJOR_V2, MSM_DSI_V2_VER_MINOR_8064,
>> &apq8064_dsi_cfg, &msm_dsi_v2_host_ops},
>> @@ -300,6 +312,8 @@ static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
>> &sm8550_dsi_cfg, &msm_dsi_6g_v2_host_ops},
>> {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_8_0,
>> &sm8650_dsi_cfg, &msm_dsi_6g_v2_host_ops},
>> + {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_9_0,
>> + &sm8650_dsi_cfg, &msm_dsi_6g_v2_9_host_ops},
>> };
>>
>> const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
>> diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
>> index 120cb65164c1ba1deb9acb513e5f073bd560c496..859c279afbb0377d16f8406f3e6b083640aff5a1 100644
>> --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
>> +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
>> @@ -30,6 +30,7 @@
>> #define MSM_DSI_6G_VER_MINOR_V2_6_0 0x20060000
>> #define MSM_DSI_6G_VER_MINOR_V2_7_0 0x20070000
>> #define MSM_DSI_6G_VER_MINOR_V2_8_0 0x20080000
>> +#define MSM_DSI_6G_VER_MINOR_V2_9_0 0x20090000
>>
>> #define MSM_DSI_V2_VER_MINOR_8064 0x0
>>
>> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
>> index 4d75529c0e858160761f5eb55db65e5d7565c27b..694ed95897d49c477726a2b0bec1099e75a3ce21 100644
>> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
>> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
>> @@ -119,6 +119,15 @@ struct msm_dsi_host {
>> struct clk *pixel_clk;
>> struct clk *byte_intf_clk;
>>
>> + /*
>> + * Clocks which needs to be properly parented between DISPCC and DSI PHY
>> + * PLL:
>> + */
>> + struct clk *byte_src_clk;
>> + struct clk *pixel_src_clk;
>> + struct clk *dsi_pll_byte_clk;
>> + struct clk *dsi_pll_pixel_clk;
>> +
>> unsigned long byte_clk_rate;
>> unsigned long byte_intf_clk_rate;
>> unsigned long pixel_clk_rate;
>> @@ -269,6 +278,38 @@ int dsi_clk_init_6g_v2(struct msm_dsi_host *msm_host)
>> return ret;
>> }
>>
>> +int dsi_clk_init_6g_v2_9(struct msm_dsi_host *msm_host)
>> +{
>> + struct device *dev = &msm_host->pdev->dev;
>> + int ret;
>> +
>> + ret = dsi_clk_init_6g_v2(msm_host);
>> + if (ret)
>> + return ret;
>> +
>> + msm_host->byte_src_clk = devm_clk_get(dev, "byte_src");
>> + if (IS_ERR(msm_host->byte_src_clk))
>> + return dev_err_probe(dev, PTR_ERR(msm_host->byte_src_clk),
>> + "can't get byte_src clock\n");
>> +
>> + msm_host->dsi_pll_byte_clk = devm_clk_get(dev, "dsi_pll_byte");
>> + if (IS_ERR(msm_host->dsi_pll_byte_clk))
>> + return dev_err_probe(dev, PTR_ERR(msm_host->dsi_pll_byte_clk),
>> + "can't get dsi_pll_byte clock\n");
>> +
>> + msm_host->pixel_src_clk = devm_clk_get(dev, "pixel_src");
>> + if (IS_ERR(msm_host->pixel_src_clk))
>> + return dev_err_probe(dev, PTR_ERR(msm_host->pixel_src_clk),
>> + "can't get pixel_src clock\n");
>> +
>> + msm_host->dsi_pll_pixel_clk = devm_clk_get(dev, "dsi_pll_pixel");
>> + if (IS_ERR(msm_host->dsi_pll_pixel_clk))
>> + return dev_err_probe(dev, PTR_ERR(msm_host->dsi_pll_pixel_clk),
>> + "can't get dsi_pll_pixel clock\n");
>> +
>> + return 0;
>> +}
>> +
>> static int dsi_clk_init(struct msm_dsi_host *msm_host)
>> {
>> struct platform_device *pdev = msm_host->pdev;
>> @@ -370,6 +411,46 @@ int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host)
>> return 0;
>> }
>>
>> +int dsi_link_clk_set_rate_6g_v2_9(struct msm_dsi_host *msm_host)
>> +{
>> + struct device *dev = &msm_host->pdev->dev;
>> + int ret;
>> +
>> + /*
>> + * DSI PHY PLLs have to be enabled to allow reparenting to them and
>> + * setting the rates of pixel/byte clocks.
>> + */
>
> According to the docs this should be handled by the
> CLK_OPS_PARENT_ENABLE flag. Please correct me if I'm wrong.
>
I am also interested to know that if we are indeed setting
CLK_OPS_PARENT_ENABLE flag, do we need this logic in the dsi driver.
If CLK_OPS_PARENT_ENABLE flag is not working as expected, shouldnt this
be something fixed on the clk fwk side?
Thanks
Abhinav
>> + ret = clk_prepare_enable(msm_host->dsi_pll_byte_clk);
>> + if (ret) {
>> + dev_err(dev, "Failed to enable dsi_pll_byte: %d\n", ret);
>> + return ret;
>> + }
>> +
>> + ret = clk_prepare_enable(msm_host->dsi_pll_pixel_clk);
>
> And this.
>
>> + if (ret) {
>> + dev_err(dev, "Failed to enable dsi_pll_byte: %d\n", ret);
>> + goto out_disable_byte_clk;
>> + }
>> +
>> + ret = clk_set_parent(msm_host->byte_src_clk, msm_host->dsi_pll_byte_clk);
>> + if (ret)
>> + dev_err(dev, "Failed to parent byte_src -> dsi_pll_byte: %d\n", ret);
>> +
>> + ret = clk_set_parent(msm_host->pixel_src_clk, msm_host->dsi_pll_pixel_clk);
>> + if (ret)
>> + dev_err(dev, "Failed to parent pixel_src -> dsi_pll_pixel: %d\n", ret);
>> +
>> + clk_disable_unprepare(msm_host->dsi_pll_pixel_clk);
>> + clk_disable_unprepare(msm_host->dsi_pll_byte_clk);
>> +
>> + return dsi_link_clk_set_rate_6g(msm_host);
>> +
>> +out_disable_byte_clk:
>> + clk_disable_unprepare(msm_host->dsi_pll_byte_clk);
>> +
>> + return ret;
>> +}
>> +
>> int dsi_link_clk_enable_6g(struct msm_dsi_host *msm_host)
>> {
>> int ret;
>>
>> --
>> 2.45.2
>>
>
next prev parent reply other threads:[~2025-05-05 21:29 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 13:00 [PATCH v5 00/24] drm/msm: Add support for SM8750 Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 01/24] dt-bindings: display/msm: dsi-phy-7nm: Add SM8750 Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 02/24] dt-bindings: display/msm: dsi-controller-main: " Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 03/24] dt-bindings: display/msm: dp-controller: " Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 04/24] dt-bindings: display/msm: qcom,sm8650-dpu: " Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 05/24] dt-bindings: display/msm: qcom,sm8750-mdss: " Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 06/24] clk: qcom: dispcc-sm8750: Fix setting rate byte and pixel clocks Krzysztof Kozlowski
2025-05-02 22:42 ` Dmitry Baryshkov
2025-05-05 6:15 ` Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 07/24] drm/msm/dpu: Add missing "fetch" name to set_active_pipes() Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 08/24] drm/msm/dpu: Clear CTL_FETCH_PIPE_ACTIVE on mixer reset Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 09/24] drm/msm/dpu: Clear CTL_FETCH_PIPE_ACTIVE on ctl_path reset Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 10/24] drm/msm/dpu: Clear CTL_FETCH_PIPE_ACTIVE before blend setup Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 11/24] drm/msm/dpu: Drop useless comments Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 12/24] drm/msm/dpu: Add LM_7, DSC_[67], PP_[67] and MERGE_3D_5 Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 13/24] drm/msm/dpu: Add handling of LM_6 and LM_7 bits in pending flush mask Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 14/24] drm/msm/dsi/phy: Toggle back buffer resync after preparing PLL Krzysztof Kozlowski
2025-05-02 22:43 ` Dmitry Baryshkov
2025-04-30 13:00 ` [PATCH v5 15/24] drm/msm/dsi/phy: Define PHY_CMN_CTRL_0 bitfields Krzysztof Kozlowski
2025-05-02 22:44 ` Dmitry Baryshkov
2025-05-05 6:17 ` Krzysztof Kozlowski
2025-05-05 14:14 ` Dmitry Baryshkov
2025-05-20 10:57 ` Krzysztof Kozlowski
2025-05-20 21:23 ` Dmitry Baryshkov
2025-05-21 6:11 ` Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 16/24] drm/msm/dsi/phy: Fix reading zero as PLL rates when unprepared Krzysztof Kozlowski
2025-04-30 13:11 ` Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 17/24] drm/msm/dsi/phy: Fix missing initial VCO rate Krzysztof Kozlowski
2025-05-02 22:48 ` Dmitry Baryshkov
2025-04-30 13:00 ` [PATCH v5 18/24] drm/msm/dsi/phy: Add support for SM8750 Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 19/24] drm/msm/dsi: " Krzysztof Kozlowski
2025-05-02 22:52 ` Dmitry Baryshkov
2025-05-05 6:45 ` Krzysztof Kozlowski
2025-05-05 12:26 ` Dmitry Baryshkov
2025-05-05 12:35 ` Dmitry Baryshkov
2025-05-05 21:28 ` Abhinav Kumar [this message]
2025-05-19 15:11 ` Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 20/24] drm/msm/dpu: " Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 21/24] drm/msm/dpu: Implement 10-bit color alpha for v12.0 DPU Krzysztof Kozlowski
2025-05-05 12:24 ` Dmitry Baryshkov
2025-05-19 16:49 ` Abhinav Kumar
2025-05-19 16:53 ` Dmitry Baryshkov
2025-05-23 6:55 ` Abel Vesa
2025-05-23 7:02 ` Abel Vesa
2025-05-23 8:29 ` Dmitry Baryshkov
2025-05-23 9:50 ` Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 22/24] drm/msm/dpu: Implement CTL_PIPE_ACTIVE " Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 23/24] drm/msm/dpu: Implement LM crossbar " Krzysztof Kozlowski
2025-04-30 13:00 ` [PATCH v5 24/24] drm/msm/mdss: Add support for SM8750 Krzysztof Kozlowski
2025-05-17 0:08 ` [PATCH v5 00/24] drm/msm: " Jessica Zhang
2025-05-19 14:52 ` Krzysztof Kozlowski
2025-05-19 15:07 ` Dmitry Baryshkov
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=65710c50-9bfc-42e8-afad-ac01c7f96a9e@quicinc.com \
--to=quic_abhinavk@quicinc.com \
--cc=airlied@gmail.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jonathan@marek.ca \
--cc=krzk+dt@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marijn.suijten@somainline.org \
--cc=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--cc=neil.armstrong@linaro.org \
--cc=quic_khsieh@quicinc.com \
--cc=quic_mkrishn@quicinc.com \
--cc=robdclark@chromium.org \
--cc=robdclark@gmail.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
--cc=srini@kernel.org \
--cc=tzimmermann@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).