[PATCH v1 1/2] mfd: mt6397: Add new bit definitions for RTC_BBPU register

ot_shunxi.zhang@mediatek.com posted 2 patches 6 months ago
There is a newer version of this series
[PATCH v1 1/2] mfd: mt6397: Add new bit definitions for RTC_BBPU register
Posted by ot_shunxi.zhang@mediatek.com 6 months ago
From: Shunxi Zhang <ot_shunxi.zhang@mediatek.com>

This patch adds new bit definitions for the RTC_BBPU register in the
mt6397 RTC header file. The following bit definitions are introduced:

Signed-off-by: Shunxi Zhang <ot_shunxi.zhang@mediatek.com>
---
 include/linux/mfd/mt6397/rtc.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h
index 27883af44f87..001cef6b7302 100644
--- a/include/linux/mfd/mt6397/rtc.h
+++ b/include/linux/mfd/mt6397/rtc.h
@@ -15,8 +15,11 @@
 #include <linux/rtc.h>
 
 #define RTC_BBPU               0x0000
+#define RTC_BBPU_PWREN         BIT(0)
+#define RTC_BBPU_CLR           BIT(1)
+#define RTC_BBPU_RESET_AL      BIT(3)
 #define RTC_BBPU_CBUSY         BIT(6)
-#define RTC_BBPU_KEY            (0x43 << 8)
+#define RTC_BBPU_KEY           (0x43 << 8)
 
 #define RTC_WRTGR_MT6358       0x003a
 #define RTC_WRTGR_MT6397       0x003c
-- 
2.46.0
Re: [PATCH v1 1/2] mfd: mt6397: Add new bit definitions for RTC_BBPU register
Posted by Krzysztof Kozlowski 6 months ago
On 11/08/2025 10:15, ot_shunxi.zhang@mediatek.com wrote:
> From: Shunxi Zhang <ot_shunxi.zhang@mediatek.com>
> 
> This patch adds new bit definitions for the RTC_BBPU register in the

Why? There is no user of these. Don't add useless defines.

> mt6397 RTC header file. The following bit definitions are introduced:

Hm?

> 
> Signed-off-by: Shunxi Zhang <ot_shunxi.zhang@mediatek.com>
> ---
>  include/linux/mfd/mt6397/rtc.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h
> index 27883af44f87..001cef6b7302 100644
> --- a/include/linux/mfd/mt6397/rtc.h
> +++ b/include/linux/mfd/mt6397/rtc.h
> @@ -15,8 +15,11 @@
>  #include <linux/rtc.h>
>  
>  #define RTC_BBPU               0x0000
> +#define RTC_BBPU_PWREN         BIT(0)
> +#define RTC_BBPU_CLR           BIT(1)
> +#define RTC_BBPU_RESET_AL      BIT(3)
>  #define RTC_BBPU_CBUSY         BIT(6)
> -#define RTC_BBPU_KEY            (0x43 << 8)
> +#define RTC_BBPU_KEY           (0x43 << 8)


Why?



Best regards,
Krzysztof
Re: [PATCH v1 1/2] mfd: mt6397: Add new bit definitions for RTC_BBPU register
Posted by Shunxi Zhang (章顺喜) 5 months, 3 weeks ago
On Mon, 2025-08-11 at 13:02 +0200, Krzysztof Kozlowski wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> On 11/08/2025 10:15, ot_shunxi.zhang@mediatek.com wrote:
> > From: Shunxi Zhang <ot_shunxi.zhang@mediatek.com>
> > 
> > This patch adds new bit definitions for the RTC_BBPU register in
> > the
> 
> Why? There is no user of these. Don't add useless defines.
> 
> > mt6397 RTC header file. The following bit definitions are
> > introduced:
> 
> Hm?
> 
> > 
> > Signed-off-by: Shunxi Zhang <ot_shunxi.zhang@mediatek.com>
> > ---
> >  include/linux/mfd/mt6397/rtc.h | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/linux/mfd/mt6397/rtc.h
> > b/include/linux/mfd/mt6397/rtc.h
> > index 27883af44f87..001cef6b7302 100644
> > --- a/include/linux/mfd/mt6397/rtc.h
> > +++ b/include/linux/mfd/mt6397/rtc.h
> > @@ -15,8 +15,11 @@
> >  #include <linux/rtc.h>
> > 
> >  #define RTC_BBPU               0x0000
> > +#define RTC_BBPU_PWREN         BIT(0)
> > +#define RTC_BBPU_CLR           BIT(1)
> > +#define RTC_BBPU_RESET_AL      BIT(3)
> >  #define RTC_BBPU_CBUSY         BIT(6)
> > -#define RTC_BBPU_KEY            (0x43 << 8)
> > +#define RTC_BBPU_KEY           (0x43 << 8)
> 
> 
> Why?
> 
> 
> 
> Best regards,
> Krzysztof

