xref: /linux/drivers/gpu/drm/tegra/plane.c (revision c6aeaf56f468a565f6d2f27325fc07d35cdcd3cb)
1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
25acd3514SThierry Reding /*
35acd3514SThierry Reding  * Copyright (C) 2017 NVIDIA CORPORATION.  All rights reserved.
45acd3514SThierry Reding  */
55acd3514SThierry Reding 
6273da5a0SThierry Reding #include <linux/iommu.h>
704d5d5dfSDmitry Osipenko #include <linux/interconnect.h>
8273da5a0SThierry Reding 
95acd3514SThierry Reding #include <drm/drm_atomic.h>
105acd3514SThierry Reding #include <drm/drm_atomic_helper.h>
11eb1df694SSam Ravnborg #include <drm/drm_fourcc.h>
12820c1707SThomas Zimmermann #include <drm/drm_gem_atomic_helper.h>
135acd3514SThierry Reding #include <drm/drm_plane_helper.h>
145acd3514SThierry Reding 
155acd3514SThierry Reding #include "dc.h"
165acd3514SThierry Reding #include "plane.h"
175acd3514SThierry Reding 
185acd3514SThierry Reding static void tegra_plane_destroy(struct drm_plane *plane)
195acd3514SThierry Reding {
205acd3514SThierry Reding 	struct tegra_plane *p = to_tegra_plane(plane);
215acd3514SThierry Reding 
225acd3514SThierry Reding 	drm_plane_cleanup(plane);
235acd3514SThierry Reding 	kfree(p);
245acd3514SThierry Reding }
255acd3514SThierry Reding 
265acd3514SThierry Reding static void tegra_plane_reset(struct drm_plane *plane)
275acd3514SThierry Reding {
283dae08bcSDmitry Osipenko 	struct tegra_plane *p = to_tegra_plane(plane);
295acd3514SThierry Reding 	struct tegra_plane_state *state;
302e8d8749SThierry Reding 	unsigned int i;
315acd3514SThierry Reding 
325acd3514SThierry Reding 	if (plane->state)
335acd3514SThierry Reding 		__drm_atomic_helper_plane_destroy_state(plane->state);
345acd3514SThierry Reding 
355acd3514SThierry Reding 	kfree(plane->state);
365acd3514SThierry Reding 	plane->state = NULL;
375acd3514SThierry Reding 
385acd3514SThierry Reding 	state = kzalloc(sizeof(*state), GFP_KERNEL);
395acd3514SThierry Reding 	if (state) {
405acd3514SThierry Reding 		plane->state = &state->base;
415acd3514SThierry Reding 		plane->state->plane = plane;
423dae08bcSDmitry Osipenko 		plane->state->zpos = p->index;
433dae08bcSDmitry Osipenko 		plane->state->normalized_zpos = p->index;
442e8d8749SThierry Reding 
452e8d8749SThierry Reding 		for (i = 0; i < 3; i++)
462e8d8749SThierry Reding 			state->iova[i] = DMA_MAPPING_ERROR;
475acd3514SThierry Reding 	}
485acd3514SThierry Reding }
495acd3514SThierry Reding 
505acd3514SThierry Reding static struct drm_plane_state *
515acd3514SThierry Reding tegra_plane_atomic_duplicate_state(struct drm_plane *plane)
525acd3514SThierry Reding {
535acd3514SThierry Reding 	struct tegra_plane_state *state = to_tegra_plane_state(plane->state);
545acd3514SThierry Reding 	struct tegra_plane_state *copy;
55ebae8d07SThierry Reding 	unsigned int i;
565acd3514SThierry Reding 
575acd3514SThierry Reding 	copy = kmalloc(sizeof(*copy), GFP_KERNEL);
585acd3514SThierry Reding 	if (!copy)
595acd3514SThierry Reding 		return NULL;
605acd3514SThierry Reding 
615acd3514SThierry Reding 	__drm_atomic_helper_plane_duplicate_state(plane, &copy->base);
625acd3514SThierry Reding 	copy->tiling = state->tiling;
635acd3514SThierry Reding 	copy->format = state->format;
645acd3514SThierry Reding 	copy->swap = state->swap;
65cd740777SDmitry Osipenko 	copy->reflect_x = state->reflect_x;
66e9e476f7SDmitry Osipenko 	copy->reflect_y = state->reflect_y;
67ebae8d07SThierry Reding 	copy->opaque = state->opaque;
6804d5d5dfSDmitry Osipenko 	copy->total_peak_memory_bandwidth = state->total_peak_memory_bandwidth;
6904d5d5dfSDmitry Osipenko 	copy->peak_memory_bandwidth = state->peak_memory_bandwidth;
7004d5d5dfSDmitry Osipenko 	copy->avg_memory_bandwidth = state->avg_memory_bandwidth;
71ebae8d07SThierry Reding 
723dae08bcSDmitry Osipenko 	for (i = 0; i < 2; i++)
733dae08bcSDmitry Osipenko 		copy->blending[i] = state->blending[i];
745acd3514SThierry Reding 
752e8d8749SThierry Reding 	for (i = 0; i < 3; i++) {
762e8d8749SThierry Reding 		copy->iova[i] = DMA_MAPPING_ERROR;
77*c6aeaf56SThierry Reding 		copy->map[i] = NULL;
782e8d8749SThierry Reding 	}
792e8d8749SThierry Reding 
805acd3514SThierry Reding 	return &copy->base;
815acd3514SThierry Reding }
825acd3514SThierry Reding 
835acd3514SThierry Reding static void tegra_plane_atomic_destroy_state(struct drm_plane *plane,
845acd3514SThierry Reding 					     struct drm_plane_state *state)
855acd3514SThierry Reding {
865acd3514SThierry Reding 	__drm_atomic_helper_plane_destroy_state(state);
875acd3514SThierry Reding 	kfree(state);
885acd3514SThierry Reding }
895acd3514SThierry Reding 
907b6f8467SThierry Reding static bool tegra_plane_supports_sector_layout(struct drm_plane *plane)
917b6f8467SThierry Reding {
927b6f8467SThierry Reding 	struct drm_crtc *crtc;
937b6f8467SThierry Reding 
947b6f8467SThierry Reding 	drm_for_each_crtc(crtc, plane->dev) {
957b6f8467SThierry Reding 		if (plane->possible_crtcs & drm_crtc_mask(crtc)) {
967b6f8467SThierry Reding 			struct tegra_dc *dc = to_tegra_dc(crtc);
977b6f8467SThierry Reding 
987b6f8467SThierry Reding 			if (!dc->soc->supports_sector_layout)
997b6f8467SThierry Reding 				return false;
1007b6f8467SThierry Reding 		}
1017b6f8467SThierry Reding 	}
1027b6f8467SThierry Reding 
1037b6f8467SThierry Reding 	return true;
1047b6f8467SThierry Reding }
1057b6f8467SThierry Reding 
106e90124cbSThierry Reding static bool tegra_plane_format_mod_supported(struct drm_plane *plane,
107e90124cbSThierry Reding 					     uint32_t format,
108e90124cbSThierry Reding 					     uint64_t modifier)
109e90124cbSThierry Reding {
110e90124cbSThierry Reding 	const struct drm_format_info *info = drm_format_info(format);
111e90124cbSThierry Reding 
112e90124cbSThierry Reding 	if (modifier == DRM_FORMAT_MOD_LINEAR)
113e90124cbSThierry Reding 		return true;
114e90124cbSThierry Reding 
1157b6f8467SThierry Reding 	/* check for the sector layout bit */
116c1d3cfbcSThierry Reding 	if (fourcc_mod_is_vendor(modifier, NVIDIA)) {
1177b6f8467SThierry Reding 		if (modifier & DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT) {
1187b6f8467SThierry Reding 			if (!tegra_plane_supports_sector_layout(plane))
1197b6f8467SThierry Reding 				return false;
1207b6f8467SThierry Reding 		}
1217b6f8467SThierry Reding 	}
1227b6f8467SThierry Reding 
123e90124cbSThierry Reding 	if (info->num_planes == 1)
124e90124cbSThierry Reding 		return true;
125e90124cbSThierry Reding 
126e90124cbSThierry Reding 	return false;
127e90124cbSThierry Reding }
128e90124cbSThierry Reding 
1295acd3514SThierry Reding const struct drm_plane_funcs tegra_plane_funcs = {
1305acd3514SThierry Reding 	.update_plane = drm_atomic_helper_update_plane,
1315acd3514SThierry Reding 	.disable_plane = drm_atomic_helper_disable_plane,
1325acd3514SThierry Reding 	.destroy = tegra_plane_destroy,
1335acd3514SThierry Reding 	.reset = tegra_plane_reset,
1345acd3514SThierry Reding 	.atomic_duplicate_state = tegra_plane_atomic_duplicate_state,
1355acd3514SThierry Reding 	.atomic_destroy_state = tegra_plane_atomic_destroy_state,
136e90124cbSThierry Reding 	.format_mod_supported = tegra_plane_format_mod_supported,
1375acd3514SThierry Reding };
1385acd3514SThierry Reding 
1392e8d8749SThierry Reding static int tegra_dc_pin(struct tegra_dc *dc, struct tegra_plane_state *state)
1402e8d8749SThierry Reding {
1412e8d8749SThierry Reding 	unsigned int i;
1422e8d8749SThierry Reding 	int err;
1432e8d8749SThierry Reding 
1442e8d8749SThierry Reding 	for (i = 0; i < state->base.fb->format->num_planes; i++) {
1452e8d8749SThierry Reding 		struct tegra_bo *bo = tegra_fb_get_plane(state->base.fb, i);
146*c6aeaf56SThierry Reding 		struct host1x_bo_mapping *map;
1472e8d8749SThierry Reding 
148*c6aeaf56SThierry Reding 		map = host1x_bo_pin(dc->dev, &bo->base, DMA_TO_DEVICE);
149*c6aeaf56SThierry Reding 		if (IS_ERR(map)) {
150*c6aeaf56SThierry Reding 			err = PTR_ERR(map);
1512e8d8749SThierry Reding 			goto unpin;
1522e8d8749SThierry Reding 		}
1532e8d8749SThierry Reding 
154*c6aeaf56SThierry Reding 		if (!dc->client.group) {
15549f82191SThierry Reding 			/*
15649f82191SThierry Reding 			 * The display controller needs contiguous memory, so
15749f82191SThierry Reding 			 * fail if the buffer is discontiguous and we fail to
15849f82191SThierry Reding 			 * map its SG table to a single contiguous chunk of
15949f82191SThierry Reding 			 * I/O virtual memory.
16049f82191SThierry Reding 			 */
161*c6aeaf56SThierry Reding 			if (map->chunks > 1) {
16249f82191SThierry Reding 				err = -EINVAL;
16349f82191SThierry Reding 				goto unpin;
16449f82191SThierry Reding 			}
16549f82191SThierry Reding 
166*c6aeaf56SThierry Reding 			state->iova[i] = map->phys;
1672e8d8749SThierry Reding 		} else {
168*c6aeaf56SThierry Reding 			state->iova[i] = bo->iova;
1692e8d8749SThierry Reding 		}
170*c6aeaf56SThierry Reding 
171*c6aeaf56SThierry Reding 		state->map[i] = map;
1722e8d8749SThierry Reding 	}
1732e8d8749SThierry Reding 
1742e8d8749SThierry Reding 	return 0;
1752e8d8749SThierry Reding 
1762e8d8749SThierry Reding unpin:
1772e8d8749SThierry Reding 	dev_err(dc->dev, "failed to map plane %u: %d\n", i, err);
1782e8d8749SThierry Reding 
1792e8d8749SThierry Reding 	while (i--) {
180*c6aeaf56SThierry Reding 		host1x_bo_unpin(state->map[i]);
1812e8d8749SThierry Reding 		state->iova[i] = DMA_MAPPING_ERROR;
182*c6aeaf56SThierry Reding 		state->map[i] = NULL;
1832e8d8749SThierry Reding 	}
1842e8d8749SThierry Reding 
1852e8d8749SThierry Reding 	return err;
1862e8d8749SThierry Reding }
1872e8d8749SThierry Reding 
1882e8d8749SThierry Reding static void tegra_dc_unpin(struct tegra_dc *dc, struct tegra_plane_state *state)
1892e8d8749SThierry Reding {
1902e8d8749SThierry Reding 	unsigned int i;
1912e8d8749SThierry Reding 
1922e8d8749SThierry Reding 	for (i = 0; i < state->base.fb->format->num_planes; i++) {
193*c6aeaf56SThierry Reding 		host1x_bo_unpin(state->map[i]);
1942e8d8749SThierry Reding 		state->iova[i] = DMA_MAPPING_ERROR;
195*c6aeaf56SThierry Reding 		state->map[i] = NULL;
1962e8d8749SThierry Reding 	}
1972e8d8749SThierry Reding }
1982e8d8749SThierry Reding 
1992e8d8749SThierry Reding int tegra_plane_prepare_fb(struct drm_plane *plane,
2002e8d8749SThierry Reding 			   struct drm_plane_state *state)
2012e8d8749SThierry Reding {
2022e8d8749SThierry Reding 	struct tegra_dc *dc = to_tegra_dc(state->crtc);
2032e8d8749SThierry Reding 
2042e8d8749SThierry Reding 	if (!state->fb)
2052e8d8749SThierry Reding 		return 0;
2062e8d8749SThierry Reding 
207820c1707SThomas Zimmermann 	drm_gem_plane_helper_prepare_fb(plane, state);
2082e8d8749SThierry Reding 
2092e8d8749SThierry Reding 	return tegra_dc_pin(dc, to_tegra_plane_state(state));
2102e8d8749SThierry Reding }
2112e8d8749SThierry Reding 
2122e8d8749SThierry Reding void tegra_plane_cleanup_fb(struct drm_plane *plane,
2132e8d8749SThierry Reding 			    struct drm_plane_state *state)
2142e8d8749SThierry Reding {
2152e8d8749SThierry Reding 	struct tegra_dc *dc = to_tegra_dc(state->crtc);
2162e8d8749SThierry Reding 
2172e8d8749SThierry Reding 	if (dc)
2182e8d8749SThierry Reding 		tegra_dc_unpin(dc, to_tegra_plane_state(state));
2192e8d8749SThierry Reding }
2202e8d8749SThierry Reding 
22104d5d5dfSDmitry Osipenko static int tegra_plane_calculate_memory_bandwidth(struct drm_plane_state *state)
22204d5d5dfSDmitry Osipenko {
22304d5d5dfSDmitry Osipenko 	struct tegra_plane_state *tegra_state = to_tegra_plane_state(state);
22404d5d5dfSDmitry Osipenko 	unsigned int i, bpp, dst_w, dst_h, src_w, src_h, mul;
22504d5d5dfSDmitry Osipenko 	const struct tegra_dc_soc_info *soc;
22604d5d5dfSDmitry Osipenko 	const struct drm_format_info *fmt;
22704d5d5dfSDmitry Osipenko 	struct drm_crtc_state *crtc_state;
22804d5d5dfSDmitry Osipenko 	u64 avg_bandwidth, peak_bandwidth;
22904d5d5dfSDmitry Osipenko 
23004d5d5dfSDmitry Osipenko 	if (!state->visible)
23104d5d5dfSDmitry Osipenko 		return 0;
23204d5d5dfSDmitry Osipenko 
23304d5d5dfSDmitry Osipenko 	crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
23404d5d5dfSDmitry Osipenko 	if (!crtc_state)
23504d5d5dfSDmitry Osipenko 		return -EINVAL;
23604d5d5dfSDmitry Osipenko 
23704d5d5dfSDmitry Osipenko 	src_w = drm_rect_width(&state->src) >> 16;
23804d5d5dfSDmitry Osipenko 	src_h = drm_rect_height(&state->src) >> 16;
23904d5d5dfSDmitry Osipenko 	dst_w = drm_rect_width(&state->dst);
24004d5d5dfSDmitry Osipenko 	dst_h = drm_rect_height(&state->dst);
24104d5d5dfSDmitry Osipenko 
24204d5d5dfSDmitry Osipenko 	fmt = state->fb->format;
24304d5d5dfSDmitry Osipenko 	soc = to_tegra_dc(state->crtc)->soc;
24404d5d5dfSDmitry Osipenko 
24504d5d5dfSDmitry Osipenko 	/*
24604d5d5dfSDmitry Osipenko 	 * Note that real memory bandwidth vary depending on format and
24704d5d5dfSDmitry Osipenko 	 * memory layout, we are not taking that into account because small
24804d5d5dfSDmitry Osipenko 	 * estimation error isn't important since bandwidth is rounded up
24904d5d5dfSDmitry Osipenko 	 * anyway.
25004d5d5dfSDmitry Osipenko 	 */
25104d5d5dfSDmitry Osipenko 	for (i = 0, bpp = 0; i < fmt->num_planes; i++) {
25204d5d5dfSDmitry Osipenko 		unsigned int bpp_plane = fmt->cpp[i] * 8;
25304d5d5dfSDmitry Osipenko 
25404d5d5dfSDmitry Osipenko 		/*
25504d5d5dfSDmitry Osipenko 		 * Sub-sampling is relevant for chroma planes only and vertical
25604d5d5dfSDmitry Osipenko 		 * readouts are not cached, hence only horizontal sub-sampling
25704d5d5dfSDmitry Osipenko 		 * matters.
25804d5d5dfSDmitry Osipenko 		 */
25904d5d5dfSDmitry Osipenko 		if (i > 0)
26004d5d5dfSDmitry Osipenko 			bpp_plane /= fmt->hsub;
26104d5d5dfSDmitry Osipenko 
26204d5d5dfSDmitry Osipenko 		bpp += bpp_plane;
26304d5d5dfSDmitry Osipenko 	}
26404d5d5dfSDmitry Osipenko 
26504d5d5dfSDmitry Osipenko 	/* average bandwidth in kbytes/sec */
26604d5d5dfSDmitry Osipenko 	avg_bandwidth  = min(src_w, dst_w) * min(src_h, dst_h);
26704d5d5dfSDmitry Osipenko 	avg_bandwidth *= drm_mode_vrefresh(&crtc_state->adjusted_mode);
26804d5d5dfSDmitry Osipenko 	avg_bandwidth  = DIV_ROUND_UP(avg_bandwidth * bpp, 8) + 999;
26904d5d5dfSDmitry Osipenko 	do_div(avg_bandwidth, 1000);
27004d5d5dfSDmitry Osipenko 
27104d5d5dfSDmitry Osipenko 	/* mode.clock in kHz, peak bandwidth in kbytes/sec */
27204d5d5dfSDmitry Osipenko 	peak_bandwidth = DIV_ROUND_UP(crtc_state->adjusted_mode.clock * bpp, 8);
27304d5d5dfSDmitry Osipenko 
27404d5d5dfSDmitry Osipenko 	/*
27504d5d5dfSDmitry Osipenko 	 * Tegra30/114 Memory Controller can't interleave DC memory requests
27604d5d5dfSDmitry Osipenko 	 * for the tiled windows because DC uses 16-bytes atom, while DDR3
27704d5d5dfSDmitry Osipenko 	 * uses 32-bytes atom.  Hence there is x2 memory overfetch for tiled
27804d5d5dfSDmitry Osipenko 	 * framebuffer and DDR3 on these SoCs.
27904d5d5dfSDmitry Osipenko 	 */
28004d5d5dfSDmitry Osipenko 	if (soc->plane_tiled_memory_bandwidth_x2 &&
28104d5d5dfSDmitry Osipenko 	    tegra_state->tiling.mode == TEGRA_BO_TILING_MODE_TILED)
28204d5d5dfSDmitry Osipenko 		mul = 2;
28304d5d5dfSDmitry Osipenko 	else
28404d5d5dfSDmitry Osipenko 		mul = 1;
28504d5d5dfSDmitry Osipenko 
28604d5d5dfSDmitry Osipenko 	/* ICC bandwidth in kbytes/sec */
28704d5d5dfSDmitry Osipenko 	tegra_state->peak_memory_bandwidth = kBps_to_icc(peak_bandwidth) * mul;
28804d5d5dfSDmitry Osipenko 	tegra_state->avg_memory_bandwidth  = kBps_to_icc(avg_bandwidth)  * mul;
28904d5d5dfSDmitry Osipenko 
29004d5d5dfSDmitry Osipenko 	return 0;
29104d5d5dfSDmitry Osipenko }
29204d5d5dfSDmitry Osipenko 
2935acd3514SThierry Reding int tegra_plane_state_add(struct tegra_plane *plane,
2945acd3514SThierry Reding 			  struct drm_plane_state *state)
2955acd3514SThierry Reding {
2965acd3514SThierry Reding 	struct drm_crtc_state *crtc_state;
2975acd3514SThierry Reding 	struct tegra_dc_state *tegra;
2985acd3514SThierry Reding 	int err;
2995acd3514SThierry Reding 
3005acd3514SThierry Reding 	/* Propagate errors from allocation or locking failures. */
3015acd3514SThierry Reding 	crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
3025acd3514SThierry Reding 	if (IS_ERR(crtc_state))
3035acd3514SThierry Reding 		return PTR_ERR(crtc_state);
3045acd3514SThierry Reding 
3055acd3514SThierry Reding 	/* Check plane state for visibility and calculate clipping bounds */
30681af63a4SVille Syrjälä 	err = drm_atomic_helper_check_plane_state(state, crtc_state,
3075acd3514SThierry Reding 						  0, INT_MAX, true, true);
3085acd3514SThierry Reding 	if (err < 0)
3095acd3514SThierry Reding 		return err;
3105acd3514SThierry Reding 
31104d5d5dfSDmitry Osipenko 	err = tegra_plane_calculate_memory_bandwidth(state);
31204d5d5dfSDmitry Osipenko 	if (err < 0)
31304d5d5dfSDmitry Osipenko 		return err;
31404d5d5dfSDmitry Osipenko 
3155acd3514SThierry Reding 	tegra = to_dc_state(crtc_state);
3165acd3514SThierry Reding 
3175acd3514SThierry Reding 	tegra->planes |= WIN_A_ACT_REQ << plane->index;
3185acd3514SThierry Reding 
3195acd3514SThierry Reding 	return 0;
3205acd3514SThierry Reding }
3215acd3514SThierry Reding 
3225acd3514SThierry Reding int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap)
3235acd3514SThierry Reding {
3245acd3514SThierry Reding 	/* assume no swapping of fetched data */
3255acd3514SThierry Reding 	if (swap)
3265acd3514SThierry Reding 		*swap = BYTE_SWAP_NOSWAP;
3275acd3514SThierry Reding 
3285acd3514SThierry Reding 	switch (fourcc) {
329511c7023SThierry Reding 	case DRM_FORMAT_ARGB4444:
330511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B4G4R4A4;
3317772fdaeSThierry Reding 		break;
3327772fdaeSThierry Reding 
333511c7023SThierry Reding 	case DRM_FORMAT_ARGB1555:
334511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B5G5R5A1;
3355acd3514SThierry Reding 		break;
3365acd3514SThierry Reding 
337511c7023SThierry Reding 	case DRM_FORMAT_RGB565:
338511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B5G6R5;
339511c7023SThierry Reding 		break;
340511c7023SThierry Reding 
341511c7023SThierry Reding 	case DRM_FORMAT_RGBA5551:
342511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_A1B5G5R5;
3437772fdaeSThierry Reding 		break;
3447772fdaeSThierry Reding 
3457772fdaeSThierry Reding 	case DRM_FORMAT_ARGB8888:
3465acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_B8G8R8A8;
3475acd3514SThierry Reding 		break;
3485acd3514SThierry Reding 
349511c7023SThierry Reding 	case DRM_FORMAT_ABGR8888:
350511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R8G8B8A8;
351511c7023SThierry Reding 		break;
352511c7023SThierry Reding 
353511c7023SThierry Reding 	case DRM_FORMAT_ABGR4444:
354511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R4G4B4A4;
355511c7023SThierry Reding 		break;
356511c7023SThierry Reding 
357511c7023SThierry Reding 	case DRM_FORMAT_ABGR1555:
358511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R5G5B5A;
359511c7023SThierry Reding 		break;
360511c7023SThierry Reding 
361511c7023SThierry Reding 	case DRM_FORMAT_BGRA5551:
362511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_AR5G5B5;
363511c7023SThierry Reding 		break;
364511c7023SThierry Reding 
365511c7023SThierry Reding 	case DRM_FORMAT_XRGB1555:
366511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B5G5R5X1;
367511c7023SThierry Reding 		break;
368511c7023SThierry Reding 
369511c7023SThierry Reding 	case DRM_FORMAT_RGBX5551:
370511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_X1B5G5R5;
371511c7023SThierry Reding 		break;
372511c7023SThierry Reding 
373511c7023SThierry Reding 	case DRM_FORMAT_XBGR1555:
374511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R5G5B5X1;
375511c7023SThierry Reding 		break;
376511c7023SThierry Reding 
377511c7023SThierry Reding 	case DRM_FORMAT_BGRX5551:
378511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_X1R5G5B5;
379511c7023SThierry Reding 		break;
380511c7023SThierry Reding 
381511c7023SThierry Reding 	case DRM_FORMAT_BGR565:
382511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R5G6B5;
383511c7023SThierry Reding 		break;
384511c7023SThierry Reding 
385511c7023SThierry Reding 	case DRM_FORMAT_BGRA8888:
386511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_A8R8G8B8;
387511c7023SThierry Reding 		break;
388511c7023SThierry Reding 
389511c7023SThierry Reding 	case DRM_FORMAT_RGBA8888:
390511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_A8B8G8R8;
391511c7023SThierry Reding 		break;
392511c7023SThierry Reding 
393511c7023SThierry Reding 	case DRM_FORMAT_XRGB8888:
394511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_B8G8R8X8;
395511c7023SThierry Reding 		break;
396511c7023SThierry Reding 
397511c7023SThierry Reding 	case DRM_FORMAT_XBGR8888:
398511c7023SThierry Reding 		*format = WIN_COLOR_DEPTH_R8G8B8X8;
3995acd3514SThierry Reding 		break;
4005acd3514SThierry Reding 
4015acd3514SThierry Reding 	case DRM_FORMAT_UYVY:
4025acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr422;
4035acd3514SThierry Reding 		break;
4045acd3514SThierry Reding 
4055acd3514SThierry Reding 	case DRM_FORMAT_YUYV:
4065acd3514SThierry Reding 		if (!swap)
4075acd3514SThierry Reding 			return -EINVAL;
4085acd3514SThierry Reding 
4095acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr422;
4105acd3514SThierry Reding 		*swap = BYTE_SWAP_SWAP2;
4115acd3514SThierry Reding 		break;
4125acd3514SThierry Reding 
4135acd3514SThierry Reding 	case DRM_FORMAT_YUV420:
4145acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr420P;
4155acd3514SThierry Reding 		break;
4165acd3514SThierry Reding 
4175acd3514SThierry Reding 	case DRM_FORMAT_YUV422:
4185acd3514SThierry Reding 		*format = WIN_COLOR_DEPTH_YCbCr422P;
4195acd3514SThierry Reding 		break;
4205acd3514SThierry Reding 
4215acd3514SThierry Reding 	default:
4225acd3514SThierry Reding 		return -EINVAL;
4235acd3514SThierry Reding 	}
4245acd3514SThierry Reding 
4255acd3514SThierry Reding 	return 0;
4265acd3514SThierry Reding }
4275acd3514SThierry Reding 
428e16efff4SThierry Reding bool tegra_plane_format_is_indexed(unsigned int format)
429e16efff4SThierry Reding {
430e16efff4SThierry Reding 	switch (format) {
431e16efff4SThierry Reding 	case WIN_COLOR_DEPTH_P1:
432e16efff4SThierry Reding 	case WIN_COLOR_DEPTH_P2:
433e16efff4SThierry Reding 	case WIN_COLOR_DEPTH_P4:
434e16efff4SThierry Reding 	case WIN_COLOR_DEPTH_P8:
435e16efff4SThierry Reding 		return true;
436e16efff4SThierry Reding 	}
437e16efff4SThierry Reding 
438e16efff4SThierry Reding 	return false;
439e16efff4SThierry Reding }
440e16efff4SThierry Reding 
441e16efff4SThierry Reding bool tegra_plane_format_is_yuv(unsigned int format, bool *planar, unsigned int *bpc)
4425acd3514SThierry Reding {
4435acd3514SThierry Reding 	switch (format) {
4445acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422:
4455acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422:
4465acd3514SThierry Reding 		if (planar)
4475acd3514SThierry Reding 			*planar = false;
4485acd3514SThierry Reding 
449e16efff4SThierry Reding 		if (bpc)
450e16efff4SThierry Reding 			*bpc = 8;
451e16efff4SThierry Reding 
4525acd3514SThierry Reding 		return true;
4535acd3514SThierry Reding 
4545acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr420P:
4555acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV420P:
4565acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422P:
4575acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422P:
4585acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422R:
4595acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422R:
4605acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YCbCr422RA:
4615acd3514SThierry Reding 	case WIN_COLOR_DEPTH_YUV422RA:
4625acd3514SThierry Reding 		if (planar)
4635acd3514SThierry Reding 			*planar = true;
4645acd3514SThierry Reding 
465e16efff4SThierry Reding 		if (bpc)
466e16efff4SThierry Reding 			*bpc = 8;
467e16efff4SThierry Reding 
4685acd3514SThierry Reding 		return true;
4695acd3514SThierry Reding 	}
4705acd3514SThierry Reding 
4715acd3514SThierry Reding 	if (planar)
4725acd3514SThierry Reding 		*planar = false;
4735acd3514SThierry Reding 
4745acd3514SThierry Reding 	return false;
4755acd3514SThierry Reding }
476ebae8d07SThierry Reding 
477ebae8d07SThierry Reding static bool __drm_format_has_alpha(u32 format)
478ebae8d07SThierry Reding {
479ebae8d07SThierry Reding 	switch (format) {
480ebae8d07SThierry Reding 	case DRM_FORMAT_ARGB1555:
481ebae8d07SThierry Reding 	case DRM_FORMAT_RGBA5551:
482ebae8d07SThierry Reding 	case DRM_FORMAT_ABGR8888:
483ebae8d07SThierry Reding 	case DRM_FORMAT_ARGB8888:
484ebae8d07SThierry Reding 		return true;
485ebae8d07SThierry Reding 	}
486ebae8d07SThierry Reding 
487ebae8d07SThierry Reding 	return false;
488ebae8d07SThierry Reding }
489ebae8d07SThierry Reding 
4903dae08bcSDmitry Osipenko static int tegra_plane_format_get_alpha(unsigned int opaque,
4913dae08bcSDmitry Osipenko 					unsigned int *alpha)
492ebae8d07SThierry Reding {
493e16efff4SThierry Reding 	if (tegra_plane_format_is_yuv(opaque, NULL, NULL)) {
4945467a8b8SThierry Reding 		*alpha = opaque;
4955467a8b8SThierry Reding 		return 0;
4965467a8b8SThierry Reding 	}
4975467a8b8SThierry Reding 
498ebae8d07SThierry Reding 	switch (opaque) {
499ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_B5G5R5X1:
500ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_B5G5R5A1;
501ebae8d07SThierry Reding 		return 0;
502ebae8d07SThierry Reding 
503ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_X1B5G5R5:
504ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_A1B5G5R5;
505ebae8d07SThierry Reding 		return 0;
506ebae8d07SThierry Reding 
507ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_R8G8B8X8:
508ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_R8G8B8A8;
509ebae8d07SThierry Reding 		return 0;
510ebae8d07SThierry Reding 
511ebae8d07SThierry Reding 	case WIN_COLOR_DEPTH_B8G8R8X8:
512ebae8d07SThierry Reding 		*alpha = WIN_COLOR_DEPTH_B8G8R8A8;
513ebae8d07SThierry Reding 		return 0;
5148a927d64SThierry Reding 
5158a927d64SThierry Reding 	case WIN_COLOR_DEPTH_B5G6R5:
5168a927d64SThierry Reding 		*alpha = opaque;
5178a927d64SThierry Reding 		return 0;
518ebae8d07SThierry Reding 	}
519ebae8d07SThierry Reding 
520ebae8d07SThierry Reding 	return -EINVAL;
521ebae8d07SThierry Reding }
522ebae8d07SThierry Reding 
5233dae08bcSDmitry Osipenko /*
5243dae08bcSDmitry Osipenko  * This is applicable to Tegra20 and Tegra30 only where the opaque formats can
5253dae08bcSDmitry Osipenko  * be emulated using the alpha formats and alpha blending disabled.
5263dae08bcSDmitry Osipenko  */
5273dae08bcSDmitry Osipenko static int tegra_plane_setup_opacity(struct tegra_plane *tegra,
5283dae08bcSDmitry Osipenko 				     struct tegra_plane_state *state)
5293dae08bcSDmitry Osipenko {
5303dae08bcSDmitry Osipenko 	unsigned int format;
5313dae08bcSDmitry Osipenko 	int err;
5323dae08bcSDmitry Osipenko 
5333dae08bcSDmitry Osipenko 	switch (state->format) {
5343dae08bcSDmitry Osipenko 	case WIN_COLOR_DEPTH_B5G5R5A1:
5353dae08bcSDmitry Osipenko 	case WIN_COLOR_DEPTH_A1B5G5R5:
5363dae08bcSDmitry Osipenko 	case WIN_COLOR_DEPTH_R8G8B8A8:
5373dae08bcSDmitry Osipenko 	case WIN_COLOR_DEPTH_B8G8R8A8:
5383dae08bcSDmitry Osipenko 		state->opaque = false;
5393dae08bcSDmitry Osipenko 		break;
5403dae08bcSDmitry Osipenko 
5413dae08bcSDmitry Osipenko 	default:
5423dae08bcSDmitry Osipenko 		err = tegra_plane_format_get_alpha(state->format, &format);
5433dae08bcSDmitry Osipenko 		if (err < 0)
5443dae08bcSDmitry Osipenko 			return err;
5453dae08bcSDmitry Osipenko 
5463dae08bcSDmitry Osipenko 		state->format = format;
5473dae08bcSDmitry Osipenko 		state->opaque = true;
5483dae08bcSDmitry Osipenko 		break;
5493dae08bcSDmitry Osipenko 	}
5503dae08bcSDmitry Osipenko 
5513dae08bcSDmitry Osipenko 	return 0;
5523dae08bcSDmitry Osipenko }
5533dae08bcSDmitry Osipenko 
5543dae08bcSDmitry Osipenko static int tegra_plane_check_transparency(struct tegra_plane *tegra,
5553dae08bcSDmitry Osipenko 					  struct tegra_plane_state *state)
5563dae08bcSDmitry Osipenko {
5573dae08bcSDmitry Osipenko 	struct drm_plane_state *old, *plane_state;
5583dae08bcSDmitry Osipenko 	struct drm_plane *plane;
5593dae08bcSDmitry Osipenko 
5603dae08bcSDmitry Osipenko 	old = drm_atomic_get_old_plane_state(state->base.state, &tegra->base);
5613dae08bcSDmitry Osipenko 
5623dae08bcSDmitry Osipenko 	/* check if zpos / transparency changed */
5633dae08bcSDmitry Osipenko 	if (old->normalized_zpos == state->base.normalized_zpos &&
5643dae08bcSDmitry Osipenko 	    to_tegra_plane_state(old)->opaque == state->opaque)
5653dae08bcSDmitry Osipenko 		return 0;
5663dae08bcSDmitry Osipenko 
5673dae08bcSDmitry Osipenko 	/* include all sibling planes into this commit */
5683dae08bcSDmitry Osipenko 	drm_for_each_plane(plane, tegra->base.dev) {
5693dae08bcSDmitry Osipenko 		struct tegra_plane *p = to_tegra_plane(plane);
5703dae08bcSDmitry Osipenko 
5713dae08bcSDmitry Osipenko 		/* skip this plane and planes on different CRTCs */
5723dae08bcSDmitry Osipenko 		if (p == tegra || p->dc != tegra->dc)
5733dae08bcSDmitry Osipenko 			continue;
5743dae08bcSDmitry Osipenko 
5753dae08bcSDmitry Osipenko 		plane_state = drm_atomic_get_plane_state(state->base.state,
5763dae08bcSDmitry Osipenko 							 plane);
5773dae08bcSDmitry Osipenko 		if (IS_ERR(plane_state))
5783dae08bcSDmitry Osipenko 			return PTR_ERR(plane_state);
5793dae08bcSDmitry Osipenko 	}
5803dae08bcSDmitry Osipenko 
5813dae08bcSDmitry Osipenko 	return 1;
5823dae08bcSDmitry Osipenko }
5833dae08bcSDmitry Osipenko 
5845e2e86f1SDmitry Osipenko static unsigned int tegra_plane_get_overlap_index(struct tegra_plane *plane,
585ebae8d07SThierry Reding 						  struct tegra_plane *other)
586ebae8d07SThierry Reding {
587ebae8d07SThierry Reding 	unsigned int index = 0, i;
588ebae8d07SThierry Reding 
589ebae8d07SThierry Reding 	WARN_ON(plane == other);
590ebae8d07SThierry Reding 
591ebae8d07SThierry Reding 	for (i = 0; i < 3; i++) {
592ebae8d07SThierry Reding 		if (i == plane->index)
593ebae8d07SThierry Reding 			continue;
594ebae8d07SThierry Reding 
595ebae8d07SThierry Reding 		if (i == other->index)
596ebae8d07SThierry Reding 			break;
597ebae8d07SThierry Reding 
598ebae8d07SThierry Reding 		index++;
599ebae8d07SThierry Reding 	}
600ebae8d07SThierry Reding 
601ebae8d07SThierry Reding 	return index;
602ebae8d07SThierry Reding }
603ebae8d07SThierry Reding 
6043dae08bcSDmitry Osipenko static void tegra_plane_update_transparency(struct tegra_plane *tegra,
605ebae8d07SThierry Reding 					    struct tegra_plane_state *state)
606ebae8d07SThierry Reding {
6073dae08bcSDmitry Osipenko 	struct drm_plane_state *new;
608ebae8d07SThierry Reding 	struct drm_plane *plane;
609ebae8d07SThierry Reding 	unsigned int i;
610ebae8d07SThierry Reding 
6113dae08bcSDmitry Osipenko 	for_each_new_plane_in_state(state->base.state, plane, new, i) {
612ebae8d07SThierry Reding 		struct tegra_plane *p = to_tegra_plane(plane);
613ebae8d07SThierry Reding 		unsigned index;
614ebae8d07SThierry Reding 
615ebae8d07SThierry Reding 		/* skip this plane and planes on different CRTCs */
6163dae08bcSDmitry Osipenko 		if (p == tegra || p->dc != tegra->dc)
617ebae8d07SThierry Reding 			continue;
618ebae8d07SThierry Reding 
619ebae8d07SThierry Reding 		index = tegra_plane_get_overlap_index(tegra, p);
620ebae8d07SThierry Reding 
6213dae08bcSDmitry Osipenko 		if (new->fb && __drm_format_has_alpha(new->fb->format->format))
6223dae08bcSDmitry Osipenko 			state->blending[index].alpha = true;
6233dae08bcSDmitry Osipenko 		else
6243dae08bcSDmitry Osipenko 			state->blending[index].alpha = false;
6253dae08bcSDmitry Osipenko 
6263dae08bcSDmitry Osipenko 		if (new->normalized_zpos > state->base.normalized_zpos)
6273dae08bcSDmitry Osipenko 			state->blending[index].top = true;
6283dae08bcSDmitry Osipenko 		else
6293dae08bcSDmitry Osipenko 			state->blending[index].top = false;
63048519232SDmitry Osipenko 
631ebae8d07SThierry Reding 		/*
6323dae08bcSDmitry Osipenko 		 * Missing framebuffer means that plane is disabled, in this
6333dae08bcSDmitry Osipenko 		 * case mark B / C window as top to be able to differentiate
6343dae08bcSDmitry Osipenko 		 * windows indices order in regards to zPos for the middle
6353dae08bcSDmitry Osipenko 		 * window X / Y registers programming.
636ebae8d07SThierry Reding 		 */
6373dae08bcSDmitry Osipenko 		if (!new->fb)
6383dae08bcSDmitry Osipenko 			state->blending[index].top = (index == 1);
639ebae8d07SThierry Reding 	}
640ebae8d07SThierry Reding }
641ebae8d07SThierry Reding 
6423dae08bcSDmitry Osipenko static int tegra_plane_setup_transparency(struct tegra_plane *tegra,
6433dae08bcSDmitry Osipenko 					  struct tegra_plane_state *state)
6443dae08bcSDmitry Osipenko {
6453dae08bcSDmitry Osipenko 	struct tegra_plane_state *tegra_state;
6463dae08bcSDmitry Osipenko 	struct drm_plane_state *new;
6473dae08bcSDmitry Osipenko 	struct drm_plane *plane;
6483dae08bcSDmitry Osipenko 	int err;
649ebae8d07SThierry Reding 
650ebae8d07SThierry Reding 	/*
6513dae08bcSDmitry Osipenko 	 * If planes zpos / transparency changed, sibling planes blending
6523dae08bcSDmitry Osipenko 	 * state may require adjustment and in this case they will be included
6533dae08bcSDmitry Osipenko 	 * into this atom commit, otherwise blending state is unchanged.
654ebae8d07SThierry Reding 	 */
6553dae08bcSDmitry Osipenko 	err = tegra_plane_check_transparency(tegra, state);
6563dae08bcSDmitry Osipenko 	if (err <= 0)
6573dae08bcSDmitry Osipenko 		return err;
6583dae08bcSDmitry Osipenko 
6593dae08bcSDmitry Osipenko 	/*
6603dae08bcSDmitry Osipenko 	 * All planes are now in the atomic state, walk them up and update
6613dae08bcSDmitry Osipenko 	 * transparency state for each plane.
6623dae08bcSDmitry Osipenko 	 */
6633dae08bcSDmitry Osipenko 	drm_for_each_plane(plane, tegra->base.dev) {
6643dae08bcSDmitry Osipenko 		struct tegra_plane *p = to_tegra_plane(plane);
6653dae08bcSDmitry Osipenko 
6663dae08bcSDmitry Osipenko 		/* skip planes on different CRTCs */
6673dae08bcSDmitry Osipenko 		if (p->dc != tegra->dc)
6683dae08bcSDmitry Osipenko 			continue;
6693dae08bcSDmitry Osipenko 
6703dae08bcSDmitry Osipenko 		new = drm_atomic_get_new_plane_state(state->base.state, plane);
6713dae08bcSDmitry Osipenko 		tegra_state = to_tegra_plane_state(new);
6723dae08bcSDmitry Osipenko 
6733dae08bcSDmitry Osipenko 		/*
6743dae08bcSDmitry Osipenko 		 * There is no need to update blending state for the disabled
6753dae08bcSDmitry Osipenko 		 * plane.
6763dae08bcSDmitry Osipenko 		 */
6773dae08bcSDmitry Osipenko 		if (new->fb)
6783dae08bcSDmitry Osipenko 			tegra_plane_update_transparency(p, tegra_state);
679ebae8d07SThierry Reding 	}
6803dae08bcSDmitry Osipenko 
6813dae08bcSDmitry Osipenko 	return 0;
6823dae08bcSDmitry Osipenko }
6833dae08bcSDmitry Osipenko 
6843dae08bcSDmitry Osipenko int tegra_plane_setup_legacy_state(struct tegra_plane *tegra,
6853dae08bcSDmitry Osipenko 				   struct tegra_plane_state *state)
6863dae08bcSDmitry Osipenko {
6873dae08bcSDmitry Osipenko 	int err;
6883dae08bcSDmitry Osipenko 
6893dae08bcSDmitry Osipenko 	err = tegra_plane_setup_opacity(tegra, state);
6903dae08bcSDmitry Osipenko 	if (err < 0)
6913dae08bcSDmitry Osipenko 		return err;
6923dae08bcSDmitry Osipenko 
6933dae08bcSDmitry Osipenko 	err = tegra_plane_setup_transparency(tegra, state);
6943dae08bcSDmitry Osipenko 	if (err < 0)
6953dae08bcSDmitry Osipenko 		return err;
6963dae08bcSDmitry Osipenko 
6973dae08bcSDmitry Osipenko 	return 0;
698ebae8d07SThierry Reding }
69904d5d5dfSDmitry Osipenko 
70004d5d5dfSDmitry Osipenko static const char * const tegra_plane_icc_names[TEGRA_DC_LEGACY_PLANES_NUM] = {
70104d5d5dfSDmitry Osipenko 	"wina", "winb", "winc", NULL, NULL, NULL, "cursor",
70204d5d5dfSDmitry Osipenko };
70304d5d5dfSDmitry Osipenko 
70404d5d5dfSDmitry Osipenko int tegra_plane_interconnect_init(struct tegra_plane *plane)
70504d5d5dfSDmitry Osipenko {
70604d5d5dfSDmitry Osipenko 	const char *icc_name = tegra_plane_icc_names[plane->index];
70704d5d5dfSDmitry Osipenko 	struct device *dev = plane->dc->dev;
70804d5d5dfSDmitry Osipenko 	struct tegra_dc *dc = plane->dc;
70904d5d5dfSDmitry Osipenko 	int err;
71004d5d5dfSDmitry Osipenko 
71104d5d5dfSDmitry Osipenko 	if (WARN_ON(plane->index >= TEGRA_DC_LEGACY_PLANES_NUM) ||
71204d5d5dfSDmitry Osipenko 	    WARN_ON(!tegra_plane_icc_names[plane->index]))
71304d5d5dfSDmitry Osipenko 		return -EINVAL;
71404d5d5dfSDmitry Osipenko 
71504d5d5dfSDmitry Osipenko 	plane->icc_mem = devm_of_icc_get(dev, icc_name);
71604d5d5dfSDmitry Osipenko 	err = PTR_ERR_OR_ZERO(plane->icc_mem);
71704d5d5dfSDmitry Osipenko 	if (err) {
71804d5d5dfSDmitry Osipenko 		dev_err_probe(dev, err, "failed to get %s interconnect\n",
71904d5d5dfSDmitry Osipenko 			      icc_name);
72004d5d5dfSDmitry Osipenko 		return err;
72104d5d5dfSDmitry Osipenko 	}
72204d5d5dfSDmitry Osipenko 
72304d5d5dfSDmitry Osipenko 	/* plane B on T20/30 has a dedicated memory client for a 6-tap vertical filter */
72404d5d5dfSDmitry Osipenko 	if (plane->index == 1 && dc->soc->has_win_b_vfilter_mem_client) {
72504d5d5dfSDmitry Osipenko 		plane->icc_mem_vfilter = devm_of_icc_get(dev, "winb-vfilter");
72604d5d5dfSDmitry Osipenko 		err = PTR_ERR_OR_ZERO(plane->icc_mem_vfilter);
72704d5d5dfSDmitry Osipenko 		if (err) {
72804d5d5dfSDmitry Osipenko 			dev_err_probe(dev, err, "failed to get %s interconnect\n",
72904d5d5dfSDmitry Osipenko 				      "winb-vfilter");
73004d5d5dfSDmitry Osipenko 			return err;
73104d5d5dfSDmitry Osipenko 		}
73204d5d5dfSDmitry Osipenko 	}
73304d5d5dfSDmitry Osipenko 
73404d5d5dfSDmitry Osipenko 	return 0;
73504d5d5dfSDmitry Osipenko }
736