Re: [PATCH 6/8] drm: atmel-hlcdc: add XLCDC clock bypass support for small dividers

From: Lee Jones

Date: Wed May 27 2026 - 11:03:49 EST


On Tue, 19 May 2026, Manikandan Muralidharan wrote:

> Define ATMEL_XLCDC_CLKBYP and set the clock bypass bit on XLCDC
> hardware when the computed divider is less than 2, avoiding an
> invalid divider value. Non-XLCDC hardware retains the existing
> minimum divider clamp of 2.
>
> Signed-off-by: Manikandan Muralidharan <manikandan.m@xxxxxxxxxxxxx>
> ---
> drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 7 +++++++
> include/linux/mfd/atmel-hlcdc.h | 1 +

Acked-by: Lee Jones <lee@xxxxxxxxxx>

> 2 files changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> index 6da428361c19..f837684654ea 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> @@ -87,6 +87,13 @@ static int atmel_hlcdc_crtc_setup_clock(struct atmel_hlcdc_crtc *crtc,
>
> div = DIV_ROUND_CLOSEST(prate, mode_rate);
> if (div < 2) {
> + /* XLCDC: bypass divider when div < 2 */
> + if (crtc->dc->desc->is_xlcdc) {
> + *cfg |= ATMEL_XLCDC_CLKBYP;
> + *mask |= ATMEL_XLCDC_CLKBYP;
> + return 0;
> + }
> + /* Enforce minimum divider for non-XLCDC */
> div = 2;
> } else if (ATMEL_HLCDC_CLKDIV(div) & ~ATMEL_HLCDC_CLKDIV_MASK) {
> /* The divider ended up too big, try a lower base rate. */
> diff --git a/include/linux/mfd/atmel-hlcdc.h b/include/linux/mfd/atmel-hlcdc.h
> index 8e86219293b7..1463c7db0e64 100644
> --- a/include/linux/mfd/atmel-hlcdc.h
> +++ b/include/linux/mfd/atmel-hlcdc.h
> @@ -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))
> --
> 2.25.1
>

--
Lee Jones