rtc: s35390a: set 32K register when resume

when system enter suspend, aaos will set output S35390A_CMD_TIME1 mode,
and status register 32K will clear, so need set register again.

Signed-off-by: Xu Xuehui <xxh@rock-chips.com>
Change-Id: I0efe1ad9c2ed5fc48007309f3ac3f3d714823c88
This commit is contained in:
Xu Xuehui
2024-04-02 16:47:20 +08:00
committed by Tao Huang
parent ab68de732b
commit 7f151d9170

View File

@@ -413,6 +413,22 @@ static int s35390a_rtc_ioctl(struct device *dev, unsigned int cmd,
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int s35390a_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct s35390a *s35390a = i2c_get_clientdata(client);
char buf;
buf = S35390A_INT2_MODE_32K;
s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, &buf, sizeof(buf));
return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(s35390a_pm_ops, NULL, s35390a_resume);
static const struct rtc_class_ops s35390a_rtc_ops = {
.read_time = s35390a_rtc_read_time,
.set_time = s35390a_rtc_set_time,
@@ -508,6 +524,7 @@ static int s35390a_probe(struct i2c_client *client)
static struct i2c_driver s35390a_driver = {
.driver = {
.name = "rtc-s35390a",
.pm = &s35390a_pm_ops,
.of_match_table = of_match_ptr(s35390a_of_match),
},
.probe_new = s35390a_probe,