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
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
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 >> >
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
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
>>>>
>>>
>>
>
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.
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
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
© 2016 - 2026 Red Hat, Inc.