linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/14] power: supply: bq25890: fix and extend
@ 2020-04-02 14:58 Michał Mirosław
  2020-04-02 14:58 ` [PATCH 02/14] power: supply: bq25890: simplify chip name property getter Michał Mirosław
                   ` (13 more replies)
  0 siblings, 14 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

This series consists of a set of fixes and enchancements to bq25890
driver. This is tested on a board using bq25896 as battery controller.

Patches 1-6 are fixes and cleanups, patches 7-14 update and extend
property support.

Series depends on core extensions from earlier series [1].

[1] https://lore.kernel.org/linux-pm/cover.1585837575.git.mirq-linux@rere.qmqm.pl/

Michał Mirosław (14):
  power: supply: bq25890: remove redundant I2C bus check
  power: supply: bq25890: simplify chip name property getter
  power: supply: bq25890: make property table const
  power: supply: bq25890: protect view of the chip's state
  power: supply: bq25890: fix ADC mode configuration
  power: supply: bq25890: update state on property read
  power: supply: bq25890: implement CHARGE_TYPE property
  power: supply: bq25890: implement PRECHARGE_CURRENT property
  power: supply: bq25890: implement INPUT_CURRENT_LIMIT property
  power: supply: bq25890: use proper CURRENT_NOW property for I_BAT
  power: supply: bq25890: show measured VBUS
  power: supply: bq25890: show VSYS as output voltage
  power: supply: bq25890: show VBAT as VOLTAGE_NOW
  power: supply: bq25890: support IBAT compensation

 drivers/power/supply/bq25890_charger.c | 261 +++++++++++++++----------
 1 file changed, 154 insertions(+), 107 deletions(-)

-- 
2.20.1


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

* [PATCH 01/14] power: supply: bq25890: remove redundant I2C bus check
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
  2020-04-02 14:58 ` [PATCH 02/14] power: supply: bq25890: simplify chip name property getter Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-02 14:58 ` [PATCH 03/14] power: supply: bq25890: make property table const Michał Mirosław
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-pm, linux-kernel

regmap initialization will check I2C adapter functionality.
Remove redundant check in the driver.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index aebd1253dbc9..c642519ef7b2 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -881,17 +881,11 @@ static int bq25890_fw_probe(struct bq25890_device *bq)
 static int bq25890_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	struct bq25890_device *bq;
 	int ret;
 	int i;
 
-	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
-		dev_err(dev, "No support for SMBUS_BYTE_DATA\n");
-		return -ENODEV;
-	}
-
 	bq = devm_kzalloc(dev, sizeof(*bq), GFP_KERNEL);
 	if (!bq)
 		return -ENOMEM;
-- 
2.20.1


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

* [PATCH 02/14] power: supply: bq25890: simplify chip name property getter
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-02 14:58 ` [PATCH 01/14] power: supply: bq25890: remove redundant I2C bus check Michał Mirosław
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

Driver rejects unknown chips early in the probe(), so when
bq25890_power_supply_get_property() is made reachable, bq->chip_version
will already be set to correct value - there is no need to check
it again.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index c642519ef7b2..f9f29edadddc 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -32,6 +32,13 @@ enum bq25890_chip_version {
 	BQ25896,
 };
 
+static const char *const bq25890_chip_name[] = {
+	"BQ25890",
+	"BQ25892",
+	"BQ25895",
+	"BQ25896",
+};
+
 enum bq25890_fields {
 	F_EN_HIZ, F_EN_ILIM, F_IILIM,				     /* Reg00 */
 	F_BHOT, F_BCOLD, F_VINDPM_OFS,				     /* Reg01 */
@@ -400,17 +407,7 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 		break;
 
 	case POWER_SUPPLY_PROP_MODEL_NAME:
-		if (bq->chip_version == BQ25890)
-			val->strval = "BQ25890";
-		else if (bq->chip_version == BQ25892)
-			val->strval = "BQ25892";
-		else if (bq->chip_version == BQ25895)
-			val->strval = "BQ25895";
-		else if (bq->chip_version == BQ25896)
-			val->strval = "BQ25896";
-		else
-			val->strval = "UNKNOWN";
-
+		val->strval = bq25890_chip_name[bq->chip_version];
 		break;
 
 	case POWER_SUPPLY_PROP_ONLINE:
-- 
2.20.1


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

* [PATCH 03/14] power: supply: bq25890: make property table const
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
  2020-04-02 14:58 ` [PATCH 02/14] power: supply: bq25890: simplify chip name property getter Michał Mirosław
  2020-04-02 14:58 ` [PATCH 01/14] power: supply: bq25890: remove redundant I2C bus check Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-03 19:52   ` kbuild test robot
  2020-04-04  3:41   ` kbuild test robot
  2020-04-02 14:58 ` [PATCH 04/14] power: supply: bq25890: protect view of the chip's state Michał Mirosław
                   ` (10 subsequent siblings)
  13 siblings, 2 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

Property list should not change, so mark it const.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index f9f29edadddc..c4a69fd69f34 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -668,7 +668,7 @@ static int bq25890_hw_init(struct bq25890_device *bq)
 	return 0;
 }
 
-static enum power_supply_property bq25890_power_supply_props[] = {
+static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 	POWER_SUPPLY_PROP_MODEL_NAME,
 	POWER_SUPPLY_PROP_STATUS,
-- 
2.20.1


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

* [PATCH 05/14] power: supply: bq25890: fix ADC mode configuration
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
                   ` (3 preceding siblings ...)
  2020-04-02 14:58 ` [PATCH 04/14] power: supply: bq25890: protect view of the chip's state Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-03 20:29   ` kbuild test robot
                     ` (2 more replies)
  2020-04-02 14:58 ` [PATCH 06/14] power: supply: bq25890: update state on property read Michał Mirosław
                   ` (8 subsequent siblings)
  13 siblings, 3 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

Datasheet describes two modes for reading ADC measurements:
1. continuous, 1 Hz - enabled and started by CONV_RATE bit
2. one-shot - triggered by CONV_START bit

In continuous mode, CONV_START is read-only and signifies an ongoing
conversion.

Change the code to follow the datasheet and really disable continuous
mode for power saving.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 33 ++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 9339e216651f..3b02fa80aedd 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -126,6 +126,7 @@ static const struct regmap_access_table bq25890_writeable_regs = {
 
 static const struct regmap_range bq25890_volatile_reg_ranges[] = {
 	regmap_reg_range(0x00, 0x00),
+	regmap_reg_range(0x02, 0x02),
 	regmap_reg_range(0x09, 0x09),
 	regmap_reg_range(0x0b, 0x14),
 };
@@ -374,18 +375,40 @@ enum bq25890_chrg_fault {
 	CHRG_FAULT_TIMER_EXPIRED,
 };
 
+static bool bq25890_is_adc_property(enum power_supply_property psp)
+{
+	switch (psp) {
+	case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
+	case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
+	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+	case POWER_SUPPLY_PROP_CURRENT_NOW:
+		return true;
+
+	default:
+		return false;
+	}
+}
+
 static int bq25890_power_supply_get_property(struct power_supply *psy,
 					     enum power_supply_property psp,
 					     union power_supply_propval *val)
 {
-	int ret;
 	struct bq25890_device *bq = power_supply_get_drvdata(psy);
 	struct bq25890_state state;
+	bool do_adc_conv;
+	int ret;
 
 	mutex_lock(&bq->lock);
 	state = bq->state;
+	do_adc_conv = !state.online && bq25890_is_adc_property(psp);
+	if (do_adc_conv)
+		bq25890_field_write(bq, F_CONV_START, 1);
 	mutex_unlock(&bq->lock);
 
+	if (do_adc_conv)
+		regmap_field_read_poll_timeout(bq->rmap_fields[F_CONV_START],
+			ret, !ret, 25000, 1000000);
+
 	switch (psp) {
 	case POWER_SUPPLY_PROP_STATUS:
 		if (!state.online)
@@ -623,8 +646,8 @@ static int bq25890_hw_init(struct bq25890_device *bq)
 		}
 	}
 
-	/* Configure ADC for continuous conversions. This does not enable it. */
-	ret = bq25890_field_write(bq, F_CONV_RATE, 1);
+	/* Configure ADC for continuous conversions when charging */
+	ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online);
 	if (ret < 0) {
 		dev_dbg(bq->dev, "Config ADC failed %d\n", ret);
 		return ret;
@@ -966,7 +989,7 @@ static int bq25890_suspend(struct device *dev)
 	 * If charger is removed, while in suspend, make sure ADC is diabled
 	 * since it consumes slightly more power.
 	 */
-	return bq25890_field_write(bq, F_CONV_START, 0);
+	return bq25890_field_write(bq, F_CONV_RATE, 0);
 }
 
 static int bq25890_resume(struct device *dev)
@@ -982,7 +1005,7 @@ static int bq25890_resume(struct device *dev)
 
 	/* Re-enable ADC only if charger is plugged in. */
 	if (bq->state.online) {
-		ret = bq25890_field_write(bq, F_CONV_START, 1);
+		ret = bq25890_field_write(bq, F_CONV_RATE, 1);
 		if (ret < 0)
 			return ret;
 	}
-- 
2.20.1


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

* [PATCH 04/14] power: supply: bq25890: protect view of the chip's state
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
                   ` (2 preceding siblings ...)
  2020-04-02 14:58 ` [PATCH 03/14] power: supply: bq25890: make property table const Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-02 14:58 ` [PATCH 05/14] power: supply: bq25890: fix ADC mode configuration Michał Mirosław
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

