On 07/09/2018 21:35:07+0200, Sam Ravnborg wrote:
> From: Søren Andersen <s...@skov.dk>
> 
> Add support for specifying the quartz load in the DT node.
> The pcf8523 may use either a 7 pF or an 12.5 pF xtal.
> If the rtc has the wrong configuration the time will
> drift several hours/week.
> 
> If nothing is specified in DT then the factory default of 7 pF is used.
> This is a change compared to before where the driver assumed 12.5 pF.
> 
> Note: all kernel dts trees are updated with the new property.
> 
> Signed-off-by: Søren Andersen <s...@skov.dk>
> Signed-off-by: Sam Ravnborg <s...@ravnborg.org>
> Cc: Alessandro Zummo <a.zu...@towertech.it>
> Cc: Alexandre Belloni <alexandre.bell...@bootlin.com>
> ---
>  drivers/rtc/rtc-pcf8523.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
> index 453615f8ac9a..3c19b4d21a2d 100644
> --- a/drivers/rtc/rtc-pcf8523.c
> +++ b/drivers/rtc/rtc-pcf8523.c
> @@ -85,7 +85,7 @@ static int pcf8523_write(struct i2c_client *client, u8 reg, 
> u8 value)
>       return 0;
>  }
>  
> -static int pcf8523_select_capacitance(struct i2c_client *client, bool high)
> +static int pcf8523_select_capacitance(struct i2c_client *client)
>  {
>       u8 value;
>       int err;
> @@ -94,7 +94,7 @@ static int pcf8523_select_capacitance(struct i2c_client 
> *client, bool high)
>       if (err < 0)
>               return err;
>  
> -     if (!high)
> +     if (!device_property_present(&client->dev, "nxp,quartz_load_12.5pf"))

OK, this is super annoying we unfortunately can't change what was done
previously without breaking the DT ABI. Honestly, I suspect the 12.5pF
value is wrong for most boards anyway.

What I would do is use the value from DT (so either 7000fF or 12500fF)
and set it if present.
If not present, set 12.5pF and print a warning that this differs from
the RTC default.

Hopefully, at some point, we could leave it as it is as the value should
persist across reboot.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Reply via email to