linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lubomir Rintel <lkundrak@v3.sk>
To: Sebastian Reichel <sre@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	x86@kernel.org, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Lubomir Rintel <lkundrak@v3.sk>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Pavel Machek <pavel@ucw.cz>,
	Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: [PATCH v5 3/7] power: supply: olpc_battery: Use DT to get battery version
Date: Thu, 10 Jan 2019 18:40:01 +0100	[thread overview]
Message-ID: <20190110174005.1202564-4-lkundrak@v3.sk> (raw)
In-Reply-To: <20190110174005.1202564-1-lkundrak@v3.sk>

Avoid using the x86 OLPC platform specific call to get the board
version. That wouldn't work on FDT-based ARM MMP2 platform.

Add the XO 1.5 compatible string too. This is actually not completely
necessary as the battery nodes on XO 1.5 claim to be compatible with
"olpc,xo1-battery", but there are, in fact, differencies.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>

---
Changes since v2:
- Clarify the XO 1 compatibility in the commit message.

Changes since v1:
- Sort the new include a bit higher

 drivers/power/supply/olpc_battery.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c
index 5a97e42a3547..5323987d9284 100644
--- a/drivers/power/supply/olpc_battery.c
+++ b/drivers/power/supply/olpc_battery.c
@@ -14,6 +14,7 @@
 #include <linux/types.h>
 #include <linux/err.h>
 #include <linux/device.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/power_supply.h>
 #include <linux/jiffies.h>
@@ -622,11 +623,13 @@ static int olpc_battery_probe(struct platform_device *pdev)
 	olpc_ac = power_supply_register(&pdev->dev, &olpc_ac_desc, NULL);
 	if (IS_ERR(olpc_ac))
 		return PTR_ERR(olpc_ac);
-
-	if (olpc_board_at_least(olpc_board_pre(0xd0))) { /* XO-1.5 */
+	if (of_property_match_string(pdev->dev.of_node, "compatible",
+					"olpc,xo1.5-battery") >= 0) {
+		/* XO-1.5 */
 		olpc_bat_desc.properties = olpc_xo15_bat_props;
 		olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo15_bat_props);
-	} else { /* XO-1 */
+	} else {
+		/* XO-1 */
 		olpc_bat_desc.properties = olpc_xo1_bat_props;
 		olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo1_bat_props);
 	}
@@ -672,6 +675,7 @@ static int olpc_battery_remove(struct platform_device *pdev)
 
 static const struct of_device_id olpc_battery_ids[] = {
 	{ .compatible = "olpc,xo1-battery" },
+	{ .compatible = "olpc,xo1.5-battery" },
 	{}
 };
 MODULE_DEVICE_TABLE(of, olpc_battery_ids);
-- 
2.20.1


  parent reply	other threads:[~2019-01-10 17:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10 17:39 [PATCH v5 1/7] Add support for XO 1.75 to OLPC battery driver Lubomir Rintel
2019-01-10 17:39 ` [PATCH v5 1/7] dt-bindings: olpc_battery: Add XO-1.5 battery Lubomir Rintel
2019-01-10 17:40 ` [PATCH v5 2/7] x86, olpc: Use a correct version when making up a battery node Lubomir Rintel
2019-01-23 20:56   ` Sebastian Reichel
2019-01-31 12:26     ` Lubomir Rintel
2019-01-31 12:59       ` Borislav Petkov
2019-02-11 11:37       ` Lubomir Rintel
2019-02-19 23:15         ` Sebastian Reichel
2019-03-07  5:01   ` Darren Hart
2019-01-10 17:40 ` Lubomir Rintel [this message]
2019-01-23 20:38   ` [PATCH v5 3/7] power: supply: olpc_battery: Use DT to get battery version Sebastian Reichel
2019-01-10 17:40 ` [PATCH v5 4/7] power: supply: olpc_battery: Move priv data to a struct Lubomir Rintel
2019-01-23 20:54   ` Sebastian Reichel
2019-01-10 17:40 ` [PATCH v5 5/7] power: supply: olpc_battery: Use devm_power_supply_register() Lubomir Rintel
2019-01-10 17:40 ` [PATCH v5 6/7] power: supply: olpc_battery: Avoid using platform_info Lubomir Rintel
2019-01-23 20:47   ` Sebastian Reichel
2019-01-10 17:40 ` [PATCH v5 7/7] power: supply: olpc_battery: Add OLPC XO 1.75 support Lubomir Rintel
2019-01-23 20:49   ` 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=20190110174005.1202564-4-lkundrak@v3.sk \
    --to=lkundrak@v3.sk \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --cc=sebastian.reichel@collabora.com \
    --cc=sre@kernel.org \
    --cc=x86@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).