adt7475.c (54ecb9e3c194687eebabe7ca45bae889ac1cd4de) adt7475.c (d656b6fde2531a13c4e68a3ce6b9f12bc19d96bb)
1/*
2 * adt7475 - Thermal sensor driver for the ADT7475 chip and derivatives
3 * Copyright (C) 2007-2008, Advanced Micro Devices, Inc.
4 * Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
5 * Copyright (C) 2008 Hans de Goede <hdegoede@redhat.com>
6
7 * Derived from the lm83 driver by Jean Delvare
8 *

--- 33 unchanged lines hidden (view full) ---

42#define REG_VOLTAGE_BASE 0x20
43#define REG_TEMP_BASE 0x25
44#define REG_TACH_BASE 0x28
45#define REG_PWM_BASE 0x30
46#define REG_PWM_MAX_BASE 0x38
47
48#define REG_DEVID 0x3D
49#define REG_VENDID 0x3E
1/*
2 * adt7475 - Thermal sensor driver for the ADT7475 chip and derivatives
3 * Copyright (C) 2007-2008, Advanced Micro Devices, Inc.
4 * Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
5 * Copyright (C) 2008 Hans de Goede <hdegoede@redhat.com>
6
7 * Derived from the lm83 driver by Jean Delvare
8 *

--- 33 unchanged lines hidden (view full) ---

42#define REG_VOLTAGE_BASE 0x20
43#define REG_TEMP_BASE 0x25
44#define REG_TACH_BASE 0x28
45#define REG_PWM_BASE 0x30
46#define REG_PWM_MAX_BASE 0x38
47
48#define REG_DEVID 0x3D
49#define REG_VENDID 0x3E
50#define REG_DEVID2 0x3F
50
51#define REG_STATUS1 0x41
52#define REG_STATUS2 0x42
53
54#define REG_VOLTAGE_MIN_BASE 0x44
55#define REG_VOLTAGE_MAX_BASE 0x45
56
57#define REG_TEMP_MIN_BASE 0x4E

--- 951 unchanged lines hidden (view full) ---

1009};
1010
1011static struct attribute_group adt7475_attr_group = { .attrs = adt7475_attrs };
1012
1013static int adt7475_detect(struct i2c_client *client, int kind,
1014 struct i2c_board_info *info)
1015{
1016 struct i2c_adapter *adapter = client->adapter;
51
52#define REG_STATUS1 0x41
53#define REG_STATUS2 0x42
54
55#define REG_VOLTAGE_MIN_BASE 0x44
56#define REG_VOLTAGE_MAX_BASE 0x45
57
58#define REG_TEMP_MIN_BASE 0x4E

--- 951 unchanged lines hidden (view full) ---

1010};
1011
1012static struct attribute_group adt7475_attr_group = { .attrs = adt7475_attrs };
1013
1014static int adt7475_detect(struct i2c_client *client, int kind,
1015 struct i2c_board_info *info)
1016{
1017 struct i2c_adapter *adapter = client->adapter;
1017 int vendid, devid;
1018 int vendid, devid, devid2;
1018 const char *name;
1019
1020 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1021 return -ENODEV;
1022
1023 vendid = adt7475_read(REG_VENDID);
1019 const char *name;
1020
1021 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1022 return -ENODEV;
1023
1024 vendid = adt7475_read(REG_VENDID);
1024 devid = adt7475_read(REG_DEVID);
1025 devid2 = adt7475_read(REG_DEVID2);
1026 if (vendid != 0x41 || /* Analog Devices */
1027 (devid2 & 0xf8) != 0x68)
1028 return -ENODEV;
1025
1029
1026 if (vendid == 0x41 && devid == 0x73)
1030 devid = adt7475_read(REG_DEVID);
1031 if (devid == 0x73)
1027 name = "adt7473";
1032 name = "adt7473";
1028 else if (vendid == 0x41 && devid == 0x75 && client->addr == 0x2e)
1033 else if (devid == 0x75 && client->addr == 0x2e)
1029 name = "adt7475";
1030 else {
1031 dev_dbg(&adapter->dev,
1032 "Couldn't detect an ADT7473 or ADT7475 part at "
1033 "0x%02x\n", (unsigned int)client->addr);
1034 return -ENODEV;
1035 }
1036

--- 246 unchanged lines hidden ---
1034 name = "adt7475";
1035 else {
1036 dev_dbg(&adapter->dev,
1037 "Couldn't detect an ADT7473 or ADT7475 part at "
1038 "0x%02x\n", (unsigned int)client->addr);
1039 return -ENODEV;
1040 }
1041

--- 246 unchanged lines hidden ---