ACPI: platform-profile: Add a name member to handlers
authorMario Limonciello <mario.limonciello@amd.com>
Fri, 6 Dec 2024 03:18:57 +0000 (21:18 -0600)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 10 Dec 2024 17:17:45 +0000 (19:17 +0200)
In order to prepare for allowing multiple handlers, introduce
a name field that can be used to distinguish between different
handlers.

Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Matthew Schwartz <matthew.schwartz@linux.dev>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241206031918.1537-2-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/surface/surface_platform_profile.c
drivers/platform/x86/acer-wmi.c
drivers/platform/x86/amd/pmf/sps.c
drivers/platform/x86/asus-wmi.c
drivers/platform/x86/dell/alienware-wmi.c
drivers/platform/x86/dell/dell-pc.c
drivers/platform/x86/hp/hp-wmi.c
drivers/platform/x86/ideapad-laptop.c
drivers/platform/x86/inspur_platform_profile.c
drivers/platform/x86/thinkpad_acpi.c
include/linux/platform_profile.h

index 08db878f1d7d46ff234971186eca032e229cecba..9d3e3f9458186372c707fa4ef17dcdce6eead125 100644 (file)
@@ -211,6 +211,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev)
 
        tpd->sdev = sdev;
 
+       tpd->handler.name = "Surface Platform Profile";
        tpd->handler.profile_get = ssam_platform_profile_get;
        tpd->handler.profile_set = ssam_platform_profile_set;
 
index d09baa3d3d902ee31551dd4fbf2be374cbc0623c..53fbc9b4d3df7d418fe5c4058fe78586f798c317 100644 (file)
@@ -1878,6 +1878,7 @@ static int acer_platform_profile_setup(void)
        if (quirks->predator_v4) {
                int err;
 
+               platform_profile_handler.name = "acer-wmi";
                platform_profile_handler.profile_get =
                        acer_predator_v4_platform_profile_get;
                platform_profile_handler.profile_set =
index 92f7fb22277dca773a6b88f404bd94ea1e697a9c..e2d0cc92c4396a3f0777a5f58cb5f8fb4428f9fd 100644 (file)
@@ -405,6 +405,7 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev)
                amd_pmf_set_sps_power_limits(dev);
        }
 
+       dev->pprof.name = "amd-pmf";
        dev->pprof.profile_get = amd_pmf_profile_get;
        dev->pprof.profile_set = amd_pmf_profile_set;
 
index ba8b6d028f9fea0a2b1933fb225668adaaad2b9a..a08dc936276b9e2ee501470e7ba250df75d1b4fd 100644 (file)
@@ -3876,6 +3876,7 @@ static int platform_profile_setup(struct asus_wmi *asus)
 
        dev_info(dev, "Using throttle_thermal_policy for platform_profile support\n");
 
+       asus->platform_profile_handler.name = "asus-wmi";
        asus->platform_profile_handler.profile_get = asus_wmi_platform_profile_get;
        asus->platform_profile_handler.profile_set = asus_wmi_platform_profile_set;
 
index 77465ed9b449bfa96c427ba781a1818235641c91..f88d8984475116ac72749653902c63bcd5bd4718 100644 (file)
@@ -1156,6 +1156,7 @@ static int create_thermal_profile(void)
 
        pp_handler.profile_get = thermal_profile_get;
        pp_handler.profile_set = thermal_profile_set;
+       pp_handler.name = "alienware-wmi";
 
        return platform_profile_register(&pp_handler);
 }
index 972385ca1990b00738b73331baae484fa6d4b905..3cf79e55e3129d82e00f977b845602feaa2c0d20 100644 (file)
@@ -247,6 +247,7 @@ static int thermal_init(void)
        thermal_handler = kzalloc(sizeof(*thermal_handler), GFP_KERNEL);
        if (!thermal_handler)
                return -ENOMEM;
+       thermal_handler->name = "dell-pc";
        thermal_handler->profile_get = thermal_platform_profile_get;
        thermal_handler->profile_set = thermal_platform_profile_set;
 
index 81ccc96ffe40a3c0e3f3adee9cf0dabdf945534a..26cac73caf2b92f5c565ae50e8de8c913cdeab29 100644 (file)
@@ -1624,6 +1624,7 @@ static int thermal_profile_setup(void)
                set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices);
        }
 
+       platform_profile_handler.name = "hp-wmi";
        set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices);
        set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices);
 
index 5d2c1f0d1e9fbc2602fb74bbd1082f153645b9bb..cbdc965eeb2485dc78790316eb0dfbd96201765f 100644 (file)
@@ -1102,6 +1102,7 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv)
 
        mutex_init(&priv->dytc->mutex);
 
+       priv->dytc->pprof.name = "ideapad-laptop";
        priv->dytc->priv = priv;
        priv->dytc->pprof.profile_get = dytc_profile_get;
        priv->dytc->pprof.profile_set = dytc_profile_set;
index 8440defa67886a091d3afa0af7d3e6c6a10d454b..03da2c8cf6789fb59ecfc4a7f652d3cccf9d7b93 100644 (file)
@@ -177,6 +177,7 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context)
        priv->wdev = wdev;
        dev_set_drvdata(&wdev->dev, priv);
 
+       priv->handler.name = "inspur-wmi";
        priv->handler.profile_get = inspur_platform_profile_get;
        priv->handler.profile_set = inspur_platform_profile_set;
 
index 6371a9f765c139f2f1a4a37c7d1970f17145ce28..0e03c41e028d41f6a2334b3b481acd8f04d35a54 100644 (file)
@@ -10571,6 +10571,7 @@ static void dytc_profile_refresh(void)
 }
 
 static struct platform_profile_handler dytc_profile = {
+       .name = "thinkpad-acpi",
        .profile_get = dytc_profile_get,
        .profile_set = dytc_profile_set,
 };
index f5492ed413f363ee80272f2d44a68a1ad7158f51..6fa988e41742880325a8ea7af3cb727d3b9e324d 100644 (file)
@@ -27,6 +27,7 @@ enum platform_profile_option {
 };
 
 struct platform_profile_handler {
+       const char *name;
        unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
        int (*profile_get)(struct platform_profile_handler *pprof,
                                enum platform_profile_option *profile);