Skip to contentSkip to conversation

drm/tilcdc: Fix setting clock divider for omap-l138

PATCH In review David Lechner 2 participants 4 messages Mar 14, 2018 – May 9, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/tilcdc: Fix setting clock divider for omap-l138

This fixes setting the clock divider on the TI OMAP-L138 LCDK board.

The clock drivers for OMAP-L138 are being covernted to the common clock framework. When this happens, clk_set_rate() will no longer return an error. However, on this SoC, the clock rate cannot actually be changed because the clock has to maintain a fixed ratio to the ARM clock. So after attempting to set the clock rate, we need to check to see if the new rate is actually close enough. If not, then follow the previous error path to adjust the divider in LCDC IP block to compensate for not being able to change the parent clock rate.

Tested working on a TI OMAP-L138 LCDK board.

---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +1 -1
index 8bf6bb9..6931777 100644
@@ -224,7 +224,7 @@ static void tilcdc_crtc_set_clk(struct drm_crtc *crtc)
 
 	ret = clk_set_rate(priv->clk, req_rate * clkdiv);
 	clk_rate = clk_get_rate(priv->clk);
-	if (ret < 0) {
+	if (ret < 0 || tilcdc_pclk_diff(req_rate, clk_rate) > 5) {
 		/*
 		 * If we fail to set the clock rate (some architectures don't
 		 * use the common clock framework yet and may not implement
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Thanks,
I'll pick this for v4.18.

Best regards,
Jyri

Quoted 32 lines · David Lechner

This fixes setting the clock divider on the TI OMAP-L138 LCDK board.

The clock drivers for OMAP-L138 are being covernted to the common clock framework. When this happens, clk_set_rate() will no longer return an error. However, on this SoC, the clock rate cannot actually be changed because the clock has to maintain a fixed ratio to the ARM clock. So after attempting to set the clock rate, we need to check to see if the new rate is actually close enough. If not, then follow the previous error path to adjust the divider in LCDC IP block to compensate for not being able to change the parent clock rate.

Tested working on a TI OMAP-L138 LCDK board.

---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +1 -1
index 8bf6bb9..6931777 100644
@@ -224,7 +224,7 @@ static void tilcdc_crtc_set_clk(struct drm_crtc *crtc)
 
 	ret = clk_set_rate(priv->clk, req_rate * clkdiv);
 	clk_rate = clk_get_rate(priv->clk);
-	if (ret < 0) {
+	if (ret < 0 || tilcdc_pclk_diff(req_rate, clk_rate) > 5) {
 		/*
 		 * If we fail to set the clock rate (some architectures don't
 		 * use the common clock framework yet and may not implement
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#2 lore raw
Quoted 2 lines · Jyri Sarha

Thanks,
I'll pick this for v4.18.

Ping. I don't see this in drm-misc-next yet.

#3 lore raw
Quoted 6 lines · David Lechner
Quoted 2 lines · Jyri Sarha

Thanks,
I'll pick this for v4.18.

Ping. I don't see this in drm-misc-next yet.

Thanks for the ping. I thought I would have time to do something more for tilcdc in v4.18, but it seems I have not. After testing I just sent a tilcdc pull request with just this patch.

Best regards,
Jyri

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel