aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f75375s.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/f75375s.c')
-rw-r--r--drivers/hwmon/f75375s.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index e2107e533ede..bad2cf3ef4a4 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -35,12 +35,12 @@
35#include <linux/err.h> 35#include <linux/err.h>
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37#include <linux/f75375s.h> 37#include <linux/f75375s.h>
38#include <linux/slab.h>
38 39
39/* Addresses to scan */ 40/* Addresses to scan */
40static const unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; 41static const unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END };
41 42
42/* Insmod parameters */ 43enum chips { f75373, f75375 };
43I2C_CLIENT_INSMOD_2(f75373, f75375);
44 44
45/* Fintek F75375 registers */ 45/* Fintek F75375 registers */
46#define F75375_REG_CONFIG0 0x0 46#define F75375_REG_CONFIG0 0x0
@@ -113,7 +113,7 @@ struct f75375_data {
113 s8 temp_max_hyst[2]; 113 s8 temp_max_hyst[2];
114}; 114};
115 115
116static int f75375_detect(struct i2c_client *client, int kind, 116static int f75375_detect(struct i2c_client *client,
117 struct i2c_board_info *info); 117 struct i2c_board_info *info);
118static int f75375_probe(struct i2c_client *client, 118static int f75375_probe(struct i2c_client *client,
119 const struct i2c_device_id *id); 119 const struct i2c_device_id *id);
@@ -135,7 +135,7 @@ static struct i2c_driver f75375_driver = {
135 .remove = f75375_remove, 135 .remove = f75375_remove,
136 .id_table = f75375_id, 136 .id_table = f75375_id,
137 .detect = f75375_detect, 137 .detect = f75375_detect,
138 .address_data = &addr_data, 138 .address_list = normal_i2c,
139}; 139};
140 140
141static inline int f75375_read8(struct i2c_client *client, u8 reg) 141static inline int f75375_read8(struct i2c_client *client, u8 reg)
@@ -677,34 +677,24 @@ static int f75375_remove(struct i2c_client *client)
677} 677}
678 678
679/* Return 0 if detection is successful, -ENODEV otherwise */ 679/* Return 0 if detection is successful, -ENODEV otherwise */
680static int f75375_detect(struct i2c_client *client, int kind, 680static int f75375_detect(struct i2c_client *client,
681 struct i2c_board_info *info) 681 struct i2c_board_info *info)
682{ 682{
683 struct i2c_adapter *adapter = client->adapter; 683 struct i2c_adapter *adapter = client->adapter;
684 u8 version = 0; 684 u16 vendid, chipid;
685 const char *name = ""; 685 u8 version;
686 686 const char *name;
687 if (kind < 0) {
688 u16 vendid = f75375_read16(client, F75375_REG_VENDOR);
689 u16 chipid = f75375_read16(client, F75375_CHIP_ID);
690 version = f75375_read8(client, F75375_REG_VERSION);
691 if (chipid == 0x0306 && vendid == 0x1934) {
692 kind = f75375;
693 } else if (chipid == 0x0204 && vendid == 0x1934) {
694 kind = f75373;
695 } else {
696 dev_err(&adapter->dev,
697 "failed,%02X,%02X,%02X\n",
698 chipid, version, vendid);
699 return -ENODEV;
700 }
701 }
702 687
703 if (kind == f75375) { 688 vendid = f75375_read16(client, F75375_REG_VENDOR);
689 chipid = f75375_read16(client, F75375_CHIP_ID);
690 if (chipid == 0x0306 && vendid == 0x1934)
704 name = "f75375"; 691 name = "f75375";
705 } else if (kind == f75373) { 692 else if (chipid == 0x0204 && vendid == 0x1934)
706 name = "f75373"; 693 name = "f75373";
707 } 694 else
695 return -ENODEV;
696
697 version = f75375_read8(client, F75375_REG_VERSION);
708 dev_info(&adapter->dev, "found %s version: %02X\n", name, version); 698 dev_info(&adapter->dev, "found %s version: %02X\n", name, version);
709 strlcpy(info->type, name, I2C_NAME_SIZE); 699 strlcpy(info->type, name, I2C_NAME_SIZE);
710 700