From: Paul Kocialkowski <contact@paulk.fr>
To: linux-kernel@vger.kernel.org
Cc: linux-tegra@vger.kernel.org, Sebastian Reichel <sre@kernel.org>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
linux-pm@vger.kernel.org, Paul Kocialkowski <contact@paulk.fr>
Subject: [PATCH 1/2] power: bq24735-charger: Request status GPIO with initial input setup
Date: Sun, 28 Aug 2016 19:34:45 +0200 [thread overview]
Message-ID: <20160828173446.32728-1-contact@paulk.fr> (raw)
This requests the status GPIO with initial input setup. it is required
to read the GPIO status at probe time and thus correctly avoid sending
i2c messages when AC is not plugged.
When requesting the GPIO without initial input setup, it always reads 0
which causes probe to fail as it assumes the charger is connected, sends
i2c messages and fails.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
drivers/power/bq24735-charger.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/power/bq24735-charger.c b/drivers/power/bq24735-charger.c
index fa454c1..361a047 100644
--- a/drivers/power/bq24735-charger.c
+++ b/drivers/power/bq24735-charger.c
@@ -393,9 +393,9 @@ static int bq24735_charger_probe(struct i2c_client *client,
i2c_set_clientdata(client, charger);
if (gpio_is_valid(charger->pdata->status_gpio)) {
- ret = devm_gpio_request(&client->dev,
- charger->pdata->status_gpio,
- name);
+ ret = devm_gpio_request_one(&client->dev,
+ charger->pdata->status_gpio,
+ GPIOF_IN, name);
if (ret) {
dev_err(&client->dev,
"Failed GPIO request for GPIO %d: %d\n",
--
2.9.3
next reply other threads:[~2016-08-28 17:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-28 17:34 Paul Kocialkowski [this message]
2016-08-28 17:34 ` [PATCH 2/2] power: bq24735-charger: Assume not charging when charger is missing Paul Kocialkowski
2016-08-29 0:40 ` Sebastian Reichel
2016-08-29 0:36 ` [PATCH 1/2] power: bq24735-charger: Request status GPIO with initial input setup Sebastian Reichel
2016-08-29 18:13 ` Paul Kocialkowski
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=20160828173446.32728-1-contact@paulk.fr \
--to=contact@paulk.fr \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-tegra@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®