@@ -60,27 +60,6 @@ static void msm_hdmi_phy_reset(struct hdmi *hdmi)
60
60
}
61
61
}
62
62
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
-
84
63
int msm_hdmi_hpd_enable (struct drm_bridge * bridge )
85
64
{
86
65
struct hdmi_bridge * hdmi_bridge = to_hdmi_bridge (bridge );
@@ -107,7 +86,9 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge)
107
86
gpiod_set_value_cansleep (hdmi -> hpd_gpiod , 1 );
108
87
109
88
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 ;
111
92
112
93
msm_hdmi_set_mode (hdmi , false);
113
94
msm_hdmi_phy_reset (hdmi );
@@ -149,7 +130,7 @@ void msm_hdmi_hpd_disable(struct hdmi *hdmi)
149
130
150
131
msm_hdmi_set_mode (hdmi , false);
151
132
152
- enable_hpd_clocks ( hdmi , false );
133
+ clk_bulk_disable_unprepare ( config -> hpd_clk_cnt , hdmi -> hpd_clks );
153
134
pm_runtime_put (dev );
154
135
155
136
ret = pinctrl_pm_select_sleep_state (dev );
@@ -193,14 +174,20 @@ void msm_hdmi_hpd_irq(struct drm_bridge *bridge)
193
174
194
175
static enum drm_connector_status detect_reg (struct hdmi * hdmi )
195
176
{
196
- uint32_t hpd_int_status ;
177
+ const struct hdmi_platform_config * config = hdmi -> config ;
178
+ u32 hpd_int_status = 0 ;
179
+ int ret ;
197
180
198
181
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 ;
200
185
201
186
hpd_int_status = hdmi_read (hdmi , REG_HDMI_HPD_INT_STATUS );
202
187
203
- enable_hpd_clocks (hdmi , false);
188
+ clk_bulk_disable_unprepare (config -> hpd_clk_cnt , hdmi -> hpd_clks );
189
+
190
+ out :
204
191
pm_runtime_put (& hdmi -> pdev -> dev );
205
192
206
193
return (hpd_int_status & HDMI_HPD_INT_STATUS_CABLE_DETECTED ) ?
0 commit comments