diff options
| author | Jernej Skrabec <jernej.skrabec@gmail.com> | 2025-11-04 19:09:38 +0100 |
|---|---|---|
| committer | Chen-Yu Tsai <wens@kernel.org> | 2025-11-12 17:18:25 +0800 |
| commit | 5a96ae801f0ac39f85491d81b4f02e1a613107cd (patch) | |
| tree | ec73effe653f2e402581a9641cf897e773bdcb45 | |
| parent | a23e3402f65d1784e30b0b6654f5146905457a45 (diff) | |
drm/sun4i: mixer: Add quirk for number of VI scalers
On DE2 and DE3, UI scalers are located right after VI scalers. So in
order to calculate proper UI scaler base address, number of VI scalers
must be known. In practice, it is same as number of VI channels, but it
doesn't need to be.
Let's make a quirk for this number. Code for configuring channels and
associated functions won't have access to vi_num quirk anymore after
rework for independent planes.
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-27-jernej.skrabec@gmail.com
Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
| -rw-r--r-- | drivers/gpu/drm/sun4i/sun8i_mixer.c | 11 | ||||
| -rw-r--r-- | drivers/gpu/drm/sun4i/sun8i_mixer.h | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/sun4i/sun8i_ui_scaler.c | 10 |
3 files changed, 18 insertions, 5 deletions
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c index 86361564189c..446af7026259 100644 --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c @@ -706,6 +706,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, + .vi_scaler_num = 1, .scaler_mask = 0xf, .scanline_yuv = 2048, .de2_fcc_alpha = 1, @@ -716,6 +717,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, + .vi_scaler_num = 1, .scaler_mask = 0x3, .scanline_yuv = 2048, .de2_fcc_alpha = 1, @@ -727,6 +729,7 @@ static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = { .ccsc = CCSC_MIXER0_LAYOUT, .de_type = SUN8I_MIXER_DE2, .mod_rate = 432000000, + .vi_scaler_num = 1, .scaler_mask = 0xf, .scanline_yuv = 2048, .de2_fcc_alpha = 1, @@ -738,6 +741,7 @@ static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = { .ccsc = CCSC_MIXER0_LAYOUT, .de_type = SUN8I_MIXER_DE2, .mod_rate = 297000000, + .vi_scaler_num = 1, .scaler_mask = 0xf, .scanline_yuv = 2048, .de2_fcc_alpha = 1, @@ -749,6 +753,7 @@ static const struct sun8i_mixer_cfg sun8i_r40_mixer1_cfg = { .ccsc = CCSC_MIXER1_LAYOUT, .de_type = SUN8I_MIXER_DE2, .mod_rate = 297000000, + .vi_scaler_num = 1, .scaler_mask = 0x3, .scanline_yuv = 2048, .de2_fcc_alpha = 1, @@ -760,6 +765,7 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = { .de_type = SUN8I_MIXER_DE2, .vi_num = 2, .ui_num = 1, + .vi_scaler_num = 2, .scaler_mask = 0x3, .scanline_yuv = 2048, .ccsc = CCSC_MIXER0_LAYOUT, @@ -770,6 +776,7 @@ static const struct sun8i_mixer_cfg sun20i_d1_mixer0_cfg = { .ccsc = CCSC_D1_MIXER0_LAYOUT, .de_type = SUN8I_MIXER_DE2, .mod_rate = 297000000, + .vi_scaler_num = 1, .scaler_mask = 0x3, .scanline_yuv = 2048, .de2_fcc_alpha = 1, @@ -781,6 +788,7 @@ static const struct sun8i_mixer_cfg sun20i_d1_mixer1_cfg = { .ccsc = CCSC_MIXER1_LAYOUT, .de_type = SUN8I_MIXER_DE2, .mod_rate = 297000000, + .vi_scaler_num = 1, .scaler_mask = 0x1, .scanline_yuv = 1024, .de2_fcc_alpha = 1, @@ -792,6 +800,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer0_cfg = { .ccsc = CCSC_MIXER0_LAYOUT, .de_type = SUN8I_MIXER_DE2, .mod_rate = 297000000, + .vi_scaler_num = 1, .scaler_mask = 0xf, .scanline_yuv = 4096, .de2_fcc_alpha = 1, @@ -803,6 +812,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer1_cfg = { .ccsc = CCSC_MIXER1_LAYOUT, .de_type = SUN8I_MIXER_DE2, .mod_rate = 297000000, + .vi_scaler_num = 1, .scaler_mask = 0x3, .scanline_yuv = 2048, .de2_fcc_alpha = 1, @@ -813,6 +823,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer1_cfg = { static const struct sun8i_mixer_cfg sun50i_h6_mixer0_cfg = { .de_type = SUN8I_MIXER_DE3, .mod_rate = 600000000, + .vi_scaler_num = 1, .scaler_mask = 0xf, .scanline_yuv = 4096, .ui_num = 3, diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h index def07afd37e1..8c2e8005fc5b 100644 --- a/drivers/gpu/drm/sun4i/sun8i_mixer.h +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h @@ -167,6 +167,7 @@ enum sun8i_mixer_type { * struct sun8i_mixer_cfg - mixer HW configuration * @vi_num: number of VI channels * @ui_num: number of UI channels + * @vi_scaler_num: Number of VI scalers. Used on DE2 and DE3. * @scaler_mask: bitmask which tells which channel supports scaling * 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 @@ -183,6 +184,7 @@ enum sun8i_mixer_type { struct sun8i_mixer_cfg { int vi_num; int ui_num; + unsigned int vi_scaler_num; int scaler_mask; int ccsc; unsigned long mod_rate; diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c b/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c index c0947ccf675b..0ba1482688d7 100644 --- a/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c +++ b/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c @@ -91,16 +91,16 @@ static const u32 lan2coefftab16[240] = { static u32 sun8i_ui_scaler_base(struct sun8i_mixer *mixer, int channel) { - int vi_num = mixer->cfg->vi_num; + int offset = mixer->cfg->vi_scaler_num; 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); + DE3_VI_SCALER_UNIT_SIZE * offset + + DE3_UI_SCALER_UNIT_SIZE * (channel - offset); else return DE2_VI_SCALER_UNIT_BASE + - DE2_VI_SCALER_UNIT_SIZE * vi_num + - DE2_UI_SCALER_UNIT_SIZE * (channel - vi_num); + DE2_VI_SCALER_UNIT_SIZE * offset + + DE2_UI_SCALER_UNIT_SIZE * (channel - offset); } static int sun8i_ui_scaler_coef_index(unsigned int step) |