Extend bq->lock over whole updating of the chip's state. Might get
useful later for switching ADC modes correctly.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 82 ++++++++------------------
 1 file changed, 26 insertions(+), 56 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index c4a69fd69f34..9339e216651f 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -510,74 +510,50 @@ static int bq25890_get_chip_state(struct bq25890_device *bq,
 	return 0;
 }
 
-static bool bq25890_state_changed(struct bq25890_device *bq,
-				  struct bq25890_state *new_state)
-{
-	struct bq25890_state old_state;
-
-	mutex_lock(&bq->lock);
-	old_state = bq->state;
-	mutex_unlock(&bq->lock);
-
-	return (old_state.chrg_status != new_state->chrg_status ||
-		old_state.chrg_fault != new_state->chrg_fault	||
-		old_state.online != new_state->online		||
-		old_state.bat_fault != new_state->bat_fault	||
-		old_state.boost_fault != new_state->boost_fault ||
-		old_state.vsys_status != new_state->vsys_status);
-}
-
-static void bq25890_handle_state_change(struct bq25890_device *bq,
-					struct bq25890_state *new_state)
+static irqreturn_t __bq25890_handle_irq(struct bq25890_device *bq)
 {
+	struct bq25890_state new_state;
 	int ret;
-	struct bq25890_state old_state;
 
-	mutex_lock(&bq->lock);
-	old_state = bq->state;
-	mutex_unlock(&bq->lock);
+	ret = bq25890_get_chip_state(bq, &new_state);
+	if (ret < 0)
+		return IRQ_NONE;
 
-	if (!new_state->online) {			     /* power removed */
+	if (!memcmp(&bq->state, &new_state, sizeof(new_state)))
+		return IRQ_NONE;
+
+	if (!new_state.online && bq->state.online) {	    /* power removed */
 		/* disable ADC */
 		ret = bq25890_field_write(bq, F_CONV_START, 0);
 		if (ret < 0)
 			goto error;
-	} else if (!old_state.online) {			    /* power inserted */
+	} else if (new_state.online && !bq->state.online) { /* power inserted */
 		/* enable ADC, to have control of charge current/voltage */
 		ret = bq25890_field_write(bq, F_CONV_START, 1);
 		if (ret < 0)
 			goto error;
 	}
 
-	return;
+	bq->state = new_state;
+	power_supply_changed(bq->charger);
 
+	return IRQ_HANDLED;
 error:
-	dev_err(bq->dev, "Error communicating with the chip.\n");
+	dev_err(bq->dev, "Error communicating with the chip: %pe\n",
+		ERR_PTR(ret));
+	return IRQ_HANDLED;
 }
 
 static irqreturn_t bq25890_irq_handler_thread(int irq, void *private)
 {
 	struct bq25890_device *bq = private;
-	int ret;
-	struct bq25890_state state;
-
-	ret = bq25890_get_chip_state(bq, &state);
-	if (ret < 0)
-		goto handled;
-
-	if (!bq25890_state_changed(bq, &state))
-		goto handled;
-
-	bq25890_handle_state_change(bq, &state);
+	irqreturn_t ret;
 
 	mutex_lock(&bq->lock);
-	bq->state = state;
+	ret = __bq25890_handle_irq(bq);
 	mutex_unlock(&bq->lock);
 
-	power_supply_changed(bq->charger);
-
-handled:
-	return IRQ_HANDLED;
+	return ret;
 }
 
 static int bq25890_chip_reset(struct bq25890_device *bq)
@@ -607,7 +583,6 @@ static int bq25890_hw_init(struct bq25890_device *bq)
 {
 	int ret;
 	int i;
-	struct bq25890_state state;
 
 	const struct {
 		enum bq25890_fields id;
@@ -655,16 +630,12 @@ static int bq25890_hw_init(struct bq25890_device *bq)
 		return ret;
 	}
 
-	ret = bq25890_get_chip_state(bq, &state);
+	ret = bq25890_get_chip_state(bq, &bq->state);
 	if (ret < 0) {
 		dev_dbg(bq->dev, "Get state failed %d\n", ret);
 		return ret;
 	}
 
-	mutex_lock(&bq->lock);
-	bq->state = state;
-	mutex_unlock(&bq->lock);
-
 	return 0;
 }
 
@@ -1001,19 +972,16 @@ static int bq25890_suspend(struct device *dev)
 static int bq25890_resume(struct device *dev)
 {
 	int ret;
-	struct bq25890_state state;
 	struct bq25890_device *bq = dev_get_drvdata(dev);
 
-	ret = bq25890_get_chip_state(bq, &state);
+	mutex_lock(&bq->lock);
+
+	ret = bq25890_get_chip_state(bq, &bq->state);
 	if (ret < 0)
 		return ret;
 
-	mutex_lock(&bq->lock);
-	bq->state = state;
-	mutex_unlock(&bq->lock);
-
 	/* Re-enable ADC only if charger is plugged in. */
-	if (state.online) {
+	if (bq->state.online) {
 		ret = bq25890_field_write(bq, F_CONV_START, 1);
 		if (ret < 0)
 			return ret;
@@ -1022,6 +990,8 @@ static int bq25890_resume(struct device *dev)
 	/* signal userspace, maybe state changed while suspended */
 	power_supply_changed(bq->charger);
 
+	mutex_unlock(&bq->lock);
+
 	return 0;
 }
 #endif
-- 
2.20.1


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

* [PATCH 07/14] power: supply: bq25890: implement CHARGE_TYPE property
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
                   ` (5 preceding siblings ...)
  2020-04-02 14:58 ` [PATCH 06/14] power: supply: bq25890: update state on property read Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-02 14:58 ` [PATCH 09/14] power: supply: bq25890: implement INPUT_CURRENT_LIMIT property Michał Mirosław
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

Report charging type based on recently read state.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index e4368d01396a..ad0901fdceb6 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -429,6 +429,18 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 
 		break;
 
+	case POWER_SUPPLY_PROP_CHARGE_TYPE:
+		if (!state.online || state.chrg_status == STATUS_NOT_CHARGING ||
+		    state.chrg_status == STATUS_TERMINATION_DONE)
+			val->intval = POWER_SUPPLY_CHARGE_TYPE_NONE;
+		else if (state.chrg_status == STATUS_PRE_CHARGING)
+			val->intval = POWER_SUPPLY_CHARGE_TYPE_STANDARD;
+		else if (state.chrg_status == STATUS_FAST_CHARGING)
+			val->intval = POWER_SUPPLY_CHARGE_TYPE_FAST;
+		else /* unreachable */
+			val->intval = POWER_SUPPLY_CHARGE_TYPE_UNKNOWN;
+		break;
+
 	case POWER_SUPPLY_PROP_MANUFACTURER:
 		val->strval = BQ25890_MANUFACTURER;
 		break;
@@ -670,6 +682,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 	POWER_SUPPLY_PROP_MODEL_NAME,
 	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_CHARGE_TYPE,
 	POWER_SUPPLY_PROP_ONLINE,
 	POWER_SUPPLY_PROP_HEALTH,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
-- 
2.20.1


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

* [PATCH 06/14] power: supply: bq25890: update state on property read
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
                   ` (4 preceding siblings ...)
  2020-04-02 14:58 ` [PATCH 05/14] power: supply: bq25890: fix ADC mode configuration Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-02 14:58 ` [PATCH 07/14] power: supply: bq25890: implement CHARGE_TYPE property Michał Mirosław
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

Edge interrupts from the charger may be lost or stuck in fault mode
since probe(). Check if something changed everytime userspace wants
some data.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 3b02fa80aedd..e4368d01396a 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -389,6 +389,8 @@ static bool bq25890_is_adc_property(enum power_supply_property psp)
 	}
 }
 
+static irqreturn_t __bq25890_handle_irq(struct bq25890_device *bq);
+
 static int bq25890_power_supply_get_property(struct power_supply *psy,
 					     enum power_supply_property psp,
 					     union power_supply_propval *val)
@@ -399,6 +401,8 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 	int ret;
 
 	mutex_lock(&bq->lock);
+	/* update state in case we lost an interrupt */
+	__bq25890_handle_irq(bq);
 	state = bq->state;
 	do_adc_conv = !state.online && bq25890_is_adc_property(psp);
 	if (do_adc_conv)
-- 
2.20.1


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

* [PATCH 08/14] power: supply: bq25890: implement PRECHARGE_CURRENT property
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
                   ` (7 preceding siblings ...)
  2020-04-02 14:58 ` [PATCH 09/14] power: supply: bq25890: implement INPUT_CURRENT_LIMIT property Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-02 14:58 ` [PATCH 11/14] power: supply: bq25890: show measured VBUS Michał Mirosław
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

Report configured precharge current.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index ad0901fdceb6..b48685009048 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -497,6 +497,10 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 		val->intval = bq25890_find_val(bq->init_data.vreg, TBL_VREG);
 		break;
 
+	case POWER_SUPPLY_PROP_PRECHARGE_CURRENT:
+		val->intval = bq25890_find_val(bq->init_data.iprechg, TBL_ITERM);
+		break;
+
 	case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:
 		val->intval = bq25890_find_val(bq->init_data.iterm, TBL_ITERM);
 		break;
@@ -689,6 +693,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
+	POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
 	POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
 };
-- 
2.20.1


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

* [PATCH 09/14] power: supply: bq25890: implement INPUT_CURRENT_LIMIT property
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
                   ` (6 preceding siblings ...)
  2020-04-02 14:58 ` [PATCH 07/14] power: supply: bq25890: implement CHARGE_TYPE property Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-02 14:58 ` [PATCH 08/14] power: supply: bq25890: implement PRECHARGE_CURRENT property Michał Mirosław
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

Report REG00.IINLIM value as INPUT_CURRENT_LIMIT property.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index b48685009048..87c5832e23d3 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -254,6 +254,7 @@ enum bq25890_table_ids {
 	/* range tables */
 	TBL_ICHG,
 	TBL_ITERM,
+	TBL_IILIM,
 	TBL_VREG,
 	TBL_BOOSTV,
 	TBL_SYSVMIN,
@@ -294,6 +295,7 @@ static const union {
 	/* TODO: BQ25896 has max ICHG 3008 mA */
 	[TBL_ICHG] =	{ .rt = {0,	  5056000, 64000} },	 /* uA */
 	[TBL_ITERM] =	{ .rt = {64000,   1024000, 64000} },	 /* uA */
+	[TBL_IILIM] =   { .rt = {50000,   3200000, 50000} },	 /* uA */
 	[TBL_VREG] =	{ .rt = {3840000, 4608000, 16000} },	 /* uV */
 	[TBL_BOOSTV] =	{ .rt = {4550000, 5510000, 64000} },	 /* uV */
 	[TBL_SYSVMIN] = { .rt = {3000000, 3700000, 100000} },	 /* uV */
@@ -505,6 +507,14 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 		val->intval = bq25890_find_val(bq->init_data.iterm, TBL_ITERM);
 		break;
 
+	case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
+		ret = bq25890_field_read(bq, F_IILIM);
+		if (ret < 0)
+			return ret;
+
+		val->intval = bq25890_find_val(ret, TBL_IILIM);
+		break;
+
 	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
 		ret = bq25890_field_read(bq, F_SYSV); /* read measured value */
 		if (ret < 0)
@@ -695,6 +705,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
 	POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
 	POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
+	POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
 };
 
-- 
2.20.1


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

* [PATCH 11/14] power: supply: bq25890: show measured VBUS
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
                   ` (8 preceding siblings ...)
  2020-04-02 14:58 ` [PATCH 08/14] power: supply: bq25890: implement PRECHARGE_CURRENT property Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-03 21:06   ` kbuild test robot
  2020-04-03 23:04   ` kbuild test robot
  2020-04-02 14:58 ` [PATCH 10/14] power: supply: bq25890: use proper CURRENT_NOW property for I_BAT Michał Mirosław
                   ` (3 subsequent siblings)
  13 siblings, 2 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

Export VBUS measurement via INPUT_VOLTAGE_NOW property.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 250468f3ff18..d23274d13263 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -506,6 +506,24 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 		val->intval = bq25890_find_val(ret, TBL_IILIM);
 		break;
 
+	case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
+		ret = bq25890_field_read(bq, F_VBUS_GD); /* is VBUS connected? */
+		if (ret < 0)
+			return ret;
+
+		if (!ret) {
+			val->intval = 0;
+			break;
+		}
+
+		ret = bq25890_field_read(bq, F_VBUSV); /* read measured value */
+		if (ret < 0)
+			return ret;
+
+		/* converted_val = 2.6V + ADC_val * 100mV */
+		val->intval = 2600000 + ret * 100000;
+		break;
+
 	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
 		ret = bq25890_field_read(bq, F_SYSV); /* read measured value */
 		if (ret < 0)
@@ -705,6 +723,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
 	POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
 	POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
+	POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
 	POWER_SUPPLY_PROP_CURRENT_NOW,
 };
-- 
2.20.1


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

* [PATCH 10/14] power: supply: bq25890: use proper CURRENT_NOW property for I_BAT
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
                   ` (9 preceding siblings ...)
  2020-04-02 14:58 ` [PATCH 11/14] power: supply: bq25890: show measured VBUS Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-02 14:58 ` [PATCH 12/14] power: supply: bq25890: show VSYS as output voltage Michał Mirosław
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

Charge Current is more apropriately reflected by CURRENT_NOW property
(measured current) than CONSTANT_CURRENT_VOLTAGE (configured CC-phase
current limit). Fix the reference and make the sign reflect direction
of the current.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 87c5832e23d3..250468f3ff18 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -468,15 +468,6 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 			val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
 		break;
 
-	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
-		ret = bq25890_field_read(bq, F_ICHGR); /* read measured value */
-		if (ret < 0)
-			return ret;
-
-		/* converted_val = ADC_val * 50mA (table 10.3.19) */
-		val->intval = ret * 50000;
-		break;
-
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
 		val->intval = bq25890_find_val(bq->init_data.ichg, TBL_ICHG);
 		break;
@@ -524,6 +515,15 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 		val->intval = 2304000 + ret * 20000;
 		break;
 
+	case POWER_SUPPLY_PROP_CURRENT_NOW:
+		ret = bq25890_field_read(bq, F_ICHGR); /* read measured value */
+		if (ret < 0)
+			return ret;
+
+		/* converted_val = ADC_val * 50mA (table 10.3.19) */
+		val->intval = ret * -50000;
+		break;
+
 	default:
 		return -EINVAL;
 	}
@@ -699,7 +699,6 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_CHARGE_TYPE,
 	POWER_SUPPLY_PROP_ONLINE,
 	POWER_SUPPLY_PROP_HEALTH,
-	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
@@ -707,6 +706,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
 	POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
 };
 
 static char *bq25890_charger_supplied_to[] = {
-- 
2.20.1


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

* [PATCH 12/14] power: supply: bq25890: show VSYS as output voltage
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
                   ` (10 preceding siblings ...)
  2020-04-02 14:58 ` [PATCH 10/14] power: supply: bq25890: use proper CURRENT_NOW property for I_BAT Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-03 21:41   ` kbuild test robot
  2020-04-02 14:58 ` [PATCH 13/14] power: supply: bq25890: show VBAT as VOLTAGE_NOW Michał Mirosław
  2020-04-02 14:58 ` [PATCH 14/14] power: supply: bq25890: support IBAT compensation Michał Mirosław
  13 siblings, 1 reply; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

VSYS is the voltage that is provided to the rest of the system. Show
measurement OUTPUT_VOLTAGE and supplement it with VSYSMIN setting.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index d23274d13263..6c277f2dbae2 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -524,7 +524,7 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 		val->intval = 2600000 + ret * 100000;
 		break;
 
-	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+	case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
 		ret = bq25890_field_read(bq, F_SYSV); /* read measured value */
 		if (ret < 0)
 			return ret;
@@ -533,6 +533,10 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 		val->intval = 2304000 + ret * 20000;
 		break;
 
+	case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_MIN:
+		val->intval = bq25890_find_val(bq->init_data.sysvmin, TBL_SYSVMIN);
+		break;
+
 	case POWER_SUPPLY_PROP_CURRENT_NOW:
 		ret = bq25890_field_read(bq, F_ICHGR); /* read measured value */
 		if (ret < 0)
@@ -724,7 +728,8 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
 	POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
 	POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW,
-	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_MIN,
 	POWER_SUPPLY_PROP_CURRENT_NOW,
 };
 
