@@ -219,7 +219,7 @@ static bool fix_pwm_polarity;
219
219
#define IT87_REG_FAN_DIV 0x0b
220
220
#define IT87_REG_FAN_16BIT 0x0c
221
221
222
- /* Monitors: 9 voltage (0 to 7, battery), 3 temp (1 to 3 ), 3 fan (1 to 3) */
222
+ /* Monitors: 9 voltage (0 to 7, battery), 6 temp (1 to 6 ), 3 fan (1 to 3) */
223
223
224
224
static const u8 IT87_REG_FAN [] = { 0x0d , 0x0e , 0x0f , 0x80 , 0x82 , 0x4c };
225
225
static const u8 IT87_REG_FAN_MIN [] = { 0x10 , 0x11 , 0x12 , 0x84 , 0x86 , 0x4e };
@@ -252,10 +252,12 @@ static const u8 IT87_REG_PWM_DUTY[] = { 0x63, 0x6b, 0x73, 0x7b, 0xa3, 0xab };
252
252
#define IT87_REG_AUTO_TEMP (nr , i ) (0x60 + (nr) * 8 + (i))
253
253
#define IT87_REG_AUTO_PWM (nr , i ) (0x65 + (nr) * 8 + (i))
254
254
255
+ #define IT87_REG_TEMP456_ENABLE 0x77
256
+
255
257
struct it87_devices {
256
258
const char * name ;
257
259
const char * const suffix ;
258
- u16 features ;
260
+ u32 features ;
259
261
u8 peci_mask ;
260
262
u8 old_peci_mask ;
261
263
};
@@ -276,6 +278,7 @@ struct it87_devices {
276
278
#define FEAT_AVCC3 (1 << 13) /* Chip supports in9/AVCC3 */
277
279
#define FEAT_SIX_PWM (1 << 14) /* Chip supports 6 pwm chn */
278
280
#define FEAT_PWM_FREQ2 (1 << 15) /* Separate pwm freq 2 */
281
+ #define FEAT_SIX_TEMP (1 << 16) /* Up to 6 temp sensors */
279
282
280
283
static const struct it87_devices it87_devices [] = {
281
284
[it87 ] = {
@@ -412,7 +415,8 @@ static const struct it87_devices it87_devices[] = {
412
415
.suffix = "E" ,
413
416
.features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
414
417
| FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_SIX_FANS
415
- | FEAT_IN7_INTERNAL | FEAT_SIX_PWM | FEAT_PWM_FREQ2 ,
418
+ | FEAT_IN7_INTERNAL | FEAT_SIX_PWM | FEAT_PWM_FREQ2
419
+ | FEAT_SIX_TEMP ,
416
420
.peci_mask = 0x07 ,
417
421
},
418
422
};
@@ -437,6 +441,7 @@ static const struct it87_devices it87_devices[] = {
437
441
#define has_avcc3 (data ) ((data)->features & FEAT_AVCC3)
438
442
#define has_six_pwm (data ) ((data)->features & FEAT_SIX_PWM)
439
443
#define has_pwm_freq2 (data ) ((data)->features & FEAT_PWM_FREQ2)
444
+ #define has_six_temp (data ) ((data)->features & FEAT_SIX_TEMP)
440
445
441
446
struct it87_sio_data {
442
447
enum chips type ;
@@ -477,7 +482,7 @@ struct it87_data {
477
482
u8 has_fan ; /* Bitfield, fans enabled */
478
483
u16 fan [6 ][2 ]; /* Register values, [nr][0]=fan, [1]=min */
479
484
u8 has_temp ; /* Bitfield, temp sensors enabled */
480
- s8 temp [3 ][4 ]; /* [nr][0]=temp, [1]=min, [2]=max, [3]=offset */
485
+ s8 temp [6 ][4 ]; /* [nr][0]=temp, [1]=min, [2]=max, [3]=offset */
481
486
u8 sensor ; /* Register value (IT87_REG_TEMP_ENABLE) */
482
487
u8 extra ; /* Register value (IT87_REG_TEMP_EXTRA) */
483
488
u8 fan_div [3 ]; /* Register encoding, shifted right */
@@ -704,11 +709,16 @@ static struct it87_data *it87_update_device(struct device *dev)
704
709
IT87_REG_FANX_MIN [i ]) << 8 ;
705
710
}
706
711
}
707
- for (i = 0 ; i < 3 ; i ++ ) {
712
+ for (i = 0 ; i < 6 ; i ++ ) {
708
713
if (!(data -> has_temp & (1 << i )))
709
714
continue ;
710
715
data -> temp [i ][0 ] =
711
716
it87_read_value (data , IT87_REG_TEMP (i ));
717
+
718
+ /* No limits/offset for additional sensors */
719
+ if (i >= 3 )
720
+ continue ;
721
+
712
722
data -> temp [i ][1 ] =
713
723
it87_read_value (data , IT87_REG_TEMP_LOW (i ));
714
724
data -> temp [i ][2 ] =
@@ -848,7 +858,7 @@ static SENSOR_DEVICE_ATTR_2(in7_max, S_IRUGO | S_IWUSR, show_in, set_in,
848
858
static SENSOR_DEVICE_ATTR_2 (in8_input , S_IRUGO , show_in , NULL, 8 , 0 ) ;
849
859
static SENSOR_DEVICE_ATTR_2 (in9_input , S_IRUGO , show_in , NULL, 9 , 0 ) ;
850
860
851
- /* 3 temperatures */
861
+ /* Up to 6 temperatures */
852
862
static ssize_t show_temp (struct device * dev , struct device_attribute * attr ,
853
863
char * buf )
854
864
{
@@ -921,6 +931,9 @@ static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, set_temp,
921
931
2 , 2 ) ;
922
932
static SENSOR_DEVICE_ATTR_2 (temp3_offset , S_IRUGO | S_IWUSR , show_temp ,
923
933
set_temp , 2 , 3 ) ;
934
+ static SENSOR_DEVICE_ATTR_2 (temp4_input , S_IRUGO , show_temp , NULL, 3 , 0 ) ;
935
+ static SENSOR_DEVICE_ATTR_2 (temp5_input , S_IRUGO , show_temp , NULL, 4 , 0 ) ;
936
+ static SENSOR_DEVICE_ATTR_2 (temp6_input , S_IRUGO , show_temp , NULL, 5 , 0 ) ;
924
937
925
938
static ssize_t show_temp_type (struct device * dev , struct device_attribute * attr ,
926
939
char * buf )
@@ -1828,6 +1841,11 @@ static umode_t it87_temp_is_visible(struct kobject *kobj,
1828
1841
int i = index / 7 ; /* temperature index */
1829
1842
int a = index % 7 ; /* attribute index */
1830
1843
1844
+ if (index >= 21 ) {
1845
+ i = index - 21 + 3 ;
1846
+ a = 0 ;
1847
+ }
1848
+
1831
1849
if (!(data -> has_temp & (1 << i )))
1832
1850
return 0 ;
1833
1851
@@ -1849,22 +1867,25 @@ static struct attribute *it87_attributes_temp[] = {
1849
1867
& sensor_dev_attr_temp1_offset .dev_attr .attr , /* 5 */
1850
1868
& sensor_dev_attr_temp1_beep .dev_attr .attr , /* 6 */
1851
1869
1852
- & sensor_dev_attr_temp2_input .dev_attr .attr ,
1870
+ & sensor_dev_attr_temp2_input .dev_attr .attr , /* 7 */
1853
1871
& sensor_dev_attr_temp2_max .dev_attr .attr ,
1854
1872
& sensor_dev_attr_temp2_min .dev_attr .attr ,
1855
1873
& sensor_dev_attr_temp2_type .dev_attr .attr ,
1856
1874
& sensor_dev_attr_temp2_alarm .dev_attr .attr ,
1857
1875
& sensor_dev_attr_temp2_offset .dev_attr .attr ,
1858
1876
& sensor_dev_attr_temp2_beep .dev_attr .attr ,
1859
1877
1860
- & sensor_dev_attr_temp3_input .dev_attr .attr ,
1878
+ & sensor_dev_attr_temp3_input .dev_attr .attr , /* 14 */
1861
1879
& sensor_dev_attr_temp3_max .dev_attr .attr ,
1862
1880
& sensor_dev_attr_temp3_min .dev_attr .attr ,
1863
1881
& sensor_dev_attr_temp3_type .dev_attr .attr ,
1864
1882
& sensor_dev_attr_temp3_alarm .dev_attr .attr ,
1865
1883
& sensor_dev_attr_temp3_offset .dev_attr .attr ,
1866
1884
& sensor_dev_attr_temp3_beep .dev_attr .attr ,
1867
1885
1886
+ & sensor_dev_attr_temp4_input .dev_attr .attr , /* 21 */
1887
+ & sensor_dev_attr_temp5_input .dev_attr .attr ,
1888
+ & sensor_dev_attr_temp6_input .dev_attr .attr ,
1868
1889
NULL
1869
1890
};
1870
1891
@@ -2710,6 +2731,17 @@ static int it87_probe(struct platform_device *pdev)
2710
2731
data -> in_internal = sio_data -> internal ;
2711
2732
data -> has_in = 0x3ff & ~sio_data -> skip_in ;
2712
2733
2734
+ if (has_six_temp (data )) {
2735
+ u8 reg = it87_read_value (data , IT87_REG_TEMP456_ENABLE );
2736
+
2737
+ if ((reg & 0x03 ) >= 0x02 )
2738
+ data -> has_temp |= (1 << 3 );
2739
+ if (((reg >> 2 ) & 0x03 ) >= 0x02 )
2740
+ data -> has_temp |= (1 << 4 );
2741
+ if (((reg >> 4 ) & 0x03 ) >= 0x02 )
2742
+ data -> has_temp |= (1 << 5 );
2743
+ }
2744
+
2713
2745
data -> has_beep = !!sio_data -> beep_pin ;
2714
2746
2715
2747
/* Initialize the IT87 chip */
0 commit comments