Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1205015 > unrolled thread

[PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of rk3288 critical clocks

Started byLin Huang <hl@rock-chips.com>
First post2015-08-11 12:20 +0200
Last post2015-08-13 16:20 +0200
Articles 10 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of rk3288 critical clocks Lin Huang <hl@rock-chips.com> - 2015-08-11 12:20 +0200
    [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting Lin Huang <hl@rock-chips.com> - 2015-08-11 12:20 +0200
      Re: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting Doug Anderson <dianders@chromium.org> - 2015-08-12 01:00 +0200
      Re: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting Linus Walleij <linus.walleij@linaro.org> - 2015-08-13 14:30 +0200
        Re: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting Heiko Stübner <heiko@sntech.de> - 2015-08-13 14:40 +0200
          Re: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting Linus Walleij <linus.walleij@linaro.org> - 2015-08-13 16:20 +0200
            Re: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting Heiko Stübner <heiko@sntech.de> - 2015-08-13 17:00 +0200
    Re: [PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of  rk3288 critical clocks Doug Anderson <dianders@chromium.org> - 2015-08-12 01:00 +0200
    Re: [PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of  rk3288 critical clocks Stephen Boyd <sboyd@codeaurora.org> - 2015-08-12 01:10 +0200
    Re: [PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of  rk3288 critical clocks Linus Walleij <linus.walleij@linaro.org> - 2015-08-13 16:20 +0200

#1205015 — [PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of rk3288 critical clocks

FromLin Huang <hl@rock-chips.com>
Date2015-08-11 12:20 +0200
Subject[PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of rk3288 critical clocks
Message-ID<pWeP1-27X-49@gated-at.bofh.it>
From: Heiko Stuebner <heiko@sntech.de>

pclk_pd_pmu needs to keep running and with the upcoming gpio clock
handling this is not always the case anymore. So add it to the list
of critical clocks for now.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Lin Huang <hl@rock-chips.com>
---
Changes in v5:
- Add From: Heiko Stuebner <heiko@sntech.de>
- Add Signed-off-by: Heiko Stuebner <heiko@sntech.de>

 drivers/clk/rockchip/clk-rk3288.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
index 0df5bae..9040878 100644
--- a/drivers/clk/rockchip/clk-rk3288.c
+++ b/drivers/clk/rockchip/clk-rk3288.c
@@ -780,6 +780,7 @@ static const char *const rk3288_critical_clocks[] __initconst = {
 	"aclk_cpu",
 	"aclk_peri",
 	"hclk_peri",
+	"pclk_pd_pmu",
 };
 
 #ifdef CONFIG_PM_SLEEP
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1205018 — [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting

FromLin Huang <hl@rock-chips.com>
Date2015-08-11 12:20 +0200
Subject[PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting
Message-ID<pWeP1-27X-47@gated-at.bofh.it>
In reply to#1205015
gpio can keep state even the clock disable, for save power
consumption, only enable gpio clock when it setting

Signed-off-by: Lin Huang <hl@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
---
Changes in v5:
-rebase patch

 drivers/pinctrl/pinctrl-rockchip.c | 55 +++++++++++++++++++++++++++++++++++---
 1 file changed, 51 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index cc2843a..c5246c0 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -945,6 +945,7 @@ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip,
 	if (ret < 0)
 		return ret;
 
+	clk_enable(bank->clk);
 	spin_lock_irqsave(&bank->slock, flags);
 
 	data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR);
@@ -956,6 +957,7 @@ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip,
 	writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR);
 
 	spin_unlock_irqrestore(&bank->slock, flags);
+	clk_disable(bank->clk);
 
 	return 0;
 }
@@ -1389,6 +1391,7 @@ static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
 	unsigned long flags;
 	u32 data;
 
+	clk_enable(bank->clk);
 	spin_lock_irqsave(&bank->slock, flags);
 
 	data = readl(reg);
@@ -1398,6 +1401,7 @@ static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
 	writel(data, reg);
 
 	spin_unlock_irqrestore(&bank->slock, flags);
+	clk_disable(bank->clk);
 }
 
 /*
@@ -1409,7 +1413,9 @@ static int rockchip_gpio_get(struct gpio_chip *gc, unsigned offset)
 	struct rockchip_pin_bank *bank = gc_to_pin_bank(gc);
 	u32 data;
 
+	clk_enable(bank->clk);
 	data = readl(bank->reg_base + GPIO_EXT_PORT);
+	clk_disable(bank->clk);
 	data >>= offset;
 	data &= 1;
 	return data;
@@ -1546,6 +1552,7 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
 	if (ret < 0)
 		return ret;
 
+	clk_enable(bank->clk);
 	spin_lock_irqsave(&bank->slock, flags);
 
 	data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR);
@@ -1603,6 +1610,7 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
 	default:
 		irq_gc_unlock(gc);
 		spin_unlock_irqrestore(&bank->slock, flags);
+		clk_disable(bank->clk);
 		return -EINVAL;
 	}
 
@@ -1611,6 +1619,7 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
 
 	irq_gc_unlock(gc);
 	spin_unlock_irqrestore(&bank->slock, flags);
+	clk_disable(bank->clk);
 
 	return 0;
 }
@@ -1620,8 +1629,10 @@ static void rockchip_irq_suspend(struct irq_data *d)
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct rockchip_pin_bank *bank = gc->private;
 
+	clk_enable(bank->clk);
 	bank->saved_masks = irq_reg_readl(gc, GPIO_INTMASK);
 	irq_reg_writel(gc, ~gc->wake_active, GPIO_INTMASK);
+	clk_disable(bank->clk);
 }
 
 static void rockchip_irq_resume(struct irq_data *d)
@@ -1629,7 +1640,27 @@ static void rockchip_irq_resume(struct irq_data *d)
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct rockchip_pin_bank *bank = gc->private;
 
+	clk_enable(bank->clk);
 	irq_reg_writel(gc, bank->saved_masks, GPIO_INTMASK);
+	clk_disable(bank->clk);
+}
+
+static void rockchip_irq_gc_mask_clr_bit(struct irq_data *d)
+{
+	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+	struct rockchip_pin_bank *bank = gc->private;
+
+	clk_enable(bank->clk);
+	irq_gc_mask_clr_bit(d);
+}
+
+void rockchip_irq_gc_mask_set_bit(struct irq_data *d)
+{
+	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+	struct rockchip_pin_bank *bank = gc->private;
+
+	irq_gc_mask_set_bit(d);
+	clk_disable(bank->clk);
 }
 
 static int rockchip_interrupts_register(struct platform_device *pdev,
@@ -1640,7 +1671,7 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
 	unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
 	struct irq_chip_generic *gc;
 	int ret;
-	int i;
+	int i, j;
 
 	for (i = 0; i < ctrl->nr_banks; ++i, ++bank) {
 		if (!bank->valid) {
@@ -1649,11 +1680,19 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
 			continue;
 		}
 
+		ret = clk_enable(bank->clk);
+		if (ret) {
+			dev_err(&pdev->dev, "failed to enable clock for bank %s\n",
+				bank->name);
+			continue;
+		}
+
 		bank->domain = irq_domain_add_linear(bank->of_node, 32,
 						&irq_generic_chip_ops, NULL);
 		if (!bank->domain) {
 			dev_warn(&pdev->dev, "could not initialize irq domain for bank %s\n",
 				 bank->name);
+			clk_disable(bank->clk);
 			continue;
 		}
 
@@ -1664,6 +1703,7 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
 			dev_err(&pdev->dev, "could not alloc generic chips for bank %s\n",
 				bank->name);
 			irq_domain_remove(bank->domain);
+			clk_disable(bank->clk);
 			continue;
 		}
 
@@ -1681,8 +1721,9 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
 		gc->chip_types[0].regs.mask = GPIO_INTMASK;
 		gc->chip_types[0].regs.ack = GPIO_PORTS_EOI;
 		gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit;
-		gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
-		gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
+		gc->chip_types[0].chip.irq_mask = rockchip_irq_gc_mask_set_bit;
+		gc->chip_types[0].chip.irq_unmask =
+						  rockchip_irq_gc_mask_clr_bit;
 		gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake;
 		gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend;
 		gc->chip_types[0].chip.irq_resume = rockchip_irq_resume;
@@ -1691,6 +1732,12 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
 
 		irq_set_chained_handler_and_data(bank->irq,
 						 rockchip_irq_demux, bank);
+
+		/* map the gpio irqs here, when the clock is still running */
+		for (j = 0 ; j < 32 ; j++)
+			irq_create_mapping(bank->domain, j);
+
+		clk_disable(bank->clk);
 	}
 
 	return 0;
@@ -1808,7 +1855,7 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
 	if (IS_ERR(bank->clk))
 		return PTR_ERR(bank->clk);
 
-	return clk_prepare_enable(bank->clk);
+	return clk_prepare(bank->clk);
 }
 
 static const struct of_device_id rockchip_pinctrl_dt_match[];
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1205480 — Re: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting

FromDoug Anderson <dianders@chromium.org>
Date2015-08-12 01:00 +0200
SubjectRe: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting
Message-ID<pWqGu-2kd-17@gated-at.bofh.it>
In reply to#1205018
Hi,

On Tue, Aug 11, 2015 at 3:12 AM, Lin Huang <hl@rock-chips.com> wrote:
> gpio can keep state even the clock disable, for save power
> consumption, only enable gpio clock when it setting
>
> Signed-off-by: Lin Huang <hl@rock-chips.com>
> Reviewed-by: Heiko Stuebner <heiko@sntech.de>
> ---
> Changes in v5:
> -rebase patch
>
>  drivers/pinctrl/pinctrl-rockchip.c | 55 +++++++++++++++++++++++++++++++++++---
>  1 file changed, 51 insertions(+), 4 deletions(-)

Reviewed-by: Douglas Anderson <dianders@chromium.org>

Also in the ChromeOS 3.14 tree (where this patch has been backported):

Tested-by: Douglas Anderson <dianders@chromium.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1206771 — Re: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting

FromLinus Walleij <linus.walleij@linaro.org>
Date2015-08-13 14:30 +0200
SubjectRe: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting
Message-ID<pWZNT-3cO-3@gated-at.bofh.it>
In reply to#1205018
On Tue, Aug 11, 2015 at 12:12 PM, Lin Huang <hl@rock-chips.com> wrote:

> gpio can keep state even the clock disable, for save power
> consumption, only enable gpio clock when it setting
>
> Signed-off-by: Lin Huang <hl@rock-chips.com>
> Reviewed-by: Heiko Stuebner <heiko@sntech.de>
> ---
> Changes in v5:
> -rebase patch

Patch applied with Doug's test tags etc.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1206781 — Re: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting

FromHeiko Stübner <heiko@sntech.de>
Date2015-08-13 14:40 +0200
SubjectRe: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting
Message-ID<pWZXB-3o7-21@gated-at.bofh.it>
In reply to#1206771
Hi Linus,

Am Donnerstag, 13. August 2015, 14:24:28 schrieb Linus Walleij:
> On Tue, Aug 11, 2015 at 12:12 PM, Lin Huang <hl@rock-chips.com> wrote:
> > gpio can keep state even the clock disable, for save power
> > consumption, only enable gpio clock when it setting
> > 
> > Signed-off-by: Lin Huang <hl@rock-chips.com>
> > Reviewed-by: Heiko Stuebner <heiko@sntech.de>
> > ---
> > Changes in v5:
> > -rebase patch
> 
> Patch applied with Doug's test tags etc.

did you  also take the first patch?

Aka bot should probably stay together (hence Stephen's Ack for the clock 
change), as the dynamically controlling the gpio clocks exposes the 
pclk_pd_pmu.


Heiko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1206842 — Re: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting

FromLinus Walleij <linus.walleij@linaro.org>
Date2015-08-13 16:20 +0200
SubjectRe: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting
Message-ID<pX1wm-5Ix-21@gated-at.bofh.it>
In reply to#1206781
On Thu, Aug 13, 2015 at 2:37 PM, Heiko Stübner <heiko@sntech.de> wrote:

>> Patch applied with Doug's test tags etc.
>
> did you  also take the first patch?
>
> Aka bot should probably stay together (hence Stephen's Ack for the clock
> change), as the dynamically controlling the gpio clocks exposes the
> pclk_pd_pmu.

OK wasn't obvious to me, patch 1/2 applied to the pinctrl tree now.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1206883 — Re: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting

FromHeiko Stübner <heiko@sntech.de>
Date2015-08-13 17:00 +0200
SubjectRe: [PATCH v5 2/2] pinctrl: rockchip: only enable gpio clock when it setting
Message-ID<pX294-6rZ-3@gated-at.bofh.it>
In reply to#1206842
Am Donnerstag, 13. August 2015, 16:11:38 schrieb Linus Walleij:
> On Thu, Aug 13, 2015 at 2:37 PM, Heiko Stübner <heiko@sntech.de> wrote:
> >> Patch applied with Doug's test tags etc.
> > 
> > did you  also take the first patch?
> > 
> > Aka bot should probably stay together (hence Stephen's Ack for the clock
> > change), as the dynamically controlling the gpio clocks exposes the
> > pclk_pd_pmu.
> 
> OK wasn't obvious to me, patch 1/2 applied to the pinctrl tree now.

Thanks for picking patch 1/2 too.

Both me and Lin seem to have forgotten to mention this in this new revision 
(sorry about that), as it was discussed in a previous revision only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1205478 — Re: [PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of rk3288 critical clocks

FromDoug Anderson <dianders@chromium.org>
Date2015-08-12 01:00 +0200
SubjectRe: [PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of rk3288 critical clocks
Message-ID<pWqGt-2kd-11@gated-at.bofh.it>
In reply to#1205015
Hi,

On Tue, Aug 11, 2015 at 3:12 AM, Lin Huang <hl@rock-chips.com> wrote:
> From: Heiko Stuebner <heiko@sntech.de>
>
> pclk_pd_pmu needs to keep running and with the upcoming gpio clock
> handling this is not always the case anymore. So add it to the list
> of critical clocks for now.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Signed-off-by: Lin Huang <hl@rock-chips.com>
> ---
> Changes in v5:
> - Add From: Heiko Stuebner <heiko@sntech.de>
> - Add Signed-off-by: Heiko Stuebner <heiko@sntech.de>
>
>  drivers/clk/rockchip/clk-rk3288.c | 1 +
>  1 file changed, 1 insertion(+)

You forgot to carry forward my reviewed by:

Reviewed-by: Douglas Anderson <dianders@chromium.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1205485 — Re: [PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of rk3288 critical clocks

FromStephen Boyd <sboyd@codeaurora.org>
Date2015-08-12 01:10 +0200
SubjectRe: [PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of rk3288 critical clocks
Message-ID<pWqQa-2KZ-7@gated-at.bofh.it>
In reply to#1205015
On 08/11/2015 03:12 AM, Lin Huang wrote:
> From: Heiko Stuebner <heiko@sntech.de>
>
> pclk_pd_pmu needs to keep running and with the upcoming gpio clock
> handling this is not always the case anymore. So add it to the list
> of critical clocks for now.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Signed-off-by: Lin Huang <hl@rock-chips.com>
> ---
>

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1206845 — Re: [PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of rk3288 critical clocks

FromLinus Walleij <linus.walleij@linaro.org>
Date2015-08-13 16:20 +0200
SubjectRe: [PATCH v5 1/2] clk: rockchip: add pclk_pd_pmu to the list of rk3288 critical clocks
Message-ID<pX1wn-5Ix-27@gated-at.bofh.it>
In reply to#1205015
On Tue, Aug 11, 2015 at 12:12 PM, Lin Huang <hl@rock-chips.com> wrote:

> From: Heiko Stuebner <heiko@sntech.de>
>
> pclk_pd_pmu needs to keep running and with the upcoming gpio clock
> handling this is not always the case anymore. So add it to the list
> of critical clocks for now.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Signed-off-by: Lin Huang <hl@rock-chips.com>
> ---
> Changes in v5:
> - Add From: Heiko Stuebner <heiko@sntech.de>
> - Add Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Patch applied to the pinctrl tree with Doug's reviwe tag and
Stephen B's ACK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web