]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mfd: atmel-hlcdc: Fetch LVDS PLL clock for LVDS display
authorManikandan Muralidharan <manikandan.m@microchip.com>
Mon, 23 Feb 2026 10:19:17 +0000 (15:49 +0530)
committerLee Jones <lee@kernel.org>
Wed, 25 Mar 2026 12:44:57 +0000 (12:44 +0000)
The XLCDC IP supports parallel RGB, MIPI DSI and LVDS Display.
The LCD Generic clock (sys_clk) is used for Parallel RGB and MIPI
displays, while the LVDS PLL clock (lvds_pll_clk) is used for LVDS
displays.Since both the clocks cannot co-exist together in the DT
for a given display, this patch tries sys_clk first (RGB/MIPI),
fallback to lvds_pll_clk (LVDS).

Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Signed-off-by: Dharma Balasubiramani <dharma.b@microchip.com>
Link: https://patch.msgid.link/20260223101920.284697-2-manikandan.m@microchip.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/atmel-hlcdc.c
include/linux/mfd/atmel-hlcdc.h

index c3f3d39bf58455c1c468074ec4db7f03054b03fb..0b541c0d3b1b87df01856f274e089b66f1e8ef7d 100644 (file)
@@ -108,10 +108,19 @@ static int atmel_hlcdc_probe(struct platform_device *pdev)
                return PTR_ERR(hlcdc->periph_clk);
        }
 
+       /*
+        * Retrieve one of the primary clocks required for LCD operation:
+        * prefer sys_clk (for RGB/MIPI), and fall back to lvds_pll_clk
+        * (for LVDS) if needed.
+        */
        hlcdc->sys_clk = devm_clk_get(dev, "sys_clk");
        if (IS_ERR(hlcdc->sys_clk)) {
-               dev_err(dev, "failed to get system clock\n");
-               return PTR_ERR(hlcdc->sys_clk);
+               hlcdc->sys_clk = NULL;
+               hlcdc->lvds_pll_clk = devm_clk_get(dev, "lvds_pll_clk");
+               if (IS_ERR(hlcdc->lvds_pll_clk)) {
+                       dev_err(dev, "Failed to obtain both the LCDC (generic) and LVDS PLL clocks\n");
+                       return PTR_ERR(hlcdc->lvds_pll_clk);
+               }
        }
 
        hlcdc->slow_clk = devm_clk_get(dev, "slow_clk");
index 80d675a03b3953c3e964c59ffb8aca8c06b5685d..07c2081867fd6aa58ec2e8d97f6863594cf6a0d6 100644 (file)
@@ -75,6 +75,7 @@
  */
 struct atmel_hlcdc {
        struct regmap *regmap;
+       struct clk *lvds_pll_clk;
        struct clk *periph_clk;
        struct clk *sys_clk;
        struct clk *slow_clk;