Skip to content

Commit b0d5e35

Browse files
tombagregkh
authored andcommitted
phy: cdns-dphy: Store hs_clk_rate and return it
[ 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 <[email protected]> Tested-by: Parth Pancholi <[email protected]> Tested-by: Jayesh Choudhary <[email protected]> Acked-by: Vinod Koul <[email protected]> Reviewed-by: Devarsh Thakkar <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://lore.kernel.org/r/20250723-cdns-dphy-hs-clk-rate-fix-v1-1-d4539d44cbe7@ideasonboard.com Signed-off-by: Vinod Koul <[email protected]> Stable-dep-of: 284fb19a3ffb ("phy: cadence: cdns-dphy: Fix PLL lock and O_CMN_READY polling") Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d12f38a commit b0d5e35

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/phy/cadence/cdns-dphy.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ struct cdns_dphy_cfg {
7979
u8 pll_ipdiv;
8080
u8 pll_opdiv;
8181
u16 pll_fbdiv;
82+
u32 hs_clk_rate;
8283
unsigned int nlanes;
8384
};
8485

@@ -154,6 +155,9 @@ static int cdns_dsi_get_dphy_pll_cfg(struct cdns_dphy *dphy,
154155
cfg->pll_ipdiv,
155156
pll_ref_hz);
156157

158+
cfg->hs_clk_rate = div_u64((u64)pll_ref_hz * cfg->pll_fbdiv,
159+
2 * cfg->pll_opdiv * cfg->pll_ipdiv);
160+
157161
return 0;
158162
}
159163

@@ -297,6 +301,7 @@ static int cdns_dphy_config_from_opts(struct phy *phy,
297301
if (ret)
298302
return ret;
299303

304+
opts->hs_clk_rate = cfg->hs_clk_rate;
300305
opts->wakeup = cdns_dphy_get_wakeup_time_ns(dphy) / 1000;
301306

302307
return 0;

0 commit comments

Comments
 (0)