-- 
2.20.1


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

* [PATCH 14/14] power: supply: bq25890: support IBAT compensation
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
                   ` (12 preceding siblings ...)
  2020-04-02 14:58 ` [PATCH 13/14] power: supply: bq25890: show VBAT as VOLTAGE_NOW Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  13 siblings, 0 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

Add configuration for compensation of IBAT measuring resistor in series
with the battery.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index a61eab6a4552..ba1562968bec 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -83,6 +83,8 @@ struct bq25890_init_data {
 	u8 boostf;	/* boost frequency		*/
 	u8 ilim_en;	/* enable ILIM pin		*/
 	u8 treg;	/* thermal regulation threshold */
+	u8 rbatcomp;	/* IBAT sense resistor value    */
+	u8 vclamp;	/* IBAT compensation voltage limit */
 };
 
 struct bq25890_state {
@@ -258,6 +260,8 @@ enum bq25890_table_ids {
 	TBL_VREG,
 	TBL_BOOSTV,
 	TBL_SYSVMIN,
+	TBL_VBATCOMP,
+	TBL_RBATCOMP,
 
 	/* lookup tables */
 	TBL_TREG,
@@ -299,6 +303,8 @@ static const union {
 	[TBL_VREG] =	{ .rt = {3840000, 4608000, 16000} },	 /* uV */
 	[TBL_BOOSTV] =	{ .rt = {4550000, 5510000, 64000} },	 /* uV */
 	[TBL_SYSVMIN] = { .rt = {3000000, 3700000, 100000} },	 /* uV */
+	[TBL_VBATCOMP] ={ .rt = {0,        224000, 32000} },	 /* uV */
+	[TBL_RBATCOMP] ={ .rt = {0,        140000, 20000} },	 /* uOhm */
 
 	/* lookup tables */
 	[TBL_TREG] =	{ .lt = {bq25890_treg_tbl, BQ25890_TREG_TBL_SIZE} },
@@ -667,7 +673,9 @@ static int bq25890_hw_init(struct bq25890_device *bq)
 		{F_BOOSTI,	 bq->init_data.boosti},
 		{F_BOOSTF,	 bq->init_data.boostf},
 		{F_EN_ILIM,	 bq->init_data.ilim_en},
-		{F_TREG,	 bq->init_data.treg}
+		{F_TREG,	 bq->init_data.treg},
+		{F_BATCMP,	 bq->init_data.rbatcomp},
+		{F_VCLAMP,	 bq->init_data.vclamp},
 	};
 
 	ret = bq25890_chip_reset(bq);
@@ -880,11 +888,14 @@ static int bq25890_fw_read_u32_props(struct bq25890_device *bq)
 		{"ti,boost-max-current", false, TBL_BOOSTI, &init->boosti},
 
 		/* optional properties */
-		{"ti,thermal-regulation-threshold", true, TBL_TREG, &init->treg}
+		{"ti,thermal-regulation-threshold", true, TBL_TREG, &init->treg},
+		{"ti,ibatcomp-resistance", true, TBL_RBATCOMP, &init->rbatcomp},
+		{"ti,ibatcomp-clamp-voltage", true, TBL_VBATCOMP, &init->vclamp},
 	};
 
 	/* initialize data for optional properties */
 	init->treg = 3; /* 120 degrees Celsius */
+	init->rbatcomp = init->vclamp = 0; /* IBAT compensation disabled */
 
 	for (i = 0; i < ARRAY_SIZE(props); i++) {
 		ret = device_property_read_u32(bq->dev, props[i].name,
-- 
2.20.1


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

* [PATCH 13/14] power: supply: bq25890: show VBAT as VOLTAGE_NOW
  2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
                   ` (11 preceding siblings ...)
  2020-04-02 14:58 ` [PATCH 12/14] power: supply: bq25890: show VSYS as output voltage Michał Mirosław
@ 2020-04-02 14:58 ` Michał Mirosław
  2020-04-02 14:58 ` [PATCH 14/14] power: supply: bq25890: support IBAT compensation Michał Mirosław
  13 siblings, 0 replies; 23+ messages in thread
From: Michał Mirosław @ 2020-04-02 14:58 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, linux-pm

CONSTANT_CHARGE_VOLTAGE is a currently programmed CC voltage limit
and not instaneous reading of a VBAT. Move the measurement to correct
property. !online check is removed, as it is useful to read the voltage
when not charging.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/power/supply/bq25890_charger.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 6c277f2dbae2..a61eab6a4552 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -472,20 +472,6 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 		val->intval = bq25890_find_val(bq->init_data.ichg, TBL_ICHG);
 		break;
 
-	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
-		if (!state.online) {
-			val->intval = 0;
-			break;
-		}
-
-		ret = bq25890_field_read(bq, F_BATV); /* read measured value */
-		if (ret < 0)
-			return ret;
-
-		/* converted_val = 2.304V + ADC_val * 20mV (table 10.3.15) */
-		val->intval = 2304000 + ret * 20000;
-		break;
-
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
 		val->intval = bq25890_find_val(bq->init_data.vreg, TBL_VREG);
 		break;
@@ -537,6 +523,15 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 		val->intval = bq25890_find_val(bq->init_data.sysvmin, TBL_SYSVMIN);
 		break;
 
+	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+		ret = bq25890_field_read(bq, F_BATV); /* read measured value */
+		if (ret < 0)
+			return ret;
+
+		/* converted_val = 2.304V + ADC_val * 20mV (table 10.3.15) */
+		val->intval = 2304000 + ret * 20000;
+		break;
+
 	case POWER_SUPPLY_PROP_CURRENT_NOW:
 		ret = bq25890_field_read(bq, F_ICHGR); /* read measured value */
 		if (ret < 0)
@@ -722,7 +717,6 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_ONLINE,
 	POWER_SUPPLY_PROP_HEALTH,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
-	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
 	POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
 	POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
@@ -730,6 +724,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW,
 	POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW,
 	POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_MIN,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
 	POWER_SUPPLY_PROP_CURRENT_NOW,
 };
 
-- 
2.20.1


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

* Re: [PATCH 03/14] power: supply: bq25890: make property table const
  2020-04-02 14:58 ` [PATCH 03/14] power: supply: bq25890: make property table const Michał Mirosław
@ 2020-04-03 19:52   ` kbuild test robot
  2020-04-04  3:41   ` kbuild test robot
  1 sibling, 0 replies; 23+ messages in thread
From: kbuild test robot @ 2020-04-03 19:52 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: kbuild-all, Sebastian Reichel, linux-kernel, linux-pm

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

Hi "Michał,

I love your patch! Perhaps something to improve:

[auto build test WARNING on power-supply/for-next]
[also build test WARNING on linus/master v5.6 next-20200403]
[cannot apply to linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Micha-Miros-aw/power-supply-bq25890-fix-and-extend/20200404-010738
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/power/supply/bq25890_charger.c:692:16: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     692 |  .properties = bq25890_power_supply_props,
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/const +692 drivers/power/supply/bq25890_charger.c

4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  688  
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  689  static const struct power_supply_desc bq25890_power_supply_desc = {
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  690  	.name = "bq25890-charger",
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  691  	.type = POWER_SUPPLY_TYPE_USB,
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19 @692  	.properties = bq25890_power_supply_props,
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  693  	.num_properties = ARRAY_SIZE(bq25890_power_supply_props),
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  694  	.get_property = bq25890_power_supply_get_property,
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  695  };
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  696  

:::::: The code at line 692 was first introduced by commit
:::::: 4aeae9cb0dad117f055add68c48decaf489aecf3 power_supply: Add support for TI BQ25890 charger chip

:::::: TO: Laurentiu Palcu <laurentiu.palcu@intel.com>
:::::: CC: Sebastian Reichel <sre@kernel.org>

---
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: 60612 bytes --]

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

* Re: [PATCH 05/14] power: supply: bq25890: fix ADC mode configuration
  2020-04-02 14:58 ` [PATCH 05/14] power: supply: bq25890: fix ADC mode configuration Michał Mirosław
@ 2020-04-03 20:29   ` kbuild test robot
  2020-04-03 22:14   ` kbuild test robot
  2020-04-04  5:14   ` kbuild test robot
  2 siblings, 0 replies; 23+ messages in thread
From: kbuild test robot @ 2020-04-03 20:29 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: kbuild-all, Sebastian Reichel, linux-kernel, linux-pm

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

Hi "Michał,

I love your patch! Yet something to improve:

[auto build test ERROR on power-supply/for-next]
[also build test ERROR on linus/master v5.6 next-20200403]
[cannot apply to linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Micha-Miros-aw/power-supply-bq25890-fix-and-extend/20200404-010738
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/power/supply/bq25890_charger.c: In function 'bq25890_is_adc_property':
>> drivers/power/supply/bq25890_charger.c:381:7: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     381 |  case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c:381:7: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/power/supply/bq25890_charger.c:382:7: error: 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_VOLTAGE_NOW'?
     382 |  case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_VOLTAGE_NOW
   drivers/power/supply/bq25890_charger.c: At top level:
   drivers/power/supply/bq25890_charger.c:686:16: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     686 |  .properties = bq25890_power_supply_props,
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~

vim +381 drivers/power/supply/bq25890_charger.c

   377	
   378	static bool bq25890_is_adc_property(enum power_supply_property psp)
   379	{
   380		switch (psp) {
 > 381		case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
 > 382		case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
   383		case POWER_SUPPLY_PROP_VOLTAGE_NOW:
   384		case POWER_SUPPLY_PROP_CURRENT_NOW:
   385			return true;
   386	
   387		default:
   388			return false;
   389		}
   390	}
   391	

---
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: 60612 bytes --]

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

* Re: [PATCH 11/14] power: supply: bq25890: show measured VBUS
  2020-04-02 14:58 ` [PATCH 11/14] power: supply: bq25890: show measured VBUS Michał Mirosław
@ 2020-04-03 21:06   ` kbuild test robot
  2020-04-03 23:04   ` kbuild test robot
  1 sibling, 0 replies; 23+ messages in thread
From: kbuild test robot @ 2020-04-03 21:06 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: kbuild-all, Sebastian Reichel, linux-kernel, linux-pm

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

Hi "Michał,

I love your patch! Yet something to improve:

[auto build test ERROR on power-supply/for-next]
[also build test ERROR on linus/master v5.6 next-20200403]
[cannot apply to linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Micha-Miros-aw/power-supply-bq25890-fix-and-extend/20200404-010738
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/power/supply/bq25890_charger.c: In function 'bq25890_is_adc_property':
   drivers/power/supply/bq25890_charger.c:383:7: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     383 |  case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c:383:7: note: each undeclared identifier is reported only once for each function it appears in
   drivers/power/supply/bq25890_charger.c:384:7: error: 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_VOLTAGE_NOW'?
     384 |  case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_VOLTAGE_NOW
   drivers/power/supply/bq25890_charger.c: In function 'bq25890_power_supply_get_property':
   drivers/power/supply/bq25890_charger.c:509:7: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     509 |  case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c: At top level:
>> drivers/power/supply/bq25890_charger.c:726:2: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared here (not in a function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     726 |  POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |  POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c:738:16: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     738 |  .properties = bq25890_power_supply_props,
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~

vim +726 drivers/power/supply/bq25890_charger.c

   712	
   713	static const enum power_supply_property bq25890_power_supply_props[] = {
   714		POWER_SUPPLY_PROP_MANUFACTURER,
   715		POWER_SUPPLY_PROP_MODEL_NAME,
   716		POWER_SUPPLY_PROP_STATUS,
   717		POWER_SUPPLY_PROP_CHARGE_TYPE,
   718		POWER_SUPPLY_PROP_ONLINE,
   719		POWER_SUPPLY_PROP_HEALTH,
   720		POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
   721		POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
   722		POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
   723		POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
   724		POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
   725		POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
 > 726		POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW,
   727		POWER_SUPPLY_PROP_VOLTAGE_NOW,
   728		POWER_SUPPLY_PROP_CURRENT_NOW,
   729	};
   730	

---
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: 60612 bytes --]

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

* Re: [PATCH 12/14] power: supply: bq25890: show VSYS as output voltage
  2020-04-02 14:58 ` [PATCH 12/14] power: supply: bq25890: show VSYS as output voltage Michał Mirosław
@ 2020-04-03 21:41   ` kbuild test robot
  0 siblings, 0 replies; 23+ messages in thread
From: kbuild test robot @ 2020-04-03 21:41 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: kbuild-all, Sebastian Reichel, linux-kernel, linux-pm

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

Hi "Michał,

I love your patch! Yet something to improve:

[auto build test ERROR on power-supply/for-next]
[also build test ERROR on linus/master v5.6 next-20200403]
[cannot apply to linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Micha-Miros-aw/power-supply-bq25890-fix-and-extend/20200404-010738
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/power/supply/bq25890_charger.c: In function 'bq25890_is_adc_property':
   drivers/power/supply/bq25890_charger.c:383:7: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     383 |  case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c:383:7: note: each undeclared identifier is reported only once for each function it appears in
   drivers/power/supply/bq25890_charger.c:384:7: error: 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_VOLTAGE_NOW'?
     384 |  case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_VOLTAGE_NOW
   drivers/power/supply/bq25890_charger.c: In function 'bq25890_power_supply_get_property':
   drivers/power/supply/bq25890_charger.c:509:7: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     509 |  case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c:527:7: error: 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_VOLTAGE_NOW'?
     527 |  case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_VOLTAGE_NOW
>> drivers/power/supply/bq25890_charger.c:536:7: error: 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_MIN' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     536 |  case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_MIN:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c: At top level:
   drivers/power/supply/bq25890_charger.c:730:2: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared here (not in a function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     730 |  POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |  POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
>> drivers/power/supply/bq25890_charger.c:731:2: error: 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW' undeclared here (not in a function); did you mean 'POWER_SUPPLY_PROP_VOLTAGE_NOW'?
     731 |  POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |  POWER_SUPPLY_PROP_VOLTAGE_NOW
>> drivers/power/supply/bq25890_charger.c:732:2: error: 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_MIN' undeclared here (not in a function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     732 |  POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_MIN,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |  POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c:743:16: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     743 |  .properties = bq25890_power_supply_props,
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~

vim +536 drivers/power/supply/bq25890_charger.c

   395	
   396	static int bq25890_power_supply_get_property(struct power_supply *psy,
   397						     enum power_supply_property psp,
   398						     union power_supply_propval *val)
   399	{
   400		struct bq25890_device *bq = power_supply_get_drvdata(psy);
   401		struct bq25890_state state;
   402		bool do_adc_conv;
   403		int ret;
   404	
   405		mutex_lock(&bq->lock);
   406		/* update state in case we lost an interrupt */
   407		__bq25890_handle_irq(bq);
   408		state = bq->state;
   409		do_adc_conv = !state.online && bq25890_is_adc_property(psp);
   410		if (do_adc_conv)
   411			bq25890_field_write(bq, F_CONV_START, 1);
   412		mutex_unlock(&bq->lock);
   413	
   414		if (do_adc_conv)
   415			regmap_field_read_poll_timeout(bq->rmap_fields[F_CONV_START],
   416				ret, !ret, 25000, 1000000);
   417	
   418		switch (psp) {
   419		case POWER_SUPPLY_PROP_STATUS:
   420			if (!state.online)
   421				val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
   422			else if (state.chrg_status == STATUS_NOT_CHARGING)
   423				val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
   424			else if (state.chrg_status == STATUS_PRE_CHARGING ||
   425				 state.chrg_status == STATUS_FAST_CHARGING)
   426				val->intval = POWER_SUPPLY_STATUS_CHARGING;
   427			else if (state.chrg_status == STATUS_TERMINATION_DONE)
   428				val->intval = POWER_SUPPLY_STATUS_FULL;
   429			else
   430				val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
   431	
   432			break;
   433	
   434		case POWER_SUPPLY_PROP_CHARGE_TYPE:
   435			if (!state.online || state.chrg_status == STATUS_NOT_CHARGING ||
   436			    state.chrg_status == STATUS_TERMINATION_DONE)
   437				val->intval = POWER_SUPPLY_CHARGE_TYPE_NONE;
   438			else if (state.chrg_status == STATUS_PRE_CHARGING)
   439				val->intval = POWER_SUPPLY_CHARGE_TYPE_STANDARD;
   440			else if (state.chrg_status == STATUS_FAST_CHARGING)
   441				val->intval = POWER_SUPPLY_CHARGE_TYPE_FAST;
   442			else /* unreachable */
   443				val->intval = POWER_SUPPLY_CHARGE_TYPE_UNKNOWN;
   444			break;
   445	
   446		case POWER_SUPPLY_PROP_MANUFACTURER:
   447			val->strval = BQ25890_MANUFACTURER;
   448			break;
   449	
   450		case POWER_SUPPLY_PROP_MODEL_NAME:
   451			val->strval = bq25890_chip_name[bq->chip_version];
   452			break;
   453	
   454		case POWER_SUPPLY_PROP_ONLINE:
   455			val->intval = state.online;
   456			break;
   457	
   458		case POWER_SUPPLY_PROP_HEALTH:
   459			if (!state.chrg_fault && !state.bat_fault && !state.boost_fault)
   460				val->intval = POWER_SUPPLY_HEALTH_GOOD;
   461			else if (state.bat_fault)
   462				val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
   463			else if (state.chrg_fault == CHRG_FAULT_TIMER_EXPIRED)
   464				val->intval = POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE;
   465			else if (state.chrg_fault == CHRG_FAULT_THERMAL_SHUTDOWN)
   466				val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
   467			else
   468				val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
   469			break;
   470	
   471		case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
   472			val->intval = bq25890_find_val(bq->init_data.ichg, TBL_ICHG);
   473			break;
   474	
   475		case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
   476			if (!state.online) {
   477				val->intval = 0;
   478				break;
   479			}
   480	
   481			ret = bq25890_field_read(bq, F_BATV); /* read measured value */
   482			if (ret < 0)
   483				return ret;
   484	
   485			/* converted_val = 2.304V + ADC_val * 20mV (table 10.3.15) */
   486			val->intval = 2304000 + ret * 20000;
   487			break;
   488	
   489		case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
   490			val->intval = bq25890_find_val(bq->init_data.vreg, TBL_VREG);
   491			break;
   492	
   493		case POWER_SUPPLY_PROP_PRECHARGE_CURRENT:
   494			val->intval = bq25890_find_val(bq->init_data.iprechg, TBL_ITERM);
   495			break;
   496	
   497		case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:
   498			val->intval = bq25890_find_val(bq->init_data.iterm, TBL_ITERM);
   499			break;
   500	
   501		case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
   502			ret = bq25890_field_read(bq, F_IILIM);
   503			if (ret < 0)
   504				return ret;
   505	
   506			val->intval = bq25890_find_val(ret, TBL_IILIM);
   507			break;
   508	
   509		case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
   510			ret = bq25890_field_read(bq, F_VBUS_GD); /* is VBUS connected? */
   511			if (ret < 0)
   512				return ret;
   513	
   514			if (!ret) {
   515				val->intval = 0;
   516				break;
   517			}
   518	
   519			ret = bq25890_field_read(bq, F_VBUSV); /* read measured value */
   520			if (ret < 0)
   521				return ret;
   522	
   523			/* converted_val = 2.6V + ADC_val * 100mV */
   524			val->intval = 2600000 + ret * 100000;
   525			break;
   526	
   527		case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
   528			ret = bq25890_field_read(bq, F_SYSV); /* read measured value */
   529			if (ret < 0)
   530				return ret;
   531	
   532			/* converted_val = 2.304V + ADC_val * 20mV (table 10.3.15) */
   533			val->intval = 2304000 + ret * 20000;
   534			break;
   535	
 > 536		case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_MIN:
   537			val->intval = bq25890_find_val(bq->init_data.sysvmin, TBL_SYSVMIN);
   538			break;
   539	
   540		case POWER_SUPPLY_PROP_CURRENT_NOW:
   541			ret = bq25890_field_read(bq, F_ICHGR); /* read measured value */
   542			if (ret < 0)
   543				return ret;
   544	
   545			/* converted_val = ADC_val * 50mA (table 10.3.19) */
   546			val->intval = ret * -50000;
   547			break;
   548	
   549		default:
   550			return -EINVAL;
   551		}
   552	
   553		return 0;
   554	}
   555	
   556	static int bq25890_get_chip_state(struct bq25890_device *bq,
   557					  struct bq25890_state *state)
   558	{
   559		int i, ret;
   560	
   561		struct {
   562			enum bq25890_fields id;
   563			u8 *data;
   564		} state_fields[] = {
   565			{F_CHG_STAT,	&state->chrg_status},
   566			{F_PG_STAT,	&state->online},
   567			{F_VSYS_STAT,	&state->vsys_status},
   568			{F_BOOST_FAULT, &state->boost_fault},
   569			{F_BAT_FAULT,	&state->bat_fault},
   570			{F_CHG_FAULT,	&state->chrg_fault}
   571		};
   572	
   573		for (i = 0; i < ARRAY_SIZE(state_fields); i++) {
   574			ret = bq25890_field_read(bq, state_fields[i].id);
   575			if (ret < 0)
   576				return ret;
   577	
   578			*state_fields[i].data = ret;
   579		}
   580	
   581		dev_dbg(bq->dev, "S:CHG/PG/VSYS=%d/%d/%d, F:CHG/BOOST/BAT=%d/%d/%d\n",
   582			state->chrg_status, state->online, state->vsys_status,
   583			state->chrg_fault, state->boost_fault, state->bat_fault);
   584	
   585		return 0;
   586	}
   587	
   588	static irqreturn_t __bq25890_handle_irq(struct bq25890_device *bq)
   589	{
   590		struct bq25890_state new_state;
   591		int ret;
   592	
   593		ret = bq25890_get_chip_state(bq, &new_state);
   594		if (ret < 0)
   595			return IRQ_NONE;
   596	
   597		if (!memcmp(&bq->state, &new_state, sizeof(new_state)))
   598			return IRQ_NONE;
   599	
   600		if (!new_state.online && bq->state.online) {	    /* power removed */
   601			/* disable ADC */
   602			ret = bq25890_field_write(bq, F_CONV_START, 0);
   603			if (ret < 0)
   604				goto error;
   605		} else if (new_state.online && !bq->state.online) { /* power inserted */
   606			/* enable ADC, to have control of charge current/voltage */
   607			ret = bq25890_field_write(bq, F_CONV_START, 1);
   608			if (ret < 0)
   609				goto error;
   610		}
   611	
   612		bq->state = new_state;
   613		power_supply_changed(bq->charger);
   614	
   615		return IRQ_HANDLED;
   616	error:
   617		dev_err(bq->dev, "Error communicating with the chip: %pe\n",
   618			ERR_PTR(ret));
   619		return IRQ_HANDLED;
   620	}
   621	
   622	static irqreturn_t bq25890_irq_handler_thread(int irq, void *private)
   623	{
   624		struct bq25890_device *bq = private;
   625		irqreturn_t ret;
   626	
   627		mutex_lock(&bq->lock);
   628		ret = __bq25890_handle_irq(bq);
   629		mutex_unlock(&bq->lock);
   630	
   631		return ret;
   632	}
   633	
   634	static int bq25890_chip_reset(struct bq25890_device *bq)
   635	{
   636		int ret;
   637		int rst_check_counter = 10;
   638	
   639		ret = bq25890_field_write(bq, F_REG_RST, 1);
   640		if (ret < 0)
   641			return ret;
   642	
   643		do {
   644			ret = bq25890_field_read(bq, F_REG_RST);
   645			if (ret < 0)
   646				return ret;
   647	
   648			usleep_range(5, 10);
   649		} while (ret == 1 && --rst_check_counter);
   650	
   651		if (!rst_check_counter)
   652			return -ETIMEDOUT;
   653	
   654		return 0;
   655	}
   656	
   657	static int bq25890_hw_init(struct bq25890_device *bq)
   658	{
   659		int ret;
   660		int i;
   661	
   662		const struct {
   663			enum bq25890_fields id;
   664			u32 value;
   665		} init_data[] = {
   666			{F_ICHG,	 bq->init_data.ichg},
   667			{F_VREG,	 bq->init_data.vreg},
   668			{F_ITERM,	 bq->init_data.iterm},
   669			{F_IPRECHG,	 bq->init_data.iprechg},
   670			{F_SYSVMIN,	 bq->init_data.sysvmin},
   671			{F_BOOSTV,	 bq->init_data.boostv},
   672			{F_BOOSTI,	 bq->init_data.boosti},
   673			{F_BOOSTF,	 bq->init_data.boostf},
   674			{F_EN_ILIM,	 bq->init_data.ilim_en},
   675			{F_TREG,	 bq->init_data.treg}
   676		};
   677	
   678		ret = bq25890_chip_reset(bq);
   679		if (ret < 0) {
   680			dev_dbg(bq->dev, "Reset failed %d\n", ret);
   681			return ret;
   682		}
   683	
   684		/* disable watchdog */
   685		ret = bq25890_field_write(bq, F_WD, 0);
   686		if (ret < 0) {
   687			dev_dbg(bq->dev, "Disabling watchdog failed %d\n", ret);
   688			return ret;
   689		}
   690	
   691		/* initialize currents/voltages and other parameters */
   692		for (i = 0; i < ARRAY_SIZE(init_data); i++) {
   693			ret = bq25890_field_write(bq, init_data[i].id,
   694						  init_data[i].value);
   695			if (ret < 0) {
   696				dev_dbg(bq->dev, "Writing init data failed %d\n", ret);
   697				return ret;
   698			}
   699		}
   700	
   701		/* Configure ADC for continuous conversions when charging */
   702		ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online);
   703		if (ret < 0) {
   704			dev_dbg(bq->dev, "Config ADC failed %d\n", ret);
   705			return ret;
   706		}
   707	
   708		ret = bq25890_get_chip_state(bq, &bq->state);
   709		if (ret < 0) {
   710			dev_dbg(bq->dev, "Get state failed %d\n", ret);
   711			return ret;
   712		}
   713	
   714		return 0;
   715	}
   716	
   717	static const enum power_supply_property bq25890_power_supply_props[] = {
   718		POWER_SUPPLY_PROP_MANUFACTURER,
   719		POWER_SUPPLY_PROP_MODEL_NAME,
   720		POWER_SUPPLY_PROP_STATUS,
   721		POWER_SUPPLY_PROP_CHARGE_TYPE,
   722		POWER_SUPPLY_PROP_ONLINE,
   723		POWER_SUPPLY_PROP_HEALTH,
   724		POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
   725		POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
   726		POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
   727		POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
   728		POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
   729		POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
   730		POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW,
 > 731		POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW,
 > 732		POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_MIN,
   733		POWER_SUPPLY_PROP_CURRENT_NOW,
   734	};
   735	

---
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: 60612 bytes --]

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

* Re: [PATCH 05/14] power: supply: bq25890: fix ADC mode configuration
  2020-04-02 14:58 ` [PATCH 05/14] power: supply: bq25890: fix ADC mode configuration Michał Mirosław
  2020-04-03 20:29   ` kbuild test robot
@ 2020-04-03 22:14   ` kbuild test robot
  2020-04-04  5:14   ` kbuild test robot
  2 siblings, 0 replies; 23+ messages in thread
From: kbuild test robot @ 2020-04-03 22:14 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: kbuild-all, Sebastian Reichel, linux-kernel, linux-pm

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

Hi "Michał,

I love your patch! Yet something to improve:

[auto build test ERROR on power-supply/for-next]
[also build test ERROR on linus/master v5.6 next-20200403]
[cannot apply to linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Micha-Miros-aw/power-supply-bq25890-fix-and-extend/20200404-010738
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=mips 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/power/supply/bq25890_charger.c: In function 'bq25890_is_adc_property':
>> drivers/power/supply/bq25890_charger.c:381:7: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     381 |  case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c:381:7: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/power/supply/bq25890_charger.c:382:7: error: 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_VOLTAGE_NOW'?
     382 |  case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_VOLTAGE_NOW
   drivers/power/supply/bq25890_charger.c: At top level:
   drivers/power/supply/bq25890_charger.c:686:16: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     686 |  .properties = bq25890_power_supply_props,
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~

vim +381 drivers/power/supply/bq25890_charger.c

   377	
   378	static bool bq25890_is_adc_property(enum power_supply_property psp)
   379	{
   380		switch (psp) {
 > 381		case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
 > 382		case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
   383		case POWER_SUPPLY_PROP_VOLTAGE_NOW:
   384		case POWER_SUPPLY_PROP_CURRENT_NOW:
   385			return true;
   386	
   387		default:
   388			return false;
   389		}
   390	}
   391	

---
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: 64409 bytes --]

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

* Re: [PATCH 11/14] power: supply: bq25890: show measured VBUS
  2020-04-02 14:58 ` [PATCH 11/14] power: supply: bq25890: show measured VBUS Michał Mirosław
  2020-04-03 21:06   ` kbuild test robot
@ 2020-04-03 23:04   ` kbuild test robot
  1 sibling, 0 replies; 23+ messages in thread
From: kbuild test robot @ 2020-04-03 23:04 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: kbuild-all, Sebastian Reichel, linux-kernel, linux-pm

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

Hi "Michał,

I love your patch! Yet something to improve:

[auto build test ERROR on power-supply/for-next]
[also build test ERROR on linus/master v5.6 next-20200403]
[cannot apply to linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Micha-Miros-aw/power-supply-bq25890-fix-and-extend/20200404-010738
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=mips 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/power/supply/bq25890_charger.c: In function 'bq25890_is_adc_property':
   drivers/power/supply/bq25890_charger.c:383:7: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     383 |  case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c:383:7: note: each undeclared identifier is reported only once for each function it appears in
   drivers/power/supply/bq25890_charger.c:384:7: error: 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_VOLTAGE_NOW'?
     384 |  case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_VOLTAGE_NOW
   drivers/power/supply/bq25890_charger.c: In function 'bq25890_power_supply_get_property':
   drivers/power/supply/bq25890_charger.c:509:7: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     509 |  case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |       POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c: At top level:
>> drivers/power/supply/bq25890_charger.c:726:2: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared here (not in a function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'?
     726 |  POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |  POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT
   drivers/power/supply/bq25890_charger.c:738:16: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     738 |  .properties = bq25890_power_supply_props,
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~

vim +726 drivers/power/supply/bq25890_charger.c

   712	
   713	static const enum power_supply_property bq25890_power_supply_props[] = {
   714		POWER_SUPPLY_PROP_MANUFACTURER,
   715		POWER_SUPPLY_PROP_MODEL_NAME,
   716		POWER_SUPPLY_PROP_STATUS,
   717		POWER_SUPPLY_PROP_CHARGE_TYPE,
   718		POWER_SUPPLY_PROP_ONLINE,
   719		POWER_SUPPLY_PROP_HEALTH,
   720		POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
   721		POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
   722		POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
   723		POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
   724		POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
   725		POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
 > 726		POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW,
   727		POWER_SUPPLY_PROP_VOLTAGE_NOW,
   728		POWER_SUPPLY_PROP_CURRENT_NOW,
   729	};
   730	

---
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: 64409 bytes --]

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

* Re: [PATCH 03/14] power: supply: bq25890: make property table const
  2020-04-02 14:58 ` [PATCH 03/14] power: supply: bq25890: make property table const Michał Mirosław
  2020-04-03 19:52   ` kbuild test robot
@ 2020-04-04  3:41   ` kbuild test robot
  1 sibling, 0 replies; 23+ messages in thread
From: kbuild test robot @ 2020-04-04  3:41 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: kbuild-all, Sebastian Reichel, linux-kernel, linux-pm

Hi "Michał,

I love your patch! Perhaps something to improve:

[auto build test WARNING on power-supply/for-next]
[also build test WARNING on linus/master v5.6 next-20200403]
[cannot apply to linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Micha-Miros-aw/power-supply-bq25890-fix-and-extend/20200404-010738
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-188-g79f7ac98-dirty
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> drivers/power/supply/bq25890_charger.c:692:23: sparse: sparse: incorrect type in initializer (different modifiers) @@    expected unsigned int enum power_supply_property *properties @@    got unsignunsigned int enum power_supply_property *properties @@
>> drivers/power/supply/bq25890_charger.c:692:23: sparse:    expected unsigned int enum power_supply_property *properties
>> drivers/power/supply/bq25890_charger.c:692:23: sparse:    got unsigned int enum power_supply_property const *

vim +692 drivers/power/supply/bq25890_charger.c

4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  688  
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  689  static const struct power_supply_desc bq25890_power_supply_desc = {
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  690  	.name = "bq25890-charger",
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  691  	.type = POWER_SUPPLY_TYPE_USB,
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19 @692  	.properties = bq25890_power_supply_props,
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  693  	.num_properties = ARRAY_SIZE(bq25890_power_supply_props),
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  694  	.get_property = bq25890_power_supply_get_property,
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  695  };
4aeae9cb0dad11 drivers/power/bq25890_charger.c Laurentiu Palcu 2015-05-19  696  

:::::: The code at line 692 was first introduced by commit
:::::: 4aeae9cb0dad117f055add68c48decaf489aecf3 power_supply: Add support for TI BQ25890 charger chip

:::::: TO: Laurentiu Palcu <laurentiu.palcu@intel.com>
:::::: CC: Sebastian Reichel <sre@kernel.org>

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

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

* Re: [PATCH 05/14] power: supply: bq25890: fix ADC mode configuration
  2020-04-02 14:58 ` [PATCH 05/14] power: supply: bq25890: fix ADC mode configuration Michał Mirosław
  2020-04-03 20:29   ` kbuild test robot
  2020-04-03 22:14   ` kbuild test robot
@ 2020-04-04  5:14   ` kbuild test robot
  2 siblings, 0 replies; 23+ messages in thread
From: kbuild test robot @ 2020-04-04  5:14 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: kbuild-all, Sebastian Reichel, linux-kernel, linux-pm

Hi "Michał,

I love your patch! Perhaps something to improve:

[auto build test WARNING on power-supply/for-next]
[also build test WARNING on linus/master v5.6 next-20200403]
[cannot apply to linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Micha-Miros-aw/power-supply-bq25890-fix-and-extend/20200404-010738
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-188-g79f7ac98-dirty
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

   drivers/power/supply/bq25890_charger.c:381:14: sparse: sparse: undefined identifier 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW'
   drivers/power/supply/bq25890_charger.c:382:14: sparse: sparse: undefined identifier 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW'
>> drivers/power/supply/bq25890_charger.c:381:14: sparse: sparse: incompatible types for 'case' statement
   drivers/power/supply/bq25890_charger.c:382:14: sparse: sparse: incompatible types for 'case' statement
   drivers/power/supply/bq25890_charger.c:686:23: sparse: sparse: incorrect type in initializer (different modifiers) @@    expected unsigned int enum power_supply_property *properties @@    got unsignunsigned int enum power_supply_property *properties @@
   drivers/power/supply/bq25890_charger.c:686:23: sparse:    expected unsigned int enum power_supply_property *properties
   drivers/power/supply/bq25890_charger.c:686:23: sparse:    got unsigned int enum power_supply_property const *
   drivers/power/supply/bq25890_charger.c:381:14: sparse: sparse: Expected constant expression in case statement
   drivers/power/supply/bq25890_charger.c:382:14: sparse: sparse: Expected constant expression in case statement

vim +/case +381 drivers/power/supply/bq25890_charger.c

   377	
   378	static bool bq25890_is_adc_property(enum power_supply_property psp)
   379	{
   380		switch (psp) {
 > 381		case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
   382		case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
   383		case POWER_SUPPLY_PROP_VOLTAGE_NOW:
   384		case POWER_SUPPLY_PROP_CURRENT_NOW:
   385			return true;
   386	
   387		default:
   388			return false;
   389		}
   390	}
   391	

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

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

end of thread, other threads:[~2020-04-04  5:14 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 14:58 [PATCH 00/14] power: supply: bq25890: fix and extend Michał Mirosław
2020-04-02 14:58 ` [PATCH 02/14] power: supply: bq25890: simplify chip name property getter Michał Mirosław
2020-04-02 14:58 ` [PATCH 01/14] power: supply: bq25890: remove redundant I2C bus check Michał Mirosław
2020-04-02 14:58 ` [PATCH 03/14] power: supply: bq25890: make property table const Michał Mirosław
2020-04-03 19:52   ` kbuild test robot
2020-04-04  3:41   ` kbuild test robot
2020-04-02 14:58 ` [PATCH 04/14] power: supply: bq25890: protect view of the chip's state Michał Mirosław
2020-04-02 14:58 ` [PATCH 05/14] power: supply: bq25890: fix ADC mode configuration Michał Mirosław
2020-04-03 20:29   ` kbuild test robot
2020-04-03 22:14   ` kbuild test robot
2020-04-04  5:14   ` kbuild test robot
2020-04-02 14:58 ` [PATCH 06/14] power: supply: bq25890: update state on property read Michał Mirosław
2020-04-02 14:58 ` [PATCH 07/14] power: supply: bq25890: implement CHARGE_TYPE property Michał Mirosław
2020-04-02 14:58 ` [PATCH 09/14] power: supply: bq25890: implement INPUT_CURRENT_LIMIT property Michał Mirosław
2020-04-02 14:58 ` [PATCH 08/14] power: supply: bq25890: implement PRECHARGE_CURRENT property Michał Mirosław
2020-04-02 14:58 ` [PATCH 11/14] power: supply: bq25890: show measured VBUS Michał Mirosław
2020-04-03 21:06   ` kbuild test robot
2020-04-03 23:04   ` kbuild test robot
2020-04-02 14:58 ` [PATCH 10/14] power: supply: bq25890: use proper CURRENT_NOW property for I_BAT Michał Mirosław
2020-04-02 14:58 ` [PATCH 12/14] power: supply: bq25890: show VSYS as output voltage Michał Mirosław
2020-04-03 21:41   ` kbuild test robot
2020-04-02 14:58 ` [PATCH 13/14] power: supply: bq25890: show VBAT as VOLTAGE_NOW Michał Mirosław
2020-04-02 14:58 ` [PATCH 14/14] power: supply: bq25890: support IBAT compensation Michał Mirosław

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).