Linux-RTC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property
@ 2020-06-15 10:51 Kevin P. Fleming
  2020-06-15 10:51 ` [PATCH 2/3] rtc: abx80x: Add utility function for writing configuration key Kevin P. Fleming
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Kevin P. Fleming @ 2020-06-15 10:51 UTC (permalink / raw)
  To: linux-rtc, devicetree
  Cc: Kevin P. Fleming, Alessandro Zummo, Alexandre Belloni, Rob Herring

Add a property to allow control of the autocalibration filter
capacitor.

Signed-off-by: Kevin P. Fleming <kevin+linux@km6g.us>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Rob Herring <robh+dt@kernel.org>
To: linux-rtc@vger.kernel.org
To: devicetree@vger.kernel.org
---
v3: corrected whitespace
 Documentation/devicetree/bindings/rtc/abracon,abx80x.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
index 2405e35a1bc0f..1b606e33d1a83 100644
--- a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
+++ b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
@@ -29,3 +29,11 @@ and valid to enable charging:
  - "abracon,tc-diode": should be "standard" (0.6V) or "schottky" (0.3V)
  - "abracon,tc-resistor": should be <0>, <3>, <6> or <11>. 0 disables the output
                           resistor, the other values are in kOhm.
+
+All of the devices can have a 47pf capacitor attached to increase the
+autocalibration accuracy of their RC oscillators. To enable or disable usage
+of the capacitor the following property can be defined:
+
+ - "abracon,autocal-filter": should be <0> or <1>. 0 indicates that there
+                             is no capacitor attached, 1 indicates that there
+                             is a capacitor attached.
-- 
2.26.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] rtc: abx80x: Add utility function for writing configuration key
  2020-06-15 10:51 [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property Kevin P. Fleming
@ 2020-06-15 10:51 ` Kevin P. Fleming
  2020-06-15 10:51 ` [PATCH 3/3 v3] rtc: abx80x: Add support for autocalibration filter capacitor Kevin P. Fleming
  2020-07-13 18:39 ` [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property Rob Herring
  2 siblings, 0 replies; 7+ messages in thread
From: Kevin P. Fleming @ 2020-06-15 10:51 UTC (permalink / raw)
  To: linux-rtc, devicetree
  Cc: Kevin P. Fleming, Alessandro Zummo, Alexandre Belloni, Rob Herring

Writing one of key two values into the configuration key register
is a common operation, so a utility function has been added to
provide consistent behavior and eliminate code duplication.

Signed-off-by: Kevin P. Fleming <kevin+linux@km6g.us>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: linux-rtc@vger.kernel.org
---
 drivers/rtc/rtc-abx80x.c | 39 ++++++++++++++++-----------------------
 1 file changed, 16 insertions(+), 23 deletions(-)

diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 803725b3a02c3..daa6f27040e61 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -117,6 +117,16 @@ struct abx80x_priv {
 	struct watchdog_device wdog;
 };
 
+static int abx80x_write_config_key(struct i2c_client *client, u8 key)
+{
+	if (i2c_smbus_write_byte_data(client, ABX8XX_REG_CFG_KEY, key) < 0) {
+		dev_err(&client->dev, "Unable to write configuration key\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
 static int abx80x_is_rc_mode(struct i2c_client *client)
 {
 	int flags = 0;
@@ -140,12 +150,8 @@ static int abx80x_enable_trickle_charger(struct i2c_client *client,
 	 * Write the configuration key register to enable access to the Trickle
 	 * register
 	 */
-	err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CFG_KEY,
-					ABX8XX_CFG_KEY_MISC);
-	if (err < 0) {
-		dev_err(&client->dev, "Unable to write configuration key\n");
+	if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_MISC) < 0)
 		return -EIO;
-	}
 
 	err = i2c_smbus_write_byte_data(client, ABX8XX_REG_TRICKLE,
 					ABX8XX_TRICKLE_CHARGE_ENABLE |
@@ -358,12 +364,8 @@ static int abx80x_rtc_set_autocalibration(struct device *dev,
 	}
 
 	/* Unlock write access to Oscillator Control Register */
-	retval = i2c_smbus_write_byte_data(client, ABX8XX_REG_CFG_KEY,
-					   ABX8XX_CFG_KEY_OSC);
-	if (retval < 0) {
-		dev_err(dev, "Failed to write CONFIG_KEY register\n");
-		return retval;
-	}
+	if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_OSC) < 0)
+		return -EIO;
 
 	retval = i2c_smbus_write_byte_data(client, ABX8XX_REG_OSC, flags);
 
@@ -450,12 +452,8 @@ static ssize_t oscillator_store(struct device *dev,
 		flags |= (ABX8XX_OSC_OSEL);
 
 	/* Unlock write access on Oscillator Control register */
-	retval = i2c_smbus_write_byte_data(client, ABX8XX_REG_CFG_KEY,
-					   ABX8XX_CFG_KEY_OSC);
-	if (retval < 0) {
-		dev_err(dev, "Failed to write CONFIG_KEY register\n");
-		return retval;
-	}
+	if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_OSC) < 0)
+		return -EIO;
 
 	retval = i2c_smbus_write_byte_data(client, ABX8XX_REG_OSC, flags);
 	if (retval < 0) {
@@ -762,13 +760,8 @@ static int abx80x_probe(struct i2c_client *client,
 		 * Write the configuration key register to enable access to
 		 * the config2 register
 		 */
-		err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CFG_KEY,
-						ABX8XX_CFG_KEY_MISC);
-		if (err < 0) {
-			dev_err(&client->dev,
-				"Unable to write configuration key\n");
+		if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_MISC) < 0)
 			return -EIO;
-		}
 
 		err = i2c_smbus_write_byte_data(client, ABX8XX_REG_OUT_CTRL,
 						data | ABX8XX_OUT_CTRL_EXDS);
