include/linux/pm_opp.h

Source file repositories/reference/linux-study-clean/include/linux/pm_opp.h

File Facts

System
Linux kernel
Corpus path
include/linux/pm_opp.h
Extension
.h
Size
21031 bytes
Lines
762
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct dev_pm_opp_supply {
	unsigned long u_volt;
	unsigned long u_volt_min;
	unsigned long u_volt_max;
	unsigned long u_amp;
	unsigned long u_watt;
};

typedef int (*config_regulators_t)(struct device *dev,
			struct dev_pm_opp *old_opp, struct dev_pm_opp *new_opp,
			struct regulator **regulators, unsigned int count);

typedef int (*config_clks_t)(struct device *dev, struct opp_table *opp_table,
			struct dev_pm_opp *opp, void *data, bool scaling_down);

/**
 * struct dev_pm_opp_config - Device OPP configuration values
 * @clk_names: Clk names, NULL terminated array.
 * @config_clks: Custom set clk helper.
 * @prop_name: Name to postfix to properties.
 * @config_regulators: Custom set regulator helper.
 * @supported_hw: Array of hierarchy of versions to match.
 * @supported_hw_count: Number of elements in the array.
 * @regulator_names: Array of pointers to the names of the regulator, NULL terminated.
 * @required_dev: The required OPP device.
 * @required_dev_index: The index of the required OPP for the @required_dev.
 *
 * This structure contains platform specific OPP configurations for the device.
 */
struct dev_pm_opp_config {
	/* NULL terminated */
	const char * const *clk_names;
	config_clks_t config_clks;
	const char *prop_name;
	config_regulators_t config_regulators;
	const unsigned int *supported_hw;
	unsigned int supported_hw_count;
	const char * const *regulator_names;
	struct device *required_dev;
	unsigned int required_dev_index;
};

#define OPP_LEVEL_UNSET			U32_MAX

/**
 * struct dev_pm_opp_data - The data to use to initialize an OPP.
 * @turbo: Flag to indicate whether the OPP is to be marked turbo or not.
 * @level: The performance level for the OPP. Set level to OPP_LEVEL_UNSET if
 * level field isn't used.
 * @freq: The clock rate in Hz for the OPP.
 * @u_volt: The voltage in uV for the OPP.
 */
struct dev_pm_opp_data {
	bool turbo;
	unsigned int level;
	unsigned long freq;
	unsigned long u_volt;
};

/**
 * struct dev_pm_opp_key - Key used to identify OPP entries
 * @freq:       Frequency in Hz. Use 0 if frequency is not to be matched.
 * @level:      Performance level associated with the OPP entry.
 *              Use OPP_LEVEL_UNSET if level is not to be matched.
 * @bw:         Bandwidth associated with the OPP entry.
 *              Use 0 if bandwidth is not to be matched.
 *
 * This structure is used to uniquely identify an OPP entry based on
 * frequency, performance level, and bandwidth. Each field can be
 * selectively ignored during matching by setting it to its respective
 * NOP value.
 */
struct dev_pm_opp_key {
	unsigned long freq;
	unsigned int level;
	u32 bw;
};

#if defined(CONFIG_PM_OPP)

struct opp_table *dev_pm_opp_get_opp_table(struct device *dev);
struct opp_table *dev_pm_opp_get_opp_table_ref(struct opp_table *opp_table);
void dev_pm_opp_put_opp_table(struct opp_table *opp_table);

unsigned long dev_pm_opp_get_bw(struct dev_pm_opp *opp, bool peak, int index);

unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);

int dev_pm_opp_get_supplies(struct dev_pm_opp *opp, struct dev_pm_opp_supply *supplies);

Annotation

Implementation Notes