Commit d07ca4ad authored by Jean Delvare's avatar Jean Delvare

hwmon: (adt7475) Print device information on probe

Print the device name and revision at probe time, as well as a list of
all optional features which are available.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Jordan Crouse <jordan@cosmicpenguin.net>
Cc: "Darrick J. Wong" <djwong@us.ibm.com>
parent 378933c9
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
/* 7475 Common Registers */ /* 7475 Common Registers */
#define REG_DEVREV2 0x12 /* ADT7490 only */
#define REG_VTT 0x1E /* ADT7490 only */ #define REG_VTT 0x1E /* ADT7490 only */
#define REG_EXTEND3 0x1F /* ADT7490 only */ #define REG_EXTEND3 0x1F /* ADT7490 only */
...@@ -1149,6 +1151,12 @@ static void adt7475_remove_files(struct i2c_client *client, ...@@ -1149,6 +1151,12 @@ static void adt7475_remove_files(struct i2c_client *client,
static int adt7475_probe(struct i2c_client *client, static int adt7475_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
static const char *names[] = {
[adt7473] = "ADT7473",
[adt7475] = "ADT7475",
[adt7490] = "ADT7490",
};
struct adt7475_data *data; struct adt7475_data *data;
int i, ret = 0, revision; int i, ret = 0, revision;
u8 config3; u8 config3;
...@@ -1165,6 +1173,8 @@ static int adt7475_probe(struct i2c_client *client, ...@@ -1165,6 +1173,8 @@ static int adt7475_probe(struct i2c_client *client,
case adt7490: case adt7490:
data->has_voltage = 0x3e; /* in1 to in5 */ data->has_voltage = 0x3e; /* in1 to in5 */
revision = adt7475_read(REG_DEVID2) & 0x03; revision = adt7475_read(REG_DEVID2) & 0x03;
if (revision == 0x03)
revision += adt7475_read(REG_DEVREV2);
break; break;
default: default:
data->has_voltage = 0x06; /* in1, in2 */ data->has_voltage = 0x06; /* in1, in2 */
...@@ -1234,6 +1244,14 @@ static int adt7475_probe(struct i2c_client *client, ...@@ -1234,6 +1244,14 @@ static int adt7475_probe(struct i2c_client *client,
goto eremove; goto eremove;
} }
dev_info(&client->dev, "%s device, revision %d\n",
names[id->driver_data], revision);
if ((data->has_voltage & (1 << 0)) || data->has_fan4 || data->has_pwm2)
dev_info(&client->dev, "Optional features:%s%s%s\n",
(data->has_voltage & (1 << 0)) ? " in0" : "",
data->has_fan4 ? " fan4" : "",
data->has_pwm2 ? " pwm2" : "");
return 0; return 0;
eremove: eremove:
......
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