mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 16:53:54 +08:00
rtc: ds1307: Ensure oscillator is enabled for DS1388
Similar to the other variants the DS1388 has a bit to stop the oscillator to reduce the power consumption from VBAT. Ensure that the oscillator is enabled when the system is up. Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200816235731.21071-1-chris.packham@alliedtelesis.co.nz
This commit is contained in:
parent
163a512cd9
commit
59ed012715
@ -153,6 +153,7 @@ enum ds_type {
|
|||||||
#define DS1388_REG_CONTROL 0x0c
|
#define DS1388_REG_CONTROL 0x0c
|
||||||
# define DS1388_BIT_RST BIT(0)
|
# define DS1388_BIT_RST BIT(0)
|
||||||
# define DS1388_BIT_WDE BIT(1)
|
# define DS1388_BIT_WDE BIT(1)
|
||||||
|
# define DS1388_BIT_nEOSC BIT(7)
|
||||||
|
|
||||||
/* negative offset step is -2.034ppm */
|
/* negative offset step is -2.034ppm */
|
||||||
#define M41TXX_NEG_OFFSET_STEP_PPB 2034
|
#define M41TXX_NEG_OFFSET_STEP_PPB 2034
|
||||||
@ -1881,6 +1882,19 @@ static int ds1307_probe(struct i2c_client *client,
|
|||||||
DS1307_REG_HOUR << 4 | 0x08, hour);
|
DS1307_REG_HOUR << 4 | 0x08, hour);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ds_1388:
|
||||||
|
err = regmap_read(ds1307->regmap, DS1388_REG_CONTROL, &tmp);
|
||||||
|
if (err) {
|
||||||
|
dev_dbg(ds1307->dev, "read error %d\n", err);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* oscillator off? turn it on, so clock can tick. */
|
||||||
|
if (tmp & DS1388_BIT_nEOSC) {
|
||||||
|
tmp &= ~DS1388_BIT_nEOSC;
|
||||||
|
regmap_write(ds1307->regmap, DS1388_REG_CONTROL, tmp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user