提交 ed061066 编写于 作者: C Camel Guo 提交者: Alexandre Belloni

rtc: rs5c372: fix incorrect oscillation value on r2221tl

The XSL bit only exists in RS5C372A/B. On other Ricoh RTC chips
supported in rs5c372, this bit has different meaning. For example, on
R2221x and R2223x, this bit of oscillation adjustment register
determines the operation frequency of oscillation adjustment circuit and
the oscillation is always 32768HZ. But rs5c372_get_trim gives 32000HZ to
osc when DEV is 1.
Signed-off-by: NCamel Guo <camelg@axis.com>
Signed-off-by: NAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20211206125832.6461-1-camel.guo@axis.com
上级 dd93849d
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#define RS5C372_REG_MONTH 5 #define RS5C372_REG_MONTH 5
#define RS5C372_REG_YEAR 6 #define RS5C372_REG_YEAR 6
#define RS5C372_REG_TRIM 7 #define RS5C372_REG_TRIM 7
# define RS5C372_TRIM_XSL 0x80 # define RS5C372_TRIM_XSL 0x80 /* only if RS5C372[a|b] */
# define RS5C372_TRIM_MASK 0x7F # define RS5C372_TRIM_MASK 0x7F
# define R2221TL_TRIM_DEV (1 << 7) /* only if R2221TL */ # define R2221TL_TRIM_DEV (1 << 7) /* only if R2221TL */
# define RS5C372_TRIM_DECR (1 << 6) # define RS5C372_TRIM_DECR (1 << 6)
...@@ -326,8 +326,12 @@ static int rs5c372_get_trim(struct i2c_client *client, int *osc, int *trim) ...@@ -326,8 +326,12 @@ static int rs5c372_get_trim(struct i2c_client *client, int *osc, int *trim)
struct rs5c372 *rs5c372 = i2c_get_clientdata(client); struct rs5c372 *rs5c372 = i2c_get_clientdata(client);
u8 tmp = rs5c372->regs[RS5C372_REG_TRIM]; u8 tmp = rs5c372->regs[RS5C372_REG_TRIM];
if (osc) if (osc) {
*osc = (tmp & RS5C372_TRIM_XSL) ? 32000 : 32768; if (rs5c372->type == rtc_rs5c372a || rs5c372->type == rtc_rs5c372b)
*osc = (tmp & RS5C372_TRIM_XSL) ? 32000 : 32768;
else
*osc = 32768;
}
if (trim) { if (trim) {
dev_dbg(&client->dev, "%s: raw trim=%x\n", __func__, tmp); dev_dbg(&client->dev, "%s: raw trim=%x\n", __func__, tmp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册