From: Armin Wolf <W_Armin@gmx.de>
To: sre@kernel.org, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com
Cc: linux-pm@vger.kernel.org, platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] power: supply: test-power: Test access to extended power supply
Date: Fri, 27 Jun 2025 22:51:23 +0200 [thread overview]
Message-ID: <20250627205124.250433-2-W_Armin@gmx.de> (raw)
In-Reply-To: <20250627205124.250433-1-W_Armin@gmx.de>
Test that power supply extensions can access properties of their
power supply using power_supply_get_property_direct(). This both
ensures that the functionality works and serves as an example for
future driver developers.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
drivers/power/supply/test_power.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/power/supply/test_power.c b/drivers/power/supply/test_power.c
index 5bfdfcf6013b..2c0e9ad820c0 100644
--- a/drivers/power/supply/test_power.c
+++ b/drivers/power/supply/test_power.c
@@ -259,6 +259,7 @@ static const struct power_supply_config test_power_configs[] = {
static int test_power_battery_extmanufacture_year = 1234;
static int test_power_battery_exttemp_max = 1000;
static const enum power_supply_property test_power_battery_extprops[] = {
+ POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
POWER_SUPPLY_PROP_MANUFACTURE_YEAR,
POWER_SUPPLY_PROP_TEMP_MAX,
};
@@ -270,6 +271,9 @@ static int test_power_battery_extget_property(struct power_supply *psy,
union power_supply_propval *val)
{
switch (psp) {
+ case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
+ return power_supply_get_property_direct(psy, POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
+ val);
case POWER_SUPPLY_PROP_MANUFACTURE_YEAR:
val->intval = test_power_battery_extmanufacture_year;
break;
--
2.39.5
next prev parent reply other threads:[~2025-06-27 20:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-27 20:51 [PATCH 1/3] power: supply: core: Add power_supply_get/set_property_direct() Armin Wolf
2025-06-27 20:51 ` Armin Wolf [this message]
2025-07-06 23:13 ` [PATCH 2/3] power: supply: test-power: Test access to extended power supply Sebastian Reichel
2025-06-27 20:51 ` [PATCH 3/3] platform/x86: dell-ddv: Fix taking the psy->extensions_sem lock twice Armin Wolf
2025-06-28 9:25 ` [PATCH 1/3] power: supply: core: Add power_supply_get/set_property_direct() Hans de Goede
2025-06-28 21:34 ` Armin Wolf
2025-06-30 8:58 ` Ilpo Järvinen
2025-07-06 23:14 ` Sebastian Reichel
2025-07-06 23:11 ` Sebastian Reichel
2025-07-07 13:00 ` Ilpo Järvinen
2025-06-27 20:53 Armin Wolf
2025-06-27 20:53 ` [PATCH 2/3] power: supply: test-power: Test access to extended power supply Armin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250627205124.250433-2-W_Armin@gmx.de \
--to=w_armin@gmx.de \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®