It seems the device names have changed for the fan and thermostat i2c devices.
This patch addresses 3 issues with the therm_windtunnel driver. 1. Fix the device names 2. Remove the deprecated attach_adapter method of loading the driver 3. Expose the fan level setting to /sys/devices/temperature (along with temperatures) I am not a kernel developer so have no clue as to how to get this patch incorporated into the kernel tree. Hope someone on here can hall. Regards Bryan --- ../therm_windtunnel.c.orig 2014-03-21 09:18:31.608173741 +1300 +++ therm_windtunnel.c 2014-03-21 09:55:39.165486409 +1300 @@ -107,8 +107,15 @@ show_case_temperature( struct device *de return sprintf(buf, "%d.%d\n", x.casetemp>>8, (x.casetemp & 255)*10/256 ); } +static ssize_t +show_fan_level( struct device *dev, struct device_attribute *attr, char *buf ) +{ + return sprintf(buf, "%d\n", 11 - x.fan_level ); +} + static DEVICE_ATTR(cpu_temperature, S_IRUGO, show_cpu_temperature, NULL ); static DEVICE_ATTR(case_temperature, S_IRUGO, show_case_temperature, NULL ); +static DEVICE_ATTR(fan_level, S_IRUGO, show_fan_level, NULL ); @@ -254,6 +261,7 @@ setup_hardware( void ) err = device_create_file( &x.of_dev->dev, &dev_attr_cpu_temperature ); err |= device_create_file( &x.of_dev->dev, &dev_attr_case_temperature ); + err |= device_create_file( &x.of_dev->dev, &dev_attr_fan_level ); if (err) printk(KERN_WARNING "Failed to create temperature attribute file(s).\n"); @@ -264,6 +272,7 @@ restore_regs( void ) { device_remove_file( &x.of_dev->dev, &dev_attr_cpu_temperature ); device_remove_file( &x.of_dev->dev, &dev_attr_case_temperature ); + device_remove_file( &x.of_dev->dev, &dev_attr_fan_level ); write_reg( x.fan, 0x01, x.r1, 1 ); write_reg( x.fan, 0x20, x.r20, 1 ); @@ -301,40 +310,6 @@ static int control_loop(void *dummy) /************************************************************************/ static int -do_attach( struct i2c_adapter *adapter ) -{ - /* scan 0x48-0x4f (DS1775) and 0x2c-2x2f (ADM1030) */ - static const unsigned short scan_ds1775[] = { - 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, - I2C_CLIENT_END - }; - static const unsigned short scan_adm1030[] = { - 0x2c, 0x2d, 0x2e, 0x2f, - I2C_CLIENT_END - }; - - if( strncmp(adapter->name, "uni-n", 5) ) - return 0; - - if( !x.running ) { - struct i2c_board_info info; - - memset(&info, 0, sizeof(struct i2c_board_info)); - strlcpy(info.type, "therm_ds1775", I2C_NAME_SIZE); - i2c_new_probed_device(adapter, &info, scan_ds1775, NULL); - - strlcpy(info.type, "therm_adm1030", I2C_NAME_SIZE); - i2c_new_probed_device(adapter, &info, scan_adm1030, NULL); - - if( x.thermostat && x.fan ) { - x.running = 1; - x.poll_task = kthread_run(control_loop, NULL, "g4fand"); - } - } - return 0; -} - -static int do_remove(struct i2c_client *client) { if (x.running) { @@ -404,8 +379,8 @@ out: enum chip { ds1775, adm1030 }; static const struct i2c_device_id therm_windtunnel_id[] = { - { "therm_ds1775", ds1775 }, - { "therm_adm1030", adm1030 }, + { "MAC,ds1775", ds1775 }, + { "MAC,adm1030", adm1030 }, { } }; @@ -420,9 +395,15 @@ do_probe(struct i2c_client *cl, const st switch (id->driver_data) { case adm1030: - return attach_fan( cl ); + attach_fan( cl ); + break; case ds1775: - return attach_thermostat(cl); + attach_thermostat(cl); + break; + } + if( !x.running && x.thermostat && x.fan ) { + x.running = 1; + x.poll_task = kthread_run(control_loop, NULL, "g4fand"); } return 0; } @@ -431,7 +412,6 @@ static struct i2c_driver g4fan_driver = .driver = { .name = "therm_windtunnel", }, - .attach_adapter = do_attach, .probe = do_probe, .remove = do_remove, .id_table = therm_windtunnel_id,
signature.asc
Description: Message signed with OpenPGP using GPGMail