Skip to content

Commit 858c595

Browse files
lumagrobclark
authored andcommitted
drm/msm/dsi: add continuous clock support for 7nm PHY
Unlike previous generations, 7nm PHYs are required to collaborate with the host for continuos clock mode. Add changes neccessary to enable continuous clock mode in the 7nm DSI PHYs. Signed-off-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] [Fix merge conflict, and $description typo] Signed-off-by: Rob Clark <[email protected]>
1 parent 26ae419 commit 858c595

File tree

7 files changed

+40
-7
lines changed

7 files changed

+40
-7
lines changed

drivers/gpu/drm/msm/dsi/dsi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ int msm_dsi_host_enable(struct mipi_dsi_host *host);
109109
int msm_dsi_host_disable(struct mipi_dsi_host *host);
110110
int msm_dsi_host_power_on(struct mipi_dsi_host *host,
111111
struct msm_dsi_phy_shared_timings *phy_shared_timings,
112-
bool is_bonded_dsi);
112+
bool is_bonded_dsi, struct msm_dsi_phy *phy);
113113
int msm_dsi_host_power_off(struct mipi_dsi_host *host);
114114
int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
115115
const struct drm_display_mode *mode);
@@ -176,6 +176,7 @@ int msm_dsi_phy_get_clk_provider(struct msm_dsi_phy *phy,
176176
void msm_dsi_phy_pll_save_state(struct msm_dsi_phy *phy);
177177
int msm_dsi_phy_pll_restore_state(struct msm_dsi_phy *phy);
178178
void msm_dsi_phy_snapshot(struct msm_disp_state *disp_state, struct msm_dsi_phy *phy);
179+
bool msm_dsi_phy_set_continuous_clock(struct msm_dsi_phy *phy, bool enable);
179180

180181
#endif /* __DSI_CONNECTOR_H__ */
181182

drivers/gpu/drm/msm/dsi/dsi.xml.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ static inline uint32_t DSI_CLKOUT_TIMING_CTRL_T_CLK_POST(uint32_t val)
544544
#define DSI_LANE_STATUS_DLN0_DIRECTION 0x00010000
545545

546546
#define REG_DSI_LANE_CTRL 0x000000a8
547+
#define DSI_LANE_CTRL_HS_REQ_SEL_PHY 0x01000000
547548
#define DSI_LANE_CTRL_CLKLN_HS_FORCE_REQUEST 0x10000000
548549

549550
#define REG_DSI_LANE_SWAP_CTRL 0x000000ac

drivers/gpu/drm/msm/dsi/dsi_host.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ static inline enum dsi_cmd_dst_format dsi_get_cmd_fmt(
832832
}
833833

834834
static void dsi_ctrl_config(struct msm_dsi_host *msm_host, bool enable,
835-
struct msm_dsi_phy_shared_timings *phy_shared_timings)
835+
struct msm_dsi_phy_shared_timings *phy_shared_timings, struct msm_dsi_phy *phy)
836836
{
837837
u32 flags = msm_host->mode_flags;
838838
enum mipi_dsi_pixel_format mipi_fmt = msm_host->format;
@@ -927,6 +927,10 @@ static void dsi_ctrl_config(struct msm_dsi_host *msm_host, bool enable,
927927

928928
if (!(flags & MIPI_DSI_CLOCK_NON_CONTINUOUS)) {
929929
lane_ctrl = dsi_read(msm_host, REG_DSI_LANE_CTRL);
930+
931+
if (msm_dsi_phy_set_continuous_clock(phy, enable))
932+
lane_ctrl &= ~DSI_LANE_CTRL_HS_REQ_SEL_PHY;
933+
930934
dsi_write(msm_host, REG_DSI_LANE_CTRL,
931935
lane_ctrl | DSI_LANE_CTRL_CLKLN_HS_FORCE_REQUEST);
932936
}
@@ -2364,7 +2368,7 @@ static void msm_dsi_sfpb_config(struct msm_dsi_host *msm_host, bool enable)
23642368

23652369
int msm_dsi_host_power_on(struct mipi_dsi_host *host,
23662370
struct msm_dsi_phy_shared_timings *phy_shared_timings,
2367-
bool is_bonded_dsi)
2371+
bool is_bonded_dsi, struct msm_dsi_phy *phy)
23682372
{
23692373
struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
23702374
const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd;
@@ -2404,7 +2408,7 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host,
24042408

24052409
dsi_timing_setup(msm_host, is_bonded_dsi);
24062410
dsi_sw_reset(msm_host);
2407-
dsi_ctrl_config(msm_host, true, phy_shared_timings);
2411+
dsi_ctrl_config(msm_host, true, phy_shared_timings, phy);
24082412

24092413
if (msm_host->disp_en_gpio)
24102414
gpiod_set_value(msm_host->disp_en_gpio, 1);
@@ -2435,7 +2439,7 @@ int msm_dsi_host_power_off(struct mipi_dsi_host *host)
24352439
goto unlock_ret;
24362440
}
24372441

2438-
dsi_ctrl_config(msm_host, false, NULL);
2442+
dsi_ctrl_config(msm_host, false, NULL, NULL);
24392443

24402444
if (msm_host->disp_en_gpio)
24412445
gpiod_set_value(msm_host->disp_en_gpio, 0);

drivers/gpu/drm/msm/dsi/dsi_manager.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,15 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge)
361361
if (ret)
362362
goto phy_en_fail;
363363

364-
ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], is_bonded_dsi);
364+
ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], is_bonded_dsi, msm_dsi->phy);
365365
if (ret) {
366366
pr_err("%s: power on host %d failed, %d\n", __func__, id, ret);
367367
goto host_on_fail;
368368
}
369369

370370
if (is_bonded_dsi && msm_dsi1) {
371371
ret = msm_dsi_host_power_on(msm_dsi1->host,
372-
&phy_shared_timings[DSI_1], is_bonded_dsi);
372+
&phy_shared_timings[DSI_1], is_bonded_dsi, msm_dsi1->phy);
373373
if (ret) {
374374
pr_err("%s: power on host1 failed, %d\n",
375375
__func__, ret);

drivers/gpu/drm/msm/dsi/phy/dsi_phy.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,15 @@ void msm_dsi_phy_set_usecase(struct msm_dsi_phy *phy,
881881
phy->usecase = uc;
882882
}
883883

884+
/* Returns true if we have to clear DSI_LANE_CTRL.HS_REQ_SEL_PHY */
885+
bool msm_dsi_phy_set_continuous_clock(struct msm_dsi_phy *phy, bool enable)
886+
{
887+
if (!phy || !phy->cfg->ops.set_continuous_clock)
888+
return false;
889+
890+
return phy->cfg->ops.set_continuous_clock(phy, enable);
891+
}
892+
884893
int msm_dsi_phy_get_clk_provider(struct msm_dsi_phy *phy,
885894
struct clk **byte_clk_provider, struct clk **pixel_clk_provider)
886895
{

drivers/gpu/drm/msm/dsi/phy/dsi_phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct msm_dsi_phy_ops {
2424
void (*disable)(struct msm_dsi_phy *phy);
2525
void (*save_pll_state)(struct msm_dsi_phy *phy);
2626
int (*restore_pll_state)(struct msm_dsi_phy *phy);
27+
bool (*set_continuous_clock)(struct msm_dsi_phy *phy, bool enable);
2728
};
2829

2930
struct msm_dsi_phy_cfg {

drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,21 @@ static int dsi_7nm_phy_enable(struct msm_dsi_phy *phy,
991991
return 0;
992992
}
993993

994+
static bool dsi_7nm_set_continuous_clock(struct msm_dsi_phy *phy, bool enable)
995+
{
996+
void __iomem *base = phy->base;
997+
u32 data;
998+
999+
data = dsi_phy_read(base + REG_DSI_7nm_PHY_CMN_LANE_CTRL1);
1000+
if (enable)
1001+
data |= BIT(5) | BIT(6);
1002+
else
1003+
data &= ~(BIT(5) | BIT(6));
1004+
dsi_phy_write(base + REG_DSI_7nm_PHY_CMN_LANE_CTRL1, data);
1005+
1006+
return enable;
1007+
}
1008+
9941009
static void dsi_7nm_phy_disable(struct msm_dsi_phy *phy)
9951010
{
9961011
void __iomem *base = phy->base;
@@ -1031,6 +1046,7 @@ const struct msm_dsi_phy_cfg dsi_phy_7nm_cfgs = {
10311046
.pll_init = dsi_pll_7nm_init,
10321047
.save_pll_state = dsi_7nm_pll_save_state,
10331048
.restore_pll_state = dsi_7nm_pll_restore_state,
1049+
.set_continuous_clock = dsi_7nm_set_continuous_clock,
10341050
},
10351051
.min_pll_rate = 600000000UL,
10361052
#ifdef CONFIG_64BIT
@@ -1057,6 +1073,7 @@ const struct msm_dsi_phy_cfg dsi_phy_7nm_8150_cfgs = {
10571073
.pll_init = dsi_pll_7nm_init,
10581074
.save_pll_state = dsi_7nm_pll_save_state,
10591075
.restore_pll_state = dsi_7nm_pll_restore_state,
1076+
.set_continuous_clock = dsi_7nm_set_continuous_clock,
10601077
},
10611078
.min_pll_rate = 1000000000UL,
10621079
.max_pll_rate = 3500000000UL,

0 commit comments

Comments
 (0)