Loading drivers/pinctrl/qcom/pinctrl-msm.c +57 −4 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-2018, 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 @@ -73,6 +74,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 @@ -1009,6 +1012,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; raw_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.irq.domain, 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); } } raw_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 @@ -1016,10 +1065,12 @@ int msm_pinctrl_probe(struct platform_device *pdev, struct resource *res; int ret; pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); if (!pctrl) 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; } pctrl->dev = &pdev->dev; pctrl->soc = soc_data; pctrl->chip = msm_gpio_template; Loading Loading @@ -1059,6 +1110,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 @@ -1072,6 +1124,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 +6 −0 Original line number Diff line number Diff line Loading @@ -125,4 +125,10 @@ int msm_pinctrl_probe(struct platform_device *pdev, const struct msm_pinctrl_soc_data *soc_data); int msm_pinctrl_remove(struct platform_device *pdev); #ifdef CONFIG_QCOM_SHOW_RESUME_IRQ extern int msm_show_resume_irq_mask; #else #define msm_show_resume_irq_mask 0 #endif #endif Loading
drivers/pinctrl/qcom/pinctrl-msm.c +57 −4 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-2018, 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 @@ -73,6 +74,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 @@ -1009,6 +1012,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; raw_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.irq.domain, 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); } } raw_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 @@ -1016,10 +1065,12 @@ int msm_pinctrl_probe(struct platform_device *pdev, struct resource *res; int ret; pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); if (!pctrl) 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; } pctrl->dev = &pdev->dev; pctrl->soc = soc_data; pctrl->chip = msm_gpio_template; Loading Loading @@ -1059,6 +1110,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 @@ -1072,6 +1124,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 +6 −0 Original line number Diff line number Diff line Loading @@ -125,4 +125,10 @@ int msm_pinctrl_probe(struct platform_device *pdev, const struct msm_pinctrl_soc_data *soc_data); int msm_pinctrl_remove(struct platform_device *pdev); #ifdef CONFIG_QCOM_SHOW_RESUME_IRQ extern int msm_show_resume_irq_mask; #else #define msm_show_resume_irq_mask 0 #endif #endif