-- 
2.26.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/3 v3] rtc: abx80x: Add support for autocalibration filter capacitor
  2020-06-15 10:51 [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property Kevin P. Fleming
  2020-06-15 10:51 ` [PATCH 2/3] rtc: abx80x: Add utility function for writing configuration key Kevin P. Fleming
@ 2020-06-15 10:51 ` Kevin P. Fleming
  2020-07-13 18:39 ` [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property Rob Herring
  2 siblings, 0 replies; 7+ messages in thread
From: Kevin P. Fleming @ 2020-06-15 10:51 UTC (permalink / raw)
  To: linux-rtc, devicetree
  Cc: Kevin P. Fleming, Alessandro Zummo, Alexandre Belloni, Rob Herring

All of the parts supported by this driver can make use of a
small capacitor to improve the accuracy of the autocalibration
process for their RC oscillators. If a capacitor is connected,
a configuration register must be set to enable its use, so a
new Device Tree property has been added for that purpose.

Signed-off-by: Kevin P. Fleming <kevin+linux@km6g.us>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Rob Herring <robh+dt@kernel.org>
To: linux-rtc@vger.kernel.org
To: devicetree@vger.kernel.org
---
v3: corrected failure to initialize variable
 drivers/rtc/rtc-abx80x.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index daa6f27040e61..1b428fe2029ef 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -77,6 +77,10 @@
 #define ABX8XX_CFG_KEY_OSC	0xa1
 #define ABX8XX_CFG_KEY_MISC	0x9d
 
+#define ABX8XX_REG_AFCTRL	0x26
+#define ABX8XX_AUTOCAL_FILTER_DISABLE	0x00
+#define ABX8XX_AUTOCAL_FILTER_ENABLE	0xa0
+
 #define ABX8XX_REG_ID0		0x28
 
 #define ABX8XX_REG_OUT_CTRL	0x30
@@ -141,6 +145,26 @@ static int abx80x_is_rc_mode(struct i2c_client *client)
 	return (flags & ABX8XX_OSS_OMODE) ? 1 : 0;
 }
 
+static int abx80x_set_autocal_filter(struct i2c_client *client, u8 filter_cfg)
+{
+	int err;
+
+	/*
+	 * Write the configuration key register to enable access to the AFCTRL
+	 * register
+	 */
+	if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_MISC) < 0)
+		return -EIO;
+
+	err = i2c_smbus_write_byte_data(client, ABX8XX_REG_AFCTRL, filter_cfg);
+	if (err < 0) {
+		dev_warn(&client->dev, "Unable to write autocal filter register\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
 static int abx80x_enable_trickle_charger(struct i2c_client *client,
 					 u8 trickle_cfg)
 {
@@ -678,7 +702,8 @@ static int abx80x_probe(struct i2c_client *client,
 {
 	struct device_node *np = client->dev.of_node;
 	struct abx80x_priv *priv;
-	int i, data, err, trickle_cfg = -EINVAL;
+	int i, data, err, filter_cfg;
+	int trickle_cfg = -EINVAL;
 	char buf[7];
 	unsigned int part = id->driver_data;
 	unsigned int partnumber;
@@ -824,6 +849,15 @@ static int abx80x_probe(struct i2c_client *client,
 			return err;
 	}
 
+	if (of_property_read_u32(np, "abracon,autocal_filter", &filter_cfg) == 0) {
+		err = abx80x_set_autocal_filter(client,
+						filter_cfg ?
+						ABX8XX_AUTOCAL_FILTER_ENABLE :
+						ABX8XX_AUTOCAL_FILTER_DISABLE);
+		if (err)
+			return err;
+	}
+
 	if (client->irq > 0) {
 		dev_info(&client->dev, "IRQ %d supplied\n", client->irq);
 		err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
-- 
2.26.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property
  2020-06-15 10:51 [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property Kevin P. Fleming
  2020-06-15 10:51 ` [PATCH 2/3] rtc: abx80x: Add utility function for writing configuration key Kevin P. Fleming
  2020-06-15 10:51 ` [PATCH 3/3 v3] rtc: abx80x: Add support for autocalibration filter capacitor Kevin P. Fleming
@ 2020-07-13 18:39 ` Rob Herring
  2020-07-13 22:05   ` Kevin P. Fleming
  2020-07-26 19:40   ` Alexandre Belloni
  2 siblings, 2 replies; 7+ messages in thread
From: Rob Herring @ 2020-07-13 18:39 UTC (permalink / raw)
  To: Kevin P. Fleming
  Cc: linux-rtc, devicetree, Alessandro Zummo, Alexandre Belloni

On Mon, Jun 15, 2020 at 06:51:11AM -0400, Kevin P. Fleming wrote:
> Add a property to allow control of the autocalibration filter
> capacitor.
> 
> Signed-off-by: Kevin P. Fleming <kevin+linux@km6g.us>
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> To: linux-rtc@vger.kernel.org
> To: devicetree@vger.kernel.org
> ---
> v3: corrected whitespace
>  Documentation/devicetree/bindings/rtc/abracon,abx80x.txt | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
> index 2405e35a1bc0f..1b606e33d1a83 100644
> --- a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
> +++ b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
> @@ -29,3 +29,11 @@ and valid to enable charging:
>   - "abracon,tc-diode": should be "standard" (0.6V) or "schottky" (0.3V)
>   - "abracon,tc-resistor": should be <0>, <3>, <6> or <11>. 0 disables the output
>                            resistor, the other values are in kOhm.
> +
> +All of the devices can have a 47pf capacitor attached to increase the
> +autocalibration accuracy of their RC oscillators. To enable or disable usage
> +of the capacitor the following property can be defined:
> +
> + - "abracon,autocal-filter": should be <0> or <1>. 0 indicates that there
> +                             is no capacitor attached, 1 indicates that there
> +                             is a capacitor attached.

What does not present mean? If you don't have a defined meaning (such 
as maintain the default/bootloader initialized setting), then make this 
boolean.

