]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/sun4i: csc: Add support for the new MMIO layout
authorSamuel Holland <samuel@sholland.org>
Sun, 24 Apr 2022 16:26:28 +0000 (11:26 -0500)
committerMaxime Ripard <maxime@cerno.tech>
Tue, 26 Apr 2022 12:25:15 +0000 (14:25 +0200)
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
drivers/gpu/drm/sun4i/sun8i_csc.c
drivers/gpu/drm/sun4i/sun8i_csc.h
drivers/gpu/drm/sun4i/sun8i_mixer.c
drivers/gpu/drm/sun4i/sun8i_mixer.h

index 9bd62de0c288c8a3e692da3085f4d48f71a8277c..58480d8e4f7042d0593d686fb0a0116898d2fc4f 100644 (file)
@@ -8,9 +8,10 @@
 #include "sun8i_csc.h"
 #include "sun8i_mixer.h"
 
-static const u32 ccsc_base[2][2] = {
-       {CCSC00_OFFSET, CCSC01_OFFSET},
-       {CCSC10_OFFSET, CCSC11_OFFSET},
+static const u32 ccsc_base[][2] = {
+       [CCSC_MIXER0_LAYOUT]    = {CCSC00_OFFSET, CCSC01_OFFSET},
+       [CCSC_MIXER1_LAYOUT]    = {CCSC10_OFFSET, CCSC11_OFFSET},
+       [CCSC_D1_MIXER0_LAYOUT] = {CCSC00_OFFSET, CCSC01_D1_OFFSET},
 };
 
 /*
index 022cafa6c06cb040d3739182ac432187742aa251..828b86fd0cabb685c59e87860335dddcce8a83fe 100644 (file)
@@ -13,6 +13,7 @@ struct sun8i_mixer;
 /* VI channel CSC units offsets */
 #define CCSC00_OFFSET 0xAA050
 #define CCSC01_OFFSET 0xFA050
+#define CCSC01_D1_OFFSET 0xFA000
 #define CCSC10_OFFSET 0xA0000
 #define CCSC11_OFFSET 0xF0000
 
index 6b1711a9a71f20475721f5bf82bee8a77d4ceccf..4ce593c998071270c30ea074591798874a62e459 100644 (file)
@@ -564,7 +564,7 @@ static int sun8i_mixer_remove(struct platform_device *pdev)
 }
 
 static const struct sun8i_mixer_cfg sun8i_a83t_mixer0_cfg = {
-       .ccsc           = 0,
+       .ccsc           = CCSC_MIXER0_LAYOUT,
        .scaler_mask    = 0xf,
        .scanline_yuv   = 2048,
        .ui_num         = 3,
@@ -572,7 +572,7 @@ static const struct sun8i_mixer_cfg sun8i_a83t_mixer0_cfg = {
 };
 
 static const struct sun8i_mixer_cfg sun8i_a83t_mixer1_cfg = {
-       .ccsc           = 1,
+       .ccsc           = CCSC_MIXER1_LAYOUT,
        .scaler_mask    = 0x3,
        .scanline_yuv   = 2048,
        .ui_num         = 1,
@@ -580,7 +580,7 @@ static const struct sun8i_mixer_cfg sun8i_a83t_mixer1_cfg = {
 };
 
 static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
-       .ccsc           = 0,
+       .ccsc           = CCSC_MIXER0_LAYOUT,
        .mod_rate       = 432000000,
        .scaler_mask    = 0xf,
        .scanline_yuv   = 2048,
@@ -589,7 +589,7 @@ static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
 };
 
 static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = {
-       .ccsc           = 0,
+       .ccsc           = CCSC_MIXER0_LAYOUT,
        .mod_rate       = 297000000,
        .scaler_mask    = 0xf,
        .scanline_yuv   = 2048,
@@ -598,7 +598,7 @@ static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = {
 };
 
 static const struct sun8i_mixer_cfg sun8i_r40_mixer1_cfg = {
-       .ccsc           = 1,
+       .ccsc           = CCSC_MIXER1_LAYOUT,
        .mod_rate       = 297000000,
        .scaler_mask    = 0x3,
        .scanline_yuv   = 2048,
@@ -611,12 +611,12 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
        .ui_num = 1,
        .scaler_mask = 0x3,
        .scanline_yuv = 2048,
-       .ccsc = 0,
+       .ccsc = CCSC_MIXER0_LAYOUT,
        .mod_rate = 150000000,
 };
 
 static const struct sun8i_mixer_cfg sun50i_a64_mixer0_cfg = {
-       .ccsc           = 0,
+       .ccsc           = CCSC_MIXER0_LAYOUT,
        .mod_rate       = 297000000,
        .scaler_mask    = 0xf,
        .scanline_yuv   = 4096,
@@ -625,7 +625,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer0_cfg = {
 };
 
 static const struct sun8i_mixer_cfg sun50i_a64_mixer1_cfg = {
-       .ccsc           = 1,
+       .ccsc           = CCSC_MIXER1_LAYOUT,
        .mod_rate       = 297000000,
        .scaler_mask    = 0x3,
        .scanline_yuv   = 2048,
@@ -634,7 +634,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer1_cfg = {
 };
 
 static const struct sun8i_mixer_cfg sun50i_h6_mixer0_cfg = {
-       .ccsc           = 0,
+       .ccsc           = CCSC_MIXER0_LAYOUT,
        .is_de3         = true,
        .mod_rate       = 600000000,
        .scaler_mask    = 0xf,
index 5b3fbee18671301a4d63d80ede641306750a3608..85c94884fb9a4b54a9f3aaa9efff24031fef40e5 100644 (file)
 #define SUN50I_MIXER_CDC0_EN                   0xd0000
 #define SUN50I_MIXER_CDC1_EN                   0xd8000
 
+enum {
+       /* First mixer or second mixer with VEP support. */
+       CCSC_MIXER0_LAYOUT,
+       /* Second mixer without VEP support. */
+       CCSC_MIXER1_LAYOUT,
+       /* First mixer with the MMIO layout found in the D1 SoC. */
+       CCSC_D1_MIXER0_LAYOUT,
+};
+
 /**
  * struct sun8i_mixer_cfg - mixer HW configuration
  * @vi_num: number of VI channels
  *     First, scaler supports for VI channels is defined and after that, scaler
  *     support for UI channels. For example, if mixer has 2 VI channels without
  *     scaler and 2 UI channels with scaler, bitmask would be 0xC.
- * @ccsc: select set of CCSC base addresses
- *     Set value to 0 if this is first mixer or second mixer with VEP support.
- *     Set value to 1 if this is second mixer without VEP support. Other values
- *     are invalid.
+ * @ccsc: select set of CCSC base addresses from the enumeration above.
  * @mod_rate: module clock rate that needs to be set in order to have
  *     a functional block.
  * @is_de3: true, if this is next gen display engine 3.0, false otherwise.