ROHM BD71828 PMIC RTC block is from many parts similar to one on BD70528. Support BD71828 RTC using BD70528 RTC driver and avoid re-inventing the wheel.
Showing the changes to include/linux (3 of 5 files). Show all
Unified · Split
| @@ -7,6 +7,7 @@ · 6 unmodified lines | |||
| 7 | #include <linux/bits.h> | 7 | #include <linux/bits.h> |
| 8 | #include <linux/device.h> | 8 | #include <linux/device.h> |
| 9 | #include <linux/mfd/rohm-generic.h> | 9 | #include <linux/mfd/rohm-generic.h> |
| 10 | #include <linux/mfd/rohm-shared.h> | ||
| 10 | #include <linux/regmap.h> | 11 | #include <linux/regmap.h> |
| 11 | 12 | ||
| 12 | enum { | 13 | enum { |
| @@ -307,17 +308,6 @@ enum { · 294 unmodified lines | |||
| 307 | 308 | ||
| 308 | /* RTC masks to mask out reserved bits */ | 309 | /* RTC masks to mask out reserved bits */ |
| 309 | 310 | ||
| 310 | #define BD70528_MASK_RTC_SEC 0x7f | ||
| 311 | #define BD70528_MASK_RTC_MINUTE 0x7f | ||
| 312 | #define BD70528_MASK_RTC_HOUR_24H 0x80 | ||
| 313 | #define BD70528_MASK_RTC_HOUR_PM 0x20 | ||
| 314 | #define BD70528_MASK_RTC_HOUR 0x3f | ||
| 315 | #define BD70528_MASK_RTC_DAY 0x3f | ||
| 316 | #define BD70528_MASK_RTC_WEEK 0x07 | ||
| 317 | #define BD70528_MASK_RTC_MONTH 0x1f | ||
| 318 | #define BD70528_MASK_RTC_YEAR 0xff | ||
| 319 | #define BD70528_MASK_RTC_COUNT_L 0x7f | ||
| 320 | |||
| 321 | #define BD70528_MASK_ELAPSED_TIMER_EN 0x1 | 311 | #define BD70528_MASK_ELAPSED_TIMER_EN 0x1 |
| 322 | /* Mask second, min and hour fields | 312 | /* Mask second, min and hour fields |
| 323 | * HW would support ALM irq for over 24h | 313 | * HW would support ALM irq for over 24h |
| @@ -326,7 +316,6 @@ enum { · 2 unmodified lines | |||
| 326 | * wake-up we limit ALM to 24H and only | 316 | * wake-up we limit ALM to 24H and only |
| 327 | * unmask sec, min and hour | 317 | * unmask sec, min and hour |
| 328 | */ | 318 | */ |
| 329 | #define BD70528_MASK_ALM_EN 0x7 | ||
| 330 | #define BD70528_MASK_WAKE_EN 0x1 | 319 | #define BD70528_MASK_WAKE_EN 0x1 |
| 331 | 320 | ||
| 332 | /* WDT masks */ | 321 | /* WDT masks */ |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | |||
| 5 | #define __LINUX_MFD_BD71828_H__ | 5 | #define __LINUX_MFD_BD71828_H__ |
| 6 | 6 | ||
| 7 | #include <linux/mfd/rohm-generic.h> | 7 | #include <linux/mfd/rohm-generic.h> |
| 8 | #include <linux/mfd/rohm-shared.h> | ||
| 8 | 9 | ||
| 9 | /* Regulator IDs */ | 10 | /* Regulator IDs */ |
| 10 | enum { | 11 | enum { |
| @@ -160,6 +161,7 @@ enum { · 149 unmodified lines | |||
| 160 | #define BD71828_REG_RTC_YEAR 0x52 | 161 | #define BD71828_REG_RTC_YEAR 0x52 |
| 161 | 162 | ||
| 162 | #define BD71828_REG_RTC_ALM0_SEC 0x53 | 163 | #define BD71828_REG_RTC_ALM0_SEC 0x53 |
| 164 | #define BD71828_REG_RTC_ALM_START BD71828_REG_RTC_ALM0_SEC | ||
| 163 | #define BD71828_REG_RTC_ALM0_MINUTE 0x54 | 165 | #define BD71828_REG_RTC_ALM0_MINUTE 0x54 |
| 164 | #define BD71828_REG_RTC_ALM0_HOUR 0x55 | 166 | #define BD71828_REG_RTC_ALM0_HOUR 0x55 |
| 165 | #define BD71828_REG_RTC_ALM0_WEEK 0x56 | 167 | #define BD71828_REG_RTC_ALM0_WEEK 0x56 |
| @@ -178,6 +180,7 @@ enum { · 12 unmodified lines | |||
| 178 | #define BD71828_REG_RTC_ALM1_MASK 0x62 | 180 | #define BD71828_REG_RTC_ALM1_MASK 0x62 |
| 179 | 181 | ||
| 180 | #define BD71828_REG_RTC_ALM2 0x63 | 182 | #define BD71828_REG_RTC_ALM2 0x63 |
| 183 | #define BD71828_REG_RTC_START BD71828_REG_RTC_SEC | ||
| 181 | 184 | ||
| 182 | /* Charger/Battey */ | 185 | /* Charger/Battey */ |
| 183 | #define BD71828_REG_CHG_STATE 0x65 | 186 | #define BD71828_REG_CHG_STATE 0x65 |
| @@ -204,7 +207,6 @@ enum { · 20 unmodified lines | |||
| 204 | #define BD71828_REG_INT_MASK_TEMP 0xdd | 207 | #define BD71828_REG_INT_MASK_TEMP 0xdd |
| 205 | #define BD71828_REG_INT_MASK_RTC 0xde | 208 | #define BD71828_REG_INT_MASK_RTC 0xde |
| 206 | 209 | ||
| 207 | |||
| 208 | #define BD71828_REG_INT_MAIN 0xdf | 210 | #define BD71828_REG_INT_MAIN 0xdf |
| 209 | #define BD71828_REG_INT_BUCK 0xe0 | 211 | #define BD71828_REG_INT_BUCK 0xe0 |
| 210 | #define BD71828_REG_INT_DCIN1 0xe1 | 212 | #define BD71828_REG_INT_DCIN1 0xe1 |
| @@ -0,0 +1,21 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 2 | /* Copyright (C) 2020 ROHM Semiconductors */ | ||
| 3 | |||
| 4 | |||
| 5 | #ifndef __LINUX_MFD_ROHM_SHARED_H__ | ||
| 6 | #define __LINUX_MFD_ROHM_SHARED_H__ | ||
| 7 | |||
| 8 | /* RTC definitions shared between BD70528 and BD71828 */ | ||
| 9 | |||
| 10 | #define BD70528_MASK_RTC_SEC 0x7f | ||
| 11 | #define BD70528_MASK_RTC_MINUTE 0x7f | ||
| 12 | #define BD70528_MASK_RTC_HOUR_24H 0x80 | ||
| 13 | #define BD70528_MASK_RTC_HOUR_PM 0x20 | ||
| 14 | #define BD70528_MASK_RTC_HOUR 0x3f | ||
| 15 | #define BD70528_MASK_RTC_DAY 0x3f | ||
| 16 | #define BD70528_MASK_RTC_WEEK 0x07 | ||
| 17 | #define BD70528_MASK_RTC_MONTH 0x1f | ||
| 18 | #define BD70528_MASK_RTC_YEAR 0xff | ||
| 19 | #define BD70528_MASK_ALM_EN 0x7 | ||
| 20 | |||
| 21 | #endif /* __LINUX_MFD_ROHM_SHARED_H__ */ | ||