summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-06-04 15:30:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-06-04 15:30:36 -0400
commit049ec1b5a76d34a6980cccdb7c0baeb4eed7a993 (patch)
tree4dc049d43b677e5a9b5c176760ce03e4799a3fc7
parentf2c6b9e4b2708ae50e3ab8c91dcad1564974f2a4 (diff)
parentab3ab68493aaac6fea4ad1bb597def9f48f41c71 (diff)
Merge tag 'drm-fixes-for-v4.7-rc2' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: "A bunch of ARM drivers got into the fixes vibe this time around, so this contains a bunch of fixes for imx, atmel hlcdc, arm hdlcd (only so many combos of hlcd), mediatek and omap drm. Other than that there is one mgag200 fix and a few core drm regression fixes" * tag 'drm-fixes-for-v4.7-rc2' of git://people.freedesktop.org/~airlied/linux: (34 commits) drm/omap: fix unused variable warning. drm: hdlcd: Add information about the underlying framebuffers in debugfs drm: hdlcd: Cleanup the atomic plane operations drm/hdlcd: Fix up crtc_state->event handling drm: hdlcd: Revamp runtime power management drm/mediatek: mtk_dsi: Remove spurious drm_connector_unregister drm/mediatek: mtk_dpi: remove invalid error message drm: atmel-hlcdc: fix a NULL check drm: atmel-hlcdc: fix atmel_hlcdc_crtc_reset() implementation drm/mgag200: Black screen fix for G200e rev 4 drm: Wrap direct calls to driver->gem_free_object from CMA drm: fix fb refcount issue with atomic modesetting drm: make drm_atomic_set_mode_prop_for_crtc() more reliable drm/sti: remove extra mode fixup drm: add missing drm_mode_set_crtcinfo call drm/omap: include gpio/consumer.h where needed drm/omap: include linux/seq_file.h where needed Revert "drm/omap: no need to select OMAP2_DSS" drm/omap: Remove regulator API abuse OMAPDSS: HDMI5: Change DDC timings ...
-rw-r--r--Documentation/devicetree/bindings/display/imx/ldb.txt1
-rw-r--r--drivers/gpu/drm/arm/hdlcd_crtc.c86
-rw-r--r--drivers/gpu/drm/arm/hdlcd_drv.c68
-rw-r--r--drivers/gpu/drm/arm/hdlcd_drv.h5
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c10
-rw-r--r--drivers/gpu/drm/drm_atomic.c3
-rw-r--r--drivers/gpu/drm/drm_crtc.c5
-rw-r--r--drivers/gpu/drm/drm_fb_cma_helper.c2
-rw-r--r--drivers/gpu/drm/drm_gem_cma_helper.c12
-rw-r--r--drivers/gpu/drm/drm_modes.c2
-rw-r--r--drivers/gpu/drm/imx/imx-drm-core.c13
-rw-r--r--drivers/gpu/drm/imx/imx-drm.h7
-rw-r--r--drivers/gpu/drm/imx/imx-ldb.c78
-rw-r--r--drivers/gpu/drm/imx/imx-tve.c6
-rw-r--r--drivers/gpu/drm/imx/ipuv3-crtc.c10
-rw-r--r--drivers/gpu/drm/imx/ipuv3-plane.c5
-rw-r--r--drivers/gpu/drm/imx/parallel-display.c40
-rw-r--r--drivers/gpu/drm/mediatek/mtk_dpi.c5
-rw-r--r--drivers/gpu/drm/mediatek/mtk_dsi.c4
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_mode.c10
-rw-r--r--drivers/gpu/drm/omapdrm/Kconfig1
-rw-r--r--drivers/gpu/drm/omapdrm/displays/connector-hdmi.c1
-rw-r--r--drivers/gpu/drm/omapdrm/displays/encoder-opa362.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-dpi.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c1
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c2
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dsi.c9
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dss.c1
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi4.c11
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi4_core.c2
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi5.c10
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi5_core.c6
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi_phy.c1
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi_pll.c1
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi_wp.c1
-rw-r--r--drivers/gpu/drm/omapdrm/omap_debugfs.c2
-rw-r--r--drivers/gpu/drm/omapdrm/omap_dmm_tiler.c1
-rw-r--r--drivers/gpu/drm/omapdrm/omap_fb.c2
-rw-r--r--drivers/gpu/drm/omapdrm/omap_gem.c1
-rw-r--r--drivers/gpu/drm/sti/sti_crtc.c10
-rw-r--r--drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c6
46 files changed, 227 insertions, 228 deletions
diff --git a/Documentation/devicetree/bindings/display/imx/ldb.txt b/Documentation/devicetree/bindings/display/imx/ldb.txt
index 0a175d991b52..a407462c885e 100644
--- a/Documentation/devicetree/bindings/display/imx/ldb.txt
+++ b/Documentation/devicetree/bindings/display/imx/ldb.txt
@@ -62,6 +62,7 @@ Required properties:
62 display-timings are used instead. 62 display-timings are used instead.
63 63
64Optional properties (required if display-timings are used): 64Optional properties (required if display-timings are used):
65 - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
65 - display-timings : A node that describes the display timings as defined in 66 - display-timings : A node that describes the display timings as defined in
66 Documentation/devicetree/bindings/display/display-timing.txt. 67 Documentation/devicetree/bindings/display/display-timing.txt.
67 - fsl,data-mapping : should be "spwg" or "jeida" 68 - fsl,data-mapping : should be "spwg" or "jeida"
diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index fef1b04c2aab..0813c2f06931 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -33,8 +33,17 @@
33 * 33 *
34 */ 34 */
35 35
36static void hdlcd_crtc_cleanup(struct drm_crtc *crtc)
37{
38 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
39
40 /* stop the controller on cleanup */
41 hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0);
42 drm_crtc_cleanup(crtc);
43}
44
36static const struct drm_crtc_funcs hdlcd_crtc_funcs = { 45static const struct drm_crtc_funcs hdlcd_crtc_funcs = {
37 .destroy = drm_crtc_cleanup, 46 .destroy = hdlcd_crtc_cleanup,
38 .set_config = drm_atomic_helper_set_config, 47 .set_config = drm_atomic_helper_set_config,
39 .page_flip = drm_atomic_helper_page_flip, 48 .page_flip = drm_atomic_helper_page_flip,
40 .reset = drm_atomic_helper_crtc_reset, 49 .reset = drm_atomic_helper_crtc_reset,
@@ -97,7 +106,7 @@ static void hdlcd_crtc_mode_set_nofb(struct drm_crtc *crtc)
97 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); 106 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
98 struct drm_display_mode *m = &crtc->state->adjusted_mode; 107 struct drm_display_mode *m = &crtc->state->adjusted_mode;
99 struct videomode vm; 108 struct videomode vm;
100 unsigned int polarities, line_length, err; 109 unsigned int polarities, err;
101 110
102 vm.vfront_porch = m->crtc_vsync_start - m->crtc_vdisplay; 111 vm.vfront_porch = m->crtc_vsync_start - m->crtc_vdisplay;
103 vm.vback_porch = m->crtc_vtotal - m->crtc_vsync_end; 112 vm.vback_porch = m->crtc_vtotal - m->crtc_vsync_end;
@@ -113,23 +122,18 @@ static void hdlcd_crtc_mode_set_nofb(struct drm_crtc *crtc)
113 if (m->flags & DRM_MODE_FLAG_PVSYNC) 122 if (m->flags & DRM_MODE_FLAG_PVSYNC)
114 polarities |= HDLCD_POLARITY_VSYNC; 123 polarities |= HDLCD_POLARITY_VSYNC;
115 124
116 line_length = crtc->primary->state->fb->pitches[0];
117
118 /* Allow max number of outstanding requests and largest burst size */ 125 /* Allow max number of outstanding requests and largest burst size */
119 hdlcd_write(hdlcd, HDLCD_REG_BUS_OPTIONS, 126 hdlcd_write(hdlcd, HDLCD_REG_BUS_OPTIONS,
120 HDLCD_BUS_MAX_OUTSTAND | HDLCD_BUS_BURST_16); 127 HDLCD_BUS_MAX_OUTSTAND | HDLCD_BUS_BURST_16);
121 128
122 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, line_length);
123 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, line_length);
124 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, m->crtc_vdisplay - 1);
125 hdlcd_write(hdlcd, HDLCD_REG_V_DATA, m->crtc_vdisplay - 1); 129 hdlcd_write(hdlcd, HDLCD_REG_V_DATA, m->crtc_vdisplay - 1);
126 hdlcd_write(hdlcd, HDLCD_REG_V_BACK_PORCH, vm.vback_porch - 1); 130 hdlcd_write(hdlcd, HDLCD_REG_V_BACK_PORCH, vm.vback_porch - 1);
127 hdlcd_write(hdlcd, HDLCD_REG_V_FRONT_PORCH, vm.vfront_porch - 1); 131 hdlcd_write(hdlcd, HDLCD_REG_V_FRONT_PORCH, vm.vfront_porch - 1);
128 hdlcd_write(hdlcd, HDLCD_REG_V_SYNC, vm.vsync_len - 1); 132 hdlcd_write(hdlcd, HDLCD_REG_V_SYNC, vm.vsync_len - 1);
133 hdlcd_write(hdlcd, HDLCD_REG_H_DATA, m->crtc_hdisplay - 1);
129 hdlcd_write(hdlcd, HDLCD_REG_H_BACK_PORCH, vm.hback_porch - 1); 134 hdlcd_write(hdlcd, HDLCD_REG_H_BACK_PORCH, vm.hback_porch - 1);
130 hdlcd_write(hdlcd, HDLCD_REG_H_FRONT_PORCH, vm.hfront_porch - 1); 135 hdlcd_write(hdlcd, HDLCD_REG_H_FRONT_PORCH, vm.hfront_porch - 1);
131 hdlcd_write(hdlcd, HDLCD_REG_H_SYNC, vm.hsync_len - 1); 136 hdlcd_write(hdlcd, HDLCD_REG_H_SYNC, vm.hsync_len - 1);
132 hdlcd_write(hdlcd, HDLCD_REG_H_DATA, m->crtc_hdisplay - 1);
133 hdlcd_write(hdlcd, HDLCD_REG_POLARITIES, polarities); 137 hdlcd_write(hdlcd, HDLCD_REG_POLARITIES, polarities);
134 138
135 err = hdlcd_set_pxl_fmt(crtc); 139 err = hdlcd_set_pxl_fmt(crtc);
@@ -144,20 +148,19 @@ static void hdlcd_crtc_enable(struct drm_crtc *crtc)
144 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); 148 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
145 149
146 clk_prepare_enable(hdlcd->clk); 150 clk_prepare_enable(hdlcd->clk);
151 hdlcd_crtc_mode_set_nofb(crtc);
147 hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 1); 152 hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 1);
148 drm_crtc_vblank_on(crtc);
149} 153}
150 154
151static void hdlcd_crtc_disable(struct drm_crtc *crtc) 155static void hdlcd_crtc_disable(struct drm_crtc *crtc)
152{ 156{
153 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); 157 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
154 158
155 if (!crtc->primary->fb) 159 if (!crtc->state->active)
156 return; 160 return;
157 161
158 clk_disable_unprepare(hdlcd->clk);
159 hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0); 162 hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0);
160 drm_crtc_vblank_off(crtc); 163 clk_disable_unprepare(hdlcd->clk);
161} 164}
162 165
163static int hdlcd_crtc_atomic_check(struct drm_crtc *crtc, 166static int hdlcd_crtc_atomic_check(struct drm_crtc *crtc,
@@ -179,20 +182,17 @@ static int hdlcd_crtc_atomic_check(struct drm_crtc *crtc,
179static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc, 182static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc,
180 struct drm_crtc_state *state) 183 struct drm_crtc_state *state)
181{ 184{
182 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); 185 struct drm_pending_vblank_event *event = crtc->state->event;
183 unsigned long flags;
184
185 if (crtc->state->event) {
186 struct drm_pending_vblank_event *event = crtc->state->event;
187 186
187 if (event) {
188 crtc->state->event = NULL; 188 crtc->state->event = NULL;
189 event->pipe = drm_crtc_index(crtc);
190
191 WARN_ON(drm_crtc_vblank_get(crtc) != 0);
192 189
193 spin_lock_irqsave(&crtc->dev->event_lock, flags); 190 spin_lock_irq(&crtc->dev->event_lock);
194 list_add_tail(&event->base.link, &hdlcd->event_list); 191 if (drm_crtc_vblank_get(crtc) == 0)
195 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 192 drm_crtc_arm_vblank_event(crtc, event);
193 else
194 drm_crtc_send_vblank_event(crtc, event);
195 spin_unlock_irq(&crtc->dev->event_lock);
196 } 196 }
197} 197}
198 198
@@ -225,6 +225,15 @@ static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = {
225static int hdlcd_plane_atomic_check(struct drm_plane *plane, 225static int hdlcd_plane_atomic_check(struct drm_plane *plane,
226 struct drm_plane_state *state) 226 struct drm_plane_state *state)
227{ 227{
228 u32 src_w, src_h;
229
230 src_w = state->src_w >> 16;
231 src_h = state->src_h >> 16;
232
233 /* we can't do any scaling of the plane source */
234 if ((src_w != state->crtc_w) || (src_h != state->crtc_h))
235 return -EINVAL;
236
228 return 0; 237 return 0;
229} 238}
230 239
@@ -233,20 +242,31 @@ static void hdlcd_plane_atomic_update(struct drm_plane *plane,
233{ 242{
234 struct hdlcd_drm_private *hdlcd; 243 struct hdlcd_drm_private *hdlcd;
235 struct drm_gem_cma_object *gem; 244 struct drm_gem_cma_object *gem;
245 unsigned int depth, bpp;
246 u32 src_w, src_h, dest_w, dest_h;
236 dma_addr_t scanout_start; 247 dma_addr_t scanout_start;
237 248
238 if (!plane->state->crtc || !plane->state->fb) 249 if (!plane->state->fb)
239 return; 250 return;
240 251
241 hdlcd = crtc_to_hdlcd_priv(plane->state->crtc); 252 drm_fb_get_bpp_depth(plane->state->fb->pixel_format, &depth, &bpp);
253 src_w = plane->state->src_w >> 16;
254 src_h = plane->state->src_h >> 16;
255 dest_w = plane->state->crtc_w;
256 dest_h = plane->state->crtc_h;
242 gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0); 257 gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0);
243 scanout_start = gem->paddr; 258 scanout_start = gem->paddr + plane->state->fb->offsets[0] +
259 plane->state->crtc_y * plane->state->fb->pitches[0] +
260 plane->state->crtc_x * bpp / 8;
261
262 hdlcd = plane->dev->dev_private;
263 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, plane->state->fb->pitches[0]);
264 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, plane->state->fb->pitches[0]);
265 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, dest_h - 1);
244 hdlcd_write(hdlcd, HDLCD_REG_FB_BASE, scanout_start); 266 hdlcd_write(hdlcd, HDLCD_REG_FB_BASE, scanout_start);
245} 267}
246 268
247static const struct drm_plane_helper_funcs hdlcd_plane_helper_funcs = { 269static const struct drm_plane_helper_funcs hdlcd_plane_helper_funcs = {
248 .prepare_fb = NULL,
249 .cleanup_fb = NULL,
250 .atomic_check = hdlcd_plane_atomic_check, 270 .atomic_check = hdlcd_plane_atomic_check,
251 .atomic_update = hdlcd_plane_atomic_update, 271 .atomic_update = hdlcd_plane_atomic_update,
252}; 272};
@@ -294,16 +314,6 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device *drm)
294 return plane; 314 return plane;
295} 315}
296 316
297void hdlcd_crtc_suspend(struct drm_crtc *crtc)
298{
299 hdlcd_crtc_disable(crtc);
300}
301
302void hdlcd_crtc_resume(struct drm_crtc *crtc)
303{
304 hdlcd_crtc_enable(crtc);
305}
306
307int hdlcd_setup_crtc(struct drm_device *drm) 317int hdlcd_setup_crtc(struct drm_device *drm)
308{ 318{
309 struct hdlcd_drm_private *hdlcd = drm->dev_private; 319 struct hdlcd_drm_private *hdlcd = drm->dev_private;
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index b987c63ba8d6..a6ca36f0096f 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -49,8 +49,6 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
49 atomic_set(&hdlcd->dma_end_count, 0); 49 atomic_set(&hdlcd->dma_end_count, 0);
50#endif 50#endif
51 51
52 INIT_LIST_HEAD(&hdlcd->event_list);
53
54 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 52 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
55 hdlcd->mmio = devm_ioremap_resource(drm->dev, res); 53 hdlcd->mmio = devm_ioremap_resource(drm->dev, res);
56 if (IS_ERR(hdlcd->mmio)) { 54 if (IS_ERR(hdlcd->mmio)) {
@@ -84,11 +82,7 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
84 goto setup_fail; 82 goto setup_fail;
85 } 83 }
86 84
87 pm_runtime_enable(drm->dev);
88
89 pm_runtime_get_sync(drm->dev);
90 ret = drm_irq_install(drm, platform_get_irq(pdev, 0)); 85 ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
91 pm_runtime_put_sync(drm->dev);
92 if (ret < 0) { 86 if (ret < 0) {
93 DRM_ERROR("failed to install IRQ handler\n"); 87 DRM_ERROR("failed to install IRQ handler\n");
94 goto irq_fail; 88 goto irq_fail;
@@ -164,24 +158,9 @@ static irqreturn_t hdlcd_irq(int irq, void *arg)
164 atomic_inc(&hdlcd->vsync_count); 158 atomic_inc(&hdlcd->vsync_count);
165 159
166#endif 160#endif
167 if (irq_status & HDLCD_INTERRUPT_VSYNC) { 161 if (irq_status & HDLCD_INTERRUPT_VSYNC)
168 bool events_sent = false;
169 unsigned long flags;
170 struct drm_pending_vblank_event *e, *t;
171
172 drm_crtc_handle_vblank(&hdlcd->crtc); 162 drm_crtc_handle_vblank(&hdlcd->crtc);
173 163
174 spin_lock_irqsave(&drm->event_lock, flags);
175 list_for_each_entry_safe(e, t, &hdlcd->event_list, base.link) {
176 list_del(&e->base.link);
177 drm_crtc_send_vblank_event(&hdlcd->crtc, e);
178 events_sent = true;
179 }
180 if (events_sent)
181 drm_crtc_vblank_put(&hdlcd->crtc);
182 spin_unlock_irqrestore(&drm->event_lock, flags);
183 }
184
185 /* acknowledge interrupt(s) */ 164 /* acknowledge interrupt(s) */
186 hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status); 165 hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
187 166
@@ -275,6 +254,7 @@ static int hdlcd_show_pxlclock(struct seq_file *m, void *arg)
275static struct drm_info_list hdlcd_debugfs_list[] = { 254static struct drm_info_list hdlcd_debugfs_list[] = {
276 { "interrupt_count", hdlcd_show_underrun_count, 0 }, 255 { "interrupt_count", hdlcd_show_underrun_count, 0 },
277 { "clocks", hdlcd_show_pxlclock, 0 }, 256 { "clocks", hdlcd_show_pxlclock, 0 },
257 { "fb", drm_fb_cma_debugfs_show, 0 },
278}; 258};
279 259
280static int hdlcd_debugfs_init(struct drm_minor *minor) 260static int hdlcd_debugfs_init(struct drm_minor *minor)
@@ -357,6 +337,8 @@ static int hdlcd_drm_bind(struct device *dev)
357 return -ENOMEM; 337 return -ENOMEM;
358 338
359 drm->dev_private = hdlcd; 339 drm->dev_private = hdlcd;
340 dev_set_drvdata(dev, drm);
341
360 hdlcd_setup_mode_config(drm); 342 hdlcd_setup_mode_config(drm);
361 ret = hdlcd_load(drm, 0); 343 ret = hdlcd_load(drm, 0);
362 if (ret) 344 if (ret)
@@ -366,14 +348,18 @@ static int hdlcd_drm_bind(struct device *dev)
366 if (ret) 348 if (ret)
367 goto err_unload; 349 goto err_unload;
368 350
369 dev_set_drvdata(dev, drm);
370
371 ret = component_bind_all(dev, drm); 351 ret = component_bind_all(dev, drm);
372 if (ret) { 352 if (ret) {
373 DRM_ERROR("Failed to bind all components\n"); 353 DRM_ERROR("Failed to bind all components\n");
374 goto err_unregister; 354 goto err_unregister;
375 } 355 }
376 356
357 ret = pm_runtime_set_active(dev);
358 if (ret)
359 goto err_pm_active;
360
361 pm_runtime_enable(dev);
362
377 ret = drm_vblank_init(drm, drm->mode_config.num_crtc); 363 ret = drm_vblank_init(drm, drm->mode_config.num_crtc);
378 if (ret < 0) { 364 if (ret < 0) {
379 DRM_ERROR("failed to initialise vblank\n"); 365 DRM_ERROR("failed to initialise vblank\n");
@@ -399,16 +385,16 @@ err_fbdev:
399 drm_mode_config_cleanup(drm); 385 drm_mode_config_cleanup(drm);
400 drm_vblank_cleanup(drm); 386 drm_vblank_cleanup(drm);
401err_vblank: 387err_vblank:
388 pm_runtime_disable(drm->dev);
389err_pm_active:
402 component_unbind_all(dev, drm); 390 component_unbind_all(dev, drm);
403err_unregister: 391err_unregister:
404 drm_dev_unregister(drm); 392 drm_dev_unregister(drm);
405err_unload: 393err_unload:
406 pm_runtime_get_sync(drm->dev);
407 drm_irq_uninstall(drm); 394 drm_irq_uninstall(drm);
408 pm_runtime_put_sync(drm->dev);
409 pm_runtime_disable(drm->dev);
410 of_reserved_mem_device_release(drm->dev); 395 of_reserved_mem_device_release(drm->dev);
411err_free: 396err_free:
397 dev_set_drvdata(dev, NULL);
412 drm_dev_unref(drm); 398 drm_dev_unref(drm);
413 399
414 return ret; 400 return ret;
@@ -495,30 +481,34 @@ MODULE_DEVICE_TABLE(of, hdlcd_of_match);
495static int __maybe_unused hdlcd_pm_suspend(struct device *dev) 481static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
496{ 482{
497 struct drm_device *drm = dev_get_drvdata(dev); 483 struct drm_device *drm = dev_get_drvdata(dev);
498 struct drm_crtc *crtc; 484 struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private : NULL;
499 485
500 if (pm_runtime_suspended(dev)) 486 if (!hdlcd)
501 return 0; 487 return 0;
502 488
503 drm_modeset_lock_all(drm); 489 drm_kms_helper_poll_disable(drm);
504 list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) 490
505 hdlcd_crtc_suspend(crtc); 491 hdlcd->state = drm_atomic_helper_suspend(drm);
506 drm_modeset_unlock_all(drm); 492 if (IS_ERR(hdlcd->state)) {
493 drm_kms_helper_poll_enable(drm);
494 return PTR_ERR(hdlcd->state);
495 }
496
507 return 0; 497 return 0;
508} 498}
509 499
510static int __maybe_unused hdlcd_pm_resume(struct device *dev) 500static int __maybe_unused hdlcd_pm_resume(struct device *dev)
511{ 501{
512 struct drm_device *drm = dev_get_drvdata(dev); 502 struct drm_device *drm = dev_get_drvdata(dev);
513 struct drm_crtc *crtc; 503 struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private : NULL;
514 504
515 if (!pm_runtime_suspended(dev)) 505 if (!hdlcd)
516 return 0; 506 return 0;
517 507
518 drm_modeset_lock_all(drm); 508 drm_atomic_helper_resume(drm, hdlcd->state);
519 list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) 509 drm_kms_helper_poll_enable(drm);
520 hdlcd_crtc_resume(crtc); 510 pm_runtime_set_active(dev);
521 drm_modeset_unlock_all(drm); 511
522 return 0; 512 return 0;
523} 513}
524 514
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
index aa234784f053..e3950a071152 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.h
+++ b/drivers/gpu/drm/arm/hdlcd_drv.h
@@ -9,10 +9,9 @@ struct hdlcd_drm_private {
9 void __iomem *mmio; 9 void __iomem *mmio;
10 struct clk *clk; 10 struct clk *clk;
11 struct drm_fbdev_cma *fbdev; 11 struct drm_fbdev_cma *fbdev;
12 struct drm_framebuffer *fb;
13 struct list_head event_list;
14 struct drm_crtc crtc; 12 struct drm_crtc crtc;
15 struct drm_plane *plane; 13 struct drm_plane *plane;
14 struct drm_atomic_state *state;
16#ifdef CONFIG_DEBUG_FS 15#ifdef CONFIG_DEBUG_FS
17 atomic_t buffer_underrun_count; 16 atomic_t buffer_underrun_count;
18 atomic_t bus_error_count; 17 atomic_t bus_error_count;
@@ -36,7 +35,5 @@ static inline u32 hdlcd_read(struct hdlcd_drm_private *hdlcd, unsigned int reg)
36 35
37int hdlcd_setup_crtc(struct drm_device *dev); 36int hdlcd_setup_crtc(struct drm_device *dev);
38void hdlcd_set_scanout(struct hdlcd_drm_private *hdlcd); 37void hdlcd_set_scanout(struct hdlcd_drm_private *hdlcd);
39void hdlcd_crtc_suspend(struct drm_crtc *crtc);
40void hdlcd_crtc_resume(struct drm_crtc *crtc);
41 38
42#endif /* __HDLCD_DRV_H__ */ 39#endif /* __HDLCD_DRV_H__ */
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
index cf23a755f777..bd12231ab0cd 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
@@ -391,12 +391,11 @@ void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc)
391{ 391{
392 struct atmel_hlcdc_crtc_state *state; 392 struct atmel_hlcdc_crtc_state *state;
393 393
394 if (crtc->state && crtc->state->mode_blob)
395 drm_property_unreference_blob(crtc->state->mode_blob);
396
397 if (crtc->state) { 394 if (crtc->state) {
395 __drm_atomic_helper_crtc_destroy_state(crtc->state);
398 state = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); 396 state = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state);
399 kfree(state); 397 kfree(state);
398 crtc->state = NULL;
400 } 399 }
401 400
402 state = kzalloc(sizeof(*state), GFP_KERNEL); 401 state = kzalloc(sizeof(*state), GFP_KERNEL);
@@ -415,8 +414,9 @@ atmel_hlcdc_crtc_duplicate_state(struct drm_crtc *crtc)
415 return NULL; 414 return NULL;
416 415
417 state = kmalloc(sizeof(*state), GFP_KERNEL); 416 state = kmalloc(sizeof(*state), GFP_KERNEL);
418 if (state) 417 if (!state)
419 __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); 418 return NULL;
419 __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
420 420
421 cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); 421 cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state);
422 state->output_mode = cur->output_mode; 422 state->output_mode = cur->output_mode;
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 3ff1ed7b33db..c204ef32df16 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -351,6 +351,8 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
351 drm_property_unreference_blob(state->mode_blob); 351 drm_property_unreference_blob(state->mode_blob);
352 state->mode_blob = NULL; 352 state->mode_blob = NULL;
353 353
354 memset(&state->mode, 0, sizeof(state->mode));
355
354 if (blob) { 356 if (blob) {
355 if (blob->length != sizeof(struct drm_mode_modeinfo) || 357 if (blob->length != sizeof(struct drm_mode_modeinfo) ||
356 drm_mode_convert_umode(&state->mode, 358 drm_mode_convert_umode(&state->mode,
@@ -363,7 +365,6 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
363 DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n", 365 DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n",
364 state->mode.name, state); 366 state->mode.name, state);
365 } else { 367 } else {
366 memset(&state->mode, 0, sizeof(state->mode));
367 state->enable = false; 368 state->enable = false;
368 DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n", 369 DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n",
369 state); 370 state);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d2a6d958ca76..0e3cc66aa8b7 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2821,8 +2821,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
2821 goto out; 2821 goto out;
2822 } 2822 }
2823 2823
2824 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
2825
2826 /* 2824 /*
2827 * Check whether the primary plane supports the fb pixel format. 2825 * Check whether the primary plane supports the fb pixel format.
2828 * Drivers not implementing the universal planes API use a 2826 * Drivers not implementing the universal planes API use a
@@ -4841,7 +4839,8 @@ bool drm_property_change_valid_get(struct drm_property *property,
4841 if (value == 0) 4839 if (value == 0)
4842 return true; 4840 return true;
4843 4841
4844 return _object_find(property->dev, value, property->values[0]) != NULL; 4842 *ref = _object_find(property->dev, value, property->values[0]);
4843 return *ref != NULL;
4845 } 4844 }
4846 4845
4847 for (i = 0; i < property->num_values; i++) 4846 for (i = 0; i < property->num_values; i++)
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 172cafe11c71..5075fae3c4e2 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -445,7 +445,7 @@ err_cma_destroy:
445err_fb_info_destroy: 445err_fb_info_destroy:
446 drm_fb_helper_release_fbi(helper); 446 drm_fb_helper_release_fbi(helper);
447err_gem_free_object: 447err_gem_free_object:
448 dev->driver->gem_free_object(&obj->base); 448 drm_gem_object_unreference_unlocked(&obj->base);
449 return ret; 449 return ret;
450} 450}
451EXPORT_SYMBOL(drm_fbdev_cma_create_with_funcs); 451EXPORT_SYMBOL(drm_fbdev_cma_create_with_funcs);
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
index e1ab008b3f08..1d6c335584ec 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -121,7 +121,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
121 return cma_obj; 121 return cma_obj;
122 122
123error: 123error:
124 drm->driver->gem_free_object(&cma_obj->base); 124 drm_gem_object_unreference_unlocked(&cma_obj->base);
125 return ERR_PTR(ret); 125 return ERR_PTR(ret);
126} 126}
127EXPORT_SYMBOL_GPL(drm_gem_cma_create); 127EXPORT_SYMBOL_GPL(drm_gem_cma_create);
@@ -162,18 +162,12 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,
162 * and handle has the id what user can see. 162 * and handle has the id what user can see.
163 */ 163 */
164 ret = drm_gem_handle_create(file_priv, gem_obj, handle); 164 ret = drm_gem_handle_create(file_priv, gem_obj, handle);
165 if (ret)
166 goto err_handle_create;
167
168 /* drop reference from allocate - handle holds it now. */ 165 /* drop reference from allocate - handle holds it now. */
169 drm_gem_object_unreference_unlocked(gem_obj); 166 drm_gem_object_unreference_unlocked(gem_obj);
167 if (ret)
168 return ERR_PTR(ret);
170 169
171 return cma_obj; 170 return cma_obj;
172
173err_handle_create:
174 drm->driver->gem_free_object(gem_obj);
175
176 return ERR_PTR(ret);
177} 171}
178 172
179/** 173/**
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 7def3d58da18..e5e6f504d8cc 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1518,6 +1518,8 @@ int drm_mode_convert_umode(struct drm_display_mode *out,
1518 if (out->status != MODE_OK) 1518 if (out->status != MODE_OK)
1519 goto out; 1519 goto out;
1520 1520
1521 drm_mode_set_crtcinfo(out, CRTC_INTERLACE_HALVE_V);
1522
1521 ret = 0; 1523 ret = 0;
1522 1524
1523out: 1525out:
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 1f14b602882b..82656654fb21 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -97,8 +97,8 @@ static struct imx_drm_crtc *imx_drm_find_crtc(struct drm_crtc *crtc)
97 return NULL; 97 return NULL;
98} 98}
99 99
100int imx_drm_set_bus_format_pins(struct drm_encoder *encoder, u32 bus_format, 100int imx_drm_set_bus_config(struct drm_encoder *encoder, u32 bus_format,
101 int hsync_pin, int vsync_pin) 101 int hsync_pin, int vsync_pin, u32 bus_flags)
102{ 102{
103 struct imx_drm_crtc_helper_funcs *helper; 103 struct imx_drm_crtc_helper_funcs *helper;
104 struct imx_drm_crtc *imx_crtc; 104 struct imx_drm_crtc *imx_crtc;
@@ -110,14 +110,17 @@ int imx_drm_set_bus_format_pins(struct drm_encoder *encoder, u32 bus_format,
110 helper = &imx_crtc->imx_drm_helper_funcs; 110 helper = &imx_crtc->imx_drm_helper_funcs;
111 if (helper->set_interface_pix_fmt) 111 if (helper->set_interface_pix_fmt)
112 return helper->set_interface_pix_fmt(encoder->crtc, 112 return helper->set_interface_pix_fmt(encoder->crtc,
113 bus_format, hsync_pin, vsync_pin); 113 bus_format, hsync_pin, vsync_pin,
114 bus_flags);
114 return 0; 115 return 0;
115} 116}
116EXPORT_SYMBOL_GPL(imx_drm_set_bus_format_pins); 117EXPORT_SYMBOL_GPL(imx_drm_set_bus_config);
117 118
118int imx_drm_set_bus_format(struct drm_encoder *encoder, u32 bus_format) 119int imx_drm_set_bus_format(struct drm_encoder *encoder, u32 bus_format)
119{ 120{
120 return imx_drm_set_bus_format_pins(encoder, bus_format, 2, 3); 121 return imx_drm_set_bus_config(encoder, bus_format, 2, 3,
122 DRM_BUS_FLAG_DE_HIGH |
123 DRM_BUS_FLAG_PIXDATA_NEGEDGE);
121} 124}
122EXPORT_SYMBOL_GPL(imx_drm_set_bus_format); 125EXPORT_SYMBOL_GPL(imx_drm_set_bus_format);
123 126
diff --git a/drivers/gpu/drm/imx/imx-drm.h b/drivers/gpu/drm/imx/imx-drm.h
index b0241b9d1334..74320a1723b7 100644
--- a/drivers/gpu/drm/imx/imx-drm.h
+++ b/drivers/gpu/drm/imx/imx-drm.h
@@ -19,7 +19,8 @@ struct imx_drm_crtc_helper_funcs {
19 int (*enable_vblank)(struct drm_crtc *crtc); 19 int (*enable_vblank)(struct drm_crtc *crtc);
20 void (*disable_vblank)(struct drm_crtc *crtc); 20 void (*disable_vblank)(struct drm_crtc *crtc);
21 int (*set_interface_pix_fmt)(struct drm_crtc *crtc, 21 int (*set_interface_pix_fmt)(struct drm_crtc *crtc,
22 u32 bus_format, int hsync_pin, int vsync_pin); 22 u32 bus_format, int hsync_pin, int vsync_pin,
23 u32 bus_flags);
23 const struct drm_crtc_helper_funcs *crtc_helper_funcs; 24 const struct drm_crtc_helper_funcs *crtc_helper_funcs;
24 const struct drm_crtc_funcs *crtc_funcs; 25 const struct drm_crtc_funcs *crtc_funcs;
25}; 26};
@@ -41,8 +42,8 @@ void imx_drm_mode_config_init(struct drm_device *drm);
41 42
42struct drm_gem_cma_object *imx_drm_fb_get_obj(struct drm_framebuffer *fb); 43struct drm_gem_cma_object *imx_drm_fb_get_obj(struct drm_framebuffer *fb);
43 44
44int imx_drm_set_bus_format_pins(struct drm_encoder *encoder, 45int imx_drm_set_bus_config(struct drm_encoder *encoder, u32 bus_format,
45 u32 bus_format, int hsync_pin, int vsync_pin); 46 int hsync_pin, int vsync_pin, u32 bus_flags);
46int imx_drm_set_bus_format(struct drm_encoder *encoder, 47int imx_drm_set_bus_format(struct drm_encoder *encoder,
47 u32 bus_format); 48 u32 bus_format);
48 49
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index a58eee59550a..beff793bb717 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -25,6 +25,7 @@
25#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> 25#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
26#include <linux/of_device.h> 26#include <linux/of_device.h>
27#include <linux/of_graph.h> 27#include <linux/of_graph.h>
28#include <video/of_display_timing.h>
28#include <video/of_videomode.h> 29#include <video/of_videomode.h>
29#include <linux/regmap.h> 30#include <linux/regmap.h>
30#include <linux/videodev2.h> 31#include <linux/videodev2.h>
@@ -59,6 +60,7 @@ struct imx_ldb_channel {
59 struct drm_encoder encoder; 60 struct drm_encoder encoder;
60 struct drm_panel *panel; 61 struct drm_panel *panel;
61 struct device_node *child; 62 struct device_node *child;
63 struct i2c_adapter *ddc;
62 int chno; 64 int chno;
63 void *edid; 65 void *edid;
64 int edid_len; 66 int edid_len;
@@ -107,6 +109,9 @@ static int imx_ldb_connector_get_modes(struct drm_connector *connector)
107 return num_modes; 109 return num_modes;
108 } 110 }
109 111
112 if (!imx_ldb_ch->edid && imx_ldb_ch->ddc)
113 imx_ldb_ch->edid = drm_get_edid(connector, imx_ldb_ch->ddc);
114
110 if (imx_ldb_ch->edid) { 115 if (imx_ldb_ch->edid) {
111 drm_mode_connector_update_edid_property(connector, 116 drm_mode_connector_update_edid_property(connector,
112 imx_ldb_ch->edid); 117 imx_ldb_ch->edid);
@@ -553,7 +558,8 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
553 558
554 for_each_child_of_node(np, child) { 559 for_each_child_of_node(np, child) {
555 struct imx_ldb_channel *channel; 560 struct imx_ldb_channel *channel;
556 struct device_node *port; 561 struct device_node *ddc_node;
562 struct device_node *ep;
557 563
558 ret = of_property_read_u32(child, "reg", &i); 564 ret = of_property_read_u32(child, "reg", &i);
559 if (ret || i < 0 || i > 1) 565 if (ret || i < 0 || i > 1)
@@ -576,33 +582,54 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
576 * The output port is port@4 with an external 4-port mux or 582 * The output port is port@4 with an external 4-port mux or
577 * port@2 with the internal 2-port mux. 583 * port@2 with the internal 2-port mux.
578 */ 584 */
579 port = of_graph_get_port_by_id(child, imx_ldb->lvds_mux ? 4 : 2); 585 ep = of_graph_get_endpoint_by_regs(child,
580 if (port) { 586 imx_ldb->lvds_mux ? 4 : 2,
581 struct device_node *endpoint, *remote; 587 -1);
582 588 if (ep) {
583 endpoint = of_get_child_by_name(port, "endpoint"); 589 struct device_node *remote;
584 if (endpoint) { 590
585 remote = of_graph_get_remote_port_parent(endpoint); 591 remote = of_graph_get_remote_port_parent(ep);
586 if (remote) 592 of_node_put(ep);
587 channel->panel = of_drm_find_panel(remote); 593 if (remote)
588 else 594 channel->panel = of_drm_find_panel(remote);
589 return -EPROBE_DEFER; 595 else
590 if (!channel->panel) { 596 return -EPROBE_DEFER;
591 dev_err(dev, "panel not found: %s\n", 597 of_node_put(remote);
592 remote->full_name); 598 if (!channel->panel) {
593 return -EPROBE_DEFER; 599 dev_err(dev, "panel not found: %s\n",
594 } 600 remote->full_name);
601 return -EPROBE_DEFER;
595 } 602 }
596 } 603 }
597 604
598 edidp = of_get_property(child, "edid", &channel->edid_len); 605 ddc_node = of_parse_phandle(child, "ddc-i2c-bus", 0);
599 if (edidp) { 606 if (ddc_node) {
600 channel->edid = kmemdup(edidp, channel->edid_len, 607 channel->ddc = of_find_i2c_adapter_by_node(ddc_node);
601 GFP_KERNEL); 608 of_node_put(ddc_node);
602 } else if (!channel->panel) { 609 if (!channel->ddc) {
603 ret = of_get_drm_display_mode(child, &channel->mode, 0); 610 dev_warn(dev, "failed to get ddc i2c adapter\n");
604 if (!ret) 611 return -EPROBE_DEFER;
605 channel->mode_valid = 1; 612 }
613 }
614
615 if (!channel->ddc) {
616 /* if no DDC available, fallback to hardcoded EDID */
617 dev_dbg(dev, "no ddc available\n");
618
619 edidp = of_get_property(child, "edid",
620 &channel->edid_len);
621 if (edidp) {
622 channel->edid = kmemdup(edidp,
623 channel->edid_len,
624 GFP_KERNEL);
625 } else if (!channel->panel) {
626 /* fallback to display-timings node */
627 ret = of_get_drm_display_mode(child,
628 &channel->mode,
629 OF_USE_NATIVE_MODE);
630 if (!ret)
631 channel->mode_valid = 1;
632 }
606 } 633 }
607 634
608 channel->bus_format = of_get_bus_format(dev, child); 635 channel->bus_format = of_get_bus_format(dev, child);
@@ -647,6 +674,7 @@ static void imx_ldb_unbind(struct device *dev, struct device *master,
647 channel->encoder.funcs->destroy(&channel->encoder); 674 channel->encoder.funcs->destroy(&channel->encoder);
648 675
649 kfree(channel->edid); 676 kfree(channel->edid);
677 i2c_put_adapter(channel->ddc);
650 } 678 }
651} 679}
652 680
diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index ae7a9fb3b8a2..baf788121287 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -294,8 +294,10 @@ static void imx_tve_encoder_prepare(struct drm_encoder *encoder)
294 294
295 switch (tve->mode) { 295 switch (tve->mode) {
296 case TVE_MODE_VGA: 296 case TVE_MODE_VGA:
297 imx_drm_set_bus_format_pins(encoder, MEDIA_BUS_FMT_GBR888_1X24, 297 imx_drm_set_bus_config(encoder, MEDIA_BUS_FMT_GBR888_1X24,
298 tve->hsync_pin, tve->vsync_pin); 298 tve->hsync_pin, tve->vsync_pin,
299 DRM_BUS_FLAG_DE_HIGH |
300 DRM_BUS_FLAG_PIXDATA_NEGEDGE);
299 break; 301 break;
300 case TVE_MODE_TVOUT: 302 case TVE_MODE_TVOUT:
301 imx_drm_set_bus_format(encoder, MEDIA_BUS_FMT_YUV8_1X24); 303 imx_drm_set_bus_format(encoder, MEDIA_BUS_FMT_YUV8_1X24);
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index b2c30b8d9816..fc040417e1e8 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -66,6 +66,7 @@ struct ipu_crtc {
66 struct ipu_flip_work *flip_work; 66 struct ipu_flip_work *flip_work;
67 int irq; 67 int irq;
68 u32 bus_format; 68 u32 bus_format;
69 u32 bus_flags;
69 int di_hsync_pin; 70 int di_hsync_pin;
70 int di_vsync_pin; 71 int di_vsync_pin;
71}; 72};
@@ -271,8 +272,10 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc,
271 else 272 else
272 sig_cfg.clkflags = 0; 273 sig_cfg.clkflags = 0;
273 274
274 sig_cfg.enable_pol = 1; 275 sig_cfg.enable_pol = !(ipu_crtc->bus_flags & DRM_BUS_FLAG_DE_LOW);
275 sig_cfg.clk_pol = 0; 276 /* Default to driving pixel data on negative clock edges */
277 sig_cfg.clk_pol = !!(ipu_crtc->bus_flags &
278 DRM_BUS_FLAG_PIXDATA_POSEDGE);
276 sig_cfg.bus_format = ipu_crtc->bus_format; 279 sig_cfg.bus_format = ipu_crtc->bus_format;
277 sig_cfg.v_to_h_sync = 0; 280 sig_cfg.v_to_h_sync = 0;
278 sig_cfg.hsync_pin = ipu_crtc->di_hsync_pin; 281 sig_cfg.hsync_pin = ipu_crtc->di_hsync_pin;
@@ -396,11 +399,12 @@ static void ipu_disable_vblank(struct drm_crtc *crtc)
396} 399}
397 400
398static int ipu_set_interface_pix_fmt(struct drm_crtc *crtc, 401static int ipu_set_interface_pix_fmt(struct drm_crtc *crtc,
399 u32 bus_format, int hsync_pin, int vsync_pin) 402 u32 bus_format, int hsync_pin, int vsync_pin, u32 bus_flags)
400{ 403{
401 struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc); 404 struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
402 405
403 ipu_crtc->bus_format = bus_format; 406 ipu_crtc->bus_format = bus_format;
407 ipu_crtc->bus_flags = bus_flags;
404 ipu_crtc->di_hsync_pin = hsync_pin; 408 ipu_crtc->di_hsync_pin = hsync_pin;
405 ipu_crtc->di_vsync_pin = vsync_pin; 409 ipu_crtc->di_vsync_pin = vsync_pin;
406 410
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index 681ec6eb77d9..a4bb44118d33 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -38,6 +38,8 @@ static const uint32_t ipu_plane_formats[] = {
38 DRM_FORMAT_RGBX8888, 38 DRM_FORMAT_RGBX8888,
39 DRM_FORMAT_BGRA8888, 39 DRM_FORMAT_BGRA8888,
40 DRM_FORMAT_BGRA8888, 40 DRM_FORMAT_BGRA8888,
41 DRM_FORMAT_UYVY,
42 DRM_FORMAT_VYUY,
41 DRM_FORMAT_YUYV, 43 DRM_FORMAT_YUYV,
42 DRM_FORMAT_YVYU, 44 DRM_FORMAT_YVYU,
43 DRM_FORMAT_YUV420, 45 DRM_FORMAT_YUV420,
@@ -428,7 +430,6 @@ static int ipu_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
428 if (crtc != plane->crtc) 430 if (crtc != plane->crtc)
429 dev_dbg(plane->dev->dev, "crtc change: %p -> %p\n", 431 dev_dbg(plane->dev->dev, "crtc change: %p -> %p\n",
430 plane->crtc, crtc); 432 plane->crtc, crtc);
431 plane->crtc = crtc;
432 433
433 if (!ipu_plane->enabled) 434 if (!ipu_plane->enabled)
434 ipu_plane_enable(ipu_plane); 435 ipu_plane_enable(ipu_plane);
@@ -461,7 +462,7 @@ static void ipu_plane_destroy(struct drm_plane *plane)
461 kfree(ipu_plane); 462 kfree(ipu_plane);
462} 463}
463 464
464static struct drm_plane_funcs ipu_plane_funcs = { 465static const struct drm_plane_funcs ipu_plane_funcs = {
465 .update_plane = ipu_update_plane, 466 .update_plane = ipu_update_plane,
466 .disable_plane = ipu_disable_plane, 467 .disable_plane = ipu_disable_plane,
467 .destroy = ipu_plane_destroy, 468 .destroy = ipu_plane_destroy,
diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
index 363e2c7741e2..2d1fd02cd3d6 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -35,7 +35,6 @@ struct imx_parallel_display {
35 void *edid; 35 void *edid;
36 int edid_len; 36 int edid_len;
37 u32 bus_format; 37 u32 bus_format;
38 int mode_valid;
39 struct drm_display_mode mode; 38 struct drm_display_mode mode;
40 struct drm_panel *panel; 39 struct drm_panel *panel;
41}; 40};
@@ -68,17 +67,6 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
68 num_modes = drm_add_edid_modes(connector, imxpd->edid); 67 num_modes = drm_add_edid_modes(connector, imxpd->edid);
69 } 68 }
70 69
71 if (imxpd->mode_valid) {
72 struct drm_display_mode *mode = drm_mode_create(connector->dev);
73
74 if (!mode)
75 return -EINVAL;
76 drm_mode_copy(mode, &imxpd->mode);
77 mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
78 drm_mode_probed_add(connector, mode);
79 num_modes++;
80 }
81
82 if (np) { 70 if (np) {
83 struct drm_display_mode *mode = drm_mode_create(connector->dev); 71 struct drm_display_mode *mode = drm_mode_create(connector->dev);
84 72
@@ -115,8 +103,8 @@ static void imx_pd_encoder_dpms(struct drm_encoder *encoder, int mode)
115static void imx_pd_encoder_prepare(struct drm_encoder *encoder) 103static void imx_pd_encoder_prepare(struct drm_encoder *encoder)
116{ 104{
117 struct imx_parallel_display *imxpd = enc_to_imxpd(encoder); 105 struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
118 106 imx_drm_set_bus_config(encoder, imxpd->bus_format, 2, 3,
119 imx_drm_set_bus_format(encoder, imxpd->bus_format); 107 imxpd->connector.display_info.bus_flags);
120} 108}
121 109
122static void imx_pd_encoder_commit(struct drm_encoder *encoder) 110static void imx_pd_encoder_commit(struct drm_encoder *encoder)
@@ -203,7 +191,7 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
203{ 191{
204 struct drm_device *drm = data; 192 struct drm_device *drm = data;
205 struct device_node *np = dev->of_node; 193 struct device_node *np = dev->of_node;
206 struct device_node *port; 194 struct device_node *ep;
207 const u8 *edidp; 195 const u8 *edidp;
208 struct imx_parallel_display *imxpd; 196 struct imx_parallel_display *imxpd;
209 int ret; 197 int ret;
@@ -230,18 +218,18 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
230 } 218 }
231 219
232 /* port@1 is the output port */ 220 /* port@1 is the output port */
233 port = of_graph_get_port_by_id(np, 1); 221 ep = of_graph_get_endpoint_by_regs(np, 1, -1);
234 if (port) { 222 if (ep) {
235 struct device_node *endpoint, *remote; 223 struct device_node *remote;
236 224
237 endpoint = of_get_child_by_name(port, "endpoint"); 225 remote = of_graph_get_remote_port_parent(ep);
238 if (endpoint) { 226 of_node_put(ep);
239 remote = of_graph_get_remote_port_parent(endpoint); 227 if (remote) {
240 if (remote) 228 imxpd->panel = of_drm_find_panel(remote);
241 imxpd->panel = of_drm_find_panel(remote); 229 of_node_put(remote);
242 if (!imxpd->panel)
243 return -EPROBE_DEFER;
244 } 230 }
231 if (!imxpd->panel)
232 return -EPROBE_DEFER;
245 } 233 }
246 234
247 imxpd->dev = dev; 235 imxpd->dev = dev;
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index d05ca7901315..0186e500d2a5 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -432,11 +432,6 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
432 unsigned long pll_rate; 432 unsigned long pll_rate;
433 unsigned int factor; 433 unsigned int factor;
434 434
435 if (!dpi) {
436 dev_err(dpi->dev, "invalid argument\n");
437 return -EINVAL;
438 }
439
440 pix_rate = 1000UL * mode->clock; 435 pix_rate = 1000UL * mode->clock;
441 if (mode->clock <= 74000) 436 if (mode->clock <= 74000)
442 factor = 8 * 3; 437 factor = 8 * 3;
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 2d808e59fefd..769559124562 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -695,10 +695,8 @@ static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi)
695{ 695{
696 drm_encoder_cleanup(&dsi->encoder); 696 drm_encoder_cleanup(&dsi->encoder);
697 /* Skip connector cleanup if creation was delegated to the bridge */ 697 /* Skip connector cleanup if creation was delegated to the bridge */
698 if (dsi->conn.dev) { 698 if (dsi->conn.dev)
699 drm_connector_unregister(&dsi->conn);
700 drm_connector_cleanup(&dsi->conn); 699 drm_connector_cleanup(&dsi->conn);
701 }
702} 700}
703 701
704static void mtk_dsi_ddp_start(struct mtk_ddp_comp *comp) 702static void mtk_dsi_ddp_start(struct mtk_ddp_comp *comp)
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 14e64e08909e..d347dca17267 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -182,7 +182,7 @@ static int mga_g200se_set_plls(struct mga_device *mdev, long clock)
182 } 182 }
183 } 183 }
184 184
185 fvv = pllreffreq * testn / testm; 185 fvv = pllreffreq * (n + 1) / (m + 1);
186 fvv = (fvv - 800000) / 50000; 186 fvv = (fvv - 800000) / 50000;
187 187
188 if (fvv > 15) 188 if (fvv > 15)
@@ -202,6 +202,14 @@ static int mga_g200se_set_plls(struct mga_device *mdev, long clock)
202 WREG_DAC(MGA1064_PIX_PLLC_M, m); 202 WREG_DAC(MGA1064_PIX_PLLC_M, m);
203 WREG_DAC(MGA1064_PIX_PLLC_N, n); 203 WREG_DAC(MGA1064_PIX_PLLC_N, n);
204 WREG_DAC(MGA1064_PIX_PLLC_P, p); 204 WREG_DAC(MGA1064_PIX_PLLC_P, p);
205
206 if (mdev->unique_rev_id >= 0x04) {
207 WREG_DAC(0x1a, 0x09);
208 msleep(20);
209 WREG_DAC(0x1a, 0x01);
210
211 }
212
205 return 0; 213 return 0;
206} 214}
207 215
diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
index 73241c4eb7aa..336ad4de9981 100644
--- a/drivers/gpu/drm/omapdrm/Kconfig
+++ b/drivers/gpu/drm/omapdrm/Kconfig
@@ -2,6 +2,7 @@ config DRM_OMAP
2 tristate "OMAP DRM" 2 tristate "OMAP DRM"
3 depends on DRM 3 depends on DRM
4 depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM 4 depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM
5 select OMAP2_DSS
5 select DRM_KMS_HELPER 6 select DRM_KMS_HELPER
6 select DRM_KMS_FB_HELPER 7 select DRM_KMS_FB_HELPER
7 select FB_SYS_FILLRECT 8 select FB_SYS_FILLRECT
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
index 225fd8d6ab31..667ca4a24ece 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
@@ -9,6 +9,7 @@
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/gpio/consumer.h>
12#include <linux/slab.h> 13#include <linux/slab.h>
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
index 8c246c213e06..9594ff7a2b0c 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
@@ -14,7 +14,7 @@
14 * the Free Software Foundation. 14 * the Free Software Foundation.
15 */ 15 */
16 16
17#include <linux/gpio.h> 17#include <linux/gpio/consumer.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
index 2fd5602880a7..671806ca7d6a 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
@@ -9,7 +9,7 @@
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/gpio.h> 12#include <linux/gpio/consumer.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
index e780fd4f8b46..7c2331be8d15 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
@@ -9,7 +9,7 @@
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/gpio.h> 12#include <linux/gpio/consumer.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 36485c2137ce..2b118071b5a1 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -14,7 +14,7 @@
14#include <linux/backlight.h> 14#include <linux/backlight.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/fb.h> 16#include <linux/fb.h>
17#include <linux/gpio.h> 17#include <linux/gpio/consumer.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/jiffies.h> 19#include <linux/jiffies.h>
20#include <linux/module.h> 20#include <linux/module.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
index 458f77bc473d..ac680e1de603 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
@@ -15,6 +15,7 @@
15#include <linux/spi/spi.h> 15#include <linux/spi/spi.h>
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/gpio/consumer.h>
18 19
19#include <video/omapdss.h> 20#include <video/omapdss.h>
20#include <video/omap-panel-data.h> 21#include <video/omap-panel-data.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
index 780cb263a318..38d2920a95e6 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
@@ -15,7 +15,7 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <linux/gpio.h> 18#include <linux/gpio/consumer.h>
19#include <linux/of_gpio.h> 19#include <linux/of_gpio.h>
20 20
21#include <video/omapdss.h> 21#include <video/omapdss.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
index 529a017602e4..4363fffc87e3 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <linux/gpio.h> 13#include <linux/gpio/consumer.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_gpio.h> 16#include <linux/of_gpio.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
index 31efcca801bd..deb416736aad 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
@@ -29,7 +29,7 @@
29#include <linux/sched.h> 29#include <linux/sched.h>
30#include <linux/backlight.h> 30#include <linux/backlight.h>
31#include <linux/fb.h> 31#include <linux/fb.h>
32#include <linux/gpio.h> 32#include <linux/gpio/consumer.h>
33#include <linux/of.h> 33#include <linux/of.h>
34#include <linux/of_gpio.h> 34#include <linux/of_gpio.h>
35 35
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
index 03e2beb7b4f0..d93175b03a12 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
@@ -14,7 +14,7 @@
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/spi/spi.h> 15#include <linux/spi/spi.h>
16#include <linux/regulator/consumer.h> 16#include <linux/regulator/consumer.h>
17#include <linux/gpio.h> 17#include <linux/gpio/consumer.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/of_gpio.h> 20#include <linux/of_gpio.h>
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 8730646a0cbb..9ed8272e54ae 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -1180,15 +1180,6 @@ static int dsi_regulator_init(struct platform_device *dsidev)
1180 return PTR_ERR(vdds_dsi); 1180 return PTR_ERR(vdds_dsi);
1181 } 1181 }
1182 1182
1183 if (regulator_can_change_voltage(vdds_dsi)) {
1184 r = regulator_set_voltage(vdds_dsi, 1800000, 1800000);
1185 if (r) {
1186 devm_regulator_put(vdds_dsi);
1187 DSSERR("can't set the DSI regulator voltage\n");
1188 return r;
1189 }
1190 }
1191
1192 dsi->vdds_dsi_reg = vdds_dsi; 1183 dsi->vdds_dsi_reg = vdds_dsi;
1193 1184
1194 return 0; 1185 return 0;
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index f95ff319e68e..3303cfad4838 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -30,6 +30,7 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/seq_file.h> 31#include <linux/seq_file.h>
32#include <linux/clk.h> 32#include <linux/clk.h>
33#include <linux/pinctrl/consumer.h>
33#include <linux/platform_device.h> 34#include <linux/platform_device.h>
34#include <linux/pm_runtime.h> 35#include <linux/pm_runtime.h>
35#include <linux/gfp.h> 36#include <linux/gfp.h>
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index f892ae157ff3..4d46cdf7a037 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -33,6 +33,7 @@
33#include <linux/gpio.h> 33#include <linux/gpio.h>
34#include <linux/regulator/consumer.h> 34#include <linux/regulator/consumer.h>
35#include <linux/component.h> 35#include <linux/component.h>
36#include <linux/of.h>
36#include <video/omapdss.h> 37#include <video/omapdss.h>
37#include <sound/omap-hdmi-audio.h> 38#include <sound/omap-hdmi-audio.h>
38 39
@@ -100,7 +101,6 @@ static irqreturn_t hdmi_irq_handler(int irq, void *data)
100 101
101static int hdmi_init_regulator(void) 102static int hdmi_init_regulator(void)
102{ 103{
103 int r;
104 struct regulator *reg; 104 struct regulator *reg;
105 105
106 if (hdmi.vdda_reg != NULL) 106 if (hdmi.vdda_reg != NULL)
@@ -114,15 +114,6 @@ static int hdmi_init_regulator(void)
114 return PTR_ERR(reg); 114 return PTR_ERR(reg);
115 } 115 }
116 116
117 if (regulator_can_change_voltage(reg)) {
118 r = regulator_set_voltage(reg, 1800000, 1800000);
119 if (r) {
120 devm_regulator_put(reg);
121 DSSWARN("can't set the regulator voltage\n");
122 return r;
123 }
124 }
125
126 hdmi.vdda_reg = reg; 117 hdmi.vdda_reg = reg;
127 118
128 return 0; 119 return 0;
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
index fa72e735dad2..ef3afe99e487 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
@@ -211,7 +211,7 @@ static void hdmi_core_init(struct hdmi_core_video_config *video_cfg)
211static void hdmi_core_powerdown_disable(struct hdmi_core_data *core) 211static void hdmi_core_powerdown_disable(struct hdmi_core_data *core)
212{ 212{
213 DSSDBG("Enter hdmi_core_powerdown_disable\n"); 213 DSSDBG("Enter hdmi_core_powerdown_disable\n");
214 REG_FLD_MOD(core->base, HDMI_CORE_SYS_SYS_CTRL1, 0x0, 0, 0); 214 REG_FLD_MOD(core->base, HDMI_CORE_SYS_SYS_CTRL1, 0x1, 0, 0);
215} 215}
216 216
217static void hdmi_core_swreset_release(struct hdmi_core_data *core) 217static void hdmi_core_swreset_release(struct hdmi_core_data *core)
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index a43f7b10e113..e129245eb8a9 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -38,6 +38,7 @@
38#include <linux/gpio.h> 38#include <linux/gpio.h>
39#include <linux/regulator/consumer.h> 39#include <linux/regulator/consumer.h>
40#include <linux/component.h> 40#include <linux/component.h>
41#include <linux/of.h>
41#include <video/omapdss.h> 42#include <video/omapdss.h>
42#include <sound/omap-hdmi-audio.h> 43#include <sound/omap-hdmi-audio.h>
43 44
@@ -131,15 +132,6 @@ static int hdmi_init_regulator(void)
131 return PTR_ERR(reg); 132 return PTR_ERR(reg);
132 } 133 }
133 134
134 if (regulator_can_change_voltage(reg)) {
135 r = regulator_set_voltage(reg, 1800000, 1800000);
136 if (r) {
137 devm_regulator_put(reg);
138 DSSWARN("can't set the regulator voltage\n");
139 return r;
140 }
141 }
142
143 hdmi.vdda_reg = reg; 135 hdmi.vdda_reg = reg;
144 136
145 return 0; 137 return 0;
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c b/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
index 6a397520cae5..8ab2093daa12 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
@@ -51,8 +51,8 @@ static void hdmi_core_ddc_init(struct hdmi_core_data *core)
51{ 51{
52 void __iomem *base = core->base; 52 void __iomem *base = core->base;
53 const unsigned long long iclk = 266000000; /* DSS L3 ICLK */ 53 const unsigned long long iclk = 266000000; /* DSS L3 ICLK */
54 const unsigned ss_scl_high = 4000; /* ns */ 54 const unsigned ss_scl_high = 4600; /* ns */
55 const unsigned ss_scl_low = 4700; /* ns */ 55 const unsigned ss_scl_low = 5400; /* ns */
56 const unsigned fs_scl_high = 600; /* ns */ 56 const unsigned fs_scl_high = 600; /* ns */
57 const unsigned fs_scl_low = 1300; /* ns */ 57 const unsigned fs_scl_low = 1300; /* ns */
58 const unsigned sda_hold = 1000; /* ns */ 58 const unsigned sda_hold = 1000; /* ns */
@@ -458,7 +458,7 @@ static void hdmi_core_write_avi_infoframe(struct hdmi_core_data *core,
458 458
459 c = (ptr[1] >> 6) & 0x3; 459 c = (ptr[1] >> 6) & 0x3;
460 m = (ptr[1] >> 4) & 0x3; 460 m = (ptr[1] >> 4) & 0x3;
461 r = (ptr[1] >> 0) & 0x3; 461 r = (ptr[1] >> 0) & 0xf;
462 462
463 itc = (ptr[2] >> 7) & 0x1; 463 itc = (ptr[2] >> 7) & 0x1;
464 ec = (ptr[2] >> 4) & 0x7; 464 ec = (ptr[2] >> 4) & 0x7;
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
index 1f5d19c119ce..f98b750fc499 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
@@ -13,6 +13,7 @@
13#include <linux/io.h> 13#include <linux/io.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/seq_file.h>
16#include <video/omapdss.h> 17#include <video/omapdss.h>
17 18
18#include "dss.h" 19#include "dss.h"
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
index 06e23a7c432c..f1015e8b8267 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
@@ -16,6 +16,7 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/seq_file.h>
19 20
20#include <video/omapdss.h> 21#include <video/omapdss.h>
21 22
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c b/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c
index 13442b9052d1..055f62fca5dc 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c
@@ -14,6 +14,7 @@
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/seq_file.h>
17#include <video/omapdss.h> 18#include <video/omapdss.h>
18 19
19#include "dss.h" 20#include "dss.h"
diff --git a/drivers/gpu/drm/omapdrm/omap_debugfs.c b/drivers/gpu/drm/omapdrm/omap_debugfs.c
index 6f5fc14fc015..479bf24050f8 100644
--- a/drivers/gpu/drm/omapdrm/omap_debugfs.c
+++ b/drivers/gpu/drm/omapdrm/omap_debugfs.c
@@ -17,6 +17,8 @@
17 * this program. If not, see <http://www.gnu.org/licenses/>. 17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <linux/seq_file.h>
21
20#include <drm/drm_crtc.h> 22#include <drm/drm_crtc.h>
21#include <drm/drm_fb_helper.h> 23#include <drm/drm_fb_helper.h>
22 24
diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
index de275a5be1db..4ceed7a9762f 100644
--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
+++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
@@ -27,6 +27,7 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/platform_device.h> /* platform_device() */ 28#include <linux/platform_device.h> /* platform_device() */
29#include <linux/sched.h> 29#include <linux/sched.h>
30#include <linux/seq_file.h>
30#include <linux/slab.h> 31#include <linux/slab.h>
31#include <linux/time.h> 32#include <linux/time.h>
32#include <linux/vmalloc.h> 33#include <linux/vmalloc.h>
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 94ec06d3d737..f84570d1636c 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -17,6 +17,8 @@
17 * this program. If not, see <http://www.gnu.org/licenses/>. 17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <linux/seq_file.h>
21
20#include <drm/drm_crtc.h> 22#include <drm/drm_crtc.h>
21#include <drm/drm_crtc_helper.h> 23#include <drm/drm_crtc_helper.h>
22 24
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index b97afc281778..03698b6c806c 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -17,6 +17,7 @@
17 * this program. If not, see <http://www.gnu.org/licenses/>. 17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <linux/seq_file.h>
20#include <linux/shmem_fs.h> 21#include <linux/shmem_fs.h>
21#include <linux/spinlock.h> 22#include <linux/spinlock.h>
22#include <linux/pfn_t.h> 23#include <linux/pfn_t.h>
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index 505620c7c2c8..e04deedabd4a 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -51,15 +51,6 @@ static void sti_crtc_disabling(struct drm_crtc *crtc)
51 mixer->status = STI_MIXER_DISABLING; 51 mixer->status = STI_MIXER_DISABLING;
52} 52}
53 53
54static bool sti_crtc_mode_fixup(struct drm_crtc *crtc,
55 const struct drm_display_mode *mode,
56 struct drm_display_mode *adjusted_mode)
57{
58 /* accept the provided drm_display_mode, do not fix it up */
59 drm_mode_set_crtcinfo(adjusted_mode, CRTC_INTERLACE_HALVE_V);
60 return true;
61}
62
63static int 54static int
64sti_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode) 55sti_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode)
65{ 56{
@@ -230,7 +221,6 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
230static const struct drm_crtc_helper_funcs sti_crtc_helper_funcs = { 221static const struct drm_crtc_helper_funcs sti_crtc_helper_funcs = {
231 .enable = sti_crtc_enable, 222 .enable = sti_crtc_enable,
232 .disable = sti_crtc_disabling, 223 .disable = sti_crtc_disabling,
233 .mode_fixup = sti_crtc_mode_fixup,
234 .mode_set = drm_helper_crtc_mode_set, 224 .mode_set = drm_helper_crtc_mode_set,
235 .mode_set_nofb = sti_crtc_mode_set_nofb, 225 .mode_set_nofb = sti_crtc_mode_set_nofb,
236 .mode_set_base = drm_helper_crtc_mode_set_base, 226 .mode_set_base = drm_helper_crtc_mode_set_base,
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c b/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c
index 8ea531d2652c..bbfe7e2d4332 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c
@@ -51,8 +51,8 @@ static void hdmi_core_ddc_init(struct hdmi_core_data *core)
51{ 51{
52 void __iomem *base = core->base; 52 void __iomem *base = core->base;
53 const unsigned long long iclk = 266000000; /* DSS L3 ICLK */ 53 const unsigned long long iclk = 266000000; /* DSS L3 ICLK */
54 const unsigned ss_scl_high = 4000; /* ns */ 54 const unsigned ss_scl_high = 4600; /* ns */
55 const unsigned ss_scl_low = 4700; /* ns */ 55 const unsigned ss_scl_low = 5400; /* ns */
56 const unsigned fs_scl_high = 600; /* ns */ 56 const unsigned fs_scl_high = 600; /* ns */
57 const unsigned fs_scl_low = 1300; /* ns */ 57 const unsigned fs_scl_low = 1300; /* ns */
58 const unsigned sda_hold = 1000; /* ns */ 58 const unsigned sda_hold = 1000; /* ns */
@@ -442,7 +442,7 @@ static void hdmi_core_write_avi_infoframe(struct hdmi_core_data *core,
442 442
443 c = (ptr[1] >> 6) & 0x3; 443 c = (ptr[1] >> 6) & 0x3;
444 m = (ptr[1] >> 4) & 0x3; 444 m = (ptr[1] >> 4) & 0x3;
445 r = (ptr[1] >> 0) & 0x3; 445 r = (ptr[1] >> 0) & 0xf;
446 446
447 itc = (ptr[2] >> 7) & 0x1; 447 itc = (ptr[2] >> 7) & 0x1;
448 ec = (ptr[2] >> 4) & 0x7; 448 ec = (ptr[2] >> 4) & 0x7;