Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp296574pxa; Wed, 26 Aug 2020 10:50:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJo/eoijXXD9Is3mf0ofeqhUj+ff7/Vy7scqKgHlaqJNAK+QF+pEW0WwC5B4EZ6cL0rpwv X-Received: by 2002:aa7:ce96:: with SMTP id y22mr13210545edv.180.1598464214317; Wed, 26 Aug 2020 10:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598464214; cv=none; d=google.com; s=arc-20160816; b=hSBvcqpZHqSnDsX9Nj+7Yjou/CXLrjzBNE2RGNh2HJJiwkCfcD4LSBS5a/eY2XIu6O 38ZHa3StUmjbLB4/KXlKK9DzcdjM01toD/QFSgZL/MxDPnNMrHzgplhW3chbBezNogVt 9Z5DWZDZPHwgq9w2GMQoLabsS0kHUXOTAil15+Xl2n2YO610QdVOGtoV4UfVnvVHS1bt bMkAJ8O383dEL1w7hBLjtkSZDJpypQ4ZtzoiTHe+sIuvlqKVsQaJ0VCS0U0ahON22XfQ qSS3S6Yk7vi15fmBxegb13LLLuVt7ca5Hs1X2zGY5xoAqtfICJmSwExDvrfO7ZPUZFDh KofQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=MvBv7M3MrlDGBswXycROV0pp6pO4AVuNn63hTEwLI9w=; b=kmUmDupKrQQad9NXRdMQW2oElU9OskMzxBwBUogNUYE8cnd6HoI/5v/Z6oFNBe5AUC fuXnrUi9TQ58xMrRt3HDafIDub2sAPcy6Gt/O2HhCAqvCW8jJ6MG7YPaL8uKAPBBqdEZ ehZ7WuWGTdgYa5upqR7TYOJXLXup/qRCuUiq+H1zseo0GahF7G0mbBZaEmYz44wnds9e Gwj32kQ4lhLx4Rnrv8RVqAz0bAzWqhU5bMF2xVtOsCQsMZ3lq9sB7hA4gC2GFLutsDnl iGedkAQJsf4xlk0LAbYmq4EfwUcWmrrEmK4+CDcxrISgVIYEVBxwcpDKA567Qm0I2Ol7 Rmng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g4si2025932edr.170.2020.08.26.10.49.51; Wed, 26 Aug 2020 10:50:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727022AbgHZRs3 (ORCPT + 99 others); Wed, 26 Aug 2020 13:48:29 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:45500 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726947AbgHZRs0 (ORCPT ); Wed, 26 Aug 2020 13:48:26 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 8944F294D9C Received: by earth.universe (Postfix, from userid 1000) id 54F1E3C0C82; Wed, 26 Aug 2020 19:48:17 +0200 (CEST) Date: Wed, 26 Aug 2020 19:48:17 +0200 From: Sebastian Reichel To: Andreas Kemnade Cc: lee.jones@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, b.galvani@gmail.com, phh@phh.me, letux-kernel@openphoenux.org Subject: Re: [PATCH 1/2] power: supply: Add support for RN5T618/RC5T619 charger and fuel gauge Message-ID: <20200826174817.vhus3j4i4t7u7jc4@earth.universe> References: <20200815165610.10647-1-andreas@kemnade.info> <20200815165610.10647-2-andreas@kemnade.info> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="y3moyevmvc7nmaqp" Content-Disposition: inline In-Reply-To: <20200815165610.10647-2-andreas@kemnade.info> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --y3moyevmvc7nmaqp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, Driver looks mostly good. On Sat, Aug 15, 2020 at 06:56:09PM +0200, Andreas Kemnade wrote: > [...] > +static int rn5t618_battery_current_now(struct rn5t618_power_info *info, > + union power_supply_propval *val) > +{ > + u16 res; > + int ret; > + > + ret = rn5t618_battery_read_doublereg(info, RN5T618_CC_AVEREG1, &res); > + if (ret) > + return ret; > + > + val->intval = res; > + /* 2's complement */ > + if (val->intval & (1 << 13)) > + val->intval = val->intval - (1 << 14); > + > + /* negate current to be positive when discharging */ > + val->intval *= -1000; mh, the sign is not documented (which should be fixed). At least sbs-battery does it the other way around (negative current when discharging, positive otherwise). Some drivers do not support signed current and always report positive values (e.g. ACPI driver). What did you use as reference for swapping the sign? > + return 0; > +} > [...] > +static const struct power_supply_desc rn5t618_adp_desc = { > + .name = "rn5t618-adp", > + .type = POWER_SUPPLY_TYPE_MAINS, > + .properties = rn5t618_usb_props, wrong property array, works by accident since usb and adp property lists are the same. > + .num_properties = ARRAY_SIZE(rn5t618_adp_props), > + .get_property = rn5t618_adp_get_property, > +}; > [...] -- Sebastian --y3moyevmvc7nmaqp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAl9GoFsACgkQ2O7X88g7 +prupQ/+PUw6LW965p9e0EajZ5HB7SF2KwRWx6T+uXRreV8R2dMAS1s8K1gJplca 0/U5ZqMf3BjI5lP9m4h7/ccgUNEp/Iuk6tl143dCHutV+33SzTMgsucZVkuB+C7l te75mJdDcxlf54+A2YBTLJkWoeFuznG9Cnecz0+KYJVpFia5Y6IJDQhmuAkW1UQ/ iSe8LnvAIZH+HQ9dyU0/wTSYhlidecfybKJL2i4o9Rv0l0jp4eKYnb/vhFQ7tW/u 4IXtEuc+CPSMy4wWC0gFMx2fo7EMBVmMLgxKOw3p5E3+26yG0tMoR/q8Pp4paIqk CC/YZolAbU0nPWm71gCbisiZc3V/FE10SA6v65mFU/PyDIdCFHxmpWYb3A+LaOim Z/HAcKzJj3mtmTDBu/O7sezuIgULfx2Zb3lAZ2HtuqWKJ/KYaZ0Z10TXtiBNGm14 3jWp2hEBVHsktNNVf4kjTQwENGwMaI85Kjsx9e2YNXJoESpyJh32M3HMKiBpDUKh v/Qkb2Y5SSlgMb0E+StPIbRpVQ46vZpV2Ys04X5dfOp81UoG7NhvSECI5fOLRpo7 Kpa2/mrPMhe1gha/LEk2OItqXAZF8P95PL1obXVXWyV39vYm/v5oUd51wnOdnlu1 oyc2RLOgLW0Ae3KZsywx7ZgqD9XhhM076V0NaSMfSd5AAMQt0vI= =TU9+ -----END PGP SIGNATURE----- --y3moyevmvc7nmaqp--