Commit a26d8463 authored by Luca Ceresoli's avatar Luca Ceresoli Committed by Lee Jones

rtc: max77686: Rename day-of-month defines

RTC_DATE and REG_RTC_DATE are used for the registers holding the day of
month. Rename these constants to mean what they mean.
Signed-off-by: default avatarLuca Ceresoli <luca@lucaceresoli.net>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 72c356c2
...@@ -87,7 +87,7 @@ static bool max77802_rtc_is_volatile_reg(struct device *dev, unsigned int reg) ...@@ -87,7 +87,7 @@ static bool max77802_rtc_is_volatile_reg(struct device *dev, unsigned int reg)
reg == MAX77802_RTC_WEEKDAY || reg == MAX77802_RTC_WEEKDAY ||
reg == MAX77802_RTC_MONTH || reg == MAX77802_RTC_MONTH ||
reg == MAX77802_RTC_YEAR || reg == MAX77802_RTC_YEAR ||
reg == MAX77802_RTC_DATE); reg == MAX77802_RTC_MONTHDAY);
} }
static bool max77802_is_volatile_reg(struct device *dev, unsigned int reg) static bool max77802_is_volatile_reg(struct device *dev, unsigned int reg)
......
...@@ -57,7 +57,7 @@ enum { ...@@ -57,7 +57,7 @@ enum {
RTC_WEEKDAY, RTC_WEEKDAY,
RTC_MONTH, RTC_MONTH,
RTC_YEAR, RTC_YEAR,
RTC_DATE, RTC_MONTHDAY,
RTC_NR_TIME RTC_NR_TIME
}; };
...@@ -119,7 +119,7 @@ enum max77686_rtc_reg_offset { ...@@ -119,7 +119,7 @@ enum max77686_rtc_reg_offset {
REG_RTC_WEEKDAY, REG_RTC_WEEKDAY,
REG_RTC_MONTH, REG_RTC_MONTH,
REG_RTC_YEAR, REG_RTC_YEAR,
REG_RTC_DATE, REG_RTC_MONTHDAY,
REG_ALARM1_SEC, REG_ALARM1_SEC,
REG_ALARM1_MIN, REG_ALARM1_MIN,
REG_ALARM1_HOUR, REG_ALARM1_HOUR,
...@@ -150,7 +150,7 @@ static const unsigned int max77686_map[REG_RTC_END] = { ...@@ -150,7 +150,7 @@ static const unsigned int max77686_map[REG_RTC_END] = {
[REG_RTC_WEEKDAY] = MAX77686_RTC_WEEKDAY, [REG_RTC_WEEKDAY] = MAX77686_RTC_WEEKDAY,
[REG_RTC_MONTH] = MAX77686_RTC_MONTH, [REG_RTC_MONTH] = MAX77686_RTC_MONTH,
[REG_RTC_YEAR] = MAX77686_RTC_YEAR, [REG_RTC_YEAR] = MAX77686_RTC_YEAR,
[REG_RTC_DATE] = MAX77686_RTC_DATE, [REG_RTC_MONTHDAY] = MAX77686_RTC_MONTHDAY,
[REG_ALARM1_SEC] = MAX77686_ALARM1_SEC, [REG_ALARM1_SEC] = MAX77686_ALARM1_SEC,
[REG_ALARM1_MIN] = MAX77686_ALARM1_MIN, [REG_ALARM1_MIN] = MAX77686_ALARM1_MIN,
[REG_ALARM1_HOUR] = MAX77686_ALARM1_HOUR, [REG_ALARM1_HOUR] = MAX77686_ALARM1_HOUR,
...@@ -233,7 +233,7 @@ static const unsigned int max77802_map[REG_RTC_END] = { ...@@ -233,7 +233,7 @@ static const unsigned int max77802_map[REG_RTC_END] = {
[REG_RTC_WEEKDAY] = MAX77802_RTC_WEEKDAY, [REG_RTC_WEEKDAY] = MAX77802_RTC_WEEKDAY,
[REG_RTC_MONTH] = MAX77802_RTC_MONTH, [REG_RTC_MONTH] = MAX77802_RTC_MONTH,
[REG_RTC_YEAR] = MAX77802_RTC_YEAR, [REG_RTC_YEAR] = MAX77802_RTC_YEAR,
[REG_RTC_DATE] = MAX77802_RTC_DATE, [REG_RTC_MONTHDAY] = MAX77802_RTC_MONTHDAY,
[REG_ALARM1_SEC] = MAX77802_ALARM1_SEC, [REG_ALARM1_SEC] = MAX77802_ALARM1_SEC,
[REG_ALARM1_MIN] = MAX77802_ALARM1_MIN, [REG_ALARM1_MIN] = MAX77802_ALARM1_MIN,
[REG_ALARM1_HOUR] = MAX77802_ALARM1_HOUR, [REG_ALARM1_HOUR] = MAX77802_ALARM1_HOUR,
...@@ -288,7 +288,7 @@ static void max77686_rtc_data_to_tm(u8 *data, struct rtc_time *tm, ...@@ -288,7 +288,7 @@ static void max77686_rtc_data_to_tm(u8 *data, struct rtc_time *tm,
/* Only a single bit is set in data[], so fls() would be equivalent */ /* Only a single bit is set in data[], so fls() would be equivalent */
tm->tm_wday = ffs(data[RTC_WEEKDAY] & mask) - 1; tm->tm_wday = ffs(data[RTC_WEEKDAY] & mask) - 1;
tm->tm_mday = data[RTC_DATE] & 0x1f; tm->tm_mday = data[RTC_MONTHDAY] & 0x1f;
tm->tm_mon = (data[RTC_MONTH] & 0x0f) - 1; tm->tm_mon = (data[RTC_MONTH] & 0x0f) - 1;
tm->tm_year = data[RTC_YEAR] & mask; tm->tm_year = data[RTC_YEAR] & mask;
tm->tm_yday = 0; tm->tm_yday = 0;
...@@ -309,7 +309,7 @@ static int max77686_rtc_tm_to_data(struct rtc_time *tm, u8 *data, ...@@ -309,7 +309,7 @@ static int max77686_rtc_tm_to_data(struct rtc_time *tm, u8 *data,
data[RTC_MIN] = tm->tm_min; data[RTC_MIN] = tm->tm_min;
data[RTC_HOUR] = tm->tm_hour; data[RTC_HOUR] = tm->tm_hour;
data[RTC_WEEKDAY] = 1 << tm->tm_wday; data[RTC_WEEKDAY] = 1 << tm->tm_wday;
data[RTC_DATE] = tm->tm_mday; data[RTC_MONTHDAY] = tm->tm_mday;
data[RTC_MONTH] = tm->tm_mon + 1; data[RTC_MONTH] = tm->tm_mon + 1;
if (info->drv_data->alarm_enable_reg) { if (info->drv_data->alarm_enable_reg) {
...@@ -565,8 +565,8 @@ static int max77686_rtc_start_alarm(struct max77686_rtc_info *info) ...@@ -565,8 +565,8 @@ static int max77686_rtc_start_alarm(struct max77686_rtc_info *info)
data[RTC_MONTH] |= (1 << ALARM_ENABLE_SHIFT); data[RTC_MONTH] |= (1 << ALARM_ENABLE_SHIFT);
if (data[RTC_YEAR] & info->drv_data->mask) if (data[RTC_YEAR] & info->drv_data->mask)
data[RTC_YEAR] |= (1 << ALARM_ENABLE_SHIFT); data[RTC_YEAR] |= (1 << ALARM_ENABLE_SHIFT);
if (data[RTC_DATE] & 0x1f) if (data[RTC_MONTHDAY] & 0x1f)
data[RTC_DATE] |= (1 << ALARM_ENABLE_SHIFT); data[RTC_MONTHDAY] |= (1 << ALARM_ENABLE_SHIFT);
ret = regmap_bulk_write(info->rtc_regmap, map[REG_ALARM1_SEC], ret = regmap_bulk_write(info->rtc_regmap, map[REG_ALARM1_SEC],
data, ARRAY_SIZE(data)); data, ARRAY_SIZE(data));
......
...@@ -152,7 +152,7 @@ enum max77686_rtc_reg { ...@@ -152,7 +152,7 @@ enum max77686_rtc_reg {
MAX77686_RTC_WEEKDAY = 0x0A, MAX77686_RTC_WEEKDAY = 0x0A,
MAX77686_RTC_MONTH = 0x0B, MAX77686_RTC_MONTH = 0x0B,
MAX77686_RTC_YEAR = 0x0C, MAX77686_RTC_YEAR = 0x0C,
MAX77686_RTC_DATE = 0x0D, MAX77686_RTC_MONTHDAY = 0x0D,
MAX77686_ALARM1_SEC = 0x0E, MAX77686_ALARM1_SEC = 0x0E,
MAX77686_ALARM1_MIN = 0x0F, MAX77686_ALARM1_MIN = 0x0F,
MAX77686_ALARM1_HOUR = 0x10, MAX77686_ALARM1_HOUR = 0x10,
...@@ -352,7 +352,7 @@ enum max77802_rtc_reg { ...@@ -352,7 +352,7 @@ enum max77802_rtc_reg {
MAX77802_RTC_WEEKDAY = 0xCA, MAX77802_RTC_WEEKDAY = 0xCA,
MAX77802_RTC_MONTH = 0xCB, MAX77802_RTC_MONTH = 0xCB,
MAX77802_RTC_YEAR = 0xCC, MAX77802_RTC_YEAR = 0xCC,
MAX77802_RTC_DATE = 0xCD, MAX77802_RTC_MONTHDAY = 0xCD,
MAX77802_RTC_AE1 = 0xCE, MAX77802_RTC_AE1 = 0xCE,
MAX77802_ALARM1_SEC = 0xCF, MAX77802_ALARM1_SEC = 0xCF,
MAX77802_ALARM1_MIN = 0xD0, MAX77802_ALARM1_MIN = 0xD0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment