• Home
  • Raw
  • Download

Lines Matching +full:power +full:- +full:sensor

1 // SPDX-License-Identifier: GPL-2.0+
7 * sensor values, except for devices that communicate through the
97 /* Info, sensor sizes and offsets for most Aquacomputer devices */
122 /* Sensor report offsets for Aquaero fan controllers */
146 /* Sensor report offsets for the D5 Next pump */
157 #define D5NEXT_TEMP_CTRL_OFFSET 0x2D /* Temperature sensor offsets location */
158 static u16 d5next_ctrl_fan_offsets[] = { 0x97, 0x42 }; /* Pump and fan speed (from 0-100%) */
165 /* Sensor report offsets for the Aquastream Ultimate pump */
180 /* Spec and sensor report offset for the Farbwerk RGB controller */
189 /* Sensor report offsets for the Farbwerk 360 */
202 /* Sensor report offsets for the Octo */
210 /* Fan speed offsets (0-100%) */
220 /* Sensor report offsets for the Quadro */
230 static u16 quadro_ctrl_fan_offsets[] = { 0x37, 0x8c, 0xe1, 0x136 }; /* Fan speed offsets (0-100%) */
232 /* Specs of High Flow Next flow sensor */
236 /* Sensor report offsets for the High Flow Next */
248 /* Sensor report offsets for Leakshield */
270 /* Sensor report offsets and info for Aquastream XT */
282 /* Sensor report offsets for the Poweradjust 3 */
296 "Pump power",
297 "Fan power"
314 "Sensor 1",
315 "Sensor 2",
316 "Sensor 3",
317 "Sensor 4",
318 "Sensor 5",
319 "Sensor 6",
320 "Sensor 7",
321 "Sensor 8"
325 "Virtual sensor 1",
326 "Virtual sensor 2",
327 "Virtual sensor 3",
328 "Virtual sensor 4",
329 "Virtual sensor 5",
330 "Virtual sensor 6",
331 "Virtual sensor 7",
332 "Virtual sensor 8",
333 "Virtual sensor 9",
334 "Virtual sensor 10",
335 "Virtual sensor 11",
336 "Virtual sensor 12",
337 "Virtual sensor 13",
338 "Virtual sensor 14",
339 "Virtual sensor 15",
340 "Virtual sensor 16",
344 "Calc. virtual sensor 1",
345 "Calc. virtual sensor 2",
346 "Calc. virtual sensor 3",
347 "Calc. virtual sensor 4"
363 "Fan 1 power",
364 "Fan 2 power",
365 "Fan 3 power",
366 "Fan 4 power",
367 "Fan 5 power",
368 "Fan 6 power",
369 "Fan 7 power",
370 "Fan 8 power"
410 "Flow sensor 1 [dL/h]",
411 "Flow sensor 2 [dL/h]"
417 "External sensor"
427 "Dissipated power",
443 "User-Provided Pump Speed",
444 "User-Provided Flow [dL/h]",
452 "External sensor",
470 "Fan power",
471 "Pump power"
486 "External sensor"
492 u8 power; member
500 .power = AQUAERO_FAN_POWER_OFFSET,
508 .power = AQUASTREAMULT_FAN_POWER_OFFSET,
516 .power = AQC_FAN_POWER_OFFSET,
568 /* Sensor values */
590 /* Converts from centi-percent */
596 /* Converts to centi-percent */
600 return -EINVAL; in aqc_pwm_to_percent()
627 if (priv->ctrl_report_delay) { in aqc_delay_ctrl_report()
628 s64 delta = ktime_ms_delta(ktime_get(), priv->last_ctrl_report_op); in aqc_delay_ctrl_report()
630 if (delta < priv->ctrl_report_delay) in aqc_delay_ctrl_report()
631 msleep(priv->ctrl_report_delay - delta); in aqc_delay_ctrl_report()
642 memset(priv->buffer, 0x00, priv->buffer_size); in aqc_get_ctrl_data()
643 ret = hid_hw_raw_request(priv->hdev, priv->ctrl_report_id, priv->buffer, priv->buffer_size, in aqc_get_ctrl_data()
646 ret = -ENODATA; in aqc_get_ctrl_data()
648 priv->last_ctrl_report_op = ktime_get(); in aqc_get_ctrl_data()
662 if (priv->kind != aquaero) { in aqc_send_ctrl_data()
663 /* Init and xorout value for CRC-16/USB is 0xffff */ in aqc_send_ctrl_data()
664 checksum = crc16(0xffff, priv->buffer + priv->checksum_start, in aqc_send_ctrl_data()
665 priv->checksum_length); in aqc_send_ctrl_data()
669 put_unaligned_be16(checksum, priv->buffer + priv->checksum_offset); in aqc_send_ctrl_data()
673 ret = hid_hw_raw_request(priv->hdev, priv->ctrl_report_id, priv->buffer, priv->buffer_size, in aqc_send_ctrl_data()
679 ret = hid_hw_raw_request(priv->hdev, priv->secondary_ctrl_report_id, in aqc_send_ctrl_data()
680 priv->secondary_ctrl_report, priv->secondary_ctrl_report_size, in aqc_send_ctrl_data()
684 priv->last_ctrl_report_op = ktime_get(); in aqc_send_ctrl_data()
694 mutex_lock(&priv->mutex); in aqc_get_ctrl_val()
702 *val = (s16)get_unaligned_be16(priv->buffer + offset); in aqc_get_ctrl_val()
705 *val = priv->buffer[offset]; in aqc_get_ctrl_val()
708 ret = -EINVAL; in aqc_get_ctrl_val()
712 mutex_unlock(&priv->mutex); in aqc_get_ctrl_val()
720 mutex_lock(&priv->mutex); in aqc_set_ctrl_vals()
729 put_unaligned_be16((s16)vals[i], priv->buffer + offsets[i]); in aqc_set_ctrl_vals()
732 priv->buffer[offsets[i]] = (u8)vals[i]; in aqc_set_ctrl_vals()
735 ret = -EINVAL; in aqc_set_ctrl_vals()
745 mutex_unlock(&priv->mutex); in aqc_set_ctrl_vals()
760 if (channel < priv->num_temp_sensors) { in aqc_is_visible()
766 if (priv->temp_ctrl_offset != 0) in aqc_is_visible()
775 priv->num_temp_sensors + priv->num_virtual_temp_sensors + in aqc_is_visible()
776 priv->num_calc_virt_temp_sensors) in aqc_is_visible()
786 if (priv->fan_ctrl_offsets && channel < priv->num_fans) { in aqc_is_visible()
799 switch (priv->kind) { in aqc_is_visible()
803 * pressure and flow sensor in aqc_is_visible()
809 /* Special case to support flow sensor, water quality in aqc_is_visible()
823 if (channel < priv->num_fans + priv->num_flow_sensors) in aqc_is_visible()
827 if (channel < priv->num_fans) in aqc_is_visible()
833 /* Special case for Quadro flow sensor */ in aqc_is_visible()
834 if (priv->kind == quadro && channel == priv->num_fans) in aqc_is_visible()
840 /* Special case for Leakshield pressure sensor */ in aqc_is_visible()
841 if (priv->kind == leakshield && channel == 0) in aqc_is_visible()
849 switch (priv->kind) { in aqc_is_visible()
851 /* Special case to support pump and fan power */ in aqc_is_visible()
856 /* Special case to support one power sensor */ in aqc_is_visible()
863 if (channel < priv->num_fans) in aqc_is_visible()
869 switch (priv->kind) { in aqc_is_visible()
881 if (channel < priv->num_fans) in aqc_is_visible()
887 switch (priv->kind) { in aqc_is_visible()
890 if (channel < priv->num_fans + 2) in aqc_is_visible()
900 if (channel < priv->num_fans) in aqc_is_visible()
912 /* Read device sensors by manually requesting the sensor report (legacy way) */
917 mutex_lock(&priv->mutex); in aqc_legacy_read()
919 memset(priv->buffer, 0x00, priv->buffer_size); in aqc_legacy_read()
920 ret = hid_hw_raw_request(priv->hdev, priv->status_report_id, priv->buffer, in aqc_legacy_read()
921 priv->buffer_size, HID_FEATURE_REPORT, HID_REQ_GET_REPORT); in aqc_legacy_read()
925 /* Temperature sensor readings */ in aqc_legacy_read()
926 for (i = 0; i < priv->num_temp_sensors; i++) { in aqc_legacy_read()
927 sensor_value = get_unaligned_le16(priv->buffer + priv->temp_sensor_start_offset + in aqc_legacy_read()
929 priv->temp_input[i] = sensor_value * 10; in aqc_legacy_read()
932 /* Special-case sensor readings */ in aqc_legacy_read()
933 switch (priv->kind) { in aqc_legacy_read()
936 priv->serial_number[0] = get_unaligned_le16(priv->buffer + in aqc_legacy_read()
937 priv->serial_number_start_offset); in aqc_legacy_read()
938 priv->firmware_version = in aqc_legacy_read()
939 get_unaligned_le16(priv->buffer + priv->firmware_version_offset); in aqc_legacy_read()
942 sensor_value = get_unaligned_le16(priv->buffer + priv->fan_sensor_offsets[0]); in aqc_legacy_read()
943 priv->speed_input[0] = aqc_aquastreamxt_convert_pump_rpm(sensor_value); in aqc_legacy_read()
946 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_FAN_STATUS_OFFSET); in aqc_legacy_read()
948 priv->speed_input[1] = 0; in aqc_legacy_read()
951 get_unaligned_le16(priv->buffer + priv->fan_sensor_offsets[1]); in aqc_legacy_read()
952 priv->speed_input[1] = aqc_aquastreamxt_convert_fan_rpm(sensor_value); in aqc_legacy_read()
956 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_PUMP_CURR_OFFSET); in aqc_legacy_read()
957 priv->current_input[0] = DIV_ROUND_CLOSEST(sensor_value * 176, 100) - 52; in aqc_legacy_read()
959 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_PUMP_VOLTAGE_OFFSET); in aqc_legacy_read()
960 priv->voltage_input[0] = DIV_ROUND_CLOSEST(sensor_value * 1000, 61); in aqc_legacy_read()
962 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_FAN_VOLTAGE_OFFSET); in aqc_legacy_read()
963 priv->voltage_input[1] = DIV_ROUND_CLOSEST(sensor_value * 1000, 63); in aqc_legacy_read()
969 priv->updated = jiffies; in aqc_legacy_read()
972 mutex_unlock(&priv->mutex); in aqc_legacy_read()
982 if (time_after(jiffies, priv->updated + STATUS_UPDATE_INTERVAL)) { in aqc_read()
983 if (priv->status_report_id != 0) { in aqc_read()
987 return -ENODATA; in aqc_read()
989 return -ENODATA; in aqc_read()
997 if (priv->temp_input[channel] == -ENODATA) in aqc_read()
998 return -ENODATA; in aqc_read()
1000 *val = priv->temp_input[channel]; in aqc_read()
1004 aqc_get_ctrl_val(priv, priv->temp_ctrl_offset + in aqc_read()
1018 if (priv->speed_input[channel] == -ENODATA) in aqc_read()
1019 return -ENODATA; in aqc_read()
1021 *val = priv->speed_input[channel]; in aqc_read()
1024 *val = priv->speed_input_min[channel]; in aqc_read()
1027 *val = priv->speed_input_max[channel]; in aqc_read()
1030 *val = priv->speed_input_target[channel]; in aqc_read()
1033 ret = aqc_get_ctrl_val(priv, priv->flow_pulses_ctrl_offset, in aqc_read()
1043 *val = priv->power_input[channel]; in aqc_read()
1046 switch (priv->kind) { in aqc_read()
1056 ret = aqc_get_ctrl_val(priv, priv->fan_ctrl_offsets[channel], in aqc_read()
1066 *val = priv->voltage_input[channel]; in aqc_read()
1069 *val = priv->current_input[channel]; in aqc_read()
1072 return -EOPNOTSUPP; in aqc_read()
1084 int num_non_calc_sensors = priv->num_temp_sensors + priv->num_virtual_temp_sensors; in aqc_read_string()
1088 if (channel < priv->num_temp_sensors) { in aqc_read_string()
1089 *str = priv->temp_label[channel]; in aqc_read_string()
1091 if (priv->kind == aquaero && channel >= num_non_calc_sensors) in aqc_read_string()
1093 priv->calc_virt_temp_label[channel - num_non_calc_sensors]; in aqc_read_string()
1095 *str = priv->virtual_temp_label[channel - priv->num_temp_sensors]; in aqc_read_string()
1099 *str = priv->speed_label[channel]; in aqc_read_string()
1102 *str = priv->power_label[channel]; in aqc_read_string()
1105 *str = priv->voltage_label[channel]; in aqc_read_string()
1108 *str = priv->current_label[channel]; in aqc_read_string()
1111 return -EOPNOTSUPP; in aqc_read_string()
1131 /* Limit temp offset to +/- 15K as in the official software */ in aqc_write()
1132 val = clamp_val(val, -15000, 15000) / 10; in aqc_write()
1134 aqc_set_ctrl_val(priv, priv->temp_ctrl_offset + in aqc_write()
1140 return -EOPNOTSUPP; in aqc_write()
1147 ret = aqc_set_ctrl_val(priv, priv->flow_pulses_ctrl_offset, in aqc_write()
1163 switch (priv->kind) { in aqc_write()
1172 ctrl_values_offsets[1] = priv->fan_ctrl_offsets[channel] + in aqc_write()
1177 /* Set minimum power to 0 to allow the fan to turn off */ in aqc_write()
1178 ctrl_values_offsets[2] = priv->fan_ctrl_offsets[channel] + in aqc_write()
1183 /* Set maximum power to 255 to allow the fan to reach max speed */ in aqc_write()
1184 ctrl_values_offsets[3] = priv->fan_ctrl_offsets[channel] + in aqc_write()
1195 ret = aqc_set_ctrl_val(priv, priv->fan_ctrl_offsets[channel], in aqc_write()
1207 return -EOPNOTSUPP; in aqc_write()
1252 HWMON_CHANNEL_INFO(power,
1301 if (report->id != STATUS_REPORT_ID) in aqc_raw_event()
1307 priv->serial_number[0] = get_unaligned_be16(data + priv->serial_number_start_offset); in aqc_raw_event()
1308 priv->serial_number[1] = get_unaligned_be16(data + priv->serial_number_start_offset + in aqc_raw_event()
1310 priv->firmware_version = get_unaligned_be16(data + priv->firmware_version_offset); in aqc_raw_event()
1312 /* Physical temperature sensor readings */ in aqc_raw_event()
1313 for (i = 0; i < priv->num_temp_sensors; i++) { in aqc_raw_event()
1315 priv->temp_sensor_start_offset + in aqc_raw_event()
1318 priv->temp_input[i] = -ENODATA; in aqc_raw_event()
1320 priv->temp_input[i] = sensor_value * 10; in aqc_raw_event()
1323 /* Virtual temperature sensor readings */ in aqc_raw_event()
1324 for (j = 0; j < priv->num_virtual_temp_sensors; j++) { in aqc_raw_event()
1326 priv->virtual_temp_sensor_start_offset + in aqc_raw_event()
1329 priv->temp_input[i] = -ENODATA; in aqc_raw_event()
1331 priv->temp_input[i] = sensor_value * 10; in aqc_raw_event()
1336 for (i = 0; i < priv->num_fans; i++) { in aqc_raw_event()
1337 priv->speed_input[i] = in aqc_raw_event()
1338 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1339 priv->fan_structure->speed); in aqc_raw_event()
1340 priv->power_input[i] = in aqc_raw_event()
1341 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1342 priv->fan_structure->power) * 10000; in aqc_raw_event()
1343 priv->voltage_input[i] = in aqc_raw_event()
1344 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1345 priv->fan_structure->voltage) * 10; in aqc_raw_event()
1346 priv->current_input[i] = in aqc_raw_event()
1347 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1348 priv->fan_structure->curr); in aqc_raw_event()
1351 /* Flow sensor readings */ in aqc_raw_event()
1352 for (j = 0; j < priv->num_flow_sensors; j++) { in aqc_raw_event()
1353 priv->speed_input[i] = get_unaligned_be16(data + priv->flow_sensors_start_offset + in aqc_raw_event()
1358 if (priv->power_cycle_count_offset != 0) in aqc_raw_event()
1359 priv->power_cycles = get_unaligned_be32(data + priv->power_cycle_count_offset); in aqc_raw_event()
1361 /* Special-case sensor readings */ in aqc_raw_event()
1362 switch (priv->kind) { in aqc_raw_event()
1365 i = priv->num_temp_sensors + priv->num_virtual_temp_sensors; in aqc_raw_event()
1366 for (j = 0; j < priv->num_calc_virt_temp_sensors; j++) { in aqc_raw_event()
1368 priv->calc_virt_temp_sensor_start_offset + in aqc_raw_event()
1371 priv->temp_input[i] = -ENODATA; in aqc_raw_event()
1373 priv->temp_input[i] = sensor_value * 10; in aqc_raw_event()
1378 priv->speed_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_OFFSET); in aqc_raw_event()
1379 priv->speed_input[2] = get_unaligned_be16(data + AQUASTREAMULT_PRESSURE_OFFSET); in aqc_raw_event()
1380 priv->speed_input[3] = get_unaligned_be16(data + AQUASTREAMULT_FLOW_SENSOR_OFFSET); in aqc_raw_event()
1382 priv->power_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_POWER) * 10000; in aqc_raw_event()
1384 priv->voltage_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_VOLTAGE) * 10; in aqc_raw_event()
1386 priv->current_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_CURRENT); in aqc_raw_event()
1389 priv->voltage_input[2] = get_unaligned_be16(data + D5NEXT_5V_VOLTAGE) * 10; in aqc_raw_event()
1390 priv->voltage_input[3] = get_unaligned_be16(data + D5NEXT_12V_VOLTAGE) * 10; in aqc_raw_event()
1393 /* If external temp sensor is not connected, its power reading is also N/A */ in aqc_raw_event()
1394 if (priv->temp_input[1] == -ENODATA) in aqc_raw_event()
1395 priv->power_input[0] = -ENODATA; in aqc_raw_event()
1397 priv->power_input[0] = in aqc_raw_event()
1400 priv->voltage_input[0] = get_unaligned_be16(data + HIGHFLOWNEXT_5V_VOLTAGE) * 10; in aqc_raw_event()
1401 priv->voltage_input[1] = in aqc_raw_event()
1404 priv->speed_input[1] = get_unaligned_be16(data + HIGHFLOWNEXT_WATER_QUALITY); in aqc_raw_event()
1405 priv->speed_input[2] = get_unaligned_be16(data + HIGHFLOWNEXT_CONDUCTIVITY); in aqc_raw_event()
1408 priv->speed_input[0] = in aqc_raw_event()
1410 priv->speed_input_min[0] = get_unaligned_be16(data + LEAKSHIELD_PRESSURE_MIN) * 100; in aqc_raw_event()
1411 priv->speed_input_target[0] = in aqc_raw_event()
1413 priv->speed_input_max[0] = get_unaligned_be16(data + LEAKSHIELD_PRESSURE_MAX) * 100; in aqc_raw_event()
1415 priv->speed_input[1] = get_unaligned_be16(data + LEAKSHIELD_PUMP_RPM_IN); in aqc_raw_event()
1416 if (priv->speed_input[1] == AQC_SENSOR_NA) in aqc_raw_event()
1417 priv->speed_input[1] = -ENODATA; in aqc_raw_event()
1419 priv->speed_input[2] = get_unaligned_be16(data + LEAKSHIELD_FLOW_IN); in aqc_raw_event()
1420 if (priv->speed_input[2] == AQC_SENSOR_NA) in aqc_raw_event()
1421 priv->speed_input[2] = -ENODATA; in aqc_raw_event()
1423 priv->speed_input[3] = get_unaligned_be16(data + LEAKSHIELD_RESERVOIR_VOLUME); in aqc_raw_event()
1424 priv->speed_input[4] = get_unaligned_be16(data + LEAKSHIELD_RESERVOIR_FILLED); in aqc_raw_event()
1426 /* Second temp sensor is not positioned after the first one, read it here */ in aqc_raw_event()
1427 priv->temp_input[1] = get_unaligned_be16(data + LEAKSHIELD_TEMPERATURE_2) * 10; in aqc_raw_event()
1433 priv->updated = jiffies; in aqc_raw_event()
1442 struct aqc_data *priv = seqf->private; in serial_number_show()
1444 seq_printf(seqf, "%05u-%05u\n", priv->serial_number[0], priv->serial_number[1]); in serial_number_show()
1452 struct aqc_data *priv = seqf->private; in firmware_version_show()
1454 seq_printf(seqf, "%u\n", priv->firmware_version); in firmware_version_show()
1462 struct aqc_data *priv = seqf->private; in power_cycles_show()
1464 seq_printf(seqf, "%u\n", priv->power_cycles); in power_cycles_show()
1474 scnprintf(name, sizeof(name), "%s_%s-%s", "aquacomputer", priv->name, in aqc_debugfs_init()
1475 dev_name(&priv->hdev->dev)); in aqc_debugfs_init()
1477 priv->debugfs = debugfs_create_dir(name, NULL); in aqc_debugfs_init()
1479 if (priv->serial_number_start_offset != 0) in aqc_debugfs_init()
1480 debugfs_create_file("serial_number", 0444, priv->debugfs, priv, in aqc_debugfs_init()
1482 if (priv->firmware_version_offset != 0) in aqc_debugfs_init()
1483 debugfs_create_file("firmware_version", 0444, priv->debugfs, priv, in aqc_debugfs_init()
1485 if (priv->power_cycle_count_offset != 0) in aqc_debugfs_init()
1486 debugfs_create_file("power_cycles", 0444, priv->debugfs, priv, &power_cycles_fops); in aqc_debugfs_init()
1502 priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); in aqc_probe()
1504 return -ENOMEM; in aqc_probe()
1506 priv->hdev = hdev; in aqc_probe()
1509 priv->updated = jiffies - STATUS_UPDATE_INTERVAL; in aqc_probe()
1523 switch (hdev->product) { in aqc_probe()
1536 if (hdev->collection[1].type != 0) { in aqc_probe()
1537 ret = -ENODEV; in aqc_probe()
1541 priv->kind = aquaero; in aqc_probe()
1543 priv->num_fans = AQUAERO_NUM_FANS; in aqc_probe()
1544 priv->fan_sensor_offsets = aquaero_sensor_fan_offsets; in aqc_probe()
1545 priv->fan_ctrl_offsets = aquaero_ctrl_fan_offsets; in aqc_probe()
1547 priv->num_temp_sensors = AQUAERO_NUM_SENSORS; in aqc_probe()
1548 priv->temp_sensor_start_offset = AQUAERO_SENSOR_START; in aqc_probe()
1549 priv->num_virtual_temp_sensors = AQUAERO_NUM_VIRTUAL_SENSORS; in aqc_probe()
1550 priv->virtual_temp_sensor_start_offset = AQUAERO_VIRTUAL_SENSOR_START; in aqc_probe()
1551 priv->num_calc_virt_temp_sensors = AQUAERO_NUM_CALC_VIRTUAL_SENSORS; in aqc_probe()
1552 priv->calc_virt_temp_sensor_start_offset = AQUAERO_CALC_VIRTUAL_SENSOR_START; in aqc_probe()
1553 priv->num_flow_sensors = AQUAERO_NUM_FLOW_SENSORS; in aqc_probe()
1554 priv->flow_sensors_start_offset = AQUAERO_FLOW_SENSORS_START; in aqc_probe()
1556 priv->buffer_size = AQUAERO_CTRL_REPORT_SIZE; in aqc_probe()
1557 priv->temp_ctrl_offset = AQUAERO_TEMP_CTRL_OFFSET; in aqc_probe()
1558 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1560 priv->temp_label = label_temp_sensors; in aqc_probe()
1561 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1562 priv->calc_virt_temp_label = label_aquaero_calc_temp_sensors; in aqc_probe()
1563 priv->speed_label = label_aquaero_speeds; in aqc_probe()
1564 priv->power_label = label_fan_power; in aqc_probe()
1565 priv->voltage_label = label_fan_voltage; in aqc_probe()
1566 priv->current_label = label_fan_current; in aqc_probe()
1569 priv->kind = d5next; in aqc_probe()
1571 priv->num_fans = D5NEXT_NUM_FANS; in aqc_probe()
1572 priv->fan_sensor_offsets = d5next_sensor_fan_offsets; in aqc_probe()
1573 priv->fan_ctrl_offsets = d5next_ctrl_fan_offsets; in aqc_probe()
1575 priv->num_temp_sensors = D5NEXT_NUM_SENSORS; in aqc_probe()
1576 priv->temp_sensor_start_offset = D5NEXT_COOLANT_TEMP; in aqc_probe()
1577 priv->num_virtual_temp_sensors = D5NEXT_NUM_VIRTUAL_SENSORS; in aqc_probe()
1578 priv->virtual_temp_sensor_start_offset = D5NEXT_VIRTUAL_SENSORS_START; in aqc_probe()
1579 priv->temp_ctrl_offset = D5NEXT_TEMP_CTRL_OFFSET; in aqc_probe()
1581 priv->buffer_size = D5NEXT_CTRL_REPORT_SIZE; in aqc_probe()
1582 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1584 priv->power_cycle_count_offset = D5NEXT_POWER_CYCLES; in aqc_probe()
1586 priv->temp_label = label_d5next_temp; in aqc_probe()
1587 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1588 priv->speed_label = label_d5next_speeds; in aqc_probe()
1589 priv->power_label = label_d5next_power; in aqc_probe()
1590 priv->voltage_label = label_d5next_voltages; in aqc_probe()
1591 priv->current_label = label_d5next_current; in aqc_probe()
1594 priv->kind = farbwerk; in aqc_probe()
1596 priv->num_fans = 0; in aqc_probe()
1598 priv->num_temp_sensors = FARBWERK_NUM_SENSORS; in aqc_probe()
1599 priv->temp_sensor_start_offset = FARBWERK_SENSOR_START; in aqc_probe()
1601 priv->temp_label = label_temp_sensors; in aqc_probe()
1604 priv->kind = farbwerk360; in aqc_probe()
1606 priv->num_fans = 0; in aqc_probe()
1608 priv->num_temp_sensors = FARBWERK360_NUM_SENSORS; in aqc_probe()
1609 priv->temp_sensor_start_offset = FARBWERK360_SENSOR_START; in aqc_probe()
1610 priv->num_virtual_temp_sensors = FARBWERK360_NUM_VIRTUAL_SENSORS; in aqc_probe()
1611 priv->virtual_temp_sensor_start_offset = FARBWERK360_VIRTUAL_SENSORS_START; in aqc_probe()
1612 priv->temp_ctrl_offset = FARBWERK360_TEMP_CTRL_OFFSET; in aqc_probe()
1614 priv->buffer_size = FARBWERK360_CTRL_REPORT_SIZE; in aqc_probe()
1616 priv->temp_label = label_temp_sensors; in aqc_probe()
1617 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1620 priv->kind = octo; in aqc_probe()
1622 priv->num_fans = OCTO_NUM_FANS; in aqc_probe()
1623 priv->fan_sensor_offsets = octo_sensor_fan_offsets; in aqc_probe()
1624 priv->fan_ctrl_offsets = octo_ctrl_fan_offsets; in aqc_probe()
1626 priv->num_temp_sensors = OCTO_NUM_SENSORS; in aqc_probe()
1627 priv->temp_sensor_start_offset = OCTO_SENSOR_START; in aqc_probe()
1628 priv->num_virtual_temp_sensors = OCTO_NUM_VIRTUAL_SENSORS; in aqc_probe()
1629 priv->virtual_temp_sensor_start_offset = OCTO_VIRTUAL_SENSORS_START; in aqc_probe()
1630 priv->temp_ctrl_offset = OCTO_TEMP_CTRL_OFFSET; in aqc_probe()
1632 priv->buffer_size = OCTO_CTRL_REPORT_SIZE; in aqc_probe()
1633 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1635 priv->power_cycle_count_offset = OCTO_POWER_CYCLES; in aqc_probe()
1637 priv->temp_label = label_temp_sensors; in aqc_probe()
1638 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1639 priv->speed_label = label_fan_speed; in aqc_probe()
1640 priv->power_label = label_fan_power; in aqc_probe()
1641 priv->voltage_label = label_fan_voltage; in aqc_probe()
1642 priv->current_label = label_fan_current; in aqc_probe()
1645 priv->kind = quadro; in aqc_probe()
1647 priv->num_fans = QUADRO_NUM_FANS; in aqc_probe()
1648 priv->fan_sensor_offsets = quadro_sensor_fan_offsets; in aqc_probe()
1649 priv->fan_ctrl_offsets = quadro_ctrl_fan_offsets; in aqc_probe()
1651 priv->num_temp_sensors = QUADRO_NUM_SENSORS; in aqc_probe()
1652 priv->temp_sensor_start_offset = QUADRO_SENSOR_START; in aqc_probe()
1653 priv->num_virtual_temp_sensors = QUADRO_NUM_VIRTUAL_SENSORS; in aqc_probe()
1654 priv->virtual_temp_sensor_start_offset = QUADRO_VIRTUAL_SENSORS_START; in aqc_probe()
1655 priv->num_flow_sensors = QUADRO_NUM_FLOW_SENSORS; in aqc_probe()
1656 priv->flow_sensors_start_offset = QUADRO_FLOW_SENSOR_OFFSET; in aqc_probe()
1658 priv->temp_ctrl_offset = QUADRO_TEMP_CTRL_OFFSET; in aqc_probe()
1660 priv->buffer_size = QUADRO_CTRL_REPORT_SIZE; in aqc_probe()
1661 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1663 priv->flow_pulses_ctrl_offset = QUADRO_FLOW_PULSES_CTRL_OFFSET; in aqc_probe()
1664 priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; in aqc_probe()
1666 priv->temp_label = label_temp_sensors; in aqc_probe()
1667 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1668 priv->speed_label = label_quadro_speeds; in aqc_probe()
1669 priv->power_label = label_fan_power; in aqc_probe()
1670 priv->voltage_label = label_fan_voltage; in aqc_probe()
1671 priv->current_label = label_fan_current; in aqc_probe()
1674 priv->kind = highflownext; in aqc_probe()
1676 priv->num_fans = 0; in aqc_probe()
1678 priv->num_temp_sensors = HIGHFLOWNEXT_NUM_SENSORS; in aqc_probe()
1679 priv->temp_sensor_start_offset = HIGHFLOWNEXT_SENSOR_START; in aqc_probe()
1680 priv->num_flow_sensors = HIGHFLOWNEXT_NUM_FLOW_SENSORS; in aqc_probe()
1681 priv->flow_sensors_start_offset = HIGHFLOWNEXT_FLOW; in aqc_probe()
1683 priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; in aqc_probe()
1685 priv->temp_label = label_highflownext_temp_sensors; in aqc_probe()
1686 priv->speed_label = label_highflownext_fan_speed; in aqc_probe()
1687 priv->power_label = label_highflownext_power; in aqc_probe()
1688 priv->voltage_label = label_highflownext_voltage; in aqc_probe()
1695 if (hdev->type != 2) { in aqc_probe()
1696 ret = -ENODEV; in aqc_probe()
1700 priv->kind = leakshield; in aqc_probe()
1702 priv->num_fans = 0; in aqc_probe()
1703 priv->num_temp_sensors = LEAKSHIELD_NUM_SENSORS; in aqc_probe()
1704 priv->temp_sensor_start_offset = LEAKSHIELD_TEMPERATURE_1; in aqc_probe()
1706 priv->temp_label = label_leakshield_temp_sensors; in aqc_probe()
1707 priv->speed_label = label_leakshield_fan_speed; in aqc_probe()
1710 priv->kind = aquastreamxt; in aqc_probe()
1712 priv->num_fans = AQUASTREAMXT_NUM_FANS; in aqc_probe()
1713 priv->fan_sensor_offsets = aquastreamxt_sensor_fan_offsets; in aqc_probe()
1715 priv->num_temp_sensors = AQUASTREAMXT_NUM_SENSORS; in aqc_probe()
1716 priv->temp_sensor_start_offset = AQUASTREAMXT_SENSOR_START; in aqc_probe()
1717 priv->buffer_size = AQUASTREAMXT_SENSOR_REPORT_SIZE; in aqc_probe()
1719 priv->temp_label = label_aquastreamxt_temp_sensors; in aqc_probe()
1720 priv->speed_label = label_d5next_speeds; in aqc_probe()
1721 priv->voltage_label = label_d5next_voltages; in aqc_probe()
1722 priv->current_label = label_d5next_current; in aqc_probe()
1725 priv->kind = aquastreamult; in aqc_probe()
1727 priv->num_fans = AQUASTREAMULT_NUM_FANS; in aqc_probe()
1728 priv->fan_sensor_offsets = aquastreamult_sensor_fan_offsets; in aqc_probe()
1730 priv->num_temp_sensors = AQUASTREAMULT_NUM_SENSORS; in aqc_probe()
1731 priv->temp_sensor_start_offset = AQUASTREAMULT_SENSOR_START; in aqc_probe()
1733 priv->temp_label = label_aquastreamult_temp; in aqc_probe()
1734 priv->speed_label = label_aquastreamult_speeds; in aqc_probe()
1735 priv->power_label = label_aquastreamult_power; in aqc_probe()
1736 priv->voltage_label = label_aquastreamult_voltages; in aqc_probe()
1737 priv->current_label = label_aquastreamult_current; in aqc_probe()
1740 priv->kind = poweradjust3; in aqc_probe()
1742 priv->num_fans = 0; in aqc_probe()
1744 priv->num_temp_sensors = POWERADJUST3_NUM_SENSORS; in aqc_probe()
1745 priv->temp_sensor_start_offset = POWERADJUST3_SENSOR_START; in aqc_probe()
1746 priv->buffer_size = POWERADJUST3_SENSOR_REPORT_SIZE; in aqc_probe()
1748 priv->temp_label = label_poweradjust3_temp_sensors; in aqc_probe()
1754 switch (priv->kind) { in aqc_probe()
1756 priv->serial_number_start_offset = AQUAERO_SERIAL_START; in aqc_probe()
1757 priv->firmware_version_offset = AQUAERO_FIRMWARE_VERSION; in aqc_probe()
1759 priv->fan_structure = &aqc_aquaero_fan_structure; in aqc_probe()
1761 priv->ctrl_report_id = AQUAERO_CTRL_REPORT_ID; in aqc_probe()
1762 priv->secondary_ctrl_report_id = AQUAERO_SECONDARY_CTRL_REPORT_ID; in aqc_probe()
1763 priv->secondary_ctrl_report_size = AQUAERO_SECONDARY_CTRL_REPORT_SIZE; in aqc_probe()
1764 priv->secondary_ctrl_report = aquaero_secondary_ctrl_report; in aqc_probe()
1767 priv->status_report_id = POWERADJUST3_STATUS_REPORT_ID; in aqc_probe()
1770 priv->serial_number_start_offset = AQUASTREAMXT_SERIAL_START; in aqc_probe()
1771 priv->firmware_version_offset = AQUASTREAMXT_FIRMWARE_VERSION; in aqc_probe()
1773 priv->status_report_id = AQUASTREAMXT_STATUS_REPORT_ID; in aqc_probe()
1776 priv->serial_number_start_offset = AQC_SERIAL_START; in aqc_probe()
1777 priv->firmware_version_offset = AQC_FIRMWARE_VERSION; in aqc_probe()
1779 priv->ctrl_report_id = CTRL_REPORT_ID; in aqc_probe()
1780 priv->secondary_ctrl_report_id = SECONDARY_CTRL_REPORT_ID; in aqc_probe()
1781 priv->secondary_ctrl_report_size = SECONDARY_CTRL_REPORT_SIZE; in aqc_probe()
1782 priv->secondary_ctrl_report = secondary_ctrl_report; in aqc_probe()
1784 if (priv->kind == aquastreamult) in aqc_probe()
1785 priv->fan_structure = &aqc_aquastreamult_fan_structure; in aqc_probe()
1787 priv->fan_structure = &aqc_general_fan_structure; in aqc_probe()
1791 if (priv->buffer_size != 0) { in aqc_probe()
1792 priv->checksum_start = 0x01; in aqc_probe()
1793 priv->checksum_length = priv->buffer_size - 3; in aqc_probe()
1794 priv->checksum_offset = priv->buffer_size - 2; in aqc_probe()
1797 priv->name = aqc_device_names[priv->kind]; in aqc_probe()
1799 priv->buffer = devm_kzalloc(&hdev->dev, priv->buffer_size, GFP_KERNEL); in aqc_probe()
1800 if (!priv->buffer) { in aqc_probe()
1801 ret = -ENOMEM; in aqc_probe()
1805 mutex_init(&priv->mutex); in aqc_probe()
1807 priv->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, priv->name, priv, in aqc_probe()
1810 if (IS_ERR(priv->hwmon_dev)) { in aqc_probe()
1811 ret = PTR_ERR(priv->hwmon_dev); in aqc_probe()
1830 debugfs_remove_recursive(priv->debugfs); in aqc_remove()
1831 hwmon_device_unregister(priv->hwmon_dev); in aqc_remove()