1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Description:
8  *     Juno PVT Driver header file
9  */
10 
11 #ifndef MOD_JUNO_PVT_H
12 #define MOD_JUNO_PVT_H
13 
14 #include <fwk_id.h>
15 
16 #include <stdint.h>
17 
18 /*!
19  * \ingroup GroupJunoModule
20  * \defgroup GroupJunoPVT Juno PVT
21  * \{
22  * \brief The Juno SoC provides Power, Voltage, and Temperature (PVT) sensors
23  *      that can be used to power down the chip when it exceeds the maximum
24  *      operating temperature. These sensors may be located next to the cores,
25  *      gpu, or distributed on the SoC, and are grouped together within the same
26  *      location.
27  *      The PVT sensors are calibrated during board manufacture.
28  *
29  * \note Only one sensor per group can be read at a time.
30  */
31 
32 /*!
33  * \brief Sensor type indices.
34  */
35 enum juno_sensor_pvt_type {
36     /*! Temperature type PVT sensor */
37     JUNO_PVT_TYPE_TEMP,
38 
39     /*! Voltage type PVT sensor */
40     JUNO_PVT_TYPE_VOLT,
41 
42     /*! Type count of PVT sensors */
43     JUNO_PVT_TYPE_COUNT
44 };
45 
46 /*!
47  * \brief Sensor Group identifiers.
48  */
49 enum juno_group_pvt_id {
50     /*! BIG CPU group */
51     JUNO_PVT_GROUP_BIG = 0,
52 
53     /*! LITTLE CPU group */
54     JUNO_PVT_GROUP_LITTLE,
55 
56     /*! GPU group */
57     JUNO_PVT_GROUP_GPU,
58 
59     /*! SoC group */
60     JUNO_PVT_GROUP_SOC,
61 
62     /*! Standard Cell group */
63     JUNO_PVT_GROUP_STDCELL,
64 
65     /*! Number of groups */
66     JUNO_PVT_GROUP_COUNT
67 };
68 
69 /*!
70  * \brief Sensor Group Descriptor.
71  */
72 struct juno_group_desc {
73     /*! Configuration register */
74     struct juno_pvt_reg *regs;
75 
76     /*! Interrupt number */
77     unsigned int irq;
78 
79     /*! Sensor count for the group */
80     uint8_t sensor_count;
81 
82     /*! Identifier of the Power Domain associated with the sensor group */
83     fwk_id_t pd_id;
84 };
85 
86 /*!
87  * \brief Sensor Descriptor.
88  */
89 struct mod_juno_pvt_dev_config {
90     /*! The group the sensor belongs to */
91     const struct juno_group_desc *group;
92 
93     /*! The index of the sensor within its group */
94     uint8_t index;
95 
96     /*! Sensor type */
97     enum juno_sensor_pvt_type type;
98 
99     /*! Sensor information */
100     struct mod_sensor_info *info;
101 
102     /*! Calibration register, first point */
103     uint16_t *cal_reg_a;
104 
105     /*! Calibration register, second point */
106     uint16_t *cal_reg_b;
107 
108     /*! Calibration offset, first point */
109     uint16_t offset_cal_reg_a;
110 
111     /*! Calibration offset, second point */
112     uint16_t offset_cal_reg_b;
113 };
114 
115 /*!
116  * \}
117  */
118 
119 #endif /* MOD_JUNO_PVT_H */
120