Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp486411pxa; Thu, 27 Aug 2020 07:42:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1yQjZTSmMOFa8yE8aw1+i3iniF6b0g9C+4wS6T0ZR6DMsqM4rqc15+m7VsH91BCRScJPJ X-Received: by 2002:a05:6402:333:: with SMTP id q19mr1660539edw.205.1598539329828; Thu, 27 Aug 2020 07:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598539329; cv=none; d=google.com; s=arc-20160816; b=pdcsFKR09+9xbHV00t0FBCd59l5Ii3miWrzegv91UEnGg96o+Kh9Nxm2qWMz2gIDJ4 AUxzQ+gX6WQAJ+Mi6qPNGjo2TLFJ0sXz2F4RHlbrbaMHsXrC7pKOHpPvR01jEtv+fx+6 mwT73gF9FcCpSO41yynN1mc7CSHBmeyc/a9rMEqZOfqndnsOxUXgQqFAMxtVXsBAEDxl cvQ2ZBShSi7YfY+8L/pBJSLVPFradYMdk+ZNfpvwoOPYTYXrUNHb1543ut0zqze75yr0 D/iy/ke6VD1HqUfdV+0CgJk1M9PamqmOuMRqdrTmSl8LVgq9PsC+3OA12xz1X2FUp6Wk bZ+Q== 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 :message-id:date:subject:cc:to:from; bh=I6Y/okL/7fPxUEobfsehjBgkNwf5PKUQ6xX7p9lOEVQ=; b=FJEscOhbbPjIC2ECHK+/vOL20hjbV1N1KxaooWQh6psw6G05IPrwCn1TvjKrbRynVh YgLEFkJOl7YpnDaQ83g6dsmKS7aTI5srqpj614cDdulw0AspQ5ZmnMB04altwEf71EBf UrTIW2Vccb7KvEaBdZ/KcH0hy2vetpOpUFadV6Iuid4jdEdnxejPMTn9GXW2eLwMoUuU HK3unYwvVS6y6ECxdtzqn6qa8qLnK5oKhiV+cQ20SOpUpUdHjHRXsBzeDn+oIyrgBQgk zYflqcQHyvlD+b/uP2BZY5BvOcNDfypMPrwc9v21Ocy8Z7ff0PZgigEXE3mNWL0KrnLT 201A== 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 w1si1468155ejc.440.2020.08.27.07.41.47; Thu, 27 Aug 2020 07:42:09 -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 S1727937AbgH0OlC (ORCPT + 99 others); Thu, 27 Aug 2020 10:41:02 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:56338 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727095AbgH0ODr (ORCPT ); Thu, 27 Aug 2020 10:03:47 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id A7A8929A33C Received: by jupiter.universe (Postfix, from userid 1000) id 6D88248010D; Thu, 27 Aug 2020 16:02:52 +0200 (CEST) From: Sebastian Reichel To: Andreas Kemnade , Sebastian Reichel Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Sebastian Reichel Subject: [PATCHv1] power: supply: document current direction Date: Thu, 27 Aug 2020 16:02:48 +0200 Message-Id: <20200827140248.37749-1-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the sign for CURRENT_NOW and CURRENT_AVG is a bit of a mess. There are basically 3 different ways battery fuel gauges report the current: 1. uses negative values for discharging and positive values for charging 2. uses positive values for discharging and negative values for discharging (opposit of 1) 3. only uses positive values As a result userspace currently cannot use the sign at all in a generic way. Let's solve the issue by documenting a canonical way for reporting the data and ensure new drivers follow this way. Then existing drivers can be fixed on a case-by-case basis. The 'negative value = battery discharging' has been choosen, since there are only very few drivers doing it the other way around. Signed-off-by: Sebastian Reichel --- Documentation/ABI/testing/sysfs-class-power | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power index 651599fb18f8..dbccb2fcd7ce 100644 --- a/Documentation/ABI/testing/sysfs-class-power +++ b/Documentation/ABI/testing/sysfs-class-power @@ -108,7 +108,8 @@ Description: which they average readings to smooth out the reported value. Access: Read - Valid values: Represented in microamps + Valid values: Represented in microamps. Negative values are used + for discharging batteries, positive values for charging batteries. What: /sys/class/power_supply//current_max Date: October 2010 @@ -127,7 +128,8 @@ Description: This value is not averaged/smoothed. Access: Read - Valid values: Represented in microamps + Valid values: Represented in microamps. Negative values are used + for discharging batteries, positive values for charging batteries. What: /sys/class/power_supply//charge_control_limit Date: Oct 2012 -- 2.28.0