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

drm/sun4i: csc: Add support for the new MMIO layout

D1 changes the MMIO offsets for the CSC blocks in the first mixer. The
mixers' ccsc property is used as an index into the ccsc_base array. Use
an enumeration to describe this index, and add the new set of offsets.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220424162633.12369-11-samuel@sholland.org

authored by

Samuel Holland and committed by
Maxime Ripard
b2da8192 c3779dab

+24 -16
+4 -3
drivers/gpu/drm/sun4i/sun8i_csc.c
··· 8 8 #include "sun8i_csc.h" 9 9 #include "sun8i_mixer.h" 10 10 11 - static const u32 ccsc_base[2][2] = { 12 - {CCSC00_OFFSET, CCSC01_OFFSET}, 13 - {CCSC10_OFFSET, CCSC11_OFFSET}, 11 + static const u32 ccsc_base[][2] = { 12 + [CCSC_MIXER0_LAYOUT] = {CCSC00_OFFSET, CCSC01_OFFSET}, 13 + [CCSC_MIXER1_LAYOUT] = {CCSC10_OFFSET, CCSC11_OFFSET}, 14 + [CCSC_D1_MIXER0_LAYOUT] = {CCSC00_OFFSET, CCSC01_D1_OFFSET}, 14 15 }; 15 16 16 17 /*
+1
drivers/gpu/drm/sun4i/sun8i_csc.h
··· 13 13 /* VI channel CSC units offsets */ 14 14 #define CCSC00_OFFSET 0xAA050 15 15 #define CCSC01_OFFSET 0xFA050 16 + #define CCSC01_D1_OFFSET 0xFA000 16 17 #define CCSC10_OFFSET 0xA0000 17 18 #define CCSC11_OFFSET 0xF0000 18 19
+9 -9
drivers/gpu/drm/sun4i/sun8i_mixer.c
··· 564 564 } 565 565 566 566 static const struct sun8i_mixer_cfg sun8i_a83t_mixer0_cfg = { 567 - .ccsc = 0, 567 + .ccsc = CCSC_MIXER0_LAYOUT, 568 568 .scaler_mask = 0xf, 569 569 .scanline_yuv = 2048, 570 570 .ui_num = 3, ··· 572 572 }; 573 573 574 574 static const struct sun8i_mixer_cfg sun8i_a83t_mixer1_cfg = { 575 - .ccsc = 1, 575 + .ccsc = CCSC_MIXER1_LAYOUT, 576 576 .scaler_mask = 0x3, 577 577 .scanline_yuv = 2048, 578 578 .ui_num = 1, ··· 580 580 }; 581 581 582 582 static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = { 583 - .ccsc = 0, 583 + .ccsc = CCSC_MIXER0_LAYOUT, 584 584 .mod_rate = 432000000, 585 585 .scaler_mask = 0xf, 586 586 .scanline_yuv = 2048, ··· 589 589 }; 590 590 591 591 static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = { 592 - .ccsc = 0, 592 + .ccsc = CCSC_MIXER0_LAYOUT, 593 593 .mod_rate = 297000000, 594 594 .scaler_mask = 0xf, 595 595 .scanline_yuv = 2048, ··· 598 598 }; 599 599 600 600 static const struct sun8i_mixer_cfg sun8i_r40_mixer1_cfg = { 601 - .ccsc = 1, 601 + .ccsc = CCSC_MIXER1_LAYOUT, 602 602 .mod_rate = 297000000, 603 603 .scaler_mask = 0x3, 604 604 .scanline_yuv = 2048, ··· 611 611 .ui_num = 1, 612 612 .scaler_mask = 0x3, 613 613 .scanline_yuv = 2048, 614 - .ccsc = 0, 614 + .ccsc = CCSC_MIXER0_LAYOUT, 615 615 .mod_rate = 150000000, 616 616 }; 617 617 618 618 static const struct sun8i_mixer_cfg sun50i_a64_mixer0_cfg = { 619 - .ccsc = 0, 619 + .ccsc = CCSC_MIXER0_LAYOUT, 620 620 .mod_rate = 297000000, 621 621 .scaler_mask = 0xf, 622 622 .scanline_yuv = 4096, ··· 625 625 }; 626 626 627 627 static const struct sun8i_mixer_cfg sun50i_a64_mixer1_cfg = { 628 - .ccsc = 1, 628 + .ccsc = CCSC_MIXER1_LAYOUT, 629 629 .mod_rate = 297000000, 630 630 .scaler_mask = 0x3, 631 631 .scanline_yuv = 2048, ··· 634 634 }; 635 635 636 636 static const struct sun8i_mixer_cfg sun50i_h6_mixer0_cfg = { 637 - .ccsc = 0, 637 + .ccsc = CCSC_MIXER0_LAYOUT, 638 638 .is_de3 = true, 639 639 .mod_rate = 600000000, 640 640 .scaler_mask = 0xf,
+10 -4
drivers/gpu/drm/sun4i/sun8i_mixer.h
··· 141 141 #define SUN50I_MIXER_CDC0_EN 0xd0000 142 142 #define SUN50I_MIXER_CDC1_EN 0xd8000 143 143 144 + enum { 145 + /* First mixer or second mixer with VEP support. */ 146 + CCSC_MIXER0_LAYOUT, 147 + /* Second mixer without VEP support. */ 148 + CCSC_MIXER1_LAYOUT, 149 + /* First mixer with the MMIO layout found in the D1 SoC. */ 150 + CCSC_D1_MIXER0_LAYOUT, 151 + }; 152 + 144 153 /** 145 154 * struct sun8i_mixer_cfg - mixer HW configuration 146 155 * @vi_num: number of VI channels ··· 158 149 * First, scaler supports for VI channels is defined and after that, scaler 159 150 * support for UI channels. For example, if mixer has 2 VI channels without 160 151 * scaler and 2 UI channels with scaler, bitmask would be 0xC. 161 - * @ccsc: select set of CCSC base addresses 162 - * Set value to 0 if this is first mixer or second mixer with VEP support. 163 - * Set value to 1 if this is second mixer without VEP support. Other values 164 - * are invalid. 152 + * @ccsc: select set of CCSC base addresses from the enumeration above. 165 153 * @mod_rate: module clock rate that needs to be set in order to have 166 154 * a functional block. 167 155 * @is_de3: true, if this is next gen display engine 3.0, false otherwise.