Commit 10f2ed31 authored by Matthew Garrett's avatar Matthew Garrett Committed by Jean Delvare

hwmon: (lm63) Add basic support for LM64

The LM64 appears to be an LM63 with added GPIO lines. Add support for the
hwmon functionality - GPIO can be added at some later stage if someone
has a need for them.
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 70dd6bea
...@@ -7,6 +7,11 @@ Supported chips: ...@@ -7,6 +7,11 @@ Supported chips:
Addresses scanned: I2C 0x4c Addresses scanned: I2C 0x4c
Datasheet: Publicly available at the National Semiconductor website Datasheet: Publicly available at the National Semiconductor website
http://www.national.com/pf/LM/LM63.html http://www.national.com/pf/LM/LM63.html
* National Semiconductor LM64
Prefix: 'lm64'
Addresses scanned: I2C 0x18 and 0x4e
Datasheet: Publicly available at the National Semiconductor website
http://www.national.com/pf/LM/LM64.html
Author: Jean Delvare <khali@linux-fr.org> Author: Jean Delvare <khali@linux-fr.org>
...@@ -55,3 +60,5 @@ The lm63 driver will not update its values more frequently than every ...@@ -55,3 +60,5 @@ The lm63 driver will not update its values more frequently than every
second; reading them more often will do no harm, but will return 'old' second; reading them more often will do no harm, but will return 'old'
values. values.
The LM64 is effectively an LM63 with GPIO lines. The driver does not
support these GPIO lines at present.
...@@ -447,13 +447,14 @@ config SENSORS_IT87 ...@@ -447,13 +447,14 @@ config SENSORS_IT87
will be called it87. will be called it87.
config SENSORS_LM63 config SENSORS_LM63
tristate "National Semiconductor LM63" tristate "National Semiconductor LM63 and LM64"
depends on I2C depends on I2C
help help
If you say yes here you get support for the National Semiconductor If you say yes here you get support for the National
LM63 remote diode digital temperature sensor with integrated fan Semiconductor LM63 and LM64 remote diode digital temperature
control. Such chips are found on the Tyan S4882 (Thunder K8QS Pro) sensors with integrated fan control. Such chips are found
motherboard, among others. on the Tyan S4882 (Thunder K8QS Pro) motherboard, among
others.
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called lm63. will be called lm63.
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
* Address is fully defined internally and cannot be changed. * Address is fully defined internally and cannot be changed.
*/ */
static const unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x18, 0x4c, 0x4e, I2C_CLIENT_END };
/* /*
* The LM63 registers * The LM63 registers
...@@ -131,12 +131,15 @@ static struct lm63_data *lm63_update_device(struct device *dev); ...@@ -131,12 +131,15 @@ static struct lm63_data *lm63_update_device(struct device *dev);
static int lm63_detect(struct i2c_client *client, struct i2c_board_info *info); static int lm63_detect(struct i2c_client *client, struct i2c_board_info *info);
static void lm63_init_client(struct i2c_client *client); static void lm63_init_client(struct i2c_client *client);
enum chips { lm63, lm64 };
/* /*
* Driver data (common to all clients) * Driver data (common to all clients)
*/ */
static const struct i2c_device_id lm63_id[] = { static const struct i2c_device_id lm63_id[] = {
{ "lm63", 0 }, { "lm63", lm63 },
{ "lm64", lm64 },
{ } { }
}; };
MODULE_DEVICE_TABLE(i2c, lm63_id); MODULE_DEVICE_TABLE(i2c, lm63_id);
...@@ -422,6 +425,7 @@ static int lm63_detect(struct i2c_client *new_client, ...@@ -422,6 +425,7 @@ static int lm63_detect(struct i2c_client *new_client,
struct i2c_adapter *adapter = new_client->adapter; struct i2c_adapter *adapter = new_client->adapter;
u8 man_id, chip_id, reg_config1, reg_config2; u8 man_id, chip_id, reg_config1, reg_config2;
u8 reg_alert_status, reg_alert_mask; u8 reg_alert_status, reg_alert_mask;
int address = new_client->addr;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -ENODEV; return -ENODEV;
...@@ -439,7 +443,6 @@ static int lm63_detect(struct i2c_client *new_client, ...@@ -439,7 +443,6 @@ static int lm63_detect(struct i2c_client *new_client,
LM63_REG_ALERT_MASK); LM63_REG_ALERT_MASK);
if (man_id != 0x01 /* National Semiconductor */ if (man_id != 0x01 /* National Semiconductor */
|| chip_id != 0x41 /* LM63 */
|| (reg_config1 & 0x18) != 0x00 || (reg_config1 & 0x18) != 0x00
|| (reg_config2 & 0xF8) != 0x00 || (reg_config2 & 0xF8) != 0x00
|| (reg_alert_status & 0x20) != 0x00 || (reg_alert_status & 0x20) != 0x00
...@@ -450,7 +453,12 @@ static int lm63_detect(struct i2c_client *new_client, ...@@ -450,7 +453,12 @@ static int lm63_detect(struct i2c_client *new_client,
return -ENODEV; return -ENODEV;
} }
if (chip_id == 0x41 && address == 0x4c)
strlcpy(info->type, "lm63", I2C_NAME_SIZE); strlcpy(info->type, "lm63", I2C_NAME_SIZE);
else if (chip_id == 0x51 && (address == 0x18 || address == 0x4e))
strlcpy(info->type, "lm64", I2C_NAME_SIZE);
else
return -ENODEV;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment