Lines Matching +full:current +full:- +full:speed

1 // SPDX-License-Identifier: GPL-2.0+
163 static u16 d5next_ctrl_fan_offsets[] = { 0x97, 0x42 }; /* Pump and fan speed (from 0-100%) */
215 /* Fan speed offsets (0-100%) */
235 static u16 quadro_ctrl_fan_offsets[] = { 0x37, 0x8c, 0xe1, 0x136 }; /* Fan speed offsets (0-100%) */
307 "Pump speed",
308 "Fan speed"
324 "Pump current",
325 "Fan current"
366 /* Labels for Octo and Quadro (except speed) */
368 "Fan 1 speed",
369 "Fan 2 speed",
370 "Fan 3 speed",
371 "Fan 4 speed",
372 "Fan 5 speed",
373 "Fan 6 speed",
374 "Fan 7 speed",
375 "Fan 8 speed"
401 "Fan 1 current",
402 "Fan 2 current",
403 "Fan 3 current",
404 "Fan 4 current",
405 "Fan 5 current",
406 "Fan 6 current",
407 "Fan 7 current",
408 "Fan 8 current"
413 "Fan 1 speed",
414 "Fan 2 speed",
415 "Fan 3 speed",
416 "Fan 4 speed",
417 "Flow speed [dL/h]"
422 "Fan 1 speed",
423 "Fan 2 speed",
424 "Fan 3 speed",
425 "Fan 4 speed",
459 "User-Provided Pump Speed",
460 "User-Provided Flow [dL/h]",
479 "Fan speed",
480 "Pump speed",
482 "Flow speed [dL/h]"
496 "Fan current",
497 "Pump current"
512 "Flow speed [dL/h]"
519 u8 speed; member
527 .speed = AQUAERO_FAN_SPEED_OFFSET
535 .speed = AQUASTREAMULT_FAN_SPEED_OFFSET
543 .speed = AQC_FAN_SPEED_OFFSET
616 /* Converts from centi-percent */
622 /* Converts to centi-percent */
626 return -EINVAL; in aqc_pwm_to_percent()
631 /* Converts raw value for Aquastream XT pump speed to RPM */
639 /* Converts raw value for Aquastream XT fan speed to RPM */
650 * If previous read or write is too close to this one, delay the current operation in aqc_delay_ctrl_report()
653 if (priv->ctrl_report_delay) { in aqc_delay_ctrl_report()
654 s64 delta = ktime_ms_delta(ktime_get(), priv->last_ctrl_report_op); in aqc_delay_ctrl_report()
656 if (delta < priv->ctrl_report_delay) in aqc_delay_ctrl_report()
657 msleep(priv->ctrl_report_delay - delta); in aqc_delay_ctrl_report()
668 memset(priv->buffer, 0x00, priv->buffer_size); in aqc_get_ctrl_data()
669 ret = hid_hw_raw_request(priv->hdev, priv->ctrl_report_id, priv->buffer, priv->buffer_size, in aqc_get_ctrl_data()
672 ret = -ENODATA; in aqc_get_ctrl_data()
674 priv->last_ctrl_report_op = ktime_get(); in aqc_get_ctrl_data()
688 if (priv->kind != aquaero) { in aqc_send_ctrl_data()
689 /* Init and xorout value for CRC-16/USB is 0xffff */ in aqc_send_ctrl_data()
690 checksum = crc16(0xffff, priv->buffer + priv->checksum_start, in aqc_send_ctrl_data()
691 priv->checksum_length); in aqc_send_ctrl_data()
695 put_unaligned_be16(checksum, priv->buffer + priv->checksum_offset); in aqc_send_ctrl_data()
699 ret = hid_hw_raw_request(priv->hdev, priv->ctrl_report_id, priv->buffer, priv->buffer_size, in aqc_send_ctrl_data()
705 ret = hid_hw_raw_request(priv->hdev, priv->secondary_ctrl_report_id, in aqc_send_ctrl_data()
706 priv->secondary_ctrl_report, priv->secondary_ctrl_report_size, in aqc_send_ctrl_data()
710 priv->last_ctrl_report_op = ktime_get(); in aqc_send_ctrl_data()
720 mutex_lock(&priv->mutex); in aqc_get_ctrl_val()
728 *val = (s16)get_unaligned_be16(priv->buffer + offset); in aqc_get_ctrl_val()
731 *val = priv->buffer[offset]; in aqc_get_ctrl_val()
734 ret = -EINVAL; in aqc_get_ctrl_val()
738 mutex_unlock(&priv->mutex); in aqc_get_ctrl_val()
746 mutex_lock(&priv->mutex); in aqc_set_ctrl_vals()
755 put_unaligned_be16((s16)vals[i], priv->buffer + offsets[i]); in aqc_set_ctrl_vals()
758 priv->buffer[offsets[i]] = (u8)vals[i]; in aqc_set_ctrl_vals()
761 ret = -EINVAL; in aqc_set_ctrl_vals()
771 mutex_unlock(&priv->mutex); in aqc_set_ctrl_vals()
786 if (channel < priv->num_temp_sensors) { in aqc_is_visible()
792 if (priv->temp_ctrl_offset != 0) in aqc_is_visible()
801 priv->num_temp_sensors + priv->num_virtual_temp_sensors + in aqc_is_visible()
802 priv->num_calc_virt_temp_sensors) in aqc_is_visible()
812 if (priv->fan_ctrl_offsets && channel < priv->num_fans) { in aqc_is_visible()
825 switch (priv->kind) { in aqc_is_visible()
850 if (channel < priv->num_fans + priv->num_flow_sensors) in aqc_is_visible()
854 if (channel < priv->num_fans) in aqc_is_visible()
861 if (priv->kind == quadro && channel == priv->num_fans) in aqc_is_visible()
868 if (priv->kind == leakshield && channel == 0) in aqc_is_visible()
876 switch (priv->kind) { in aqc_is_visible()
890 if (channel < priv->num_fans) in aqc_is_visible()
896 switch (priv->kind) { in aqc_is_visible()
898 /* Special case to support pump and fan current */ in aqc_is_visible()
903 /* Special case to support pump current */ in aqc_is_visible()
908 if (channel < priv->num_fans) in aqc_is_visible()
914 switch (priv->kind) { in aqc_is_visible()
917 if (channel < priv->num_fans + 2) in aqc_is_visible()
927 if (channel < priv->num_fans) in aqc_is_visible()
944 mutex_lock(&priv->mutex); in aqc_legacy_read()
946 memset(priv->buffer, 0x00, priv->buffer_size); in aqc_legacy_read()
947 ret = hid_hw_raw_request(priv->hdev, priv->status_report_id, priv->buffer, in aqc_legacy_read()
948 priv->buffer_size, HID_FEATURE_REPORT, HID_REQ_GET_REPORT); in aqc_legacy_read()
953 for (i = 0; i < priv->num_temp_sensors; i++) { in aqc_legacy_read()
954 sensor_value = get_unaligned_le16(priv->buffer + priv->temp_sensor_start_offset + in aqc_legacy_read()
957 priv->temp_input[i] = -ENODATA; in aqc_legacy_read()
959 priv->temp_input[i] = sensor_value * 10; in aqc_legacy_read()
962 /* Special-case sensor readings */ in aqc_legacy_read()
963 switch (priv->kind) { in aqc_legacy_read()
966 priv->serial_number[0] = get_unaligned_le16(priv->buffer + in aqc_legacy_read()
967 priv->serial_number_start_offset); in aqc_legacy_read()
968 priv->firmware_version = in aqc_legacy_read()
969 get_unaligned_le16(priv->buffer + priv->firmware_version_offset); in aqc_legacy_read()
971 /* Read pump speed in RPM */ in aqc_legacy_read()
972 sensor_value = get_unaligned_le16(priv->buffer + priv->fan_sensor_offsets[0]); in aqc_legacy_read()
973 priv->speed_input[0] = aqc_aquastreamxt_convert_pump_rpm(sensor_value); in aqc_legacy_read()
975 /* Read fan speed in RPM, if available */ in aqc_legacy_read()
976 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_FAN_STATUS_OFFSET); in aqc_legacy_read()
978 priv->speed_input[1] = 0; in aqc_legacy_read()
981 get_unaligned_le16(priv->buffer + priv->fan_sensor_offsets[1]); in aqc_legacy_read()
982 priv->speed_input[1] = aqc_aquastreamxt_convert_fan_rpm(sensor_value); in aqc_legacy_read()
986 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_PUMP_CURR_OFFSET); in aqc_legacy_read()
987 priv->current_input[0] = DIV_ROUND_CLOSEST(sensor_value * 176, 100) - 52; in aqc_legacy_read()
989 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_PUMP_VOLTAGE_OFFSET); in aqc_legacy_read()
990 priv->voltage_input[0] = DIV_ROUND_CLOSEST(sensor_value * 1000, 61); in aqc_legacy_read()
992 sensor_value = get_unaligned_le16(priv->buffer + AQUASTREAMXT_FAN_VOLTAGE_OFFSET); in aqc_legacy_read()
993 priv->voltage_input[1] = DIV_ROUND_CLOSEST(sensor_value * 1000, 63); in aqc_legacy_read()
997 priv->serial_number[0] = get_unaligned_le16(priv->buffer + in aqc_legacy_read()
998 priv->serial_number_start_offset); in aqc_legacy_read()
999 priv->firmware_version = in aqc_legacy_read()
1000 get_unaligned_le16(priv->buffer + priv->firmware_version_offset); in aqc_legacy_read()
1002 /* Read flow speed */ in aqc_legacy_read()
1003 priv->speed_input[0] = get_unaligned_le16(priv->buffer + in aqc_legacy_read()
1004 priv->flow_sensors_start_offset); in aqc_legacy_read()
1010 priv->updated = jiffies; in aqc_legacy_read()
1013 mutex_unlock(&priv->mutex); in aqc_legacy_read()
1023 if (time_after(jiffies, priv->updated + STATUS_UPDATE_INTERVAL)) { in aqc_read()
1024 if (priv->status_report_id != 0) { in aqc_read()
1028 return -ENODATA; in aqc_read()
1030 return -ENODATA; in aqc_read()
1038 if (priv->temp_input[channel] == -ENODATA) in aqc_read()
1039 return -ENODATA; in aqc_read()
1041 *val = priv->temp_input[channel]; in aqc_read()
1045 aqc_get_ctrl_val(priv, priv->temp_ctrl_offset + in aqc_read()
1059 if (priv->speed_input[channel] == -ENODATA) in aqc_read()
1060 return -ENODATA; in aqc_read()
1062 *val = priv->speed_input[channel]; in aqc_read()
1065 *val = priv->speed_input_min[channel]; in aqc_read()
1068 *val = priv->speed_input_max[channel]; in aqc_read()
1071 *val = priv->speed_input_target[channel]; in aqc_read()
1074 ret = aqc_get_ctrl_val(priv, priv->flow_pulses_ctrl_offset, in aqc_read()
1084 *val = priv->power_input[channel]; in aqc_read()
1087 switch (priv->kind) { in aqc_read()
1097 ret = aqc_get_ctrl_val(priv, priv->fan_ctrl_offsets[channel], in aqc_read()
1107 *val = priv->voltage_input[channel]; in aqc_read()
1110 *val = priv->current_input[channel]; in aqc_read()
1113 return -EOPNOTSUPP; in aqc_read()
1125 int num_non_calc_sensors = priv->num_temp_sensors + priv->num_virtual_temp_sensors; in aqc_read_string()
1129 if (channel < priv->num_temp_sensors) { in aqc_read_string()
1130 *str = priv->temp_label[channel]; in aqc_read_string()
1132 if (priv->kind == aquaero && channel >= num_non_calc_sensors) in aqc_read_string()
1134 priv->calc_virt_temp_label[channel - num_non_calc_sensors]; in aqc_read_string()
1136 *str = priv->virtual_temp_label[channel - priv->num_temp_sensors]; in aqc_read_string()
1140 *str = priv->speed_label[channel]; in aqc_read_string()
1143 *str = priv->power_label[channel]; in aqc_read_string()
1146 *str = priv->voltage_label[channel]; in aqc_read_string()
1149 *str = priv->current_label[channel]; in aqc_read_string()
1152 return -EOPNOTSUPP; in aqc_read_string()
1172 /* Limit temp offset to +/- 15K as in the official software */ in aqc_write()
1173 val = clamp_val(val, -15000, 15000) / 10; in aqc_write()
1175 aqc_set_ctrl_val(priv, priv->temp_ctrl_offset + in aqc_write()
1181 return -EOPNOTSUPP; in aqc_write()
1188 ret = aqc_set_ctrl_val(priv, priv->flow_pulses_ctrl_offset, in aqc_write()
1204 switch (priv->kind) { in aqc_write()
1213 ctrl_values_offsets[1] = priv->fan_ctrl_offsets[channel] + in aqc_write()
1219 ctrl_values_offsets[2] = priv->fan_ctrl_offsets[channel] + in aqc_write()
1224 /* Set maximum power to 255 to allow the fan to reach max speed */ in aqc_write()
1225 ctrl_values_offsets[3] = priv->fan_ctrl_offsets[channel] + in aqc_write()
1236 ret = aqc_set_ctrl_val(priv, priv->fan_ctrl_offsets[channel], in aqc_write()
1248 return -EOPNOTSUPP; in aqc_write()
1342 if (report->id != STATUS_REPORT_ID) in aqc_raw_event()
1348 priv->serial_number[0] = get_unaligned_be16(data + priv->serial_number_start_offset); in aqc_raw_event()
1349 priv->serial_number[1] = get_unaligned_be16(data + priv->serial_number_start_offset + in aqc_raw_event()
1351 priv->firmware_version = get_unaligned_be16(data + priv->firmware_version_offset); in aqc_raw_event()
1354 for (i = 0; i < priv->num_temp_sensors; i++) { in aqc_raw_event()
1356 priv->temp_sensor_start_offset + in aqc_raw_event()
1359 priv->temp_input[i] = -ENODATA; in aqc_raw_event()
1361 priv->temp_input[i] = sensor_value * 10; in aqc_raw_event()
1365 for (j = 0; j < priv->num_virtual_temp_sensors; j++) { in aqc_raw_event()
1367 priv->virtual_temp_sensor_start_offset + in aqc_raw_event()
1370 priv->temp_input[i] = -ENODATA; in aqc_raw_event()
1372 priv->temp_input[i] = sensor_value * 10; in aqc_raw_event()
1376 /* Fan speed and related readings */ in aqc_raw_event()
1377 for (i = 0; i < priv->num_fans; i++) { in aqc_raw_event()
1378 priv->speed_input[i] = in aqc_raw_event()
1379 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1380 priv->fan_structure->speed); in aqc_raw_event()
1381 priv->power_input[i] = in aqc_raw_event()
1382 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1383 priv->fan_structure->power) * 10000; in aqc_raw_event()
1384 priv->voltage_input[i] = in aqc_raw_event()
1385 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1386 priv->fan_structure->voltage) * 10; in aqc_raw_event()
1387 priv->current_input[i] = in aqc_raw_event()
1388 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
1389 priv->fan_structure->curr); in aqc_raw_event()
1393 for (j = 0; j < priv->num_flow_sensors; j++) { in aqc_raw_event()
1394 priv->speed_input[i] = get_unaligned_be16(data + priv->flow_sensors_start_offset + in aqc_raw_event()
1399 if (priv->power_cycle_count_offset != 0) in aqc_raw_event()
1400 priv->power_cycles = get_unaligned_be32(data + priv->power_cycle_count_offset); in aqc_raw_event()
1402 /* Special-case sensor readings */ in aqc_raw_event()
1403 switch (priv->kind) { in aqc_raw_event()
1406 i = priv->num_temp_sensors + priv->num_virtual_temp_sensors; in aqc_raw_event()
1407 for (j = 0; j < priv->num_calc_virt_temp_sensors; j++) { in aqc_raw_event()
1409 priv->calc_virt_temp_sensor_start_offset + in aqc_raw_event()
1412 priv->temp_input[i] = -ENODATA; in aqc_raw_event()
1414 priv->temp_input[i] = sensor_value * 10; in aqc_raw_event()
1419 priv->speed_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_OFFSET); in aqc_raw_event()
1420 priv->speed_input[2] = get_unaligned_be16(data + AQUASTREAMULT_PRESSURE_OFFSET); in aqc_raw_event()
1421 priv->speed_input[3] = get_unaligned_be16(data + AQUASTREAMULT_FLOW_SENSOR_OFFSET); in aqc_raw_event()
1423 priv->power_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_POWER) * 10000; in aqc_raw_event()
1425 priv->voltage_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_VOLTAGE) * 10; in aqc_raw_event()
1427 priv->current_input[1] = get_unaligned_be16(data + AQUASTREAMULT_PUMP_CURRENT); in aqc_raw_event()
1430 priv->voltage_input[2] = get_unaligned_be16(data + D5NEXT_5V_VOLTAGE) * 10; in aqc_raw_event()
1431 priv->voltage_input[3] = get_unaligned_be16(data + D5NEXT_12V_VOLTAGE) * 10; in aqc_raw_event()
1435 if (priv->temp_input[1] == -ENODATA) in aqc_raw_event()
1436 priv->power_input[0] = -ENODATA; in aqc_raw_event()
1438 priv->power_input[0] = in aqc_raw_event()
1441 priv->voltage_input[0] = get_unaligned_be16(data + HIGHFLOWNEXT_5V_VOLTAGE) * 10; in aqc_raw_event()
1442 priv->voltage_input[1] = in aqc_raw_event()
1445 priv->speed_input[1] = get_unaligned_be16(data + HIGHFLOWNEXT_WATER_QUALITY); in aqc_raw_event()
1446 priv->speed_input[2] = get_unaligned_be16(data + HIGHFLOWNEXT_CONDUCTIVITY); in aqc_raw_event()
1449 priv->speed_input[0] = in aqc_raw_event()
1451 priv->speed_input_min[0] = get_unaligned_be16(data + LEAKSHIELD_PRESSURE_MIN) * 100; in aqc_raw_event()
1452 priv->speed_input_target[0] = in aqc_raw_event()
1454 priv->speed_input_max[0] = get_unaligned_be16(data + LEAKSHIELD_PRESSURE_MAX) * 100; in aqc_raw_event()
1456 priv->speed_input[1] = get_unaligned_be16(data + LEAKSHIELD_PUMP_RPM_IN); in aqc_raw_event()
1457 if (priv->speed_input[1] == AQC_SENSOR_NA) in aqc_raw_event()
1458 priv->speed_input[1] = -ENODATA; in aqc_raw_event()
1460 priv->speed_input[2] = get_unaligned_be16(data + LEAKSHIELD_FLOW_IN); in aqc_raw_event()
1461 if (priv->speed_input[2] == AQC_SENSOR_NA) in aqc_raw_event()
1462 priv->speed_input[2] = -ENODATA; in aqc_raw_event()
1464 priv->speed_input[3] = get_unaligned_be16(data + LEAKSHIELD_RESERVOIR_VOLUME); in aqc_raw_event()
1465 priv->speed_input[4] = get_unaligned_be16(data + LEAKSHIELD_RESERVOIR_FILLED); in aqc_raw_event()
1468 priv->temp_input[1] = get_unaligned_be16(data + LEAKSHIELD_TEMPERATURE_2) * 10; in aqc_raw_event()
1474 priv->updated = jiffies; in aqc_raw_event()
1481 struct aqc_data *priv = seqf->private; in serial_number_show()
1483 seq_printf(seqf, "%05u-%05u\n", priv->serial_number[0], priv->serial_number[1]); in serial_number_show()
1491 struct aqc_data *priv = seqf->private; in firmware_version_show()
1493 seq_printf(seqf, "%u\n", priv->firmware_version); in firmware_version_show()
1501 struct aqc_data *priv = seqf->private; in power_cycles_show()
1503 seq_printf(seqf, "%u\n", priv->power_cycles); in power_cycles_show()
1513 scnprintf(name, sizeof(name), "%s_%s-%s", "aquacomputer", priv->name, in aqc_debugfs_init()
1514 dev_name(&priv->hdev->dev)); in aqc_debugfs_init()
1516 priv->debugfs = debugfs_create_dir(name, NULL); in aqc_debugfs_init()
1518 if (priv->serial_number_start_offset != 0) in aqc_debugfs_init()
1519 debugfs_create_file("serial_number", 0444, priv->debugfs, priv, in aqc_debugfs_init()
1521 if (priv->firmware_version_offset != 0) in aqc_debugfs_init()
1522 debugfs_create_file("firmware_version", 0444, priv->debugfs, priv, in aqc_debugfs_init()
1524 if (priv->power_cycle_count_offset != 0) in aqc_debugfs_init()
1525 debugfs_create_file("power_cycles", 0444, priv->debugfs, priv, &power_cycles_fops); in aqc_debugfs_init()
1533 priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); in aqc_probe()
1535 return -ENOMEM; in aqc_probe()
1537 priv->hdev = hdev; in aqc_probe()
1540 priv->updated = jiffies - STATUS_UPDATE_INTERVAL; in aqc_probe()
1554 switch (hdev->product) { in aqc_probe()
1567 if (hdev->collection[1].type != 0) { in aqc_probe()
1568 ret = -ENODEV; in aqc_probe()
1572 priv->kind = aquaero; in aqc_probe()
1574 priv->num_fans = AQUAERO_NUM_FANS; in aqc_probe()
1575 priv->fan_sensor_offsets = aquaero_sensor_fan_offsets; in aqc_probe()
1576 priv->fan_ctrl_offsets = aquaero_ctrl_fan_offsets; in aqc_probe()
1578 priv->num_temp_sensors = AQUAERO_NUM_SENSORS; in aqc_probe()
1579 priv->temp_sensor_start_offset = AQUAERO_SENSOR_START; in aqc_probe()
1580 priv->num_virtual_temp_sensors = AQUAERO_NUM_VIRTUAL_SENSORS; in aqc_probe()
1581 priv->virtual_temp_sensor_start_offset = AQUAERO_VIRTUAL_SENSOR_START; in aqc_probe()
1582 priv->num_calc_virt_temp_sensors = AQUAERO_NUM_CALC_VIRTUAL_SENSORS; in aqc_probe()
1583 priv->calc_virt_temp_sensor_start_offset = AQUAERO_CALC_VIRTUAL_SENSOR_START; in aqc_probe()
1584 priv->num_flow_sensors = AQUAERO_NUM_FLOW_SENSORS; in aqc_probe()
1585 priv->flow_sensors_start_offset = AQUAERO_FLOW_SENSORS_START; in aqc_probe()
1587 priv->buffer_size = AQUAERO_CTRL_REPORT_SIZE; in aqc_probe()
1588 priv->temp_ctrl_offset = AQUAERO_TEMP_CTRL_OFFSET; in aqc_probe()
1589 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1591 priv->temp_label = label_temp_sensors; in aqc_probe()
1592 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1593 priv->calc_virt_temp_label = label_aquaero_calc_temp_sensors; in aqc_probe()
1594 priv->speed_label = label_aquaero_speeds; in aqc_probe()
1595 priv->power_label = label_fan_power; in aqc_probe()
1596 priv->voltage_label = label_fan_voltage; in aqc_probe()
1597 priv->current_label = label_fan_current; in aqc_probe()
1600 priv->kind = d5next; in aqc_probe()
1602 priv->num_fans = D5NEXT_NUM_FANS; in aqc_probe()
1603 priv->fan_sensor_offsets = d5next_sensor_fan_offsets; in aqc_probe()
1604 priv->fan_ctrl_offsets = d5next_ctrl_fan_offsets; in aqc_probe()
1606 priv->num_temp_sensors = D5NEXT_NUM_SENSORS; in aqc_probe()
1607 priv->temp_sensor_start_offset = D5NEXT_COOLANT_TEMP; in aqc_probe()
1608 priv->num_virtual_temp_sensors = D5NEXT_NUM_VIRTUAL_SENSORS; in aqc_probe()
1609 priv->virtual_temp_sensor_start_offset = D5NEXT_VIRTUAL_SENSORS_START; in aqc_probe()
1610 priv->temp_ctrl_offset = D5NEXT_TEMP_CTRL_OFFSET; in aqc_probe()
1612 priv->buffer_size = D5NEXT_CTRL_REPORT_SIZE; in aqc_probe()
1613 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1615 priv->power_cycle_count_offset = D5NEXT_POWER_CYCLES; in aqc_probe()
1617 priv->temp_label = label_d5next_temp; in aqc_probe()
1618 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1619 priv->speed_label = label_d5next_speeds; in aqc_probe()
1620 priv->power_label = label_d5next_power; in aqc_probe()
1621 priv->voltage_label = label_d5next_voltages; in aqc_probe()
1622 priv->current_label = label_d5next_current; in aqc_probe()
1625 priv->kind = farbwerk; in aqc_probe()
1627 priv->num_fans = 0; in aqc_probe()
1629 priv->num_temp_sensors = FARBWERK_NUM_SENSORS; in aqc_probe()
1630 priv->temp_sensor_start_offset = FARBWERK_SENSOR_START; in aqc_probe()
1632 priv->temp_label = label_temp_sensors; in aqc_probe()
1635 priv->kind = farbwerk360; in aqc_probe()
1637 priv->num_fans = 0; in aqc_probe()
1639 priv->num_temp_sensors = FARBWERK360_NUM_SENSORS; in aqc_probe()
1640 priv->temp_sensor_start_offset = FARBWERK360_SENSOR_START; in aqc_probe()
1641 priv->num_virtual_temp_sensors = FARBWERK360_NUM_VIRTUAL_SENSORS; in aqc_probe()
1642 priv->virtual_temp_sensor_start_offset = FARBWERK360_VIRTUAL_SENSORS_START; in aqc_probe()
1643 priv->temp_ctrl_offset = FARBWERK360_TEMP_CTRL_OFFSET; in aqc_probe()
1645 priv->buffer_size = FARBWERK360_CTRL_REPORT_SIZE; in aqc_probe()
1647 priv->temp_label = label_temp_sensors; in aqc_probe()
1648 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1651 priv->kind = octo; in aqc_probe()
1653 priv->num_fans = OCTO_NUM_FANS; in aqc_probe()
1654 priv->fan_sensor_offsets = octo_sensor_fan_offsets; in aqc_probe()
1655 priv->fan_ctrl_offsets = octo_ctrl_fan_offsets; in aqc_probe()
1657 priv->num_temp_sensors = OCTO_NUM_SENSORS; in aqc_probe()
1658 priv->temp_sensor_start_offset = OCTO_SENSOR_START; in aqc_probe()
1659 priv->num_virtual_temp_sensors = OCTO_NUM_VIRTUAL_SENSORS; in aqc_probe()
1660 priv->virtual_temp_sensor_start_offset = OCTO_VIRTUAL_SENSORS_START; in aqc_probe()
1661 priv->temp_ctrl_offset = OCTO_TEMP_CTRL_OFFSET; in aqc_probe()
1663 priv->buffer_size = OCTO_CTRL_REPORT_SIZE; in aqc_probe()
1664 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1666 priv->power_cycle_count_offset = OCTO_POWER_CYCLES; in aqc_probe()
1668 priv->temp_label = label_temp_sensors; in aqc_probe()
1669 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1670 priv->speed_label = label_fan_speed; in aqc_probe()
1671 priv->power_label = label_fan_power; in aqc_probe()
1672 priv->voltage_label = label_fan_voltage; in aqc_probe()
1673 priv->current_label = label_fan_current; in aqc_probe()
1676 priv->kind = quadro; in aqc_probe()
1678 priv->num_fans = QUADRO_NUM_FANS; in aqc_probe()
1679 priv->fan_sensor_offsets = quadro_sensor_fan_offsets; in aqc_probe()
1680 priv->fan_ctrl_offsets = quadro_ctrl_fan_offsets; in aqc_probe()
1682 priv->num_temp_sensors = QUADRO_NUM_SENSORS; in aqc_probe()
1683 priv->temp_sensor_start_offset = QUADRO_SENSOR_START; in aqc_probe()
1684 priv->num_virtual_temp_sensors = QUADRO_NUM_VIRTUAL_SENSORS; in aqc_probe()
1685 priv->virtual_temp_sensor_start_offset = QUADRO_VIRTUAL_SENSORS_START; in aqc_probe()
1686 priv->num_flow_sensors = QUADRO_NUM_FLOW_SENSORS; in aqc_probe()
1687 priv->flow_sensors_start_offset = QUADRO_FLOW_SENSOR_OFFSET; in aqc_probe()
1689 priv->temp_ctrl_offset = QUADRO_TEMP_CTRL_OFFSET; in aqc_probe()
1691 priv->buffer_size = QUADRO_CTRL_REPORT_SIZE; in aqc_probe()
1692 priv->ctrl_report_delay = CTRL_REPORT_DELAY; in aqc_probe()
1694 priv->flow_pulses_ctrl_offset = QUADRO_FLOW_PULSES_CTRL_OFFSET; in aqc_probe()
1695 priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; in aqc_probe()
1697 priv->temp_label = label_temp_sensors; in aqc_probe()
1698 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
1699 priv->speed_label = label_quadro_speeds; in aqc_probe()
1700 priv->power_label = label_fan_power; in aqc_probe()
1701 priv->voltage_label = label_fan_voltage; in aqc_probe()
1702 priv->current_label = label_fan_current; in aqc_probe()
1705 priv->kind = highflownext; in aqc_probe()
1707 priv->num_fans = 0; in aqc_probe()
1709 priv->num_temp_sensors = HIGHFLOWNEXT_NUM_SENSORS; in aqc_probe()
1710 priv->temp_sensor_start_offset = HIGHFLOWNEXT_SENSOR_START; in aqc_probe()
1711 priv->num_flow_sensors = HIGHFLOWNEXT_NUM_FLOW_SENSORS; in aqc_probe()
1712 priv->flow_sensors_start_offset = HIGHFLOWNEXT_FLOW; in aqc_probe()
1714 priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; in aqc_probe()
1716 priv->temp_label = label_highflownext_temp_sensors; in aqc_probe()
1717 priv->speed_label = label_highflownext_fan_speed; in aqc_probe()
1718 priv->power_label = label_highflownext_power; in aqc_probe()
1719 priv->voltage_label = label_highflownext_voltage; in aqc_probe()
1726 if (hdev->type != 2) { in aqc_probe()
1727 ret = -ENODEV; in aqc_probe()
1731 priv->kind = leakshield; in aqc_probe()
1733 priv->num_fans = 0; in aqc_probe()
1734 priv->num_temp_sensors = LEAKSHIELD_NUM_SENSORS; in aqc_probe()
1735 priv->temp_sensor_start_offset = LEAKSHIELD_TEMPERATURE_1; in aqc_probe()
1737 priv->temp_label = label_leakshield_temp_sensors; in aqc_probe()
1738 priv->speed_label = label_leakshield_fan_speed; in aqc_probe()
1741 priv->kind = aquastreamxt; in aqc_probe()
1743 priv->num_fans = AQUASTREAMXT_NUM_FANS; in aqc_probe()
1744 priv->fan_sensor_offsets = aquastreamxt_sensor_fan_offsets; in aqc_probe()
1746 priv->num_temp_sensors = AQUASTREAMXT_NUM_SENSORS; in aqc_probe()
1747 priv->temp_sensor_start_offset = AQUASTREAMXT_SENSOR_START; in aqc_probe()
1748 priv->buffer_size = AQUASTREAMXT_SENSOR_REPORT_SIZE; in aqc_probe()
1750 priv->temp_label = label_aquastreamxt_temp_sensors; in aqc_probe()
1751 priv->speed_label = label_d5next_speeds; in aqc_probe()
1752 priv->voltage_label = label_d5next_voltages; in aqc_probe()
1753 priv->current_label = label_d5next_current; in aqc_probe()
1756 priv->kind = aquastreamult; in aqc_probe()
1758 priv->num_fans = AQUASTREAMULT_NUM_FANS; in aqc_probe()
1759 priv->fan_sensor_offsets = aquastreamult_sensor_fan_offsets; in aqc_probe()
1761 priv->num_temp_sensors = AQUASTREAMULT_NUM_SENSORS; in aqc_probe()
1762 priv->temp_sensor_start_offset = AQUASTREAMULT_SENSOR_START; in aqc_probe()
1764 priv->temp_label = label_aquastreamult_temp; in aqc_probe()
1765 priv->speed_label = label_aquastreamult_speeds; in aqc_probe()
1766 priv->power_label = label_aquastreamult_power; in aqc_probe()
1767 priv->voltage_label = label_aquastreamult_voltages; in aqc_probe()
1768 priv->current_label = label_aquastreamult_current; in aqc_probe()
1771 priv->kind = poweradjust3; in aqc_probe()
1773 priv->num_fans = 0; in aqc_probe()
1775 priv->num_temp_sensors = POWERADJUST3_NUM_SENSORS; in aqc_probe()
1776 priv->temp_sensor_start_offset = POWERADJUST3_SENSOR_START; in aqc_probe()
1777 priv->buffer_size = POWERADJUST3_SENSOR_REPORT_SIZE; in aqc_probe()
1779 priv->temp_label = label_poweradjust3_temp_sensors; in aqc_probe()
1782 priv->kind = highflow; in aqc_probe()
1784 priv->num_fans = 0; in aqc_probe()
1786 priv->num_temp_sensors = HIGHFLOW_NUM_SENSORS; in aqc_probe()
1787 priv->temp_sensor_start_offset = HIGHFLOW_SENSOR_START; in aqc_probe()
1788 priv->num_flow_sensors = HIGHFLOW_NUM_FLOW_SENSORS; in aqc_probe()
1789 priv->flow_sensors_start_offset = HIGHFLOW_FLOW_SENSOR_OFFSET; in aqc_probe()
1790 priv->buffer_size = HIGHFLOW_SENSOR_REPORT_SIZE; in aqc_probe()
1792 priv->temp_label = label_highflow_temp; in aqc_probe()
1793 priv->speed_label = label_highflow_speeds; in aqc_probe()
1799 switch (priv->kind) { in aqc_probe()
1801 priv->serial_number_start_offset = AQUAERO_SERIAL_START; in aqc_probe()
1802 priv->firmware_version_offset = AQUAERO_FIRMWARE_VERSION; in aqc_probe()
1804 priv->fan_structure = &aqc_aquaero_fan_structure; in aqc_probe()
1806 priv->ctrl_report_id = AQUAERO_CTRL_REPORT_ID; in aqc_probe()
1807 priv->secondary_ctrl_report_id = AQUAERO_SECONDARY_CTRL_REPORT_ID; in aqc_probe()
1808 priv->secondary_ctrl_report_size = AQUAERO_SECONDARY_CTRL_REPORT_SIZE; in aqc_probe()
1809 priv->secondary_ctrl_report = aquaero_secondary_ctrl_report; in aqc_probe()
1812 priv->status_report_id = POWERADJUST3_STATUS_REPORT_ID; in aqc_probe()
1815 priv->serial_number_start_offset = AQUASTREAMXT_SERIAL_START; in aqc_probe()
1816 priv->firmware_version_offset = AQUASTREAMXT_FIRMWARE_VERSION; in aqc_probe()
1818 priv->status_report_id = AQUASTREAMXT_STATUS_REPORT_ID; in aqc_probe()
1821 priv->serial_number_start_offset = HIGHFLOW_SERIAL_START; in aqc_probe()
1822 priv->firmware_version_offset = HIGHFLOW_FIRMWARE_VERSION; in aqc_probe()
1824 priv->status_report_id = HIGHFLOW_STATUS_REPORT_ID; in aqc_probe()
1827 priv->serial_number_start_offset = AQC_SERIAL_START; in aqc_probe()
1828 priv->firmware_version_offset = AQC_FIRMWARE_VERSION; in aqc_probe()
1830 priv->ctrl_report_id = CTRL_REPORT_ID; in aqc_probe()
1831 priv->secondary_ctrl_report_id = SECONDARY_CTRL_REPORT_ID; in aqc_probe()
1832 priv->secondary_ctrl_report_size = SECONDARY_CTRL_REPORT_SIZE; in aqc_probe()
1833 priv->secondary_ctrl_report = secondary_ctrl_report; in aqc_probe()
1835 if (priv->kind == aquastreamult) in aqc_probe()
1836 priv->fan_structure = &aqc_aquastreamult_fan_structure; in aqc_probe()
1838 priv->fan_structure = &aqc_general_fan_structure; in aqc_probe()
1842 if (priv->buffer_size != 0) { in aqc_probe()
1843 priv->checksum_start = 0x01; in aqc_probe()
1844 priv->checksum_length = priv->buffer_size - 3; in aqc_probe()
1845 priv->checksum_offset = priv->buffer_size - 2; in aqc_probe()
1848 priv->name = aqc_device_names[priv->kind]; in aqc_probe()
1850 priv->buffer = devm_kzalloc(&hdev->dev, priv->buffer_size, GFP_KERNEL); in aqc_probe()
1851 if (!priv->buffer) { in aqc_probe()
1852 ret = -ENOMEM; in aqc_probe()
1856 mutex_init(&priv->mutex); in aqc_probe()
1858 priv->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, priv->name, priv, in aqc_probe()
1861 if (IS_ERR(priv->hwmon_dev)) { in aqc_probe()
1862 ret = PTR_ERR(priv->hwmon_dev); in aqc_probe()
1881 debugfs_remove_recursive(priv->debugfs); in aqc_remove()
1882 hwmon_device_unregister(priv->hwmon_dev); in aqc_remove()