mirror of
https://github.com/armbian/build.git
synced 2025-08-15 15:46:58 +02:00
258 lines
9.0 KiB
Diff
258 lines
9.0 KiB
Diff
From b49e4fb3439c50eb6effc559366b3e88e2ac2f27 Mon Sep 17 00:00:00 2001
|
|
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
|
Date: Sun, 29 Sep 2024 22:04:45 +1300
|
|
Subject: drm: sun4i: de2/de3: add mixer version enum
|
|
|
|
The Allwinner DE2 and DE3 display engine mixers are currently identified
|
|
by a simple boolean flag. This will not scale to support additional DE
|
|
variants.
|
|
|
|
Convert the boolean flag to an enum.
|
|
|
|
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
|
Signed-off-by: Ryan Walklin <ryan@testtoast.com>
|
|
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
|
|
---
|
|
drivers/gpu/drm/sun4i/sun8i_csc.c | 2 +-
|
|
drivers/gpu/drm/sun4i/sun8i_mixer.c | 14 ++++++++++++--
|
|
drivers/gpu/drm/sun4i/sun8i_mixer.h | 11 ++++++++---
|
|
drivers/gpu/drm/sun4i/sun8i_ui_scaler.c | 2 +-
|
|
drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 8 ++++----
|
|
drivers/gpu/drm/sun4i/sun8i_vi_scaler.c | 4 ++--
|
|
6 files changed, 28 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.c b/drivers/gpu/drm/sun4i/sun8i_csc.c
|
|
index e12a81fa9108..2d5a2cf7cba2 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_csc.c
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_csc.c
|
|
@@ -365,7 +365,7 @@ void sun8i_csc_set_ccsc(struct sun8i_mixer *mixer, int layer,
|
|
{
|
|
u32 base;
|
|
|
|
- if (mixer->cfg->is_de3) {
|
|
+ if (mixer->cfg->de_type == sun8i_mixer_de3) {
|
|
sun8i_de3_ccsc_setup(&mixer->engine, layer,
|
|
fmt_type, encoding, range);
|
|
return;
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
|
|
index a50c583852ed..16e018aa4aae 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
|
|
@@ -584,7 +584,7 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
|
|
base = sun8i_blender_base(mixer);
|
|
|
|
/* Reset registers and disable unused sub-engines */
|
|
- if (mixer->cfg->is_de3) {
|
|
+ if (mixer->cfg->de_type == sun8i_mixer_de3) {
|
|
for (i = 0; i < DE3_MIXER_UNIT_SIZE; i += 4)
|
|
regmap_write(mixer->engine.regs, i, 0);
|
|
|
|
@@ -675,6 +675,7 @@ static void sun8i_mixer_remove(struct platform_device *pdev)
|
|
|
|
static const struct sun8i_mixer_cfg sun8i_a83t_mixer0_cfg = {
|
|
.ccsc = CCSC_MIXER0_LAYOUT,
|
|
+ .de_type = sun8i_mixer_de2,
|
|
.scaler_mask = 0xf,
|
|
.scanline_yuv = 2048,
|
|
.ui_num = 3,
|
|
@@ -683,6 +684,7 @@ static const struct sun8i_mixer_cfg sun8i_a83t_mixer0_cfg = {
|
|
|
|
static const struct sun8i_mixer_cfg sun8i_a83t_mixer1_cfg = {
|
|
.ccsc = CCSC_MIXER1_LAYOUT,
|
|
+ .de_type = sun8i_mixer_de2,
|
|
.scaler_mask = 0x3,
|
|
.scanline_yuv = 2048,
|
|
.ui_num = 1,
|
|
@@ -691,6 +693,7 @@ static const struct sun8i_mixer_cfg sun8i_a83t_mixer1_cfg = {
|
|
|
|
static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
|
|
.ccsc = CCSC_MIXER0_LAYOUT,
|
|
+ .de_type = sun8i_mixer_de2,
|
|
.mod_rate = 432000000,
|
|
.scaler_mask = 0xf,
|
|
.scanline_yuv = 2048,
|
|
@@ -700,6 +703,7 @@ static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
|
|
|
|
static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = {
|
|
.ccsc = CCSC_MIXER0_LAYOUT,
|
|
+ .de_type = sun8i_mixer_de2,
|
|
.mod_rate = 297000000,
|
|
.scaler_mask = 0xf,
|
|
.scanline_yuv = 2048,
|
|
@@ -709,6 +713,7 @@ static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = {
|
|
|
|
static const struct sun8i_mixer_cfg sun8i_r40_mixer1_cfg = {
|
|
.ccsc = CCSC_MIXER1_LAYOUT,
|
|
+ .de_type = sun8i_mixer_de2,
|
|
.mod_rate = 297000000,
|
|
.scaler_mask = 0x3,
|
|
.scanline_yuv = 2048,
|
|
@@ -717,6 +722,7 @@ static const struct sun8i_mixer_cfg sun8i_r40_mixer1_cfg = {
|
|
};
|
|
|
|
static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
|
|
+ .de_type = sun8i_mixer_de2,
|
|
.vi_num = 2,
|
|
.ui_num = 1,
|
|
.scaler_mask = 0x3,
|
|
@@ -727,6 +733,7 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
|
|
|
|
static const struct sun8i_mixer_cfg sun20i_d1_mixer0_cfg = {
|
|
.ccsc = CCSC_D1_MIXER0_LAYOUT,
|
|
+ .de_type = sun8i_mixer_de2,
|
|
.mod_rate = 297000000,
|
|
.scaler_mask = 0x3,
|
|
.scanline_yuv = 2048,
|
|
@@ -736,6 +743,7 @@ static const struct sun8i_mixer_cfg sun20i_d1_mixer0_cfg = {
|
|
|
|
static const struct sun8i_mixer_cfg sun20i_d1_mixer1_cfg = {
|
|
.ccsc = CCSC_MIXER1_LAYOUT,
|
|
+ .de_type = sun8i_mixer_de2,
|
|
.mod_rate = 297000000,
|
|
.scaler_mask = 0x1,
|
|
.scanline_yuv = 1024,
|
|
@@ -745,6 +753,7 @@ static const struct sun8i_mixer_cfg sun20i_d1_mixer1_cfg = {
|
|
|
|
static const struct sun8i_mixer_cfg sun50i_a64_mixer0_cfg = {
|
|
.ccsc = CCSC_MIXER0_LAYOUT,
|
|
+ .de_type = sun8i_mixer_de2,
|
|
.mod_rate = 297000000,
|
|
.scaler_mask = 0xf,
|
|
.scanline_yuv = 4096,
|
|
@@ -754,6 +763,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer0_cfg = {
|
|
|
|
static const struct sun8i_mixer_cfg sun50i_a64_mixer1_cfg = {
|
|
.ccsc = CCSC_MIXER1_LAYOUT,
|
|
+ .de_type = sun8i_mixer_de2,
|
|
.mod_rate = 297000000,
|
|
.scaler_mask = 0x3,
|
|
.scanline_yuv = 2048,
|
|
@@ -763,7 +773,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer1_cfg = {
|
|
|
|
static const struct sun8i_mixer_cfg sun50i_h6_mixer0_cfg = {
|
|
.ccsc = CCSC_MIXER0_LAYOUT,
|
|
- .is_de3 = true,
|
|
+ .de_type = sun8i_mixer_de3,
|
|
.has_formatter = 1,
|
|
.mod_rate = 600000000,
|
|
.scaler_mask = 0xf,
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
|
|
index 8417b8fef2e1..82956cb97cfd 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
|
|
@@ -151,6 +151,11 @@ enum {
|
|
CCSC_D1_MIXER0_LAYOUT,
|
|
};
|
|
|
|
+enum sun8i_mixer_type {
|
|
+ sun8i_mixer_de2,
|
|
+ sun8i_mixer_de3,
|
|
+};
|
|
+
|
|
/**
|
|
* struct sun8i_mixer_cfg - mixer HW configuration
|
|
* @vi_num: number of VI channels
|
|
@@ -172,7 +177,7 @@ struct sun8i_mixer_cfg {
|
|
int scaler_mask;
|
|
int ccsc;
|
|
unsigned long mod_rate;
|
|
- unsigned int is_de3 : 1;
|
|
+ unsigned int de_type;
|
|
unsigned int has_formatter : 1;
|
|
unsigned int scanline_yuv;
|
|
};
|
|
@@ -216,13 +221,13 @@ engine_to_sun8i_mixer(struct sunxi_engine *engine)
|
|
static inline u32
|
|
sun8i_blender_base(struct sun8i_mixer *mixer)
|
|
{
|
|
- return mixer->cfg->is_de3 ? DE3_BLD_BASE : DE2_BLD_BASE;
|
|
+ return mixer->cfg->de_type == sun8i_mixer_de3 ? DE3_BLD_BASE : DE2_BLD_BASE;
|
|
}
|
|
|
|
static inline u32
|
|
sun8i_channel_base(struct sun8i_mixer *mixer, int channel)
|
|
{
|
|
- if (mixer->cfg->is_de3)
|
|
+ if (mixer->cfg->de_type == sun8i_mixer_de3)
|
|
return DE3_CH_BASE + channel * DE3_CH_SIZE;
|
|
else
|
|
return DE2_CH_BASE + channel * DE2_CH_SIZE;
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c b/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c
|
|
index ae0806bccac7..504ffa0971a4 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c
|
|
@@ -93,7 +93,7 @@ static u32 sun8i_ui_scaler_base(struct sun8i_mixer *mixer, int channel)
|
|
{
|
|
int vi_num = mixer->cfg->vi_num;
|
|
|
|
- if (mixer->cfg->is_de3)
|
|
+ if (mixer->cfg->de_type == sun8i_mixer_de3)
|
|
return DE3_VI_SCALER_UNIT_BASE +
|
|
DE3_VI_SCALER_UNIT_SIZE * vi_num +
|
|
DE3_UI_SCALER_UNIT_SIZE * (channel - vi_num);
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
|
|
index 3c657b069d1f..4647e9bcccaa 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
|
|
@@ -25,7 +25,7 @@ static void sun8i_vi_layer_update_alpha(struct sun8i_mixer *mixer, int channel,
|
|
|
|
ch_base = sun8i_channel_base(mixer, channel);
|
|
|
|
- if (mixer->cfg->is_de3) {
|
|
+ if (mixer->cfg->de_type >= sun8i_mixer_de3) {
|
|
mask = SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA_MASK |
|
|
SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA_MODE_MASK;
|
|
val = SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA
|
|
@@ -483,7 +483,7 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
|
layer->channel = index;
|
|
layer->overlay = 0;
|
|
|
|
- if (mixer->cfg->is_de3) {
|
|
+ if (mixer->cfg->de_type >= sun8i_mixer_de3) {
|
|
formats = sun8i_vi_layer_de3_formats;
|
|
format_count = ARRAY_SIZE(sun8i_vi_layer_de3_formats);
|
|
} else {
|
|
@@ -507,7 +507,7 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
|
|
|
plane_cnt = mixer->cfg->ui_num + mixer->cfg->vi_num;
|
|
|
|
- if (mixer->cfg->vi_num == 1 || mixer->cfg->is_de3) {
|
|
+ if (mixer->cfg->vi_num == 1 || mixer->cfg->de_type >= sun8i_mixer_de3) {
|
|
ret = drm_plane_create_alpha_property(&layer->plane);
|
|
if (ret) {
|
|
dev_err(drm->dev, "Couldn't add alpha property\n");
|
|
@@ -524,7 +524,7 @@ struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
|
|
|
supported_encodings = BIT(DRM_COLOR_YCBCR_BT601) |
|
|
BIT(DRM_COLOR_YCBCR_BT709);
|
|
- if (mixer->cfg->is_de3)
|
|
+ if (mixer->cfg->de_type >= sun8i_mixer_de3)
|
|
supported_encodings |= BIT(DRM_COLOR_YCBCR_BT2020);
|
|
|
|
supported_ranges = BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
|
|
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c b/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c
|
|
index 2e49a6e5f1f1..aa346c3beb30 100644
|
|
--- a/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c
|
|
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c
|
|
@@ -835,7 +835,7 @@ static const u32 bicubic4coefftab32[480] = {
|
|
|
|
static u32 sun8i_vi_scaler_base(struct sun8i_mixer *mixer, int channel)
|
|
{
|
|
- if (mixer->cfg->is_de3)
|
|
+ if (mixer->cfg->de_type == sun8i_mixer_de3)
|
|
return DE3_VI_SCALER_UNIT_BASE +
|
|
DE3_VI_SCALER_UNIT_SIZE * channel;
|
|
else
|
|
@@ -982,7 +982,7 @@ void sun8i_vi_scaler_setup(struct sun8i_mixer *mixer, int layer,
|
|
cvphase = vphase;
|
|
}
|
|
|
|
- if (mixer->cfg->is_de3) {
|
|
+ if (mixer->cfg->de_type >= sun8i_mixer_de3) {
|
|
u32 val;
|
|
|
|
if (format->hsub == 1 && format->vsub == 1)
|
|
--
|
|
2.35.3
|
|
|