aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/surface
diff options
context:
space:
mode:
authorKurt Borja <kuurtb@gmail.com>2025-01-15 19:27:07 -0500
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2025-01-16 17:26:30 +0200
commit58d5629dc8b8b8d9928fc649d9f2aaa361a8a5c5 (patch)
treeb66e4f7da4e1ab555cb23b74860c204748cbc4fc /drivers/platform/surface
parentACPI: platform_profile: Add `ops` member to handlers (diff)
downloadlinux-58d5629dc8b8b8d9928fc649d9f2aaa361a8a5c5.tar.gz
linux-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 <mario.limonciello@amd.com> Signed-off-by: Kurt Borja <kuurtb@gmail.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Link: https://lore.kernel.org/r/20250116002721.75592-6-kuurtb@gmail.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/platform/surface')
-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);
}