All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: amd: Add Z-state wake control bits
@ 2022-12-08  9:37 Basavaraj Natikar
  2022-12-08 22:21 ` Linus Walleij
  2022-12-29  1:02 ` Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Basavaraj Natikar @ 2022-12-08  9:37 UTC (permalink / raw)
  To: Shyam-sundar.S-k, linus.walleij, linux-gpio
  Cc: Rajesh1.Kumar, Basavaraj Natikar, Mario Limonciello,
	Guruvendra Punugupati

GPIO registers include Bit 27 for WakeCntrlZ used to enable wake in
Z state. Hence add Z-state wake control bits to debugfs output to
debug and analyze Z-states problems.

Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
Tested-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
---
 drivers/pinctrl/pinctrl-amd.c | 7 +++++++
 drivers/pinctrl/pinctrl-amd.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
index 6be896871718..e944003bb84a 100644
--- a/drivers/pinctrl/pinctrl-amd.c
+++ b/drivers/pinctrl/pinctrl-amd.c
@@ -218,6 +218,7 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
 	char *orientation;
 	char debounce_value[40];
 	char *debounce_enable;
+	char *wake_cntrlz;
 
 	for (bank = 0; bank < gpio_dev->hwbank_num; bank++) {
 		unsigned int time = 0;
@@ -305,6 +306,12 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
 				wake_cntrl2 = " ∅";
 			seq_printf(s, "S4/S5 %s| ", wake_cntrl2);
 
+			if (pin_reg & BIT(WAKECNTRL_Z_OFF))
+				wake_cntrlz = "⏰";
+			else
+				wake_cntrlz = " ∅";
+			seq_printf(s, "Z %s| ", wake_cntrlz);
+
 			if (pin_reg & BIT(PULL_UP_ENABLE_OFF)) {
 				pull_up_enable = "+";
 				if (pin_reg & BIT(PULL_UP_SEL_OFF))
diff --git a/drivers/pinctrl/pinctrl-amd.h b/drivers/pinctrl/pinctrl-amd.h
index c8635998465d..81ae8319a1f0 100644
--- a/drivers/pinctrl/pinctrl-amd.h
+++ b/drivers/pinctrl/pinctrl-amd.h
@@ -42,6 +42,7 @@
 #define OUTPUT_ENABLE_OFF		23
 #define SW_CNTRL_IN_OFF			24
 #define SW_CNTRL_EN_OFF			25
+#define WAKECNTRL_Z_OFF			27
 #define INTERRUPT_STS_OFF		28
 #define WAKE_STS_OFF			29
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: amd: Add Z-state wake control bits
  2022-12-08  9:37 [PATCH] pinctrl: amd: Add Z-state wake control bits Basavaraj Natikar
@ 2022-12-08 22:21 ` Linus Walleij
  2022-12-09 18:46   ` Basavaraj Natikar
  2022-12-29  1:02 ` Linus Walleij
  1 sibling, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2022-12-08 22:21 UTC (permalink / raw)
  To: Basavaraj Natikar
  Cc: Shyam-sundar.S-k, linux-gpio, Rajesh1.Kumar, Mario Limonciello,
	Guruvendra Punugupati

Hi Basavaraj,

thanks for your patch!

On Thu, Dec 8, 2022 at 10:37 AM Basavaraj Natikar
<Basavaraj.Natikar@amd.com> wrote:

> GPIO registers include Bit 27 for WakeCntrlZ used to enable wake in
> Z state. Hence add Z-state wake control bits to debugfs output to
> debug and analyze Z-states problems.
>
> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
> Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
> Tested-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>

The patch is overall fine, but as debug-only patch hardly urgent
so it will wait until kernel v6.3.

What I want to ask is how this bit:

+#define WAKECNTRL_Z_OFF                        27

Relates to this:

static int amd_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
{
        u32 pin_reg;
        unsigned long flags;
        struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
        struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
        u32 wake_mask = BIT(WAKE_CNTRL_OFF_S0I3) | BIT(WAKE_CNTRL_OFF_S3);
        int err;
(...)

if this is some wake up control that is unrelated to GPIO, such
that this can wake up on say I2C traffic on that pin or similar,
is this something we actually need a new define for in
include/linux/pinctrl/pinconf-generic.h
so that you can also implement methods to manipulate it
for real, like setting this from a pin control state or so?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: amd: Add Z-state wake control bits
  2022-12-08 22:21 ` Linus Walleij
@ 2022-12-09 18:46   ` Basavaraj Natikar
  0 siblings, 0 replies; 4+ messages in thread
From: Basavaraj Natikar @ 2022-12-09 18:46 UTC (permalink / raw)
  To: Linus Walleij, Basavaraj Natikar
  Cc: Shyam-sundar.S-k, linux-gpio, Rajesh1.Kumar, Mario Limonciello,
	Guruvendra Punugupati


On 12/9/2022 3:51 AM, Linus Walleij wrote:
> Hi Basavaraj,
>
> thanks for your patch!
>
> On Thu, Dec 8, 2022 at 10:37 AM Basavaraj Natikar
> <Basavaraj.Natikar@amd.com> wrote:
>
>> GPIO registers include Bit 27 for WakeCntrlZ used to enable wake in
>> Z state. Hence add Z-state wake control bits to debugfs output to
>> debug and analyze Z-states problems.
>>
>> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
>> Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
>> Tested-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>
> The patch is overall fine, but as debug-only patch hardly urgent
> so it will wait until kernel v6.3.

Sure

>
> What I want to ask is how this bit:
>
> +#define WAKECNTRL_Z_OFF                        27
>
> Relates to this:
>
> static int amd_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
> {
>         u32 pin_reg;
>         unsigned long flags;
>         struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
>         struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
>         u32 wake_mask = BIT(WAKE_CNTRL_OFF_S0I3) | BIT(WAKE_CNTRL_OFF_S3);
>         int err;
> (...)
>
> if this is some wake up control that is unrelated to GPIO, such
> that this can wake up on say I2C traffic on that pin or similar,
> is this something we actually need a new define for in
> include/linux/pinctrl/pinconf-generic.h
> so that you can also implement methods to manipulate it
> for real, like setting this from a pin control state or so?

we are not going to manipulate using pinconf_to_config_param
explicitly, setting will be taken care by BIOS. We need only
for debugging purpose to check bit status

Thanks,
--
Basavaraj


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: amd: Add Z-state wake control bits
  2022-12-08  9:37 [PATCH] pinctrl: amd: Add Z-state wake control bits Basavaraj Natikar
  2022-12-08 22:21 ` Linus Walleij
@ 2022-12-29  1:02 ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2022-12-29  1:02 UTC (permalink / raw)
  To: Basavaraj Natikar
  Cc: Shyam-sundar.S-k, linux-gpio, Rajesh1.Kumar, Mario Limonciello,
	Guruvendra Punugupati

On Thu, Dec 8, 2022 at 10:37 AM Basavaraj Natikar
<Basavaraj.Natikar@amd.com> wrote:

> GPIO registers include Bit 27 for WakeCntrlZ used to enable wake in
> Z state. Hence add Z-state wake control bits to debugfs output to
> debug and analyze Z-states problems.
>
> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
> Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
> Tested-by: Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-29  1:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08  9:37 [PATCH] pinctrl: amd: Add Z-state wake control bits Basavaraj Natikar
2022-12-08 22:21 ` Linus Walleij
2022-12-09 18:46   ` Basavaraj Natikar
2022-12-29  1:02 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.