Dear sir,
The MT6397 is an integration of several ICs and does not have a
separate IC specification. I will check the relevant IC datasheets
again. I will remove the useless define in next version.

Thanks for your commnets.

Best regards
Shunxi Zhangus

Re: [PATCH v1 1/2] mfd: mt6397: Add new bit definitions for RTC_BBPU register
Posted by Krzysztof Kozlowski 5 months, 3 weeks ago
On 19/08/2025 09:54, Shunxi Zhang (章顺喜) wrote:
>>>  #define RTC_BBPU               0x0000
>>> +#define RTC_BBPU_PWREN         BIT(0)
>>> +#define RTC_BBPU_CLR           BIT(1)
>>> +#define RTC_BBPU_RESET_AL      BIT(3)
>>>  #define RTC_BBPU_CBUSY         BIT(6)
>>> -#define RTC_BBPU_KEY            (0x43 << 8)
>>> +#define RTC_BBPU_KEY           (0x43 << 8)
>>
>>
>> Why?
>>
>>
>>
>> Best regards,
>> Krzysztof
> 
> Dear sir,
> The MT6397 is an integration of several ICs and does not have a
> separate IC specification. I will check the relevant IC datasheets
> again. I will remove the useless define in next version.


I understand nothing from this reply. I do not see it related to my
questions at all. Do you want to say that you change indentation,
because MT6397 is integration? That makes absolutely NO SENSE!

Best regards,
Krzysztof
Re: [PATCH v1 1/2] mfd: mt6397: Add new bit definitions for RTC_BBPU register
Posted by Shunxi Zhang (章顺喜) 5 months, 3 weeks ago
On Tue, 2025-08-19 at 10:16 +0200, Krzysztof Kozlowski wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> On 19/08/2025 09:54, Shunxi Zhang (章顺喜) wrote:
> > > >  #define RTC_BBPU               0x0000
> > > > +#define RTC_BBPU_PWREN         BIT(0)
> > > > +#define RTC_BBPU_CLR           BIT(1)
> > > > +#define RTC_BBPU_RESET_AL      BIT(3)
> > > >  #define RTC_BBPU_CBUSY         BIT(6)
> > > > -#define RTC_BBPU_KEY            (0x43 << 8)
> > > > +#define RTC_BBPU_KEY           (0x43 << 8)
> > > 
> > > 
> > > Why?
> > > 
> > > 
> > > 
> > > Best regards,
> > > Krzysztof
> > 
> > Dear sir,
> > The MT6397 is an integration of several ICs and does not have a
> > separate IC specification. I will check the relevant IC datasheets
> > again. I will remove the useless define in next version.
> 
> 
> I understand nothing from this reply. I do not see it related to my
> questions at all. Do you want to say that you change indentation,
> because MT6397 is integration? That makes absolutely NO SENSE!
> 
> Best regards,
> Krzysztof

Dear sir,
   I will submit a separate patch for the format modification. The
reply to the previous email was not about this format issue. I am very
sorry for causing your misunderstanding.

Best Regards
Shunxi Zhang
Re: [PATCH v1 1/2] mfd: mt6397: Add new bit definitions for RTC_BBPU register
Posted by Giorgi Tchankvetadze 6 months ago
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
    linux-mediatek@lists.infradead.org,
    linux-rtc@vger.kernel.org,
    linux-kernel@vger.kernel.org

Shunxi,

Can you confirm whether `RTC_BBPU_PWREN` (bit 0),
`RTC_BBPU_CLR` (bit 1) and `RTC_BBPU_RESET_AL` (bit 3) are documented
in the MT6397 datasheet (please cite section/page)? They look like
standard RTC controls (power enable, clear/reset, alarm reset) and
might be useful to include, but I agree with Krzysztof that adding
definitions with no users can accumulate technical debt.

Suggestion: either
- add the definitions when a driver actually needs them, or
- keep them now but add a short rationale in the commit message
  (datasheet reference + intended use) so future reviewers understand
  why they exist.

Also: please split cosmetic whitespace fixes (RTC_BBPU_KEY) into a
separate patch to make review/merge easier.

Thanks for the patch; I’m following the thread.

— Giorgi


