Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8383840imu; Thu, 15 Nov 2018 10:37:48 -0800 (PST) X-Google-Smtp-Source: AJdET5d3mI2aAPwEBLDQiOowpFEaLLXQKCzGiXfNHiV8vTtbRq6hQcVs45cueVRSovDaUFzcmItl X-Received: by 2002:a63:5026:: with SMTP id e38mr6875688pgb.123.1542307067919; Thu, 15 Nov 2018 10:37:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542307067; cv=none; d=google.com; s=arc-20160816; b=AIM4mkGvRWb9QnCgfb23ieVkz3R+ZgnIhJL8UKHe0AKFhfZ5+w5Y8F1Cp91r3LL403 ygQR+24OEmq6Q5fMcSzNO3wrr0DqkH+rTQ3x5sN6ZbQRhPL1EG6uxhoGJP8NNYA8Os21 TWtogB1PELPGd+M5bkcozr4wus5Hcdlr9OAckwS5AnESG5TqDTh0DigFao17Vka4Z8aT Dkd52XYo72oGhs/L8uKw5ES1kF/0SGYgkItVsVIph+yNiW+4UkvgeYOWw8HptYyn7aCk DldKooui2n7n7seiEdNI/2BTarp2ktPfzSixcDtOclW5DTyBvP7bpvzvf9Sx6P/iRP3s toZg== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=zLj4E2Tb9RWwHBDq7pLJS6zLt/te5YfjWvioUYcWq4U=; b=vGuydFA4xwiokCpO0HbkErHkctTzPujaMBVf/wxfxy1/V+LthmnlW3Ac1MIhpido5N tfuVCXKoK+fqnohFkps3TLOtlveSTsPIhI+t3DFKkK4PANzKjNcsl3AkigCRAJUPu5LK Q/X9OA5hHYrHPGFDK6H7t2zE2boaQ/vJaXhAyFE9LhhoRj/H4/V9mMNDqpEl8eydV7ZF yc20e/dcLW6nyMXos7M8PVbXXAXBsNki9EBBzQL6ZDKMS8OochVbtt/zUdL1uVdp6fK4 RfFJgaFFPxjT58mmEpvh7TeHXxbNfbw3SeIC+zZXocF0PfBX2rz+vQsxRLt/as5SdPk0 +SvQ== 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 28si6990496pgw.364.2018.11.15.10.37.32; Thu, 15 Nov 2018 10:37:47 -0800 (PST) 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 S2388388AbeKPEpr (ORCPT + 99 others); Thu, 15 Nov 2018 23:45:47 -0500 Received: from shell.v3.sk ([90.176.6.54]:52244 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726453AbeKPEpr (ORCPT ); Thu, 15 Nov 2018 23:45:47 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id C0CD74C35E; Thu, 15 Nov 2018 19:36:47 +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 raIzwUPqoDly; Thu, 15 Nov 2018 19:36:44 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 0434D4C37B; Thu, 15 Nov 2018 19:36:44 +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 GdJT7ZIrdELW; Thu, 15 Nov 2018 19:36:43 +0100 (CET) Received: from belphegor (nat-pool-brq-t.redhat.com [213.175.37.10]) by zimbra.v3.sk (Postfix) with ESMTPSA id C46B44C35E; Thu, 15 Nov 2018 19:36:42 +0100 (CET) Message-ID: Subject: Re: [PATCH 12/15] power: supply: olpc_battery: Use DT to get battery version From: Lubomir Rintel To: Pavel Machek Cc: Mark Brown , Geert Uytterhoeven , Darren Hart , Andy Shevchenko , Greg Kroah-Hartman , James Cameron , Sebastian Reichel , Rob Herring , Mark Rutland , Eric Miao , Haojian Zhuang , Daniel Mack , Robert Jarzmik , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, platform-driver-x86@vger.kernel.org, devel@driverdev.osuosl.org, linux-pm@vger.kernel.org Date: Thu, 15 Nov 2018 19:36:41 +0100 In-Reply-To: <20181104123710.GE23864@amd> References: <20181010172300.317643-1-lkundrak@v3.sk> <20181010172300.317643-13-lkundrak@v3.sk> <20181104123710.GE23864@amd> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.2 (3.30.2-2.fc29) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2018-11-04 at 13:37 +0100, Pavel Machek wrote: > On Wed 2018-10-10 19:22:57, Lubomir Rintel wrote: > > Avoid using the x86 OLPC platform specific call to get the board > > version. It won't work on FDT-based ARM MMP2 platform. > > > > Signed-off-by: Lubomir Rintel > > Reviewed-by: Andy Shevchenko > > Acked-by: Pavel Machek > > AFAICT, this should go earlier in the series; first, add support in > the code, then switch to new name in DTS. I think it's all right this way: I'm not removing the old compatible string -- functionality provided by one version of the battery is a superset of the another. Also, the older version of the driver with only the XO-1 compatible string guesses the actual battery version by querying the board version directly, so up to this patch things keep working the way they used to regardless of the new compatible string. Lubo > Pavel > > > --- > > 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..540d44bf536f 100644 > > --- a/drivers/power/supply/olpc_battery.c > > +++ b/drivers/power/supply/olpc_battery.c > > @@ -19,6 +19,7 @@ > > #include > > #include > > #include > > +#include > > #include > > > > > > @@ -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);