2020-12-29 19:18:26 -05:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
/*
|
|
|
|
|
* Platform profile sysfs interface
|
|
|
|
|
*
|
2021-05-19 10:51:38 +02:00
|
|
|
* See Documentation/userspace-api/sysfs-platform_profile.rst for more
|
2020-12-29 19:18:26 -05:00
|
|
|
* information.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _PLATFORM_PROFILE_H_
|
|
|
|
|
#define _PLATFORM_PROFILE_H_
|
|
|
|
|
|
2025-01-15 19:27:03 -05:00
|
|
|
#include <linux/device.h>
|
2020-12-29 19:18:26 -05:00
|
|
|
#include <linux/bitops.h>
|
|
|
|
|
|
|
|
|
|
/*
|
2021-02-11 21:17:01 +01:00
|
|
|
* If more options are added please update profile_names array in
|
|
|
|
|
* platform_profile.c and sysfs-platform_profile documentation.
|
2020-12-29 19:18:26 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
enum platform_profile_option {
|
|
|
|
|
PLATFORM_PROFILE_LOW_POWER,
|
|
|
|
|
PLATFORM_PROFILE_COOL,
|
|
|
|
|
PLATFORM_PROFILE_QUIET,
|
|
|
|
|
PLATFORM_PROFILE_BALANCED,
|
2021-02-11 21:17:02 +01:00
|
|
|
PLATFORM_PROFILE_BALANCED_PERFORMANCE,
|
2020-12-29 19:18:26 -05:00
|
|
|
PLATFORM_PROFILE_PERFORMANCE,
|
2025-11-27 07:16:03 -08:00
|
|
|
PLATFORM_PROFILE_MAX_POWER,
|
2024-12-05 21:19:12 -06:00
|
|
|
PLATFORM_PROFILE_CUSTOM,
|
2020-12-29 19:18:26 -05:00
|
|
|
PLATFORM_PROFILE_LAST, /*must always be last */
|
|
|
|
|
};
|
|
|
|
|
|
2025-01-15 19:27:20 -05:00
|
|
|
/**
|
|
|
|
|
* struct platform_profile_ops - platform profile operations
|
|
|
|
|
* @probe: Callback to setup choices available to the new class device. These
|
|
|
|
|
* choices will only be enforced when setting a new profile, not when
|
|
|
|
|
* getting the current one.
|
2025-02-28 11:01:53 -06:00
|
|
|
* @hidden_choices: Callback to setup choices that are not visible to the user
|
|
|
|
|
* but can be set by the driver.
|
2025-01-15 19:27:20 -05:00
|
|
|
* @profile_get: Callback that will be called when showing the current platform
|
|
|
|
|
* profile in sysfs.
|
|
|
|
|
* @profile_set: Callback that will be called when storing a new platform
|
|
|
|
|
* profile in sysfs.
|
|
|
|
|
*/
|
2025-01-15 19:27:06 -05:00
|
|
|
struct platform_profile_ops {
|
2025-01-15 19:27:07 -05:00
|
|
|
int (*probe)(void *drvdata, unsigned long *choices);
|
2025-02-28 11:01:53 -06:00
|
|
|
int (*hidden_choices)(void *drvdata, unsigned long *choices);
|
2025-01-15 19:27:06 -05:00
|
|
|
int (*profile_get)(struct device *dev, enum platform_profile_option *profile);
|
|
|
|
|
int (*profile_set)(struct device *dev, enum platform_profile_option profile);
|
|
|
|
|
};
|
|
|
|
|
|
2025-01-15 19:27:17 -05:00
|
|
|
struct device *platform_profile_register(struct device *dev, const char *name,
|
|
|
|
|
void *drvdata,
|
|
|
|
|
const struct platform_profile_ops *ops);
|
2025-02-12 14:03:08 -05:00
|
|
|
void platform_profile_remove(struct device *dev);
|
2025-01-15 19:27:17 -05:00
|
|
|
struct device *devm_platform_profile_register(struct device *dev, const char *name,
|
|
|
|
|
void *drvdata,
|
|
|
|
|
const struct platform_profile_ops *ops);
|
2024-04-08 19:35:10 +02:00
|
|
|
int platform_profile_cycle(void);
|
2025-01-15 19:27:17 -05:00
|
|
|
void platform_profile_notify(struct device *dev);
|
2020-12-29 19:18:26 -05:00
|
|
|
|
|
|
|
|
#endif /*_PLATFORM_PROFILE_H_*/
|