Bug 26172

Summary: Radeonfb does not register monid adapter as I2C hardware monitor
Product: Drivers Reporter: Alexander Goomenyuk (emerg.reanimator)
Component: Console/FramebuffersAssignee: Jean Delvare (jdelvare)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alexdeucher, benh, drivers_other
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.36-tuxonice-r3 Subsystem:
Regression: No Bisected commit-id:
Attachments: Fix based on Alexander's proposal

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():
<code>
       if (!(adapter->class & driver->class)) 
                goto exit_free;
</code>

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():
<code>
	radeon_setup_i2c_bus(&rinfo->i2c[0], "monid");

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

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.