linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3 v2] dt-bindings: abx80x: Add autocal-filter property
@ 2020-06-12 22:35 Kevin P. Fleming
  2020-06-12 22:35 ` [PATCH 2/3] rtc: abx80x: Add utility function for writing configuration key Kevin P. Fleming
  2020-06-12 22:35 ` [PATCH 3/3 v2] rtc: abx80x: Add support for autocalibration filter capacitor Kevin P. Fleming
  0 siblings, 2 replies; 5+ 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

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
---
v2: Change property to an integer value, and describe possible values
 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..18210627b8470 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 related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] rtc: abx80x: Add utility function for writing configuration key
  2020-06-12 22:35 [PATCH 1/3 v2] dt-bindings: abx80x: Add autocal-filter property Kevin P. Fleming
@ 2020-06-12 22:35 ` Kevin P. Fleming
  2020-06-12 22:35 ` [PATCH 3/3 v2] rtc: abx80x: Add support for autocalibration filter capacitor Kevin P. Fleming
  1 sibling, 0 replies; 5+ 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 related	[flat|nested] 5+ messages in thread

* [PATCH 3/3 v2] rtc: abx80x: Add support for autocalibration filter capacitor
  2020-06-12 22:35 [PATCH 1/3 v2] dt-bindings: abx80x: Add autocal-filter property Kevin P. Fleming
  2020-06-12 22:35 ` [PATCH 2/3] rtc: abx80x: Add utility function for writing configuration key Kevin P. Fleming
@ 2020-06-12 22:35 ` Kevin P. Fleming
  2020-06-15  9:47   ` Dan Carpenter
  1 sibling, 1 reply; 5+ 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

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
---
v2: Change property to an integer value to allow user to enable or disable
 drivers/rtc/rtc-abx80x.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index daa6f27040e61..8edfcefbd9058 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,7 @@ 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, trickle_cfg, filter_cfg = -EINVAL;
 	char buf[7];
 	unsigned int part = id->driver_data;
 	unsigned int partnumber;
@@ -824,6 +848,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 related	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3 v2] rtc: abx80x: Add support for autocalibration filter capacitor
  2020-06-12 22:35 ` [PATCH 3/3 v2] rtc: abx80x: Add support for autocalibration filter capacitor Kevin P. Fleming
@ 2020-06-15  9:47   ` Dan Carpenter
  2020-06-15 10:18     ` Kevin P. Fleming
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2020-06-15  9:47 UTC (permalink / raw)
  To: kbuild, Kevin P. Fleming, linux-rtc, devicetree
  Cc: lkp, kbuild-all, Kevin P. Fleming, Alessandro Zummo,
	Alexandre Belloni, Rob Herring

