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