PM / devfreq: clk-ddr: using drm_modeset mutex when get lcdc type

Because ddr freq scanning may get clk mutex than get drm general
mutex to get lcdc_type. But when drm status change, drm may get drm
general mutex first and than get clk mutex. This may cause deadlock.
So when get lcdc type we change to use drm_modeset mutex to avoid
deadlock.

Change-Id: Ibaa1c07b14df7e1a861162efd9f7e086b8a55042
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
This commit is contained in:
Tang Yun ping
2017-08-24 11:39:34 +08:00
committed by Huang, Tao
parent e5c0ce02f2
commit 404f22df36

View File

@@ -14,6 +14,7 @@
*/
#include <drm/drmP.h>
#include <drm/drm_modeset_lock.h>
#include <dt-bindings/display/rk_fb.h>
#include <linux/arm-smccc.h>
#include <linux/clk.h>
@@ -52,14 +53,14 @@ static int rk_drm_get_lcdc_type(void)
if (drm) {
struct drm_connector *conn;
mutex_lock(&drm->mode_config.mutex);
drm_modeset_lock(&drm->mode_config.connection_mutex, NULL);
drm_for_each_connector(conn, drm) {
if (conn->encoder) {
lcdc_type = conn->connector_type;
break;
}
}
mutex_unlock(&drm->mode_config.mutex);
drm_modeset_unlock(&drm->mode_config.connection_mutex);
}
switch (lcdc_type) {