[-- Attachment #1: Type: text/plain, Size: 15388 bytes --]

Hi "Kevin,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Kevin-P-Fleming/dt-bindings-abx80x-Add-autocal-filter-property/20200613-063944
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: i386-randconfig-m021-20200612 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/rtc/rtc-abx80x.c:821 abx80x_probe() error: uninitialized symbol 'trickle_cfg'.

# https://github.com/0day-ci/linux/commit/bbd3b3445f48810231c5f004a975116f19b37331
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout bbd3b3445f48810231c5f004a975116f19b37331
vim +/trickle_cfg +821 drivers/rtc/rtc-abx80x.c

4d61ff6b9960cb Philippe De Muyter 2015-05-05  700  static int abx80x_probe(struct i2c_client *client,
4d61ff6b9960cb Philippe De Muyter 2015-05-05  701  			const struct i2c_device_id *id)
4d61ff6b9960cb Philippe De Muyter 2015-05-05  702  {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  703  	struct device_node *np = client->dev.of_node;
af69f9a7878413 Jeremy Gebben      2018-09-11  704  	struct abx80x_priv *priv;
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  705  	int i, data, err, trickle_cfg, filter_cfg = -EINVAL;
                                                                          ^^^^^^^^^^^

4d61ff6b9960cb Philippe De Muyter 2015-05-05  706  	char buf[7];
4d61ff6b9960cb Philippe De Muyter 2015-05-05  707  	unsigned int part = id->driver_data;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  708  	unsigned int partnumber;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  709  	unsigned int majrev, minrev;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  710  	unsigned int lot;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  711  	unsigned int wafer;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  712  	unsigned int uid;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  713  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  714  	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
4d61ff6b9960cb Philippe De Muyter 2015-05-05  715  		return -ENODEV;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  716  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  717  	err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_ID0,
4d61ff6b9960cb Philippe De Muyter 2015-05-05  718  					    sizeof(buf), buf);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  719  	if (err < 0) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  720  		dev_err(&client->dev, "Unable to read partnumber\n");
4d61ff6b9960cb Philippe De Muyter 2015-05-05  721  		return -EIO;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  722  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  723  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  724  	partnumber = (buf[0] << 8) | buf[1];
4d61ff6b9960cb Philippe De Muyter 2015-05-05  725  	majrev = buf[2] >> 3;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  726  	minrev = buf[2] & 0x7;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  727  	lot = ((buf[4] & 0x80) << 2) | ((buf[6] & 0x80) << 1) | buf[3];
4d61ff6b9960cb Philippe De Muyter 2015-05-05  728  	uid = ((buf[4] & 0x7f) << 8) | buf[5];
4d61ff6b9960cb Philippe De Muyter 2015-05-05  729  	wafer = (buf[6] & 0x7c) >> 2;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  730  	dev_info(&client->dev, "model %04x, revision %u.%u, lot %x, wafer %x, uid %x\n",
4d61ff6b9960cb Philippe De Muyter 2015-05-05  731  		 partnumber, majrev, minrev, lot, wafer, uid);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  732  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  733  	data = i2c_smbus_read_byte_data(client, ABX8XX_REG_CTRL1);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  734  	if (data < 0) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  735  		dev_err(&client->dev, "Unable to read control register\n");
4d61ff6b9960cb Philippe De Muyter 2015-05-05  736  		return -EIO;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  737  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  738  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  739  	err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CTRL1,
718a820a303ca6 Alexandre Belloni  2015-12-17  740  					((data & ~(ABX8XX_CTRL_12_24 |
718a820a303ca6 Alexandre Belloni  2015-12-17  741  						   ABX8XX_CTRL_ARST)) |
4d61ff6b9960cb Philippe De Muyter 2015-05-05  742  					 ABX8XX_CTRL_WRITE));
4d61ff6b9960cb Philippe De Muyter 2015-05-05  743  	if (err < 0) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  744  		dev_err(&client->dev, "Unable to write control register\n");
4d61ff6b9960cb Philippe De Muyter 2015-05-05  745  		return -EIO;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  746  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  747  
75455e258ea2b3 Marek Vasut        2019-01-29  748  	/* Configure RV1805 specifics */
75455e258ea2b3 Marek Vasut        2019-01-29  749  	if (part == RV1805) {
75455e258ea2b3 Marek Vasut        2019-01-29  750  		/*
75455e258ea2b3 Marek Vasut        2019-01-29  751  		 * Avoid accidentally entering test mode. This can happen
75455e258ea2b3 Marek Vasut        2019-01-29  752  		 * on the RV1805 in case the reserved bit 5 in control2
75455e258ea2b3 Marek Vasut        2019-01-29  753  		 * register is set. RV-1805-C3 datasheet indicates that
75455e258ea2b3 Marek Vasut        2019-01-29  754  		 * the bit should be cleared in section 11h - Control2.
75455e258ea2b3 Marek Vasut        2019-01-29  755  		 */
75455e258ea2b3 Marek Vasut        2019-01-29  756  		data = i2c_smbus_read_byte_data(client, ABX8XX_REG_CTRL2);
75455e258ea2b3 Marek Vasut        2019-01-29  757  		if (data < 0) {
75455e258ea2b3 Marek Vasut        2019-01-29  758  			dev_err(&client->dev,
75455e258ea2b3 Marek Vasut        2019-01-29  759  				"Unable to read control2 register\n");
75455e258ea2b3 Marek Vasut        2019-01-29  760  			return -EIO;
75455e258ea2b3 Marek Vasut        2019-01-29  761  		}
75455e258ea2b3 Marek Vasut        2019-01-29  762  
75455e258ea2b3 Marek Vasut        2019-01-29  763  		err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CTRL2,
75455e258ea2b3 Marek Vasut        2019-01-29  764  						data & ~ABX8XX_CTRL2_RSVD);
75455e258ea2b3 Marek Vasut        2019-01-29  765  		if (err < 0) {
75455e258ea2b3 Marek Vasut        2019-01-29  766  			dev_err(&client->dev,
75455e258ea2b3 Marek Vasut        2019-01-29  767  				"Unable to write control2 register\n");
75455e258ea2b3 Marek Vasut        2019-01-29  768  			return -EIO;
75455e258ea2b3 Marek Vasut        2019-01-29  769  		}
75455e258ea2b3 Marek Vasut        2019-01-29  770  
75455e258ea2b3 Marek Vasut        2019-01-29  771  		/*
75455e258ea2b3 Marek Vasut        2019-01-29  772  		 * Avoid extra power leakage. The RV1805 uses smaller
75455e258ea2b3 Marek Vasut        2019-01-29  773  		 * 10pin package and the EXTI input is not present.
75455e258ea2b3 Marek Vasut        2019-01-29  774  		 * Disable it to avoid leakage.
75455e258ea2b3 Marek Vasut        2019-01-29  775  		 */
75455e258ea2b3 Marek Vasut        2019-01-29  776  		data = i2c_smbus_read_byte_data(client, ABX8XX_REG_OUT_CTRL);
75455e258ea2b3 Marek Vasut        2019-01-29  777  		if (data < 0) {
75455e258ea2b3 Marek Vasut        2019-01-29  778  			dev_err(&client->dev,
75455e258ea2b3 Marek Vasut        2019-01-29  779  				"Unable to read output control register\n");
75455e258ea2b3 Marek Vasut        2019-01-29  780  			return -EIO;
75455e258ea2b3 Marek Vasut        2019-01-29  781  		}
75455e258ea2b3 Marek Vasut        2019-01-29  782  
75455e258ea2b3 Marek Vasut        2019-01-29  783  		/*
75455e258ea2b3 Marek Vasut        2019-01-29  784  		 * Write the configuration key register to enable access to
75455e258ea2b3 Marek Vasut        2019-01-29  785  		 * the config2 register
75455e258ea2b3 Marek Vasut        2019-01-29  786  		 */
fee83bca1a1fde Kevin P. Fleming   2020-06-12  787  		if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_MISC) < 0)
75455e258ea2b3 Marek Vasut        2019-01-29  788  			return -EIO;
75455e258ea2b3 Marek Vasut        2019-01-29  789  
75455e258ea2b3 Marek Vasut        2019-01-29  790  		err = i2c_smbus_write_byte_data(client, ABX8XX_REG_OUT_CTRL,
75455e258ea2b3 Marek Vasut        2019-01-29  791  						data | ABX8XX_OUT_CTRL_EXDS);
75455e258ea2b3 Marek Vasut        2019-01-29  792  		if (err < 0) {
75455e258ea2b3 Marek Vasut        2019-01-29  793  			dev_err(&client->dev,
75455e258ea2b3 Marek Vasut        2019-01-29  794  				"Unable to write output control register\n");
75455e258ea2b3 Marek Vasut        2019-01-29  795  			return -EIO;
75455e258ea2b3 Marek Vasut        2019-01-29  796  		}
75455e258ea2b3 Marek Vasut        2019-01-29  797  	}
75455e258ea2b3 Marek Vasut        2019-01-29  798  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  799  	/* part autodetection */
4d61ff6b9960cb Philippe De Muyter 2015-05-05  800  	if (part == ABX80X) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  801  		for (i = 0; abx80x_caps[i].pn; i++)
4d61ff6b9960cb Philippe De Muyter 2015-05-05  802  			if (partnumber == abx80x_caps[i].pn)
4d61ff6b9960cb Philippe De Muyter 2015-05-05  803  				break;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  804  		if (abx80x_caps[i].pn == 0) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  805  			dev_err(&client->dev, "Unknown part: %04x\n",
4d61ff6b9960cb Philippe De Muyter 2015-05-05  806  				partnumber);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  807  			return -EINVAL;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  808  		}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  809  		part = i;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  810  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  811  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  812  	if (partnumber != abx80x_caps[part].pn) {
4d61ff6b9960cb Philippe De Muyter 2015-05-05  813  		dev_err(&client->dev, "partnumber mismatch %04x != %04x\n",
4d61ff6b9960cb Philippe De Muyter 2015-05-05  814  			partnumber, abx80x_caps[part].pn);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  815  		return -EINVAL;
4d61ff6b9960cb Philippe De Muyter 2015-05-05  816  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  817  
4d61ff6b9960cb Philippe De Muyter 2015-05-05  818  	if (np && abx80x_caps[part].has_tc)
6e429f6b8c6b8f Kevin P. Fleming   2020-05-30  819  		trickle_cfg = abx80x_dt_trickle_cfg(client);
                                                                ^^^^^^^^^^^^^
Not initialized on else path.

4d61ff6b9960cb Philippe De Muyter 2015-05-05  820  
4d61ff6b9960cb Philippe De Muyter 2015-05-05 @821  	if (trickle_cfg > 0) {
                                                            ^^^^^^^^^^^

4d61ff6b9960cb Philippe De Muyter 2015-05-05  822  		dev_info(&client->dev, "Enabling trickle charger: %02x\n",
4d61ff6b9960cb Philippe De Muyter 2015-05-05  823  			 trickle_cfg);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  824  		abx80x_enable_trickle_charger(client, trickle_cfg);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  825  	}
4d61ff6b9960cb Philippe De Muyter 2015-05-05  826  
718a820a303ca6 Alexandre Belloni  2015-12-17  827  	err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CD_TIMER_CTL,
718a820a303ca6 Alexandre Belloni  2015-12-17  828  					BIT(2));
718a820a303ca6 Alexandre Belloni  2015-12-17  829  	if (err)
718a820a303ca6 Alexandre Belloni  2015-12-17  830  		return err;
718a820a303ca6 Alexandre Belloni  2015-12-17  831  
af69f9a7878413 Jeremy Gebben      2018-09-11  832  	priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
af69f9a7878413 Jeremy Gebben      2018-09-11  833  	if (priv == NULL)
af69f9a7878413 Jeremy Gebben      2018-09-11  834  		return -ENOMEM;
af69f9a7878413 Jeremy Gebben      2018-09-11  835  
af69f9a7878413 Jeremy Gebben      2018-09-11  836  	priv->rtc = devm_rtc_allocate_device(&client->dev);
af69f9a7878413 Jeremy Gebben      2018-09-11  837  	if (IS_ERR(priv->rtc))
af69f9a7878413 Jeremy Gebben      2018-09-11  838  		return PTR_ERR(priv->rtc);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  839  
af69f9a7878413 Jeremy Gebben      2018-09-11  840  	priv->rtc->ops = &abx80x_rtc_ops;
af69f9a7878413 Jeremy Gebben      2018-09-11  841  	priv->client = client;
9360a6a81862d3 Alexandre Belloni  2017-10-13  842  
af69f9a7878413 Jeremy Gebben      2018-09-11  843  	i2c_set_clientdata(client, priv);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  844  
749e36d0a0d725 Jeremy Gebben      2018-09-11  845  	if (abx80x_caps[part].has_wdog) {
749e36d0a0d725 Jeremy Gebben      2018-09-11  846  		err = abx80x_setup_watchdog(priv);
749e36d0a0d725 Jeremy Gebben      2018-09-11  847  		if (err)
749e36d0a0d725 Jeremy Gebben      2018-09-11  848  			return err;
749e36d0a0d725 Jeremy Gebben      2018-09-11  849  	}
749e36d0a0d725 Jeremy Gebben      2018-09-11  850  
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  851  	if (of_property_read_u32(np, "abracon,autocal_filter", &filter_cfg) == 0) {
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  852  		err = abx80x_set_autocal_filter(client,
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  853  						filter_cfg ?
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  854  						ABX8XX_AUTOCAL_FILTER_ENABLE :
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  855  						ABX8XX_AUTOCAL_FILTER_DISABLE);
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  856  		if (err)
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  857  			return err;
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  858  	}
bbd3b3445f4881 Kevin P. Fleming   2020-06-12  859  
718a820a303ca6 Alexandre Belloni  2015-12-17  860  	if (client->irq > 0) {
718a820a303ca6 Alexandre Belloni  2015-12-17  861  		dev_info(&client->dev, "IRQ %d supplied\n", client->irq);
718a820a303ca6 Alexandre Belloni  2015-12-17  862  		err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
718a820a303ca6 Alexandre Belloni  2015-12-17  863  						abx80x_handle_irq,
718a820a303ca6 Alexandre Belloni  2015-12-17  864  						IRQF_SHARED | IRQF_ONESHOT,
718a820a303ca6 Alexandre Belloni  2015-12-17  865  						"abx8xx",
718a820a303ca6 Alexandre Belloni  2015-12-17  866  						client);
718a820a303ca6 Alexandre Belloni  2015-12-17  867  		if (err) {
718a820a303ca6 Alexandre Belloni  2015-12-17  868  			dev_err(&client->dev, "unable to request IRQ, alarms disabled\n");
718a820a303ca6 Alexandre Belloni  2015-12-17  869  			client->irq = 0;
718a820a303ca6 Alexandre Belloni  2015-12-17  870  		}
718a820a303ca6 Alexandre Belloni  2015-12-17  871  	}
718a820a303ca6 Alexandre Belloni  2015-12-17  872  
559e883e0f7768 Alexandre Belloni  2019-03-06  873  	err = rtc_add_group(priv->rtc, &rtc_calib_attr_group);
59a8383adb7545 Mylène Josserand   2016-03-21  874  	if (err) {
59a8383adb7545 Mylène Josserand   2016-03-21  875  		dev_err(&client->dev, "Failed to create sysfs group: %d\n",
59a8383adb7545 Mylène Josserand   2016-03-21  876  			err);
59a8383adb7545 Mylène Josserand   2016-03-21  877  		return err;
59a8383adb7545 Mylène Josserand   2016-03-21  878  	}
59a8383adb7545 Mylène Josserand   2016-03-21  879  
559e883e0f7768 Alexandre Belloni  2019-03-06  880  	return rtc_register_device(priv->rtc);
4d61ff6b9960cb Philippe De Muyter 2015-05-05  881  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31400 bytes --]

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

