Author: tbm Date: Thu Sep 27 11:40:25 2007 New Revision: 9571 Log: [arm] Set the fan on Thecus N2100 to full speed on boot (Riku Voipio).
Added: dists/trunk/linux-2.6/debian/patches/features/arm/n2100-set-fan.patch dists/trunk/linux-2.6/debian/patches/features/f75375-new-style-bindings.patch dists/trunk/linux-2.6/debian/patches/features/f75375-set-fans-platform-data.patch Modified: dists/trunk/linux-2.6/debian/changelog dists/trunk/linux-2.6/debian/patches/series/1~experimental.1 Modified: dists/trunk/linux-2.6/debian/changelog ============================================================================== --- dists/trunk/linux-2.6/debian/changelog (original) +++ dists/trunk/linux-2.6/debian/changelog Thu Sep 27 11:40:25 2007 @@ -29,6 +29,7 @@ * [mips] Add a bcm1480 PCI build fix. * [mips] Add a bcm1480 serial build fix. * Update Riku Voipio's Fintek F75375/SP driver to the latest version. + * [arm] Set the fan on Thecus N2100 to full speed on boot (Riku Voipio). [ Bastian Blank ] * Add unpriviledged only Xen support. Added: dists/trunk/linux-2.6/debian/patches/features/arm/n2100-set-fan.patch ============================================================================== --- (empty file) +++ dists/trunk/linux-2.6/debian/patches/features/arm/n2100-set-fan.patch Thu Sep 27 11:40:25 2007 @@ -0,0 +1,50 @@ +Upstream status: Riku will submit it for 2.6.24 + +From d011b8868255310f214d848fa1543265753858bd Mon Sep 17 00:00:00 2001 +From: [EMAIL PROTECTED] <[EMAIL PROTECTED]> +Date: Tue, 25 Sep 2007 16:33:24 +0300 +Subject: [PATCH] On n2100 systems, set fans to full speed on default + + +Signed-off-by: Riku Voipio <Riku Voipio [EMAIL PROTECTED]> +--- + arch/arm/mach-iop32x/n2100.c | 11 +++++++++++ + 1 files changed, 11 insertions(+), 0 deletions(-) + +diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c +index 1873bd8..5a4acff 100644 +--- a/arch/arm/mach-iop32x/n2100.c ++++ b/arch/arm/mach-iop32x/n2100.c +@@ -16,6 +16,7 @@ + + #include <linux/mm.h> + #include <linux/init.h> ++#include <linux/f75375s.h> + #include <linux/delay.h> + #include <linux/kernel.h> + #include <linux/pci.h> +@@ -200,11 +201,21 @@ static struct platform_device n2100_serial_device = { + .resource = &n2100_uart_resource, + }; + ++static struct f75375s_platform_data n2100_f75375s = { ++ .pwm = { 255, 255}, ++ .pwm_enable = { 0, 0 }, ++}; ++ + static struct i2c_board_info __initdata n2100_i2c_devices[] = { + { + I2C_BOARD_INFO("rtc-rs5c372", 0x32), + .type = "rs5c372b", + }, ++ { ++ I2C_BOARD_INFO("f75375", 0x2e), ++ .type = "f75375", ++ .platform_data = &n2100_f75375s, ++ }, + }; + + /* +-- +1.5.3.1 + Added: dists/trunk/linux-2.6/debian/patches/features/f75375-new-style-bindings.patch ============================================================================== --- (empty file) +++ dists/trunk/linux-2.6/debian/patches/features/f75375-new-style-bindings.patch Thu Sep 27 11:40:25 2007 @@ -0,0 +1,217 @@ +Upstream status: Riku will submit it for 2.6.24 + +From 53eba46aca590170b64a4a85c0eebd3222ca83ee Mon Sep 17 00:00:00 2001 +From: Riku Voipio <[EMAIL PROTECTED]> +Date: Tue, 25 Sep 2007 15:05:36 +0300 +Subject: [PATCH] Add new style bindings + + +Signed-off-by: Riku Voipio <[EMAIL PROTECTED]> +--- + drivers/hwmon/f75375s.c | 112 +++++++++++++++++++++++++++++++++++----------- + 1 files changed, 85 insertions(+), 27 deletions(-) + +diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c +index 6425184..9336f5e 100644 +--- a/drivers/hwmon/f75375s.c ++++ b/drivers/hwmon/f75375s.c +@@ -86,7 +86,7 @@ I2C_CLIENT_INSMOD_2(f75373, f75375); + + struct f75375_data { + unsigned short addr; +- struct i2c_client client; ++ struct i2c_client *client; + struct class_device *class_dev; + + const char *name; +@@ -116,15 +116,26 @@ struct f75375_data { + static int f75375_attach_adapter(struct i2c_adapter *adapter); + static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); + static int f75375_detach_client(struct i2c_client *client); ++static int f75375_probe(struct i2c_client *client); ++static int f75375_remove(struct i2c_client *client); + +-static struct i2c_driver f75375_driver = { ++static struct i2c_driver f75375_legacy_driver = { + .driver = { +- .name = "f75375", ++ .name = "f75375_legacy", + }, + .attach_adapter = f75375_attach_adapter, + .detach_client = f75375_detach_client, + }; + ++static struct i2c_driver f75375_driver = { ++ .driver = { ++ .name = "f75375", ++ }, ++ .probe = f75375_probe, ++ .remove = f75375_remove, ++}; ++ ++ + static inline int f75375_read8(struct i2c_client *client, u8 reg) + { + return i2c_smbus_read_byte_data(client, reg); +@@ -580,12 +591,8 @@ static const struct attribute_group f75375_group = { + + static int f75375_detach_client(struct i2c_client *client) + { +- struct f75375_data *data = i2c_get_clientdata(client); + int err; +- +- hwmon_device_unregister(data->class_dev); +- sysfs_remove_group(&client->dev.kobj, &f75375_group); +- ++ f75375_remove(client); + err = i2c_detach_client(client); + if (err) { + dev_err(&client->dev, +@@ -593,10 +600,64 @@ static int f75375_detach_client(struct i2c_client *client) + "client not detached.\n"); + return err; + } ++ kfree(client); ++ return 0; ++} ++ ++static int f75375_probe(struct i2c_client *client) ++{ ++ struct f75375_data *data = i2c_get_clientdata(client); ++ int err; ++ ++ if (!i2c_check_functionality(client->adapter, ++ I2C_FUNC_SMBUS_BYTE_DATA)) ++ return -EIO; ++ if (!(data = kzalloc(sizeof(struct f75375_data), GFP_KERNEL))) ++ return -ENOMEM; ++ ++ i2c_set_clientdata(client, data); ++ data->client = client; ++ mutex_init(&data->update_lock); ++ ++ if (strcmp(client->name, "f75375") == 0) ++ data->kind = f75375; ++ else if (strcmp(client->name, "f75373") == 0) ++ data->kind = f75373; ++ else { ++ dev_err(&client->dev, "Unsupported device: %s\n", client->name); ++ return -ENODEV; ++ } ++ ++ if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) ++ goto exit_free; ++ ++ data->class_dev = hwmon_device_register(&client->dev); ++ if (IS_ERR(data->class_dev)) { ++ err = PTR_ERR(data->class_dev); ++ goto exit_remove; ++ } ++ ++ return 0; ++ ++exit_remove: ++ sysfs_remove_group(&client->dev.kobj, &f75375_group); ++exit_free: + kfree(data); ++ i2c_set_clientdata(client, NULL); ++ return err; ++} ++ ++static int f75375_remove(struct i2c_client *client) ++{ ++ struct f75375_data *data = i2c_get_clientdata(client); ++ hwmon_device_unregister(data->class_dev); ++ sysfs_remove_group(&client->dev.kobj, &f75375_group); ++ kfree(data); ++ i2c_set_clientdata(client, NULL); + return 0; + } + ++ + static int f75375_attach_adapter(struct i2c_adapter *adapter) + { + if (!(adapter->class & I2C_CLASS_HWMON)) +@@ -608,20 +669,17 @@ static int f75375_attach_adapter(struct i2c_adapter *adapter) + static int f75375_detect(struct i2c_adapter *adapter, int address, int kind) + { + struct i2c_client *client; +- struct f75375_data *data; + u8 version = 0; + int err = 0; + const char *name = ""; + +- if (!(data = kzalloc(sizeof(struct f75375_data), GFP_KERNEL))) { ++ if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } +- client = &data->client; +- i2c_set_clientdata(client, data); + client->addr = address; + client->adapter = adapter; +- client->driver = &f75375_driver; ++ client->driver = &f75375_legacy_driver; + + if (kind < 0) { + u16 vendid = f75375_read16(client, F75375_REG_VENDOR); +@@ -644,42 +702,42 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind) + } else if (kind == f75373) { + name = "f75373"; + } +- + dev_info(&adapter->dev, "found %s version: %02X\n", name, version); + strlcpy(client->name, name, I2C_NAME_SIZE); +- data->kind = kind; +- mutex_init(&data->update_lock); ++ + if ((err = i2c_attach_client(client))) + goto exit_free; + +- if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) ++ if ((err = f75375_probe(client)) < 0) + goto exit_detach; + +- data->class_dev = hwmon_device_register(&client->dev); +- if (IS_ERR(data->class_dev)) { +- err = PTR_ERR(data->class_dev); +- goto exit_remove; +- } +- + return 0; + +-exit_remove: +- sysfs_remove_group(&client->dev.kobj, &f75375_group); + exit_detach: + i2c_detach_client(client); + exit_free: +- kfree(data); ++ kfree(client); + exit: + return err; + } + + static int __init sensors_f75375_init(void) + { +- return i2c_add_driver(&f75375_driver); ++ int status; ++ status = i2c_add_driver(&f75375_driver); ++ if (status < 0) ++ return status; ++ ++ status = i2c_add_driver(&f75375_legacy_driver); ++ if (status < 0) ++ i2c_del_driver(&f75375_driver); ++ ++ return status; + } + + static void __exit sensors_f75375_exit(void) + { ++ i2c_del_driver(&f75375_legacy_driver); + i2c_del_driver(&f75375_driver); + } + +-- +1.5.3.1 + Added: dists/trunk/linux-2.6/debian/patches/features/f75375-set-fans-platform-data.patch ============================================================================== --- (empty file) +++ dists/trunk/linux-2.6/debian/patches/features/f75375-set-fans-platform-data.patch Thu Sep 27 11:40:25 2007 @@ -0,0 +1,137 @@ +Upstream status: Riku will submit it for 2.6.24 + +From 588962ab89405c2cb480895253b3509ba15505ce Mon Sep 17 00:00:00 2001 +From: Riku Voipio <[EMAIL PROTECTED]> +Date: Tue, 25 Sep 2007 16:32:18 +0300 +Subject: [PATCH] Add support for setting up fans with platform_data + + +Signed-off-by: Riku Voipio <[EMAIL PROTECTED]> +--- + drivers/hwmon/f75375s.c | 42 +++++++++++++++++++++++++++++++++++------- + include/linux/f75375s.h | 21 +++++++++++++++++++++ + 2 files changed, 56 insertions(+), 7 deletions(-) + create mode 100644 include/linux/f75375s.h + +diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c +index 9336f5e..3074f74 100644 +--- a/drivers/hwmon/f75375s.c ++++ b/drivers/hwmon/f75375s.c +@@ -34,6 +34,7 @@ + #include <linux/i2c.h> + #include <linux/err.h> + #include <linux/mutex.h> ++#include <linux/f75375s.h> + + /* Addresses to scan */ + static unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; +@@ -287,19 +288,14 @@ static ssize_t show_pwm_enable(struct device *dev, struct device_attribute + return sprintf(buf, "%d\n", data->pwm_enable[nr]); + } + +-static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) + { +- int nr = to_sensor_dev_attr(attr)->index; +- struct i2c_client *client = to_i2c_client(dev); + struct f75375_data *data = i2c_get_clientdata(client); +- int val = simple_strtoul(buf, NULL, 10); + u8 fanmode; + + if (val < 0 || val > 4) + return -EINVAL; + +- mutex_lock(&data->update_lock); + fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); + fanmode = ~(3 << FAN_CTRL_MODE(nr)); + +@@ -321,8 +317,22 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, + } + f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); + data->pwm_enable[nr] = val; ++ return 0; ++} ++ ++static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int nr = to_sensor_dev_attr(attr)->index; ++ struct i2c_client *client = to_i2c_client(dev); ++ struct f75375_data *data = i2c_get_clientdata(client); ++ int val = simple_strtoul(buf, NULL, 10); ++ int err = 0; ++ ++ mutex_lock(&data->update_lock); ++ err = set_pwm_enable_direct(client, nr, val); + mutex_unlock(&data->update_lock); +- return count; ++ return err ? err : count; + } + + static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr, +@@ -604,9 +614,24 @@ static int f75375_detach_client(struct i2c_client *client) + return 0; + } + ++static void f75375_init(struct i2c_client *client, struct f75375_data *data, ++ struct f75375s_platform_data *f75375s_pdata) ++{ ++ int nr; ++ set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]); ++ set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]); ++ for (nr = 0; nr < 2; nr++) { ++ data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255); ++ f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), ++ data->pwm[nr]); ++ } ++ ++} ++ + static int f75375_probe(struct i2c_client *client) + { + struct f75375_data *data = i2c_get_clientdata(client); ++ struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data; + int err; + + if (!i2c_check_functionality(client->adapter, +@@ -637,6 +662,9 @@ static int f75375_probe(struct i2c_client *client) + goto exit_remove; + } + ++ if (f75375s_pdata != NULL) ++ f75375_init(client, data, f75375s_pdata); ++ + return 0; + + exit_remove: +diff --git a/include/linux/f75375s.h b/include/linux/f75375s.h +new file mode 100644 +index 0000000..e99e225 +--- /dev/null ++++ b/include/linux/f75375s.h +@@ -0,0 +1,21 @@ ++/* ++ * f75375s.h - platform data structure for f75375s sensor ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file "COPYING" in the main directory of this archive ++ * for more details. ++ * ++ * Copyright (C) 2007, Riku Voipio <[EMAIL PROTECTED]> ++ */ ++ ++#ifndef __LINUX_F75375S_H ++#define __LINUX_F75375S_H ++ ++/* We want to set fans spinning on systems where there is no ++ * BIOS to do that for us */ ++struct f75375s_platform_data { ++ u8 pwm[2]; ++ u8 pwm_enable[2]; ++}; ++ ++#endif /* __LINUX_F75375S_H */ +-- +1.5.3.1 + Modified: dists/trunk/linux-2.6/debian/patches/series/1~experimental.1 ============================================================================== --- dists/trunk/linux-2.6/debian/patches/series/1~experimental.1 (original) +++ dists/trunk/linux-2.6/debian/patches/series/1~experimental.1 Thu Sep 27 11:40:25 2007 @@ -32,6 +32,9 @@ #+ bugfix/powerpc/drivers_macintosh-broken.patch + bugfix/ia64/hardcode-arch-script-output.patch + features/fintek-f75375.patch ++ features/f75375-new-style-bindings.patch ++ features/f75375-set-fans-platform-data.patch ++ features/arm/n2100-set-fan.patch #+ features/alpha/isa-mapping-support.patch + bugfix/powerpc/libgcc-__ucmpdi2.patch + bugfix/arm/disable-dvb_b2c2_flexcop.patch _______________________________________________ Kernel-svn-changes mailing list Kernel-svn-changes@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/kernel-svn-changes