Changeset 2202

Show
Ignore:
Timestamp:
01/05/04 04:50:26 (9 years ago)
Author:
mmh
Message:

Updates for ASB100: remove "beeps" and other cleanups.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/kernel/chips/asb100.c

    r2135 r2202  
    101101#define ASB100_REG_PIN          0x4b 
    102102#define ASB100_REG_IRQ          0x4c 
    103 #define ASB100_REG_BEEP_CONFIG  0x4d 
    104103#define ASB100_REG_BANK         0x4e 
    105104#define ASB100_REG_CHIPMAN      0x4f 
    106105 
    107 #define ASB100_REG_BEEP_INTS1   0x56 
    108 #define ASB100_REG_BEEP_INTS2   0x57 
    109106#define ASB100_REG_WCHIPID      0x58 
    110107 
    111108/* bit 7 -> enable, bits 0-3 -> duty cycle */ 
    112109#define ASB100_REG_PWM1         0x59 
    113  
    114 /* <TODO> Does this exist on ASB100? */ 
    115 /* The following are undocumented in the data sheets however we 
    116    received the information in an email from Winbond tech support */ 
    117 /* Sensor selection - not on 781d */ 
    118 #define ASB100_REG_SCFG1 0x5D 
    119 static const u8 BIT_SCFG1[] = { 0x02, 0x04, 0x08 }; 
    120 #define ASB100_REG_SCFG2 0x59 
    121 static const u8 BIT_SCFG2[] = { 0x10, 0x20, 0x40 }; 
    122 #define W83781D_DEFAULT_BETA 3435 
    123 /* </TODO> */ 
    124110 
    125111/* CONVERSIONS 
     
    188174 
    189175#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) 
    195176 
    196177#define DIV_FROM_REG(val) (1 << (val)) 
    197178 
    198 /* <TODO> Support for larger fan divisors? */ 
    199179/* FAN DIV: 1, 2, 4, or 8 (defaults to 2) 
    200180   REG: 0, 1, 2, or 3 (respectively) (defaults to 1) */ 
     
    203183        return val==8 ? 3 : val==4 ? 2 : val==1 ? 0 : 1; 
    204184} 
    205 /* </TODO> */ 
    206185 
    207186/* For each registered client, we need to keep some data in memory. That 
     
    232211        u8 vid;                 /* Register encoding, combined */ 
    233212        u32 alarms;             /* Register encoding, combined */ 
    234         u32 beeps;              /* Register encoding, combined */ 
    235         u8 beep_enable;         /* bitmask */ 
    236213        u8 vrm; 
    237214}; 
     
    261238static void asb100_alarms(struct i2c_client *client, int operation, 
    262239                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); 
    265240static void asb100_fan_div(struct i2c_client *client, int operation, 
    266241                int ctl_name, int *nrels_mag, long *results); 
     
    304279#define ASB100_SYSCTL_FAN_DIV   2000    /* 1, 2, 4 or 8 */ 
    305280#define ASB100_SYSCTL_ALARMS    2001    /* bitvector */ 
    306 #define ASB100_SYSCTL_BEEP      2002    /* bitvector */ 
    307281 
    308282#define ASB100_ALARM_IN0        0x0001  /* ? */ 
     
    366340        {ASB100_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, 
    367341         &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}, 
    370342        {ASB100_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, 
    371343         &i2c_sysctl_real, NULL, &asb100_pwm}, 
     
    530502                        goto ERROR1; 
    531503                } 
    532  
    533 /* <TODO> this test always fails on first load attempt 
    534    but it always works after that???  */ 
    535 #if 0 
    536                 /* 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 #endif 
    546 /* </TODO> */ 
    547504 
    548505        } /* kind < 0 */ 
     
    797754                data->alarms = asb100_read_value(client, ASB100_REG_ALARM1) + 
    798755                        (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); 
    805756 
    806757                data->last_updated = jiffies; 
     
    983934                results[0] = ALARMS_FROM_REG(data->alarms); 
    984935                *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                 } 
    1017936        } 
    1018937} 
  • lm-sensors/trunk/lib/chips.c

    r2197 r2202  
    10701070                NOMAP, R, 
    10711071                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 }, 
    10781072        { 0 } 
    10791073};