On Thu, Jul 21, 2016 at 7:15 AM, Ryan <ryanphilips19@xxxxxxxxxxxxxx> wrote: > Hey, > > Can i dump the gpio states just before exynos is put to sleep? > > What would be the best place to do that? are there any example drivers which > can do this? I assume that /sys/kernel/debug/gpio is not sufficient... I got some old debug code (for 3.10 :) ) for dumping the registers. Feel free to use it under GPLv2 (derivative work from Linux kernel) - attached. If you need specific values you would have to decode the data into something readable. Best regards, Krzysztof
From bfd789387cc67eb34752be4c40e4e494e499bec6 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski <k.kozlowski@xxxxxxxxxxx> Date: Thu, 13 Feb 2014 15:03:47 +0100 Subject: [PATCH] pinctrl: exynos: Dump GPIO on suspend and resume --- drivers/pinctrl/pinctrl-exynos.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c index 4c84e61f9c44..6931bd024913 100644 --- a/drivers/pinctrl/pinctrl-exynos.c +++ b/drivers/pinctrl/pinctrl-exynos.c @@ -613,12 +613,37 @@ static void exynos_pinctrl_suspend_bank( pr_debug("%s: save fltcon1 %#010x\n", bank->name, save->eint_fltcon1); } +static void exynos_pinctrl_dump(struct samsung_pinctrl_drv_data *drvdata) +{ + struct samsung_pin_ctrl *ctrl = drvdata->ctrl; + struct samsung_pin_bank *bank = ctrl->pin_banks; + void __iomem *regs = drvdata->virt_base; + int i; + + for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { + pr_info("GPIO: %4s %08x: %#010x %#010x %#010x\n", + bank->name, + bank->pctl_offset, + readl(regs + bank->pctl_offset), + readl(regs + bank->pctl_offset + 0x04), + readl(regs + bank->pctl_offset + 0x08)); + pr_info("GPIO: %4s %08x: %#010x %#010x %#010x\n", + bank->name, + bank->pctl_offset, + readl(regs + bank->pctl_offset + 0x0c), + readl(regs + bank->pctl_offset + 0x10), + readl(regs + bank->pctl_offset + 0x14)); + } +} + static void exynos_pinctrl_suspend(struct samsung_pinctrl_drv_data *drvdata) { struct samsung_pin_ctrl *ctrl = drvdata->ctrl; struct samsung_pin_bank *bank = ctrl->pin_banks; int i; + exynos_pinctrl_dump(drvdata); + for (i = 0; i < ctrl->nr_banks; ++i, ++bank) if (bank->eint_type == EINT_TYPE_GPIO) exynos_pinctrl_suspend_bank(drvdata, bank); @@ -658,6 +683,8 @@ static void exynos_pinctrl_resume(struct samsung_pinctrl_drv_data *drvdata) for (i = 0; i < ctrl->nr_banks; ++i, ++bank) if (bank->eint_type == EINT_TYPE_GPIO) exynos_pinctrl_resume_bank(drvdata, bank); + + exynos_pinctrl_dump(drvdata); } /* pin banks of exynos3250 pin-controller 0 */ -- 1.7.9.5