* Re: [PATCH 3/3 v2] rtc: abx80x: Add support for autocalibration filter capacitor
  2020-06-15  9:47   ` Dan Carpenter
@ 2020-06-15 10:18     ` Kevin P. Fleming
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin P. Fleming @ 2020-06-15 10:18 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: kbuild, Kevin P. Fleming, linux-rtc, devicetree, lkp, kbuild-all,
	Alessandro Zummo, Alexandre Belloni, Rob Herring

Thanks for the bot-catch :-) WIll fix.

On Mon, Jun 15, 2020 at 5:47 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Hi "Kevin,
>
> Thank you for the patch! Perhaps something to improve:
>
> url:    https://github.com/0day-ci/linux/commits/Kevin-P-Fleming/dt-bindings-abx80x-Add-autocal-filter-property/20200613-063944
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
> config: i386-randconfig-m021-20200612 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> smatch warnings:
> drivers/rtc/rtc-abx80x.c:821 abx80x_probe() error: uninitialized symbol 'trickle_cfg'.
>
> # https://github.com/0day-ci/linux/commit/bbd3b3445f48810231c5f004a975116f19b37331
> git remote add linux-review https://github.com/0day-ci/linux
> git remote update linux-review
> git checkout bbd3b3445f48810231c5f004a975116f19b37331
> vim +/trickle_cfg +821 drivers/rtc/rtc-abx80x.c
>
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  700  static int abx80x_probe(struct i2c_client *client,
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  701                       const struct i2c_device_id *id)
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  702  {
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  703       struct device_node *np = client->dev.of_node;
> af69f9a7878413 Jeremy Gebben      2018-09-11  704       struct abx80x_priv *priv;
> bbd3b3445f4881 Kevin P. Fleming   2020-06-12  705       int i, data, err, trickle_cfg, filter_cfg = -EINVAL;
>                                                                           ^^^^^^^^^^^
>
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  706       char buf[7];
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  707       unsigned int part = id->driver_data;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  708       unsigned int partnumber;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  709       unsigned int majrev, minrev;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  710       unsigned int lot;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  711       unsigned int wafer;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  712       unsigned int uid;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  713
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  714       if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  715               return -ENODEV;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  716
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  717       err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_ID0,
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  718                                           sizeof(buf), buf);
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  719       if (err < 0) {
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  720               dev_err(&client->dev, "Unable to read partnumber\n");
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  721               return -EIO;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  722       }
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  723
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  724       partnumber = (buf[0] << 8) | buf[1];
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  725       majrev = buf[2] >> 3;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  726       minrev = buf[2] & 0x7;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  727       lot = ((buf[4] & 0x80) << 2) | ((buf[6] & 0x80) << 1) | buf[3];
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  728       uid = ((buf[4] & 0x7f) << 8) | buf[5];
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  729       wafer = (buf[6] & 0x7c) >> 2;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  730       dev_info(&client->dev, "model %04x, revision %u.%u, lot %x, wafer %x, uid %x\n",
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  731                partnumber, majrev, minrev, lot, wafer, uid);
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  732
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  733       data = i2c_smbus_read_byte_data(client, ABX8XX_REG_CTRL1);
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  734       if (data < 0) {
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  735               dev_err(&client->dev, "Unable to read control register\n");
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  736               return -EIO;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  737       }
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  738
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  739       err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CTRL1,
> 718a820a303ca6 Alexandre Belloni  2015-12-17  740                                       ((data & ~(ABX8XX_CTRL_12_24 |
> 718a820a303ca6 Alexandre Belloni  2015-12-17  741                                                  ABX8XX_CTRL_ARST)) |
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  742                                        ABX8XX_CTRL_WRITE));
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  743       if (err < 0) {
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  744               dev_err(&client->dev, "Unable to write control register\n");
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  745               return -EIO;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  746       }
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  747
> 75455e258ea2b3 Marek Vasut        2019-01-29  748       /* Configure RV1805 specifics */
> 75455e258ea2b3 Marek Vasut        2019-01-29  749       if (part == RV1805) {
> 75455e258ea2b3 Marek Vasut        2019-01-29  750               /*
> 75455e258ea2b3 Marek Vasut        2019-01-29  751                * Avoid accidentally entering test mode. This can happen
> 75455e258ea2b3 Marek Vasut        2019-01-29  752                * on the RV1805 in case the reserved bit 5 in control2
> 75455e258ea2b3 Marek Vasut        2019-01-29  753                * register is set. RV-1805-C3 datasheet indicates that
> 75455e258ea2b3 Marek Vasut        2019-01-29  754                * the bit should be cleared in section 11h - Control2.
> 75455e258ea2b3 Marek Vasut        2019-01-29  755                */
> 75455e258ea2b3 Marek Vasut        2019-01-29  756               data = i2c_smbus_read_byte_data(client, ABX8XX_REG_CTRL2);
> 75455e258ea2b3 Marek Vasut        2019-01-29  757               if (data < 0) {
> 75455e258ea2b3 Marek Vasut        2019-01-29  758                       dev_err(&client->dev,
> 75455e258ea2b3 Marek Vasut        2019-01-29  759                               "Unable to read control2 register\n");
> 75455e258ea2b3 Marek Vasut        2019-01-29  760                       return -EIO;
> 75455e258ea2b3 Marek Vasut        2019-01-29  761               }
> 75455e258ea2b3 Marek Vasut        2019-01-29  762
> 75455e258ea2b3 Marek Vasut        2019-01-29  763               err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CTRL2,
> 75455e258ea2b3 Marek Vasut        2019-01-29  764                                               data & ~ABX8XX_CTRL2_RSVD);
> 75455e258ea2b3 Marek Vasut        2019-01-29  765               if (err < 0) {
> 75455e258ea2b3 Marek Vasut        2019-01-29  766                       dev_err(&client->dev,
> 75455e258ea2b3 Marek Vasut        2019-01-29  767                               "Unable to write control2 register\n");
> 75455e258ea2b3 Marek Vasut        2019-01-29  768                       return -EIO;
> 75455e258ea2b3 Marek Vasut        2019-01-29  769               }
> 75455e258ea2b3 Marek Vasut        2019-01-29  770
> 75455e258ea2b3 Marek Vasut        2019-01-29  771               /*
> 75455e258ea2b3 Marek Vasut        2019-01-29  772                * Avoid extra power leakage. The RV1805 uses smaller
> 75455e258ea2b3 Marek Vasut        2019-01-29  773                * 10pin package and the EXTI input is not present.
> 75455e258ea2b3 Marek Vasut        2019-01-29  774                * Disable it to avoid leakage.
> 75455e258ea2b3 Marek Vasut        2019-01-29  775                */
> 75455e258ea2b3 Marek Vasut        2019-01-29  776               data = i2c_smbus_read_byte_data(client, ABX8XX_REG_OUT_CTRL);
> 75455e258ea2b3 Marek Vasut        2019-01-29  777               if (data < 0) {
> 75455e258ea2b3 Marek Vasut        2019-01-29  778                       dev_err(&client->dev,
> 75455e258ea2b3 Marek Vasut        2019-01-29  779                               "Unable to read output control register\n");
> 75455e258ea2b3 Marek Vasut        2019-01-29  780                       return -EIO;
> 75455e258ea2b3 Marek Vasut        2019-01-29  781               }
> 75455e258ea2b3 Marek Vasut        2019-01-29  782
> 75455e258ea2b3 Marek Vasut        2019-01-29  783               /*
> 75455e258ea2b3 Marek Vasut        2019-01-29  784                * Write the configuration key register to enable access to
> 75455e258ea2b3 Marek Vasut        2019-01-29  785                * the config2 register
> 75455e258ea2b3 Marek Vasut        2019-01-29  786                */
> fee83bca1a1fde Kevin P. Fleming   2020-06-12  787               if (abx80x_write_config_key(client, ABX8XX_CFG_KEY_MISC) < 0)
> 75455e258ea2b3 Marek Vasut        2019-01-29  788                       return -EIO;
> 75455e258ea2b3 Marek Vasut        2019-01-29  789
> 75455e258ea2b3 Marek Vasut        2019-01-29  790               err = i2c_smbus_write_byte_data(client, ABX8XX_REG_OUT_CTRL,
> 75455e258ea2b3 Marek Vasut        2019-01-29  791                                               data | ABX8XX_OUT_CTRL_EXDS);
> 75455e258ea2b3 Marek Vasut        2019-01-29  792               if (err < 0) {
> 75455e258ea2b3 Marek Vasut        2019-01-29  793                       dev_err(&client->dev,
> 75455e258ea2b3 Marek Vasut        2019-01-29  794                               "Unable to write output control register\n");
> 75455e258ea2b3 Marek Vasut        2019-01-29  795                       return -EIO;
> 75455e258ea2b3 Marek Vasut        2019-01-29  796               }
> 75455e258ea2b3 Marek Vasut        2019-01-29  797       }
> 75455e258ea2b3 Marek Vasut        2019-01-29  798
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  799       /* part autodetection */
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  800       if (part == ABX80X) {
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  801               for (i = 0; abx80x_caps[i].pn; i++)
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  802                       if (partnumber == abx80x_caps[i].pn)
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  803                               break;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  804               if (abx80x_caps[i].pn == 0) {
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  805                       dev_err(&client->dev, "Unknown part: %04x\n",
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  806                               partnumber);
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  807                       return -EINVAL;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  808               }
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  809               part = i;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  810       }
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  811
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  812       if (partnumber != abx80x_caps[part].pn) {
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  813               dev_err(&client->dev, "partnumber mismatch %04x != %04x\n",
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  814                       partnumber, abx80x_caps[part].pn);
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  815               return -EINVAL;
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  816       }
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  817
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  818       if (np && abx80x_caps[part].has_tc)
> 6e429f6b8c6b8f Kevin P. Fleming   2020-05-30  819               trickle_cfg = abx80x_dt_trickle_cfg(client);
>                                                                 ^^^^^^^^^^^^^
> Not initialized on else path.
>
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  820
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05 @821       if (trickle_cfg > 0) {
>                                                             ^^^^^^^^^^^
>
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  822               dev_info(&client->dev, "Enabling trickle charger: %02x\n",
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  823                        trickle_cfg);
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  824               abx80x_enable_trickle_charger(client, trickle_cfg);
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  825       }
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  826
> 718a820a303ca6 Alexandre Belloni  2015-12-17  827       err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CD_TIMER_CTL,
> 718a820a303ca6 Alexandre Belloni  2015-12-17  828                                       BIT(2));
> 718a820a303ca6 Alexandre Belloni  2015-12-17  829       if (err)
> 718a820a303ca6 Alexandre Belloni  2015-12-17  830               return err;
> 718a820a303ca6 Alexandre Belloni  2015-12-17  831
> af69f9a7878413 Jeremy Gebben      2018-09-11  832       priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
> af69f9a7878413 Jeremy Gebben      2018-09-11  833       if (priv == NULL)
> af69f9a7878413 Jeremy Gebben      2018-09-11  834               return -ENOMEM;
> af69f9a7878413 Jeremy Gebben      2018-09-11  835
> af69f9a7878413 Jeremy Gebben      2018-09-11  836       priv->rtc = devm_rtc_allocate_device(&client->dev);
> af69f9a7878413 Jeremy Gebben      2018-09-11  837       if (IS_ERR(priv->rtc))
> af69f9a7878413 Jeremy Gebben      2018-09-11  838               return PTR_ERR(priv->rtc);
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  839
> af69f9a7878413 Jeremy Gebben      2018-09-11  840       priv->rtc->ops = &abx80x_rtc_ops;
> af69f9a7878413 Jeremy Gebben      2018-09-11  841       priv->client = client;
> 9360a6a81862d3 Alexandre Belloni  2017-10-13  842
> af69f9a7878413 Jeremy Gebben      2018-09-11  843       i2c_set_clientdata(client, priv);
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  844
> 749e36d0a0d725 Jeremy Gebben      2018-09-11  845       if (abx80x_caps[part].has_wdog) {
> 749e36d0a0d725 Jeremy Gebben      2018-09-11  846               err = abx80x_setup_watchdog(priv);
> 749e36d0a0d725 Jeremy Gebben      2018-09-11  847               if (err)
> 749e36d0a0d725 Jeremy Gebben      2018-09-11  848                       return err;
> 749e36d0a0d725 Jeremy Gebben      2018-09-11  849       }
> 749e36d0a0d725 Jeremy Gebben      2018-09-11  850
> bbd3b3445f4881 Kevin P. Fleming   2020-06-12  851       if (of_property_read_u32(np, "abracon,autocal_filter", &filter_cfg) == 0) {
> bbd3b3445f4881 Kevin P. Fleming   2020-06-12  852               err = abx80x_set_autocal_filter(client,
> bbd3b3445f4881 Kevin P. Fleming   2020-06-12  853                                               filter_cfg ?
> bbd3b3445f4881 Kevin P. Fleming   2020-06-12  854                                               ABX8XX_AUTOCAL_FILTER_ENABLE :
> bbd3b3445f4881 Kevin P. Fleming   2020-06-12  855                                               ABX8XX_AUTOCAL_FILTER_DISABLE);
> bbd3b3445f4881 Kevin P. Fleming   2020-06-12  856               if (err)
> bbd3b3445f4881 Kevin P. Fleming   2020-06-12  857                       return err;
> bbd3b3445f4881 Kevin P. Fleming   2020-06-12  858       }
> bbd3b3445f4881 Kevin P. Fleming   2020-06-12  859
> 718a820a303ca6 Alexandre Belloni  2015-12-17  860       if (client->irq > 0) {
> 718a820a303ca6 Alexandre Belloni  2015-12-17  861               dev_info(&client->dev, "IRQ %d supplied\n", client->irq);
> 718a820a303ca6 Alexandre Belloni  2015-12-17  862               err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
> 718a820a303ca6 Alexandre Belloni  2015-12-17  863                                               abx80x_handle_irq,
> 718a820a303ca6 Alexandre Belloni  2015-12-17  864                                               IRQF_SHARED | IRQF_ONESHOT,
> 718a820a303ca6 Alexandre Belloni  2015-12-17  865                                               "abx8xx",
> 718a820a303ca6 Alexandre Belloni  2015-12-17  866                                               client);
> 718a820a303ca6 Alexandre Belloni  2015-12-17  867               if (err) {
> 718a820a303ca6 Alexandre Belloni  2015-12-17  868                       dev_err(&client->dev, "unable to request IRQ, alarms disabled\n");
> 718a820a303ca6 Alexandre Belloni  2015-12-17  869                       client->irq = 0;
> 718a820a303ca6 Alexandre Belloni  2015-12-17  870               }
> 718a820a303ca6 Alexandre Belloni  2015-12-17  871       }
> 718a820a303ca6 Alexandre Belloni  2015-12-17  872
> 559e883e0f7768 Alexandre Belloni  2019-03-06  873       err = rtc_add_group(priv->rtc, &rtc_calib_attr_group);
> 59a8383adb7545 Mylène Josserand   2016-03-21  874       if (err) {
> 59a8383adb7545 Mylène Josserand   2016-03-21  875               dev_err(&client->dev, "Failed to create sysfs group: %d\n",
> 59a8383adb7545 Mylène Josserand   2016-03-21  876                       err);
> 59a8383adb7545 Mylène Josserand   2016-03-21  877               return err;
> 59a8383adb7545 Mylène Josserand   2016-03-21  878       }
> 59a8383adb7545 Mylène Josserand   2016-03-21  879
> 559e883e0f7768 Alexandre Belloni  2019-03-06  880       return rtc_register_device(priv->rtc);
> 4d61ff6b9960cb Philippe De Muyter 2015-05-05  881  }
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

end of thread, other threads:[~2020-06-15 10:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12 22:35 [PATCH 1/3 v2] dt-bindings: abx80x: Add autocal-filter property Kevin P. Fleming
2020-06-12 22:35 ` [PATCH 2/3] rtc: abx80x: Add utility function for writing configuration key Kevin P. Fleming
2020-06-12 22:35 ` [PATCH 3/3 v2] rtc: abx80x: Add support for autocalibration filter capacitor Kevin P. Fleming
2020-06-15  9:47   ` Dan Carpenter
2020-06-15 10:18     ` Kevin P. Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).