Rob

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property
  2020-07-13 18:39 ` [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property Rob Herring
@ 2020-07-13 22:05   ` Kevin P. Fleming
  2020-07-26 19:40   ` Alexandre Belloni
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin P. Fleming @ 2020-07-13 22:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: Kevin P. Fleming, linux-rtc, devicetree, Alessandro Zummo,
	Alexandre Belloni

On Mon, Jul 13, 2020 at 2:39 PM Rob Herring <robh@kernel.org> wrote:
>
> On Mon, Jun 15, 2020 at 06:51:11AM -0400, Kevin P. Fleming wrote:
> > Add a property to allow control of the autocalibration filter
> > capacitor.
> >
> > Signed-off-by: Kevin P. Fleming <kevin+linux@km6g.us>
> > Cc: Alessandro Zummo <a.zummo@towertech.it>
> > Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > To: linux-rtc@vger.kernel.org
> > To: devicetree@vger.kernel.org
> > ---
> > v3: corrected whitespace
> >  Documentation/devicetree/bindings/rtc/abracon,abx80x.txt | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
> > index 2405e35a1bc0f..1b606e33d1a83 100644
> > --- a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
> > +++ b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
> > @@ -29,3 +29,11 @@ and valid to enable charging:
> >   - "abracon,tc-diode": should be "standard" (0.6V) or "schottky" (0.3V)
> >   - "abracon,tc-resistor": should be <0>, <3>, <6> or <11>. 0 disables the output
> >                            resistor, the other values are in kOhm.
> > +
> > +All of the devices can have a 47pf capacitor attached to increase the
> > +autocalibration accuracy of their RC oscillators. To enable or disable usage
> > +of the capacitor the following property can be defined:
> > +
> > + - "abracon,autocal-filter": should be <0> or <1>. 0 indicates that there
> > +                             is no capacitor attached, 1 indicates that there
> > +                             is a capacitor attached.
>
> What does not present mean? If you don't have a defined meaning (such
> as maintain the default/bootloader initialized setting), then make this
> boolean.

That is the intended meaning (leave the current setting unmodified). I
can add that to the documentation so it is clear.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property
  2020-07-13 18:39 ` [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property Rob Herring
  2020-07-13 22:05   ` Kevin P. Fleming
@ 2020-07-26 19:40   ` Alexandre Belloni
  1 sibling, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2020-07-26 19:40 UTC (permalink / raw)
  To: Rob Herring; +Cc: Kevin P. Fleming, linux-rtc, devicetree, Alessandro Zummo

Hi Rob,

On 13/07/2020 12:39:06-0600, Rob Herring wrote:
> On Mon, Jun 15, 2020 at 06:51:11AM -0400, Kevin P. Fleming wrote:
> > Add a property to allow control of the autocalibration filter
> > capacitor.
> > 
> > Signed-off-by: Kevin P. Fleming <kevin+linux@km6g.us>
> > Cc: Alessandro Zummo <a.zummo@towertech.it>
> > Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > To: linux-rtc@vger.kernel.org
> > To: devicetree@vger.kernel.org
> > ---
> > v3: corrected whitespace
> >  Documentation/devicetree/bindings/rtc/abracon,abx80x.txt | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
> > index 2405e35a1bc0f..1b606e33d1a83 100644
> > --- a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
> > +++ b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt
> > @@ -29,3 +29,11 @@ and valid to enable charging:
> >   - "abracon,tc-diode": should be "standard" (0.6V) or "schottky" (0.3V)
> >   - "abracon,tc-resistor": should be <0>, <3>, <6> or <11>. 0 disables the output
> >                            resistor, the other values are in kOhm.
> > +
> > +All of the devices can have a 47pf capacitor attached to increase the
> > +autocalibration accuracy of their RC oscillators. To enable or disable usage
> > +of the capacitor the following property can be defined:
> > +
> > + - "abracon,autocal-filter": should be <0> or <1>. 0 indicates that there
> > +                             is no capacitor attached, 1 indicates that there
> > +                             is a capacitor attached.
> 
> What does not present mean? If you don't have a defined meaning (such 
> as maintain the default/bootloader initialized setting), then make this 
> boolean.

