Lines Matching +full:power +full:- +full:sensor
1 // SPDX-License-Identifier: GPL-2.0+
8 * sensor values, except for devices that communicate through the
102 /* Info, sensor sizes and offsets for most Aquacomputer devices */
127 /* Sensor report offsets for Aquaero fan controllers */
151 /* Sensor report offsets for the D5 Next pump */
162 #define D5NEXT_TEMP_CTRL_OFFSET 0x2D /* Temperature sensor offsets location */
163 static u16 d5next_ctrl_fan_offsets[] = { 0x97, 0x42 }; /* Pump and fan speed (from 0-100%) */
170 /* Sensor report offsets for the Aquastream Ultimate pump */
185 /* Spec and sensor report offset for the Farbwerk RGB controller */
194 /* Sensor report offsets for the Farbwerk 360 */
208 /* Sensor report offsets for the Octo */
218 /* Fan speed offsets (0-100%) */
228 /* Sensor report offsets for the Quadro */
238 static u16 quadro_ctrl_fan_offsets[] = { 0x37, 0x8c, 0xe1, 0x136 }; /* Fan speed offsets (0-100%) */
240 /* Specs of High Flow Next flow sensor */
244 /* Sensor report offsets for the High Flow Next */
256 /* Sensor report offsets for Leakshield */
278 /* Sensor report offsets and info for Aquastream XT */
290 /* Sensor report offsets for the Poweradjust 3 */
298 /* Sensor report offsets for the High Flow USB */
315 "Pump power",
316 "Fan power"
333 "Sensor 1",
334 "Sensor 2",
335 "Sensor 3",
336 "Sensor 4",
337 "Sensor 5",
338 "Sensor 6",
339 "Sensor 7",
340 "Sensor 8"
344 "Virtual sensor 1",
345 "Virtual sensor 2",
346 "Virtual sensor 3",
347 "Virtual sensor 4",
348 "Virtual sensor 5",
349 "Virtual sensor 6",
350 "Virtual sensor 7",
351 "Virtual sensor 8",
352 "Virtual sensor 9",
353 "Virtual sensor 10",
354 "Virtual sensor 11",
355 "Virtual sensor 12",
356 "Virtual sensor 13",
357 "Virtual sensor 14",
358 "Virtual sensor 15",
359 "Virtual sensor 16",
363 "Calc. virtual sensor 1",
364 "Calc. virtual sensor 2",
365 "Calc. virtual sensor 3",
366 "Calc. virtual sensor 4"
370 "Fan 1 power",
371 "Fan 2 power",
372 "Fan 3 power",
373 "Fan 4 power",
374 "Fan 5 power",
375 "Fan 6 power",
376 "Fan 7 power",
377 "Fan 8 power"
430 "Flow sensor 1 [dL/h]",
431 "Flow sensor 2 [dL/h]"
437 "External sensor"
447 "Dissipated power",
463 "User-Provided Pump Speed",
464 "User-Provided Flow [dL/h]",
472 "External sensor",
490 "Fan power",
491 "Pump power"
506 "External sensor"
522 u8 power; member
530 .power = AQUAERO_FAN_POWER_OFFSET,
538 .power = AQUASTREAMULT_FAN_POWER_OFFSET,
546 .power = AQC_FAN_POWER_OFFSET,
598 /* Sensor values */
620 /* Converts from centi-percent */
626 /* Converts to centi-percent */
630 return -EINVAL; in aqc_pwm_to_percent()
657 if (priv->ctrl_report_delay) { in aqc_delay_ctrl_report()
658 s64 delta = ktime_ms_delta(ktime_get(), priv->last_ctrl_report_op); in aqc_delay_ctrl_report()
660 if (delta < priv->ctrl_report_delay) in aqc_delay_ctrl_report()
661 msleep(priv->ctrl_report_delay - delta); in aqc_delay_ctrl_report()
672 memset(priv->buffer, 0x00, priv->buffer_size); in aqc_get_ctrl_data()
673 ret = hid_hw_raw_request(priv->hdev, priv->ctrl_report_id, priv->buffer, priv->buffer_size, in aqc_get_ctrl_data()
676 ret = -ENODATA; in aqc_get_ctrl_data()
678 priv->last_ctrl_report_op = ktime_get(); in aqc_get_ctrl_data()
692 if (priv->kind != aquaero) { in aqc_send_ctrl_data()
693 /* Init and xorout value for CRC-16/USB is 0xffff */ in aqc_send_ctrl_data()
694 checksum = crc16(0xffff, priv->buffer + priv->checksum_start, in aqc_send_ctrl_data()
695 priv->checksum_length); in aqc_send_ctrl_data()
699 put_unaligned_be16(checksum, priv->buffer + priv->checksum_offset); in aqc_send_ctrl_data()
703 ret = hid_hw_raw_request(priv->hdev, priv->ctrl_report_id, priv->buffer, priv->buffer_size, in aqc_send_ctrl_data()
709 ret = hid_hw_raw_request(priv->hdev, priv->secondary_ctrl_report_id, in aqc_send_ctrl_data()
710 priv->secondary_ctrl_report, priv->secondary_ctrl_report_size, in aqc_send_ctrl_data()
714 priv->last_ctrl_report_op = ktime_get(); in aqc_send_ctrl_data()
724 mutex_lock(&priv->mutex); in aqc_get_ctrl_val()
732 *val = (s16)get_unaligned_be16(priv->buffer + offset); in aqc_get_ctrl_val()
735 *val = priv->buffer[offset]; in aqc_get_ctrl_val()
738 ret = -EINVAL; in aqc_get_ctrl_val()
742 mutex_unlock(&priv->mutex); in aqc_get_ctrl_val()
750 mutex_lock(&priv->mutex); in aqc_set_ctrl_vals()
759 put_unaligned_be16((s16)vals[i], priv->buffer + offsets[i]); in aqc_set_ctrl_vals()
762 priv->buffer[offsets[i]] = (u8)vals[i]; in aqc_set_ctrl_vals()
765 ret = -EINVAL; in aqc_set_ctrl_vals()
775 mutex_unlock(&priv->mutex); in aqc_set_ctrl_vals()
790 if (channel < priv->num_temp_sensors) { in aqc_is_visible()
796 if (priv->temp_ctrl_offset != 0) in aqc_is_visible()
805 priv->num_temp_sensors + priv->num_virtual_temp_sensors + in aqc_is_visible()
806 priv->num_calc_virt_temp_sensors) in aqc_is_visible()
816 if (priv->fan_ctrl_offsets && channel < priv->num_fans) { in aqc_is_visible()
829 switch (priv->kind) { in aqc_is_visible()
833 * pressure and flow sensor in aqc_is_visible()
839 /* Special case to support flow sensor, water quality in aqc_is_visible()
855 if (channel < priv->num_fans + priv->num_flow_sensors) in aqc_is_visible()
859 if (channel < priv->num_fans) in aqc_is_visible()
865 /* Special case for Quadro/Octo flow sensor */ in aqc_is_visible()
866 if (channel == priv->num_fans) { in aqc_is_visible()
867 switch (priv->kind) { in aqc_is_visible()
879 /* Special case for Leakshield pressure sensor */ in aqc_is_visible()
880 if (priv->kind == leakshield && channel == 0) in aqc_is_visible()
888 switch (priv->kind) { in aqc_is_visible()
890 /* Special case to support pump and fan power */ in aqc_is_visible()
895 /* Special case to support one power sensor */ in aqc_is_visible()
902 if (channel < priv->num_fans) in aqc_is_visible()
908 switch (priv->kind) { in aqc_is_visible()
920 if (channel < priv->num_fans) in aqc_is_visible()
926 switch (priv->kind) { in aqc_is_visible()
929 if (channel < priv->num_fans + 2) in aqc_is_visible()
939 if (channel < priv->num_fans) in aqc_is_visible()
951 /* Read device sensors by manually requesting the sensor report (legacy way) */
956 mutex_lock(&priv->mutex); in aqc_legacy_read()
958 memset(priv->buffer, 0x00, priv->buffer_size); in aqc_legacy_read()
959 ret = hid_hw_raw_request(priv->hdev, priv->status_report_id, priv->buffer, in aqc_legacy_read()
960 priv->buffer_size, HID_FEATURE_REPORT, HID_REQ_GET_REPORT); in aqc_legacy_read()
964 /* Temperature sensor readings */ in aqc_legacy_read()
965 for (i = 0; i < priv->num_temp_sensors; i++) { in aqc_legacy_read()
966 sensor_value = get_unaligned_le16(priv->buffer + priv->temp_sensor_start_offset + in aqc_legacy_read()
969 priv->temp_input[i] = -ENODATA; in aqc_legacy_read()
971 priv->temp_input[i] = sensor_value * 10; in aqc_legacy_read()
974 /* Special-case sensor readings */ in aqc_legacy_read()
975 switch (priv->kind) { in aqc_legacy_read()
978 priv->serial_number[0] = get_unaligned_le16(priv->buffer + in aqc_legacy_read()
979 priv->serial_number_start_offset); in aqc_legacy_read()
980 priv->firmware_version = in aqc_legacy_read()
981 get_unaligned_le16(priv->buffer + priv->firmware_version_offset); in aqc_legacy_read()
984 sensor_value = get_unaligned_le16(priv->buffer + priv->fan_sensor_offsets[0]); in aqc_legacy_read()
985 priv->speed_input[0] = aqc_aquastreamxt_convert_pump_rpm(sensor_value); in aqc_legacy_read()
988 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_FAN_STATUS_OFFSET); in aqc_legacy_read()
990 priv->speed_input[1] = 0; in aqc_legacy_read()
993 get_unaligned_le16(priv->buffer + priv->fan_sensor_offsets[1]); in aqc_legacy_read()
994 priv->speed_input[1] = aqc_aquastreamxt_convert_fan_rpm(sensor_value); in aqc_legacy_read()
998 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_PUMP_CURR_OFFSET); in aqc_legacy_read()
999 priv->current_input[0] = DIV_ROUND_CLOSEST(sensor_value * 176, 100) - 52; in aqc_legacy_read()
1001 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_PUMP_VOLTAGE_OFFSET); in aqc_legacy_read()
1002 priv->voltage_input[0] = DIV_ROUND_CLOSEST(sensor_value * 1000, 61); in aqc_legacy_read()
1004 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_FAN_VOLTAGE_OFFSET); in aqc_legacy_read()
1005 priv->voltage_input[1] = DIV_ROUND_CLOSEST(sensor_value * 1000, 63); in aqc_legacy_read()
1009 priv->serial_number[0] = get_unaligned_le16(priv->buffer + in aqc_legacy_read()
1010 priv->serial_number_start_offset); in aqc_legacy_read()
1011 priv->firmware_version = in aqc_legacy_read()
1012 get_unaligned_le16(priv->buffer + priv->firmware_version_offset); in aqc_legacy_read()
1015 priv->speed_input[0] = get_unaligned_le16(priv->buffer + in aqc_legacy_read()
1016 priv->flow_sensors_start_offset); in aqc_legacy_read()
1022 priv->updated = jiffies; in aqc_legacy_read()
1025 mutex_unlock(&priv->mutex); in aqc_legacy_read()
1035 if (time_after(jiffies, priv->updated + STATUS_UPDATE_INTERVAL)) { in aqc_read()
1036 if (priv->status_report_id != 0) { in aqc_read()
1040 return -ENODATA; in aqc_read()
1042 return -ENODATA; in aqc_read()
1050 if (priv->temp_input[channel] == -ENODATA) in aqc_read()
1051 return -ENODATA; in aqc_read()
1053 *val = priv->temp_input[channel]; in aqc_read()
1057 aqc_get_ctrl_val(priv, priv->temp_ctrl_offset + in aqc_read()
1071 if (priv->speed_input[channel] == -ENODATA) in aqc_read()
1072 return -ENODATA; in aqc_read()
1074 *val = priv->speed_input[channel]; in aqc_read()
1077 *val = priv->speed_input_min[channel]; in aqc_read()
1080 *val = priv->speed_input_max[channel]; in aqc_read()
1083 *val = priv->speed_input_target[channel]; in aqc_read()
1086 ret = aqc_get_ctrl_val(priv, priv->flow_pulses_ctrl_offset, in aqc_read()
1096 *val = priv->power_input[channel]; in aqc_read()
1099 switch (priv->kind) { in aqc_read()
1109 ret = aqc_get_ctrl_val(priv, priv->fan_ctrl_offsets[channel], in aqc_read()
1119 *val = priv->voltage_input[channel]; in aqc_read()
1122 *val = priv->current_input[channel]; in aqc_read()
1125 return -EOPNOTSUPP; in aqc_read()
1137 int num_non_calc_sensors = priv->num_temp_sensors + priv->num_virtual_temp_sensors; in aqc_read_string()
1141 if (channel < priv->num_temp_sensors) { in aqc_read_string()
1142 *str = priv->temp_label[channel]; in aqc_read_string()
1144 if (priv->kind == aquaero && channel >= num_non_calc_sensors) in aqc_read_string()
1146 priv->calc_virt_temp_label[channel - num_non_calc_sensors]; in aqc_read_string()
1148 *str = priv->virtual_temp_label[channel - priv->num_temp_sensors]; in aqc_read_string()
1152 *str = priv->speed_label[channel]; in aqc_read_string()
1155 *str = priv->power_label[channel]; in aqc_read_string()
1158 *str = priv->voltage_label[channel]; in aqc_read_string()
1161 *str = priv->current_label[channel]; in aqc_read_string()
1164 return -EOPNOTSUPP; in aqc_read_string()
1184 /* Limit temp offset to +/- 15K as in the official software */ in aqc_write()
1185 val = clamp_val(val, -15000, 15000) / 10; in aqc_write()
1187 aqc_set_ctrl_val(priv, priv->temp_ctrl_offset + in aqc_write()
1193 return -EOPNOTSUPP; in aqc_write()
1200 ret = aqc_set_ctrl_val(priv, priv->flow_pulses_ctrl_offset, in aqc_write()
1216 switch (priv->kind) { in aqc_write()
1225 ctrl_values_offsets[1] = priv->fan_ctrl_offsets[channel] + in aqc_write()
1230 /* Set minimum power to 0 to allow the fan to turn off */ in aqc_write()
1231 ctrl_values_offsets[2] = priv->fan_ctrl_offsets[channel] + in aqc_write()
1236 /* Set maximum power to 255 to allow the fan to reach max speed */ in aqc_write()
1237 ctrl_values_offsets[3] = priv->fan_ctrl_offsets[channel] + in aqc_write()
1248 ret = aqc_set_ctrl_val(priv, priv->fan_ctrl_offsets[channel], in aqc_write()
1260 return -EOPNOTSUPP; in aqc_write()
1306 HWMON_CHANNEL_INFO(power,
1355 if (report->id != STATUS_REPORT_ID) in aqc_raw_event()
1361 priv->serial_number[0] = get_unaligned_be16(data + priv->serial_number_start_offset); in aqc_raw_event()
1362 priv->serial_number[1] = get_unaligned_be16(data + priv->serial_number_start_offset + in aqc_raw_event()
1364 priv->firmware_version = get_unaligned_be16(data + priv->firmware_version_offset); in aqc_raw_event()
1366 /* Physical temperature sensor readings */ in aqc_raw_event()
1367 for (i = 0; i < priv->num_temp_sensors; i++) { in aqc_raw_event()
1369 priv->temp_sensor_start_offset + in aqc_raw_event()
1372 priv->temp_input[i] = -ENODATA; in aqc_raw_event()
1374 priv->temp_input[i] = sensor_value * 10; in aqc_raw_event()
1377 /* Virtual temperature sensor readings */ in aqc_raw_event()
1378 for (j = 0; j < priv->num_virtual_temp_sensors; j++) { in aqc_raw_event()
1380 priv->virtual_temp_sensor_start_offset + in aqc_raw_event()
1383 priv->temp_input[i] = -ENODATA; in aqc_raw_event()
1385 priv->temp_input[i] = sensor_value * 10; in aqc_raw_event()
1390 for (i = 0; i < priv->num_fans; i++) { in aqc_raw_event()
1391 priv->speed_input[i] = in aqc_raw_event()
1392 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1393 priv->fan_structure->speed); in aqc_raw_event()
1394 priv->power_input[i] = in aqc_raw_event()
1395 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1396 priv->fan_structure->power) * 10000; in aqc_raw_event()
1397 priv->voltage_input[i] = in aqc_raw_event()
1398 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1399 priv->fan_structure->voltage) * 10; in aqc_raw_event()
1400 priv->current_input[i] = in aqc_raw_event()
1401 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1402 priv->fan_structure->curr); in aqc_raw_event()
1405 /* Flow sensor readings */ in aqc_raw_event()
1406 for (j = 0; j < priv->num_flow_sensors; j++) { in aqc_raw_event()
1407 priv->speed_input[i] = get_unaligned_be16(data + priv->flow_sensors_start_offset + in aqc_raw_event()
1412 if (priv->power_cycle_count_offset != 0) in aqc_raw_event()
1413 priv->power_cycles = get_unaligned_be32(data + priv->power_cycle_count_offset); in aqc_raw_event()
1415 /* Special-case sensor readings */ in aqc_raw_event()
1416 switch (priv->kind) { in aqc_raw_event()
1419 i = priv->num_temp_sensors + priv->num_virtual_temp_sensors; in aqc_raw_event()
1420 for (j = 0; j < priv->num_calc_virt_temp_sensors; j++) { in aqc_raw_event()
1422 priv->calc_virt_temp_sensor_start_offset + in aqc_raw_event()
1425 priv->temp_input[i] = -ENODATA; in aqc_raw_event()
1427 priv->temp_input[i] = sensor_value * 10; in aqc_raw_event()
1432 priv->speed_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_OFFSET); in aqc_raw_event()
1433 priv->speed_input[2] = get_unaligned_be16(data + AQUASTREAMULT_PRESSURE_OFFSET); in aqc_raw_event()
1434 priv->speed_input[3] = get_unaligned_be16(data + AQUASTREAMULT_FLOW_SENSOR_OFFSET); in aqc_raw_event()
1436 priv->power_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_POWER) * 10000; in aqc_raw_event()
1438 priv->voltage_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_VOLTAGE) * 10; in aqc_raw_event()
1440 priv->current_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_CURRENT); in aqc_raw_event()
1443 priv->voltage_input[2] = get_unaligned_be16(data + D5NEXT_5V_VOLTAGE) * 10; in aqc_raw_event()
1444 priv->voltage_input[3] = get_unaligned_be16(data + D5NEXT_12V_VOLTAGE) * 10; in aqc_raw_event()
1447 /* If external temp sensor is not connected, its power reading is also N/A */ in aqc_raw_event()
1448 if (priv->temp_input[1] == -ENODATA) in aqc_raw_event()
1449 priv->power_input[0] = -ENODATA; in aqc_raw_event()
1451 priv->power_input[0] = in aqc_raw_event()
1454 priv->voltage_input[0] = get_unaligned_be16(data + HIGHFLOWNEXT_5V_VOLTAGE) * 10; in aqc_raw_event()
1455 priv->voltage_input[1] = in aqc_raw_event()
1458 priv->speed_input[1] = get_unaligned_be16(data + HIGHFLOWNEXT_WATER_QUALITY); in aqc_raw_event()
1459 priv->speed_input[2] = get_unaligned_be16(data + HIGHFLOWNEXT_CONDUCTIVITY); in aqc_raw_event()
1462 priv->speed_input[0] = in aqc_raw_event()
1464 priv->speed_input_min[0] = get_unaligned_be16(data + LEAKSHIELD_PRESSURE_MIN) * 100; in aqc_raw_event()
1465 priv->speed_input_target[0] = in aqc_raw_event()
1467 priv->speed_input_max[0] = get_unaligned_be16(data + LEAKSHIELD_PRESSURE_MAX) * 100; in aqc_raw_event()
1469 priv->speed_input[1] = get_unaligned_be16(data + LEAKSHIELD_PUMP_RPM_IN); in aqc_raw_event()
1470 if (priv->speed_input[1] == AQC_SENSOR_NA) in aqc_raw_event()
1471 priv->speed_input[1] = -ENODATA; in aqc_raw_event()
1473 priv->speed_input[2] = get_unaligned_be16(data + LEAKSHIELD_FLOW_IN); in aqc_raw_event()
1474 if (priv->speed_input[2] == AQC_SENSOR_NA) in aqc_raw_event()
1475 priv->speed_input[2] = -ENODATA; in aqc_raw_event()
1477 priv->speed_input[3] = get_unaligned_be16(data + LEAKSHIELD_RESERVOIR_VOLUME); in aqc_raw_event()
1478 priv->speed_input[4] = get_unaligned_be16(data + LEAKSHIELD_RESERVOIR_FILLED); in aqc_raw_event()
1480 /* Second temp sensor is not positioned after the first one, read it here */ in aqc_raw_event()
1481 priv->temp_input[1] = get_unaligned_be16(data + LEAKSHIELD_TEMPERATURE_2) * 10; in aqc_raw_event()
1487 priv->updated = jiffies; in aqc_raw_event()
1494 struct aqc_data *priv = seqf->private; in serial_number_show()
1496 seq_printf(seqf, "%05u-%05u\n", priv->serial_number[0], priv->serial_number[1]); in serial_number_show()
1504 struct aqc_data *priv = seqf->private; in firmware_version_show()
1506 seq_printf(seqf, "%u\n", priv->firmware_version); in firmware_version_show()
1514 struct aqc_data *priv = seqf->private; in power_cycles_show()
1516 seq_printf(seqf, "%u\n", priv->power_cycles); in power_cycles_show()
1526 scnprintf(name, sizeof(name), "%s_%s-%s", "aquacomputer", priv->name, in aqc_debugfs_init()
1527 dev_name(&priv->hdev->dev)); in aqc_debugfs_init()
1529 priv->debugfs = debugfs_create_dir(name, NULL); in aqc_debugfs_init()
1531 if (priv->serial_number_start_offset != 0) in aqc_debugfs_init()
1532 debugfs_create_file("serial_number", 0444, priv->debugfs, priv, in aqc_debugfs_init()
1534 if (priv->firmware_version_offset != 0) in aqc_debugfs_init()
1535 debugfs_create_file("firmware_version", 0444, priv->debugfs, priv, in aqc_debugfs_init()
1537 if (priv->power_cycle_count_offset != 0) in aqc_debugfs_init()
1538 debugfs_create_file("power_cycles", 0444, priv->debugfs, priv, &power_cycles_fops); in aqc_debugfs_init()
1546 priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); in aqc_probe()
1548 return -ENOMEM; in aqc_probe()
1550 priv->hdev = hdev; in aqc_probe()
1553 priv->updated = jiffies - STATUS_UPDATE_INTERVAL; in aqc_probe()
1567 switch (hdev->product) { in aqc_probe()
1580 if (hdev->collection[1].type != 0) { in aqc_probe()
1581 ret = -ENODEV; in aqc_probe()
1585 priv->kind = aquaero; in aqc_probe()
1587 priv->num_fans = AQUAERO_NUM_FANS; in aqc_probe()
1588 priv->fan_sensor_offsets = aquaero_sensor_fan_offsets; in aqc_probe()
1589 priv->fan_ctrl_offsets = aquaero_ctrl_fan_offsets; in aqc_probe()
1591 priv->num_temp_sensors = AQUAERO_NUM_SENSORS; in aqc_probe()
1592 priv->temp_sensor_start_offset = AQUAERO_SENSOR_START; in aqc_probe()
1593 priv->num_virtual_temp_sensors = AQUAERO_NUM_VIRTUAL_SENSORS; in aqc_probe()
1594 priv->virtual_temp_sensor_start_offset = AQUAERO_VIRTUAL_SENSOR_START; in aqc_probe()
1595 priv->num_calc_virt_temp_sensors = AQUAERO_NUM_CALC_VIRTUAL_SENSORS; in aqc_probe()
1596 priv->calc_virt_temp_sensor_start_offset = AQUAERO_CALC_VIRTUAL_SENSOR_START; in aqc_probe()
1597 priv->num_flow_sensors = AQUAERO_NUM_FLOW_SENSORS; in aqc_probe()
1598 priv->flow_sensors_start_offset = AQUAERO_FLOW_SENSORS_START; in aqc_probe()
1600 priv->buffer_size = AQUAERO_CTRL_REPORT_SIZE; in aqc_probe()
1601 priv->temp_ctrl_offset = AQUAERO_TEMP_CTRL_OFFSET; in aqc_probe()
1602 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1604 priv->temp_label = label_temp_sensors; in aqc_probe()
1605 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1606 priv->calc_virt_temp_label = label_aquaero_calc_temp_sensors; in aqc_probe()
1607 priv->speed_label = label_aquaero_speeds; in aqc_probe()
1608 priv->power_label = label_fan_power; in aqc_probe()
1609 priv->voltage_label = label_fan_voltage; in aqc_probe()
1610 priv->current_label = label_fan_current; in aqc_probe()
1613 priv->kind = d5next; in aqc_probe()
1615 priv->num_fans = D5NEXT_NUM_FANS; in aqc_probe()
1616 priv->fan_sensor_offsets = d5next_sensor_fan_offsets; in aqc_probe()
1617 priv->fan_ctrl_offsets = d5next_ctrl_fan_offsets; in aqc_probe()
1619 priv->num_temp_sensors = D5NEXT_NUM_SENSORS; in aqc_probe()
1620 priv->temp_sensor_start_offset = D5NEXT_COOLANT_TEMP; in aqc_probe()
1621 priv->num_virtual_temp_sensors = D5NEXT_NUM_VIRTUAL_SENSORS; in aqc_probe()
1622 priv->virtual_temp_sensor_start_offset = D5NEXT_VIRTUAL_SENSORS_START; in aqc_probe()
1623 priv->temp_ctrl_offset = D5NEXT_TEMP_CTRL_OFFSET; in aqc_probe()
1625 priv->buffer_size = D5NEXT_CTRL_REPORT_SIZE; in aqc_probe()
1626 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1628 priv->power_cycle_count_offset = D5NEXT_POWER_CYCLES; in aqc_probe()
1630 priv->temp_label = label_d5next_temp; in aqc_probe()
1631 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1632 priv->speed_label = label_d5next_speeds; in aqc_probe()
1633 priv->power_label = label_d5next_power; in aqc_probe()
1634 priv->voltage_label = label_d5next_voltages; in aqc_probe()
1635 priv->current_label = label_d5next_current; in aqc_probe()
1638 priv->kind = farbwerk; in aqc_probe()
1640 priv->num_fans = 0; in aqc_probe()
1642 priv->num_temp_sensors = FARBWERK_NUM_SENSORS; in aqc_probe()
1643 priv->temp_sensor_start_offset = FARBWERK_SENSOR_START; in aqc_probe()
1645 priv->temp_label = label_temp_sensors; in aqc_probe()
1648 priv->kind = farbwerk360; in aqc_probe()
1650 priv->num_fans = 0; in aqc_probe()
1652 priv->num_temp_sensors = FARBWERK360_NUM_SENSORS; in aqc_probe()
1653 priv->temp_sensor_start_offset = FARBWERK360_SENSOR_START; in aqc_probe()
1654 priv->num_virtual_temp_sensors = FARBWERK360_NUM_VIRTUAL_SENSORS; in aqc_probe()
1655 priv->virtual_temp_sensor_start_offset = FARBWERK360_VIRTUAL_SENSORS_START; in aqc_probe()
1656 priv->temp_ctrl_offset = FARBWERK360_TEMP_CTRL_OFFSET; in aqc_probe()
1658 priv->buffer_size = FARBWERK360_CTRL_REPORT_SIZE; in aqc_probe()
1660 priv->temp_label = label_temp_sensors; in aqc_probe()
1661 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1664 priv->kind = octo; in aqc_probe()
1666 priv->num_fans = OCTO_NUM_FANS; in aqc_probe()
1667 priv->fan_sensor_offsets = octo_sensor_fan_offsets; in aqc_probe()
1668 priv->fan_ctrl_offsets = octo_ctrl_fan_offsets; in aqc_probe()
1670 priv->num_temp_sensors = OCTO_NUM_SENSORS; in aqc_probe()
1671 priv->temp_sensor_start_offset = OCTO_SENSOR_START; in aqc_probe()
1672 priv->num_virtual_temp_sensors = OCTO_NUM_VIRTUAL_SENSORS; in aqc_probe()
1673 priv->virtual_temp_sensor_start_offset = OCTO_VIRTUAL_SENSORS_START; in aqc_probe()
1674 priv->num_flow_sensors = OCTO_NUM_FLOW_SENSORS; in aqc_probe()
1675 priv->flow_sensors_start_offset = OCTO_FLOW_SENSOR_OFFSET; in aqc_probe()
1677 priv->temp_ctrl_offset = OCTO_TEMP_CTRL_OFFSET; in aqc_probe()
1679 priv->buffer_size = OCTO_CTRL_REPORT_SIZE; in aqc_probe()
1680 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1682 priv->flow_pulses_ctrl_offset = OCTO_FLOW_PULSES_CTRL_OFFSET; in aqc_probe()
1683 priv->power_cycle_count_offset = OCTO_POWER_CYCLES; in aqc_probe()
1685 priv->temp_label = label_temp_sensors; in aqc_probe()
1686 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1687 priv->speed_label = label_octo_speeds; in aqc_probe()
1688 priv->power_label = label_fan_power; in aqc_probe()
1689 priv->voltage_label = label_fan_voltage; in aqc_probe()
1690 priv->current_label = label_fan_current; in aqc_probe()
1693 priv->kind = quadro; in aqc_probe()
1695 priv->num_fans = QUADRO_NUM_FANS; in aqc_probe()
1696 priv->fan_sensor_offsets = quadro_sensor_fan_offsets; in aqc_probe()
1697 priv->fan_ctrl_offsets = quadro_ctrl_fan_offsets; in aqc_probe()
1699 priv->num_temp_sensors = QUADRO_NUM_SENSORS; in aqc_probe()
1700 priv->temp_sensor_start_offset = QUADRO_SENSOR_START; in aqc_probe()
1701 priv->num_virtual_temp_sensors = QUADRO_NUM_VIRTUAL_SENSORS; in aqc_probe()
1702 priv->virtual_temp_sensor_start_offset = QUADRO_VIRTUAL_SENSORS_START; in aqc_probe()
1703 priv->num_flow_sensors = QUADRO_NUM_FLOW_SENSORS; in aqc_probe()
1704 priv->flow_sensors_start_offset = QUADRO_FLOW_SENSOR_OFFSET; in aqc_probe()
1706 priv->temp_ctrl_offset = QUADRO_TEMP_CTRL_OFFSET; in aqc_probe()
1708 priv->buffer_size = QUADRO_CTRL_REPORT_SIZE; in aqc_probe()
1709 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1711 priv->flow_pulses_ctrl_offset = QUADRO_FLOW_PULSES_CTRL_OFFSET; in aqc_probe()
1712 priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; in aqc_probe()
1714 priv->temp_label = label_temp_sensors; in aqc_probe()
1715 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1716 priv->speed_label = label_quadro_speeds; in aqc_probe()
1717 priv->power_label = label_fan_power; in aqc_probe()
1718 priv->voltage_label = label_fan_voltage; in aqc_probe()
1719 priv->current_label = label_fan_current; in aqc_probe()
1722 priv->kind = highflownext; in aqc_probe()
1724 priv->num_fans = 0; in aqc_probe()
1726 priv->num_temp_sensors = HIGHFLOWNEXT_NUM_SENSORS; in aqc_probe()
1727 priv->temp_sensor_start_offset = HIGHFLOWNEXT_SENSOR_START; in aqc_probe()
1728 priv->num_flow_sensors = HIGHFLOWNEXT_NUM_FLOW_SENSORS; in aqc_probe()
1729 priv->flow_sensors_start_offset = HIGHFLOWNEXT_FLOW; in aqc_probe()
1731 priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; in aqc_probe()
1733 priv->temp_label = label_highflownext_temp_sensors; in aqc_probe()
1734 priv->speed_label = label_highflownext_fan_speed; in aqc_probe()
1735 priv->power_label = label_highflownext_power; in aqc_probe()
1736 priv->voltage_label = label_highflownext_voltage; in aqc_probe()
1743 if (hdev->type != 2) { in aqc_probe()
1744 ret = -ENODEV; in aqc_probe()
1748 priv->kind = leakshield; in aqc_probe()
1750 priv->num_fans = 0; in aqc_probe()
1751 priv->num_temp_sensors = LEAKSHIELD_NUM_SENSORS; in aqc_probe()
1752 priv->temp_sensor_start_offset = LEAKSHIELD_TEMPERATURE_1; in aqc_probe()
1754 priv->temp_label = label_leakshield_temp_sensors; in aqc_probe()
1755 priv->speed_label = label_leakshield_fan_speed; in aqc_probe()
1758 priv->kind = aquastreamxt; in aqc_probe()
1760 priv->num_fans = AQUASTREAMXT_NUM_FANS; in aqc_probe()
1761 priv->fan_sensor_offsets = aquastreamxt_sensor_fan_offsets; in aqc_probe()
1763 priv->num_temp_sensors = AQUASTREAMXT_NUM_SENSORS; in aqc_probe()
1764 priv->temp_sensor_start_offset = AQUASTREAMXT_SENSOR_START; in aqc_probe()
1765 priv->buffer_size = AQUASTREAMXT_SENSOR_REPORT_SIZE; in aqc_probe()
1767 priv->temp_label = label_aquastreamxt_temp_sensors; in aqc_probe()
1768 priv->speed_label = label_d5next_speeds; in aqc_probe()
1769 priv->voltage_label = label_d5next_voltages; in aqc_probe()
1770 priv->current_label = label_d5next_current; in aqc_probe()
1773 priv->kind = aquastreamult; in aqc_probe()
1775 priv->num_fans = AQUASTREAMULT_NUM_FANS; in aqc_probe()
1776 priv->fan_sensor_offsets = aquastreamult_sensor_fan_offsets; in aqc_probe()
1778 priv->num_temp_sensors = AQUASTREAMULT_NUM_SENSORS; in aqc_probe()
1779 priv->temp_sensor_start_offset = AQUASTREAMULT_SENSOR_START; in aqc_probe()
1781 priv->temp_label = label_aquastreamult_temp; in aqc_probe()
1782 priv->speed_label = label_aquastreamult_speeds; in aqc_probe()
1783 priv->power_label = label_aquastreamult_power; in aqc_probe()
1784 priv->voltage_label = label_aquastreamult_voltages; in aqc_probe()
1785 priv->current_label = label_aquastreamult_current; in aqc_probe()
1788 priv->kind = poweradjust3; in aqc_probe()
1790 priv->num_fans = 0; in aqc_probe()
1792 priv->num_temp_sensors = POWERADJUST3_NUM_SENSORS; in aqc_probe()
1793 priv->temp_sensor_start_offset = POWERADJUST3_SENSOR_START; in aqc_probe()
1794 priv->buffer_size = POWERADJUST3_SENSOR_REPORT_SIZE; in aqc_probe()
1796 priv->temp_label = label_poweradjust3_temp_sensors; in aqc_probe()
1799 priv->kind = highflow; in aqc_probe()
1801 priv->num_fans = 0; in aqc_probe()
1803 priv->num_temp_sensors = HIGHFLOW_NUM_SENSORS; in aqc_probe()
1804 priv->temp_sensor_start_offset = HIGHFLOW_SENSOR_START; in aqc_probe()
1805 priv->num_flow_sensors = HIGHFLOW_NUM_FLOW_SENSORS; in aqc_probe()
1806 priv->flow_sensors_start_offset = HIGHFLOW_FLOW_SENSOR_OFFSET; in aqc_probe()
1807 priv->buffer_size = HIGHFLOW_SENSOR_REPORT_SIZE; in aqc_probe()
1809 priv->temp_label = label_highflow_temp; in aqc_probe()
1810 priv->speed_label = label_highflow_speeds; in aqc_probe()
1816 switch (priv->kind) { in aqc_probe()
1818 priv->serial_number_start_offset = AQUAERO_SERIAL_START; in aqc_probe()
1819 priv->firmware_version_offset = AQUAERO_FIRMWARE_VERSION; in aqc_probe()
1821 priv->fan_structure = &aqc_aquaero_fan_structure; in aqc_probe()
1823 priv->ctrl_report_id = AQUAERO_CTRL_REPORT_ID; in aqc_probe()
1824 priv->secondary_ctrl_report_id = AQUAERO_SECONDARY_CTRL_REPORT_ID; in aqc_probe()
1825 priv->secondary_ctrl_report_size = AQUAERO_SECONDARY_CTRL_REPORT_SIZE; in aqc_probe()
1826 priv->secondary_ctrl_report = aquaero_secondary_ctrl_report; in aqc_probe()
1829 priv->status_report_id = POWERADJUST3_STATUS_REPORT_ID; in aqc_probe()
1832 priv->serial_number_start_offset = AQUASTREAMXT_SERIAL_START; in aqc_probe()
1833 priv->firmware_version_offset = AQUASTREAMXT_FIRMWARE_VERSION; in aqc_probe()
1835 priv->status_report_id = AQUASTREAMXT_STATUS_REPORT_ID; in aqc_probe()
1838 priv->serial_number_start_offset = HIGHFLOW_SERIAL_START; in aqc_probe()
1839 priv->firmware_version_offset = HIGHFLOW_FIRMWARE_VERSION; in aqc_probe()
1841 priv->status_report_id = HIGHFLOW_STATUS_REPORT_ID; in aqc_probe()
1844 priv->serial_number_start_offset = AQC_SERIAL_START; in aqc_probe()
1845 priv->firmware_version_offset = AQC_FIRMWARE_VERSION; in aqc_probe()
1847 priv->ctrl_report_id = CTRL_REPORT_ID; in aqc_probe()
1848 priv->secondary_ctrl_report_id = SECONDARY_CTRL_REPORT_ID; in aqc_probe()
1849 priv->secondary_ctrl_report_size = SECONDARY_CTRL_REPORT_SIZE; in aqc_probe()
1850 priv->secondary_ctrl_report = secondary_ctrl_report; in aqc_probe()
1852 if (priv->kind == aquastreamult) in aqc_probe()
1853 priv->fan_structure = &aqc_aquastreamult_fan_structure; in aqc_probe()
1855 priv->fan_structure = &aqc_general_fan_structure; in aqc_probe()
1859 if (priv->buffer_size != 0) { in aqc_probe()
1860 priv->checksum_start = 0x01; in aqc_probe()
1861 priv->checksum_length = priv->buffer_size - 3; in aqc_probe()
1862 priv->checksum_offset = priv->buffer_size - 2; in aqc_probe()
1865 priv->name = aqc_device_names[priv->kind]; in aqc_probe()
1867 priv->buffer = devm_kzalloc(&hdev->dev, priv->buffer_size, GFP_KERNEL); in aqc_probe()
1868 if (!priv->buffer) { in aqc_probe()
1869 ret = -ENOMEM; in aqc_probe()
1873 mutex_init(&priv->mutex); in aqc_probe()
1875 priv->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, priv->name, priv, in aqc_probe()
1878 if (IS_ERR(priv->hwmon_dev)) { in aqc_probe()
1879 ret = PTR_ERR(priv->hwmon_dev); in aqc_probe()
1898 debugfs_remove_recursive(priv->debugfs); in aqc_remove()
1899 hwmon_device_unregister(priv->hwmon_dev); in aqc_remove()