Loading drivers/pinctrl/qcom/pinctrl-msm.c +54 −2 Original line number Diff line number Diff line /* * Copyright (c) 2013, Sony Mobile Communications AB. * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -27,6 +27,7 @@ #include <linux/gpio.h> #include <linux/interrupt.h> #include <linux/spinlock.h> #include <linux/syscore_ops.h> #include <linux/reboot.h> #include <linux/pm.h> #include <linux/log2.h> Loading Loading @@ -70,6 +71,8 @@ struct msm_pinctrl { void __iomem *regs; }; static struct msm_pinctrl *msm_pinctrl_data; static int msm_get_groups_count(struct pinctrl_dev *pctldev) { struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); Loading Loading @@ -866,6 +869,52 @@ static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl) } } #ifdef CONFIG_PM static int msm_pinctrl_suspend(void) { return 0; } static void msm_pinctrl_resume(void) { int i, irq; u32 val; unsigned long flags; struct irq_desc *desc; const struct msm_pingroup *g; const char *name = "null"; struct msm_pinctrl *pctrl = msm_pinctrl_data; if (!msm_show_resume_irq_mask) return; spin_lock_irqsave(&pctrl->lock, flags); for_each_set_bit(i, pctrl->enabled_irqs, pctrl->chip.ngpio) { g = &pctrl->soc->groups[i]; val = readl_relaxed(pctrl->regs + g->intr_status_reg); if (val & BIT(g->intr_status_bit)) { irq = irq_find_mapping(pctrl->chip.irqdomain, i); desc = irq_to_desc(irq); if (desc == NULL) name = "stray irq"; else if (desc->action && desc->action->name) name = desc->action->name; pr_warn("%s: %d triggered %s\n", __func__, irq, name); } } spin_unlock_irqrestore(&pctrl->lock, flags); } #else #define msm_pinctrl_suspend NULL #define msm_pinctrl_resume NULL #endif static struct syscore_ops msm_pinctrl_pm_ops = { .suspend = msm_pinctrl_suspend, .resume = msm_pinctrl_resume, }; int msm_pinctrl_probe(struct platform_device *pdev, const struct msm_pinctrl_soc_data *soc_data) { Loading @@ -873,7 +922,8 @@ int msm_pinctrl_probe(struct platform_device *pdev, struct resource *res; int ret; pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); msm_pinctrl_data = pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); if (!pctrl) { dev_err(&pdev->dev, "Can't allocate msm_pinctrl\n"); return -ENOMEM; Loading Loading @@ -913,6 +963,7 @@ int msm_pinctrl_probe(struct platform_device *pdev, platform_set_drvdata(pdev, pctrl); register_syscore_ops(&msm_pinctrl_pm_ops); dev_dbg(&pdev->dev, "Probed Qualcomm pinctrl driver\n"); return 0; Loading @@ -926,6 +977,7 @@ int msm_pinctrl_remove(struct platform_device *pdev) gpiochip_remove(&pctrl->chip); unregister_restart_handler(&pctrl->restart_nb); unregister_syscore_ops(&msm_pinctrl_pm_ops); return 0; } Loading drivers/pinctrl/qcom/pinctrl-msm.h +1 −0 Original line number Diff line number Diff line Loading @@ -121,4 +121,5 @@ int msm_pinctrl_probe(struct platform_device *pdev, const struct msm_pinctrl_soc_data *soc_data); int msm_pinctrl_remove(struct platform_device *pdev); extern int msm_show_resume_irq_mask; #endif Loading
drivers/pinctrl/qcom/pinctrl-msm.c +54 −2 Original line number Diff line number Diff line /* * Copyright (c) 2013, Sony Mobile Communications AB. * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -27,6 +27,7 @@ #include <linux/gpio.h> #include <linux/interrupt.h> #include <linux/spinlock.h> #include <linux/syscore_ops.h> #include <linux/reboot.h> #include <linux/pm.h> #include <linux/log2.h> Loading Loading @@ -70,6 +71,8 @@ struct msm_pinctrl { void __iomem *regs; }; static struct msm_pinctrl *msm_pinctrl_data; static int msm_get_groups_count(struct pinctrl_dev *pctldev) { struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); Loading Loading @@ -866,6 +869,52 @@ static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl) } } #ifdef CONFIG_PM static int msm_pinctrl_suspend(void) { return 0; } static void msm_pinctrl_resume(void) { int i, irq; u32 val; unsigned long flags; struct irq_desc *desc; const struct msm_pingroup *g; const char *name = "null"; struct msm_pinctrl *pctrl = msm_pinctrl_data; if (!msm_show_resume_irq_mask) return; spin_lock_irqsave(&pctrl->lock, flags); for_each_set_bit(i, pctrl->enabled_irqs, pctrl->chip.ngpio) { g = &pctrl->soc->groups[i]; val = readl_relaxed(pctrl->regs + g->intr_status_reg); if (val & BIT(g->intr_status_bit)) { irq = irq_find_mapping(pctrl->chip.irqdomain, i); desc = irq_to_desc(irq); if (desc == NULL) name = "stray irq"; else if (desc->action && desc->action->name) name = desc->action->name; pr_warn("%s: %d triggered %s\n", __func__, irq, name); } } spin_unlock_irqrestore(&pctrl->lock, flags); } #else #define msm_pinctrl_suspend NULL #define msm_pinctrl_resume NULL #endif static struct syscore_ops msm_pinctrl_pm_ops = { .suspend = msm_pinctrl_suspend, .resume = msm_pinctrl_resume, }; int msm_pinctrl_probe(struct platform_device *pdev, const struct msm_pinctrl_soc_data *soc_data) { Loading @@ -873,7 +922,8 @@ int msm_pinctrl_probe(struct platform_device *pdev, struct resource *res; int ret; pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); msm_pinctrl_data = pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); if (!pctrl) { dev_err(&pdev->dev, "Can't allocate msm_pinctrl\n"); return -ENOMEM; Loading Loading @@ -913,6 +963,7 @@ int msm_pinctrl_probe(struct platform_device *pdev, platform_set_drvdata(pdev, pctrl); register_syscore_ops(&msm_pinctrl_pm_ops); dev_dbg(&pdev->dev, "Probed Qualcomm pinctrl driver\n"); return 0; Loading @@ -926,6 +977,7 @@ int msm_pinctrl_remove(struct platform_device *pdev) gpiochip_remove(&pctrl->chip); unregister_restart_handler(&pctrl->restart_nb); unregister_syscore_ops(&msm_pinctrl_pm_ops); return 0; } Loading
drivers/pinctrl/qcom/pinctrl-msm.h +1 −0 Original line number Diff line number Diff line Loading @@ -121,4 +121,5 @@ int msm_pinctrl_probe(struct platform_device *pdev, const struct msm_pinctrl_soc_data *soc_data); int msm_pinctrl_remove(struct platform_device *pdev); extern int msm_show_resume_irq_mask; #endif