Commit bb5f268b authored by Tomi Valkeinen's avatar Tomi Valkeinen Committed by Tomi Valkeinen
Browse files

drm/rcar-du: Write DPTSR only if the second source exists



Currently the driver always writes DPTSR when setting up the hardware.
However, writing the register is only meaningful when the second source
for a plane is used, and the register is not even documented for SoCs
that do not have the second source.

So move the write behind a condition.

Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> # On R-Car M3-N
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241217-rcar-gh-dsi-v5-2-e77421093c05@ideasonboard.com
parent 6389e616
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -185,12 +185,22 @@ static void rcar_du_group_setup(struct rcar_du_group *rgrp)
		dorcr |= DORCR_PG1T | DORCR_DK1S | DORCR_PG1D_DS1;
	rcar_du_group_write(rgrp, DORCR, dorcr);

	/* Apply planes to CRTCs association. */
	/*
	 * DPTSR is used to select the source for the planes of a group. The
	 * first source is chosen by writing 0 to the respective bits, and this
	 * is always the default value of the register. In other words, writing
	 * DPTSR is only needed if the SoC supports choosing the second source.
	 *
	 * The SoCs documentations seems to confirm this, as the DPTSR register
	 * is not documented if only the first source exists on that SoC.
	 */
	if (rgrp->channels_mask & BIT(1)) {
		mutex_lock(&rgrp->lock);
		rcar_du_group_write(rgrp, DPTSR, (rgrp->dptsr_planes << 16) |
				    rgrp->dptsr_planes);
		mutex_unlock(&rgrp->lock);
	}
}

/*
 * rcar_du_group_get - Acquire a reference to the DU channels group