Commit faf392fb authored by Guenter Roeck's avatar Guenter Roeck
Browse files

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.

Reviewed-by: default avatarJean Delvare <jdelvare@suse.de>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent f56c9c0a
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -242,6 +242,7 @@ static const u8 IT87_REG_TEMP_OFFSET[] = { 0x56, 0x57, 0x59 };

struct it87_devices {
	const char *name;
	const char * const suffix;
	u16 features;
	u8 peci_mask;
	u8 old_peci_mask;
@@ -261,32 +262,38 @@ struct it87_devices {
static const struct it87_devices it87_devices[] = {
	[it87] = {
		.name = "it87",
		.suffix = "F",
		.features = FEAT_OLD_AUTOPWM,	/* may need to overwrite */
	},
	[it8712] = {
		.name = "it8712",
		.suffix = "F",
		.features = FEAT_OLD_AUTOPWM | FEAT_VID,
						/* may need to overwrite */
	},
	[it8716] = {
		.name = "it8716",
		.suffix = "F",
		.features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_VID
		  | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS,
	},
	[it8718] = {
		.name = "it8718",
		.suffix = "F",
		.features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_VID
		  | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS,
		.old_peci_mask = 0x4,
	},
	[it8720] = {
		.name = "it8720",
		.suffix = "F",
		.features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_VID
		  | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS,
		.old_peci_mask = 0x4,
	},
	[it8721] = {
		.name = "it8721",
		.suffix = "F",
		.features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
		  | FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI
		  | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS,
@@ -295,12 +302,14 @@ static const struct it87_devices it87_devices[] = {
	},
	[it8728] = {
		.name = "it8728",
		.suffix = "F",
		.features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
		  | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_FIVE_FANS,
		.peci_mask = 0x07,
	},
	[it8771] = {
		.name = "it8771",
		.suffix = "E",
		.features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
		  | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI,
				/* PECI: guesswork */
@@ -311,6 +320,7 @@ static const struct it87_devices it87_devices[] = {
	},
	[it8772] = {
		.name = "it8772",
		.suffix = "E",
		.features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
		  | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI,
				/* PECI (coreboot) */
@@ -321,30 +331,35 @@ static const struct it87_devices it87_devices[] = {
	},
	[it8781] = {
		.name = "it8781",
		.suffix = "F",
		.features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET
		  | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG,
		.old_peci_mask = 0x4,
	},
	[it8782] = {
		.name = "it8782",
		.suffix = "F",
		.features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET
		  | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG,
		.old_peci_mask = 0x4,
	},
	[it8783] = {
		.name = "it8783",
		.suffix = "E/F",
		.features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET
		  | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG,
		.old_peci_mask = 0x4,
	},
	[it8786] = {
		.name = "it8786",
		.suffix = "E",
		.features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
		  | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI,
		.peci_mask = 0x07,
	},
	[it8603] = {
		.name = "it8603",
		.suffix = "E",
		.features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
		  | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI,
		.peci_mask = 0x07,
@@ -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 */