We discussed that on the previous revision. Not present means keeping
the current value. Like most RTC registers, this is battery backed and
it is expected to persist across reboots. If it has ever been
initialized to a value, (e.g. by the bootloader), then we need a way to
have the driver not change it.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] rtc: abx80x: Add utility function for writing configuration key
  2020-06-12 22:35 [PATCH 1/3 v2] " Kevin P. Fleming
@ 2020-06-12 22:35 ` Kevin P. Fleming
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin P. Fleming @ 2020-06-12 22:35 UTC (permalink / raw)
  To: linux-rtc, devicetree
  Cc: Kevin P. Fleming, Alessandro Zummo, Alexandre Belloni, Rob Herring

Writing one of key two values into the configuration key register
is a common operation, so a utility function has been added to
provide consistent behavior and eliminate code duplication.

Signed-off-by: Kevin P. Fleming <kevin+linux@km6g.us>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: linux-rtc@vger.kernel.org
---
 drivers/rtc/rtc-abx80x.c | 39 ++++++++++++++++-----------------------
 1 file changed, 16 insertions(+), 23 deletions(-)

diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 803725b3a02c3..daa6f27040e61 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -117,6 +117,16 @@ struct abx80x_priv {
 	struct watchdog_device wdog;
 };
 
+static int abx80x_write_config_key(struct i2c_client *client, u8 key)
+{
+	if (i2c_smbus_write_byte_data(client, ABX8XX_REG_CFG_KEY, key) < 0) {
+		dev_err(&client->dev, "Unable to write configuration key\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
 static int abx80x_is_rc_mode(struct i2c_client *client)
 {
 	int flags = 0;
@@ -140,12 +150,8 @@ static int abx80x_enable_trickle_charger(struct i2c_client *client,
 	 * Write the configuration key register to enable access to the Trickle
 	 * register
 	 */
-	err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CFG_KEY,
-					ABX8XX_CFG_KEY_MISC);
-	if (err < 0) {
-		dev_err(&client->dev, "Unable to write configuration key\n");
+	if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_MISC) < 0)
 		return -EIO;
-	}
 
 	err = i2c_smbus_write_byte_data(client, ABX8XX_REG_TRICKLE,
 					ABX8XX_TRICKLE_CHARGE_ENABLE |
@@ -358,12 +364,8 @@ static int abx80x_rtc_set_autocalibration(struct device *dev,
 	}
 
 	/* Unlock write access to Oscillator Control Register */
-	retval = i2c_smbus_write_byte_data(client, ABX8XX_REG_CFG_KEY,
-					   ABX8XX_CFG_KEY_OSC);
-	if (retval < 0) {
-		dev_err(dev, "Failed to write CONFIG_KEY register\n");
-		return retval;
-	}
+	if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_OSC) < 0)
+		return -EIO;
 
 	retval = i2c_smbus_write_byte_data(client, ABX8XX_REG_OSC, flags);
 
@@ -450,12 +452,8 @@ static ssize_t oscillator_store(struct device *dev,
 		flags |= (ABX8XX_OSC_OSEL);
 
 	/* Unlock write access on Oscillator Control register */
-	retval = i2c_smbus_write_byte_data(client, ABX8XX_REG_CFG_KEY,
-					   ABX8XX_CFG_KEY_OSC);
-	if (retval < 0) {
-		dev_err(dev, "Failed to write CONFIG_KEY register\n");
-		return retval;
-	}
+	if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_OSC) < 0)
+		return -EIO;
 
 	retval = i2c_smbus_write_byte_data(client, ABX8XX_REG_OSC, flags);
 	if (retval < 0) {
@@ -762,13 +760,8 @@ static int abx80x_probe(struct i2c_client *client,
 		 * Write the configuration key register to enable access to
 		 * the config2 register
 		 */
-		err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CFG_KEY,
-						ABX8XX_CFG_KEY_MISC);
-		if (err < 0) {
-			dev_err(&client->dev,
-				"Unable to write configuration key\n");
+		if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_MISC) < 0)
 			return -EIO;
-		}
 
 		err = i2c_smbus_write_byte_data(client, ABX8XX_REG_OUT_CTRL,
 						data | ABX8XX_OUT_CTRL_EXDS);
-- 
2.26.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 10:51 [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property Kevin P. Fleming
2020-06-15 10:51 ` [PATCH 2/3] rtc: abx80x: Add utility function for writing configuration key Kevin P. Fleming
2020-06-15 10:51 ` [PATCH 3/3 v3] rtc: abx80x: Add support for autocalibration filter capacitor Kevin P. Fleming
2020-07-13 18:39 ` [PATCH 1/3 v3] dt-bindings: abx80x: Add autocal-filter property Rob Herring
2020-07-13 22:05   ` Kevin P. Fleming
2020-07-26 19:40   ` Alexandre Belloni
  -- strict thread matches above, loose matches on Subject: below --
2020-06-12 22:35 [PATCH 1/3 v2] " Kevin P. Fleming
2020-06-12 22:35 ` [PATCH 2/3] rtc: abx80x: Add utility function for writing configuration key Kevin P. Fleming

Linux-RTC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rtc/0 linux-rtc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rtc linux-rtc/ https://lore.kernel.org/linux-rtc \
		linux-rtc@vger.kernel.org
	public-inbox-index linux-rtc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rtc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git