Page MenuHomeFreeBSD

[PowerPC] Fix sensor attachment on PowerBook5,3
Needs ReviewPublic

Authored by bdragon on Feb 23 2020, 7:22 PM.
Referenced Files
Unknown Object (File)
Dec 24 2023, 5:45 PM
Unknown Object (File)
Dec 22 2023, 11:36 PM
Unknown Object (File)
Nov 27 2023, 11:09 AM
Unknown Object (File)
Nov 11 2023, 8:40 AM
Unknown Object (File)
Nov 9 2023, 4:00 AM
Unknown Object (File)
Oct 31 2023, 10:07 AM
Unknown Object (File)
Oct 10 2023, 7:45 AM
Unknown Object (File)
Oct 8 2023, 2:58 AM

Details

Reviewers
None
Group Reviewers
PowerPC
Summary

After spending a while trying to figure out why the fans on my PowerBook G4 would always be at full speed, and the thermal sensors were missing, I realized that the ADT746x driver did not actually have support for the "Version 1" sensor format, and would only work on models that had extra nodes for the individual child sensors.

This patch changes the behavior for hwsensor-params-version == 1 to read everything out of the device properties.

Test Plan

Test on a variety of hardware and ensure this doesn't cause any regressions

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/dev/iicbus/adt746x.c
129

As far as I can see, the Darwin driver for this chip ignores the vcc reg completely and uses the 2.5V measurements for figuring out the voltage. I assume this is for accuracy reasons.

465

I was waffling on whether or not to do this only if the children were missing or to always do it for version 1. Opinions welcome.

480

I'm tempted to use a goto here.

jhibbits added inline comments.
sys/dev/iicbus/adt746x.c
465

I'd say do it only if the children are missing, unless you've determined that there are times the device tree lies.

480

Use a goto. Our general use of goto is single exit point for cleanup. Since it stays within the version 1 block, I'd name the label something like 'out_v1' or 'cleanup_v1'

I tried this patch on Powerbook5,6 with hwsensor-params-version=00 00 00 01 and didn't notice difference. With or without the patch I see the following behavior:

1 - right fan producing an annoying noise, with rear right exhaust RPM peaking at 640 RPM for one second and going down to zero for another 7 seconds, repeating it in a cycle
2 - left fan is well behaved for several minutes after boot, then suddently it goes to 3340 RPM continues at this speed "forever"

Coincidentally or not, behavior 2 occurs at some point when adt746x temperature sensors are reading something betwen 50 and 55C, then with left spins at 3340 RPM decreasing temperatures to 39-43C range.
However, pwm values are reading 5 for both fans:

dev.adt746x.0.sensors.rear_right_exhaust.rpm: 0
dev.adt746x.0.sensors.rear_left_exhaust.rpm: 3351
dev.adt746x.0.sensors.pwr_supply_bottomside.temp: 43.0C
dev.adt746x.0.sensors.cpu_bottomside.temp: 40.0C
dev.adt746x.0.sensors.cpu/intrepid_bottomside.temp: 43.0C
dev.adt746x.0.fans.rear_right_exhaust.pwm: 5
dev.adt746x.0.fans.rear_left_exhaust.pwm: 5
dev.ds1775.0.sensor.track_pad.temp: 33.5C
.
.
.
dev.adt746x.0.sensors.rear_right_exhaust.rpm: 526
dev.adt746x.0.sensors.rear_left_exhaust.rpm: 3351
dev.adt746x.0.sensors.pwr_supply_bottomside.temp: 43.0C
dev.adt746x.0.sensors.cpu_bottomside.temp: 39.0C
dev.adt746x.0.sensors.cpu/intrepid_bottomside.temp: 43.0C
dev.adt746x.0.fans.rear_right_exhaust.pwm: 5
dev.adt746x.0.fans.rear_left_exhaust.pwm: 5
dev.ds1775.0.sensor.track_pad.temp: 33.5C

As reference, oftdump reports it has *adt7467*

1 - right fan producing an annoying noise, with rear right exhaust RPM peaking at 640 RPM for one second and going down to zero for another 7 seconds, repeating it in a cycle

I changed "fan.min_rpm" from 5% to 6% and now rear right exhaust fan RPM varies from 180 to 215 and doesn't go down to zero.

Recently got this patch working on 13.1, quiets the fans down on my Late 2003 PowerBook5,2. In fact the fans are barely on as far as I can tell, I'll have to investigate temperatures.

Had to clean up a couple unused vars like upstream to get things to compile.