@@ -136,6 +136,7 @@ static u8 quadro_sensor_fan_offsets[] = { 0x70, 0x7D, 0x8A, 0x97 };
136
136
137
137
/* Control report offsets for the Quadro */
138
138
#define QUADRO_TEMP_CTRL_OFFSET 0xA
139
+ #define QUADRO_FLOW_PULSES_CTRL_OFFSET 0x6
139
140
static u16 quadro_ctrl_fan_offsets [] = { 0x37 , 0x8c , 0xe1 , 0x136 }; /* Fan speed offsets (0-100%) */
140
141
141
142
/* Specs of High Flow Next flow sensor */
@@ -303,6 +304,7 @@ struct aqc_data {
303
304
u16 temp_ctrl_offset ;
304
305
u16 power_cycle_count_offset ;
305
306
u8 flow_sensor_offset ;
307
+ u8 flow_pulses_ctrl_offset ;
306
308
307
309
/* General info, same across all devices */
308
310
u32 serial_number [2 ];
@@ -461,20 +463,34 @@ static umode_t aqc_is_visible(const void *data, enum hwmon_sensor_types type, u3
461
463
}
462
464
break ;
463
465
case hwmon_fan :
464
- switch (priv -> kind ) {
465
- case highflownext :
466
- /* Special case to support flow sensor, water quality and conductivity */
467
- if (channel < 3 )
468
- return 0444 ;
466
+ switch (attr ) {
467
+ case hwmon_fan_input :
468
+ case hwmon_fan_label :
469
+ switch (priv -> kind ) {
470
+ case highflownext :
471
+ /* Special case to support flow sensor, water quality
472
+ * and conductivity
473
+ */
474
+ if (channel < 3 )
475
+ return 0444 ;
476
+ break ;
477
+ case quadro :
478
+ /* Special case to support flow sensor */
479
+ if (channel < priv -> num_fans + 1 )
480
+ return 0444 ;
481
+ break ;
482
+ default :
483
+ if (channel < priv -> num_fans )
484
+ return 0444 ;
485
+ break ;
486
+ }
469
487
break ;
470
- case quadro :
471
- /* Special case to support flow sensor */
472
- if (channel < priv -> num_fans + 1 )
473
- return 0444 ;
488
+ case hwmon_fan_pulses :
489
+ /* Special case for Quadro flow sensor */
490
+ if (priv -> kind == quadro && channel == priv -> num_fans )
491
+ return 0644 ;
474
492
break ;
475
493
default :
476
- if (channel < priv -> num_fans )
477
- return 0444 ;
478
494
break ;
479
495
}
480
496
break ;
@@ -552,7 +568,18 @@ static int aqc_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
552
568
}
553
569
break ;
554
570
case hwmon_fan :
555
- * val = priv -> speed_input [channel ];
571
+ switch (attr ) {
572
+ case hwmon_fan_input :
573
+ * val = priv -> speed_input [channel ];
574
+ break ;
575
+ case hwmon_fan_pulses :
576
+ ret = aqc_get_ctrl_val (priv , priv -> flow_pulses_ctrl_offset , val );
577
+ if (ret < 0 )
578
+ return ret ;
579
+ break ;
580
+ default :
581
+ break ;
582
+ }
556
583
break ;
557
584
case hwmon_power :
558
585
* val = priv -> power_input [channel ];
@@ -632,6 +659,18 @@ static int aqc_write(struct device *dev, enum hwmon_sensor_types type, u32 attr,
632
659
return - EOPNOTSUPP ;
633
660
}
634
661
break ;
662
+ case hwmon_fan :
663
+ switch (attr ) {
664
+ case hwmon_fan_pulses :
665
+ val = clamp_val (val , 10 , 1000 );
666
+ ret = aqc_set_ctrl_val (priv , priv -> flow_pulses_ctrl_offset , val );
667
+ if (ret < 0 )
668
+ return ret ;
669
+ break ;
670
+ default :
671
+ break ;
672
+ }
673
+ break ;
635
674
case hwmon_pwm :
636
675
switch (attr ) {
637
676
case hwmon_pwm_input :
@@ -691,7 +730,7 @@ static const struct hwmon_channel_info *aqc_info[] = {
691
730
HWMON_F_INPUT | HWMON_F_LABEL ,
692
731
HWMON_F_INPUT | HWMON_F_LABEL ,
693
732
HWMON_F_INPUT | HWMON_F_LABEL ,
694
- HWMON_F_INPUT | HWMON_F_LABEL ,
733
+ HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_PULSES ,
695
734
HWMON_F_INPUT | HWMON_F_LABEL ,
696
735
HWMON_F_INPUT | HWMON_F_LABEL ,
697
736
HWMON_F_INPUT | HWMON_F_LABEL ),
@@ -1000,6 +1039,7 @@ static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
1000
1039
priv -> buffer_size = QUADRO_CTRL_REPORT_SIZE ;
1001
1040
1002
1041
priv -> flow_sensor_offset = QUADRO_FLOW_SENSOR_OFFSET ;
1042
+ priv -> flow_pulses_ctrl_offset = QUADRO_FLOW_PULSES_CTRL_OFFSET ;
1003
1043
priv -> power_cycle_count_offset = QUADRO_POWER_CYCLES ;
1004
1044
1005
1045
priv -> temp_label = label_temp_sensors ;
0 commit comments