Skip to contentSkip to conversation

drm: atmel-hlcdc: bypass LCDC pixel clock divider when using LCDC Generic Clock

PATCH In review Manikandan Muralidharan 2 participants 2 messages Oct 10, 2024

Subsystems (5)
lore
Share & tools
lore

Manikandan Muralidharan

author maintainer
#0 lore raw

PATCH 1/1 drm: atmel-hlcdc: bypass LCDC pixel clock divider when using LCDC Generic Clock

In sam9x7 SoC where XLCDC IP is used,add support to bypass the LCDC pixel clock divider when LCDC Generic clock is enabled.Used to match and drive the panel requested Pixel clock.

---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 8 +++++++-
 include/linux/mfd/atmel-hlcdc.h                | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +7 -1
index 0f7ffb3ced20..c54770cecaa8 100644
@@ -146,13 +146,19 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
 
 		if (div_low >= 2 &&
 		    (10 * (prate / div_low - mode_rate) <
-		     (mode_rate - prate / div)))
+		     (mode_rate - prate / div))) {
 			/*
 			 * At least 10 times better when using a higher
 			 * frequency than requested, instead of a lower.
 			 * So, go with that.
 			 */
 			div = div_low;
+		} else {
+			if (crtc->dc->desc->is_xlcdc) {
+				cfg |= ATMEL_XLCDC_CLKBYP;
+				mask |= ATMEL_XLCDC_CLKBYP;
+			}
+		}
 	}
 
 	cfg |= ATMEL_HLCDC_CLKDIV(div);
include/linux/mfd/atmel-hlcdc.h +1 -0
index 80d675a03b39..982f494e6307 100644
@@ -44,6 +44,7 @@
 #define ATMEL_XLCDC_HEO_UPDATE		BIT(3)
 
 #define ATMEL_HLCDC_CLKPOL		BIT(0)
+#define ATMEL_XLCDC_CLKBYP		BIT(1)
 #define ATMEL_HLCDC_CLKSEL		BIT(2)
 #define ATMEL_HLCDC_CLKPWMSEL		BIT(3)
 #define ATMEL_HLCDC_CGDIS(i)		BIT(8 + (i))
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Manikandan Muralidharan

In sam9x7 SoC where XLCDC IP is used,add support to bypass the LCDC pixel clock divider when LCDC Generic clock is enabled.Used to match and drive the panel requested Pixel clock.

---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 8 +++++++-
 include/linux/mfd/atmel-hlcdc.h                | 1 +
Quoted 42 lines
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +7 -1
index 0f7ffb3ced20..c54770cecaa8 100644
@@ -146,13 +146,19 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
 
 		if (div_low >= 2 &&
 		    (10 * (prate / div_low - mode_rate) <
-		     (mode_rate - prate / div)))
+		     (mode_rate - prate / div))) {
 			/*
 			 * At least 10 times better when using a higher
 			 * frequency than requested, instead of a lower.
 			 * So, go with that.
 			 */
 			div = div_low;
+		} else {
+			if (crtc->dc->desc->is_xlcdc) {
+				cfg |= ATMEL_XLCDC_CLKBYP;
+				mask |= ATMEL_XLCDC_CLKBYP;
+			}
+		}
 	}
 
 	cfg |= ATMEL_HLCDC_CLKDIV(div);
include/linux/mfd/atmel-hlcdc.h +1 -0
index 80d675a03b39..982f494e6307 100644
@@ -44,6 +44,7 @@
 #define ATMEL_XLCDC_HEO_UPDATE		BIT(3)
 
 #define ATMEL_HLCDC_CLKPOL		BIT(0)
+#define ATMEL_XLCDC_CLKBYP		BIT(1)
 #define ATMEL_HLCDC_CLKSEL		BIT(2)
 #define ATMEL_HLCDC_CLKPWMSEL		BIT(3)
 #define ATMEL_HLCDC_CGDIS(i)		BIT(8 + (i))
Signature · 1 line
2.25.1
Signature · 1 line
Lee Jones [李琼斯]