diff options
author | Long Ling <longling@google.com> | 2021-01-06 16:19:13 -0800 |
---|---|---|
committer | Long Ling <longling@google.com> | 2021-02-11 23:45:16 +0000 |
commit | 87c783cf62fa1ff174d23edfba7fa6f0b3956261 (patch) | |
tree | e9673d02224d1b417ab5e08110a89aa976713011 /samsung/exynos_drm_dsim.c | |
parent | 28548b0efbf169b2542864bc398982883fbde13f (diff) | |
download | display-87c783cf62fa1ff174d23edfba7fa6f0b3956261.tar.gz |
drm: samsung: update hs_clock sysfs
Add a second parameter to apply hs_clock immediately or at next wakeup.
Bug: 171729515
Signed-off-by: Long Ling <longling@google.com>
Change-Id: I67f87dbeaf6d5463d8763ae4e505632e4f02bd87
Diffstat (limited to 'samsung/exynos_drm_dsim.c')
-rw-r--r-- | samsung/exynos_drm_dsim.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/samsung/exynos_drm_dsim.c b/samsung/exynos_drm_dsim.c index 20fbf80..bbd3f8e 100644 --- a/samsung/exynos_drm_dsim.c +++ b/samsung/exynos_drm_dsim.c @@ -1930,7 +1930,7 @@ static int dsim_calc_underrun(const struct dsim_device *dsim, uint32_t hs_clock_ return 0; } -static int dsim_set_hs_clock(struct dsim_device *dsim, unsigned int hs_clock) +static int dsim_set_hs_clock(struct dsim_device *dsim, unsigned int hs_clock, bool apply_now) { int ret; struct stdphy_pms pms; @@ -1968,7 +1968,7 @@ static int dsim_set_hs_clock(struct dsim_device *dsim, unsigned int hs_clock) pll_param->cmd_underrun_cnt = lp_underrun; dsim_update_clock_config(dsim, pll_param); - if (dsim->state != DSIM_STATE_HSCLKEN) + if (!apply_now || dsim->state != DSIM_STATE_HSCLKEN) goto out; /* Restart dsim to apply new clock settings */ @@ -2045,13 +2045,30 @@ static ssize_t hs_clock_store(struct device *dev, struct dsim_device *dsim = dev_get_drvdata(dev); int rc; unsigned int hs_clock; + bool apply_now = true; + + char params[32]; + char *hs_clk_str; + char *apply_now_str; + char *p = params; + + strlcpy(params, buf, sizeof(params)); + hs_clk_str = strsep(&p, " "); + apply_now_str = strsep(&p, " "); + + if (apply_now_str) { + rc = kstrtobool(apply_now_str, &apply_now); + if (rc < 0) + return rc; + } - rc = kstrtouint(buf, 0, &hs_clock); + rc = kstrtouint(hs_clk_str, 0, &hs_clock); if (rc < 0) return rc; - /* hs_clock unit: MHz */ - rc = dsim_set_hs_clock(dsim, hs_clock); + /* ddr hs_clock unit: MHz */ + dsim_info(dsim, "%s: hs clock %u, apply now: %u\n", __func__, hs_clock, apply_now); + rc = dsim_set_hs_clock(dsim, hs_clock, apply_now); if (rc < 0) return rc; |