Skip to content

Commit 0bf08f9

Browse files
zeulegroeck
authored andcommitted
hwmon: (asus-ec-sensors) sort sensor definition arrays
The arrays have to be sorted by the sensor register bank and index because this is what the sensor reading function expects. So sort them and leave a comment for future contributors. Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com> Link: https://lore.kernel.org/r/20250408204505.11412-1-eugene.shalygin@gmail.com [groeck: Fixed alignment of new multi-line comment] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent ab2f6bf commit 0bf08f9

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

drivers/hwmon/asus-ec-sensors.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ enum board_family {
169169
family_intel_600_series
170170
};
171171

172-
/* All the known sensors for ASUS EC controllers */
172+
/*
173+
* All the known sensors for ASUS EC controllers. These arrays have to be sorted
174+
* by the full ((bank << 8) + index) register index (see asus_ec_block_read() as
175+
* to why).
176+
*/
173177
static const struct ec_sensor_info sensors_family_amd_400[] = {
174178
[ec_sensor_temp_chipset] =
175179
EC_SENSOR("Chipset", hwmon_temp, 1, 0x00, 0x3a),
@@ -183,21 +187,21 @@ static const struct ec_sensor_info sensors_family_amd_400[] = {
183187
EC_SENSOR("VRM", hwmon_temp, 1, 0x00, 0x3e),
184188
[ec_sensor_in_cpu_core] =
185189
EC_SENSOR("CPU Core", hwmon_in, 2, 0x00, 0xa2),
186-
[ec_sensor_fan_cpu_opt] =
187-
EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xbc),
188190
[ec_sensor_fan_vrm_hs] =
189191
EC_SENSOR("VRM HS", hwmon_fan, 2, 0x00, 0xb2),
192+
[ec_sensor_fan_cpu_opt] =
193+
EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xbc),
190194
[ec_sensor_fan_chipset] =
191195
/* no chipset fans in this generation */
192196
EC_SENSOR("Chipset", hwmon_fan, 0, 0x00, 0x00),
193197
[ec_sensor_fan_water_flow] =
194198
EC_SENSOR("Water_Flow", hwmon_fan, 2, 0x00, 0xb4),
195199
[ec_sensor_curr_cpu] =
196200
EC_SENSOR("CPU", hwmon_curr, 1, 0x00, 0xf4),
197-
[ec_sensor_temp_water_in] =
198-
EC_SENSOR("Water_In", hwmon_temp, 1, 0x01, 0x0d),
199201
[ec_sensor_temp_water_out] =
200202
EC_SENSOR("Water_Out", hwmon_temp, 1, 0x01, 0x0b),
203+
[ec_sensor_temp_water_in] =
204+
EC_SENSOR("Water_In", hwmon_temp, 1, 0x01, 0x0d),
201205
};
202206

203207
static const struct ec_sensor_info sensors_family_amd_500[] = {
@@ -239,19 +243,20 @@ static const struct ec_sensor_info sensors_family_amd_500[] = {
239243

240244
static const struct ec_sensor_info sensors_family_amd_600[] = {
241245
[ec_sensor_temp_cpu] = EC_SENSOR("CPU", hwmon_temp, 1, 0x00, 0x30),
242-
[ec_sensor_temp_cpu_package] = EC_SENSOR("CPU Package", hwmon_temp, 1, 0x00, 0x31),
246+
[ec_sensor_temp_cpu_package] =
247+
EC_SENSOR("CPU Package", hwmon_temp, 1, 0x00, 0x31),
243248
[ec_sensor_temp_mb] =
244249
EC_SENSOR("Motherboard", hwmon_temp, 1, 0x00, 0x32),
245250
[ec_sensor_temp_vrm] =
246251
EC_SENSOR("VRM", hwmon_temp, 1, 0x00, 0x33),
247252
[ec_sensor_temp_t_sensor] =
248253
EC_SENSOR("T_Sensor", hwmon_temp, 1, 0x00, 0x36),
254+
[ec_sensor_fan_cpu_opt] =
255+
EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xb0),
249256
[ec_sensor_temp_water_in] =
250257
EC_SENSOR("Water_In", hwmon_temp, 1, 0x01, 0x00),
251258
[ec_sensor_temp_water_out] =
252259
EC_SENSOR("Water_Out", hwmon_temp, 1, 0x01, 0x01),
253-
[ec_sensor_fan_cpu_opt] =
254-
EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xb0),
255260
};
256261

257262
static const struct ec_sensor_info sensors_family_intel_300[] = {

0 commit comments

Comments
 (0)