@@ -330,6 +330,9 @@ static int pcf8523_rtc_ioctl(struct device *dev, unsigned int cmd,
if (value & PCF8523_CONTROL3_BLF)
flags |= RTC_VL_BACKUP_LOW;
+ if (value & PCF8523_CONTROL3_BSF)
+ flags |= RTC_VL_BACKUP_SWITCH;
+
ret = regmap_read(pcf8523->regmap, PCF8523_REG_SECONDS, &value);
if (ret < 0)
return ret;
@@ -339,6 +342,10 @@ static int pcf8523_rtc_ioctl(struct device *dev, unsigned int cmd,
return put_user(flags, (unsigned int __user *)arg);
+ case RTC_VL_CLR:
+ return regmap_update_bits(pcf8523->regmap,
+ PCF8523_REG_CONTROL3, PCF8523_CONTROL3_BSF, 0);
+
default:
return -ENOIOCTLCMD;
}
Set RTC_VL_BACKUP_SWITCH when reading the batter voltage level to indicate switch to battery backup. Signed-off-by: Baruch Siach <baruch@tkos.co.il> --- drivers/rtc/rtc-pcf8523.c | 7 +++++++ 1 file changed, 7 insertions(+)