Skip to content

Commit 15a5223

Browse files
committed
drm/msm/hdmi: switch to clk_bulk API
The last platform using legacy clock names for HDMI block (APQ8064) switched to new clock names in 5.16. It's time to stop caring about old DT, drop hand-coded helpers and switch to clk_bulk_* API. Reviewed-by: Jessica Zhang <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/651716/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent a6984a3 commit 15a5223

File tree

3 files changed

+19
-37
lines changed

3 files changed

+19
-37
lines changed

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -353,17 +353,12 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
353353
if (!hdmi->hpd_clks)
354354
return -ENOMEM;
355355

356-
for (i = 0; i < config->hpd_clk_cnt; i++) {
357-
struct clk *clk;
356+
for (i = 0; i < config->hpd_clk_cnt; i++)
357+
hdmi->hpd_clks[i].id = config->hpd_clk_names[i];
358358

359-
clk = msm_clk_get(pdev, config->hpd_clk_names[i]);
360-
if (IS_ERR(clk))
361-
return dev_err_probe(dev, PTR_ERR(clk),
362-
"failed to get hpd clk: %s\n",
363-
config->hpd_clk_names[i]);
364-
365-
hdmi->hpd_clks[i] = clk;
366-
}
359+
ret = devm_clk_bulk_get(&pdev->dev, config->hpd_clk_cnt, hdmi->hpd_clks);
360+
if (ret)
361+
return ret;
367362

368363
hdmi->extp_clk = devm_clk_get_optional(&pdev->dev, "extp");
369364
if (IS_ERR(hdmi->extp_clk))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct hdmi {
4949

5050
struct regulator_bulk_data *hpd_regs;
5151
struct regulator_bulk_data *pwr_regs;
52-
struct clk **hpd_clks;
52+
struct clk_bulk_data *hpd_clks;
5353
struct clk *extp_clk;
5454

5555
struct gpio_desc *hpd_gpiod;

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

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,6 @@ static void msm_hdmi_phy_reset(struct hdmi *hdmi)
6060
}
6161
}
6262

63-
static void enable_hpd_clocks(struct hdmi *hdmi, bool enable)
64-
{
65-
const struct hdmi_platform_config *config = hdmi->config;
66-
struct device *dev = &hdmi->pdev->dev;
67-
int i, ret;
68-
69-
if (enable) {
70-
for (i = 0; i < config->hpd_clk_cnt; i++) {
71-
ret = clk_prepare_enable(hdmi->hpd_clks[i]);
72-
if (ret) {
73-
DRM_DEV_ERROR(dev,
74-
"failed to enable hpd clk: %s (%d)\n",
75-
config->hpd_clk_names[i], ret);
76-
}
77-
}
78-
} else {
79-
for (i = config->hpd_clk_cnt - 1; i >= 0; i--)
80-
clk_disable_unprepare(hdmi->hpd_clks[i]);
81-
}
82-
}
83-
8463
int msm_hdmi_hpd_enable(struct drm_bridge *bridge)
8564
{
8665
struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
@@ -107,7 +86,9 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge)
10786
gpiod_set_value_cansleep(hdmi->hpd_gpiod, 1);
10887

10988
pm_runtime_get_sync(dev);
110-
enable_hpd_clocks(hdmi, true);
89+
ret = clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks);
90+
if (ret)
91+
goto fail;
11192

11293
msm_hdmi_set_mode(hdmi, false);
11394
msm_hdmi_phy_reset(hdmi);
@@ -149,7 +130,7 @@ void msm_hdmi_hpd_disable(struct hdmi *hdmi)
149130

150131
msm_hdmi_set_mode(hdmi, false);
151132

152-
enable_hpd_clocks(hdmi, false);
133+
clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks);
153134
pm_runtime_put(dev);
154135

155136
ret = pinctrl_pm_select_sleep_state(dev);
@@ -193,14 +174,20 @@ void msm_hdmi_hpd_irq(struct drm_bridge *bridge)
193174

194175
static enum drm_connector_status detect_reg(struct hdmi *hdmi)
195176
{
196-
uint32_t hpd_int_status;
177+
const struct hdmi_platform_config *config = hdmi->config;
178+
u32 hpd_int_status = 0;
179+
int ret;
197180

198181
pm_runtime_get_sync(&hdmi->pdev->dev);
199-
enable_hpd_clocks(hdmi, true);
182+
ret = clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks);
183+
if (ret)
184+
goto out;
200185

201186
hpd_int_status = hdmi_read(hdmi, REG_HDMI_HPD_INT_STATUS);
202187

203-
enable_hpd_clocks(hdmi, false);
188+
clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks);
189+
190+
out:
204191
pm_runtime_put(&hdmi->pdev->dev);
205192

206193
return (hpd_int_status & HDMI_HPD_INT_STATUS_CABLE_DETECTED) ?

0 commit comments

Comments
 (0)