All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: "Alessandro Zummo" <a.zummo@towertech.it>,
	"Andrew Jeffery" <andrew@aj.id.au>,
	"Fabio Estevam" <fabio.estevam@nxp.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Russell King" <linux@armlinux.org.uk>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Shawn Guo" <shawnguo@kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rtc@vger.kernel.org, "Søren Andersen" <san@skov.dk>
Subject: Re: [PATCH v1 5/5] rtc: pcf85063: external capacitor configuration
Date: Thu, 13 Sep 2018 21:29:24 +0200	[thread overview]
Message-ID: <20180913192924.GK14988@piout.net> (raw)
In-Reply-To: <20180907193508.24974-6-sam@ravnborg.org>

On 07/09/2018 21:35:08+0200, Sam Ravnborg wrote:
> From: Søren Andersen <san@skov.dk>
> 
> Add support for specifying the quartz load in the DT node.
> The pcf85063 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.
> 
> Signed-off-by: Søren Andersen <san@skov.dk>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
>  drivers/rtc/rtc-pcf85063.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
> index 283c2335b01b..38163446664f 100644
> --- a/drivers/rtc/rtc-pcf85063.c
> +++ b/drivers/rtc/rtc-pcf85063.c
> @@ -27,6 +27,7 @@
>  */
>  
>  #define PCF85063_REG_CTRL1		0x00 /* status */
> +#define PCF85063_REG_CTRL1_CAP_SEL	BIT(0)
>  #define PCF85063_REG_CTRL1_STOP		BIT(5)
>  #define PCF85063_REG_CTRL2		0x01
>  
> @@ -180,6 +181,31 @@ static const struct rtc_class_ops pcf85063_rtc_ops = {
>  	.set_time	= pcf85063_rtc_set_time
>  };
>  
> +static int pcf85063_select_capacitance(struct i2c_client *client)
> +{
> +	int rc;
> +	u8 reg;
> +
> +	rc = i2c_smbus_read_byte_data(client, PCF85063_REG_CTRL1);
> +	if (rc < 0) {
> +		dev_err(&client->dev, "Failing to read Control1 reg\n");
> +		return -EIO;
> +	}
> +
> +	if (device_property_present(&client->dev, "nxp,quartz_load_12.5pf"))
> +		reg = rc |= PCF85063_REG_CTRL1_CAP_SEL;
> +	else
> +		reg = rc &= ~PCF85063_REG_CTRL1_CAP_SEL;

That one is more straight forward, set it to the value from DT or leave
it alone.


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

      reply	other threads:[~2018-09-14  0:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 18:35 [PATCH v4 0/3] Add Davicom phy + reset-gpios Sam Ravnborg
2018-08-22 18:36 ` [PATCH v4 1/3] phylib: add Davicom PHY support Sam Ravnborg
2018-08-22 18:36 ` [PATCH v4 2/3] phylib: add support for reset-gpios Sam Ravnborg
2018-08-22 18:36 ` [PATCH v4 3/3] at91sam9263ek: add PHY, miitool etc. to config Sam Ravnborg
2018-08-24  8:03 ` [PATCH v4 0/3] Add Davicom phy + reset-gpios Sascha Hauer
2018-09-07 19:35 ` [PATCH v1 0/5] add quartz load support to NXP rtc drivers Sam Ravnborg
2018-09-07 19:35 ` [PATCH v1 1/5] dt-binding: rtci-pcf8523: add quartz_load property Sam Ravnborg
2018-09-07 21:43   ` Sam Ravnborg
2018-09-13 19:05   ` Alexandre Belloni
2018-09-13 20:44     ` Sam Ravnborg
2018-09-13 20:51       ` Alexandre Belloni
2018-09-26 15:47     ` Rob Herring
2018-09-26 18:51       ` Alexandre Belloni
2018-09-26 20:42         ` Sam Ravnborg
2018-09-07 19:35 ` [PATCH v1 2/5] dt-binding: rtc-pcf85063: add quartz load property Sam Ravnborg
2018-09-13 19:11   ` Alexandre Belloni
2018-09-07 19:35 ` [PATCH v1 3/5] dts: add nxp,quartz_load_12.5pf to all pcf8523 nodes Sam Ravnborg
2018-09-13 19:14   ` Alexandre Belloni
2018-09-07 19:35 ` [PATCH v1 4/5] rtc: pcf8523: external capacitor configuration Sam Ravnborg
2018-09-13 19:27   ` Alexandre Belloni
2018-09-07 19:35 ` [PATCH v1 5/5] rtc: pcf85063: " Sam Ravnborg
2018-09-13 19:29   ` Alexandre Belloni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180913192924.GK14988@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=andrew@aj.id.au \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=joel@jms.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sam@ravnborg.org \
    --cc=san@skov.dk \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.