Skip to content

Commit c0cbdda

Browse files
jernejskwens
authored andcommitted
drm/sun4i: vi_scaler: Update DE33 base calculation
Now that channel base calculation is straightforward, let's update VI scaler base calculation to be simpler. At the same time, also introduce macro to avoid magic numbers. Note, reason why current magic value and new macro value isn't the same is because sun8i_channel_base() already introduces offset to channel registers. Previous value is just the difference to VI scaler registers. However, new code calculates scaler base from channel base. This is also easier to understand when looking into BSP driver. Macro value can be easily found whereas old diff value was not. Reviewed-by: Chen-Yu Tsai <wens@kernel.org> Tested-by: Ryan Walklin <ryan@testtoast.com> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://patch.msgid.link/20251104180942.61538-24-jernej.skrabec@gmail.com Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
1 parent 5154417 commit c0cbdda

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/gpu/drm/sun4i/sun8i_vi_scaler.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,8 @@ static const u32 bicubic4coefftab32[480] = {
836836
static u32 sun8i_vi_scaler_base(struct sun8i_mixer *mixer, int channel)
837837
{
838838
if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
839-
return sun8i_channel_base(mixer, channel) + 0x3000;
839+
return DE33_VI_SCALER_UNIT_BASE +
840+
DE33_CH_SIZE * channel;
840841
else if (mixer->cfg->de_type == SUN8I_MIXER_DE3)
841842
return DE3_VI_SCALER_UNIT_BASE +
842843
DE3_VI_SCALER_UNIT_SIZE * channel;

drivers/gpu/drm/sun4i/sun8i_vi_scaler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#define DE3_VI_SCALER_UNIT_BASE 0x20000
1919
#define DE3_VI_SCALER_UNIT_SIZE 0x08000
2020

21+
#define DE33_VI_SCALER_UNIT_BASE 0x4000
22+
2123
/* this two macros assumes 16 fractional bits which is standard in DRM */
2224
#define SUN8I_VI_SCALER_SCALE_MIN 1
2325
#define SUN8I_VI_SCALER_SCALE_MAX ((1UL << 20) - 1)

0 commit comments

Comments
 (0)