hwmon: (it87) Introduce configuration field for chip suffix
Subsystems (2)
Guenter Roeck
maintainerPATCH 3/15 hwmon: (it87) Introduce configuration field for chip suffix
ITE chips may have 'E', 'F', or both 'E' and 'F' suffixes. Introduce suffic configuration to the it87_devices structure to simplify adding new chips.
--- drivers/hwmon/it87.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/hwmon/it87.c +17 -3
@@ -245,6 +245,7 @@ struct it87_devices {u16 features;u8 peci_mask;u8 old_peci_mask; +const char *const suffix; };#define FEAT_12MV_ADC (1 << 0)
@@ -262,28 +263,33 @@ static const struct it87_devices it87_devices[] = { [it87] = { .name = "it87", .features = FEAT_OLD_AUTOPWM, /* may need to overwrite */ + .suffix = "F", }, [it8712] = { .name = "it8712", .features = FEAT_OLD_AUTOPWM | FEAT_VID,/* may need to overwrite */ + .suffix = "F", }, [it8716] = { .name = "it8716", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET |FEAT_VID | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, + .suffix = "F", }, [it8718] = { .name = "it8718", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET |FEAT_VID | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, .old_peci_mask = 0x4, + .suffix = "F", }, [it8720] = { .name = "it8720", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET |FEAT_VID | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, .old_peci_mask = 0x4, + .suffix = "F", }, [it8721] = { .name = "it8721",
@@ -292,12 +298,14 @@ static const struct it87_devices it87_devices[] = { | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, .peci_mask = 0x05, .old_peci_mask = 0x02, /* Actually reports PCH */ + .suffix = "F", }, [it8728] = { .name = "it8728", .features =FEAT_NEWER_AUTOPWM |FEAT_12MV_ADC |FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_FIVE_FANS, .peci_mask = 0x07, + .suffix = "F", }, [it8771] = { .name = "it8771",
@@ -308,6 +316,7 @@ static const struct it87_devices it87_devices[] = {/* 16 bit fans (OHM) */ /* three fans, always 16 bit (guesswork) */ .peci_mask = 0x07, + .suffix = "E", }, [it8772] = { .name = "it8772",
@@ -318,36 +327,42 @@ static const struct it87_devices it87_devices[] = {/* 16 bit fans (HWSensors4, OHM) */ /* three fans, always 16 bit (datasheet) */ .peci_mask = 0x07, + .suffix = "E", }, [it8781] = { .name = "it8781", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG, .old_peci_mask = 0x4, + .suffix = "F", }, [it8782] = { .name = "it8782", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG, .old_peci_mask = 0x4, + .suffix = "F", }, [it8783] = { .name = "it8783", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG, .old_peci_mask = 0x4, + .suffix = "E/F", }, [it8786] = { .name = "it8786", .features =FEAT_NEWER_AUTOPWM |FEAT_12MV_ADC |FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI, .peci_mask = 0x07, + .suffix = "E", }, [it8603] = { .name = "it8603", .features =FEAT_NEWER_AUTOPWM |FEAT_12MV_ADC |FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI, .peci_mask = 0x07, + .suffix = "E", }, };
@@ -1841,9 +1856,8 @@ static int __init it87_find(unsigned short *address, err =0 ; sio_data->revision =superio_inb (DEVREV ) &0x0f ; -pr_info ("Found IT%04x%c chip at 0x%x, revision %d\n" , chip_type, - chip_type =0x8771 || chip_type =0x8772 || - chip_type =0x8786 || chip_type =0x8603 ?'E' :'F' , +pr_info ("Found IT%04x%s chip at 0x%x, revision %d\n" , chip_type, + it87_devices[sio_data->type].suffix, *address, sio_data->revision);/* in8 (Vbat) is always internal */
Signature · 7 lines
2.1.0 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Guenter,
Quoted 3 lines · Guenter Roeck
ITE chips may have 'E', 'F', or both 'E' and 'F' suffixes. Introduce suffic configuration to the
it87_devicesstructure to simplify adding new chips.
I like it, but I'm wondering if it wouldn't be even better to add the full "nice" chip name to each entry, so that you don't have to reconstruct it from chip_type? Granted, it would require a few more bytes of data, but it simplifies the code and would be more flexible too (imagine some future chip has an ID which no longer exactly match its name...) What do you think?
Quoted 11 lines
Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/it87.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)drivers/hwmon/it87.c +0
-0
drivers/hwmon/it87.c struct it87_devices { · line 248
Quoted 4 lines
drivers/hwmon/it87.c +1
-0@@ -245,6 +245,7 @@ struct it87_devices {u16 features;u8 peci_mask;u8 old_peci_mask; +const char *const suffix;
I'd put it right after the name field, as they have the same type and are somewhat related. (name could be const-ified BTW, right?)
Quoted 105 lines
drivers/hwmon/it87.c +14
-0};#define FEAT_12MV_ADC (1 << 0)@@ -262,28 +263,33 @@ static const struct it87_devices it87_devices[] = { [it87] = { .name = "it87", .features = FEAT_OLD_AUTOPWM, /* may need to overwrite */ + .suffix = "F", }, [it8712] = { .name = "it8712", .features = FEAT_OLD_AUTOPWM | FEAT_VID,/* may need to overwrite */ + .suffix = "F", }, [it8716] = { .name = "it8716", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET |FEAT_VID | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, + .suffix = "F", }, [it8718] = { .name = "it8718", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET |FEAT_VID | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, .old_peci_mask = 0x4, + .suffix = "F", }, [it8720] = { .name = "it8720", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET |FEAT_VID | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, .old_peci_mask = 0x4, + .suffix = "F", }, [it8721] = { .name = "it8721",@@ -292,12 +298,14 @@ static const struct it87_devices it87_devices[] = { | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, .peci_mask = 0x05, .old_peci_mask = 0x02, /* Actually reports PCH */ + .suffix = "F", }, [it8728] = { .name = "it8728", .features =FEAT_NEWER_AUTOPWM |FEAT_12MV_ADC |FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_FIVE_FANS, .peci_mask = 0x07, + .suffix = "F", }, [it8771] = { .name = "it8771",@@ -308,6 +316,7 @@ static const struct it87_devices it87_devices[] = {/* 16 bit fans (OHM) */ /* three fans, always 16 bit (guesswork) */ .peci_mask = 0x07, + .suffix = "E", }, [it8772] = { .name = "it8772",@@ -318,36 +327,42 @@ static const struct it87_devices it87_devices[] = {/* 16 bit fans (HWSensors4, OHM) */ /* three fans, always 16 bit (datasheet) */ .peci_mask = 0x07, + .suffix = "E", }, [it8781] = { .name = "it8781", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG, .old_peci_mask = 0x4, + .suffix = "F", }, [it8782] = { .name = "it8782", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG, .old_peci_mask = 0x4, + .suffix = "F", }, [it8783] = { .name = "it8783", .features =FEAT_16BIT_FANS |FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG, .old_peci_mask = 0x4, + .suffix = "E/F", }, [it8786] = { .name = "it8786", .features =FEAT_NEWER_AUTOPWM |FEAT_12MV_ADC |FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI, .peci_mask = 0x07, + .suffix = "E", }, [it8603] = { .name = "it8603", .features =FEAT_NEWER_AUTOPWM |FEAT_12MV_ADC |FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI, .peci_mask = 0x07, + .suffix = "E", }, };@@ -1841,9 +1856,8 @@ static int __init it87_find(unsigned short *address,
drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1863
Quoted 10 lines
drivers/hwmon/it87.c +2
-3err =0 ; sio_data->revision =superio_inb (DEVREV ) &0x0f ; -pr_info ("Found IT%04x%c chip at 0x%x, revision %d\n" , chip_type, - chip_type =0x8771 || chip_type =0x8772 || - chip_type =0x8786 || chip_type =0x8603 ?'E' :'F' , +pr_info ("Found IT%04x%s chip at 0x%x, revision %d\n" , chip_type, + it87_devices[sio_data->type].suffix, *address, sio_data->revision);/* in8 (Vbat) is always internal */
Signature · 7 lines
Jean Delvare SUSE L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
maintainerQuoted 7 lines · Jean Delvare
Hi Guenter,
Quoted 3 lines · Guenter Roeck
ITE chips may have 'E', 'F', or both 'E' and 'F' suffixes. Introduce suffic configuration to the
it87_devicesstructure to simplify adding new chips.
Quoted 7 lines
I like it, but I'm wondering if it wouldn't be even better to add the full "nice" chip name to each entry, so that you don't have to reconstruct it from
chip_type? Granted, it would require a few more bytes of data, but it simplifies the code and would be more flexible too (imagine some future chip has an ID which no longer exactly match its name...) What do you think?
I though about it, but it would mean that I would have to introduce it8623 and it8726 as separate types. If we want to do that, we should probably do it as separate patch(es).
Quoted 6 lines
Quoted 6 lines
Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/it87.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
Quoted 13 lines
drivers/hwmon/it87.c struct it87_devices { · line 248
Quoted 9 lines
drivers/hwmon/it87.c +1
-0@@ -245,6 +245,7 @@ struct it87_devices {u16 features;u8 peci_mask;u8 old_peci_mask; +const char *const suffix;I'd put it right after the name field, as they have the same type and are somewhat related. (name could be const-ified BTW, right?)
Makes sense. I'll do that.
Constifying name is possible. Separate patch, though, I would think.
[ ... ]
Quoted 3 lines
Reviewed-by Jean Delvare <[email protected]>
Thanks!
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 15 lines · Guenter Roeck
Quoted 7 lines · Jean Delvare
Hi Guenter,
Quoted 3 lines · Guenter Roeck
ITE chips may have 'E', 'F', or both 'E' and 'F' suffixes. Introduce suffic configuration to the
it87_devicesstructure to simplify adding new chips.Quoted 7 lines
I like it, but I'm wondering if it wouldn't be even better to add the full "nice" chip name to each entry, so that you don't have to reconstruct it from
chip_type? Granted, it would require a few more bytes of data, but it simplifies the code and would be more flexible too (imagine some future chip has an ID which no longer exactly match its name...) What do you think?
Quoted 3 lines
I though about it, but it would mean that I would have to introduce it8623 and it8726 as separate types. If we want to do that, we should probably do it as separate patch(es).
Ah, missed that. Forget about my proposal then, let's stick to your original plan.
Quoted 19 lines
Quoted 6 lines
Quoted 6 lines
Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/it87.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)Quoted 12 lines
drivers/hwmon/it87.c struct it87_devices { · line 248
Quoted 9 lines
drivers/hwmon/it87.c +1
-0@@ -245,6 +245,7 @@ struct it87_devices {u16 features;u8 peci_mask;u8 old_peci_mask; +const char *const suffix;I'd put it right after the name field, as they have the same type and are somewhat related. (name could be const-ified BTW, right?)
Quoted 3 lines
Makes sense. I'll do that.
Constifying name is possible. Separate patch, though, I would think.
Of course.
Quoted 3 lines
Quoted 1 line
Reviewed-by Jean Delvare <[email protected]>Thanks!
You're welcome.
Signature · 7 lines
Jean Delvare SUSE L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors