rtc: pcf8523: report oscillator failures
Report oscillator failures and invalid date/time on RTC_VL_READ. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210418002023.1000265-3-alexandre.belloni@bootlin.com
This commit is contained in:
parent
13e37b7fb7
commit
a1cfe7cc38
@ -406,6 +406,8 @@ static int pcf8523_rtc_ioctl(struct device *dev, unsigned int cmd,
|
|||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
struct i2c_client *client = to_i2c_client(dev);
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
|
unsigned int flags = 0;
|
||||||
|
u8 value;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
@ -414,9 +416,16 @@ static int pcf8523_rtc_ioctl(struct device *dev, unsigned int cmd,
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if (ret)
|
if (ret)
|
||||||
ret = RTC_VL_BACKUP_LOW;
|
flags |= RTC_VL_BACKUP_LOW;
|
||||||
|
|
||||||
return put_user(ret, (unsigned int __user *)arg);
|
ret = pcf8523_read(client, REG_SECONDS, &value);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (value & REG_SECONDS_OS)
|
||||||
|
flags |= RTC_VL_DATA_INVALID;
|
||||||
|
|
||||||
|
return put_user(flags, (unsigned int __user *)arg);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOIOCTLCMD;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user