drm/radeon: ATOM Endian fix for atombios_crtc_program_pll()
Subsystems (2)
PATCH 2/6 drm/radeon: ATOM Endian fix for atombios_crtc_program_pll()
v6 of the structure was programmed incorrectly:
args.v6.ulCrtcPclkFreq.ulPixelClock = cpu_to_le32(clock / 10);
ulPixelClock is a 24-bit bitfield. This statement would thus do a 32-bit swap of (clock / 10) and drop the top 8 bits which are ... the LSB. Not what we want. Instead use masks & shifts.
---
(resent adding dri-devel to the CC list to hit patchwork)
drivers/gpu/drm/radeon/atombios_crtc.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +2 -3
@@ -764,7 +764,7 @@ static void atombios_crtc_set_dcpll(struct drm_crtc *crtc, } static void atombios_crtc_program_pll(struct drm_crtc *crtc, - int crtc_id, + u32 crtc_id, int pll_id, u32 encoder_mode, u32 encoder_id,
@@ -851,8 +851,7 @@ static void atombios_crtc_program_pll(struct drm_crtc *crtc, args.v5.ucPpll = pll_id;break ;case 6 : - args.v6.ulCrtcPclkFreq.ucCRTC = crtc_id; - args.v6.ulCrtcPclkFreq.ulPixelClock =cpu_to_le32 (clock /10 ); + args.v6.ulDispEngClkFreq =cpu_to_le32 (crtc_id <<24 | clock /10 ); args.v6.ucRefDiv = ref_div; args.v6.usFbDiv =cpu_to_le16 (fb_div); args.v6.ulFbDivDecFrac =cpu_to_le32 (frac_fb_div *100000 );
Quoted 32 lines · Benjamin Herrenschmidt
v6 of the structure was programmed incorrectly:
args.v6.ulCrtcPclkFreq.ulPixelClock =
cpu_to_le32(clock / 10);ulPixelClock is a 24-bit bitfield. This statement would thus do a 32-bit swap of (clock / 10) and drop the top 8 bits which are ... the LSB. Not what we want. Instead use masks & shifts.
Signed-off-by Benjamin Herrenschmidt <[email protected]>---
(resent adding dri-devel to the CC list to hit patchwork)
drivers/gpu/drm/radeon/atombios_crtc.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/radeon/atombios_crtc.c +1
-1@@ -764,7 +764,7 @@ static void atombios_crtc_set_dcpll(struct drm_crtc *crtc, } static void atombios_crtc_program_pll(struct drm_crtc *crtc, - int crtc_id, + u32 crtc_id, int pll_id, u32 encoder_mode, u32 encoder_id,@@ -851,8 +851,7 @@ static void atombios_crtc_program_pll(struct drm_crtc *crtc, args.v5.ucPpll = pll_id; break;
Quoted 4 lines
case 6:
- args.v6.ulCrtcPclkFreq.ucCRTC =crtc_id;
- args.v6.ulCrtcPclkFreq.ulPixelClock =cpu_to_le32(clock / 10);
+ args.v6.ulDispEngClkFreq =cpu_to_le32(crtc_id << 24 | clock / 10);
For clarity (i can never remember op precedence), you might put:
cpu_to_le32((crtc_id << 24) | (clock / 10));
Other than that,
Quoted 7 lines
args.v6.ucRefDiv =
ref_div;
args.v6.usFbDiv =cpu_to_le16(fb_div); args.v6.ulFbDivDecFrac =cpu_to_le32(frac_fb_div * 100000);
Quoted 8 lines · Alex Deucher
drivers/gpu/drm/radeon/atombios_crtc.c static void atombios_crtc_program_pll(struct drm_crtc *crtc, · line 854
Quoted 4 lines
case 6:drivers/gpu/drm/radeon/atombios_crtc.c +1
-2- args.v6.ulCrtcPclkFreq.ucCRTC = crtc_id; - args.v6.ulCrtcPclkFreq.ulPixelClock =cpu_to_le32 (clock /10 ); + args.v6.ulDispEngClkFreq =cpu_to_le32 (crtc_id <<24 | clock /10 );For clarity (i can never remember op precedence), you might put:
cpu_to_le32((crtc_id << 24) | (clock / 10));
I can't either but I have a nice chart printed on my wall :-)
I can respin if you really want but the above is correct.
Cheers,
Ben.
Quoted 12 lines
Other than that,
Reviewed-by Alex Deucher <[email protected]>Quoted 7 lines
args.v6.ucRefDiv = ref_div; args.v6.usFbDiv = cpu_to_le16(fb_div); args.v6.ulFbDivDecFrac = cpu_to_le32(frac_fb_div * 100000);
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 5 lines · Alex Deucher
Quoted 4 lines
case 6:
- args.v6.ulCrtcPclkFreq.ucCRTC =crtc_id;
- args.v6.ulCrtcPclkFreq.ulPixelClock =cpu_to_le32(clock / 10);
+ args.v6.ulDispEngClkFreq =cpu_to_le32(crtc_id << 24 | clock / 10);
Quoted 7 lines
Quoted 3 lines
For clarity (i can never remember op precedence), you might put:
cpu_to_le32((crtc_id << 24) | (clock / 10));I can't either but I have a nice chart printed on my wall :-)
I can respin if you really want but the above is correct.
That's fine as is then.
Alex
Quoted 19 lines
Cheers,
Ben.Quoted 12 lines
Other than that,
Reviewed-by Alex Deucher <[email protected]>Quoted 7 lines
args.v6.ucRefDiv =
ref_div;
args.v6.usFbDiv =cpu_to_le16(fb_div); args.v6.ulFbDivDecFrac =cpu_to_le32(frac_fb_div * 100000);