Skip to content

Commit 7e53b0a

Browse files
committed
drm/msm/hdmi: simplify extp clock handling
With the extp being the only "power" clock left, remove the surrounding loops and handle the extp clock directly. Reviewed-by: Jessica Zhang <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/651710/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent e300f26 commit 7e53b0a

File tree

3 files changed

+18
-45
lines changed

3 files changed

+18
-45
lines changed

drivers/gpu/drm/msm/hdmi/hdmi.c

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,11 @@ static const struct hdmi_platform_config hdmi_tx_8960_config = {
233233
};
234234

235235
static const char * const pwr_reg_names_8x74[] = {"core-vdda", "core-vcc"};
236-
static const char * const pwr_clk_names_8x74[] = {"extp"};
237236
static const char * const hpd_clk_names_8x74[] = {"iface", "core", "mdp_core", "alt_iface"};
238237
static unsigned long hpd_clk_freq_8x74[] = {0, 19200000, 0, 0};
239238

240239
static const struct hdmi_platform_config hdmi_tx_8974_config = {
241240
HDMI_CFG(pwr_reg, 8x74),
242-
HDMI_CFG(pwr_clk, 8x74),
243241
HDMI_CFG(hpd_clk, 8x74),
244242
.hpd_freq = hpd_clk_freq_8x74,
245243
};
@@ -369,24 +367,10 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
369367
hdmi->hpd_clks[i] = clk;
370368
}
371369

372-
hdmi->pwr_clks = devm_kcalloc(&pdev->dev,
373-
config->pwr_clk_cnt,
374-
sizeof(hdmi->pwr_clks[0]),
375-
GFP_KERNEL);
376-
if (!hdmi->pwr_clks)
377-
return -ENOMEM;
378-
379-
for (i = 0; i < config->pwr_clk_cnt; i++) {
380-
struct clk *clk;
381-
382-
clk = msm_clk_get(pdev, config->pwr_clk_names[i]);
383-
if (IS_ERR(clk))
384-
return dev_err_probe(dev, PTR_ERR(clk),
385-
"failed to get pwr clk: %s\n",
386-
config->pwr_clk_names[i]);
387-
388-
hdmi->pwr_clks[i] = clk;
389-
}
370+
hdmi->extp_clk = devm_clk_get_optional(&pdev->dev, "extp");
371+
if (IS_ERR(hdmi->extp_clk))
372+
return dev_err_probe(dev, PTR_ERR(hdmi->extp_clk),
373+
"failed to get extp clock\n");
390374

391375
hdmi->hpd_gpiod = devm_gpiod_get_optional(&pdev->dev, "hpd", GPIOD_IN);
392376
/* This will catch e.g. -EPROBE_DEFER */

drivers/gpu/drm/msm/hdmi/hdmi.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct hdmi {
5050
struct regulator_bulk_data *hpd_regs;
5151
struct regulator_bulk_data *pwr_regs;
5252
struct clk **hpd_clks;
53-
struct clk **pwr_clks;
53+
struct clk *extp_clk;
5454

5555
struct gpio_desc *hpd_gpiod;
5656

@@ -95,10 +95,6 @@ struct hdmi_platform_config {
9595
const char * const *hpd_clk_names;
9696
const long unsigned *hpd_freq;
9797
int hpd_clk_cnt;
98-
99-
/* clks that need to be on for screen pwr (ie pixel clk): */
100-
const char * const *pwr_clk_names;
101-
int pwr_clk_cnt;
10298
};
10399

104100
struct hdmi_bridge {

drivers/gpu/drm/msm/hdmi/hdmi_bridge.c

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,23 @@ static void msm_hdmi_power_on(struct drm_bridge *bridge)
1919
struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
2020
struct hdmi *hdmi = hdmi_bridge->hdmi;
2121
const struct hdmi_platform_config *config = hdmi->config;
22-
int i, ret;
22+
int ret;
2323

2424
pm_runtime_get_sync(&hdmi->pdev->dev);
2525

2626
ret = regulator_bulk_enable(config->pwr_reg_cnt, hdmi->pwr_regs);
2727
if (ret)
2828
DRM_DEV_ERROR(dev->dev, "failed to enable pwr regulator: %d\n", ret);
2929

30-
if (config->pwr_clk_cnt > 0) {
30+
if (hdmi->extp_clk) {
3131
DBG("pixclock: %lu", hdmi->pixclock);
32-
ret = clk_set_rate(hdmi->pwr_clks[0], hdmi->pixclock);
33-
if (ret) {
34-
DRM_DEV_ERROR(dev->dev, "failed to set pixel clk: %s (%d)\n",
35-
config->pwr_clk_names[0], ret);
36-
}
37-
}
32+
ret = clk_set_rate(hdmi->extp_clk, hdmi->pixclock);
33+
if (ret)
34+
DRM_DEV_ERROR(dev->dev, "failed to set extp clk rate: %d\n", ret);
3835

39-
for (i = 0; i < config->pwr_clk_cnt; i++) {
40-
ret = clk_prepare_enable(hdmi->pwr_clks[i]);
41-
if (ret) {
42-
DRM_DEV_ERROR(dev->dev, "failed to enable pwr clk: %s (%d)\n",
43-
config->pwr_clk_names[i], ret);
44-
}
36+
ret = clk_prepare_enable(hdmi->extp_clk);
37+
if (ret)
38+
DRM_DEV_ERROR(dev->dev, "failed to enable extp clk: %d\n", ret);
4539
}
4640
}
4741

@@ -51,15 +45,15 @@ static void power_off(struct drm_bridge *bridge)
5145
struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
5246
struct hdmi *hdmi = hdmi_bridge->hdmi;
5347
const struct hdmi_platform_config *config = hdmi->config;
54-
int i, ret;
48+
int ret;
5549

5650
/* TODO do we need to wait for final vblank somewhere before
5751
* cutting the clocks?
5852
*/
5953
mdelay(16 + 4);
6054

61-
for (i = 0; i < config->pwr_clk_cnt; i++)
62-
clk_disable_unprepare(hdmi->pwr_clks[i]);
55+
if (hdmi->extp_clk)
56+
clk_disable_unprepare(hdmi->extp_clk);
6357

6458
ret = regulator_bulk_disable(config->pwr_reg_cnt, hdmi->pwr_regs);
6559
if (ret)
@@ -438,7 +432,6 @@ static enum drm_mode_status msm_hdmi_bridge_tmds_char_rate_valid(const struct dr
438432
{
439433
struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
440434
struct hdmi *hdmi = hdmi_bridge->hdmi;
441-
const struct hdmi_platform_config *config = hdmi->config;
442435
struct msm_drm_private *priv = bridge->dev->dev_private;
443436
struct msm_kms *kms = priv->kms;
444437
long actual;
@@ -451,8 +444,8 @@ static enum drm_mode_status msm_hdmi_bridge_tmds_char_rate_valid(const struct dr
451444
actual = kms->funcs->round_pixclk(kms,
452445
tmds_rate,
453446
hdmi_bridge->hdmi->encoder);
454-
else if (config->pwr_clk_cnt > 0)
455-
actual = clk_round_rate(hdmi->pwr_clks[0], tmds_rate);
447+
else if (hdmi->extp_clk)
448+
actual = clk_round_rate(hdmi->extp_clk, tmds_rate);
456449
else
457450
actual = tmds_rate;
458451

0 commit comments

Comments
 (0)