Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1985224rdb; Sun, 4 Feb 2024 09:27:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzA6MV0JEQJDpMH0+JRihbWpeKkYp3wRDlsEjx4WdG+4GSEoiE01kXuqU0hsV77m5AzyFs X-Received: by 2002:a17:902:ce8c:b0:1d9:ad4e:5614 with SMTP id f12-20020a170902ce8c00b001d9ad4e5614mr1401184plg.22.1707067654408; Sun, 04 Feb 2024 09:27:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707067654; cv=pass; d=google.com; s=arc-20160816; b=KE0oUf8+Mte+aDGwZgmTCg4635KXOkXv8tw9o+FCFTUSWlw9ZVxYMI7gT+VofHYbU8 Qjg4RWTvw8veUoYs7duRoNebYAtUvrPpfzUNVGxm9aoVpSG+dCiOHXv2yudORqryJZ5n 1iWPnPeb3XApgZ7/GmNEyJilJdjNJU79mog3qacCN0ytriQPQW+U0PGknJO918hAFQAP ItqXJqcGstaZhZ1aWpD4YUb0+KcuZSxkZsb517PGWO0E+fH6teqFGVeWKVehpBTBnlGz yPw1M6ry3LXfnXBsice41NtR2qAWrA+NeeCgkoDhHeXe63+0run3EY82n79Zm9h9iqZg Dl4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=r0TY0I3XSp1WSKj9eJrgghplPJ/srDCIE8rGEI+6+ms=; fh=S7YcVfXu6od5MYFG/Id/VnSvqwL6xNgwE1VXkwWGx8s=; b=NnKI+lY2yqaIhTVU98crHfebf73HfT6ovQMCyDP3Te7e5ExZ3em0dNY4kdxzLnD7Nb 4Ge6SDtlt/WtMPyj8G5XVqwAHxMgvt+GWYJCct+T33GsOwjoLU7YpXOTF5V4rPKpVMOz 2DLW29EloclKkPvJg1lHyB41nLReFYIvNW/BxAabS2pW+31diTXQCVDeJrUTwDSsRSX5 9HYqv7Rzlm/BBM/rO7hjhgu7GifSlqALoZ1UyCrQ/BKRSLkMCyRvfHssrW5HlywucXMv +DkzwIrwvLi/0e2uClLRIineHrNSnKcFR2Vjt8sCM0gRWBeixbZTM4Pa3VIo+uUulek5 hc/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=fhMew4Ad; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-51820-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51820-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWWKSCjhqgpCnb+rHktFom0Ab9EHbi/rybRiWkHI1rk7mAGutkjxBMi4KGKWAHnc8WDHVoVqfipr9X/oJEGQIoprxjSVtBjxftRFhvtRw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h23-20020a170902ac9700b001d701962b21si4961097plr.490.2024.02.04.09.27.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 09:27:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51820-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=fhMew4Ad; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-51820-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51820-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 157FE283109 for ; Sun, 4 Feb 2024 17:27:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2996A24A19; Sun, 4 Feb 2024 17:27:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="fhMew4Ad" Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28B82249EA; Sun, 4 Feb 2024 17:27:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707067628; cv=none; b=jPCQTbjwN7rblAPDmUbd5r7dZdncOTNRdlYGb3xPg7rRmvXBGfhFvaIoWQi4lB232/mtOXLlQ0mPD/xtE/7minYXAEhPThO56MUt18ABENK1Q7rppb0YbfkC7AAzd770ag2fNROctgHVM5XHUIrAjWQ/iwaVfZpNt45wGIDFYtM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707067628; c=relaxed/simple; bh=2bfpIaHPb+FVKiLlqv6onKrx8jugClAtzAL49QT9tj8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KiK54Rv1wCQuV2Cy5JWhv8TdcjTW3Oan3d46V8y/USJaJ/YpGnOkfcu5NQWjVOfs2YNIAwMvLqyiPnRb+RCADtJ8AgvoSzGv2OH6/6LZ63/l/+0fho+yHnGY+YTTeuMLVW3vfbDqeGPs4YLVgWOEWP0IJ5w8UJxyJ65s9eZEjNY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=fhMew4Ad; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1707067616; bh=2bfpIaHPb+FVKiLlqv6onKrx8jugClAtzAL49QT9tj8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=fhMew4AdtulXYoY2VpXWRvQfvCaONA9fIk0LjMdi2qR/prFTX4jXe/5paqNJRUXoT Ofa50BkT4C7yjQdfSZ2q3CFDq5AVxx+TpEOwXRu5Vj8y+9xbcll7Gjz1A8vP7PV+oj r0rb5D5DBG64iNSuJVBX64a1iWFdMce2R4x2dZpo= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 04 Feb 2024 18:26:49 +0100 Subject: [PATCH 3/4] power: supply: mm8013: implement POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR_AVAILABLE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240204-power_supply-charge_behaviour_prop-v1-3-06a20c958f96@weissschuh.net> References: <20240204-power_supply-charge_behaviour_prop-v1-0-06a20c958f96@weissschuh.net> In-Reply-To: <20240204-power_supply-charge_behaviour_prop-v1-0-06a20c958f96@weissschuh.net> To: Sebastian Reichel , Hans de Goede , Konrad Dybcio Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Reichel , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1707067615; l=1478; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=2bfpIaHPb+FVKiLlqv6onKrx8jugClAtzAL49QT9tj8=; b=YAQ1hO1l8kQ2VYBnblYST3jQhV0wwQngktbNHMJepEyv1/a45AjNO688GAhvqu6GTPruwmRT6 WJKAK1usPsRCQSUvaXcHAkVVdbH8TBXgd/RbKNCcpOKqPQVfpGM2BS8 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The sysfs is documented to report both the current and all available behaviours. For this POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR_AVAILABLE needs to be implemented. Note that this changes the format of the sysfs file (to the documented format): Before: "auto" After: "[auto] inhibit-charge" Signed-off-by: Thomas Weißschuh --- drivers/power/supply/mm8013.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/power/supply/mm8013.c b/drivers/power/supply/mm8013.c index caa272b03564..695df8bd6cb0 100644 --- a/drivers/power/supply/mm8013.c +++ b/drivers/power/supply/mm8013.c @@ -72,6 +72,7 @@ static int mm8013_checkdevice(struct mm8013_chip *chip) static enum power_supply_property mm8013_battery_props[] = { POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR, + POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR_AVAILABLE, POWER_SUPPLY_PROP_CHARGE_FULL, POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, POWER_SUPPLY_PROP_CHARGE_NOW, @@ -113,6 +114,10 @@ static int mm8013_get_property(struct power_supply *psy, else val->intval = POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO; break; + case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR_AVAILABLE: + val->intval = BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO) + | BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_INHIBIT_CHARGE); + break; case POWER_SUPPLY_PROP_CHARGE_FULL: ret = regmap_read(chip->regmap, REG_FULL_CHARGE_CAPACITY, ®val); if (ret < 0) -- 2.43.0