Przeglądaj źródła

Merge branch 'mediatek-drm-fixes-4.12-rc1' of https://github.com/ckhu-mediatek/linux.git-tags into drm-fixes

mediatek fixes

* 'mediatek-drm-fixes-4.12-rc1' of https://github.com/ckhu-mediatek/linux.git-tags:
  drm/mediatek: fix mtk_hdmi_setup_vendor_specific_infoframe mistake
  drm/mediatek: fix a timeout loop
Dave Airlie 8 lat temu
rodzic
commit
97f607fe0d

+ 6 - 9
drivers/gpu/drm/mediatek/mtk_dsi.c

@@ -19,6 +19,7 @@
 #include <drm/drm_of.h>
 #include <drm/drm_of.h>
 #include <linux/clk.h>
 #include <linux/clk.h>
 #include <linux/component.h>
 #include <linux/component.h>
+#include <linux/iopoll.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
 #include <linux/of.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/of_platform.h>
@@ -900,16 +901,12 @@ static int mtk_dsi_host_detach(struct mipi_dsi_host *host,
 
 
 static void mtk_dsi_wait_for_idle(struct mtk_dsi *dsi)
 static void mtk_dsi_wait_for_idle(struct mtk_dsi *dsi)
 {
 {
-	u32 timeout_ms = 500000; /* total 1s ~ 2s timeout */
-
-	while (timeout_ms--) {
-		if (!(readl(dsi->regs + DSI_INTSTA) & DSI_BUSY))
-			break;
-
-		usleep_range(2, 4);
-	}
+	int ret;
+	u32 val;
 
 
-	if (timeout_ms == 0) {
+	ret = readl_poll_timeout(dsi->regs + DSI_INTSTA, val, !(val & DSI_BUSY),
+				 4, 2000000);
+	if (ret) {
 		DRM_WARN("polling dsi wait not busy timeout!\n");
 		DRM_WARN("polling dsi wait not busy timeout!\n");
 
 
 		mtk_dsi_enable(dsi);
 		mtk_dsi_enable(dsi);

+ 1 - 1
drivers/gpu/drm/mediatek/mtk_hdmi.c

@@ -1062,7 +1062,7 @@ static int mtk_hdmi_setup_vendor_specific_infoframe(struct mtk_hdmi *hdmi,
 	}
 	}
 
 
 	err = hdmi_vendor_infoframe_pack(&frame, buffer, sizeof(buffer));
 	err = hdmi_vendor_infoframe_pack(&frame, buffer, sizeof(buffer));
-	if (err) {
+	if (err < 0) {
 		dev_err(hdmi->dev, "Failed to pack vendor infoframe: %zd\n",
 		dev_err(hdmi->dev, "Failed to pack vendor infoframe: %zd\n",
 			err);
 			err);
 		return err;
 		return err;