Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp414743imc; Sun, 10 Mar 2019 09:26:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyepcPVlC/tuXdA/5ncD12RJqCBLMLSD7zZv/miEZHgun9LcXbn40vApkDK+BxtZW5WrshT X-Received: by 2002:a63:4b64:: with SMTP id k36mr868407pgl.234.1552235194994; Sun, 10 Mar 2019 09:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552235194; cv=none; d=google.com; s=arc-20160816; b=ouwSSe4XK0TOf4A5BiHBSJ2JIImKBShjOFd0ih5EG4Wq1ZhrAToYSKgsbQhS7oBavB jQBWNI7axrhDM2+wa5NofS4+Rm8iDMQZ+3t3MdsbZF4+pJtS2OeTQNBu2KW7yrPqv8qO D4ZgCrE/lds3h6fBVjNmcyzmPesxYndQYVgkh33O0H+g/+WUclprausl+y3UanIfoa9J arrFKi3u7VVRec6pqDHJkBueuH6Qdepup0sz+wfRG9vGobooIYNBFb4LXP7TL4PzKBo/ /SzgL/nwu8QAZyQRoGvuUv7EEA4j0lPuKk1S7m/qnjavvpeqkuCE3zVgjuaupQGkRhjD blbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=wcr0MY/7r1YQ8QfsK7Wg1O/ADFirXeUkf29TQQ059nQ=; b=0zRWHB4em3t4rJa8vcfyiKktD/UXYatbf42WRjTPiCiMQjW8UzROGpQH1Udw98XEYZ z4BF51NEhSzDa6IuvA5X8MQCpUldvm/vAsT56wW84A11jGSjgJoCih8dP8Gb48A16hGk JAPXlya+07AVAQIo1EereNwi/W8bse8C6maUlmnDZ0jLdgz7y/Kp1uOW7TBMJQQOVmwx CwLlvY9c0EUMIj4rouEpCZn0EmvM9LeVgKwiaQQzJyyTIXwP201EKEWWIZLVl4/rjc8j IyNAbd+vEl8RDJvoCluWJQfoY369PvvcGuQZMThSCX8DjDjZMI8+yZLOZGKOz+VZG/YG XPUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si3342461plf.334.2019.03.10.09.26.19; Sun, 10 Mar 2019 09:26:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726793AbfCJQZY (ORCPT + 99 others); Sun, 10 Mar 2019 12:25:24 -0400 Received: from shell.v3.sk ([90.176.6.54]:45141 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726622AbfCJQY4 (ORCPT ); Sun, 10 Mar 2019 12:24:56 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 37AC7102CAE; Sun, 10 Mar 2019 17:24:53 +0100 (CET) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id OqkGrqDTHt77; Sun, 10 Mar 2019 17:24:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 51A1C102C8A; Sun, 10 Mar 2019 17:24:33 +0100 (CET) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id B0ls7K63qpbv; Sun, 10 Mar 2019 17:24:30 +0100 (CET) Received: from nedofet.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id DA7CE102CB3; Sun, 10 Mar 2019 17:24:29 +0100 (CET) From: Lubomir Rintel To: Sebastian Reichel Cc: Darren Hart , Rob Herring , Mark Rutland , x86@kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lubomir Rintel , Andy Shevchenko , Pavel Machek , Sebastian Reichel Subject: [PATCH 05/10] power: supply: olpc_battery: Use DT to get battery version Date: Sun, 10 Mar 2019 17:24:14 +0100 Message-Id: <20190310162419.11861-6-lkundrak@v3.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190310162419.11861-1-lkundrak@v3.sk> References: <20190310162419.11861-1-lkundrak@v3.sk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Andy Shevchenko Acked-by: Pavel Machek Reviewed-by: Sebastian Reichel --- Changes since v5: - Use of_device_is_compatible() instead of of_property_match_string("compatible") 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/o= lpc_battery.c index 5a97e42a3547..3dcf5e19f329 100644 --- a/drivers/power/supply/olpc_battery.c +++ b/drivers/power/supply/olpc_battery.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -622,11 +623,12 @@ static int olpc_battery_probe(struct platform_devic= e *pdev) olpc_ac =3D 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_device_is_compatible(pdev->dev.of_node, "olpc,xo1.5-battery")) { + /* XO-1.5 */ olpc_bat_desc.properties =3D olpc_xo15_bat_props; olpc_bat_desc.num_properties =3D ARRAY_SIZE(olpc_xo15_bat_props); - } else { /* XO-1 */ + } else { + /* XO-1 */ olpc_bat_desc.properties =3D olpc_xo1_bat_props; olpc_bat_desc.num_properties =3D ARRAY_SIZE(olpc_xo1_bat_props); } @@ -672,6 +674,7 @@ static int olpc_battery_remove(struct platform_device= *pdev) =20 static const struct of_device_id olpc_battery_ids[] =3D { { .compatible =3D "olpc,xo1-battery" }, + { .compatible =3D "olpc,xo1.5-battery" }, {} }; MODULE_DEVICE_TABLE(of, olpc_battery_ids); --=20 2.20.1