Skip to content

Commit 5a96ae8

Browse files
jernejskwens
authored andcommitted
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>
1 parent a23e340 commit 5a96ae8

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

drivers/gpu/drm/sun4i/sun8i_mixer.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ static void sun8i_mixer_remove(struct platform_device *pdev)
706706
static const struct sun8i_mixer_cfg sun8i_a83t_mixer0_cfg = {
707707
.ccsc = CCSC_MIXER0_LAYOUT,
708708
.de_type = SUN8I_MIXER_DE2,
709+
.vi_scaler_num = 1,
709710
.scaler_mask = 0xf,
710711
.scanline_yuv = 2048,
711712
.de2_fcc_alpha = 1,
@@ -716,6 +717,7 @@ static const struct sun8i_mixer_cfg sun8i_a83t_mixer0_cfg = {
716717
static const struct sun8i_mixer_cfg sun8i_a83t_mixer1_cfg = {
717718
.ccsc = CCSC_MIXER1_LAYOUT,
718719
.de_type = SUN8I_MIXER_DE2,
720+
.vi_scaler_num = 1,
719721
.scaler_mask = 0x3,
720722
.scanline_yuv = 2048,
721723
.de2_fcc_alpha = 1,
@@ -727,6 +729,7 @@ static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
727729
.ccsc = CCSC_MIXER0_LAYOUT,
728730
.de_type = SUN8I_MIXER_DE2,
729731
.mod_rate = 432000000,
732+
.vi_scaler_num = 1,
730733
.scaler_mask = 0xf,
731734
.scanline_yuv = 2048,
732735
.de2_fcc_alpha = 1,
@@ -738,6 +741,7 @@ static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = {
738741
.ccsc = CCSC_MIXER0_LAYOUT,
739742
.de_type = SUN8I_MIXER_DE2,
740743
.mod_rate = 297000000,
744+
.vi_scaler_num = 1,
741745
.scaler_mask = 0xf,
742746
.scanline_yuv = 2048,
743747
.de2_fcc_alpha = 1,
@@ -749,6 +753,7 @@ static const struct sun8i_mixer_cfg sun8i_r40_mixer1_cfg = {
749753
.ccsc = CCSC_MIXER1_LAYOUT,
750754
.de_type = SUN8I_MIXER_DE2,
751755
.mod_rate = 297000000,
756+
.vi_scaler_num = 1,
752757
.scaler_mask = 0x3,
753758
.scanline_yuv = 2048,
754759
.de2_fcc_alpha = 1,
@@ -760,6 +765,7 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
760765
.de_type = SUN8I_MIXER_DE2,
761766
.vi_num = 2,
762767
.ui_num = 1,
768+
.vi_scaler_num = 2,
763769
.scaler_mask = 0x3,
764770
.scanline_yuv = 2048,
765771
.ccsc = CCSC_MIXER0_LAYOUT,
@@ -770,6 +776,7 @@ static const struct sun8i_mixer_cfg sun20i_d1_mixer0_cfg = {
770776
.ccsc = CCSC_D1_MIXER0_LAYOUT,
771777
.de_type = SUN8I_MIXER_DE2,
772778
.mod_rate = 297000000,
779+
.vi_scaler_num = 1,
773780
.scaler_mask = 0x3,
774781
.scanline_yuv = 2048,
775782
.de2_fcc_alpha = 1,
@@ -781,6 +788,7 @@ static const struct sun8i_mixer_cfg sun20i_d1_mixer1_cfg = {
781788
.ccsc = CCSC_MIXER1_LAYOUT,
782789
.de_type = SUN8I_MIXER_DE2,
783790
.mod_rate = 297000000,
791+
.vi_scaler_num = 1,
784792
.scaler_mask = 0x1,
785793
.scanline_yuv = 1024,
786794
.de2_fcc_alpha = 1,
@@ -792,6 +800,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer0_cfg = {
792800
.ccsc = CCSC_MIXER0_LAYOUT,
793801
.de_type = SUN8I_MIXER_DE2,
794802
.mod_rate = 297000000,
803+
.vi_scaler_num = 1,
795804
.scaler_mask = 0xf,
796805
.scanline_yuv = 4096,
797806
.de2_fcc_alpha = 1,
@@ -803,6 +812,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer1_cfg = {
803812
.ccsc = CCSC_MIXER1_LAYOUT,
804813
.de_type = SUN8I_MIXER_DE2,
805814
.mod_rate = 297000000,
815+
.vi_scaler_num = 1,
806816
.scaler_mask = 0x3,
807817
.scanline_yuv = 2048,
808818
.de2_fcc_alpha = 1,
@@ -813,6 +823,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer1_cfg = {
813823
static const struct sun8i_mixer_cfg sun50i_h6_mixer0_cfg = {
814824
.de_type = SUN8I_MIXER_DE3,
815825
.mod_rate = 600000000,
826+
.vi_scaler_num = 1,
816827
.scaler_mask = 0xf,
817828
.scanline_yuv = 4096,
818829
.ui_num = 3,

drivers/gpu/drm/sun4i/sun8i_mixer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ enum sun8i_mixer_type {
167167
* struct sun8i_mixer_cfg - mixer HW configuration
168168
* @vi_num: number of VI channels
169169
* @ui_num: number of UI channels
170+
* @vi_scaler_num: Number of VI scalers. Used on DE2 and DE3.
170171
* @scaler_mask: bitmask which tells which channel supports scaling
171172
* First, scaler supports for VI channels is defined and after that, scaler
172173
* support for UI channels. For example, if mixer has 2 VI channels without
@@ -183,6 +184,7 @@ enum sun8i_mixer_type {
183184
struct sun8i_mixer_cfg {
184185
int vi_num;
185186
int ui_num;
187+
unsigned int vi_scaler_num;
186188
int scaler_mask;
187189
int ccsc;
188190
unsigned long mod_rate;

drivers/gpu/drm/sun4i/sun8i_ui_scaler.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,16 @@ static const u32 lan2coefftab16[240] = {
9191

9292
static u32 sun8i_ui_scaler_base(struct sun8i_mixer *mixer, int channel)
9393
{
94-
int vi_num = mixer->cfg->vi_num;
94+
int offset = mixer->cfg->vi_scaler_num;
9595

9696
if (mixer->cfg->de_type == SUN8I_MIXER_DE3)
9797
return DE3_VI_SCALER_UNIT_BASE +
98-
DE3_VI_SCALER_UNIT_SIZE * vi_num +
99-
DE3_UI_SCALER_UNIT_SIZE * (channel - vi_num);
98+
DE3_VI_SCALER_UNIT_SIZE * offset +
99+
DE3_UI_SCALER_UNIT_SIZE * (channel - offset);
100100
else
101101
return DE2_VI_SCALER_UNIT_BASE +
102-
DE2_VI_SCALER_UNIT_SIZE * vi_num +
103-
DE2_UI_SCALER_UNIT_SIZE * (channel - vi_num);
102+
DE2_VI_SCALER_UNIT_SIZE * offset +
103+
DE2_UI_SCALER_UNIT_SIZE * (channel - offset);
104104
}
105105

106106
static int sun8i_ui_scaler_coef_index(unsigned int step)

0 commit comments

Comments
 (0)