diff mbox series

[v4,2/9] rtc: mt6397: refine RTC_TC_MTH

Message ID 1608104827-7937-3-git-send-email-hsin-hsiung.wang@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Add Support for MediaTek PMIC MT6359 | expand

Commit Message

Hsin-Hsiung Wang Dec. 16, 2020, 7:47 a.m. UTC
This patch adds RTC_TC_MTH_MASK to support new chips.

Signed-off-by: Yuchen Huang <yuchen.huang@mediatek.com>
Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>
---
 drivers/rtc/rtc-mt6397.c       | 2 +-
 include/linux/mfd/mt6397/rtc.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Alexandre Belloni Dec. 16, 2020, 9:49 p.m. UTC | #1
On 16/12/2020 15:47:00+0800, Hsin-Hsiung Wang wrote:
> This patch adds RTC_TC_MTH_MASK to support new chips.
> 
> Signed-off-by: Yuchen Huang <yuchen.huang@mediatek.com>
> Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  drivers/rtc/rtc-mt6397.c       | 2 +-
>  include/linux/mfd/mt6397/rtc.h | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
> index 1894aded4c85..ea6da7476a5e 100644
> --- a/drivers/rtc/rtc-mt6397.c
> +++ b/drivers/rtc/rtc-mt6397.c
> @@ -75,7 +75,7 @@ static int __mtk_rtc_read_time(struct mt6397_rtc *rtc,
>  	tm->tm_min = data[RTC_OFFSET_MIN];
>  	tm->tm_hour = data[RTC_OFFSET_HOUR];
>  	tm->tm_mday = data[RTC_OFFSET_DOM];
> -	tm->tm_mon = data[RTC_OFFSET_MTH];
> +	tm->tm_mon = data[RTC_OFFSET_MTH] & RTC_TC_MTH_MASK;
>  	tm->tm_year = data[RTC_OFFSET_YEAR];
>  
>  	ret = regmap_read(rtc->regmap, rtc->addr_base + RTC_TC_SEC, sec);
> diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h
> index c3748b53bf7d..068ae1c0f0e8 100644
> --- a/include/linux/mfd/mt6397/rtc.h
> +++ b/include/linux/mfd/mt6397/rtc.h
> @@ -36,6 +36,7 @@
>  #define RTC_AL_MASK_DOW                BIT(4)
>  
>  #define RTC_TC_SEC             0x000a
> +#define RTC_TC_MTH_MASK        0x000f
>  /* Min, Hour, Dom... register offset to RTC_TC_SEC */
>  #define RTC_OFFSET_SEC         0
>  #define RTC_OFFSET_MIN         1
> -- 
> 2.18.0
>
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index 1894aded4c85..ea6da7476a5e 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -75,7 +75,7 @@  static int __mtk_rtc_read_time(struct mt6397_rtc *rtc,
 	tm->tm_min = data[RTC_OFFSET_MIN];
 	tm->tm_hour = data[RTC_OFFSET_HOUR];
 	tm->tm_mday = data[RTC_OFFSET_DOM];
-	tm->tm_mon = data[RTC_OFFSET_MTH];
+	tm->tm_mon = data[RTC_OFFSET_MTH] & RTC_TC_MTH_MASK;
 	tm->tm_year = data[RTC_OFFSET_YEAR];
 
 	ret = regmap_read(rtc->regmap, rtc->addr_base + RTC_TC_SEC, sec);
diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h
index c3748b53bf7d..068ae1c0f0e8 100644
--- a/include/linux/mfd/mt6397/rtc.h
+++ b/include/linux/mfd/mt6397/rtc.h
@@ -36,6 +36,7 @@ 
 #define RTC_AL_MASK_DOW                BIT(4)
 
 #define RTC_TC_SEC             0x000a
+#define RTC_TC_MTH_MASK        0x000f
 /* Min, Hour, Dom... register offset to RTC_TC_SEC */
 #define RTC_OFFSET_SEC         0
 #define RTC_OFFSET_MIN         1