]>
git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - include/linux/dtpm.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2020 Linaro Ltd
5 * Author: Daniel Lezcano <daniel.lezcano@linaro.org>
10 #include <linux/powercap.h>
12 #define MAX_DTPM_DESCR 8
13 #define MAX_DTPM_CONSTRAINTS 1
16 struct powercap_zone zone
;
18 struct list_head sibling
;
19 struct list_head children
;
30 u64 (*set_power_uw
)(struct dtpm
*, u64
);
31 u64 (*get_power_uw
)(struct dtpm
*);
32 void (*release
)(struct dtpm
*);
37 typedef int (*dtpm_init_t
)(struct dtpm_descr
*);
45 /* Init section thermal table */
46 extern struct dtpm_descr
*__dtpm_table
[];
47 extern struct dtpm_descr
*__dtpm_table_end
[];
49 #define DTPM_TABLE_ENTRY(name) \
50 static typeof(name) *__dtpm_table_entry_##name \
51 __used __section("__dtpm_table") = &name
53 #define DTPM_DECLARE(name) DTPM_TABLE_ENTRY(name)
55 #define for_each_dtpm_table(__dtpm) \
56 for (__dtpm = __dtpm_table; \
57 __dtpm < __dtpm_table_end; \
60 static inline struct dtpm
*to_dtpm(struct powercap_zone
*zone
)
62 return container_of(zone
, struct dtpm
, zone
);
65 int dtpm_update_power(struct dtpm
*dtpm
, u64 power_min
, u64 power_max
);
67 int dtpm_release_zone(struct powercap_zone
*pcz
);
69 struct dtpm
*dtpm_alloc(struct dtpm_ops
*ops
);
71 void dtpm_unregister(struct dtpm
*dtpm
);
73 int dtpm_register(const char *name
, struct dtpm
*dtpm
, struct dtpm
*parent
);
75 int dtpm_register_cpu(struct dtpm
*parent
);