Skip to content

Commit

Permalink
rtc: m41t80: Clear oscillator fault bit during probe
Browse files Browse the repository at this point in the history
This make sure we don't read a bad value later on.

Signed-off-by: Guido Günther <guido.gunther@puri.sm>
  • Loading branch information
agx authored and merge committed Jan 25, 2021
1 parent d046015 commit 206778f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/rtc/rtc-m41t80.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,17 @@ static int m41t80_probe(struct i2c_client *client,
return rc;
}

/* Make sure OF (osciallator failure) is cleared */
rc = i2c_smbus_read_byte_data(client, M41T80_REG_FLAGS);

if (rc >= 0)
rc = i2c_smbus_write_byte_data(client, M41T80_REG_FLAGS,
rc & ~M41T80_FLAGS_OF);
if (rc < 0) {
dev_err(&client->dev, "Can't clear OF bit\n");
return rc;
}

#ifdef CONFIG_RTC_DRV_M41T80_WDT
if (m41t80_data->features & M41T80_FEATURE_HT) {
save_client = client;
Expand Down

0 comments on commit 206778f

Please sign in to comment.