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


Groups > linux.kernel > #1738392 > unrolled thread

[PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-09-24 22:50 +0200
Last post2017-09-27 16:00 +0200
Articles 6 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-24 22:50 +0200
    Re: [PATCH 4.13 015/109] pinctrl/amd: save pin registers over  suspend/resume Petr Mladek <pmladek@suse.com> - 2017-09-26 16:10 +0200
      Re: [PATCH 4.13 015/109] pinctrl/amd: save pin registers over  suspend/resume Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-27 10:50 +0200
        Re: [PATCH 4.13 015/109] pinctrl/amd: save pin registers over  suspend/resume Petr Mladek <pmladek@suse.com> - 2017-09-27 13:40 +0200
          Re: [PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume Linus Walleij <linus.walleij@linaro.org> - 2017-09-27 15:50 +0200
      Re: [PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume Linus Walleij <linus.walleij@linaro.org> - 2017-09-27 16:00 +0200

#1738392 — [PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-09-24 22:50 +0200
Subject[PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume
Message-ID<utm0H-4Xd-57@gated-at.bofh.it>
4.13-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Drake <drake@endlessm.com>

commit 79d2c8bede2c93f9432d7da0bc2f76a195c90fc0 upstream.

The touchpad in the Asus laptop models X505BA/BP and X542BA/BP is
unresponsive after suspend/resume. The following error appears during
resume:

  i2c_hid i2c-ELAN1300:00: failed to reset device.

The problem here is that i2c_hid does not notice the interrupt being
generated at this point, because the GPIO is no longer configured
for interrupts.

Fix this by saving pinctrl-amd pin registers during suspend and
restoring them at resume time.

Based on code from pinctrl-intel.

Signed-off-by: Daniel Drake <drake@endlessm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pinctrl/pinctrl-amd.c |   75 ++++++++++++++++++++++++++++++++++++++++++
 drivers/pinctrl/pinctrl-amd.h |    1 
 2 files changed, 76 insertions(+)

--- a/drivers/pinctrl/pinctrl-amd.c
+++ b/drivers/pinctrl/pinctrl-amd.c
@@ -36,6 +36,7 @@
 #include <linux/pinctrl/pinconf.h>
 #include <linux/pinctrl/pinconf-generic.h>
 
+#include "core.h"
 #include "pinctrl-utils.h"
 #include "pinctrl-amd.h"
 
@@ -725,6 +726,69 @@ static const struct pinconf_ops amd_pinc
 	.pin_config_group_set = amd_pinconf_group_set,
 };
 
+#ifdef CONFIG_PM_SLEEP
+static bool amd_gpio_should_save(struct amd_gpio *gpio_dev, unsigned int pin)
+{
+	const struct pin_desc *pd = pin_desc_get(gpio_dev->pctrl, pin);
+
+	if (!pd)
+		return false;
+
+	/*
+	 * Only restore the pin if it is actually in use by the kernel (or
+	 * by userspace).
+	 */
+	if (pd->mux_owner || pd->gpio_owner ||
+	    gpiochip_line_is_irq(&gpio_dev->gc, pin))
+		return true;
+
+	return false;
+}
+
+int amd_gpio_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct amd_gpio *gpio_dev = platform_get_drvdata(pdev);
+	struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
+	int i;
+
+	for (i = 0; i < desc->npins; i++) {
+		int pin = desc->pins[i].number;
+
+		if (!amd_gpio_should_save(gpio_dev, pin))
+			continue;
+
+		gpio_dev->saved_regs[i] = readl(gpio_dev->base + pin*4);
+	}
+
+	return 0;
+}
+
+int amd_gpio_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct amd_gpio *gpio_dev = platform_get_drvdata(pdev);
+	struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
+	int i;
+
+	for (i = 0; i < desc->npins; i++) {
+		int pin = desc->pins[i].number;
+
+		if (!amd_gpio_should_save(gpio_dev, pin))
+			continue;
+
+		writel(gpio_dev->saved_regs[i], gpio_dev->base + pin*4);
+	}
+
+	return 0;
+}
+
+static const struct dev_pm_ops amd_gpio_pm_ops = {
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(amd_gpio_suspend,
+				     amd_gpio_resume)
+};
+#endif
+
 static struct pinctrl_desc amd_pinctrl_desc = {
 	.pins	= kerncz_pins,
 	.npins = ARRAY_SIZE(kerncz_pins),
@@ -764,6 +828,14 @@ static int amd_gpio_probe(struct platfor
 		return -EINVAL;
 	}
 
+#ifdef CONFIG_PM_SLEEP
+	gpio_dev->saved_regs = devm_kcalloc(&pdev->dev, amd_pinctrl_desc.npins,
+					    sizeof(*gpio_dev->saved_regs),
+					    GFP_KERNEL);
+	if (!gpio_dev->saved_regs)
+		return -ENOMEM;
+#endif
+
 	gpio_dev->pdev = pdev;
 	gpio_dev->gc.direction_input	= amd_gpio_direction_input;
 	gpio_dev->gc.direction_output	= amd_gpio_direction_output;
@@ -853,6 +925,9 @@ static struct platform_driver amd_gpio_d
 	.driver		= {
 		.name	= "amd_gpio",
 		.acpi_match_table = ACPI_PTR(amd_gpio_acpi_match),
+#ifdef CONFIG_PM_SLEEP
+		.pm	= &amd_gpio_pm_ops,
+#endif
 	},
 	.probe		= amd_gpio_probe,
 	.remove		= amd_gpio_remove,
--- a/drivers/pinctrl/pinctrl-amd.h
+++ b/drivers/pinctrl/pinctrl-amd.h
@@ -97,6 +97,7 @@ struct amd_gpio {
 	unsigned int            hwbank_num;
 	struct resource         *res;
 	struct platform_device  *pdev;
+	u32			*saved_regs;
 };
 
 /*  KERNCZ configuration*/

[toc] | [next] | [standalone]


#1739918 — Re: [PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume

FromPetr Mladek <pmladek@suse.com>
Date2017-09-26 16:10 +0200
SubjectRe: [PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume
Message-ID<utYIG-5O1-21@gated-at.bofh.it>
In reply to#1738392
On Sun 2017-09-24 22:32:36, Greg Kroah-Hartman wrote:
> 4.13-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Daniel Drake <drake@endlessm.com>
> 
> commit 79d2c8bede2c93f9432d7da0bc2f76a195c90fc0 upstream.
> 
> The touchpad in the Asus laptop models X505BA/BP and X542BA/BP is
> unresponsive after suspend/resume. The following error appears during
> resume:
> 
>   i2c_hid i2c-ELAN1300:00: failed to reset device.
> 
> The problem here is that i2c_hid does not notice the interrupt being
> generated at this point, because the GPIO is no longer configured
> for interrupts.
> 
> Fix this by saving pinctrl-amd pin registers during suspend and
> restoring them at resume time.
> 
> Based on code from pinctrl-intel.
> 
> Signed-off-by: Daniel Drake <drake@endlessm.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> --- a/drivers/pinctrl/pinctrl-amd.c
> +++ b/drivers/pinctrl/pinctrl-amd.c
> @@ -725,6 +726,69 @@ static const struct pinconf_ops amd_pinc
>  	.pin_config_group_set = amd_pinconf_group_set,
>  };
>  
> +#ifdef CONFIG_PM_SLEEP
> +static bool amd_gpio_should_save(struct amd_gpio *gpio_dev, unsigned int pin)
> +{
> +	const struct pin_desc *pd = pin_desc_get(gpio_dev->pctrl, pin);
> +
> +	if (!pd)
> +		return false;
> +
> +	/*
> +	 * Only restore the pin if it is actually in use by the kernel (or
> +	 * by userspace).
> +	 */
> +	if (pd->mux_owner || pd->gpio_owner ||

This code causes a compilation error in the current Linus' tree
(4.14-rc2+). I guess that the same problem will be also in
older trees.

IMHO, we need to select CONFIG_PINMUX for when CONFIG_PINCTRL_AMD
is selected. The following patch helped here:

From f83130d3b5c147b4d400922847ca2751d8020ab5 Mon Sep 17 00:00:00 2001
From: Petr Mladek <pmladek@suse.com>
Date: Tue, 26 Sep 2017 15:51:28 +0200
Subject: [PATCH] pinctrl/amd: Fix build dependency on pinmux code
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The commit 79d2c8bede2c93f943 ("pinctrl/amd: save pin registers over
suspend/resume") caused the following compilation errors:

drivers/pinctrl/pinctrl-amd.c: In function ‘amd_gpio_should_save’:
drivers/pinctrl/pinctrl-amd.c:741:8: error: ‘const struct pin_desc’ has no member named ‘mux_owner’
  if (pd->mux_owner || pd->gpio_owner ||
        ^
drivers/pinctrl/pinctrl-amd.c:741:25: error: ‘const struct pin_desc’ has no member named ‘gpio_owner’
  if (pd->mux_owner || pd->gpio_owner ||

We need to enable CONFIG_PINMUX for this driver as well.

Fixes: 79d2c8bede2c93f943 ("pinctrl/amd: save pin registers over suspend/resume")
Signed-off-by: Petr Mladek <pmladek@suse.com>
---
 drivers/pinctrl/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index 1778cf4f81c7..82cd8b08d71f 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -100,6 +100,7 @@ config PINCTRL_AMD
 	tristate "AMD GPIO pin control"
 	depends on GPIOLIB
 	select GPIOLIB_IRQCHIP
+	select PINMUX
 	select PINCONF
 	select GENERIC_PINCONF
 	help
-- 
1.8.5.6

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


#1740510 — Re: [PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-09-27 10:50 +0200
SubjectRe: [PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume
Message-ID<uugcx-8qD-5@gated-at.bofh.it>
In reply to#1739918
On Tue, Sep 26, 2017 at 04:07:45PM +0200, Petr Mladek wrote:
> On Sun 2017-09-24 22:32:36, Greg Kroah-Hartman wrote:
> > 4.13-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Daniel Drake <drake@endlessm.com>
> > 
> > commit 79d2c8bede2c93f9432d7da0bc2f76a195c90fc0 upstream.
> > 
> > The touchpad in the Asus laptop models X505BA/BP and X542BA/BP is
> > unresponsive after suspend/resume. The following error appears during
> > resume:
> > 
> >   i2c_hid i2c-ELAN1300:00: failed to reset device.
> > 
> > The problem here is that i2c_hid does not notice the interrupt being
> > generated at this point, because the GPIO is no longer configured
> > for interrupts.
> > 
> > Fix this by saving pinctrl-amd pin registers during suspend and
> > restoring them at resume time.
> > 
> > Based on code from pinctrl-intel.
> > 
> > Signed-off-by: Daniel Drake <drake@endlessm.com>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > 
> > --- a/drivers/pinctrl/pinctrl-amd.c
> > +++ b/drivers/pinctrl/pinctrl-amd.c
> > @@ -725,6 +726,69 @@ static const struct pinconf_ops amd_pinc
> >  	.pin_config_group_set = amd_pinconf_group_set,
> >  };
> >  
> > +#ifdef CONFIG_PM_SLEEP
> > +static bool amd_gpio_should_save(struct amd_gpio *gpio_dev, unsigned int pin)
> > +{
> > +	const struct pin_desc *pd = pin_desc_get(gpio_dev->pctrl, pin);
> > +
> > +	if (!pd)
> > +		return false;
> > +
> > +	/*
> > +	 * Only restore the pin if it is actually in use by the kernel (or
> > +	 * by userspace).
> > +	 */
> > +	if (pd->mux_owner || pd->gpio_owner ||
> 
> This code causes a compilation error in the current Linus' tree
> (4.14-rc2+). I guess that the same problem will be also in
> older trees.
> 
> IMHO, we need to select CONFIG_PINMUX for when CONFIG_PINCTRL_AMD
> is selected. The following patch helped here:
> 
> >From f83130d3b5c147b4d400922847ca2751d8020ab5 Mon Sep 17 00:00:00 2001
> From: Petr Mladek <pmladek@suse.com>
> Date: Tue, 26 Sep 2017 15:51:28 +0200
> Subject: [PATCH] pinctrl/amd: Fix build dependency on pinmux code
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> The commit 79d2c8bede2c93f943 ("pinctrl/amd: save pin registers over
> suspend/resume") caused the following compilation errors:
> 
> drivers/pinctrl/pinctrl-amd.c: In function ‘amd_gpio_should_save’:
> drivers/pinctrl/pinctrl-amd.c:741:8: error: ‘const struct pin_desc’ has no member named ‘mux_owner’
>   if (pd->mux_owner || pd->gpio_owner ||
>         ^
> drivers/pinctrl/pinctrl-amd.c:741:25: error: ‘const struct pin_desc’ has no member named ‘gpio_owner’
>   if (pd->mux_owner || pd->gpio_owner ||
> 
> We need to enable CONFIG_PINMUX for this driver as well.
> 
> Fixes: 79d2c8bede2c93f943 ("pinctrl/amd: save pin registers over suspend/resume")
> Signed-off-by: Petr Mladek <pmladek@suse.com>
> ---
>  drivers/pinctrl/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
> index 1778cf4f81c7..82cd8b08d71f 100644
> --- a/drivers/pinctrl/Kconfig
> +++ b/drivers/pinctrl/Kconfig
> @@ -100,6 +100,7 @@ config PINCTRL_AMD
>  	tristate "AMD GPIO pin control"
>  	depends on GPIOLIB
>  	select GPIOLIB_IRQCHIP
> +	select PINMUX
>  	select PINCONF
>  	select GENERIC_PINCONF
>  	help
> -- 
> 1.8.5.6

What is the commit id for this patch in Linus's tree?  I don't see it
there...

thanks,

greg k-h

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


#1740626 — Re: [PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume

FromPetr Mladek <pmladek@suse.com>
Date2017-09-27 13:40 +0200
SubjectRe: [PATCH 4.13 015/109] pinctrl/amd: save pin registers over suspend/resume
Message-ID<uuiR3-1LQ-1@gated-at.bofh.it>
In reply to#1740510
On Wed 2017-09-27 10:39:26, Greg Kroah-Hartman wrote:
> On Tue, Sep 26, 2017 at 04:07:45PM +0200, Petr Mladek wrote:
> > On Sun 2017-09-24 22:32:36, Greg Kroah-Hartman wrote:
> > > 4.13-stable review patch.  If anyone has any objections, please let me know.
> > > 
> > > ------------------
> > > 
> > > From: Daniel Drake <drake@endlessm.com>
> > > 
> > > commit 79d2c8bede2c93f9432d7da0bc2f76a195c90fc0 upstream.
> > > 
> > > The touchpad in the Asus laptop models X505BA/BP and X542BA/BP is
> > > unresponsive after suspend/resume. The following error appears during
> > > resume:
> > > 
> > >   i2c_hid i2c-ELAN1300:00: failed to reset device.
> > > 
> > > The problem here is that i2c_hid does not notice the interrupt being
> > > generated at this point, because the GPIO is no longer configured
> > > for interrupts.
> > > 
> > > Fix this by saving pinctrl-amd pin registers during suspend and
> > > restoring them at resume time.
> > > 
> > > Based on code from pinctrl-intel.
> > > 
> > > Signed-off-by: Daniel Drake <drake@endlessm.com>
> > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > 
> > > --- a/drivers/pinctrl/pinctrl-amd.c
> > > +++ b/drivers/pinctrl/pinctrl-amd.c
> > > @@ -725,6 +726,69 @@ static const struct pinconf_ops amd_pinc
> > >  	.pin_config_group_set = amd_pinconf_group_set,
> > >  };
> > >  
> > > +#ifdef CONFIG_PM_SLEEP
> > > +static bool amd_gpio_should_save(struct amd_gpio *gpio_dev, unsigned int pin)
> > > +{
> > > +	const struct pin_desc *pd = pin_desc_get(gpio_dev->pctrl, pin);
> > > +
> > > +	if (!pd)
> > > +		return false;
> > > +
> > > +	/*
> > > +	 * Only restore the pin if it is actually in use by the kernel (or
> > > +	 * by userspace).
> > > +	 */
> > > +	if (pd->mux_owner || pd->gpio_owner ||
> > 
> > This code causes a compilation error in the current Linus' tree
> > (4.14-rc2+). I guess that the same problem will be also in
> > older trees.
> > 
> > IMHO, we need to select CONFIG_PINMUX for when CONFIG_PINCTRL_AMD
> > is selected. The following patch helped here:
> > 
> > >From f83130d3b5c147b4d400922847ca2751d8020ab5 Mon Sep 17 00:00:00 2001
> > From: Petr Mladek <pmladek@suse.com>
> > Date: Tue, 26 Sep 2017 15:51:28 +0200
> > Subject: [PATCH] pinctrl/amd: Fix build dependency on pinmux code
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: 8bit
> > 
> > The commit 79d2c8bede2c93f943 ("pinctrl/amd: save pin registers over
> > suspend/resume") caused the following compilation errors:
> > 
> > drivers/pinctrl/pinctrl-amd.c: In function ‘amd_gpio_should_save’:
> > drivers/pinctrl/pinctrl-amd.c:741:8: error: ‘const struct pin_desc’ has no member named ‘mux_owner’
> >   if (pd->mux_owner || pd->gpio_owner ||
> >         ^
> > drivers/pinctrl/pinctrl-amd.c:741:25: error: ‘const struct pin_desc’ has no member named ‘gpio_owner’
> >   if (pd->mux_owner || pd->gpio_owner ||
> > 
> > We need to enable CONFIG_PINMUX for this driver as well.
> > 
> > Fixes: 79d2c8bede2c93f943 ("pinctrl/amd: save pin registers over suspend/resume")
> > Signed-off-by: Petr Mladek <pmladek@suse.com>
> > ---
> >  drivers/pinctrl/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
> > index 1778cf4f81c7..82cd8b08d71f 100644
> > --- a/drivers/pinctrl/Kconfig
> > +++ b/drivers/pinctrl/Kconfig
> > @@ -100,6 +100,7 @@ config PINCTRL_AMD
> >  	tristate "AMD GPIO pin control"
> >  	depends on GPIOLIB
> >  	select GPIOLIB_IRQCHIP
> > +	select PINMUX
> >  	select PINCONF
> >  	select GENERIC_PINCONF
> >  	help
> > -- 
> > 1.8.5.6
> 
> What is the commit id for this patch in Linus's tree?  I don't see it
> there...

This extra patch has not been pushed to the Linus' tree yet.
It was only my proposal to fix the problem. I did not find
the original patch discussed on the kernel mailing list.
Therefore I sent this follow up fix as a reply to
the 4.13-stable review mail.

I hope that Linus Walleij would notice, review, and push it
into Linus' tree.

Best Regards,
Petr

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


#1740735

FromLinus Walleij <linus.walleij@linaro.org>
Date2017-09-27 15:50 +0200
Message-ID<uukSS-3A0-5@gated-at.bofh.it>
In reply to#1740626
On Wed, Sep 27, 2017 at 1:29 PM, Petr Mladek <pmladek@suse.com> wrote:
> On Wed 2017-09-27 10:39:26, Greg Kroah-Hartman wrote:
>> On Tue, Sep 26, 2017 at 04:07:45PM +0200, Petr Mladek wrote:
>> > On Sun 2017-09-24 22:32:36, Greg Kroah-Hartman wrote:
>> > > 4.13-stable review patch.  If anyone has any objections, please let me know.
>> > >
>> > > ------------------
>> > >
>> > > From: Daniel Drake <drake@endlessm.com>
>> > >
>> > > commit 79d2c8bede2c93f9432d7da0bc2f76a195c90fc0 upstream.
>> > >
>> > > The touchpad in the Asus laptop models X505BA/BP and X542BA/BP is
>> > > unresponsive after suspend/resume. The following error appears during
>> > > resume:
>> > >
>> > >   i2c_hid i2c-ELAN1300:00: failed to reset device.
>> > >
>> > > The problem here is that i2c_hid does not notice the interrupt being
>> > > generated at this point, because the GPIO is no longer configured
>> > > for interrupts.
>> > >
>> > > Fix this by saving pinctrl-amd pin registers during suspend and
>> > > restoring them at resume time.
>> > >
>> > > Based on code from pinctrl-intel.
>> > >
>> > > Signed-off-by: Daniel Drake <drake@endlessm.com>
>> > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> > >
>> > > --- a/drivers/pinctrl/pinctrl-amd.c
>> > > +++ b/drivers/pinctrl/pinctrl-amd.c
>> > > @@ -725,6 +726,69 @@ static const struct pinconf_ops amd_pinc
>> > >   .pin_config_group_set = amd_pinconf_group_set,
>> > >  };
>> > >
>> > > +#ifdef CONFIG_PM_SLEEP
>> > > +static bool amd_gpio_should_save(struct amd_gpio *gpio_dev, unsigned int pin)
>> > > +{
>> > > + const struct pin_desc *pd = pin_desc_get(gpio_dev->pctrl, pin);
>> > > +
>> > > + if (!pd)
>> > > +         return false;
>> > > +
>> > > + /*
>> > > +  * Only restore the pin if it is actually in use by the kernel (or
>> > > +  * by userspace).
>> > > +  */
>> > > + if (pd->mux_owner || pd->gpio_owner ||
>> >
>> > This code causes a compilation error in the current Linus' tree
>> > (4.14-rc2+). I guess that the same problem will be also in
>> > older trees.
>> >
>> > IMHO, we need to select CONFIG_PINMUX for when CONFIG_PINCTRL_AMD
>> > is selected. The following patch helped here:
>> >
>> > >From f83130d3b5c147b4d400922847ca2751d8020ab5 Mon Sep 17 00:00:00 2001
>> > From: Petr Mladek <pmladek@suse.com>
>> > Date: Tue, 26 Sep 2017 15:51:28 +0200
>> > Subject: [PATCH] pinctrl/amd: Fix build dependency on pinmux code
>> > MIME-Version: 1.0
>> > Content-Type: text/plain; charset=UTF-8
>> > Content-Transfer-Encoding: 8bit
>> >
>> > The commit 79d2c8bede2c93f943 ("pinctrl/amd: save pin registers over
>> > suspend/resume") caused the following compilation errors:
>> >
>> > drivers/pinctrl/pinctrl-amd.c: In function ‘amd_gpio_should_save’:
>> > drivers/pinctrl/pinctrl-amd.c:741:8: error: ‘const struct pin_desc’ has no member named ‘mux_owner’
>> >   if (pd->mux_owner || pd->gpio_owner ||
>> >         ^
>> > drivers/pinctrl/pinctrl-amd.c:741:25: error: ‘const struct pin_desc’ has no member named ‘gpio_owner’
>> >   if (pd->mux_owner || pd->gpio_owner ||
>> >
>> > We need to enable CONFIG_PINMUX for this driver as well.
>> >
>> > Fixes: 79d2c8bede2c93f943 ("pinctrl/amd: save pin registers over suspend/resume")
>> > Signed-off-by: Petr Mladek <pmladek@suse.com>
>> > ---
>> >  drivers/pinctrl/Kconfig | 1 +
>> >  1 file changed, 1 insertion(+)
>> >
>> > diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
>> > index 1778cf4f81c7..82cd8b08d71f 100644
>> > --- a/drivers/pinctrl/Kconfig
>> > +++ b/drivers/pinctrl/Kconfig
>> > @@ -100,6 +100,7 @@ config PINCTRL_AMD
>> >     tristate "AMD GPIO pin control"
>> >     depends on GPIOLIB
>> >     select GPIOLIB_IRQCHIP
>> > +   select PINMUX
>> >     select PINCONF
>> >     select GENERIC_PINCONF
>> >     help
>> > --
>> > 1.8.5.6
>>
>> What is the commit id for this patch in Linus's tree?  I don't see it
>> there...
>
> This extra patch has not been pushed to the Linus' tree yet.
> It was only my proposal to fix the problem. I did not find
> the original patch discussed on the kernel mailing list.
> Therefore I sent this follow up fix as a reply to
> the 4.13-stable review mail.
>
> I hope that Linus Walleij would notice, review, and push it
> into Linus' tree.

I missed it. OK looking for it so I can apply it.

Yours,
Linus Walleij

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


#1740749

FromLinus Walleij <linus.walleij@linaro.org>
Date2017-09-27 16:00 +0200
Message-ID<uul2x-3HA-3@gated-at.bofh.it>
In reply to#1739918
On Tue, Sep 26, 2017 at 4:07 PM, Petr Mladek <pmladek@suse.com> wrote:

> IMHO, we need to select CONFIG_PINMUX for when CONFIG_PINCTRL_AMD
> is selected. The following patch helped here:

Took the patch out of this mail, applied it to fixes and tagged it for
stable.

Will send it to Torvals ASAP.

Yours,
Linus Walleij

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web