lm87: Add support for configuration through
Subsystems (2)
PATCH 1/1 lm87: Add support for configuration through
The lm87 driver normally assumes that firmware configured the chip correctly. Since this is not always the case, alllow platform code to set the channel register value via platform_data. All other configuration registers can be changed after driver initialisation.
--- Documentation/hwmon/lm87 | 9 ++++----- drivers/hwmon/lm87.c | 17 +++++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-)
This removes the line to override config in case platform_data is set.
Ben.
Documentation/hwmon/lm87 +4 -5
@@ -65,11 +65,10 @@ The LM87 has four pins which can serve one of two possible functions, depending on the hardware configuration. Some functions share pins, so not all functions are available at the same -time. Which are depends on the hardware setup. This driver assumes that -the BIOS configured the chip correctly. In that respect, it differs from -the original driver (from lm_sensors for Linux 2.4), which would force the -LM87 to an arbitrary, compile-time chosen mode, regardless of the actual -chipset wiring. +time. Which are depends on the hardware setup. This driver normally +assumes that firmware configured the chip correctly. Where this is not +the case, platform code must set the I2C client's platform_data to point +to a u8 value to be written to the channel register. For reference, here is the list of exclusive functions: - in0+in5 (default) or temp3
drivers/hwmon/lm87.c +11 -6
@@ -21,11 +21,10 @@* http://www.national.com/pf/LM/LM87.html * * Some functions share pins, so not all functions are available at the same -* time. Which are depends on the hardware setup. This driver assumes that -* the BIOS configured the chip correctly. In that respect, it differs from -* the original driver (from lm_sensors for Linux 2.4), which would force the -* LM87 to an arbitrary, compile-time chosen mode, regardless of the actual -* chipset wiring. +* time. Which are depends on the hardware setup. This driver normally +* assumes that firmware configured the chip correctly. Where this is not +* the case, platform code must set the I2C client's platform_data to point +* to a u8 value to be written to the channel register. * For reference, here is the list of exclusive functions: * - in0+in5 (default) or temp3 * - fan1 (default) or in6
@@ -843,7 +842,13 @@ static void lm87_init_client(struct i2c_client *client) {struct lm87_data *data =i2c_get_clientdata (client); - data->channel =lm87_read_value (client,LM87_REG_CHANNEL_MODE ); +if (client->dev.platform_data) { + data->channel = *(u8 *)client->dev.platform_data; +lm87_write_value (client, +LM87_REG_CHANNEL_MODE , data->channel); + }else { + data->channel =lm87_read_value (client,LM87_REG_CHANNEL_MODE ); + } data->config =lm87_read_value (client,LM87_REG_CONFIG );if (!(data->config &0x01 )) {
Signature · 8 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
PATCH 1/1 lm87: Add support for configuration through
The lm87 driver normally assumes that firmware configured the chip correctly. Since this is not always the case, alllow platform code to set the channel register value via platform_data. All other configuration registers can be changed after driver initialisation.
--- Documentation/hwmon/lm87 | 9 ++++----- drivers/hwmon/lm87.c | 17 +++++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-)
This removes the line to override config in case platform_data is set. (This time with a Signed-off-by!)
Ben.
Documentation/hwmon/lm87 +4 -5
@@ -65,11 +65,10 @@ The LM87 has four pins which can serve one of two possible functions, depending on the hardware configuration. Some functions share pins, so not all functions are available at the same -time. Which are depends on the hardware setup. This driver assumes that -the BIOS configured the chip correctly. In that respect, it differs from -the original driver (from lm_sensors for Linux 2.4), which would force the -LM87 to an arbitrary, compile-time chosen mode, regardless of the actual -chipset wiring. +time. Which are depends on the hardware setup. This driver normally +assumes that firmware configured the chip correctly. Where this is not +the case, platform code must set the I2C client's platform_data to point +to a u8 value to be written to the channel register. For reference, here is the list of exclusive functions: - in0+in5 (default) or temp3
drivers/hwmon/lm87.c +11 -6
@@ -21,11 +21,10 @@* http://www.national.com/pf/LM/LM87.html * * Some functions share pins, so not all functions are available at the same -* time. Which are depends on the hardware setup. This driver assumes that -* the BIOS configured the chip correctly. In that respect, it differs from -* the original driver (from lm_sensors for Linux 2.4), which would force the -* LM87 to an arbitrary, compile-time chosen mode, regardless of the actual -* chipset wiring. +* time. Which are depends on the hardware setup. This driver normally +* assumes that firmware configured the chip correctly. Where this is not +* the case, platform code must set the I2C client's platform_data to point +* to a u8 value to be written to the channel register. * For reference, here is the list of exclusive functions: * - in0+in5 (default) or temp3 * - fan1 (default) or in6
@@ -843,7 +842,13 @@ static void lm87_init_client(struct i2c_client *client) {struct lm87_data *data =i2c_get_clientdata (client); - data->channel =lm87_read_value (client,LM87_REG_CHANNEL_MODE ); +if (client->dev.platform_data) { + data->channel = *(u8 *)client->dev.platform_data; +lm87_write_value (client, +LM87_REG_CHANNEL_MODE , data->channel); + }else { + data->channel =lm87_read_value (client,LM87_REG_CHANNEL_MODE ); + } data->config =lm87_read_value (client,LM87_REG_CONFIG );if (!(data->config &0x01 )) {
Signature · 8 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH] lm87: Add support for configuration
In reply to Ben HutchingsQuoted 5 lines · Ben Hutchings
The lm87 driver normally assumes that firmware configured the chip correctly. Since this is not always the case, alllow platform code to set the channel register value via
platform_data. All other configuration registers can be changed after driver initialisation.
Quoted 8 lines
Signed-off-by Ben Hutchings <[email protected]>--- Documentation/hwmon/lm87 | 9 ++++----- drivers/hwmon/lm87.c | 17 +++++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-)This removes the line to override config in case
platform_datais set. (This time with a Signed-off-by!)
Excellent. Thanks for the patch. All 3 lm87 patches are now in my personal tree and I'll push them to Linus for 2.6.28.
I've tested that the lm87 driver still works OK on my test system that has an LM87 chip.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors