public inbox for linux-rtc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] spacemit: fix P1 sub-device Kconfig defaults and dependencies
@ 2025-12-25  7:46 Troy Mitchell
  2025-12-25  7:46 ` [PATCH v4 1/3] regulator: spacemit: MFD_SPACEMIT_P1 as dependencies Troy Mitchell
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Troy Mitchell @ 2025-12-25  7:46 UTC (permalink / raw)
  To: Lee Jones, Yixun Lan, Alex Elder, Andi Shyti, Alexandre Belloni,
	Liam Girdwood, Mark Brown
  Cc: linux-kernel, linux-riscv, spacemit, linux-i2c, linux-rtc,
	Troy Mitchell

This series fixes Kconfig default value and dependency handling for
the SpacemiT P1 PMIC and its sub-devices.

Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
Troy Mitchell (3):
      regulator: spacemit: MFD_SPACEMIT_P1 as dependencies
      mfd: simple-mfd-i2c: add default value
      rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled

 drivers/mfd/Kconfig       | 1 +
 drivers/regulator/Kconfig | 5 ++---
 drivers/rtc/Kconfig       | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
---
base-commit: b87881a3c93345252ce8559ad763369febfdb75d
change-id: 20251021-p1-kconfig-fix-6d2b59d03b8f

Best regards,
-- 
Troy Mitchell <troy.mitchell@linux.spacemit.com>


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

* [PATCH v4 1/3] regulator: spacemit: MFD_SPACEMIT_P1 as dependencies
  2025-12-25  7:46 [PATCH v4 0/3] spacemit: fix P1 sub-device Kconfig defaults and dependencies Troy Mitchell
@ 2025-12-25  7:46 ` Troy Mitchell
  2025-12-25  7:46 ` [PATCH v4 2/3] mfd: simple-mfd-i2c: add default value Troy Mitchell
  2025-12-25  7:46 ` [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled Troy Mitchell
  2 siblings, 0 replies; 12+ messages in thread
From: Troy Mitchell @ 2025-12-25  7:46 UTC (permalink / raw)
  To: Lee Jones, Yixun Lan, Alex Elder, Andi Shyti, Alexandre Belloni,
	Liam Girdwood, Mark Brown
  Cc: linux-kernel, linux-riscv, spacemit, linux-i2c, linux-rtc,
	Troy Mitchell

REGULATOR_SPACEMIT_P1 is a subdevice of P1 and should depend on
MFD_SPACEMIT_P1 rather than selecting it directly. Using 'select'
does not always respect the parent's dependencies, so 'depends on'
is the safer and more correct choice.

Since MFD_SPACEMIT_P1 already depends on I2C_K1, the dependency
in REGULATOR_SPACEMIT_P1 is now redundant.

Additionally, the default value depends on MFD_SPACEMIT_P1 rather
than ARCH_SPACEMIT.

Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Alex Elder <elder@riscstar.com>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
Change log in v4:
- default m if MFD_SPACEMIT_P1 instead of default MFD_SPACEMIT_P1
Link to v3: https://lore.kernel.org/all/20251118-p1-kconfig-fix-v3-3-8839c5ac5db3@linux.spacemit.com/

Changelog in v3:
- modify commit message
- change default value from ARCH_SPACEMIT to MFD_SPACEMIT_P1
- Link to v2: https://lore.kernel.org/all/20251027-p1-kconfig-fix-v2-4-49688f30bae8@linux.spacemit.com/
---
 drivers/regulator/Kconfig | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index d2335276cce5ffbd500bbaf251d1761a9116aee9..b51888a9a78f399a6af3294fc19f60792576332c 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -1496,9 +1496,8 @@ config REGULATOR_SLG51000
 config REGULATOR_SPACEMIT_P1
 	tristate "SpacemiT P1 regulators"
 	depends on ARCH_SPACEMIT || COMPILE_TEST
-	depends on I2C
-	select MFD_SPACEMIT_P1
-	default ARCH_SPACEMIT
+	depends on MFD_SPACEMIT_P1
+	default m if MFD_SPACEMIT_P1
 	help
 	  Enable support for regulators implemented by the SpacemiT P1
 	  power controller.  The P1 implements 6 high-efficiency buck

-- 
2.52.0


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

* [PATCH v4 2/3] mfd: simple-mfd-i2c: add default value
  2025-12-25  7:46 [PATCH v4 0/3] spacemit: fix P1 sub-device Kconfig defaults and dependencies Troy Mitchell
  2025-12-25  7:46 ` [PATCH v4 1/3] regulator: spacemit: MFD_SPACEMIT_P1 as dependencies Troy Mitchell
@ 2025-12-25  7:46 ` Troy Mitchell
  2026-01-09 16:41   ` (subset) " Lee Jones
  2025-12-25  7:46 ` [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled Troy Mitchell
  2 siblings, 1 reply; 12+ messages in thread
From: Troy Mitchell @ 2025-12-25  7:46 UTC (permalink / raw)
  To: Lee Jones, Yixun Lan, Alex Elder, Andi Shyti, Alexandre Belloni,
	Liam Girdwood, Mark Brown
  Cc: linux-kernel, linux-riscv, spacemit, linux-i2c, linux-rtc,
	Troy Mitchell

The default value of the P1 sub-device depends on the value
of P1, so P1 should have a default value here.

Acked-by: Alex Elder <elder@riscstar.com>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
Change log in v4:
- default m if ARCH_SPACEMIT instead of default ARCH_SPACEMIT
- Link to v3: https://lore.kernel.org/all/20251118-p1-kconfig-fix-v3-4-8839c5ac5db3@linux.spacemit.com/
---
 drivers/mfd/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index aace5766b38aa5e46e32a8a7b42eea238159fbcf..c757bc365029dc794c658fc5b10084a0f29ac9b6 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1276,6 +1276,7 @@ config MFD_SPACEMIT_P1
 	depends on ARCH_SPACEMIT || COMPILE_TEST
 	depends on I2C
 	select MFD_SIMPLE_MFD_I2C
+	default m if ARCH_SPACEMIT
 	help
 	  This option supports the I2C-based SpacemiT P1 PMIC, which
 	  contains regulators, a power switch, GPIOs, an RTC, and more.

-- 
2.52.0


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

* [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled
  2025-12-25  7:46 [PATCH v4 0/3] spacemit: fix P1 sub-device Kconfig defaults and dependencies Troy Mitchell
  2025-12-25  7:46 ` [PATCH v4 1/3] regulator: spacemit: MFD_SPACEMIT_P1 as dependencies Troy Mitchell
  2025-12-25  7:46 ` [PATCH v4 2/3] mfd: simple-mfd-i2c: add default value Troy Mitchell
@ 2025-12-25  7:46 ` Troy Mitchell
  2025-12-25 16:53   ` Alexandre Belloni
  2 siblings, 1 reply; 12+ messages in thread
From: Troy Mitchell @ 2025-12-25  7:46 UTC (permalink / raw)
  To: Lee Jones, Yixun Lan, Alex Elder, Andi Shyti, Alexandre Belloni,
	Liam Girdwood, Mark Brown
  Cc: linux-kernel, linux-riscv, spacemit, linux-i2c, linux-rtc,
	Troy Mitchell

The RTC driver defaulted to the same value as MFD_SPACEMIT_P1, which
caused it to be built-in automatically whenever the PMIC support was
set to y.

This is not always desirable, as the RTC function is not required on
all platforms using the SpacemiT P1 PMIC.

Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
 drivers/rtc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 50dc779f7f983074df7882200c90f0df21d142f2..53866493e9bbaf35ff0de85cbfe43e8343eadc1e 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -410,7 +410,7 @@ config RTC_DRV_SPACEMIT_P1
 	tristate "SpacemiT P1 RTC"
 	depends on ARCH_SPACEMIT || COMPILE_TEST
 	depends on MFD_SPACEMIT_P1
-	default MFD_SPACEMIT_P1
+	default m if MFD_SPACEMIT_P1
 	help
 	  Enable support for the RTC function in the SpacemiT P1 PMIC.
 	  This driver can also be built as a module, which will be called

-- 
2.52.0


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

* Re: [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled
  2025-12-25  7:46 ` [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled Troy Mitchell
@ 2025-12-25 16:53   ` Alexandre Belloni
  2025-12-29 18:02     ` Alex Elder
  0 siblings, 1 reply; 12+ messages in thread
From: Alexandre Belloni @ 2025-12-25 16:53 UTC (permalink / raw)
  To: Troy Mitchell
  Cc: Lee Jones, Yixun Lan, Alex Elder, Andi Shyti, Liam Girdwood,
	Mark Brown, linux-kernel, linux-riscv, spacemit, linux-i2c,
	linux-rtc

On 25/12/2025 15:46:33+0800, Troy Mitchell wrote:
> The RTC driver defaulted to the same value as MFD_SPACEMIT_P1, which
> caused it to be built-in automatically whenever the PMIC support was
> set to y.
> 
> This is not always desirable, as the RTC function is not required on
> all platforms using the SpacemiT P1 PMIC.

But then, can't people simply change the config? I don't feel like
this is an improvement.

> 
> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
> ---
>  drivers/rtc/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 50dc779f7f983074df7882200c90f0df21d142f2..53866493e9bbaf35ff0de85cbfe43e8343eadc1e 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -410,7 +410,7 @@ config RTC_DRV_SPACEMIT_P1
>  	tristate "SpacemiT P1 RTC"
>  	depends on ARCH_SPACEMIT || COMPILE_TEST
>  	depends on MFD_SPACEMIT_P1
> -	default MFD_SPACEMIT_P1
> +	default m if MFD_SPACEMIT_P1
>  	help
>  	  Enable support for the RTC function in the SpacemiT P1 PMIC.
>  	  This driver can also be built as a module, which will be called
> 
> -- 
> 2.52.0
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled
  2025-12-25 16:53   ` Alexandre Belloni
@ 2025-12-29 18:02     ` Alex Elder
  2025-12-30  0:51       ` Alexandre Belloni
  0 siblings, 1 reply; 12+ messages in thread
From: Alex Elder @ 2025-12-29 18:02 UTC (permalink / raw)
  To: Alexandre Belloni, Troy Mitchell
  Cc: Lee Jones, Yixun Lan, Andi Shyti, Liam Girdwood, Mark Brown,
	linux-kernel, linux-riscv, spacemit, linux-i2c, linux-rtc

On 12/25/25 10:53 AM, Alexandre Belloni wrote:
> On 25/12/2025 15:46:33+0800, Troy Mitchell wrote:
>> The RTC driver defaulted to the same value as MFD_SPACEMIT_P1, which
>> caused it to be built-in automatically whenever the PMIC support was
>> set to y.
>>
>> This is not always desirable, as the RTC function is not required on
>> all platforms using the SpacemiT P1 PMIC.
> 
> But then, can't people simply change the config? I don't feel like
> this is an improvement.

It's not an improvement for people who want to use the SpacemiT
P1 PMIC, but it's an improvement for all the other RISC-V builds
using "defconfig" that would rather have that support be modular
to avoid needlessly consuming resources.

I haven't done any testing on this but it looks fine to me.

Acked-by: Alex Elder <elder@riscstar.com>

I think it's a small change worth merging.  I don't think
doing so does any harm.  Your call or course, Alexandre.

					-Alex

>> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
>> ---
>>   drivers/rtc/Kconfig | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
>> index 50dc779f7f983074df7882200c90f0df21d142f2..53866493e9bbaf35ff0de85cbfe43e8343eadc1e 100644
>> --- a/drivers/rtc/Kconfig
>> +++ b/drivers/rtc/Kconfig
>> @@ -410,7 +410,7 @@ config RTC_DRV_SPACEMIT_P1
>>   	tristate "SpacemiT P1 RTC"
>>   	depends on ARCH_SPACEMIT || COMPILE_TEST
>>   	depends on MFD_SPACEMIT_P1
>> -	default MFD_SPACEMIT_P1
>> +	default m if MFD_SPACEMIT_P1
>>   	help
>>   	  Enable support for the RTC function in the SpacemiT P1 PMIC.
>>   	  This driver can also be built as a module, which will be called
>>
>> -- 
>> 2.52.0
>>
> 


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

* Re: [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled
  2025-12-29 18:02     ` Alex Elder
@ 2025-12-30  0:51       ` Alexandre Belloni
  2025-12-30  1:46         ` Alex Elder
  0 siblings, 1 reply; 12+ messages in thread
From: Alexandre Belloni @ 2025-12-30  0:51 UTC (permalink / raw)
  To: Alex Elder
  Cc: Troy Mitchell, Lee Jones, Yixun Lan, Andi Shyti, Liam Girdwood,
	Mark Brown, linux-kernel, linux-riscv, spacemit, linux-i2c,
	linux-rtc

On 29/12/2025 12:02:23-0600, Alex Elder wrote:
> On 12/25/25 10:53 AM, Alexandre Belloni wrote:
> > On 25/12/2025 15:46:33+0800, Troy Mitchell wrote:
> > > The RTC driver defaulted to the same value as MFD_SPACEMIT_P1, which
> > > caused it to be built-in automatically whenever the PMIC support was
> > > set to y.
> > > 
> > > This is not always desirable, as the RTC function is not required on
> > > all platforms using the SpacemiT P1 PMIC.
> > 
> > But then, can't people simply change the config? I don't feel like
> > this is an improvement.
> 
> It's not an improvement for people who want to use the SpacemiT
> P1 PMIC, but it's an improvement for all the other RISC-V builds
> using "defconfig" that would rather have that support be modular
> to avoid needlessly consuming resources.

But then, wouldn't MFD_SPACEMIT_P1 be simply not set or set to m ? So
this doesn't have any impact on other RISC-V builds while it makes
people using the SpacemiT P1 PMIC jump through hoops to be able to use
the RTC as this is a very uncommon way to set default values.

My point is:
 - other RISC-V platforms would simply not select MFD_SPACEMIT_P1 or
   have MFD_SPACEMIT_P1 set to m
 - having RTC_DRV_SPACEMIT_P1 built-in by default when MFD_SPACEMIT_P1
   is built-in doesn't really hurt any SpacemiT P1 users but would be
   the expectation of those using the RTC.
 - those wanting to optimise because they won't use the RTC, they can
   already simply unselect RTC_DRV_SPACEMIT_P1 or set it to m.

> 
> I haven't done any testing on this but it looks fine to me.
> 
> Acked-by: Alex Elder <elder@riscstar.com>
> 
> I think it's a small change worth merging.  I don't think
> doing so does any harm.  Your call or course, Alexandre.
> 
> 					-Alex
> 
> > > Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
> > > ---
> > >   drivers/rtc/Kconfig | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> > > index 50dc779f7f983074df7882200c90f0df21d142f2..53866493e9bbaf35ff0de85cbfe43e8343eadc1e 100644
> > > --- a/drivers/rtc/Kconfig
> > > +++ b/drivers/rtc/Kconfig
> > > @@ -410,7 +410,7 @@ config RTC_DRV_SPACEMIT_P1
> > >   	tristate "SpacemiT P1 RTC"
> > >   	depends on ARCH_SPACEMIT || COMPILE_TEST
> > >   	depends on MFD_SPACEMIT_P1
> > > -	default MFD_SPACEMIT_P1
> > > +	default m if MFD_SPACEMIT_P1
> > >   	help
> > >   	  Enable support for the RTC function in the SpacemiT P1 PMIC.
> > >   	  This driver can also be built as a module, which will be called
> > > 
> > > -- 
> > > 2.52.0
> > > 
> > 
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled
  2025-12-30  0:51       ` Alexandre Belloni
@ 2025-12-30  1:46         ` Alex Elder
  2026-01-09 22:36           ` Alexandre Belloni
  0 siblings, 1 reply; 12+ messages in thread
From: Alex Elder @ 2025-12-30  1:46 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Troy Mitchell, Lee Jones, Yixun Lan, Andi Shyti, Liam Girdwood,
	Mark Brown, linux-kernel, linux-riscv, spacemit, linux-i2c,
	linux-rtc

On 12/29/25 6:51 PM, Alexandre Belloni wrote:
> On 29/12/2025 12:02:23-0600, Alex Elder wrote:
>> On 12/25/25 10:53 AM, Alexandre Belloni wrote:
>>> On 25/12/2025 15:46:33+0800, Troy Mitchell wrote:
>>>> The RTC driver defaulted to the same value as MFD_SPACEMIT_P1, which
>>>> caused it to be built-in automatically whenever the PMIC support was
>>>> set to y.
>>>>
>>>> This is not always desirable, as the RTC function is not required on
>>>> all platforms using the SpacemiT P1 PMIC.
>>>
>>> But then, can't people simply change the config? I don't feel like
>>> this is an improvement.
>>
>> It's not an improvement for people who want to use the SpacemiT
>> P1 PMIC, but it's an improvement for all the other RISC-V builds
>> using "defconfig" that would rather have that support be modular
>> to avoid needlessly consuming resources.
> 
> But then, wouldn't MFD_SPACEMIT_P1 be simply not set or set to m ? So
> this doesn't have any impact on other RISC-V builds while it makes
> people using the SpacemiT P1 PMIC jump through hoops to be able to use
> the RTC as this is a very uncommon way to set default values.
> 
> My point is:
>   - other RISC-V platforms would simply not select MFD_SPACEMIT_P1 or
>     have MFD_SPACEMIT_P1 set to m
>   - having RTC_DRV_SPACEMIT_P1 built-in by default when MFD_SPACEMIT_P1
>     is built-in doesn't really hurt any SpacemiT P1 users but would be
>     the expectation of those using the RTC.

The "hurt" isn't about P1 users, it's about everyone else.

>   - those wanting to optimise because they won't use the RTC, they can
>     already simply unselect RTC_DRV_SPACEMIT_P1 or set it to m.


The purpose is to make the driver a module (not built-in)
when "defconfig" is used (without the need for any Kconfig
fragments to unselect things).


In arch/riscv/configs/defconfig, we have this:
     CONFIG_ARCH_SPACEMIT=y

In drivers/mfd/Kconfig b/drivers/mfd/Kconfig, we have this
(added by patch 2 in this series):
     config MFD_SPACEMIT_P1
	default m if ARCH_SPACEMIT

So when using defconfig (alone), MFD_SPACEMIT_P1 is set to m,
to benefit non-SpacemiT RISC-V platforms.

This patch is trying to do the same thing for the RTC,
i.e. having RTC_DRV_SPACEMIT_P1 be defined as a module
by default.

I think you understand.

					-Alex
>> I haven't done any testing on this but it looks fine to me.
>>
>> Acked-by: Alex Elder <elder@riscstar.com>
>>
>> I think it's a small change worth merging.  I don't think
>> doing so does any harm.  Your call or course, Alexandre.
>>
>> 					-Alex
>>
>>>> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
>>>> ---
>>>>    drivers/rtc/Kconfig | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
>>>> index 50dc779f7f983074df7882200c90f0df21d142f2..53866493e9bbaf35ff0de85cbfe43e8343eadc1e 100644
>>>> --- a/drivers/rtc/Kconfig
>>>> +++ b/drivers/rtc/Kconfig
>>>> @@ -410,7 +410,7 @@ config RTC_DRV_SPACEMIT_P1
>>>>    	tristate "SpacemiT P1 RTC"
>>>>    	depends on ARCH_SPACEMIT || COMPILE_TEST
>>>>    	depends on MFD_SPACEMIT_P1
>>>> -	default MFD_SPACEMIT_P1
>>>> +	default m if MFD_SPACEMIT_P1
>>>>    	help
>>>>    	  Enable support for the RTC function in the SpacemiT P1 PMIC.
>>>>    	  This driver can also be built as a module, which will be called
>>>>
>>>> -- 
>>>> 2.52.0
>>>>
>>>
>>
> 


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

* Re: (subset) [PATCH v4 2/3] mfd: simple-mfd-i2c: add default value
  2025-12-25  7:46 ` [PATCH v4 2/3] mfd: simple-mfd-i2c: add default value Troy Mitchell
@ 2026-01-09 16:41   ` Lee Jones
  0 siblings, 0 replies; 12+ messages in thread
From: Lee Jones @ 2026-01-09 16:41 UTC (permalink / raw)
  To: Lee Jones, Yixun Lan, Alex Elder, Andi Shyti, Alexandre Belloni,
	Liam Girdwood, Mark Brown, Troy Mitchell
  Cc: linux-kernel, linux-riscv, spacemit, linux-i2c, linux-rtc

On Thu, 25 Dec 2025 15:46:32 +0800, Troy Mitchell wrote:
> The default value of the P1 sub-device depends on the value
> of P1, so P1 should have a default value here.
> 
> 

Applied, thanks!

[2/3] mfd: simple-mfd-i2c: add default value
      commit: 77df11d1f1f962636e897f3fcf0977109aa74791

--
Lee Jones [李琼斯]


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

* Re: [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled
  2025-12-30  1:46         ` Alex Elder
@ 2026-01-09 22:36           ` Alexandre Belloni
  2026-01-11 19:55             ` Alex Elder
  0 siblings, 1 reply; 12+ messages in thread
From: Alexandre Belloni @ 2026-01-09 22:36 UTC (permalink / raw)
  To: Alex Elder
  Cc: Troy Mitchell, Lee Jones, Yixun Lan, Andi Shyti, Liam Girdwood,
	Mark Brown, linux-kernel, linux-riscv, spacemit, linux-i2c,
	linux-rtc

On 29/12/2025 19:46:59-0600, Alex Elder wrote:
> On 12/29/25 6:51 PM, Alexandre Belloni wrote:
> > On 29/12/2025 12:02:23-0600, Alex Elder wrote:
> > > On 12/25/25 10:53 AM, Alexandre Belloni wrote:
> > > > On 25/12/2025 15:46:33+0800, Troy Mitchell wrote:
> > > > > The RTC driver defaulted to the same value as MFD_SPACEMIT_P1, which
> > > > > caused it to be built-in automatically whenever the PMIC support was
> > > > > set to y.
> > > > > 
> > > > > This is not always desirable, as the RTC function is not required on
> > > > > all platforms using the SpacemiT P1 PMIC.
> > > > 
> > > > But then, can't people simply change the config? I don't feel like
> > > > this is an improvement.
> > > 
> > > It's not an improvement for people who want to use the SpacemiT
> > > P1 PMIC, but it's an improvement for all the other RISC-V builds
> > > using "defconfig" that would rather have that support be modular
> > > to avoid needlessly consuming resources.
> > 
> > But then, wouldn't MFD_SPACEMIT_P1 be simply not set or set to m ? So
> > this doesn't have any impact on other RISC-V builds while it makes
> > people using the SpacemiT P1 PMIC jump through hoops to be able to use
> > the RTC as this is a very uncommon way to set default values.
> > 
> > My point is:
> >   - other RISC-V platforms would simply not select MFD_SPACEMIT_P1 or
> >     have MFD_SPACEMIT_P1 set to m
> >   - having RTC_DRV_SPACEMIT_P1 built-in by default when MFD_SPACEMIT_P1
> >     is built-in doesn't really hurt any SpacemiT P1 users but would be
> >     the expectation of those using the RTC.
> 
> The "hurt" isn't about P1 users, it's about everyone else.
> 
> >   - those wanting to optimise because they won't use the RTC, they can
> >     already simply unselect RTC_DRV_SPACEMIT_P1 or set it to m.
> 
> 
> The purpose is to make the driver a module (not built-in)
> when "defconfig" is used (without the need for any Kconfig
> fragments to unselect things).
> 
> 
> In arch/riscv/configs/defconfig, we have this:
>     CONFIG_ARCH_SPACEMIT=y
> 
> In drivers/mfd/Kconfig b/drivers/mfd/Kconfig, we have this
> (added by patch 2 in this series):
>     config MFD_SPACEMIT_P1
> 	default m if ARCH_SPACEMIT
> 
> So when using defconfig (alone), MFD_SPACEMIT_P1 is set to m,
> to benefit non-SpacemiT RISC-V platforms.
> 
> This patch is trying to do the same thing for the RTC,
> i.e. having RTC_DRV_SPACEMIT_P1 be defined as a module
> by default.
> 
> I think you understand.

I'm sorry, I must be dumb but I don't understand. The current behaviour
is that when MFD_SPACEMIT_P1 is m, then the default value for
RTC_DRV_SPACEMIT_P1 will be m. Since patch 2 makes it exactly that way
(MFD_SPACEMIT_P set to m), I don't get why it is necessary to mess with
the default of RTC_DRV_SPACEMIT_P1.

The current default behaviour of RTC_DRV_SPACEMIT_P1 seems to be the
correct one and the proper fix is then patch 2.

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

* Re: [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled
  2026-01-09 22:36           ` Alexandre Belloni
@ 2026-01-11 19:55             ` Alex Elder
  2026-01-12  1:49               ` Troy Mitchell
  0 siblings, 1 reply; 12+ messages in thread
From: Alex Elder @ 2026-01-11 19:55 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Troy Mitchell, Lee Jones, Yixun Lan, Andi Shyti, Liam Girdwood,
	Mark Brown, linux-kernel, linux-riscv, spacemit, linux-i2c,
	linux-rtc

On 1/9/26 4:36 PM, Alexandre Belloni wrote:
>> The purpose is to make the driver a module (not built-in)
>> when "defconfig" is used (without the need for any Kconfig
>> fragments to unselect things).
>>
>>
>> In arch/riscv/configs/defconfig, we have this:
>>      CONFIG_ARCH_SPACEMIT=y
>>
>> In drivers/mfd/Kconfig b/drivers/mfd/Kconfig, we have this
>> (added by patch 2 in this series):
>>      config MFD_SPACEMIT_P1
>> 	default m if ARCH_SPACEMIT
>>
>> So when using defconfig (alone), MFD_SPACEMIT_P1 is set to m,
>> to benefit non-SpacemiT RISC-V platforms.
>>
>> This patch is trying to do the same thing for the RTC,
>> i.e. having RTC_DRV_SPACEMIT_P1 be defined as a module
>> by default.
>>
>> I think you understand.
> I'm sorry, I must be dumb but I don't understand. The current behaviour

I think I'm the dumb one.  I think I finally understand your
point.

> is that when MFD_SPACEMIT_P1 is m, then the default value for
> RTC_DRV_SPACEMIT_P1 will be m. Since patch 2 makes it exactly that way
> (MFD_SPACEMIT_P set to m), I don't get why it is necessary to mess with
> the default of RTC_DRV_SPACEMIT_P1.

Your point is that patch has no real effect, at least not
on the scenario I was talking about.

I.e., I was saying this mattered for using defconfig alone.
But, as you point out, using defconfig alone gives us:

   ARCH_SPACMIT=y	(in defconfig)
   MFD_SPACEMIT_P1=m	(from patch 2)

And then, *without* this patch:
   RTC_DRV_SPACEMIT_P1=MFD_SPACEMIT_P1
meaning
   RTC_DRV_SPACEMIT_P1=m

And therefore there's no need for this patch to set the
default to m rather than MFD_SPACEMIT_P1.


> The current default behaviour of RTC_DRV_SPACEMIT_P1 seems to be the
> correct one and the proper fix is then patch 2.

Yes, now I understand.  I'm sorry about my confusion.

					-Alex

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

* Re: [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled
  2026-01-11 19:55             ` Alex Elder
@ 2026-01-12  1:49               ` Troy Mitchell
  0 siblings, 0 replies; 12+ messages in thread
From: Troy Mitchell @ 2026-01-12  1:49 UTC (permalink / raw)
  To: Alex Elder, Alexandre Belloni
  Cc: Troy Mitchell, Lee Jones, Yixun Lan, Andi Shyti, Liam Girdwood,
	Mark Brown, linux-kernel, linux-riscv, spacemit, linux-i2c,
	linux-rtc

On Mon Jan 12, 2026 at 3:55 AM CST, Alex Elder wrote:
> On 1/9/26 4:36 PM, Alexandre Belloni wrote:
>>> The purpose is to make the driver a module (not built-in)
>>> when "defconfig" is used (without the need for any Kconfig
>>> fragments to unselect things).
>>>
>>>
>>> In arch/riscv/configs/defconfig, we have this:
>>>      CONFIG_ARCH_SPACEMIT=y
>>>
>>> In drivers/mfd/Kconfig b/drivers/mfd/Kconfig, we have this
>>> (added by patch 2 in this series):
>>>      config MFD_SPACEMIT_P1
>>> 	default m if ARCH_SPACEMIT
>>>
>>> So when using defconfig (alone), MFD_SPACEMIT_P1 is set to m,
>>> to benefit non-SpacemiT RISC-V platforms.
>>>
>>> This patch is trying to do the same thing for the RTC,
>>> i.e. having RTC_DRV_SPACEMIT_P1 be defined as a module
>>> by default.
>>>
>>> I think you understand.
>> I'm sorry, I must be dumb but I don't understand. The current behaviour
>
> I think I'm the dumb one.  I think I finally understand your
> point.
>
>> is that when MFD_SPACEMIT_P1 is m, then the default value for
>> RTC_DRV_SPACEMIT_P1 will be m. Since patch 2 makes it exactly that way
>> (MFD_SPACEMIT_P set to m), I don't get why it is necessary to mess with
>> the default of RTC_DRV_SPACEMIT_P1.
>
> Your point is that patch has no real effect, at least not
> on the scenario I was talking about.
>
> I.e., I was saying this mattered for using defconfig alone.
> But, as you point out, using defconfig alone gives us:
>
>    ARCH_SPACMIT=y	(in defconfig)
>    MFD_SPACEMIT_P1=m	(from patch 2)
>
> And then, *without* this patch:
>    RTC_DRV_SPACEMIT_P1=MFD_SPACEMIT_P1
> meaning
>    RTC_DRV_SPACEMIT_P1=m
>
> And therefore there's no need for this patch to set the
> default to m rather than MFD_SPACEMIT_P1.
>
Thanks Alex and Alexandre for the clarification. You're absolutely right - 
the patch is indeed redundant since RTC_DRV_SPACEMIT_P1 already inherits 
the correct default value (m) through its dependency on MFD_SPACEMIT_P1.

I'll drop this patch in the next version and review the rest of the series
for similar unnecessary default overrides.

                                          - Troy
>
>
>> The current default behaviour of RTC_DRV_SPACEMIT_P1 seems to be the
>> correct one and the proper fix is then patch 2.
>
> Yes, now I understand.  I'm sorry about my confusion.
>
> 					-Alex


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

end of thread, other threads:[~2026-01-12  1:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-25  7:46 [PATCH v4 0/3] spacemit: fix P1 sub-device Kconfig defaults and dependencies Troy Mitchell
2025-12-25  7:46 ` [PATCH v4 1/3] regulator: spacemit: MFD_SPACEMIT_P1 as dependencies Troy Mitchell
2025-12-25  7:46 ` [PATCH v4 2/3] mfd: simple-mfd-i2c: add default value Troy Mitchell
2026-01-09 16:41   ` (subset) " Lee Jones
2025-12-25  7:46 ` [PATCH v4 3/3] rtc: spacemit: default module when MFD_SPACEMIT_P1 is enabled Troy Mitchell
2025-12-25 16:53   ` Alexandre Belloni
2025-12-29 18:02     ` Alex Elder
2025-12-30  0:51       ` Alexandre Belloni
2025-12-30  1:46         ` Alex Elder
2026-01-09 22:36           ` Alexandre Belloni
2026-01-11 19:55             ` Alex Elder
2026-01-12  1:49               ` Troy Mitchell

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