]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
phy: cdns-dphy: Store hs_clk_rate and return it
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Mon, 20 Oct 2025 12:59:58 +0000 (08:59 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2025 13:04:39 +0000 (14:04 +0100)
[ Upstream commit 689a54acb56858c85de8c7285db82b8ae6dbf683 ]

The DPHY driver does not return the actual hs_clk_rate, so the DSI
driver has no idea what clock was actually achieved. Set the realized
hs_clk_rate to the opts struct, so that the DSI driver gets it back.

Reviewed-by: Aradhya Bhatia <aradhya.bhatia@linux.dev>
Tested-by: Parth Pancholi <parth.pancholi@toradex.com>
Tested-by: Jayesh Choudhary <j-choudhary@ti.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://lore.kernel.org/r/20250723-cdns-dphy-hs-clk-rate-fix-v1-1-d4539d44cbe7@ideasonboard.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Stable-dep-of: 284fb19a3ffb ("phy: cadence: cdns-dphy: Fix PLL lock and O_CMN_READY polling")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/phy/cadence/cdns-dphy.c

index 3dfdfb33cd0ac7378210fdeae231be6123253975..23ab48671b79c5eab94a98c9652e3188313ad724 100644 (file)
@@ -80,6 +80,7 @@ struct cdns_dphy_cfg {
        u8 pll_ipdiv;
        u8 pll_opdiv;
        u16 pll_fbdiv;
+       u32 hs_clk_rate;
        unsigned int nlanes;
 };
 
@@ -155,6 +156,9 @@ static int cdns_dsi_get_dphy_pll_cfg(struct cdns_dphy *dphy,
                                          cfg->pll_ipdiv,
                                          pll_ref_hz);
 
+       cfg->hs_clk_rate = div_u64((u64)pll_ref_hz * cfg->pll_fbdiv,
+                                  2 * cfg->pll_opdiv * cfg->pll_ipdiv);
+
        return 0;
 }
 
@@ -298,6 +302,7 @@ static int cdns_dphy_config_from_opts(struct phy *phy,
        if (ret)
                return ret;
 
+       opts->hs_clk_rate = cfg->hs_clk_rate;
        opts->wakeup = cdns_dphy_get_wakeup_time_ns(dphy) / 1000;
 
        return 0;