mbox series

[v3,0/5] soc: loongson: Fix some issues about loongson2_pm

Message ID cover.1693623752.git.zhoubinbin@loongson.cn
Headers show
Series soc: loongson: Fix some issues about loongson2_pm | expand

Message

Binbin Zhou Sept. 2, 2023, 8:47 a.m. UTC
Hi all:

Since commit 67694c076bd7 ("soc: loongson2_pm: add power management support"),
the Loongson-2K PM driver was added, some issues have been found and
this patchset is planned to fix these issues.

Specific:
Patch 1: Compilation error found by Randy;
Patch 2/3: Rewriting the ls2k-pmc compatible attribute with fallback
compatible;
Patch 4/5: Add Loongson-2K SoC reboot/shutdown support as part of power
management.

Thanks.

-----
V3:
- Changes "loongson_pm2" to "loongson2_pm" in all subject lines.
  Sorry, it was a clerical error.
patch 1:
  - Add Fixes tag;
  - Update commit message.
patch 2:
  - Add Fixes and Acked-by tag.
patch 3:
  - Add Fixes tag;
patch 4:
  - Add Reviewed-by tag.

Link to V2:
https://lore.kernel.org/all/cover.1693474728.git.zhoubinbin@loongson.cn/

V2:
patch 1:
 - Change "depends on INPUT" to "depends on INPUT=y", because the
   compilation error still exists when "INPUT=m".
patch 2:
  - Use ls2k0500 as the fallback compatible;
  - Add ls2k2000 compatible.
patch 3:
 - Drop ls2k1000 compatible, for ls2k0500 is used as the fallback
   compatible.
patch 4:
  - Drop label;
  - Drop regmap property in syscon-reboot, for it's deprecated;
  - Add missing space.

Link to V1:
https://lore.kernel.org/all/cover.1693218539.git.zhoubinbin@loongson.cn/

Binbin Zhou (5):
  soc: loongson: loongson2_pm: Add dependency for INPUT
  dt-bindings: soc: loongson,ls2k-pmc: Use fallbacks for ls2k-pmc
    compatible
  soc: loongson: loongson2_pm: Drop useless of_device_id compatible
  dt-bindings: soc: loongson,ls2k-pmc: Allow
    syscon-reboot/syscon-poweroff as child
  soc: loongson: loongson2_pm: Populate children syscon nodes

 .../soc/loongson/loongson,ls2k-pmc.yaml       | 43 ++++++++++++++++---
 drivers/soc/loongson/Kconfig                  |  1 +
 drivers/soc/loongson/loongson2_pm.c           |  7 ++-
 3 files changed, 44 insertions(+), 7 deletions(-)

Comments

Randy Dunlap Sept. 2, 2023, 3:43 p.m. UTC | #1
On 9/2/23 01:47, Binbin Zhou wrote:
> Since commit 67694c076bd7 ("soc: loongson2_pm: add power management
> support"), the Loongson-2K PM driver was added, but it didn't update the
> Kconfig entry for the INPUT dependency, leading to build errors:
> 
> /opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
> drivers/soc/loongson/loongson2_pm.o: in function `loongson2_power_button_init':
> /work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:101:(.text+0x350): undefined reference to `input_allocate_device'
> /opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
> /work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:109:(.text+0x3dc): undefined reference to `input_set_capability'
> /opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
> /work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:111:(.text+0x3e4): undefined reference to `input_register_device'
> /opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
> /work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:125:(.text+0x3fc): undefined reference to `input_free_device'
> /opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld: drivers/soc/loongson/loongson2_pm.o: in function `input_report_key':
> /work/lnx/next/linux-next-20230825/LOONG64/../include/linux/input.h:425:(.text+0x58c): undefined reference to `input_event'
> 
> Also, since this driver can only be built-in, it fails to link when the
> INPUT is in a loadable module, so we should update the Kconfig entry to
> depend on INPUT=y.
> 
> Fixes: 67694c076bd7 ("soc: loongson2_pm: add power management support")
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  drivers/soc/loongson/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/soc/loongson/Kconfig b/drivers/soc/loongson/Kconfig
> index 314e13bb3e01..368344943a93 100644
> --- a/drivers/soc/loongson/Kconfig
> +++ b/drivers/soc/loongson/Kconfig
> @@ -20,6 +20,7 @@ config LOONGSON2_GUTS
>  config LOONGSON2_PM
>  	bool "Loongson-2 SoC Power Management Controller Driver"
>  	depends on LOONGARCH && OF
> +	depends on INPUT=y
>  	help
>  	  The Loongson-2's power management controller was ACPI, supports ACPI
>  	  S2Idle (Suspend To Idle), ACPI S3 (Suspend To RAM), ACPI S4 (Suspend To
Randy Dunlap Sept. 19, 2023, 3:36 p.m. UTC | #2
Hi--

On 9/2/23 08:43, Randy Dunlap wrote:
> 
> 
> On 9/2/23 01:47, Binbin Zhou wrote:
>> Since commit 67694c076bd7 ("soc: loongson2_pm: add power management
>> support"), the Loongson-2K PM driver was added, but it didn't update the
>> Kconfig entry for the INPUT dependency, leading to build errors:
>>
>> /opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
>> drivers/soc/loongson/loongson2_pm.o: in function `loongson2_power_button_init':
>> /work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:101:(.text+0x350): undefined reference to `input_allocate_device'
>> /opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
>> /work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:109:(.text+0x3dc): undefined reference to `input_set_capability'
>> /opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
>> /work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:111:(.text+0x3e4): undefined reference to `input_register_device'
>> /opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
>> /work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:125:(.text+0x3fc): undefined reference to `input_free_device'
>> /opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld: drivers/soc/loongson/loongson2_pm.o: in function `input_report_key':
>> /work/lnx/next/linux-next-20230825/LOONG64/../include/linux/input.h:425:(.text+0x58c): undefined reference to `input_event'
>>
>> Also, since this driver can only be built-in, it fails to link when the
>> INPUT is in a loadable module, so we should update the Kconfig entry to
>> depend on INPUT=y.
>>
>> Fixes: 67694c076bd7 ("soc: loongson2_pm: add power management support")
>> Reported-by: Randy Dunlap <rdunlap@infradead.org>
>> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> 
> Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
> Tested-by: Randy Dunlap <rdunlap@infradead.org>
> 
> Thanks.

What's the status of this patch?
linux-next builds are still failing without this patch.

Thanks.

> 
>> ---
>>  drivers/soc/loongson/Kconfig | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/soc/loongson/Kconfig b/drivers/soc/loongson/Kconfig
>> index 314e13bb3e01..368344943a93 100644
>> --- a/drivers/soc/loongson/Kconfig
>> +++ b/drivers/soc/loongson/Kconfig
>> @@ -20,6 +20,7 @@ config LOONGSON2_GUTS
>>  config LOONGSON2_PM
>>  	bool "Loongson-2 SoC Power Management Controller Driver"
>>  	depends on LOONGARCH && OF
>> +	depends on INPUT=y
>>  	help
>>  	  The Loongson-2's power management controller was ACPI, supports ACPI
>>  	  S2Idle (Suspend To Idle), ACPI S3 (Suspend To RAM), ACPI S4 (Suspend To
>
Arnd Bergmann Sept. 22, 2023, 2:42 p.m. UTC | #3
On Tue, Sep 19, 2023, at 12:15, Huacai Chen wrote:
> On Tue, Sep 19, 2023 at 11:48 PM Conor Dooley <conor@kernel.org> wrote:
>> On Tue, Sep 19, 2023 at 08:36:50AM -0700, Randy Dunlap wrote:
>>
>> Seemingly this was sent again in isolation 2 weeks ago, but neither the
>> maintainer (Huacai) nor soc@kernel.org were on cc:
>>
>> https://lore.kernel.org/all/20230905123629.4510-1-zhuyinbo@loongson.cn/
> v3 indeed cc-ed soc@kernel.org. :)
>
> Arnd, could you please take this series to the soc tree? And also this 
> series:
> https://lore.kernel.org/loongarch/cover.1693534134.git.zhoubinbin@loongson.cn/T/#t

Sorry, I have been traveling and not pushed out the tree yet.

Can you confirm that the input dependency is required for 6.6
and the other series can wait until 6.7? When you send patches
to soc@kernel.org, please always mention which tree you intend
them for. I might disagree, but it's better than having to guess.

     Arnd
Binbin Zhou Sept. 24, 2023, 12:21 p.m. UTC | #4
On Fri, Sep 22, 2023 at 10:43 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Tue, Sep 19, 2023, at 12:15, Huacai Chen wrote:
> > On Tue, Sep 19, 2023 at 11:48 PM Conor Dooley <conor@kernel.org> wrote:
> >> On Tue, Sep 19, 2023 at 08:36:50AM -0700, Randy Dunlap wrote:
> >>
> >> Seemingly this was sent again in isolation 2 weeks ago, but neither the
> >> maintainer (Huacai) nor soc@kernel.org were on cc:
> >>
> >> https://lore.kernel.org/all/20230905123629.4510-1-zhuyinbo@loongson.cn/
> > v3 indeed cc-ed soc@kernel.org. :)
> >
> > Arnd, could you please take this series to the soc tree? And also this
> > series:
> > https://lore.kernel.org/loongarch/cover.1693534134.git.zhoubinbin@loongson.cn/T/#t
>
> Sorry, I have been traveling and not pushed out the tree yet.
>
> Can you confirm that the input dependency is required for 6.6
> and the other series can wait until 6.7? When you send patches
> to soc@kernel.org, please always mention which tree you intend
> them for. I might disagree, but it's better than having to guess.
>
Hi Arnd:

Thanks for your reply.

As we know, this driver was just merged in during the v6.6 window, and
no release will use it until now:

commit 67694c076bd7 soc: loongson2_pm: add power management support
commit 6054a676e969 soc: dt-bindings: add loongson-2 pm

Now, since the Loongson-2K series SoCs are indifferent at the driver
level, we used fallback compatible and added
syscon-reboot/syscon-poweroff subnodes for power on/off functionality.
These somewhat break the original devicetree rules.
So, I think these patches need to be merged in before the v6.6 release
to avoid unnecessary compatibility issues.
Of course, I added the "Fixes:" tag in the corresponding patch.

Thanks.
Binbin

>      Arnd