[PATCH v6 09/27] drm: sun4i: de3: refactor YUV formatter module setup

Ryan Walklin
2025-02-16T08:56:49Z

Because the format is stored in the mixer configuration, the formatter
module setup function no longer requires the color format to be passed
separately.

Remove this from the setup function declaration and access the format
via the mixer object.

Signed-off-by: Ryan Walklin <ryan@testtoast.com>

--
Changelog v5..v6:
- Add this commit updating the sun50i_fmt_setup function
---
drivers/gpu/drm/sun4i/sun50i_fmt.c | 5 +++--
drivers/gpu/drm/sun4i/sun50i_fmt.h | 3 +--
drivers/gpu/drm/sun4i/sun8i_mixer.c | 3 +--
3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun50i_fmt.c b/drivers/gpu/drm/sun4i/sun50i_fmt.c
index 050a8716ae862..376a3c9b993f4 100644
--- a/drivers/gpu/drm/sun4i/sun50i_fmt.c
+++ b/drivers/gpu/drm/sun4i/sun50i_fmt.c
@@ -51,13 +51,14 @@ static void sun50i_fmt_de3_limits(u32 *limits, u32 colorspace, bool bit10)
}
}

-void sun50i_fmt_setup(struct sun8i_mixer *mixer, u16 width,
- u16 height, u32 format)
+void sun50i_fmt_setup(struct sun8i_mixer *mixer, u16 width, u16 height)
{
u32 colorspace, limit[3], base;
struct regmap *regs;
bool bit10;
+ u32 format;

+ format = mixer->color_model.format;
colorspace = sun50i_fmt_get_colorspace(format);
bit10 = sun50i_fmt_is_10bit(format);
base = SUN50I_FMT_DE3;
diff --git a/drivers/gpu/drm/sun4i/sun50i_fmt.h b/drivers/gpu/drm/sun4i/sun50i_fmt.h
index 4127f7206aade..dd6816c90dfcd 100644
--- a/drivers/gpu/drm/sun4i/sun50i_fmt.h
+++ b/drivers/gpu/drm/sun4i/sun50i_fmt.h
@@ -26,7 +26,6 @@
#define SUN50I_FMT_CS_YUV422 1
#define SUN50I_FMT_CS_YUV420 2

-void sun50i_fmt_setup(struct sun8i_mixer *mixer, u16 width,
- u16 height, u32 format);
+void sun50i_fmt_setup(struct sun8i_mixer *mixer, u16 width, u16 height);

#endif
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index bc934186bfd6f..3069329210085 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -405,8 +405,7 @@ static void sun8i_mixer_mode_set(struct sunxi_engine *engine,
SUN8I_MIXER_BLEND_ATTR_FCOLOR(bld_base, 0), val);

if (mixer->cfg->has_formatter)
- sun50i_fmt_setup(mixer, mode->hdisplay,
- mode->vdisplay, mixer->color_model.format);
+ sun50i_fmt_setup(mixer, mode->hdisplay, mode->vdisplay);
}

static u32 *sun8i_mixer_get_supported_fmts(struct sunxi_engine *engine, u32 *num)
--
2.48.1