1*b68fe1efSJean-Sébastien Pédron /*-
2*b68fe1efSJean-Sébastien Pédron * Copyright (c) 2025 The FreeBSD Foundation
3*b68fe1efSJean-Sébastien Pédron * Copyright (c) 2025 Jean-Sébastien Pédron
4*b68fe1efSJean-Sébastien Pédron *
5*b68fe1efSJean-Sébastien Pédron * This software was developed by Jean-Sébastien Pédron under sponsorship
6*b68fe1efSJean-Sébastien Pédron * from the FreeBSD Foundation.
7*b68fe1efSJean-Sébastien Pédron *
8*b68fe1efSJean-Sébastien Pédron * Redistribution and use in source and binary forms, with or without
9*b68fe1efSJean-Sébastien Pédron * modification, are permitted provided that the following conditions
10*b68fe1efSJean-Sébastien Pédron * are met:
11*b68fe1efSJean-Sébastien Pédron * 1. Redistributions of source code must retain the above copyright
12*b68fe1efSJean-Sébastien Pédron * notice, this list of conditions and the following disclaimer.
13*b68fe1efSJean-Sébastien Pédron * 2. Redistributions in binary form must reproduce the above copyright
14*b68fe1efSJean-Sébastien Pédron * notice, this list of conditions and the following disclaimer in the
15*b68fe1efSJean-Sébastien Pédron * documentation and/or other materials provided with the distribution.
16*b68fe1efSJean-Sébastien Pédron *
17*b68fe1efSJean-Sébastien Pédron * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18*b68fe1efSJean-Sébastien Pédron * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*b68fe1efSJean-Sébastien Pédron * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*b68fe1efSJean-Sébastien Pédron * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21*b68fe1efSJean-Sébastien Pédron * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*b68fe1efSJean-Sébastien Pédron * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*b68fe1efSJean-Sébastien Pédron * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*b68fe1efSJean-Sébastien Pédron * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*b68fe1efSJean-Sébastien Pédron * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*b68fe1efSJean-Sébastien Pédron * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*b68fe1efSJean-Sébastien Pédron * SUCH DAMAGE.
28*b68fe1efSJean-Sébastien Pédron */
29*b68fe1efSJean-Sébastien Pédron
30*b68fe1efSJean-Sébastien Pédron #ifndef _LINUXKPI_LINUX_ACPI_AMD_WBRF_H_
31*b68fe1efSJean-Sébastien Pédron #define _LINUXKPI_LINUX_ACPI_AMD_WBRF_H_
32*b68fe1efSJean-Sébastien Pédron
33*b68fe1efSJean-Sébastien Pédron #include <linux/device.h>
34*b68fe1efSJean-Sébastien Pédron #include <linux/notifier.h>
35*b68fe1efSJean-Sébastien Pédron
36*b68fe1efSJean-Sébastien Pédron #define MAX_NUM_OF_WBRF_RANGES 11
37*b68fe1efSJean-Sébastien Pédron
38*b68fe1efSJean-Sébastien Pédron #define WBRF_RECORD_ADD 0x0
39*b68fe1efSJean-Sébastien Pédron #define WBRF_RECORD_REMOVE 0x1
40*b68fe1efSJean-Sébastien Pédron
41*b68fe1efSJean-Sébastien Pédron struct freq_band_range {
42*b68fe1efSJean-Sébastien Pédron uint64_t start;
43*b68fe1efSJean-Sébastien Pédron uint64_t end;
44*b68fe1efSJean-Sébastien Pédron };
45*b68fe1efSJean-Sébastien Pédron
46*b68fe1efSJean-Sébastien Pédron struct wbrf_ranges_in_out {
47*b68fe1efSJean-Sébastien Pédron uint64_t num_of_ranges;
48*b68fe1efSJean-Sébastien Pédron struct freq_band_range band_list[MAX_NUM_OF_WBRF_RANGES];
49*b68fe1efSJean-Sébastien Pédron };
50*b68fe1efSJean-Sébastien Pédron
51*b68fe1efSJean-Sébastien Pédron enum wbrf_notifier_actions {
52*b68fe1efSJean-Sébastien Pédron WBRF_CHANGED,
53*b68fe1efSJean-Sébastien Pédron };
54*b68fe1efSJean-Sébastien Pédron
55*b68fe1efSJean-Sébastien Pédron /*
56*b68fe1efSJean-Sébastien Pédron * The following functions currently have dummy implementations that, on Linux,
57*b68fe1efSJean-Sébastien Pédron * are used when CONFIG_AMD_WBRF is not set at compile time.
58*b68fe1efSJean-Sébastien Pédron */
59*b68fe1efSJean-Sébastien Pédron
60*b68fe1efSJean-Sébastien Pédron static inline bool
acpi_amd_wbrf_supported_consumer(struct device * dev)61*b68fe1efSJean-Sébastien Pédron acpi_amd_wbrf_supported_consumer(struct device *dev)
62*b68fe1efSJean-Sébastien Pédron {
63*b68fe1efSJean-Sébastien Pédron return (false);
64*b68fe1efSJean-Sébastien Pédron }
65*b68fe1efSJean-Sébastien Pédron
66*b68fe1efSJean-Sébastien Pédron static inline int
acpi_amd_wbrf_add_remove(struct device * dev,uint8_t action,struct wbrf_ranges_in_out * in)67*b68fe1efSJean-Sébastien Pédron acpi_amd_wbrf_add_remove(struct device *dev, uint8_t action,
68*b68fe1efSJean-Sébastien Pédron struct wbrf_ranges_in_out *in)
69*b68fe1efSJean-Sébastien Pédron {
70*b68fe1efSJean-Sébastien Pédron return (-ENODEV);
71*b68fe1efSJean-Sébastien Pédron }
72*b68fe1efSJean-Sébastien Pédron
73*b68fe1efSJean-Sébastien Pédron static inline bool
acpi_amd_wbrf_supported_producer(struct device * dev)74*b68fe1efSJean-Sébastien Pédron acpi_amd_wbrf_supported_producer(struct device *dev)
75*b68fe1efSJean-Sébastien Pédron {
76*b68fe1efSJean-Sébastien Pédron return (false);
77*b68fe1efSJean-Sébastien Pédron }
78*b68fe1efSJean-Sébastien Pédron
79*b68fe1efSJean-Sébastien Pédron static inline int
amd_wbrf_retrieve_freq_band(struct device * dev,struct wbrf_ranges_in_out * out)80*b68fe1efSJean-Sébastien Pédron amd_wbrf_retrieve_freq_band(struct device *dev, struct wbrf_ranges_in_out *out)
81*b68fe1efSJean-Sébastien Pédron {
82*b68fe1efSJean-Sébastien Pédron return (-ENODEV);
83*b68fe1efSJean-Sébastien Pédron }
84*b68fe1efSJean-Sébastien Pédron
85*b68fe1efSJean-Sébastien Pédron static inline int
amd_wbrf_register_notifier(struct notifier_block * nb)86*b68fe1efSJean-Sébastien Pédron amd_wbrf_register_notifier(struct notifier_block *nb)
87*b68fe1efSJean-Sébastien Pédron {
88*b68fe1efSJean-Sébastien Pédron return (-ENODEV);
89*b68fe1efSJean-Sébastien Pédron }
90*b68fe1efSJean-Sébastien Pédron
91*b68fe1efSJean-Sébastien Pédron static inline int
amd_wbrf_unregister_notifier(struct notifier_block * nb)92*b68fe1efSJean-Sébastien Pédron amd_wbrf_unregister_notifier(struct notifier_block *nb)
93*b68fe1efSJean-Sébastien Pédron {
94*b68fe1efSJean-Sébastien Pédron return (-ENODEV);
95*b68fe1efSJean-Sébastien Pédron }
96*b68fe1efSJean-Sébastien Pédron
97*b68fe1efSJean-Sébastien Pédron #endif /* _LINUXKPI_LINUX_ACPI_AMD_WBRF_H_ */
98