Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3846244imu; Mon, 7 Jan 2019 10:30:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/XpwfA5wqy0iFnm6QUy4Bw2XWD7njum8cpEWBvwPYGZS+K3bMMbMQEbVerBX/84P2MqZLEt X-Received: by 2002:a62:5c1:: with SMTP id 184mr63479128pff.165.1546885849384; Mon, 07 Jan 2019 10:30:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546885849; cv=none; d=google.com; s=arc-20160816; b=ZgqGB6t56Z7ANt04IrTn9lYDaWo9/z5AodbZ47wGrEpzCcX7MpwqqHFN3eAsoJEjpW jIuMLCPC58K47TJ4gK31Bwc7NSp+HYw40/AL9cBOXwJyyTsTuZm/P2Q7SjjF5HuKItLZ gRsSMjTvmr/Vp3YODj66EgtOGauUqrKilG6GPx61GGJuRsap7uItK5cTExFwbUUfRAVB N/X2z8AT0giaUVUQUB196WMfVYaQdmecfGpXbwK0pCaVU7a88NFaVl6ElCbaA+NHDYEB lKd/RhMwst/+VYvqI2HcXuGGXkYhexWtMjD8bzeq1U8KYlj1798ofNmvxCcI85C54USX vHWQ== 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=++8l5PyMhTIDMckRLZusqE1uHOQfLufiScNOwN2PgpQ=; b=g8NW2zW6L1KMm/oz//wDE0oxkfvzCaEj2wDNMBlwWDMc3HXjNXFhCs6+CjUQNFYo6C 9+DYlYPe+lISQBsnTFT2bpUxPXjcUuNmtZprvGEV/+WYCf+vR5GJ/4pOybHSESj7FS2i UItvqewa38Lsu3AopO+nzSi9YBhb5Gfu96VtIpZXpX1ljCdbIsmi6yqeBl+I47y/KPh1 kW4wo43saGnXJ3al2Zg7usST9xNslOg1AWTKq1O1fR0Hsj2r4/ko/negIpw9V/yMsj+V /zOie9DpMfnAjrpEI4k/ib9foNryST7iJh403m6QOm9glSis2EYnjG/YEZtZIfnbhazQ WY1Q== 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 z67si64150107pfb.268.2019.01.07.10.30.32; Mon, 07 Jan 2019 10:30:49 -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 S1727467AbfAGSCt (ORCPT + 99 others); Mon, 7 Jan 2019 13:02:49 -0500 Received: from shell.v3.sk ([90.176.6.54]:44274 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbfAGSCt (ORCPT ); Mon, 7 Jan 2019 13:02:49 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 8788DFFD76; Mon, 7 Jan 2019 19:02:43 +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 W11ZjhyktRhx; Mon, 7 Jan 2019 19:02:40 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 253C0FFD78; Mon, 7 Jan 2019 19:02:40 +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 g_IdK83M7cJM; Mon, 7 Jan 2019 19:02:39 +0100 (CET) Received: from belphegor (nat-pool-brq-t.redhat.com [213.175.37.10]) by zimbra.v3.sk (Postfix) with ESMTPSA id DA6AAFFD76; Mon, 7 Jan 2019 19:02:38 +0100 (CET) Message-ID: Subject: Re: [PATCH v2 17/17] power: supply: olpc_battery: Add OLPC XO 1.75 support From: Lubomir Rintel To: Darren Hart Cc: Mark Brown , Geert Uytterhoeven , 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: Mon, 07 Jan 2019 19:02:37 +0100 In-Reply-To: <20181202233458.GE23087@wrath> References: <20181116162403.49854-1-lkundrak@v3.sk> <20181116162403.49854-18-lkundrak@v3.sk> <20181202233458.GE23087@wrath> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.3 (3.30.3-1.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-12-02 at 15:34 -0800, Darren Hart wrote: > On Fri, Nov 16, 2018 at 05:24:03PM +0100, Lubomir Rintel wrote: > > The battery and the protocol are essentially the same as OLPC XO 1.5, > > but the responses from the EC are LSB first. > > > > Signed-off-by: Lubomir Rintel > > Acked-by: Pavel Machek > > > > --- > > Changes since v1: > > - s/s16 ecword_to_cpu/u16 ecword_to_cpu/ > > - s/u16 ec_byte/u16 ec_word/ > > > > drivers/power/supply/olpc_battery.c | 23 ++++++++++++++++++----- > > 1 file changed, 18 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c > > ... > > > @@ -626,6 +635,10 @@ static int olpc_battery_probe(struct platform_device *pdev) > > if (ecver > 0x44) { > > /* XO 1 or 1.5 with a new EC firmware. */ > > data->new_proto = 1; > > + } else if (of_find_compatible_node(NULL, NULL, "olpc,xo1.75-ec")) { > > This if/else blocks concerns me a bit, but I might just be missing some > context. > > This tests both ecver as well as the OF compatible string, is this reliable? Do > we know that for all xo1.75-ec compatible nodes the ecver will be <= 0x44? Or, > is ecver undefined? If the latter, then perhaps this test should be performed > first? > > if (of_find_compatible_node....x01.75-ec...) > ... > else if (ecver > 0x44) > ... > else > ... > > And what happens when ecver == 0x44? We test for > and < but not ==, <=, > or >= in this block You're right, the conditionals are not correct. On XO 1.75 the versioning is different (now at level 0x05) and uninteresting, therefore the XO 1.75 check needs to go first. On XO 1 and XO 1.75, we don't support < 0x44. 0x44 is okay, though uses stays with an old protocol, and > 0x44 uses a new protocol. Will follow up with a new version of the patch soon. > > > + /* XO 1.75 */ > > + data->new_proto = 1; > > + data->little_endian = 1; > > } else if (ecver < 0x44) { > > /* > > * We've seen a number of EC protocol changes; this driver > > -- > > 2.19.1 Thanks Lubo