public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Pinctrl: core: export pinctrl_provide_dummies() to fix build error
@ 2025-10-28  6:13 Gary Yang
  2025-10-28  9:49 ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Yang @ 2025-10-28  6:13 UTC (permalink / raw)
  To: linus.walleij, robh, krzk+dt, conor+dt
  Cc: linux-gpio, devicetree, linux-kernel, linux-arm-kernel,
	cix-kernel-upstream, sfr, Gary Yang

If a pinctrl driver uses pinctrl_provide_dummies() interface, and

is built as a module, then an error occur as follow:

ERROR: modpost: "pinctrl_provide_dummies" [drivers/pinctrl/cix/pinctrl-sky1-base.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:147: Module.symvers] Error 1
make[1]: *** [/home/gary/workspace/upstream/kernel_upstream/Makefile:1960: modpost] Error 2
make: *** [Makefile:248: __sub-make] Error 2

Signed-off-by: Gary Yang <gary.yang@cixtech.com>
---
 drivers/pinctrl/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index c5dbf4e9db84..acf4a86fb5cd 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -70,6 +70,7 @@ void pinctrl_provide_dummies(void)
 {
 	pinctrl_dummy_state = true;
 }
+EXPORT_SYMBOL_GPL(pinctrl_provide_dummies);
 
 const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev)
 {
-- 
2.49.0


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

* Re: [PATCH] Pinctrl: core: export pinctrl_provide_dummies() to fix build error
  2025-10-28  6:13 [PATCH] Pinctrl: core: export pinctrl_provide_dummies() to fix build error Gary Yang
@ 2025-10-28  9:49 ` Linus Walleij
  2025-10-29  3:35   ` 回复: " Gary Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2025-10-28  9:49 UTC (permalink / raw)
  To: Gary Yang
  Cc: robh, krzk+dt, conor+dt, linux-gpio, devicetree, linux-kernel,
	linux-arm-kernel, cix-kernel-upstream, sfr

On Tue, Oct 28, 2025 at 7:13 AM Gary Yang <gary.yang@cixtech.com> wrote:

> If a pinctrl driver uses pinctrl_provide_dummies() interface, and
>
> is built as a module, then an error occur as follow:
>
> ERROR: modpost: "pinctrl_provide_dummies" [drivers/pinctrl/cix/pinctrl-sky1-base.ko] undefined!
> make[2]: *** [scripts/Makefile.modpost:147: Module.symvers] Error 1
> make[1]: *** [/home/gary/workspace/upstream/kernel_upstream/Makefile:1960: modpost] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
>
> Signed-off-by: Gary Yang <gary.yang@cixtech.com>

I just deleted the call to pinctrl_provide_dummies() from the SKY1
driver instead, because I didn't understand it.

But if you need it, put it in a series with this patch based on the latest
devel and an explanation why it is needed.

The only other driver that use it is the Renesas driver and it uses
it like this:

        /* Enable dummy states for those platforms without pinctrl support */
        if (!of_have_populated_dt())
                pinctrl_provide_dummies();

I don't understand why you would need this? The SKY1 has pinctrl
support after this patch I think and since the arch code in arm64
requires DT, it seems fine. But maybe this is for ACPI boots or
something like that, so you would have this driver but there would
not be any device tree?

Just explain it in a patch and we can add it back.

Yours,
Linus Walleij

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

* 回复: [PATCH] Pinctrl: core: export pinctrl_provide_dummies() to fix build error
  2025-10-28  9:49 ` Linus Walleij
@ 2025-10-29  3:35   ` Gary Yang
  2025-11-04 10:49     ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Yang @ 2025-10-29  3:35 UTC (permalink / raw)
  To: Linus Walleij
  Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, cix-kernel-upstream,
	sfr@canb.auug.org.au

Hi Linus:

First Sorry for building mistakes. We always build code with -y option, and ignore -m option.

We will double check it later.

> EXTERNAL EMAIL
> 
> On Tue, Oct 28, 2025 at 7:13 AM Gary Yang <gary.yang@cixtech.com> wrote:
> 
> > If a pinctrl driver uses pinctrl_provide_dummies() interface, and
> >
> > is built as a module, then an error occur as follow:
> >
> > ERROR: modpost: "pinctrl_provide_dummies"
> [drivers/pinctrl/cix/pinctrl-sky1-base.ko] undefined!
> > make[2]: *** [scripts/Makefile.modpost:147: Module.symvers] Error 1
> > make[1]: ***
> > [/home/gary/workspace/upstream/kernel_upstream/Makefile:1960:
> modpost]
> > Error 2
> > make: *** [Makefile:248: __sub-make] Error 2
> >
> > Signed-off-by: Gary Yang <gary.yang@cixtech.com>
> 
> I just deleted the call to pinctrl_provide_dummies() from the SKY1 driver
> instead, because I didn't understand it.
> 
> But if you need it, put it in a series with this patch based on the latest devel
> and an explanation why it is needed.
> 
> The only other driver that use it is the Renesas driver and it uses it like this:
> 
>         /* Enable dummy states for those platforms without pinctrl support
> */
>         if (!of_have_populated_dt())
>                 pinctrl_provide_dummies();
> 
> I don't understand why you would need this? The SKY1 has pinctrl support
> after this patch I think and since the arch code in arm64 requires DT, it seems
> fine. But maybe this is for ACPI boots or something like that, so you would
> have this driver but there would not be any device tree?
> 
> Just explain it in a patch and we can add it back.
> 

Please allow us to explain why we use it. 

As you known, there are some states on pinctrl. They are default state, init state, sleep state, and so on.

Generally a device may has two states: default state and sleep state. They are included in DTS file.

So DTS has two nodes, one is for default state, and the other is for sleep state. When the device works, select

default state, but select sleep state when the system enters str. 


There is two pinctrl controllers on CIX sky1. One is used under S0 state, and the other is used under S0 and S5 state. 

When enter str, the system enter S3 state and S0 domain power off. So the pinctrl controller under S0 state is also off. 

The settings for sleep state are loft and make no sense. 


But if we remove these settings, the pinctrl can't find sleep state and can't change state when system enter str. 

When resume pinctrl, pinctrl core may think state is still the same as before. So the settings can't be applied as expected.

1364 /**
1365  * pinctrl_select_state() - select/activate/program a pinctrl state to HW
1366  * @p: the pinctrl handle for the device that requests configuration
1367  * @state: the state handle to select/activate/program
1368  */
1369 int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
1370 {
1371         if (p->state == state)
1372                 return 0;
1373
1374         return pinctrl_commit_state(p, state);
1375 }
1376 EXPORT_SYMBOL_GPL(pinctrl_select_state);

To avoid write these unused settings in DTS file, we have to use pinctrl_provide_dummies() interface. 

Do you agree our schemes? What's your opinion? Please give us some suggestions. Thanks

If you have any questions, please let us know.

Best wishes
Gary

> Yours,
> Linus Walleij

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

* Re: [PATCH] Pinctrl: core: export pinctrl_provide_dummies() to fix build error
  2025-10-29  3:35   ` 回复: " Gary Yang
@ 2025-11-04 10:49     ` Linus Walleij
  2025-11-05  1:50       ` 回复: " Gary Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2025-11-04 10:49 UTC (permalink / raw)
  To: Gary Yang
  Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, cix-kernel-upstream,
	sfr@canb.auug.org.au

On Wed, Oct 29, 2025 at 4:35 AM Gary Yang <gary.yang@cixtech.com> wrote:


> Generally a device may has two states: default state and sleep state. They are included in DTS file.
> So DTS has two nodes, one is for default state, and the other is for sleep state. When the device works, select
> default state, but select sleep state when the system enters str.

What is "str"? stand-by-retention? (Sorry for my ignorance.)

> There is two pinctrl controllers on CIX sky1. One is used under S0 state, and the other is used under S0 and S5 state.
> When enter str, the system enter S3 state and S0 domain power off. So the pinctrl controller under S0 state is also off.
> The settings for sleep state are loft and make no sense.
>
> But if we remove these settings, the pinctrl can't find sleep state and can't change state when system enter str.
> When resume pinctrl, pinctrl core may think state is still the same as before. So the settings can't be applied
> as expected.

Aha!

> To avoid write these unused settings in DTS file, we have to use pinctrl_provide_dummies() interface.
> Do you agree our schemes? What's your opinion? Please give us some suggestions. Thanks

I think it's fine to use the pinctrl dummies, I will draft a patch and
send so you can ACK it.

It's fun to get the whole picture of how this works on CIX silicon,
it's a new way of doing
things with two different pin controllers so I haven't seen this before!

Yours,
Linus Walleij

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

* 回复: [PATCH] Pinctrl: core: export pinctrl_provide_dummies() to fix build error
  2025-11-04 10:49     ` Linus Walleij
@ 2025-11-05  1:50       ` Gary Yang
  0 siblings, 0 replies; 5+ messages in thread
From: Gary Yang @ 2025-11-05  1:50 UTC (permalink / raw)
  To: Linus Walleij
  Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, cix-kernel-upstream,
	sfr@canb.auug.org.au

Hi Linus,

> EXTERNAL EMAIL
> 
> On Wed, Oct 29, 2025 at 4:35 AM Gary Yang <gary.yang@cixtech.com> wrote:
> 
> 
> > Generally a device may has two states: default state and sleep state. They are
> included in DTS file.
> > So DTS has two nodes, one is for default state, and the other is for
> > sleep state. When the device works, select default state, but select sleep
> state when the system enters str.
> 
> What is "str"? stand-by-retention? (Sorry for my ignorance.)
> 

Sorry, we forgot to explain it before. Str means suspend to RAM

> > There is two pinctrl controllers on CIX sky1. One is used under S0 state, and
> the other is used under S0 and S5 state.
> > When enter str, the system enter S3 state and S0 domain power off. So the
> pinctrl controller under S0 state is also off.
> > The settings for sleep state are loft and make no sense.
> >
> > But if we remove these settings, the pinctrl can't find sleep state and can't
> change state when system enter str.
> > When resume pinctrl, pinctrl core may think state is still the same as
> > before. So the settings can't be applied as expected.
> 
> Aha!
> 
> > To avoid write these unused settings in DTS file, we have to use
> pinctrl_provide_dummies() interface.
> > Do you agree our schemes? What's your opinion? Please give us some
> > suggestions. Thanks
> 
> I think it's fine to use the pinctrl dummies, I will draft a patch and send so you
> can ACK it.
> 
> It's fun to get the whole picture of how this works on CIX silicon, it's a new way
> of doing things with two different pin controllers so I haven't seen this before!
> 

Great! It's a big surprise!
Thanks for your understandings

> Yours,
> Linus Walleij

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

end of thread, other threads:[~2025-11-05  1:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28  6:13 [PATCH] Pinctrl: core: export pinctrl_provide_dummies() to fix build error Gary Yang
2025-10-28  9:49 ` Linus Walleij
2025-10-29  3:35   ` 回复: " Gary Yang
2025-11-04 10:49     ` Linus Walleij
2025-11-05  1:50       ` 回复: " Gary Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox