Changeset 2202
- Timestamp:
- 01/05/04 04:50:26 (9 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 2 modified
-
kernel/chips/asb100.c (modified) (10 diffs)
-
lib/chips.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/kernel/chips/asb100.c
r2135 r2202 101 101 #define ASB100_REG_PIN 0x4b 102 102 #define ASB100_REG_IRQ 0x4c 103 #define ASB100_REG_BEEP_CONFIG 0x4d104 103 #define ASB100_REG_BANK 0x4e 105 104 #define ASB100_REG_CHIPMAN 0x4f 106 105 107 #define ASB100_REG_BEEP_INTS1 0x56108 #define ASB100_REG_BEEP_INTS2 0x57109 106 #define ASB100_REG_WCHIPID 0x58 110 107 111 108 /* bit 7 -> enable, bits 0-3 -> duty cycle */ 112 109 #define ASB100_REG_PWM1 0x59 113 114 /* <TODO> Does this exist on ASB100? */115 /* The following are undocumented in the data sheets however we116 received the information in an email from Winbond tech support */117 /* Sensor selection - not on 781d */118 #define ASB100_REG_SCFG1 0x5D119 static const u8 BIT_SCFG1[] = { 0x02, 0x04, 0x08 };120 #define ASB100_REG_SCFG2 0x59121 static const u8 BIT_SCFG2[] = { 0x10, 0x20, 0x40 };122 #define W83781D_DEFAULT_BETA 3435123 /* </TODO> */124 110 125 111 /* CONVERSIONS … … 188 174 189 175 #define ALARMS_FROM_REG(val) (val) 190 #define BEEPS_FROM_REG(val) (val)191 #define BEEPS_TO_REG(val) ((val) & 0xffffff)192 193 #define BEEP_ENABLE_TO_REG(val) ((val)?1:0)194 #define BEEP_ENABLE_FROM_REG(val) ((val)?1:0)195 176 196 177 #define DIV_FROM_REG(val) (1 << (val)) 197 178 198 /* <TODO> Support for larger fan divisors? */199 179 /* FAN DIV: 1, 2, 4, or 8 (defaults to 2) 200 180 REG: 0, 1, 2, or 3 (respectively) (defaults to 1) */ … … 203 183 return val==8 ? 3 : val==4 ? 2 : val==1 ? 0 : 1; 204 184 } 205 /* </TODO> */206 185 207 186 /* For each registered client, we need to keep some data in memory. That … … 232 211 u8 vid; /* Register encoding, combined */ 233 212 u32 alarms; /* Register encoding, combined */ 234 u32 beeps; /* Register encoding, combined */235 u8 beep_enable; /* bitmask */236 213 u8 vrm; 237 214 }; … … 261 238 static void asb100_alarms(struct i2c_client *client, int operation, 262 239 int ctl_name, int *nrels_mag, long *results); 263 static void asb100_beep(struct i2c_client *client, int operation,264 int ctl_name, int *nrels_mag, long *results);265 240 static void asb100_fan_div(struct i2c_client *client, int operation, 266 241 int ctl_name, int *nrels_mag, long *results); … … 304 279 #define ASB100_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ 305 280 #define ASB100_SYSCTL_ALARMS 2001 /* bitvector */ 306 #define ASB100_SYSCTL_BEEP 2002 /* bitvector */307 281 308 282 #define ASB100_ALARM_IN0 0x0001 /* ? */ … … 366 340 {ASB100_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, 367 341 &i2c_sysctl_real, NULL, &asb100_alarms}, 368 {ASB100_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real,369 &i2c_sysctl_real, NULL, &asb100_beep},370 342 {ASB100_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, 371 343 &i2c_sysctl_real, NULL, &asb100_pwm}, … … 530 502 goto ERROR1; 531 503 } 532 533 /* <TODO> this test always fails on first load attempt534 but it always works after that??? */535 #if 0536 /* On Winbond chips, 0x48 is the I2C address.537 On ASB100, it's always zero */538 val1 = asb100_read_value(new_client, ASB100_REG_I2C_ADDR);539 if (val1) {540 pr_debug("asb100.o: detect failed, nonzero value "541 "at register 0x48: (0x%02x)\n", val1);542 err = -ENODEV;543 goto ERROR1;544 }545 #endif546 /* </TODO> */547 504 548 505 } /* kind < 0 */ … … 797 754 data->alarms = asb100_read_value(client, ASB100_REG_ALARM1) + 798 755 (asb100_read_value(client, ASB100_REG_ALARM2) << 8); 799 800 /* beep */801 i = asb100_read_value(client, ASB100_REG_BEEP_INTS2);802 data->beep_enable = i >> 7;803 data->beeps = ((i & 0x7f) << 8) +804 asb100_read_value(client, ASB100_REG_BEEP_INTS1);805 756 806 757 data->last_updated = jiffies; … … 983 934 results[0] = ALARMS_FROM_REG(data->alarms); 984 935 *nrels_mag = 1; 985 }986 }987 988 void asb100_beep(struct i2c_client *client, int operation, int ctl_name,989 int *nrels_mag, long *results)990 {991 struct asb100_data *data = client->data;992 int val;993 994 if (operation == SENSORS_PROC_REAL_INFO)995 *nrels_mag = 0;996 else if (operation == SENSORS_PROC_REAL_READ) {997 asb100_update_client(client);998 results[0] = BEEP_ENABLE_FROM_REG(data->beep_enable);999 results[1] = BEEPS_FROM_REG(data->beeps);1000 *nrels_mag = 2;1001 } else if (operation == SENSORS_PROC_REAL_WRITE) {1002 if (*nrels_mag >= 2) {1003 data->beeps = BEEPS_TO_REG(results[1]);1004 asb100_write_value(client, ASB100_REG_BEEP_INTS1,1005 data->beeps & 0xff);1006 val = (data->beeps >> 8) & 0x7f;1007 } else if (*nrels_mag >= 1)1008 val =1009 asb100_read_value(client,1010 ASB100_REG_BEEP_INTS2) &1011 0x7f;1012 if (*nrels_mag >= 1) {1013 data->beep_enable = BEEP_ENABLE_TO_REG(results[0]);1014 asb100_write_value(client, ASB100_REG_BEEP_INTS2,1015 val | data->beep_enable << 7);1016 }1017 936 } 1018 937 } -
lm-sensors/trunk/lib/chips.c
r2197 r2202 1070 1070 NOMAP, R, 1071 1071 ASB100_SYSCTL_ALARMS, VALUE(1), 0 }, 1072 { SENSORS_ASB100_BEEP_ENABLE, "beep_enable", SENSORS_ASB100_ALARMS,1073 NOMAP, RW,1074 ASB100_SYSCTL_BEEP, VALUE(1), 0 },1075 { SENSORS_ASB100_BEEPS, "beeps", SENSORS_ASB100_ALARMS,1076 SENSORS_ASB100_ALARMS, RW,1077 ASB100_SYSCTL_BEEP, VALUE(2), 0 },1078 1072 { 0 } 1079 1073 };
