Bug 26172 - Radeonfb does not register monid adapter as I2C hardware monitor
Radeonfb does not register monid adapter as I2C hardware monitor
Product: Drivers
Classification: Unclassified
Component: Console/Framebuffers
All Linux
: P1 normal
Assigned To: Jean Delvare
Depends on:
  Show dependency treegraph
Reported: 2011-01-05 23:50 UTC by Alexander Goomenyuk
Modified: 2011-05-03 16:38 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6.36-tuxonice-r3
Tree: Mainline
Regression: No

Fix based on Alexander's proposal (1.01 KB, patch)
2011-01-11 15:26 UTC, Jean Delvare
Details | Diff

Description Alexander Goomenyuk 2011-01-05 23:50:22 UTC
I have X600 Radeon video card with external LM63 temperature sensor.

In order to access the sensor the radeonfb (i2c-core, i2c_algo_bit, ...) drivers need to loaded.

When the radeonfb_create_i2c_busses() called it register I2C bus with adapter class set to 0 (default, not set explicitly). Later when lm63 module is loaded the i2c_register_driver()->__process_new_driver()->i2c_do_add_adapter()->i2c_detect() called.

This function check if adapter support driver class:
linux/drivers/i2c.c, i2c_detect():
       if (!(adapter->class & driver->class)) 
                goto exit_free;

Here it's successfully failed. And the LM63 driver become useless for monitoring the GPU temp with lm_sensors.

If I add the following line to linux/drivers/video/aty/radeon_i2c.c, radeonfb_create_i2c_busses():
	radeon_setup_i2c_bus(&rinfo->i2c[0], "monid");

#warning "Debug code"
+        rinfo->i2c[0].adapter.class = I2C_CLASS_HWMON;

Then lm63 works as expected.

Is it possible to fix the radeon driver in this way?
Or that problem has to be solved differently?

Thanks in advance!
Comment 1 Jean Delvare 2011-01-11 15:26:07 UTC
Created attachment 43262 [details]
Fix based on Alexander's proposal

I've just sent this patch to Benjamin Herrenschmidt.
Comment 2 Jean Delvare 2011-01-13 08:43:43 UTC
BTW, note that using the kms radeon driver would solve your problem too, as this driver already has full support for hardware monitoring on Radeon cards.
Comment 4 Alex Deucher 2011-05-03 15:21:47 UTC
In theory a thermal chip can be hooked up to any of the i2c buses on the asic, not just monid.
Comment 5 Jean Delvare 2011-05-03 15:35:57 UTC
And in practice?
Comment 6 Alex Deucher 2011-05-03 16:38:09 UTC
It's up to the oem.  There's a table in the vbios that lists the i2c bus the thermal chip is on.

Note You need to log in before you can comment on or make changes to this bug.