aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1307.c
diff options
context:
space:
mode:
authorBastian Krause <bst@pengutronix.de>2020-09-17 20:32:43 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2020-09-24 09:56:04 +0200
commit1b5b6af788ae59ee73e3f3230dbfa4f0e31d8d18 (patch)
tree10f8140f4b07fde547c2235fc641f48646703525 /drivers/rtc/rtc-ds1307.c
parent462eb736db3db76899022e4e4db788a7b6efbe09 (diff)
downloadlinux-1b5b6af788ae59ee73e3f3230dbfa4f0e31d8d18.tar.gz
rtc: ds1307: introduce requires_trickle_resistor per chip
Make trickle-resistor-ohms optional for charging setups that do not require specifying ROUT bits (specifying the resistor value between Vcc and Vbackup). In order to allow specifying that, introduce requires_trickle_resistor per chip. Signed-off-by: Bastian Krause <bst@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200917183246.19446-6-bst@pengutronix.de
Diffstat (limited to 'drivers/rtc/rtc-ds1307.c')
-rw-r--r--drivers/rtc/rtc-ds1307.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 82f75a7987056..64fa1318817c8 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -191,6 +191,10 @@ struct chip_desc {
u16 trickle_charger_reg;
u8 (*do_trickle_setup)(struct ds1307 *, u32,
bool);
+ /* Does the RTC require trickle-resistor-ohms to select the value of
+ * the resistor between Vcc and Vbackup?
+ */
+ bool requires_trickle_resistor;
};
static const struct chip_desc chips[last_ds_type];
@@ -986,6 +990,7 @@ static const struct chip_desc chips[last_ds_type] = {
.bbsqi_bit = DS1339_BIT_BBSQI,
.trickle_charger_reg = 0x10,
.do_trickle_setup = &do_trickle_setup_ds1339,
+ .requires_trickle_resistor = true,
},
[ds_1340] = {
.century_reg = DS1307_REG_HOUR,
@@ -993,6 +998,7 @@ static const struct chip_desc chips[last_ds_type] = {
.century_bit = DS1340_BIT_CENTURY,
.do_trickle_setup = &do_trickle_setup_ds1339,
.trickle_charger_reg = 0x08,
+ .requires_trickle_resistor = true,
},
[ds_1341] = {
.century_reg = DS1307_REG_MONTH,
@@ -1307,7 +1313,7 @@ static u8 ds1307_trickle_init(struct ds1307 *ds1307,
return 0;
if (device_property_read_u32(ds1307->dev, "trickle-resistor-ohms",
- &ohms))
+ &ohms) && chip->requires_trickle_resistor)
return 0;
if (device_property_read_bool(ds1307->dev, "trickle-diode-disable"))