untitled paste

unlisted ⁨1⁩ ⁨file⁩ 2021-08-09 20:49:48 UTC

pinctrl_clock.diff

Raw
diff --git a/drivers/pinctrl/pinctrl-apple-gpio.c b/drivers/pinctrl/pinctrl-apple-gpio.c
index a16bf1c0a1f3..8a43a3100d74 100644
--- a/drivers/pinctrl/pinctrl-apple-gpio.c
+++ b/drivers/pinctrl/pinctrl-apple-gpio.c
@@ -8,6 +8,7 @@
  * Copyright (C) 2014 Google, Inc.
  */

+#include <linux/clk.h>
 #include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
@@ -445,6 +446,7 @@ static int apple_gpio_pinctrl_probe(struct platform_device *pdev)
 {
        struct apple_gpio_pinctrl *pctl;
        struct resource *rsrc;
+       struct clk *clk;
        int res;
        unsigned i;

@@ -504,6 +506,16 @@ static int apple_gpio_pinctrl_probe(struct platform_device *pdev)
        if(IS_ERR(pctl->base))
                return PTR_ERR(pctl->base);

+       clk = devm_clk_get(&pdev->dev, NULL);
+       if(IS_ERR(clk)) {
+               dev_err(&pdev->dev, "unable to get clock: %ld.\n", PTR_ERR(clk));
+               return PTR_ERR(clk);
+       }
+
+       res = clk_prepare_enable(clk);
+       if(res)
+               return res;
+
        for(i=0; i<pctl->npins; i++) {
                apple_gpio_init_reg(pctl, i);