Lines Matching +full:current +full:- +full:speed
1 // SPDX-License-Identifier: GPL-2.0+
85 /* Pump and fan speed registers in D5 Next control report (from 0-100%) */
108 /* Fan speed registers in Octo control report (from 0-100%) */
122 /* Fan speed registers in Quadro control report (from 0-100%) */
141 "Pump speed",
142 "Fan speed"
158 "Pump current",
159 "Fan current"
189 /* Labels for Octo and Quadro (except speed) */
191 "Fan 1 speed",
192 "Fan 2 speed",
193 "Fan 3 speed",
194 "Fan 4 speed",
195 "Fan 5 speed",
196 "Fan 6 speed",
197 "Fan 7 speed",
198 "Fan 8 speed"
224 "Fan 1 current",
225 "Fan 2 current",
226 "Fan 3 current",
227 "Fan 4 current",
228 "Fan 5 current",
229 "Fan 6 current",
230 "Fan 7 current",
231 "Fan 8 current"
236 "Fan 1 speed",
237 "Fan 2 speed",
238 "Fan 3 speed",
239 "Fan 4 speed",
240 "Flow speed [dL/h]"
313 /* Converts from centi-percent */
319 /* Converts to centi-percent */
323 return -EINVAL; in aqc_pwm_to_percent()
333 memset(priv->buffer, 0x00, priv->buffer_size); in aqc_get_ctrl_data()
334 ret = hid_hw_raw_request(priv->hdev, CTRL_REPORT_ID, priv->buffer, priv->buffer_size, in aqc_get_ctrl_data()
337 ret = -ENODATA; in aqc_get_ctrl_data()
348 /* Init and xorout value for CRC-16/USB is 0xffff */ in aqc_send_ctrl_data()
349 checksum = crc16(0xffff, priv->buffer + priv->checksum_start, priv->checksum_length); in aqc_send_ctrl_data()
353 put_unaligned_be16(checksum, priv->buffer + priv->checksum_offset); in aqc_send_ctrl_data()
356 ret = hid_hw_raw_request(priv->hdev, CTRL_REPORT_ID, priv->buffer, priv->buffer_size, in aqc_send_ctrl_data()
362 ret = hid_hw_raw_request(priv->hdev, SECONDARY_CTRL_REPORT_ID, secondary_ctrl_report, in aqc_send_ctrl_data()
373 mutex_lock(&priv->mutex); in aqc_get_ctrl_val()
379 ret = get_unaligned_be16(priv->buffer + offset); in aqc_get_ctrl_val()
382 mutex_unlock(&priv->mutex); in aqc_get_ctrl_val()
390 mutex_lock(&priv->mutex); in aqc_set_ctrl_val()
396 put_unaligned_be16((u16)val, priv->buffer + offset); in aqc_set_ctrl_val()
401 mutex_unlock(&priv->mutex); in aqc_set_ctrl_val()
411 if (channel < priv->num_temp_sensors + priv->num_virtual_temp_sensors) in aqc_is_visible()
415 if (priv->fan_ctrl_offsets && channel < priv->num_fans) { in aqc_is_visible()
425 switch (priv->kind) { in aqc_is_visible()
433 if (channel < priv->num_fans + 1) in aqc_is_visible()
437 if (channel < priv->num_fans) in aqc_is_visible()
443 switch (priv->kind) { in aqc_is_visible()
450 if (channel < priv->num_fans) in aqc_is_visible()
456 if (channel < priv->num_fans) in aqc_is_visible()
460 switch (priv->kind) { in aqc_is_visible()
463 if (channel < priv->num_fans + 2) in aqc_is_visible()
472 if (channel < priv->num_fans) in aqc_is_visible()
490 if (time_after(jiffies, priv->updated + STATUS_UPDATE_INTERVAL)) in aqc_read()
491 return -ENODATA; in aqc_read()
495 if (priv->temp_input[channel] == -ENODATA) in aqc_read()
496 return -ENODATA; in aqc_read()
498 *val = priv->temp_input[channel]; in aqc_read()
501 *val = priv->speed_input[channel]; in aqc_read()
504 *val = priv->power_input[channel]; in aqc_read()
507 if (priv->fan_ctrl_offsets) { in aqc_read()
508 ret = aqc_get_ctrl_val(priv, priv->fan_ctrl_offsets[channel]); in aqc_read()
516 *val = priv->voltage_input[channel]; in aqc_read()
519 *val = priv->current_input[channel]; in aqc_read()
522 return -EOPNOTSUPP; in aqc_read()
535 if (channel < priv->num_temp_sensors) in aqc_read_string()
536 *str = priv->temp_label[channel]; in aqc_read_string()
538 *str = priv->virtual_temp_label[channel - priv->num_temp_sensors]; in aqc_read_string()
541 *str = priv->speed_label[channel]; in aqc_read_string()
544 *str = priv->power_label[channel]; in aqc_read_string()
547 *str = priv->voltage_label[channel]; in aqc_read_string()
550 *str = priv->current_label[channel]; in aqc_read_string()
553 return -EOPNOTSUPP; in aqc_read_string()
569 if (priv->fan_ctrl_offsets) { in aqc_write()
574 ret = aqc_set_ctrl_val(priv, priv->fan_ctrl_offsets[channel], in aqc_write()
585 return -EOPNOTSUPP; in aqc_write()
678 if (report->id != STATUS_REPORT_ID) in aqc_raw_event()
684 priv->serial_number[0] = get_unaligned_be16(data + SERIAL_FIRST_PART); in aqc_raw_event()
685 priv->serial_number[1] = get_unaligned_be16(data + SERIAL_SECOND_PART); in aqc_raw_event()
686 priv->firmware_version = get_unaligned_be16(data + FIRMWARE_VERSION); in aqc_raw_event()
689 for (i = 0; i < priv->num_temp_sensors; i++) { in aqc_raw_event()
691 priv->temp_sensor_start_offset + in aqc_raw_event()
694 priv->temp_input[i] = -ENODATA; in aqc_raw_event()
696 priv->temp_input[i] = sensor_value * 10; in aqc_raw_event()
700 for (j = 0; j < priv->num_virtual_temp_sensors; j++) { in aqc_raw_event()
702 priv->virtual_temp_sensor_start_offset + in aqc_raw_event()
705 priv->temp_input[i] = -ENODATA; in aqc_raw_event()
707 priv->temp_input[i] = sensor_value * 10; in aqc_raw_event()
711 /* Fan speed and related readings */ in aqc_raw_event()
712 for (i = 0; i < priv->num_fans; i++) { in aqc_raw_event()
713 priv->speed_input[i] = in aqc_raw_event()
714 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + AQC_FAN_SPEED_OFFSET); in aqc_raw_event()
715 priv->power_input[i] = in aqc_raw_event()
716 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
718 priv->voltage_input[i] = in aqc_raw_event()
719 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + in aqc_raw_event()
721 priv->current_input[i] = in aqc_raw_event()
722 get_unaligned_be16(data + priv->fan_sensor_offsets[i] + AQC_FAN_CURRENT_OFFSET); in aqc_raw_event()
725 if (priv->power_cycle_count_offset != 0) in aqc_raw_event()
726 priv->power_cycles = get_unaligned_be32(data + priv->power_cycle_count_offset); in aqc_raw_event()
728 /* Special-case sensor readings */ in aqc_raw_event()
729 switch (priv->kind) { in aqc_raw_event()
731 priv->voltage_input[2] = get_unaligned_be16(data + D5NEXT_5V_VOLTAGE) * 10; in aqc_raw_event()
732 priv->voltage_input[3] = get_unaligned_be16(data + D5NEXT_12V_VOLTAGE) * 10; in aqc_raw_event()
735 priv->speed_input[4] = get_unaligned_be16(data + priv->flow_sensor_offset); in aqc_raw_event()
739 if (priv->temp_input[1] == -ENODATA) in aqc_raw_event()
740 priv->power_input[0] = -ENODATA; in aqc_raw_event()
742 priv->power_input[0] = in aqc_raw_event()
745 priv->voltage_input[0] = get_unaligned_be16(data + HIGHFLOWNEXT_5V_VOLTAGE) * 10; in aqc_raw_event()
746 priv->voltage_input[1] = in aqc_raw_event()
749 priv->speed_input[0] = get_unaligned_be16(data + HIGHFLOWNEXT_FLOW); in aqc_raw_event()
750 priv->speed_input[1] = get_unaligned_be16(data + HIGHFLOWNEXT_WATER_QUALITY); in aqc_raw_event()
751 priv->speed_input[2] = get_unaligned_be16(data + HIGHFLOWNEXT_CONDUCTIVITY); in aqc_raw_event()
757 priv->updated = jiffies; in aqc_raw_event()
766 struct aqc_data *priv = seqf->private; in serial_number_show()
768 seq_printf(seqf, "%05u-%05u\n", priv->serial_number[0], priv->serial_number[1]); in serial_number_show()
776 struct aqc_data *priv = seqf->private; in firmware_version_show()
778 seq_printf(seqf, "%u\n", priv->firmware_version); in firmware_version_show()
786 struct aqc_data *priv = seqf->private; in power_cycles_show()
788 seq_printf(seqf, "%u\n", priv->power_cycles); in power_cycles_show()
798 scnprintf(name, sizeof(name), "%s_%s-%s", "aquacomputer", priv->name, in aqc_debugfs_init()
799 dev_name(&priv->hdev->dev)); in aqc_debugfs_init()
801 priv->debugfs = debugfs_create_dir(name, NULL); in aqc_debugfs_init()
802 debugfs_create_file("serial_number", 0444, priv->debugfs, priv, &serial_number_fops); in aqc_debugfs_init()
803 debugfs_create_file("firmware_version", 0444, priv->debugfs, priv, &firmware_version_fops); in aqc_debugfs_init()
805 if (priv->power_cycle_count_offset != 0) in aqc_debugfs_init()
806 debugfs_create_file("power_cycles", 0444, priv->debugfs, priv, &power_cycles_fops); in aqc_debugfs_init()
822 priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL); in aqc_probe()
824 return -ENOMEM; in aqc_probe()
826 priv->hdev = hdev; in aqc_probe()
829 priv->updated = jiffies - STATUS_UPDATE_INTERVAL; in aqc_probe()
843 switch (hdev->product) { in aqc_probe()
845 priv->kind = d5next; in aqc_probe()
847 priv->num_fans = D5NEXT_NUM_FANS; in aqc_probe()
848 priv->fan_sensor_offsets = d5next_sensor_fan_offsets; in aqc_probe()
849 priv->fan_ctrl_offsets = d5next_ctrl_fan_offsets; in aqc_probe()
850 priv->num_temp_sensors = D5NEXT_NUM_SENSORS; in aqc_probe()
851 priv->temp_sensor_start_offset = D5NEXT_COOLANT_TEMP; in aqc_probe()
852 priv->num_virtual_temp_sensors = D5NEXT_NUM_VIRTUAL_SENSORS; in aqc_probe()
853 priv->virtual_temp_sensor_start_offset = D5NEXT_VIRTUAL_SENSORS_START; in aqc_probe()
854 priv->power_cycle_count_offset = D5NEXT_POWER_CYCLES; in aqc_probe()
855 priv->buffer_size = D5NEXT_CTRL_REPORT_SIZE; in aqc_probe()
857 priv->temp_label = label_d5next_temp; in aqc_probe()
858 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
859 priv->speed_label = label_d5next_speeds; in aqc_probe()
860 priv->power_label = label_d5next_power; in aqc_probe()
861 priv->voltage_label = label_d5next_voltages; in aqc_probe()
862 priv->current_label = label_d5next_current; in aqc_probe()
865 priv->kind = farbwerk; in aqc_probe()
867 priv->num_fans = 0; in aqc_probe()
868 priv->num_temp_sensors = FARBWERK_NUM_SENSORS; in aqc_probe()
869 priv->temp_sensor_start_offset = FARBWERK_SENSOR_START; in aqc_probe()
870 priv->temp_label = label_temp_sensors; in aqc_probe()
873 priv->kind = farbwerk360; in aqc_probe()
875 priv->num_fans = 0; in aqc_probe()
876 priv->num_temp_sensors = FARBWERK360_NUM_SENSORS; in aqc_probe()
877 priv->temp_sensor_start_offset = FARBWERK360_SENSOR_START; in aqc_probe()
878 priv->num_virtual_temp_sensors = FARBWERK360_NUM_VIRTUAL_SENSORS; in aqc_probe()
879 priv->virtual_temp_sensor_start_offset = FARBWERK360_VIRTUAL_SENSORS_START; in aqc_probe()
881 priv->temp_label = label_temp_sensors; in aqc_probe()
882 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
885 priv->kind = octo; in aqc_probe()
887 priv->num_fans = OCTO_NUM_FANS; in aqc_probe()
888 priv->fan_sensor_offsets = octo_sensor_fan_offsets; in aqc_probe()
889 priv->fan_ctrl_offsets = octo_ctrl_fan_offsets; in aqc_probe()
890 priv->num_temp_sensors = OCTO_NUM_SENSORS; in aqc_probe()
891 priv->temp_sensor_start_offset = OCTO_SENSOR_START; in aqc_probe()
892 priv->num_virtual_temp_sensors = OCTO_NUM_VIRTUAL_SENSORS; in aqc_probe()
893 priv->virtual_temp_sensor_start_offset = OCTO_VIRTUAL_SENSORS_START; in aqc_probe()
894 priv->power_cycle_count_offset = OCTO_POWER_CYCLES; in aqc_probe()
895 priv->buffer_size = OCTO_CTRL_REPORT_SIZE; in aqc_probe()
897 priv->temp_label = label_temp_sensors; in aqc_probe()
898 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
899 priv->speed_label = label_fan_speed; in aqc_probe()
900 priv->power_label = label_fan_power; in aqc_probe()
901 priv->voltage_label = label_fan_voltage; in aqc_probe()
902 priv->current_label = label_fan_current; in aqc_probe()
905 priv->kind = quadro; in aqc_probe()
907 priv->num_fans = QUADRO_NUM_FANS; in aqc_probe()
908 priv->fan_sensor_offsets = quadro_sensor_fan_offsets; in aqc_probe()
909 priv->fan_ctrl_offsets = quadro_ctrl_fan_offsets; in aqc_probe()
910 priv->num_temp_sensors = QUADRO_NUM_SENSORS; in aqc_probe()
911 priv->temp_sensor_start_offset = QUADRO_SENSOR_START; in aqc_probe()
912 priv->num_virtual_temp_sensors = QUADRO_NUM_VIRTUAL_SENSORS; in aqc_probe()
913 priv->virtual_temp_sensor_start_offset = QUADRO_VIRTUAL_SENSORS_START; in aqc_probe()
914 priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; in aqc_probe()
915 priv->buffer_size = QUADRO_CTRL_REPORT_SIZE; in aqc_probe()
916 priv->flow_sensor_offset = QUADRO_FLOW_SENSOR_OFFSET; in aqc_probe()
918 priv->temp_label = label_temp_sensors; in aqc_probe()
919 priv->virtual_temp_label = label_virtual_temp_sensors; in aqc_probe()
920 priv->speed_label = label_quadro_speeds; in aqc_probe()
921 priv->power_label = label_fan_power; in aqc_probe()
922 priv->voltage_label = label_fan_voltage; in aqc_probe()
923 priv->current_label = label_fan_current; in aqc_probe()
926 priv->kind = highflownext; in aqc_probe()
928 priv->num_fans = 0; in aqc_probe()
929 priv->num_temp_sensors = HIGHFLOWNEXT_NUM_SENSORS; in aqc_probe()
930 priv->temp_sensor_start_offset = HIGHFLOWNEXT_SENSOR_START; in aqc_probe()
931 priv->power_cycle_count_offset = QUADRO_POWER_CYCLES; in aqc_probe()
933 priv->temp_label = label_highflownext_temp_sensors; in aqc_probe()
934 priv->speed_label = label_highflownext_fan_speed; in aqc_probe()
935 priv->power_label = label_highflownext_power; in aqc_probe()
936 priv->voltage_label = label_highflownext_voltage; in aqc_probe()
942 if (priv->buffer_size != 0) { in aqc_probe()
943 priv->checksum_start = 0x01; in aqc_probe()
944 priv->checksum_length = priv->buffer_size - 3; in aqc_probe()
945 priv->checksum_offset = priv->buffer_size - 2; in aqc_probe()
948 priv->name = aqc_device_names[priv->kind]; in aqc_probe()
950 priv->buffer = devm_kzalloc(&hdev->dev, priv->buffer_size, GFP_KERNEL); in aqc_probe()
951 if (!priv->buffer) { in aqc_probe()
952 ret = -ENOMEM; in aqc_probe()
956 mutex_init(&priv->mutex); in aqc_probe()
958 priv->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, priv->name, priv, in aqc_probe()
961 if (IS_ERR(priv->hwmon_dev)) { in aqc_probe()
962 ret = PTR_ERR(priv->hwmon_dev); in aqc_probe()
981 debugfs_remove_recursive(priv->debugfs); in aqc_remove()
982 hwmon_device_unregister(priv->hwmon_dev); in aqc_remove()