All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Angus Ainslie (Purism)" <angus@akkea.ca>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: angus.ainslie@puri.sm, Sebastian Reichel <sre@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Angus Ainslie (Purism)" <angus@akkea.ca>
Subject: [PATCH v3 1/4] power: bq25890_charger.c: Add debugging output of failed initialization
Date: Tue, 31 Jul 2018 10:43:13 -0600	[thread overview]
Message-ID: <20180731164316.32696-2-angus@akkea.ca> (raw)
In-Reply-To: <20180731164316.32696-1-angus@akkea.ca>

To ease adding a new part variant some debugging is handy.

Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
---
 drivers/power/supply/bq25890_charger.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 8e2c41ded171..7f0b3a46c50c 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -608,30 +608,40 @@ static int bq25890_hw_init(struct bq25890_device *bq)
 	};
 
 	ret = bq25890_chip_reset(bq);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_dbg(bq->dev, "Reset failed %d\n", ret);
 		return ret;
+	};
 
 	/* disable watchdog */
 	ret = bq25890_field_write(bq, F_WD, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_dbg(bq->dev, "Disabling watchdog failed %d\n", ret);
 		return ret;
+	};
 
 	/* initialize currents/voltages and other parameters */
 	for (i = 0; i < ARRAY_SIZE(init_data); i++) {
 		ret = bq25890_field_write(bq, init_data[i].id,
 					  init_data[i].value);
-		if (ret < 0)
+		if (ret < 0) {
+			dev_dbg(bq->dev, "Writing init data failed %d\n", ret);
 			return ret;
+		};
 	}
 
 	/* Configure ADC for continuous conversions. This does not enable it. */
 	ret = bq25890_field_write(bq, F_CONV_RATE, 1);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_dbg(bq->dev, "Config ADC failed %d\n", ret);
 		return ret;
+	};
 
 	ret = bq25890_get_chip_state(bq, &state);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_dbg(bq->dev, "Get state failed %d\n", ret);
 		return ret;
+	};
 
 	mutex_lock(&bq->lock);
 	bq->state = state;
@@ -767,6 +777,9 @@ static int bq25890_fw_read_u32_props(struct bq25890_device *bq)
 			if (props[i].optional)
 				continue;
 
+			dev_err(bq->dev, "Unable to read property %d %s\n", ret,
+				props[i].name);
+
 			return ret;
 		}
 
-- 
2.17.1

  reply	other threads:[~2018-07-31 16:43 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 13:51 [PATCH] bq25890_charger.c : add the BQ25896 part Angus Ainslie
2018-07-25  9:58 ` Krzysztof Kozlowski
2018-07-25 12:17   ` Angus Ainslie
2018-07-26  6:37     ` Krzysztof Kozlowski
2018-07-25 19:46   ` [PATCH v2 0/4] Add the BQ25896 charger IC Angus Ainslie (Purism)
2018-07-25 19:46     ` [PATCH v2 1/4] power: bq25890_charger.c: Add debugging output of failed initialization Angus Ainslie (Purism)
2018-07-26  6:44       ` Krzysztof Kozlowski
2018-07-25 19:46     ` [PATCH v2 2/4] power: bq25890_charger.c: Remove unused table Angus Ainslie (Purism)
2018-07-26  6:51       ` Krzysztof Kozlowski
2018-07-27 15:26         ` Angus Ainslie
2018-07-31  6:40           ` Krzysztof Kozlowski
2018-07-25 19:46     ` [PATCH v2 3/4] power: bq25890_charger.c: Add the BQ25896 part Angus Ainslie (Purism)
2018-07-26  6:56       ` Krzysztof Kozlowski
2018-07-25 19:46     ` [PATCH v2 4/4] power: bq25890_charger.c: Read back the current battery voltage Angus Ainslie (Purism)
2018-07-26  7:03       ` Krzysztof Kozlowski
2018-07-27 15:30         ` Angus Ainslie
2018-07-31 16:43   ` [PATCH v3 0/4] Add the BQ25896 charger IC Angus Ainslie (Purism)
2018-07-31 16:43     ` Angus Ainslie (Purism) [this message]
2018-07-31 16:57       ` [PATCH v3 1/4] power: bq25890_charger.c: Add debugging output of failed initialization Krzysztof Kozlowski
2018-07-31 18:16         ` Angus Ainslie
2018-07-31 16:43     ` [PATCH v3 2/4] power: bq25890_charger.c: Remove unused table entries Angus Ainslie (Purism)
2018-07-31 16:58       ` Krzysztof Kozlowski
2018-07-31 16:43     ` [PATCH v3 3/4] power: bq25890_charger.c: Add the BQ25896 part Angus Ainslie (Purism)
2018-07-31 17:00       ` Krzysztof Kozlowski
2018-07-31 16:43     ` [PATCH v3 4/4] power: bq25890_charger.c: Read back the current battery voltage Angus Ainslie (Purism)
2018-07-31 17:02       ` Krzysztof Kozlowski
2018-07-31 17:49   ` [PATCH v4 0/4] Add the BQ25896 charger IC Angus Ainslie (Purism)
2018-07-31 17:49     ` [PATCH v4 1/4] power: bq25890_charger.c: Add debugging output of failed initialization Angus Ainslie (Purism)
2018-07-31 17:49     ` [PATCH v4 2/4] power: bq25890_charger.c: Remove unused table entries Angus Ainslie (Purism)
2018-07-31 17:49     ` [PATCH v4 3/4] power: bq25890_charger.c: Add the BQ25896 part Angus Ainslie (Purism)
2018-07-31 17:49     ` [PATCH v4 4/4] power: bq25890_charger.c: Read back the current battery voltage Angus Ainslie (Purism)
2018-08-30 21:46     ` [PATCH v4 0/4] Add the BQ25896 charger IC Sebastian Reichel

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20180731164316.32696-2-angus@akkea.ca \
    --to=angus@akkea.ca \
    --cc=angus.ainslie@puri.sm \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

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

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