diff options
-rw-r--r-- | drivers/hwmon/ftsteutates.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/hwmon/ftsteutates.c b/drivers/hwmon/ftsteutates.c index 48633e541dc3..0f0277e7aae5 100644 --- a/drivers/hwmon/ftsteutates.c +++ b/drivers/hwmon/ftsteutates.c | |||
@@ -36,6 +36,10 @@ | |||
36 | #define FTS_EVENT_STATUS_REG 0x0006 | 36 | #define FTS_EVENT_STATUS_REG 0x0006 |
37 | #define FTS_GLOBAL_CONTROL_REG 0x0007 | 37 | #define FTS_GLOBAL_CONTROL_REG 0x0007 |
38 | 38 | ||
39 | #define FTS_DEVICE_DETECT_REG_1 0x0C | ||
40 | #define FTS_DEVICE_DETECT_REG_2 0x0D | ||
41 | #define FTS_DEVICE_DETECT_REG_3 0x0E | ||
42 | |||
39 | #define FTS_SENSOR_EVENT_REG 0x0010 | 43 | #define FTS_SENSOR_EVENT_REG 0x0010 |
40 | 44 | ||
41 | #define FTS_FAN_EVENT_REG 0x0014 | 45 | #define FTS_FAN_EVENT_REG 0x0014 |
@@ -54,6 +58,8 @@ | |||
54 | #define FTS_NO_TEMP_SENSORS 0x10 | 58 | #define FTS_NO_TEMP_SENSORS 0x10 |
55 | #define FTS_NO_VOLT_SENSORS 0x04 | 59 | #define FTS_NO_VOLT_SENSORS 0x04 |
56 | 60 | ||
61 | static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; | ||
62 | |||
57 | static struct i2c_device_id fts_id[] = { | 63 | static struct i2c_device_id fts_id[] = { |
58 | { "ftsteutates", 0 }, | 64 | { "ftsteutates", 0 }, |
59 | { } | 65 | { } |
@@ -734,6 +740,42 @@ static const struct attribute_group *fts_attr_groups[] = { | |||
734 | /*****************************************************************************/ | 740 | /*****************************************************************************/ |
735 | /* Module initialization / remove functions */ | 741 | /* Module initialization / remove functions */ |
736 | /*****************************************************************************/ | 742 | /*****************************************************************************/ |
743 | static int fts_detect(struct i2c_client *client, | ||
744 | struct i2c_board_info *info) | ||
745 | { | ||
746 | int val; | ||
747 | |||
748 | /* detection works with revsion greater or equal to 0x2b */ | ||
749 | val = i2c_smbus_read_byte_data(client, FTS_DEVICE_REVISION_REG); | ||
750 | if (val < 0x2b) | ||
751 | return -ENODEV; | ||
752 | |||
753 | /* Device Detect Regs must have 0x17 0x34 and 0x54 */ | ||
754 | val = i2c_smbus_read_byte_data(client, FTS_DEVICE_DETECT_REG_1); | ||
755 | if (val != 0x17) | ||
756 | return -ENODEV; | ||
757 | |||
758 | val = i2c_smbus_read_byte_data(client, FTS_DEVICE_DETECT_REG_2); | ||
759 | if (val != 0x34) | ||
760 | return -ENODEV; | ||
761 | |||
762 | val = i2c_smbus_read_byte_data(client, FTS_DEVICE_DETECT_REG_3); | ||
763 | if (val != 0x54) | ||
764 | return -ENODEV; | ||
765 | |||
766 | /* | ||
767 | * 0x10 == Baseboard Management Controller, 0x01 == Teutates | ||
768 | * Device ID Reg needs to be 0x11 | ||
769 | */ | ||
770 | val = i2c_smbus_read_byte_data(client, FTS_DEVICE_ID_REG); | ||
771 | if (val != 0x11) | ||
772 | return -ENODEV; | ||
773 | |||
774 | strlcpy(info->type, fts_id[0].name, I2C_NAME_SIZE); | ||
775 | info->flags = 0; | ||
776 | return 0; | ||
777 | } | ||
778 | |||
737 | static int fts_remove(struct i2c_client *client) | 779 | static int fts_remove(struct i2c_client *client) |
738 | { | 780 | { |
739 | struct fts_data *data = dev_get_drvdata(&client->dev); | 781 | struct fts_data *data = dev_get_drvdata(&client->dev); |
@@ -804,12 +846,15 @@ static int fts_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
804 | /* Module Details */ | 846 | /* Module Details */ |
805 | /*****************************************************************************/ | 847 | /*****************************************************************************/ |
806 | static struct i2c_driver fts_driver = { | 848 | static struct i2c_driver fts_driver = { |
849 | .class = I2C_CLASS_HWMON, | ||
807 | .driver = { | 850 | .driver = { |
808 | .name = "ftsteutates", | 851 | .name = "ftsteutates", |
809 | }, | 852 | }, |
810 | .id_table = fts_id, | 853 | .id_table = fts_id, |
811 | .probe = fts_probe, | 854 | .probe = fts_probe, |
812 | .remove = fts_remove, | 855 | .remove = fts_remove, |
856 | .detect = fts_detect, | ||
857 | .address_list = normal_i2c, | ||
813 | }; | 858 | }; |
814 | 859 | ||
815 | module_i2c_driver(fts_driver); | 860 | module_i2c_driver(fts_driver); |