Lines Matching +full:gen +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0+
3 * rcar_du_group.c -- R-Car Display Unit Channels Pair
5 * Copyright (C) 2013-2015 Renesas Electronics Corporation
11 * The R8A7779 DU is split in per-CRTC resources (scan-out engine, blending
12 * unit, timings generator, ...) and device-global resources (start/stop
19 * modeled as a single device with three CRTCs, two sets of "semi-global"
20 * resources, and a few device-global resources.
23 * counterpart in the DU documentation, that models those semi-global resources.
35 return rcar_du_read(rgrp->dev, rgrp->mmio_offset + reg); in rcar_du_group_read()
40 rcar_du_write(rgrp->dev, rgrp->mmio_offset + reg, data); in rcar_du_group_write()
47 if (rgrp->channels_mask & BIT(0)) in rcar_du_group_setup_pins()
50 if (rgrp->channels_mask & BIT(1)) in rcar_du_group_setup_pins()
58 struct rcar_du_device *rcdu = rgrp->dev; in rcar_du_group_setup_defr8()
61 if (rcdu->info->gen < 3) { in rcar_du_group_setup_defr8()
66 * RGB output routing to DPAD0 and VSPD1 routing to DU0/1/2 for in rcar_du_group_setup_defr8()
69 if (rgrp->index == 0) { in rcar_du_group_setup_defr8()
70 defr8 |= DEFR8_DRGBS_DU(rcdu->dpad0_source); in rcar_du_group_setup_defr8()
71 if (rgrp->dev->vspd1_sink == 2) in rcar_du_group_setup_defr8()
80 if (rgrp->index == rcdu->dpad0_source / 2) in rcar_du_group_setup_defr8()
81 defr8 |= DEFR8_DRGBS_DU(rcdu->dpad0_source); in rcar_du_group_setup_defr8()
89 struct rcar_du_device *rcdu = rgrp->dev; in rcar_du_group_setup_didsr()
103 if (rcdu->info->gen < 3 && rgrp->index == 0) { in rcar_du_group_setup_didsr()
108 rcrtc = rcdu->crtcs; in rcar_du_group_setup_didsr()
109 num_crtcs = rcdu->num_crtcs; in rcar_du_group_setup_didsr()
110 } else if (rcdu->info->gen == 3 && rgrp->num_crtcs > 1) { in rcar_du_group_setup_didsr()
112 * On Gen3 dot clocks are setup through per-group registers, in rcar_du_group_setup_didsr()
115 rcrtc = &rcdu->crtcs[rgrp->index * 2]; in rcar_du_group_setup_didsr()
116 num_crtcs = rgrp->num_crtcs; in rcar_du_group_setup_didsr()
124 if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index)) in rcar_du_group_setup_didsr()
137 struct rcar_du_device *rcdu = rgrp->dev; in rcar_du_group_setup()
142 if (rcdu->info->gen < 3) { in rcar_du_group_setup()
156 defr7 |= (rgrp->cmms_mask & BIT(1) ? DEFR7_CMME1 : 0) | in rcar_du_group_setup()
157 (rgrp->cmms_mask & BIT(0) ? DEFR7_CMME0 : 0); in rcar_du_group_setup()
160 if (rcdu->info->gen >= 2) { in rcar_du_group_setup()
165 if (rcdu->info->gen >= 3) in rcar_du_group_setup()
175 mutex_lock(&rgrp->lock); in rcar_du_group_setup()
176 rcar_du_group_write(rgrp, DPTSR, (rgrp->dptsr_planes << 16) | in rcar_du_group_setup()
177 rgrp->dptsr_planes); in rcar_du_group_setup()
178 mutex_unlock(&rgrp->lock); in rcar_du_group_setup()
182 * rcar_du_group_get - Acquire a reference to the DU channels group
193 if (rgrp->use_count) in rcar_du_group_get()
199 rgrp->use_count++; in rcar_du_group_get()
204 * rcar_du_group_put - Release a reference to the DU
210 --rgrp->use_count; in rcar_du_group_put()
215 struct rcar_du_device *rcdu = rgrp->dev; in __rcar_du_group_start_stop()
222 * M3-N, however, DU2 doesn't exist, but DSYSR2 does. We thus need to in __rcar_du_group_start_stop()
225 if (rcdu->info->channels_mask & BIT(rgrp->index * 2)) { in __rcar_du_group_start_stop()
226 struct rcar_du_crtc *rcrtc = &rgrp->dev->crtcs[rgrp->index * 2]; in __rcar_du_group_start_stop()
241 * of those bits could be pre-configured, but others (especially the in rcar_du_group_start_stop()
246 * flicker. It should be possible to move most of the "DRES-update" bits in rcar_du_group_start_stop()
251 if (rgrp->used_crtcs++ != 0) in rcar_du_group_start_stop()
255 if (--rgrp->used_crtcs == 0) in rcar_du_group_start_stop()
262 rgrp->need_restart = false; in rcar_du_group_restart()
275 if (rcdu->info->gen < 2) in rcar_du_set_dpad0_vsp1_routing()
279 * RGB output routing to DPAD0 and VSP1D routing to DU0/1/2 are in rcar_du_set_dpad0_vsp1_routing()
285 index = rcdu->info->gen < 3 ? 0 : DIV_ROUND_UP(rcdu->num_crtcs, 2) - 1; in rcar_du_set_dpad0_vsp1_routing()
286 rgrp = &rcdu->groups[index]; in rcar_du_set_dpad0_vsp1_routing()
287 crtc = &rcdu->crtcs[index * 2]; in rcar_du_set_dpad0_vsp1_routing()
289 ret = clk_prepare_enable(crtc->clock); in rcar_du_set_dpad0_vsp1_routing()
295 clk_disable_unprepare(crtc->clock); in rcar_du_set_dpad0_vsp1_routing()
302 static const u32 doflr_values[2] = { in rcar_du_group_set_dpad_levels()
310 struct rcar_du_device *rcdu = rgrp->dev; in rcar_du_group_set_dpad_levels()
314 if (rcdu->info->gen < 2) in rcar_du_group_set_dpad_levels()
321 * by driving fixed low-level signals at the output of any DU channel in rcar_du_group_set_dpad_levels()
327 for (i = 0; i < rgrp->num_crtcs; ++i) { in rcar_du_group_set_dpad_levels()
331 rcrtc = &rcdu->crtcs[rgrp->index * 2 + i]; in rcar_du_group_set_dpad_levels()
332 rstate = to_rcar_crtc_state(rcrtc->crtc.state); in rcar_du_group_set_dpad_levels()
334 if (!(rstate->outputs & dpad_mask)) in rcar_du_group_set_dpad_levels()
343 struct rcar_du_device *rcdu = rgrp->dev; in rcar_du_group_set_routing()
353 if (rcdu->dpad1_source == rgrp->index * 2) in rcar_du_group_set_routing()
362 return rcar_du_set_dpad0_vsp1_routing(rgrp->dev); in rcar_du_group_set_routing()