Changeset 4453
- Timestamp:
- 06/17/07 18:50:57 (1 year ago)
- Files:
-
- lm-sensors/trunk/CHANGES (modified) (2 diffs)
- lm-sensors/trunk/kernel/chips/w83627ehf.c (modified) (7 diffs)
- lm-sensors/trunk/lib/chips.c (modified) (1 diff)
- lm-sensors/trunk/lib/chips.h (modified) (1 diff)
- lm-sensors/trunk/prog/sensors/chips.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/trunk/CHANGES
r4449 r4453 10 10 Add applesmc support 11 11 Add w83627ehf support (for Linux 2.4) 12 Add support for the w83627ehf VID function 12 13 Man page sensors.conf.5: Update the chip statement section 13 14 Module i2c-nforce2: Add nForce MCP61, MCP65 support (2.6 backport) … … 35 36 Fix alignment of alarm for one-limit temperatures 36 37 Add w83627ehf support (for Linux 2.4) 38 Add support for the w83627ehf VID function 37 39 Program sensors-detect: Stop Super-I/O probe after first family success 38 40 Fix SMSC DME1737 detection lm-sensors/trunk/kernel/chips/w83627ehf.c
r4452 r4453 40 40 #include <asm/io.h> 41 41 #include "version.h" 42 #include "sensors_vid.h" 42 43 #include "lm75.h" 43 44 … … 62 63 #define SIO_REG_LDSEL 0x07 /* Logical device select */ 63 64 #define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */ 65 #define SIO_REG_EN_VRM10 0x2C /* GPIO3, GPIO4 selection */ 64 66 #define SIO_REG_ENABLE 0x30 /* Logical device enable */ 65 67 #define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */ 68 #define SIO_REG_VID_CTRL 0xF0 /* VID control */ 69 #define SIO_REG_VID_DATA 0xF1 /* VID data */ 66 70 67 71 #define SIO_W83627EHF_ID 0x8850 … … 213 217 u8 pwm_enable[4]; /* 1 for manual, 2+ for auto */ 214 218 u8 pwm[4]; 219 220 u8 vid; 221 u8 vrm; 215 222 }; 216 223 … … 236 243 #define W83627EHF_SYSCTL_TEMP2 1202 237 244 #define W83627EHF_SYSCTL_TEMP3 1203 245 #define W83627EHF_SYSCTL_VID 1300 /* Volts * 1000 */ 246 #define W83627EHF_SYSCTL_VRM 1301 238 247 #define W83627EHF_SYSCTL_PWM1 1401 239 248 #define W83627EHF_SYSCTL_PWM2 1402 … … 738 747 } 739 748 749 static void w83627ehf_vid(struct i2c_client *client, int operation, 750 int ctl_name, int *nrels_mag, long *results) 751 { 752 struct w83627ehf_data *data = client->data; 753 754 if (operation == SENSORS_PROC_REAL_INFO) 755 *nrels_mag = 3; 756 else if (operation == SENSORS_PROC_REAL_READ) { 757 results[0] = vid_from_reg(data->vid, data->vrm); 758 *nrels_mag = 1; 759 } 760 } 761 762 /* Change the VID input level, and read VID value again 763 This function assumes that the caller holds data->update_lock */ 764 static void w83627ehf_en_vrm10(struct w83627ehf_data *data, int enable) 765 { 766 u8 reg; 767 768 superio_enter(); 769 reg = superio_inb(SIO_REG_EN_VRM10) & ~0x08; 770 if (enable) 771 reg |= 0x08; 772 superio_outb(SIO_REG_EN_VRM10, reg); 773 774 superio_select(W83627EHF_LD_HWM); 775 if (superio_inb(SIO_REG_VID_CTRL) & 0x80) /* VID input mode */ 776 data->vid = superio_inb(SIO_REG_VID_DATA) & 0x3f; 777 superio_exit(); 778 } 779 780 static void w83627ehf_vrm(struct i2c_client *client, int operation, 781 int ctl_name, int *nrels_mag, long *results) 782 { 783 struct w83627ehf_data *data = client->data; 784 785 if (operation == SENSORS_PROC_REAL_INFO) 786 *nrels_mag = 1; 787 else if (operation == SENSORS_PROC_REAL_READ) { 788 results[0] = data->vrm; 789 *nrels_mag = 1; 790 } else if (operation == SENSORS_PROC_REAL_WRITE) { 791 if (*nrels_mag >= 1) { 792 down(&data->update_lock); 793 /* We may have to change the VID input level */ 794 if (data->vrm/10 != 10 && results[0]/10 == 10) 795 w83627ehf_en_vrm10(data, 1); 796 else if (data->vrm/10 == 10 && results[0]/10 != 10) 797 w83627ehf_en_vrm10(data, 0); 798 data->vrm = results[0]; 799 up(&data->update_lock); 800 } 801 } 802 } 803 740 804 static ctl_table w83627ehf_dir_table_template[] = { 741 805 {W83627EHF_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, … … 792 856 {W83627EHF_SYSCTL_PWM4, "pwm4", NULL, 0, 0644, NULL, &i2c_proc_real, 793 857 &i2c_sysctl_real, NULL, &w83627ehf_pwm}, 858 859 {W83627EHF_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, 860 &i2c_sysctl_real, NULL, &w83627ehf_vid}, 861 {W83627EHF_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, 862 &i2c_sysctl_real, NULL, &w83627ehf_vrm}, 794 863 {0} 795 864 }; … … 870 939 W83627EHF_REG_FAN_MIN[i]); 871 940 941 /* Read VID value */ 942 superio_enter(); 943 superio_select(W83627EHF_LD_HWM); 944 if (superio_inb(SIO_REG_VID_CTRL) & 0x80) /* VID input mode */ 945 data->vid = superio_inb(SIO_REG_VID_DATA) & 0x3f; 946 else { 947 printk(KERN_NOTICE "w83627ehf: VID pins in output mode, CPU " 948 "VID not available\n"); 949 data->vid = 0x3f; 950 } 951 952 /* Wild guess, might not be correct */ 953 if (superio_inb(SIO_REG_EN_VRM10) & 0x08) 954 data->vrm = 100; 955 else 956 data->vrm = 91; 957 872 958 /* fan4 and fan5 share some pins with the GPIO and serial flash */ 873 superio_enter();874 959 fan5pin = superio_inb(0x24) & 0x2; 875 960 fan4pin = superio_inb(0x29) & 0x6; lm-sensors/trunk/lib/chips.c
r4449 r4453 2148 2148 SENSORS_W83627EHF_TEMP3, RW }, 2149 2149 W83627EHF_SYSCTL_TEMP3, VALUE(2), 1 }, 2150 { { SENSORS_W83627EHF_VID, "vid", NOMAP, NOMAP, R }, 2151 W83627EHF_SYSCTL_VID, VALUE(1), 3 }, 2152 { { SENSORS_W83627EHF_VRM, "vrm", NOMAP, NOMAP, RW }, 2153 W83627EHF_SYSCTL_VRM, VALUE(1), 1 }, 2150 2154 { { SENSORS_W83627EHF_ALARMS, "alarms", NOMAP, NOMAP, R }, 2151 2155 W83627EHF_SYSCTL_ALARMS, VALUE(1), 0 }, lm-sensors/trunk/lib/chips.h
r4449 r4453 972 972 #define SENSORS_W83627EHF_TEMP2_HYST 82 /* RW */ 973 973 #define SENSORS_W83627EHF_TEMP3_HYST 83 /* RW */ 974 #define SENSORS_W83627EHF_VID 245 /* R */ 975 #define SENSORS_W83627EHF_VRM 249 /* R */ 974 976 #define SENSORS_W83627EHF_ALARMS 250 /* R */ 975 977 lm-sensors/trunk/prog/sensors/chips.c
r4449 r4453 3009 3009 free(label); 3010 3010 } 3011 3012 print_vid_info(name, SENSORS_W83627EHF_VID, SENSORS_W83627EHF_VRM); 3011 3013 } 3012 3014
