@@ -41,7 +41,7 @@ static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
4141enum chips {
4242 any_chip , lm85b , lm85c ,
4343 adm1027 , adt7463 , adt7468 ,
44- emc6d100 , emc6d102 , emc6d103
44+ emc6d100 , emc6d102 , emc6d103 , emc6d103s
4545};
4646
4747/* The LM85 registers */
@@ -350,6 +350,7 @@ static const struct i2c_device_id lm85_id[] = {
350350 { "emc6d101" , emc6d100 },
351351 { "emc6d102" , emc6d102 },
352352 { "emc6d103" , emc6d103 },
353+ { "emc6d103s" , emc6d103s },
353354 { }
354355};
355356MODULE_DEVICE_TABLE (i2c , lm85_id );
@@ -1068,13 +1069,7 @@ static struct attribute *lm85_attributes[] = {
10681069 & sensor_dev_attr_pwm1_auto_pwm_min .dev_attr .attr ,
10691070 & sensor_dev_attr_pwm2_auto_pwm_min .dev_attr .attr ,
10701071 & sensor_dev_attr_pwm3_auto_pwm_min .dev_attr .attr ,
1071- & sensor_dev_attr_pwm1_auto_pwm_minctl .dev_attr .attr ,
1072- & sensor_dev_attr_pwm2_auto_pwm_minctl .dev_attr .attr ,
1073- & sensor_dev_attr_pwm3_auto_pwm_minctl .dev_attr .attr ,
10741072
1075- & sensor_dev_attr_temp1_auto_temp_off .dev_attr .attr ,
1076- & sensor_dev_attr_temp2_auto_temp_off .dev_attr .attr ,
1077- & sensor_dev_attr_temp3_auto_temp_off .dev_attr .attr ,
10781073 & sensor_dev_attr_temp1_auto_temp_min .dev_attr .attr ,
10791074 & sensor_dev_attr_temp2_auto_temp_min .dev_attr .attr ,
10801075 & sensor_dev_attr_temp3_auto_temp_min .dev_attr .attr ,
@@ -1095,6 +1090,26 @@ static const struct attribute_group lm85_group = {
10951090 .attrs = lm85_attributes ,
10961091};
10971092
1093+ static struct attribute * lm85_attributes_minctl [] = {
1094+ & sensor_dev_attr_pwm1_auto_pwm_minctl .dev_attr .attr ,
1095+ & sensor_dev_attr_pwm2_auto_pwm_minctl .dev_attr .attr ,
1096+ & sensor_dev_attr_pwm3_auto_pwm_minctl .dev_attr .attr ,
1097+ };
1098+
1099+ static const struct attribute_group lm85_group_minctl = {
1100+ .attrs = lm85_attributes_minctl ,
1101+ };
1102+
1103+ static struct attribute * lm85_attributes_temp_off [] = {
1104+ & sensor_dev_attr_temp1_auto_temp_off .dev_attr .attr ,
1105+ & sensor_dev_attr_temp2_auto_temp_off .dev_attr .attr ,
1106+ & sensor_dev_attr_temp3_auto_temp_off .dev_attr .attr ,
1107+ };
1108+
1109+ static const struct attribute_group lm85_group_temp_off = {
1110+ .attrs = lm85_attributes_temp_off ,
1111+ };
1112+
10981113static struct attribute * lm85_attributes_in4 [] = {
10991114 & sensor_dev_attr_in4_input .dev_attr .attr ,
11001115 & sensor_dev_attr_in4_min .dev_attr .attr ,
@@ -1242,16 +1257,9 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info)
12421257 case LM85_VERSTEP_EMC6D103_A1 :
12431258 type_name = "emc6d103" ;
12441259 break ;
1245- /*
1246- * Registers apparently missing in EMC6D103S/EMC6D103:A2
1247- * compared to EMC6D103:A0, EMC6D103:A1, and EMC6D102
1248- * (according to the data sheets), but used unconditionally
1249- * in the driver: 62[5:7], 6D[0:7], and 6E[0:7].
1250- * So skip EMC6D103S for now.
12511260 case LM85_VERSTEP_EMC6D103S :
12521261 type_name = "emc6d103s" ;
12531262 break ;
1254- */
12551263 }
12561264 } else {
12571265 dev_dbg (& adapter -> dev ,
@@ -1267,6 +1275,10 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info)
12671275static void lm85_remove_files (struct i2c_client * client , struct lm85_data * data )
12681276{
12691277 sysfs_remove_group (& client -> dev .kobj , & lm85_group );
1278+ if (data -> type != emc6d103s ) {
1279+ sysfs_remove_group (& client -> dev .kobj , & lm85_group_minctl );
1280+ sysfs_remove_group (& client -> dev .kobj , & lm85_group_temp_off );
1281+ }
12701282 if (!data -> has_vid5 )
12711283 sysfs_remove_group (& client -> dev .kobj , & lm85_group_in4 );
12721284 if (data -> type == emc6d100 )
@@ -1295,6 +1307,7 @@ static int lm85_probe(struct i2c_client *client,
12951307 case emc6d100 :
12961308 case emc6d102 :
12971309 case emc6d103 :
1310+ case emc6d103s :
12981311 data -> freq_map = adm1027_freq_map ;
12991312 break ;
13001313 default :
@@ -1312,6 +1325,17 @@ static int lm85_probe(struct i2c_client *client,
13121325 if (err )
13131326 goto err_kfree ;
13141327
1328+ /* minctl and temp_off exist on all chips except emc6d103s */
1329+ if (data -> type != emc6d103s ) {
1330+ err = sysfs_create_group (& client -> dev .kobj , & lm85_group_minctl );
1331+ if (err )
1332+ goto err_kfree ;
1333+ err = sysfs_create_group (& client -> dev .kobj ,
1334+ & lm85_group_temp_off );
1335+ if (err )
1336+ goto err_kfree ;
1337+ }
1338+
13151339 /* The ADT7463/68 have an optional VRM 10 mode where pin 21 is used
13161340 as a sixth digital VID input rather than an analog input. */
13171341 if (data -> type == adt7463 || data -> type == adt7468 ) {
@@ -1475,7 +1499,8 @@ static struct lm85_data *lm85_update_device(struct device *dev)
14751499 /* More alarm bits */
14761500 data -> alarms |= lm85_read_value (client ,
14771501 EMC6D100_REG_ALARM3 ) << 16 ;
1478- } else if (data -> type == emc6d102 || data -> type == emc6d103 ) {
1502+ } else if (data -> type == emc6d102 || data -> type == emc6d103 ||
1503+ data -> type == emc6d103s ) {
14791504 /* Have to read LSB bits after the MSB ones because
14801505 the reading of the MSB bits has frozen the
14811506 LSBs (backward from the ADM1027).
@@ -1560,17 +1585,19 @@ static struct lm85_data *lm85_update_device(struct device *dev)
15601585 }
15611586 }
15621587
1563- i = lm85_read_value (client , LM85_REG_AFAN_SPIKE1 );
1564- data -> autofan [0 ].min_off = (i & 0x20 ) != 0 ;
1565- data -> autofan [1 ].min_off = (i & 0x40 ) != 0 ;
1566- data -> autofan [2 ].min_off = (i & 0x80 ) != 0 ;
1588+ if (data -> type != emc6d103s ) {
1589+ i = lm85_read_value (client , LM85_REG_AFAN_SPIKE1 );
1590+ data -> autofan [0 ].min_off = (i & 0x20 ) != 0 ;
1591+ data -> autofan [1 ].min_off = (i & 0x40 ) != 0 ;
1592+ data -> autofan [2 ].min_off = (i & 0x80 ) != 0 ;
15671593
1568- i = lm85_read_value (client , LM85_REG_AFAN_HYST1 );
1569- data -> zone [0 ].hyst = i >> 4 ;
1570- data -> zone [1 ].hyst = i & 0x0f ;
1594+ i = lm85_read_value (client , LM85_REG_AFAN_HYST1 );
1595+ data -> zone [0 ].hyst = i >> 4 ;
1596+ data -> zone [1 ].hyst = i & 0x0f ;
15711597
1572- i = lm85_read_value (client , LM85_REG_AFAN_HYST2 );
1573- data -> zone [2 ].hyst = i >> 4 ;
1598+ i = lm85_read_value (client , LM85_REG_AFAN_HYST2 );
1599+ data -> zone [2 ].hyst = i >> 4 ;
1600+ }
15741601
15751602 data -> last_config = jiffies ;
15761603 } /* last_config */
0 commit comments