Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1985253rdb; Sun, 4 Feb 2024 09:27:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IGWVA7bXyUCP8tv2gI3DFS2+3SBjwKLciDaDO0GtAg4ay5JJwMd5a6wxU2ihVjEuBtknJ1x X-Received: by 2002:a05:6a20:d04f:b0:19e:5517:c33e with SMTP id hv15-20020a056a20d04f00b0019e5517c33emr7549445pzb.39.1707067660958; Sun, 04 Feb 2024 09:27:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707067660; cv=pass; d=google.com; s=arc-20160816; b=VsRm6i9IR7SZ9LCvklWjiiHJu6gT1xZGleBM176kvRk0IOqXuFl9Nu/J6t5qD0sG1n wQmPb7e8XYdpajsIoAph1/HTPZ2aDeCg/yv6AaHrZJW+hdVx9mfih935gNqDA+SOdG2T PNeeIfpTphuB0vH4VU8Mswg2DXmVbVrcC/AsNzrRfeZTLZaX37NP2MKeXp9Kdg5B1JcL VdUsUAk4VJWWyzLMhZIMLf/78ChTs2xs05kQu2mZTpQ65ZWf+XpoiprwnZydrJ/3aJ4X lf7rRjbQkrcC5YSF7esZurdhd8xYF56U7gfMU+NtuiXbFEOr5CSW7T1AXwgNeKbRLdjS JK1g== 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=Q/dyZ9brj1k4C5HirKPNGX1qgR92AW0svWYQbWmyLL8=; fh=qZSTk2FutxQ4AKvHojr2Rh5dNn0wP2jsUnL2aMKbJi4=; b=nfbDfhvU5fWhEklNxyE+iGGCUbjpmOaIgQPnIIr65MeIzIddxPE0Ymech2SIuxDbtD e7MCIfHzwBnXxrda/LjP337WfpmpCC8Sdlu/6fFG7AeH3HcDcmYZpjDJV8fhOzAMQUPV Uz3CISPU/XWbUQNtG+6DuY2Ti6NDnBda+Nxl2PafeuygvxRZC2cxeKRAZ6KOgfDEuT2+ UYK4CrlrMOgh5Oq4D7kjvaaP1PRJH2XHWPsSs2y8mT/cOgbFfzLwHsLfaqBIKNhl37Yx Nn8Wk2xgXNfPiYav+p7oOF4XwAH7z66/iNv+0LV1JpBzMUadubGthp+6zhpc0RNwxflO bBlw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=tyLZio+5; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-51819-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51819-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVMura9MRCiNAHIgSmvWqI4JexCzNhXs5S0G8fk19Hnk3ev4k4P/2NlT8xFaFxrJ6NFRAbjsx/d5N91Qb+CySzmyyhqKqtvKN/pFFccjQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lw6-20020a056a00750600b006dff3ca9e36si4716357pfb.370.2024.02.04.09.27.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 09:27:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51819-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=tyLZio+5; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-51819-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51819-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 53A3CB2093E for ; Sun, 4 Feb 2024 17:27:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2999B24A1A; 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="tyLZio+5" 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 28B45249E8; 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=EZ7FYJXUXQWJM/Xtf3+0xJCPGadATpKP/5XAontJt9KVuxUeB7UdXbUmdD6JOAp4KWQWcerDEhxj4/sZ4fOtcMdTqo3s2uR23F1dEyuPYWz3HHsxNspwWmzJeqY4ZdB9IzSrPkI+wbRLDfc2e9IjKXLtsZzYzYsxPXROdAo0E7U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707067628; c=relaxed/simple; bh=jhC9MrS/DvTlCbbFDLlt5Ex7tBPY1h+Ja6j31zHqUDY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nlO350l4PLBz0TdlfPLYd8s4EzW091M/4QKycQ0xmyTRhCE5lVqZOWOQiSdMCOGH5F2Z+4tjH15i0l7ujyrNxQw2+26DPYryog4/T9N4/ZSJ9gfbRqJ0lWc8R0J/A+ODOhCCYGn0I7J+kv7ORBbSmZ9uWqc26zhrcq7KbFeCtMM= 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=tyLZio+5; 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=jhC9MrS/DvTlCbbFDLlt5Ex7tBPY1h+Ja6j31zHqUDY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tyLZio+5j4b83kcLgkgcckSZaIgFsNQpbcTS228yUnQNV8ZI6km4TWXHLG1bCwH6C CWl20AY27g3aXB2SnNMk2/QLNALVygFjQbkzndbxx/lnW6vR3eBYHOZ8zMp7BFt3DT XSsjyK7mYpPFBMTaXQmpknrPiGoEYpVRWpS8OG3g= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 04 Feb 2024 18:26:48 +0100 Subject: [PATCH 2/4] power: supply: test-power: implement charge_behaviour property 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-2-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=1449; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=jhC9MrS/DvTlCbbFDLlt5Ex7tBPY1h+Ja6j31zHqUDY=; b=zSfoi6za/QSGlccGGbzM0jSxDfpkVUL9clLjL0HYWEfz4XEYhYCjmCPGJL/T6t+imjLVgXj4F SwJNzFhUwv5BECr78yk3M/Ssle1fo8sJaciCuX9QHRWxbIXPlGWbObj X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= To validate the special formatting of the "charge_behaviour" sysfs property add it to the example driver. Signed-off-by: Thomas Weißschuh --- drivers/power/supply/test_power.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/power/supply/test_power.c b/drivers/power/supply/test_power.c index 0d0a77584c5d..4da0420996c9 100644 --- a/drivers/power/supply/test_power.c +++ b/drivers/power/supply/test_power.c @@ -123,6 +123,14 @@ static int test_power_get_battery_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CURRENT_NOW: val->intval = battery_current; break; + case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR: + val->intval = POWER_SUPPLY_CHARGE_BEHAVIOUR_INHIBIT_CHARGE; + break; + case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR_AVAILABLE: + val->intval = BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO) + | BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_INHIBIT_CHARGE) + | BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_FORCE_DISCHARGE); + break; default: pr_info("%s: some properties deliberately report errors.\n", __func__); @@ -156,6 +164,8 @@ static enum power_supply_property test_power_battery_props[] = { POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_CURRENT_AVG, POWER_SUPPLY_PROP_CURRENT_NOW, + POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR, + POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR_AVAILABLE, }; static char *test_power_ac_supplied_to[] = { -- 2.43.0