linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: linux-pm@vger.kernel.org
Cc: Sebastian Reichel <sre@kernel.org>,
	Mike Looijmans <mike.looijmans@topic.nl>
Subject: [PATCH 5/5] power: supply: gpio-charger: LM3658 support
Date: Wed, 17 Jan 2018 21:33:02 +0100	[thread overview]
Message-ID: <20180117203302.GF8774@lenoch> (raw)
In-Reply-To: <20180117202701.GA8774@lenoch>

Just a proof of concept...

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 drivers/power/supply/gpio-charger.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/power/supply/gpio-charger.c b/drivers/power/supply/gpio-charger.c
index 463e0abe975b..1628ac1e84d1 100644
--- a/drivers/power/supply/gpio-charger.c
+++ b/drivers/power/supply/gpio-charger.c
@@ -441,6 +441,21 @@ struct gpio_charger_mapping chrg_fault_mapping[] = {
 	},
 };
 
+struct gpio_charger_mapping stat12_mapping[] = {
+	{
+		POWER_SUPPLY_PROP_STATUS,
+		POWER_SUPPLY_STATUS_NOT_CHARGING,
+		MAP(0x03,
+		{ 0x01, POWER_SUPPLY_STATUS_CHARGING },
+		{ 0x02, POWER_SUPPLY_STATUS_FULL }),
+	}, {
+		POWER_SUPPLY_PROP_HEALTH,
+		POWER_SUPPLY_HEALTH_GOOD,
+		MAP(0x03,
+		{ 0x03, POWER_SUPPLY_HEALTH_DEAD }),
+	},
+};
+
 static const struct gpio_charger_config ltc3651_cfg = {
 	MAPPING(chrg_fault_mapping),
 	{
@@ -451,12 +466,25 @@ static const struct gpio_charger_config ltc3651_cfg = {
 	},
 };
 
+static const struct gpio_charger_config lm3658_cfg = {
+	MAPPING(stat12_mapping),
+	{
+		{ "ti,stat1", 0 },
+		{ "ti,stat2", 0 },
+		{ NULL, 0 },
+	},
+};
+
 static const struct of_device_id gpio_charger_match[] = {
 	{	.compatible = "gpio-charger" },
 	{
 		.compatible = "lltc,ltc3651-charger",
 		.data = (void *) &ltc3651_cfg,
 	},
+	{
+		.compatible = "ti,lm3658",
+		.data = (void *) &lm3658_cfg,
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, gpio_charger_match);
-- 
2.15.1

      parent reply	other threads:[~2018-01-17 20:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 20:27 [PATCH 0/5] Generic GPIO connected chargers support Ladislav Michl
2018-01-17 20:31 ` [PATCH 1/5] power: supply: gpio-charger: Drop driver remove function Ladislav Michl
2018-01-17 20:31 ` [PATCH 2/5] power: supply: gpio-charger: use helper variable to access device info Ladislav Michl
2018-01-17 20:32 ` [PATCH 3/5] power: supply: gpio-charger: generic gpio algo Ladislav Michl
2018-01-17 20:32 ` [PATCH 4/5] power: supply: gpio-charger: LTC3651 support Ladislav Michl
2018-01-17 20:33 ` Ladislav Michl [this message]

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=20180117203302.GF8774@lenoch \
    --to=ladis@linux-mips.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    --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;
as well as URLs for NNTP newsgroup(s).