1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2019-2021, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef MOD_N1SDP_SENSOR_H
9 #define MOD_N1SDP_SENSOR_H
10 
11 #include <mod_sensor.h>
12 
13 #include <fwk_id.h>
14 
15 #include <stdint.h>
16 
17 /*!
18  * \addtogroup GroupN1SDPModule N1SDP Product Modules
19  * \{
20  */
21 
22 /*!
23  * \defgroup GroupN1SDPSensor N1SDP Sensor Support
24  *
25  * \brief Driver for reading on-chip temperature & voltage sensor values.
26  * \{
27  */
28 
29 /*!
30  * \brief Sensor type
31  */
32 enum sensor_type {
33     /*! Temperature sensor */
34     MOD_N1SDP_TEMP_SENSOR,
35 
36     /*! Voltage sensor */
37     MOD_N1SDP_VOLT_SENSOR,
38 };
39 
40 /*!
41  * \brief Temperature sensor indices.
42  */
43 enum mod_n1sdp_temp_sensor_idx {
44     /*! Cluster 0 temperature sensor */
45     MOD_N1SDP_TEMP_SENSOR_IDX_CLUSTER0,
46 
47     /*! Cluster 1 temperature sensor */
48     MOD_N1SDP_TEMP_SENSOR_IDX_CLUSTER1,
49 
50     /*! SYSTOP temperature sensor */
51     MOD_N1SDP_TEMP_SENSOR_IDX_SYSTEM,
52 
53     /*! Temperature sensor count */
54     MOD_N1SDP_TEMP_SENSOR_COUNT,
55 };
56 
57 /*!
58  * \brief Voltage sensor indices.
59  */
60 enum mod_n1sdp_volt_sensor_idx {
61     /*! Cluster 0 Core 0 voltage sensor */
62     MOD_N1SDP_VOLT_SENSOR_IDX_CLUS0CORE0 = MOD_N1SDP_TEMP_SENSOR_COUNT,
63 
64     /*! Cluster 0 Core 1 voltage sensor */
65     MOD_N1SDP_VOLT_SENSOR_IDX_CLUS0CORE1,
66 
67     /*! Cluster 1 Core 0 voltage sensor */
68     MOD_N1SDP_VOLT_SENSOR_IDX_CLUS1CORE0,
69 
70     /*! Cluster 1 Core 1 voltage sensor */
71     MOD_N1SDP_VOLT_SENSOR_IDX_CLUS1CORE1,
72 
73     /*! SYSTOP voltage sensor */
74     MOD_N1SDP_VOLT_SENSOR_IDX_SYSTEM,
75 
76     /*! Voltage sensor count */
77     MOD_N1SDP_VOLT_SENSOR_COUNT,
78 };
79 
80 
81 /*!
82  * \brief Temperature sensor element configuration.
83  */
84 struct mod_n1sdp_temp_sensor_config {
85     /*! Threshold value to raise an alarm */
86     int32_t alarm_threshold;
87 
88     /*! Threshold value to shutdown the temperature domain */
89     int32_t shutdown_threshold;
90 
91     /*! Auxiliary sensor information */
92     struct mod_sensor_info *info;
93 };
94 
95 /*!
96  * \brief Voltage sensor element configuration.
97  */
98 struct mod_n1sdp_volt_sensor_config {
99     /*! Auxiliary sensor information */
100     struct mod_sensor_info *info;
101 };
102 
103 /*!
104  * \brief N1SDP sensor - Module configuration.
105  */
106 struct mod_n1sdp_sensor_config {
107     /*! Identifier of timer alarm element */
108     fwk_id_t alarm_id;
109 
110     /*! Identifier of timer alarm API */
111     fwk_id_t alarm_api;
112 
113     /*! Temperature sensor count */
114     uint8_t t_sensor_count;
115 
116     /*! Voltage sensor count */
117     uint8_t v_sensor_count;
118 };
119 
120 /*!
121  * \}
122  */
123 
124 /*!
125  * \}
126  */
127 
128 #endif /* MOD_N1SDP_SENSOR_H */
129