aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-pcf8523.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
index fb13933f4006..b5c61a70b5df 100644
--- a/drivers/rtc/rtc-pcf8523.c
+++ b/drivers/rtc/rtc-pcf8523.c
@@ -97,8 +97,9 @@ static int pcf8523_voltage_low(struct i2c_client *client)
97 return !!(value & REG_CONTROL3_BLF); 97 return !!(value & REG_CONTROL3_BLF);
98} 98}
99 99
100static int pcf8523_select_capacitance(struct i2c_client *client, bool high) 100static int pcf8523_load_capacitance(struct i2c_client *client)
101{ 101{
102 u32 load;
102 u8 value; 103 u8 value;
103 int err; 104 int err;
104 105
@@ -106,14 +107,24 @@ static int pcf8523_select_capacitance(struct i2c_client *client, bool high)
106 if (err < 0) 107 if (err < 0)
107 return err; 108 return err;
108 109
109 if (!high) 110 load = 12500;
110 value &= ~REG_CONTROL1_CAP_SEL; 111 of_property_read_u32(client->dev.of_node, "quartz-load-femtofarads",
111 else 112 &load);
113
114 switch (load) {
115 default:
116 dev_warn(&client->dev, "Unknown quartz-load-femtofarads value: %d. Assuming 12500",
117 load);
118 /* fall through */
119 case 12500:
112 value |= REG_CONTROL1_CAP_SEL; 120 value |= REG_CONTROL1_CAP_SEL;
121 break;
122 case 7000:
123 value &= ~REG_CONTROL1_CAP_SEL;
124 break;
125 }
113 126
114 err = pcf8523_write(client, REG_CONTROL1, value); 127 err = pcf8523_write(client, REG_CONTROL1, value);
115 if (err < 0)
116 return err;
117 128
118 return err; 129 return err;
119} 130}
@@ -347,9 +358,10 @@ static int pcf8523_probe(struct i2c_client *client,
347 if (!pcf) 358 if (!pcf)
348 return -ENOMEM; 359 return -ENOMEM;
349 360
350 err = pcf8523_select_capacitance(client, true); 361 err = pcf8523_load_capacitance(client);
351 if (err < 0) 362 if (err < 0)
352 return err; 363 dev_warn(&client->dev, "failed to set xtal load capacitance: %d",
364 err);
353 365
354 err = pcf8523_set_pm(client, 0); 366 err = pcf8523_set_pm(client, 0);
355 if (err < 0) 367 if (err < 0)