printf: Remove unused 'bprintf'
[drm/drm-misc.git] / include / linux / dtpm.h
bloba4a13514b730658229b36d8586f5711f7c88bf75
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2020 Linaro Ltd
5 * Author: Daniel Lezcano <daniel.lezcano@linaro.org>
6 */
7 #ifndef ___DTPM_H__
8 #define ___DTPM_H__
10 #include <linux/powercap.h>
12 #define MAX_DTPM_DESCR 8
13 #define MAX_DTPM_CONSTRAINTS 1
15 struct dtpm {
16 struct powercap_zone zone;
17 struct dtpm *parent;
18 struct list_head sibling;
19 struct list_head children;
20 struct dtpm_ops *ops;
21 unsigned long flags;
22 u64 power_limit;
23 u64 power_max;
24 u64 power_min;
25 int weight;
28 struct dtpm_ops {
29 u64 (*set_power_uw)(struct dtpm *, u64);
30 u64 (*get_power_uw)(struct dtpm *);
31 int (*update_power_uw)(struct dtpm *);
32 void (*release)(struct dtpm *);
35 struct device_node;
37 struct dtpm_subsys_ops {
38 const char *name;
39 int (*init)(void);
40 void (*exit)(void);
41 int (*setup)(struct dtpm *, struct device_node *);
44 enum DTPM_NODE_TYPE {
45 DTPM_NODE_VIRTUAL = 0,
46 DTPM_NODE_DT,
49 struct dtpm_node {
50 enum DTPM_NODE_TYPE type;
51 const char *name;
52 struct dtpm_node *parent;
55 static inline struct dtpm *to_dtpm(struct powercap_zone *zone)
57 return container_of(zone, struct dtpm, zone);
60 int dtpm_update_power(struct dtpm *dtpm);
62 int dtpm_release_zone(struct powercap_zone *pcz);
64 void dtpm_init(struct dtpm *dtpm, struct dtpm_ops *ops);
66 void dtpm_unregister(struct dtpm *dtpm);
68 int dtpm_register(const char *name, struct dtpm *dtpm, struct dtpm *parent);
70 int dtpm_create_hierarchy(struct of_device_id *dtpm_match_table);
72 void dtpm_destroy_hierarchy(void);
73 #endif