Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3d98203 authored by Jean Delvare's avatar Jean Delvare
Browse files

hwmon: (i5500_temp) Don't bind to disabled sensors



On many motherboards, for an unknown reason, the thermal sensor seems
to be disabled and will return a constant temperature value of 36.5
degrees Celsius. Don't bind to the device in that case, so that we
don't report this bogus value to userspace.

Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
Cc: Romain Dolbeau <romain@dolbeau.org>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent b8d48ce9
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -121,6 +121,8 @@ static int i5500_temp_probe(struct pci_dev *pdev,
{
{
	int err;
	int err;
	struct device *hwmon_dev;
	struct device *hwmon_dev;
	u32 tstimer;
	s8 tsfsc;


	err = pci_enable_device(pdev);
	err = pci_enable_device(pdev);
	if (err) {
	if (err) {
@@ -128,6 +130,13 @@ static int i5500_temp_probe(struct pci_dev *pdev,
		return err;
		return err;
	}
	}


	pci_read_config_byte(pdev, REG_TSFSC, &tsfsc);
	pci_read_config_dword(pdev, REG_TSTIMER, &tstimer);
	if (tsfsc == 0x7F && tstimer == 0x07D30D40) {
		dev_warn(&pdev->dev, "Sensor seems to be disabled\n");
		return -ENODEV;
	}

	hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev,
	hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev,
							   "intel5500", NULL,
							   "intel5500", NULL,
							   i5500_temp_groups);
							   i5500_temp_groups);