@@ -182,7 +182,8 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
182182#define LM90_HAVE_EMERGENCY_ALARM (1 << 5)/* emergency alarm */
183183#define LM90_HAVE_TEMP3 (1 << 6) /* 3rd temperature sensor */
184184#define LM90_HAVE_BROKEN_ALERT (1 << 7) /* Broken alert */
185- #define LM90_PAUSE_FOR_CONFIG (1 << 8) /* Pause conversion for config */
185+ #define LM90_HAVE_EXTENDED_TEMP (1 << 8) /* extended temperature support*/
186+ #define LM90_PAUSE_FOR_CONFIG (1 << 9) /* Pause conversion for config */
186187
187188/* LM90 status */
188189#define LM90_STATUS_LTHRM (1 << 0) /* local THERM limit tripped */
@@ -350,7 +351,7 @@ static const struct lm90_params lm90_params[] = {
350351 },
351352 [adt7461 ] = {
352353 .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
353- | LM90_HAVE_BROKEN_ALERT ,
354+ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP ,
354355 .alert_alarms = 0x7c ,
355356 .max_convrate = 10 ,
356357 },
@@ -422,7 +423,7 @@ static const struct lm90_params lm90_params[] = {
422423 },
423424 [tmp451 ] = {
424425 .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
425- | LM90_HAVE_BROKEN_ALERT ,
426+ | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP ,
426427 .alert_alarms = 0x7c ,
427428 .max_convrate = 9 ,
428429 .reg_local_ext = TMP451_REG_R_LOCAL_TEMPL ,
@@ -998,7 +999,7 @@ static int lm90_get_temp11(struct lm90_data *data, int index)
998999 s16 temp11 = data -> temp11 [index ];
9991000 int temp ;
10001001
1001- if (data -> kind == adt7461 || data -> kind == tmp451 )
1002+ if (data -> flags & LM90_HAVE_EXTENDED_TEMP )
10021003 temp = temp_from_u16_adt7461 (data , temp11 );
10031004 else if (data -> kind == max6646 )
10041005 temp = temp_from_u16 (temp11 );
@@ -1035,7 +1036,7 @@ static int lm90_set_temp11(struct lm90_data *data, int index, long val)
10351036 val -= 16000 ;
10361037 }
10371038
1038- if (data -> kind == adt7461 || data -> kind == tmp451 )
1039+ if (data -> flags & LM90_HAVE_EXTENDED_TEMP )
10391040 data -> temp11 [index ] = temp_to_u16_adt7461 (data , val );
10401041 else if (data -> kind == max6646 )
10411042 data -> temp11 [index ] = temp_to_u8 (val ) << 8 ;
@@ -1062,7 +1063,7 @@ static int lm90_get_temp8(struct lm90_data *data, int index)
10621063 s8 temp8 = data -> temp8 [index ];
10631064 int temp ;
10641065
1065- if (data -> kind == adt7461 || data -> kind == tmp451 )
1066+ if (data -> flags & LM90_HAVE_EXTENDED_TEMP )
10661067 temp = temp_from_u8_adt7461 (data , temp8 );
10671068 else if (data -> kind == max6646 )
10681069 temp = temp_from_u8 (temp8 );
@@ -1098,7 +1099,7 @@ static int lm90_set_temp8(struct lm90_data *data, int index, long val)
10981099 val -= 16000 ;
10991100 }
11001101
1101- if (data -> kind == adt7461 || data -> kind == tmp451 )
1102+ if (data -> flags & LM90_HAVE_EXTENDED_TEMP )
11021103 data -> temp8 [index ] = temp_to_u8_adt7461 (data , val );
11031104 else if (data -> kind == max6646 )
11041105 data -> temp8 [index ] = temp_to_u8 (val );
@@ -1116,7 +1117,7 @@ static int lm90_get_temphyst(struct lm90_data *data, int index)
11161117{
11171118 int temp ;
11181119
1119- if (data -> kind == adt7461 || data -> kind == tmp451 )
1120+ if (data -> flags & LM90_HAVE_EXTENDED_TEMP )
11201121 temp = temp_from_u8_adt7461 (data , data -> temp8 [index ]);
11211122 else if (data -> kind == max6646 )
11221123 temp = temp_from_u8 (data -> temp8 [index ]);
@@ -1136,7 +1137,7 @@ static int lm90_set_temphyst(struct lm90_data *data, long val)
11361137 int temp ;
11371138 int err ;
11381139
1139- if (data -> kind == adt7461 || data -> kind == tmp451 )
1140+ if (data -> flags & LM90_HAVE_EXTENDED_TEMP )
11401141 temp = temp_from_u8_adt7461 (data , data -> temp8 [LOCAL_CRIT ]);
11411142 else if (data -> kind == max6646 )
11421143 temp = temp_from_u8 (data -> temp8 [LOCAL_CRIT ]);
@@ -1685,7 +1686,7 @@ static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
16851686 lm90_set_convrate (client , data , 500 ); /* 500ms; 2Hz conversion rate */
16861687
16871688 /* Check Temperature Range Select */
1688- if (data -> kind == adt7461 || data -> kind == tmp451 ) {
1689+ if (data -> flags & LM90_HAVE_EXTENDED_TEMP ) {
16891690 if (config & 0x04 )
16901691 data -> flags |= LM90_FLAG_ADT7461_EXT ;
16911692 }
0 commit comments