Commit 093d1a47 authored by Jean Delvare's avatar Jean Delvare Committed by Jean Delvare

hwmon: (w83795) Drop duplicate enum

Enum chips and chip_types are redundant, get rid of the former. Fix
the detection code to properly identify the chip variant and name the
client accordingly.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 315bacfd
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END };
enum chips { w83795 };
static int reset; static int reset;
module_param(reset, bool, 0); module_param(reset, bool, 0);
...@@ -1686,6 +1684,7 @@ static int w83795_detect(struct i2c_client *client, ...@@ -1686,6 +1684,7 @@ static int w83795_detect(struct i2c_client *client,
u8 tmp, bank; u8 tmp, bank;
struct i2c_adapter *adapter = client->adapter; struct i2c_adapter *adapter = client->adapter;
unsigned short address = client->addr; unsigned short address = client->addr;
const char *chip_name;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -ENODEV; return -ENODEV;
...@@ -1718,18 +1717,21 @@ static int w83795_detect(struct i2c_client *client, ...@@ -1718,18 +1717,21 @@ static int w83795_detect(struct i2c_client *client,
return -ENODEV; return -ENODEV;
} }
#if 0 /* Check 795 chip type: 795G or 795ADG
/* Check 795 chip type: 795G or 795ADG */ Usually we don't write to chips during detection, but here we don't
quite have the choice; hopefully it's OK, we are about to return
success anyway */
if ((bank & 0x07) != 0)
i2c_smbus_write_byte_data(client, W83795_REG_BANKSEL,
bank & ~0x07);
if (W83795_REG_CONFIG_CONFIG48 & if (W83795_REG_CONFIG_CONFIG48 &
w83795_read(client, W83795_REG_CONFIG)) { i2c_smbus_read_byte_data(client, W83795_REG_CONFIG)) {
data->chip_type = w83795adg; chip_name = "w83795adg";
} else { } else {
data->chip_type = w83795g; chip_name = "w83795g";
} }
#endif
/* Fill in the remaining client fields and put into the global list */ strlcpy(info->type, chip_name, I2C_NAME_SIZE);
strlcpy(info->type, "w83795", I2C_NAME_SIZE);
return 0; return 0;
} }
...@@ -1750,20 +1752,13 @@ static int w83795_probe(struct i2c_client *client, ...@@ -1750,20 +1752,13 @@ static int w83795_probe(struct i2c_client *client,
} }
i2c_set_clientdata(client, data); i2c_set_clientdata(client, data);
data->chip_type = id->driver_data;
data->bank = i2c_smbus_read_byte_data(client, W83795_REG_BANKSEL); data->bank = i2c_smbus_read_byte_data(client, W83795_REG_BANKSEL);
mutex_init(&data->update_lock); mutex_init(&data->update_lock);
/* Initialize the chip */ /* Initialize the chip */
w83795_init_client(client); w83795_init_client(client);
/* Check 795 chip type: 795G or 795ADG */
if (W83795_REG_CONFIG_CONFIG48 &
w83795_read(client, W83795_REG_CONFIG)) {
data->chip_type = w83795adg;
} else {
data->chip_type = w83795g;
}
data->has_in = w83795_read(client, W83795_REG_VOLT_CTRL1); data->has_in = w83795_read(client, W83795_REG_VOLT_CTRL1);
data->has_in |= w83795_read(client, W83795_REG_VOLT_CTRL2) << 8; data->has_in |= w83795_read(client, W83795_REG_VOLT_CTRL2) << 8;
/* VSEN11-9 not for 795adg */ /* VSEN11-9 not for 795adg */
...@@ -2097,7 +2092,8 @@ static int w83795_remove(struct i2c_client *client) ...@@ -2097,7 +2092,8 @@ static int w83795_remove(struct i2c_client *client)
static const struct i2c_device_id w83795_id[] = { static const struct i2c_device_id w83795_id[] = {
{ "w83795", w83795 }, { "w83795g", w83795g },
{ "w83795adg", w83795adg },
{ } { }
}; };
MODULE_DEVICE_TABLE(i2c, w83795_id); MODULE_DEVICE_TABLE(i2c, w83795_id);
......
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