Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: rcar-du: Fix dot clock routing configuration

Dot clock routing is setup through different registers depending on the
DU generation. The code has been designed for Gen2 and hasn't been
updated since. This works thanks to good reset default value, but isn't
very safe. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

+13 -9
+13 -9
drivers/gpu/drm/rcar-du/rcar_du_group.c
··· 105 105 if (rcar_du_has(rgrp->dev, RCAR_DU_FEATURE_EXT_CTRL_REGS)) { 106 106 rcar_du_group_setup_defr8(rgrp); 107 107 108 - /* Configure input dot clock routing. We currently hardcode the 109 - * configuration to routing DOTCLKINn to DUn. 108 + /* 109 + * Configure input dot clock routing. We currently hardcode the 110 + * configuration to routing DOTCLKINn to DUn. Register fields 111 + * depend on the DU generation, but the resulting value is 0 in 112 + * all cases. 113 + * 114 + * On Gen2 a single register in the first group controls dot 115 + * clock selection for all channels, while on Gen3 dot clocks 116 + * are setup through per-group registers, only available when 117 + * the group has two channels. 110 118 */ 111 - rcar_du_group_write(rgrp, DIDSR, DIDSR_CODE | 112 - DIDSR_LCDS_DCLKIN(2) | 113 - DIDSR_LCDS_DCLKIN(1) | 114 - DIDSR_LCDS_DCLKIN(0) | 115 - DIDSR_PDCS_CLK(2, 0) | 116 - DIDSR_PDCS_CLK(1, 0) | 117 - DIDSR_PDCS_CLK(0, 0)); 119 + if ((rcdu->info->gen < 3 && rgrp->index == 0) || 120 + (rcdu->info->gen == 3 && rgrp->num_crtcs > 1)) 121 + rcar_du_group_write(rgrp, DIDSR, DIDSR_CODE); 118 122 } 119 123 120 124 if (rcdu->info->gen >= 3)