aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/surface/surface_platform_profile.c
diff options
context:
space:
mode:
authorKurt Borja <[email protected]>2025-01-16 00:27:07 +0000
committerIlpo Järvinen <[email protected]>2025-01-16 15:26:30 +0000
commit58d5629dc8b8b8d9928fc649d9f2aaa361a8a5c5 (patch)
treeb66e4f7da4e1ab555cb23b74860c204748cbc4fc /drivers/platform/surface/surface_platform_profile.c
parentACPI: platform_profile: Add `ops` member to handlers (diff)
downloadkernel-58d5629dc8b8b8d9928fc649d9f2aaa361a8a5c5.tar.gz
kernel-58d5629dc8b8b8d9928fc649d9f2aaa361a8a5c5.zip
ACPI: platform_profile: Add `probe` to platform_profile_ops
Add a `probe` callback to platform_profile_ops, which lets drivers initialize the choices member manually. This is a step towards unexposing the struct platform_profile_handler from the consumer drivers. Reviewed-by: Mario Limonciello <[email protected]> Signed-off-by: Kurt Borja <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Tested-by: Mark Pearson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
Diffstat (limited to 'drivers/platform/surface/surface_platform_profile.c')
-rw-r--r--drivers/platform/surface/surface_platform_profile.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c
index 76967bfeeef8..48cfe9cb89c8 100644
--- a/drivers/platform/surface/surface_platform_profile.c
+++ b/drivers/platform/surface/surface_platform_profile.c
@@ -201,7 +201,18 @@ static int ssam_platform_profile_set(struct device *dev,
return tp;
}
+static int ssam_platform_profile_probe(void *drvdata, unsigned long *choices)
+{
+ set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
+ set_bit(PLATFORM_PROFILE_BALANCED, choices);
+ set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices);
+ set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
+
+ return 0;
+}
+
static const struct platform_profile_ops ssam_platform_profile_ops = {
+ .probe = ssam_platform_profile_probe,
.profile_get = ssam_platform_profile_get,
.profile_set = ssam_platform_profile_set,
};
@@ -223,11 +234,6 @@ static int surface_platform_profile_probe(struct ssam_device *sdev)
tpd->has_fan = device_property_read_bool(&sdev->dev, "has_fan");
- set_bit(PLATFORM_PROFILE_LOW_POWER, tpd->handler.choices);
- set_bit(PLATFORM_PROFILE_BALANCED, tpd->handler.choices);
- set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, tpd->handler.choices);
- set_bit(PLATFORM_PROFILE_PERFORMANCE, tpd->handler.choices);
-
return platform_profile_register(&tpd->handler, tpd);
}