1 #include <console/console.h>
2 #include <device/device.h>
3 #include <device/smbus.h>
4 #include <device/pci.h>
5 #include <device/pci_ids.h>
6 #include <device/pci_ops.h>
7 #include <cpu/x86/msr.h>
10 #define ADM1026_DEVICE 0x2d /* Either 0x2c or 0x2d or 0x2e */
11 #define ADM1026_REG_CONFIG1 0x00
12 #define CFG1_MONITOR 0x01
13 #define CFG1_INT_ENABLE 0x02
14 #define CFG1_INT_CLEAR 0x04
15 #define CFG1_AIN8_9 0x08
16 #define CFG1_THERM_HOT 0x10
17 #define CFT1_DAC_AFC 0x20
18 #define CFG1_PWM_AFC 0x40
19 #define CFG1_RESET 0x80
20 #define ADM1026_REG_CONFIG2 0x01
21 #define ADM1026_REG_CONFIG3 0x07
23 static void adm1026_enable_monitoring(device_t dev);
25 static void adm1026_init(device_t dev)
27 if (dev->enabled && dev->path.type == DEVICE_PATH_I2C)
29 if(ops_smbus_bus(get_pbus_smbus(dev))) {
30 if( dev->bus->dev->path.type == DEVICE_PATH_I2C) smbus_set_link(dev); // it is under mux
31 adm1026_enable_monitoring(dev);
37 static void adm1026_enable_monitoring(device_t dev)
40 result = smbus_read_byte(dev, ADM1026_REG_CONFIG1);
42 result = (result | CFG1_MONITOR) & ~(CFG1_INT_CLEAR | CFG1_RESET);
43 result = smbus_write_byte(dev, ADM1026_REG_CONFIG1, result);
45 result = smbus_read_byte(dev, ADM1026_REG_CONFIG1);
46 if (!(result & CFG1_MONITOR)) {
47 printk(BIOS_DEBUG, "ADM1026: monitoring would not enable");
50 static void adm1026_noop(device_t dummy)
54 static struct device_operations adm1026_operations = {
55 .read_resources = adm1026_noop,
56 .set_resources = adm1026_noop,
57 .enable_resources = adm1026_noop,
61 static void enable_dev(struct device *dev)
63 dev->ops = &adm1026_operations;
66 struct chip_operations drivers_i2c_adm1026_ops = {
68 .enable_dev = enable_dev,