On Mon, Aug 11, 2025 at 3:03 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 11/08/2025 10:15, ot_shunxi.zhang@mediatek.com wrote:
> > From: Shunxi Zhang <ot_shunxi.zhang@mediatek.com>
> >
> > This patch adds new bit definitions for the RTC_BBPU register in the
>
> Why? There is no user of these. Don't add useless defines.
>
> > mt6397 RTC header file. The following bit definitions are introduced:
>
> Hm?
>
> >
> > Signed-off-by: Shunxi Zhang <ot_shunxi.zhang@mediatek.com>
> > ---
> >  include/linux/mfd/mt6397/rtc.h | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h
> > index 27883af44f87..001cef6b7302 100644
> > --- a/include/linux/mfd/mt6397/rtc.h
> > +++ b/include/linux/mfd/mt6397/rtc.h
> > @@ -15,8 +15,11 @@
> >  #include <linux/rtc.h>
> >
> >  #define RTC_BBPU               0x0000
> > +#define RTC_BBPU_PWREN         BIT(0)
> > +#define RTC_BBPU_CLR           BIT(1)
> > +#define RTC_BBPU_RESET_AL      BIT(3)
> >  #define RTC_BBPU_CBUSY         BIT(6)
> > -#define RTC_BBPU_KEY            (0x43 << 8)
> > +#define RTC_BBPU_KEY           (0x43 << 8)
>
>
> Why?
>
>
>
> Best regards,
> Krzysztof
>
Re: [PATCH v1 1/2] mfd: mt6397: Add new bit definitions for RTC_BBPU register
Posted by Shunxi Zhang (章顺喜) 5 months, 3 weeks ago
On Mon, 2025-08-11 at 15:21 +0400, Giorgi Tchankvetadze wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Cc: Krzysztof Kozlowski <krzk@kernel.org>,
>     linux-mediatek@lists.infradead.org,
>     linux-rtc@vger.kernel.org,
>     linux-kernel@vger.kernel.org
> 
> Shunxi,
> 
> Can you confirm whether `RTC_BBPU_PWREN` (bit 0),
> `RTC_BBPU_CLR` (bit 1) and `RTC_BBPU_RESET_AL` (bit 3) are documented
> in the MT6397 datasheet (please cite section/page)? They look like
> standard RTC controls (power enable, clear/reset, alarm reset) and
> might be useful to include, but I agree with Krzysztof that adding
> definitions with no users can accumulate technical debt.
> 
> Suggestion: either
> - add the definitions when a driver actually needs them, or
> - keep them now but add a short rationale in the commit message
>   (datasheet reference + intended use) so future reviewers understand
>   why they exist.
> 
> Also: please split cosmetic whitespace fixes (RTC_BBPU_KEY) into a
> separate patch to make review/merge easier.
> 
> Thanks for the patch; I’m following the thread.
> 
> — Giorgi

Dear sir,
The MT6397 is an integration of several ICs and does not have a
separate IC specification. I will check the relevant IC datasheets
again. I will remove the useless define in next version.

Thanks for your commnets.

Best regards
Shunxi Zhangus
> 
> 
> On Mon, Aug 11, 2025 at 3:03 PM Krzysztof Kozlowski <krzk@kernel.org>
> wrote:
> > 
> > On 11/08/2025 10:15, ot_shunxi.zhang@mediatek.com wrote:
> > > From: Shunxi Zhang <ot_shunxi.zhang@mediatek.com>
> > > 
> > > This patch adds new bit definitions for the RTC_BBPU register in
> > > the
> > 
> > Why? There is no user of these. Don't add useless defines.
> > 
> > > mt6397 RTC header file. The following bit definitions are
> > > introduced:
> > 
> > Hm?
> > 
> > > 
> > > Signed-off-by: Shunxi Zhang <ot_shunxi.zhang@mediatek.com>
> > > ---
> > >  include/linux/mfd/mt6397/rtc.h | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/include/linux/mfd/mt6397/rtc.h
> > > b/include/linux/mfd/mt6397/rtc.h
> > > index 27883af44f87..001cef6b7302 100644
> > > --- a/include/linux/mfd/mt6397/rtc.h
> > > +++ b/include/linux/mfd/mt6397/rtc.h
> > > @@ -15,8 +15,11 @@
> > >  #include <linux/rtc.h>
> > > 
> > >  #define RTC_BBPU               0x0000
> > > +#define RTC_BBPU_PWREN         BIT(0)
> > > +#define RTC_BBPU_CLR           BIT(1)
> > > +#define RTC_BBPU_RESET_AL      BIT(3)
> > >  #define RTC_BBPU_CBUSY         BIT(6)
> > > -#define RTC_BBPU_KEY            (0x43 << 8)
> > > +#define RTC_BBPU_KEY           (0x43 << 8)
> > 
> > 
> > Why?
> > 
> > 
> > 
> > Best regards,
> > Krzysztof
> >