aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-10-16 20:10:17 -0400
committerDave Airlie <airlied@redhat.com>2017-10-16 20:10:17 -0400
commit6c94804fde4415f3938778155d8e665e6870a46d (patch)
treedf9dbb4be6005171b457aee49706e409ae27e765
parent787e1b74b77d4aa910f40dd5f08edb5da27200bd (diff)
parent2e20c9ddae0b3770abca4b9b1a5243d6841bdd84 (diff)
Merge tag 'drm-misc-next-2017-10-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
Quick 4.15 misc pull for the build fix: Cross-subsystem Changes: - piles an piles of misc/trivial patches all over, some more from outreachy applicants Core Changes: - build fix for the bridge/of cleanup (Maarten) - fix vblank count in arm_vblank_event (Ville) - some kerneldoc typo fixes from Thierry Driver Changes: - vc4: Fix T-format tiling scanout, cleanup clock divider w/a (Anholt) - sun4i: small cleanups and improved code comments all over (Chen-Yu Tsai) * tag 'drm-misc-next-2017-10-16' of git://anongit.freedesktop.org/drm/drm-misc: (21 commits) drm/via: use ARRAY_SIZE drm/gma500: use ARRAY_SIZE drm/sun4i: hdmi: Move PAD_CTRL1 setting to mode_set function drm/sun4i: hdmi: Document PAD_CTRL1 output invert bits drm/sun4i: backend: Add comment explaining why registers are cleared drm/sun4i: backend: Use drm_fb_cma_get_gem_addr() to get display memory drm/sun4i: backend: Create regmap after access is possible drm/sun4i: don't add components that are already in the queue drm/vc4: Fix pitch setup for T-format scanout. drm/vc4: Move the DSI clock divider workaround closer to the clock call. drm: Replace kzalloc with kcalloc drm/tinydrm: Remove explicit .best_encoder assignment drm/tinydrm: Replace dev_error with DRM_DEV_ERROR drm/drm_of: Move drm_of_panel_bridge_remove_function into header. drm/atomic-helper: Fix reference to drm_crtc_send_vblank_event() drm/atomic-helper: Fix typo drm: Add missing __user annotation to drm_syncobj_array_find() drm/rockchip: add PINCTRL dependency for LVDS drm/kirin: Checking for IS_ERR() instead of NULL driver:gpu: return -ENOMEM on allocation failure. ...
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c4
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c4
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c2
-rw-r--r--drivers/gpu/drm/drm_of.c33
-rw-r--r--drivers/gpu/drm/drm_plane_helper.c2
-rw-r--r--drivers/gpu/drm/drm_syncobj.c3
-rw-r--r--drivers/gpu/drm/drm_vblank.c2
-rw-r--r--drivers/gpu/drm/gma500/mid_bios.c2
-rw-r--r--drivers/gpu/drm/gma500/psb_intel_sdvo.c9
-rw-r--r--drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c4
-rw-r--r--drivers/gpu/drm/rockchip/Kconfig1
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_backend.c38
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_drv.c16
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_hdmi.h5
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c26
-rw-r--r--drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c1
-rw-r--r--drivers/gpu/drm/tinydrm/mi0283qt.c8
-rw-r--r--drivers/gpu/drm/tinydrm/repaper.c28
-rw-r--r--drivers/gpu/drm/tinydrm/st7586.c6
-rw-r--r--drivers/gpu/drm/vc4/vc4_dsi.c12
-rw-r--r--drivers/gpu/drm/vc4/vc4_plane.c20
-rw-r--r--drivers/gpu/drm/via/via_verifier.c10
-rw-r--r--include/drm/drm_of.h29
23 files changed, 142 insertions, 123 deletions
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 960944e82b98..ae56d91433ff 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1704,7 +1704,7 @@ crtc_or_fake_commit(struct drm_atomic_state *state, struct drm_crtc *crtc)
1704 * drm_atomic_helper_commit_cleanup_done(). 1704 * drm_atomic_helper_commit_cleanup_done().
1705 * 1705 *
1706 * This is all implemented by in drm_atomic_helper_commit(), giving drivers a 1706 * This is all implemented by in drm_atomic_helper_commit(), giving drivers a
1707 * complete and esay-to-use default implementation of the atomic_commit() hook. 1707 * complete and easy-to-use default implementation of the atomic_commit() hook.
1708 * 1708 *
1709 * The tracking of asynchronously executed and still pending commits is done 1709 * The tracking of asynchronously executed and still pending commits is done
1710 * using the core structure &drm_crtc_commit. 1710 * using the core structure &drm_crtc_commit.
@@ -1819,7 +1819,7 @@ EXPORT_SYMBOL(drm_atomic_helper_setup_commit);
1819 * This function waits for all preceeding commits that touch the same CRTC as 1819 * This function waits for all preceeding commits that touch the same CRTC as
1820 * @old_state to both be committed to the hardware (as signalled by 1820 * @old_state to both be committed to the hardware (as signalled by
1821 * drm_atomic_helper_commit_hw_done) and executed by the hardware (as signalled 1821 * drm_atomic_helper_commit_hw_done) and executed by the hardware (as signalled
1822 * by calling drm_crtc_vblank_send_event() on the &drm_crtc_state.event). 1822 * by calling drm_crtc_send_vblank_event() on the &drm_crtc_state.event).
1823 * 1823 *
1824 * This is part of the atomic helper support for nonblocking commits, see 1824 * This is part of the atomic helper support for nonblocking commits, see
1825 * drm_atomic_helper_setup_commit() for an overview. 1825 * drm_atomic_helper_setup_commit() for an overview.
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index eab36a460638..5a84c3bc915d 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -562,12 +562,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
562 * Allocate space for the backup of all (non-pointer) encoder and 562 * Allocate space for the backup of all (non-pointer) encoder and
563 * connector data. 563 * connector data.
564 */ 564 */
565 save_encoder_crtcs = kzalloc(dev->mode_config.num_encoder * 565 save_encoder_crtcs = kcalloc(dev->mode_config.num_encoder,
566 sizeof(struct drm_crtc *), GFP_KERNEL); 566 sizeof(struct drm_crtc *), GFP_KERNEL);
567 if (!save_encoder_crtcs) 567 if (!save_encoder_crtcs)
568 return -ENOMEM; 568 return -ENOMEM;
569 569
570 save_connector_encoders = kzalloc(dev->mode_config.num_connector * 570 save_connector_encoders = kcalloc(dev->mode_config.num_connector,
571 sizeof(struct drm_encoder *), GFP_KERNEL); 571 sizeof(struct drm_encoder *), GFP_KERNEL);
572 if (!save_connector_encoders) { 572 if (!save_connector_encoders) {
573 kfree(save_encoder_crtcs); 573 kfree(save_encoder_crtcs);
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 6a31d13f2f81..116d1f1337c7 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2266,7 +2266,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
2266 if (modes[n] == NULL) 2266 if (modes[n] == NULL)
2267 return best_score; 2267 return best_score;
2268 2268
2269 crtcs = kzalloc(fb_helper->connector_count * 2269 crtcs = kcalloc(fb_helper->connector_count,
2270 sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL); 2270 sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL);
2271 if (!crtcs) 2271 if (!crtcs)
2272 return best_score; 2272 return best_score;
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index 7a36934ea5db..4c191c050e7d 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -262,36 +262,3 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
262 return ret; 262 return ret;
263} 263}
264EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); 264EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge);
265
266#ifdef CONFIG_DRM_PANEL_BRIDGE
267/*
268 * drm_of_panel_bridge_remove - remove panel bridge
269 * @np: device tree node containing panel bridge output ports
270 *
271 * Remove the panel bridge of a given DT node's port and endpoint number
272 *
273 * Returns zero if successful, or one of the standard error codes if it fails.
274 */
275int drm_of_panel_bridge_remove(const struct device_node *np,
276 int port, int endpoint)
277{
278 struct drm_bridge *bridge;
279 struct device_node *remote;
280
281 remote = of_graph_get_remote_node(np, port, endpoint);
282 if (!remote)
283 return -ENODEV;
284
285 bridge = of_drm_find_bridge(remote);
286 drm_panel_bridge_remove(bridge);
287
288 return 0;
289}
290#else
291int drm_of_panel_bridge_remove(const struct device_node *np,
292 int port, int endpoint)
293{
294 return -EINVAL;
295}
296#endif
297EXPORT_SYMBOL_GPL(drm_of_panel_bridge_remove);
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 06aee1741e96..759ed93f4ba8 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -354,7 +354,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
354 /* Find current connectors for CRTC */ 354 /* Find current connectors for CRTC */
355 num_connectors = get_connectors_for_crtc(crtc, NULL, 0); 355 num_connectors = get_connectors_for_crtc(crtc, NULL, 0);
356 BUG_ON(num_connectors == 0); 356 BUG_ON(num_connectors == 0);
357 connector_list = kzalloc(num_connectors * sizeof(*connector_list), 357 connector_list = kcalloc(num_connectors, sizeof(*connector_list),
358 GFP_KERNEL); 358 GFP_KERNEL);
359 if (!connector_list) 359 if (!connector_list)
360 return -ENOMEM; 360 return -ENOMEM;
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 80b6151da9ae..f776fc1cc543 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -845,7 +845,8 @@ static int drm_syncobj_array_wait(struct drm_device *dev,
845} 845}
846 846
847static int drm_syncobj_array_find(struct drm_file *file_private, 847static int drm_syncobj_array_find(struct drm_file *file_private,
848 void *user_handles, uint32_t count_handles, 848 void __user *user_handles,
849 uint32_t count_handles,
849 struct drm_syncobj ***syncobjs_out) 850 struct drm_syncobj ***syncobjs_out)
850{ 851{
851 uint32_t i, *handles; 852 uint32_t i, *handles;
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 810a93fc558b..3af6c20ba03b 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -854,7 +854,7 @@ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
854 assert_spin_locked(&dev->event_lock); 854 assert_spin_locked(&dev->event_lock);
855 855
856 e->pipe = pipe; 856 e->pipe = pipe;
857 e->event.sequence = drm_vblank_count(dev, pipe); 857 e->event.sequence = drm_crtc_accurate_vblank_count(crtc) + 1;
858 e->event.crtc_id = crtc->base.id; 858 e->event.crtc_id = crtc->base.id;
859 list_add_tail(&e->base.link, &dev->vblank_event_list); 859 list_add_tail(&e->base.link, &dev->vblank_event_list);
860} 860}
diff --git a/drivers/gpu/drm/gma500/mid_bios.c b/drivers/gpu/drm/gma500/mid_bios.c
index d75ecb3bdee7..1fa163373a47 100644
--- a/drivers/gpu/drm/gma500/mid_bios.c
+++ b/drivers/gpu/drm/gma500/mid_bios.c
@@ -237,7 +237,7 @@ static int mid_get_vbt_data_r10(struct drm_psb_private *dev_priv, u32 addr)
237 237
238 gct = kmalloc(sizeof(*gct) * vbt.panel_count, GFP_KERNEL); 238 gct = kmalloc(sizeof(*gct) * vbt.panel_count, GFP_KERNEL);
239 if (!gct) 239 if (!gct)
240 return -1; 240 return -ENOMEM;
241 241
242 gct_virtual = ioremap(addr + sizeof(vbt), 242 gct_virtual = ioremap(addr + sizeof(vbt),
243 sizeof(*gct) * vbt.panel_count); 243 sizeof(*gct) * vbt.panel_count);
diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
index e787d376ba67..84507912be84 100644
--- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
+++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
@@ -37,6 +37,7 @@
37#include "psb_drv.h" 37#include "psb_drv.h"
38#include "psb_intel_sdvo_regs.h" 38#include "psb_intel_sdvo_regs.h"
39#include "psb_intel_reg.h" 39#include "psb_intel_reg.h"
40#include <linux/kernel.h>
40 41
41#define SDVO_TMDS_MASK (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1) 42#define SDVO_TMDS_MASK (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)
42#define SDVO_RGB_MASK (SDVO_OUTPUT_RGB0 | SDVO_OUTPUT_RGB1) 43#define SDVO_RGB_MASK (SDVO_OUTPUT_RGB0 | SDVO_OUTPUT_RGB1)
@@ -62,8 +63,6 @@ static const char *tv_format_names[] = {
62 "SECAM_60" 63 "SECAM_60"
63}; 64};
64 65
65#define TV_FORMAT_NUM (sizeof(tv_format_names) / sizeof(*tv_format_names))
66
67struct psb_intel_sdvo { 66struct psb_intel_sdvo {
68 struct gma_encoder base; 67 struct gma_encoder base;
69 68
@@ -148,7 +147,7 @@ struct psb_intel_sdvo_connector {
148 int force_audio; 147 int force_audio;
149 148
150 /* This contains all current supported TV format */ 149 /* This contains all current supported TV format */
151 u8 tv_format_supported[TV_FORMAT_NUM]; 150 u8 tv_format_supported[ARRAY_SIZE(tv_format_names)];
152 int format_supported_num; 151 int format_supported_num;
153 struct drm_property *tv_format; 152 struct drm_property *tv_format;
154 153
@@ -1709,7 +1708,7 @@ psb_intel_sdvo_set_property(struct drm_connector *connector,
1709 } 1708 }
1710 1709
1711 if (property == psb_intel_sdvo_connector->tv_format) { 1710 if (property == psb_intel_sdvo_connector->tv_format) {
1712 if (val >= TV_FORMAT_NUM) 1711 if (val >= ARRAY_SIZE(tv_format_names))
1713 return -EINVAL; 1712 return -EINVAL;
1714 1713
1715 if (psb_intel_sdvo->tv_format_index == 1714 if (psb_intel_sdvo->tv_format_index ==
@@ -2269,7 +2268,7 @@ static bool psb_intel_sdvo_tv_create_property(struct psb_intel_sdvo *psb_intel_s
2269 return false; 2268 return false;
2270 2269
2271 psb_intel_sdvo_connector->format_supported_num = 0; 2270 psb_intel_sdvo_connector->format_supported_num = 0;
2272 for (i = 0 ; i < TV_FORMAT_NUM; i++) 2271 for (i = 0 ; i < ARRAY_SIZE(tv_format_names); i++)
2273 if (format_map & (1 << i)) 2272 if (format_map & (1 << i))
2274 psb_intel_sdvo_connector->tv_format_supported[psb_intel_sdvo_connector->format_supported_num++] = i; 2273 psb_intel_sdvo_connector->tv_format_supported[psb_intel_sdvo_connector->format_supported_num++] = i;
2275 2274
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index c19ab4f91ae7..ddb0403f1975 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -237,8 +237,8 @@ static int kirin_drm_platform_probe(struct platform_device *pdev)
237 } 237 }
238 238
239 remote = of_graph_get_remote_node(np, 0, 0); 239 remote = of_graph_get_remote_node(np, 0, 0);
240 if (IS_ERR(remote)) 240 if (!remote)
241 return PTR_ERR(remote); 241 return -ENODEV;
242 242
243 drm_of_component_match_add(dev, &match, compare_of, remote); 243 drm_of_component_match_add(dev, &match, compare_of, remote);
244 of_node_put(remote); 244 of_node_put(remote);
diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 0c31f0a27b9c..3c70c6224bd2 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -60,6 +60,7 @@ config ROCKCHIP_INNO_HDMI
60config ROCKCHIP_LVDS 60config ROCKCHIP_LVDS
61 bool "Rockchip LVDS support" 61 bool "Rockchip LVDS support"
62 depends on DRM_ROCKCHIP 62 depends on DRM_ROCKCHIP
63 depends on PINCTRL
63 help 64 help
64 Choose this option to enable support for Rockchip LVDS controllers. 65 Choose this option to enable support for Rockchip LVDS controllers.
65 Rockchip rk3288 SoC has LVDS TX Controller can be used, and it 66 Rockchip rk3288 SoC has LVDS TX Controller can be used, and it
diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c
index ec5943627aa5..4fefd8add714 100644
--- a/drivers/gpu/drm/sun4i/sun4i_backend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
@@ -209,22 +209,11 @@ int sun4i_backend_update_layer_buffer(struct sun4i_backend *backend,
209{ 209{
210 struct drm_plane_state *state = plane->state; 210 struct drm_plane_state *state = plane->state;
211 struct drm_framebuffer *fb = state->fb; 211 struct drm_framebuffer *fb = state->fb;
212 struct drm_gem_cma_object *gem;
213 u32 lo_paddr, hi_paddr; 212 u32 lo_paddr, hi_paddr;
214 dma_addr_t paddr; 213 dma_addr_t paddr;
215 int bpp;
216
217 /* Get the physical address of the buffer in memory */
218 gem = drm_fb_cma_get_gem_obj(fb, 0);
219
220 DRM_DEBUG_DRIVER("Using GEM @ %pad\n", &gem->paddr);
221
222 /* Compute the start of the displayed memory */
223 bpp = fb->format->cpp[0];
224 paddr = gem->paddr + fb->offsets[0];
225 paddr += (state->src_x >> 16) * bpp;
226 paddr += (state->src_y >> 16) * fb->pitches[0];
227 214
215 /* Get the start of the displayed memory */
216 paddr = drm_fb_cma_get_gem_addr(fb, state, 0);
228 DRM_DEBUG_DRIVER("Setting buffer address to %pad\n", &paddr); 217 DRM_DEBUG_DRIVER("Setting buffer address to %pad\n", &paddr);
229 218
230 /* Write the 32 lower bits of the address (in bits) */ 219 /* Write the 32 lower bits of the address (in bits) */
@@ -369,13 +358,6 @@ static int sun4i_backend_bind(struct device *dev, struct device *master,
369 if (IS_ERR(regs)) 358 if (IS_ERR(regs))
370 return PTR_ERR(regs); 359 return PTR_ERR(regs);
371 360
372 backend->engine.regs = devm_regmap_init_mmio(dev, regs,
373 &sun4i_backend_regmap_config);
374 if (IS_ERR(backend->engine.regs)) {
375 dev_err(dev, "Couldn't create the backend regmap\n");
376 return PTR_ERR(backend->engine.regs);
377 }
378
379 backend->reset = devm_reset_control_get(dev, NULL); 361 backend->reset = devm_reset_control_get(dev, NULL);
380 if (IS_ERR(backend->reset)) { 362 if (IS_ERR(backend->reset)) {
381 dev_err(dev, "Couldn't get our reset line\n"); 363 dev_err(dev, "Couldn't get our reset line\n");
@@ -421,9 +403,23 @@ static int sun4i_backend_bind(struct device *dev, struct device *master,
421 } 403 }
422 } 404 }
423 405
406 backend->engine.regs = devm_regmap_init_mmio(dev, regs,
407 &sun4i_backend_regmap_config);
408 if (IS_ERR(backend->engine.regs)) {
409 dev_err(dev, "Couldn't create the backend regmap\n");
410 return PTR_ERR(backend->engine.regs);
411 }
412
424 list_add_tail(&backend->engine.list, &drv->engine_list); 413 list_add_tail(&backend->engine.list, &drv->engine_list);
425 414
426 /* Reset the registers */ 415 /*
416 * Many of the backend's layer configuration registers have
417 * undefined default values. This poses a risk as we use
418 * regmap_update_bits in some places, and don't overwrite
419 * the whole register.
420 *
421 * Clear the registers here to have something predictable.
422 */
427 for (i = 0x800; i < 0x1000; i += 4) 423 for (i = 0x800; i < 0x1000; i += 4)
428 regmap_write(backend->engine.regs, i, 0); 424 regmap_write(backend->engine.regs, i, 0);
429 425
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index a2012638d5f7..b5879d4620d8 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -226,6 +226,18 @@ struct endpoint_list {
226 struct list_head list; 226 struct list_head list;
227}; 227};
228 228
229static bool node_is_in_list(struct list_head *endpoints,
230 struct device_node *node)
231{
232 struct endpoint_list *endpoint;
233
234 list_for_each_entry(endpoint, endpoints, list)
235 if (endpoint->node == node)
236 return true;
237
238 return false;
239}
240
229static int sun4i_drv_add_endpoints(struct device *dev, 241static int sun4i_drv_add_endpoints(struct device *dev,
230 struct list_head *endpoints, 242 struct list_head *endpoints,
231 struct component_match **match, 243 struct component_match **match,
@@ -292,6 +304,10 @@ static int sun4i_drv_add_endpoints(struct device *dev,
292 } 304 }
293 } 305 }
294 306
307 /* skip downstream node if it is already in the queue */
308 if (node_is_in_list(endpoints, remote))
309 continue;
310
295 /* Add downstream nodes to the queue */ 311 /* Add downstream nodes to the queue */
296 endpoint = kzalloc(sizeof(*endpoint), GFP_KERNEL); 312 endpoint = kzalloc(sizeof(*endpoint), GFP_KERNEL);
297 if (!endpoint) { 313 if (!endpoint) {
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
index 9b97da39927e..b685ee11623d 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
@@ -72,6 +72,11 @@
72#define SUN4I_HDMI_PAD_CTRL1_HALVE_CLK BIT(6) 72#define SUN4I_HDMI_PAD_CTRL1_HALVE_CLK BIT(6)
73#define SUN4I_HDMI_PAD_CTRL1_REG_AMP(n) (((n) & 7) << 3) 73#define SUN4I_HDMI_PAD_CTRL1_REG_AMP(n) (((n) & 7) << 3)
74 74
75/* These bits seem to invert the TMDS data channels */
76#define SUN4I_HDMI_PAD_CTRL1_INVERT_R BIT(2)
77#define SUN4I_HDMI_PAD_CTRL1_INVERT_G BIT(1)
78#define SUN4I_HDMI_PAD_CTRL1_INVERT_B BIT(0)
79
75#define SUN4I_HDMI_PLL_CTRL_REG 0x208 80#define SUN4I_HDMI_PLL_CTRL_REG 0x208
76#define SUN4I_HDMI_PLL_CTRL_PLL_EN BIT(31) 81#define SUN4I_HDMI_PLL_CTRL_PLL_EN BIT(31)
77#define SUN4I_HDMI_PLL_CTRL_BWS BIT(30) 82#define SUN4I_HDMI_PLL_CTRL_BWS BIT(30)
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index 027b5608dbe6..6ca6e6a74c4a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -144,6 +144,22 @@ static void sun4i_hdmi_mode_set(struct drm_encoder *encoder,
144 writel(SUN4I_HDMI_UNKNOWN_INPUT_SYNC, 144 writel(SUN4I_HDMI_UNKNOWN_INPUT_SYNC,
145 hdmi->base + SUN4I_HDMI_UNKNOWN_REG); 145 hdmi->base + SUN4I_HDMI_UNKNOWN_REG);
146 146
147 /*
148 * Setup output pad (?) controls
149 *
150 * This is done here instead of at probe/bind time because
151 * the controller seems to toggle some of the bits on its own.
152 *
153 * We can't just initialize the register there, we need to
154 * protect the clock bits that have already been read out and
155 * cached by the clock framework.
156 */
157 val = readl(hdmi->base + SUN4I_HDMI_PAD_CTRL1_REG);
158 val &= SUN4I_HDMI_PAD_CTRL1_HALVE_CLK;
159 val |= hdmi->variant->pad_ctrl1_init_val;
160 writel(val, hdmi->base + SUN4I_HDMI_PAD_CTRL1_REG);
161 val = readl(hdmi->base + SUN4I_HDMI_PAD_CTRL1_REG);
162
147 /* Setup timing registers */ 163 /* Setup timing registers */
148 writel(SUN4I_HDMI_VID_TIMING_X(mode->hdisplay) | 164 writel(SUN4I_HDMI_VID_TIMING_X(mode->hdisplay) |
149 SUN4I_HDMI_VID_TIMING_Y(mode->vdisplay), 165 SUN4I_HDMI_VID_TIMING_Y(mode->vdisplay),
@@ -489,16 +505,6 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
489 writel(hdmi->variant->pad_ctrl0_init_val, 505 writel(hdmi->variant->pad_ctrl0_init_val,
490 hdmi->base + SUN4I_HDMI_PAD_CTRL0_REG); 506 hdmi->base + SUN4I_HDMI_PAD_CTRL0_REG);
491 507
492 /*
493 * We can't just initialize the register there, we need to
494 * protect the clock bits that have already been read out and
495 * cached by the clock framework.
496 */
497 reg = readl(hdmi->base + SUN4I_HDMI_PAD_CTRL1_REG);
498 reg &= SUN4I_HDMI_PAD_CTRL1_HALVE_CLK;
499 reg |= hdmi->variant->pad_ctrl1_init_val;
500 writel(reg, hdmi->base + SUN4I_HDMI_PAD_CTRL1_REG);
501
502 reg = readl(hdmi->base + SUN4I_HDMI_PLL_CTRL_REG); 508 reg = readl(hdmi->base + SUN4I_HDMI_PLL_CTRL_REG);
503 reg &= SUN4I_HDMI_PLL_CTRL_DIV_MASK; 509 reg &= SUN4I_HDMI_PLL_CTRL_DIV_MASK;
504 reg |= hdmi->variant->pll_ctrl_init_val; 510 reg |= hdmi->variant->pll_ctrl_init_val;
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
index fc447c9a1a27..f41fc506ff87 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
@@ -51,7 +51,6 @@ static int tinydrm_connector_get_modes(struct drm_connector *connector)
51 51
52static const struct drm_connector_helper_funcs tinydrm_connector_hfuncs = { 52static const struct drm_connector_helper_funcs tinydrm_connector_hfuncs = {
53 .get_modes = tinydrm_connector_get_modes, 53 .get_modes = tinydrm_connector_get_modes,
54 .best_encoder = drm_atomic_helper_best_encoder,
55}; 54};
56 55
57static enum drm_connector_status 56static enum drm_connector_status
diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 7fd26912f2ba..6a83b3093254 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -31,7 +31,7 @@ static int mi0283qt_init(struct mipi_dbi *mipi)
31 31
32 ret = regulator_enable(mipi->regulator); 32 ret = regulator_enable(mipi->regulator);
33 if (ret) { 33 if (ret) {
34 dev_err(dev, "Failed to enable regulator %d\n", ret); 34 DRM_DEV_ERROR(dev, "Failed to enable regulator %d\n", ret);
35 return ret; 35 return ret;
36 } 36 }
37 37
@@ -42,7 +42,7 @@ static int mi0283qt_init(struct mipi_dbi *mipi)
42 mipi_dbi_hw_reset(mipi); 42 mipi_dbi_hw_reset(mipi);
43 ret = mipi_dbi_command(mipi, MIPI_DCS_SOFT_RESET); 43 ret = mipi_dbi_command(mipi, MIPI_DCS_SOFT_RESET);
44 if (ret) { 44 if (ret) {
45 dev_err(dev, "Error sending command %d\n", ret); 45 DRM_DEV_ERROR(dev, "Error sending command %d\n", ret);
46 regulator_disable(mipi->regulator); 46 regulator_disable(mipi->regulator);
47 return ret; 47 return ret;
48 } 48 }
@@ -174,13 +174,13 @@ static int mi0283qt_probe(struct spi_device *spi)
174 174
175 mipi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); 175 mipi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
176 if (IS_ERR(mipi->reset)) { 176 if (IS_ERR(mipi->reset)) {
177 dev_err(dev, "Failed to get gpio 'reset'\n"); 177 DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
178 return PTR_ERR(mipi->reset); 178 return PTR_ERR(mipi->reset);
179 } 179 }
180 180
181 dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW); 181 dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW);
182 if (IS_ERR(dc)) { 182 if (IS_ERR(dc)) {
183 dev_err(dev, "Failed to get gpio 'dc'\n"); 183 DRM_DEV_ERROR(dev, "Failed to get gpio 'dc'\n");
184 return PTR_ERR(dc); 184 return PTR_ERR(dc);
185 } 185 }
186 186
diff --git a/drivers/gpu/drm/tinydrm/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c
index 340198f5afea..75740630c410 100644
--- a/drivers/gpu/drm/tinydrm/repaper.c
+++ b/drivers/gpu/drm/tinydrm/repaper.c
@@ -474,8 +474,7 @@ static void repaper_get_temperature(struct repaper_epd *epd)
474 474
475 ret = thermal_zone_get_temp(epd->thermal, &temperature); 475 ret = thermal_zone_get_temp(epd->thermal, &temperature);
476 if (ret) { 476 if (ret) {
477 dev_err(&epd->spi->dev, "Failed to get temperature (%d)\n", 477 DRM_DEV_ERROR(&epd->spi->dev, "Failed to get temperature (%d)\n", ret);
478 ret);
479 return; 478 return;
480 } 479 }
481 480
@@ -630,7 +629,7 @@ out_unlock:
630 mutex_unlock(&tdev->dirty_lock); 629 mutex_unlock(&tdev->dirty_lock);
631 630
632 if (ret) 631 if (ret)
633 dev_err(fb->dev->dev, "Failed to update display (%d)\n", ret); 632 DRM_DEV_ERROR(fb->dev->dev, "Failed to update display (%d)\n", ret);
634 kfree(buf); 633 kfree(buf);
635 634
636 return ret; 635 return ret;
@@ -704,7 +703,7 @@ static void repaper_pipe_enable(struct drm_simple_display_pipe *pipe,
704 } 703 }
705 704
706 if (!i) { 705 if (!i) {
707 dev_err(dev, "timeout waiting for panel to become ready.\n"); 706 DRM_DEV_ERROR(dev, "timeout waiting for panel to become ready.\n");
708 power_off(epd); 707 power_off(epd);
709 return; 708 return;
710 } 709 }
@@ -726,9 +725,9 @@ static void repaper_pipe_enable(struct drm_simple_display_pipe *pipe,
726 ret = repaper_read_val(spi, 0x0f); 725 ret = repaper_read_val(spi, 0x0f);
727 if (ret < 0 || !(ret & 0x80)) { 726 if (ret < 0 || !(ret & 0x80)) {
728 if (ret < 0) 727 if (ret < 0)
729 dev_err(dev, "failed to read chip (%d)\n", ret); 728 DRM_DEV_ERROR(dev, "failed to read chip (%d)\n", ret);
730 else 729 else
731 dev_err(dev, "panel is reported broken\n"); 730 DRM_DEV_ERROR(dev, "panel is reported broken\n");
732 power_off(epd); 731 power_off(epd);
733 return; 732 return;
734 } 733 }
@@ -768,7 +767,7 @@ static void repaper_pipe_enable(struct drm_simple_display_pipe *pipe,
768 /* check DC/DC */ 767 /* check DC/DC */
769 ret = repaper_read_val(spi, 0x0f); 768 ret = repaper_read_val(spi, 0x0f);
770 if (ret < 0) { 769 if (ret < 0) {
771 dev_err(dev, "failed to read chip (%d)\n", ret); 770 DRM_DEV_ERROR(dev, "failed to read chip (%d)\n", ret);
772 power_off(epd); 771 power_off(epd);
773 return; 772 return;
774 } 773 }
@@ -780,7 +779,7 @@ static void repaper_pipe_enable(struct drm_simple_display_pipe *pipe,
780 } 779 }
781 780
782 if (!dc_ok) { 781 if (!dc_ok) {
783 dev_err(dev, "dc/dc failed\n"); 782 DRM_DEV_ERROR(dev, "dc/dc failed\n");
784 power_off(epd); 783 power_off(epd);
785 return; 784 return;
786 } 785 }
@@ -960,7 +959,7 @@ static int repaper_probe(struct spi_device *spi)
960 if (IS_ERR(epd->panel_on)) { 959 if (IS_ERR(epd->panel_on)) {
961 ret = PTR_ERR(epd->panel_on); 960 ret = PTR_ERR(epd->panel_on);
962 if (ret != -EPROBE_DEFER) 961 if (ret != -EPROBE_DEFER)
963 dev_err(dev, "Failed to get gpio 'panel-on'\n"); 962 DRM_DEV_ERROR(dev, "Failed to get gpio 'panel-on'\n");
964 return ret; 963 return ret;
965 } 964 }
966 965
@@ -968,7 +967,7 @@ static int repaper_probe(struct spi_device *spi)
968 if (IS_ERR(epd->discharge)) { 967 if (IS_ERR(epd->discharge)) {
969 ret = PTR_ERR(epd->discharge); 968 ret = PTR_ERR(epd->discharge);
970 if (ret != -EPROBE_DEFER) 969 if (ret != -EPROBE_DEFER)
971 dev_err(dev, "Failed to get gpio 'discharge'\n"); 970 DRM_DEV_ERROR(dev, "Failed to get gpio 'discharge'\n");
972 return ret; 971 return ret;
973 } 972 }
974 973
@@ -976,7 +975,7 @@ static int repaper_probe(struct spi_device *spi)
976 if (IS_ERR(epd->reset)) { 975 if (IS_ERR(epd->reset)) {
977 ret = PTR_ERR(epd->reset); 976 ret = PTR_ERR(epd->reset);
978 if (ret != -EPROBE_DEFER) 977 if (ret != -EPROBE_DEFER)
979 dev_err(dev, "Failed to get gpio 'reset'\n"); 978 DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
980 return ret; 979 return ret;
981 } 980 }
982 981
@@ -984,7 +983,7 @@ static int repaper_probe(struct spi_device *spi)
984 if (IS_ERR(epd->busy)) { 983 if (IS_ERR(epd->busy)) {
985 ret = PTR_ERR(epd->busy); 984 ret = PTR_ERR(epd->busy);
986 if (ret != -EPROBE_DEFER) 985 if (ret != -EPROBE_DEFER)
987 dev_err(dev, "Failed to get gpio 'busy'\n"); 986 DRM_DEV_ERROR(dev, "Failed to get gpio 'busy'\n");
988 return ret; 987 return ret;
989 } 988 }
990 989
@@ -992,8 +991,7 @@ static int repaper_probe(struct spi_device *spi)
992 &thermal_zone)) { 991 &thermal_zone)) {
993 epd->thermal = thermal_zone_get_zone_by_name(thermal_zone); 992 epd->thermal = thermal_zone_get_zone_by_name(thermal_zone);
994 if (IS_ERR(epd->thermal)) { 993 if (IS_ERR(epd->thermal)) {
995 dev_err(dev, "Failed to get thermal zone: %s\n", 994 DRM_DEV_ERROR(dev, "Failed to get thermal zone: %s\n", thermal_zone);
996 thermal_zone);
997 return PTR_ERR(epd->thermal); 995 return PTR_ERR(epd->thermal);
998 } 996 }
999 } 997 }
@@ -1034,7 +1032,7 @@ static int repaper_probe(struct spi_device *spi)
1034 if (IS_ERR(epd->border)) { 1032 if (IS_ERR(epd->border)) {
1035 ret = PTR_ERR(epd->border); 1033 ret = PTR_ERR(epd->border);
1036 if (ret != -EPROBE_DEFER) 1034 if (ret != -EPROBE_DEFER)
1037 dev_err(dev, "Failed to get gpio 'border'\n"); 1035 DRM_DEV_ERROR(dev, "Failed to get gpio 'border'\n");
1038 return ret; 1036 return ret;
1039 } 1037 }
1040 1038
diff --git a/drivers/gpu/drm/tinydrm/st7586.c b/drivers/gpu/drm/tinydrm/st7586.c
index da9c0d83045f..0a2c60da5c0e 100644
--- a/drivers/gpu/drm/tinydrm/st7586.c
+++ b/drivers/gpu/drm/tinydrm/st7586.c
@@ -188,7 +188,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe,
188 mipi_dbi_hw_reset(mipi); 188 mipi_dbi_hw_reset(mipi);
189 ret = mipi_dbi_command(mipi, ST7586_AUTO_READ_CTRL, 0x9f); 189 ret = mipi_dbi_command(mipi, ST7586_AUTO_READ_CTRL, 0x9f);
190 if (ret) { 190 if (ret) {
191 dev_err(dev, "Error sending command %d\n", ret); 191 DRM_DEV_ERROR(dev, "Error sending command %d\n", ret);
192 return; 192 return;
193 } 193 }
194 194
@@ -355,13 +355,13 @@ static int st7586_probe(struct spi_device *spi)
355 355
356 mipi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); 356 mipi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
357 if (IS_ERR(mipi->reset)) { 357 if (IS_ERR(mipi->reset)) {
358 dev_err(dev, "Failed to get gpio 'reset'\n"); 358 DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
359 return PTR_ERR(mipi->reset); 359 return PTR_ERR(mipi->reset);
360 } 360 }
361 361
362 a0 = devm_gpiod_get(dev, "a0", GPIOD_OUT_LOW); 362 a0 = devm_gpiod_get(dev, "a0", GPIOD_OUT_LOW);
363 if (IS_ERR(a0)) { 363 if (IS_ERR(a0)) {
364 dev_err(dev, "Failed to get gpio 'a0'\n"); 364 DRM_DEV_ERROR(dev, "Failed to get gpio 'a0'\n");
365 return PTR_ERR(a0); 365 return PTR_ERR(a0);
366 } 366 }
367 367
diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 925c726ac694..554605af344e 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -859,11 +859,7 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
859 pll_clock = parent_rate / divider; 859 pll_clock = parent_rate / divider;
860 pixel_clock_hz = pll_clock / dsi->divider; 860 pixel_clock_hz = pll_clock / dsi->divider;
861 861
862 /* Round up the clk_set_rate() request slightly, since 862 adjusted_mode->clock = pixel_clock_hz / 1000;
863 * PLLD_DSI1 is an integer divider and its rate selection will
864 * never round up.
865 */
866 adjusted_mode->clock = pixel_clock_hz / 1000 + 1;
867 863
868 /* Given the new pixel clock, adjust HFP to keep vrefresh the same. */ 864 /* Given the new pixel clock, adjust HFP to keep vrefresh the same. */
869 adjusted_mode->htotal = adjusted_mode->clock * mode->htotal / 865 adjusted_mode->htotal = adjusted_mode->clock * mode->htotal /
@@ -901,7 +897,11 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
901 vc4_dsi_dump_regs(dsi); 897 vc4_dsi_dump_regs(dsi);
902 } 898 }
903 899
904 phy_clock = pixel_clock_hz * dsi->divider; 900 /* Round up the clk_set_rate() request slightly, since
901 * PLLD_DSI1 is an integer divider and its rate selection will
902 * never round up.
903 */
904 phy_clock = (pixel_clock_hz + 1000) * dsi->divider;
905 ret = clk_set_rate(dsi->pll_phy_clock, phy_clock); 905 ret = clk_set_rate(dsi->pll_phy_clock, phy_clock);
906 if (ret) { 906 if (ret) {
907 dev_err(&dsi->pdev->dev, 907 dev_err(&dsi->pdev->dev,
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 2968b3ebb895..3a767a038f72 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -547,14 +547,24 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
547 tiling = SCALER_CTL0_TILING_LINEAR; 547 tiling = SCALER_CTL0_TILING_LINEAR;
548 pitch0 = VC4_SET_FIELD(fb->pitches[0], SCALER_SRC_PITCH); 548 pitch0 = VC4_SET_FIELD(fb->pitches[0], SCALER_SRC_PITCH);
549 break; 549 break;
550 case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED: 550
551 case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED: {
552 /* For T-tiled, the FB pitch is "how many bytes from
553 * one row to the next, such that pitch * tile_h ==
554 * tile_size * tiles_per_row."
555 */
556 u32 tile_size_shift = 12; /* T tiles are 4kb */
557 u32 tile_h_shift = 5; /* 16 and 32bpp are 32 pixels high */
558 u32 tiles_w = fb->pitches[0] >> (tile_size_shift - tile_h_shift);
559
551 tiling = SCALER_CTL0_TILING_256B_OR_T; 560 tiling = SCALER_CTL0_TILING_256B_OR_T;
552 561
553 pitch0 = (VC4_SET_FIELD(0, SCALER_PITCH0_TILE_Y_OFFSET), 562 pitch0 = (VC4_SET_FIELD(0, SCALER_PITCH0_TILE_Y_OFFSET) |
554 VC4_SET_FIELD(0, SCALER_PITCH0_TILE_WIDTH_L), 563 VC4_SET_FIELD(0, SCALER_PITCH0_TILE_WIDTH_L) |
555 VC4_SET_FIELD((vc4_state->src_w[0] + 31) >> 5, 564 VC4_SET_FIELD(tiles_w, SCALER_PITCH0_TILE_WIDTH_R));
556 SCALER_PITCH0_TILE_WIDTH_R));
557 break; 565 break;
566 }
567
558 default: 568 default:
559 DRM_DEBUG_KMS("Unsupported FB tiling flag 0x%16llx", 569 DRM_DEBUG_KMS("Unsupported FB tiling flag 0x%16llx",
560 (long long)fb->modifier); 570 (long long)fb->modifier);
diff --git a/drivers/gpu/drm/via/via_verifier.c b/drivers/gpu/drm/via/via_verifier.c
index 0677bbf4ec7e..fb2609434df7 100644
--- a/drivers/gpu/drm/via/via_verifier.c
+++ b/drivers/gpu/drm/via/via_verifier.c
@@ -34,6 +34,7 @@
34#include <drm/drm_legacy.h> 34#include <drm/drm_legacy.h>
35#include "via_verifier.h" 35#include "via_verifier.h"
36#include "via_drv.h" 36#include "via_drv.h"
37#include <linux/kernel.h>
37 38
38typedef enum { 39typedef enum {
39 state_command, 40 state_command,
@@ -1102,10 +1103,7 @@ setup_hazard_table(hz_init_t init_table[], hazard_t table[], int size)
1102 1103
1103void via_init_command_verifier(void) 1104void via_init_command_verifier(void)
1104{ 1105{
1105 setup_hazard_table(init_table1, table1, 1106 setup_hazard_table(init_table1, table1, ARRAY_SIZE(init_table1));
1106 sizeof(init_table1) / sizeof(hz_init_t)); 1107 setup_hazard_table(init_table2, table2, ARRAY_SIZE(init_table2));
1107 setup_hazard_table(init_table2, table2, 1108 setup_hazard_table(init_table3, table3, ARRAY_SIZE(init_table3));
1108 sizeof(init_table2) / sizeof(hz_init_t));
1109 setup_hazard_table(init_table3, table3,
1110 sizeof(init_table3) / sizeof(hz_init_t));
1111} 1109}
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index 390966e4a308..d20ec4e0431d 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -2,6 +2,9 @@
2#define __DRM_OF_H__ 2#define __DRM_OF_H__
3 3
4#include <linux/of_graph.h> 4#include <linux/of_graph.h>
5#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE)
6#include <drm/drm_bridge.h>
7#endif
5 8
6struct component_master_ops; 9struct component_master_ops;
7struct component_match; 10struct component_match;
@@ -29,8 +32,6 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
29 int port, int endpoint, 32 int port, int endpoint,
30 struct drm_panel **panel, 33 struct drm_panel **panel,
31 struct drm_bridge **bridge); 34 struct drm_bridge **bridge);
32int drm_of_panel_bridge_remove(const struct device_node *np,
33 int port, int endpoint);
34#else 35#else
35static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, 36static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
36 struct device_node *port) 37 struct device_node *port)
@@ -67,13 +68,35 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
67{ 68{
68 return -EINVAL; 69 return -EINVAL;
69} 70}
71#endif
70 72
73/*
74 * drm_of_panel_bridge_remove - remove panel bridge
75 * @np: device tree node containing panel bridge output ports
76 *
77 * Remove the panel bridge of a given DT node's port and endpoint number
78 *
79 * Returns zero if successful, or one of the standard error codes if it fails.
80 */
71static inline int drm_of_panel_bridge_remove(const struct device_node *np, 81static inline int drm_of_panel_bridge_remove(const struct device_node *np,
72 int port, int endpoint) 82 int port, int endpoint)
73{ 83{
84#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE)
85 struct drm_bridge *bridge;
86 struct device_node *remote;
87
88 remote = of_graph_get_remote_node(np, port, endpoint);
89 if (!remote)
90 return -ENODEV;
91
92 bridge = of_drm_find_bridge(remote);
93 drm_panel_bridge_remove(bridge);
94
95 return 0;
96#else
74 return -EINVAL; 97 return -EINVAL;
75}
76#endif 98#endif
99}
77 100
78static inline int drm_of_encoder_active_endpoint_id(struct device_node *node, 101static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,
79 struct drm_encoder *encoder) 102 struct drm_encoder *encoder)