Merge branch 'for-next/rtc'
This commit is contained in:
commit
11b2257f4b
|
@ -59,7 +59,7 @@ static int abracon_get_time(struct rtc_device *rtcdev, struct rtc_time *t)
|
||||||
t->tm_mon = bcd2bin(cp[5]);
|
t->tm_mon = bcd2bin(cp[5]);
|
||||||
t->tm_year = bcd2bin(cp[6]) + 100;
|
t->tm_year = bcd2bin(cp[6]) + 100;
|
||||||
|
|
||||||
return 0;
|
return rtc_valid_tm(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int abracon_set_time(struct rtc_device *rtcdev, struct rtc_time *t)
|
static int abracon_set_time(struct rtc_device *rtcdev, struct rtc_time *t)
|
||||||
|
|
|
@ -68,6 +68,7 @@ enum ds_type {
|
||||||
#define DS1337_REG_CONTROL 0x0e
|
#define DS1337_REG_CONTROL 0x0e
|
||||||
# define DS1337_BIT_nEOSC 0x80
|
# define DS1337_BIT_nEOSC 0x80
|
||||||
# define DS1339_BIT_BBSQI 0x20
|
# define DS1339_BIT_BBSQI 0x20
|
||||||
|
# define DS1341_BIT_EGFIL 0x20
|
||||||
# define DS3231_BIT_BBSQW 0x40 /* same as BBSQI */
|
# define DS3231_BIT_BBSQW 0x40 /* same as BBSQI */
|
||||||
# define DS1337_BIT_RS2 0x10
|
# define DS1337_BIT_RS2 0x10
|
||||||
# define DS1337_BIT_RS1 0x08
|
# define DS1337_BIT_RS1 0x08
|
||||||
|
@ -83,6 +84,7 @@ enum ds_type {
|
||||||
# define DS1340_BIT_OSF 0x80
|
# define DS1340_BIT_OSF 0x80
|
||||||
#define DS1337_REG_STATUS 0x0f
|
#define DS1337_REG_STATUS 0x0f
|
||||||
# define DS1337_BIT_OSF 0x80
|
# define DS1337_BIT_OSF 0x80
|
||||||
|
# define DS1341_BIT_DOSF 0x40
|
||||||
# define DS1341_BIT_ECLK 0x04
|
# define DS1341_BIT_ECLK 0x04
|
||||||
# define DS1337_BIT_A2I 0x02
|
# define DS1337_BIT_A2I 0x02
|
||||||
# define DS1337_BIT_A1I 0x01
|
# define DS1337_BIT_A1I 0x01
|
||||||
|
@ -333,12 +335,22 @@ static int ds1307_probe(struct device_d *dev)
|
||||||
i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,
|
i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,
|
||||||
ds1307->regs[0]);
|
ds1307->regs[0]);
|
||||||
|
|
||||||
/*
|
|
||||||
For the above to be true, DS1341 also has to have
|
|
||||||
ECLK bit set to 0
|
|
||||||
*/
|
|
||||||
if (ds1307->type == ds_1341) {
|
if (ds1307->type == ds_1341) {
|
||||||
ds1307->regs[1] &= DS1341_BIT_ECLK;
|
/*
|
||||||
|
* For the above to be true, DS1341 also has to have
|
||||||
|
* ECLK bit set to 0
|
||||||
|
*/
|
||||||
|
ds1307->regs[1] &= ~DS1341_BIT_ECLK;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Let's set additionale RTC bits to
|
||||||
|
* facilitate maximum power saving.
|
||||||
|
*/
|
||||||
|
ds1307->regs[0] |= DS1341_BIT_DOSF;
|
||||||
|
ds1307->regs[0] &= ~DS1341_BIT_EGFIL;
|
||||||
|
|
||||||
|
i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,
|
||||||
|
ds1307->regs[0]);
|
||||||
i2c_smbus_write_byte_data(client, DS1337_REG_STATUS,
|
i2c_smbus_write_byte_data(client, DS1337_REG_STATUS,
|
||||||
ds1307->regs[1]);
|
ds1307->regs[1]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue