aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/dme1737.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/dme1737.c')
-rw-r--r--drivers/hwmon/dme1737.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
index 27d62574284f..823dd28a902c 100644
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -57,11 +57,7 @@ MODULE_PARM_DESC(probe_all_addr, "Include probing of non-standard LPC "
57/* Addresses to scan */ 57/* Addresses to scan */
58static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; 58static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};
59 59
60/* Insmod parameters */ 60enum chips { dme1737, sch5027, sch311x };
61I2C_CLIENT_INSMOD_2(dme1737, sch5027);
62
63/* ISA chip types */
64enum isa_chips { sch311x = sch5027 + 1 };
65 61
66/* --------------------------------------------------------------------- 62/* ---------------------------------------------------------------------
67 * Registers 63 * Registers
@@ -2208,7 +2204,7 @@ exit:
2208} 2204}
2209 2205
2210/* Return 0 if detection is successful, -ENODEV otherwise */ 2206/* Return 0 if detection is successful, -ENODEV otherwise */
2211static int dme1737_i2c_detect(struct i2c_client *client, int kind, 2207static int dme1737_i2c_detect(struct i2c_client *client,
2212 struct i2c_board_info *info) 2208 struct i2c_board_info *info)
2213{ 2209{
2214 struct i2c_adapter *adapter = client->adapter; 2210 struct i2c_adapter *adapter = client->adapter;
@@ -2220,33 +2216,23 @@ static int dme1737_i2c_detect(struct i2c_client *client, int kind,
2220 return -ENODEV; 2216 return -ENODEV;
2221 } 2217 }
2222 2218
2223 /* A negative kind means that the driver was loaded with no force 2219 company = i2c_smbus_read_byte_data(client, DME1737_REG_COMPANY);
2224 * parameter (default), so we must identify the chip. */ 2220 verstep = i2c_smbus_read_byte_data(client, DME1737_REG_VERSTEP);
2225 if (kind < 0) {
2226 company = i2c_smbus_read_byte_data(client, DME1737_REG_COMPANY);
2227 verstep = i2c_smbus_read_byte_data(client, DME1737_REG_VERSTEP);
2228
2229 if (company == DME1737_COMPANY_SMSC &&
2230 (verstep & DME1737_VERSTEP_MASK) == DME1737_VERSTEP) {
2231 kind = dme1737;
2232 } else if (company == DME1737_COMPANY_SMSC &&
2233 verstep == SCH5027_VERSTEP) {
2234 kind = sch5027;
2235 } else {
2236 return -ENODEV;
2237 }
2238 }
2239 2221
2240 if (kind == sch5027) { 2222 if (company == DME1737_COMPANY_SMSC &&
2223 verstep == SCH5027_VERSTEP) {
2241 name = "sch5027"; 2224 name = "sch5027";
2242 } else { 2225
2243 kind = dme1737; 2226 } else if (company == DME1737_COMPANY_SMSC &&
2227 (verstep & DME1737_VERSTEP_MASK) == DME1737_VERSTEP) {
2244 name = "dme1737"; 2228 name = "dme1737";
2229 } else {
2230 return -ENODEV;
2245 } 2231 }
2246 2232
2247 dev_info(dev, "Found a %s chip at 0x%02x (rev 0x%02x).\n", 2233 dev_info(dev, "Found a %s chip at 0x%02x (rev 0x%02x).\n",
2248 kind == sch5027 ? "SCH5027" : "DME1737", client->addr, 2234 verstep == SCH5027_VERSTEP ? "SCH5027" : "DME1737",
2249 verstep); 2235 client->addr, verstep);
2250 strlcpy(info->type, name, I2C_NAME_SIZE); 2236 strlcpy(info->type, name, I2C_NAME_SIZE);
2251 2237
2252 return 0; 2238 return 0;
@@ -2328,7 +2314,7 @@ static struct i2c_driver dme1737_i2c_driver = {
2328 .remove = dme1737_i2c_remove, 2314 .remove = dme1737_i2c_remove,
2329 .id_table = dme1737_id, 2315 .id_table = dme1737_id,
2330 .detect = dme1737_i2c_detect, 2316 .detect = dme1737_i2c_detect,
2331 .address_data = &addr_data, 2317 .address_list = normal_i2c,
2332}; 2318};
2333 2319
2334/* --------------------------------------------------------------------- 2320/* ---------------------------------------------------------------------