Changeset 87

Show
Ignore:
Timestamp:
12/18/98 04:15:07 (14 years ago)
Author:
phil
Message:

(Phil) Added access to 'beep' buzzer control registers via 'beep' file.

Location:
lm-sensors/trunk
Files:
4 modified

Legend:

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

    r86 r87  
    6565#define W83781D_REG_ALARM1 0x41 
    6666#define W83781D_REG_ALARM2 0x42 
     67 
     68#define W83781D_REG_BEEP_CONFIG 0x4D 
     69#define W83781D_REG_BEEP_INTS1 0x56 
     70#define W83781D_REG_BEEP_INTS2 0x57 
    6771 
    6872#define W83781D_REG_VID_FANDIV 0x47 
     
    182186         u8 vid;                     /* Register encoding, combined */ 
    183187         u16 alarms;                 /* Register encoding, combined */ 
     188         u8 beep[3];                    /* Register value of config and interrupt masks */ 
    184189}; 
    185190 
     
    224229static void w83781d_alarms(struct i2c_client *client, int operation, int ctl_name, 
    225230                        int *nrels_mag, long *results); 
     231static void w83781d_beep(struct i2c_client *client, int operation, int ctl_name, 
     232                      int *nrels_mag, long *results); 
    226233static void w83781d_fan_div(struct i2c_client *client, int operation, int ctl_name, 
    227234                         int *nrels_mag, long *results); 
     
    288295  { W83781D_SYSCTL_ALARMS, "alarms", NULL, 0, 0644, NULL, &sensors_proc_real, 
    289296    &sensors_sysctl_real, NULL, &w83781d_alarms }, 
     297  { W83781D_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &sensors_proc_real, 
     298    &sensors_sysctl_real, NULL, &w83781d_beep }, 
    290299  { 0 } 
    291300}; 
     
    725734    data->alarms = w83781d_read_value(client,W83781D_REG_ALARM1) + 
    726735                   (w83781d_read_value(client,W83781D_REG_ALARM2) >> 8); 
     736    data->beep[0] = w83781d_read_value(client,W83781D_REG_BEEP_CONFIG); 
     737    data->beep[1] = w83781d_read_value(client,W83781D_REG_BEEP_INTS1); 
     738    data->beep[2] = w83781d_read_value(client,W83781D_REG_BEEP_INTS2); 
    727739    data->last_updated = jiffies; 
    728740    data->valid = 1; 
     
    846858} 
    847859 
    848 /* Change back! */ 
    849860 
    850861void w83781d_temp1(struct i2c_client *client, int operation, int ctl_name, 
     
    892903    results[0] = ALARMS_FROM_REG(data->alarms); 
    893904    *nrels_mag = 1; 
     905  } 
     906} 
     907 
     908void w83781d_beep(struct i2c_client *client, int operation, int ctl_name, 
     909                 int *nrels_mag, long *results) 
     910{ 
     911  struct w83781d_data *data = client->data; 
     912  if (operation == SENSORS_PROC_REAL_INFO) 
     913    *nrels_mag = 0; 
     914  else if (operation == SENSORS_PROC_REAL_READ) { 
     915    w83781d_update_client(client); 
     916    results[0] = data->beep[0]; 
     917    results[1] = data->beep[1]; 
     918    results[2] = data->beep[2]; 
     919    *nrels_mag = 3; 
     920  } else if (operation == SENSORS_PROC_REAL_WRITE) { 
     921    data->beep[0] = results[0]; 
     922    w83781d_write_value(client,W83781D_REG_BEEP_CONFIG,data->beep[0]); 
     923    data->beep[1] = results[1]; 
     924    w83781d_write_value(client,W83781D_REG_BEEP_INTS1,data->beep[1]); 
     925    data->beep[2] = results[2]; 
     926    w83781d_write_value(client,W83781D_REG_BEEP_INTS2,data->beep[2]); 
    894927  } 
    895928} 
  • lm-sensors/trunk/kernel/include/sensors.h

    r85 r87  
    149149#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ 
    150150#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */ 
     151#define W83781D_SYSCTL_BEEP 2002 /* bitvector */ 
    151152 
    152153#define W83781D_ALARM_IN0 0x0001 
  • lm-sensors/trunk/src/sensors.h

    r85 r87  
    149149#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ 
    150150#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */ 
     151#define W83781D_SYSCTL_BEEP 2002 /* bitvector */ 
    151152 
    152153#define W83781D_ALARM_IN0 0x0001 
  • lm-sensors/trunk/src/w83781d.c

    r86 r87  
    6565#define W83781D_REG_ALARM1 0x41 
    6666#define W83781D_REG_ALARM2 0x42 
     67 
     68#define W83781D_REG_BEEP_CONFIG 0x4D 
     69#define W83781D_REG_BEEP_INTS1 0x56 
     70#define W83781D_REG_BEEP_INTS2 0x57 
    6771 
    6872#define W83781D_REG_VID_FANDIV 0x47 
     
    182186         u8 vid;                     /* Register encoding, combined */ 
    183187         u16 alarms;                 /* Register encoding, combined */ 
     188         u8 beep[3];                    /* Register value of config and interrupt masks */ 
    184189}; 
    185190 
     
    224229static void w83781d_alarms(struct i2c_client *client, int operation, int ctl_name, 
    225230                        int *nrels_mag, long *results); 
     231static void w83781d_beep(struct i2c_client *client, int operation, int ctl_name, 
     232                      int *nrels_mag, long *results); 
    226233static void w83781d_fan_div(struct i2c_client *client, int operation, int ctl_name, 
    227234                         int *nrels_mag, long *results); 
     
    288295  { W83781D_SYSCTL_ALARMS, "alarms", NULL, 0, 0644, NULL, &sensors_proc_real, 
    289296    &sensors_sysctl_real, NULL, &w83781d_alarms }, 
     297  { W83781D_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &sensors_proc_real, 
     298    &sensors_sysctl_real, NULL, &w83781d_beep }, 
    290299  { 0 } 
    291300}; 
     
    725734    data->alarms = w83781d_read_value(client,W83781D_REG_ALARM1) + 
    726735                   (w83781d_read_value(client,W83781D_REG_ALARM2) >> 8); 
     736    data->beep[0] = w83781d_read_value(client,W83781D_REG_BEEP_CONFIG); 
     737    data->beep[1] = w83781d_read_value(client,W83781D_REG_BEEP_INTS1); 
     738    data->beep[2] = w83781d_read_value(client,W83781D_REG_BEEP_INTS2); 
    727739    data->last_updated = jiffies; 
    728740    data->valid = 1; 
     
    846858} 
    847859 
    848 /* Change back! */ 
    849860 
    850861void w83781d_temp1(struct i2c_client *client, int operation, int ctl_name, 
     
    892903    results[0] = ALARMS_FROM_REG(data->alarms); 
    893904    *nrels_mag = 1; 
     905  } 
     906} 
     907 
     908void w83781d_beep(struct i2c_client *client, int operation, int ctl_name, 
     909                 int *nrels_mag, long *results) 
     910{ 
     911  struct w83781d_data *data = client->data; 
     912  if (operation == SENSORS_PROC_REAL_INFO) 
     913    *nrels_mag = 0; 
     914  else if (operation == SENSORS_PROC_REAL_READ) { 
     915    w83781d_update_client(client); 
     916    results[0] = data->beep[0]; 
     917    results[1] = data->beep[1]; 
     918    results[2] = data->beep[2]; 
     919    *nrels_mag = 3; 
     920  } else if (operation == SENSORS_PROC_REAL_WRITE) { 
     921    data->beep[0] = results[0]; 
     922    w83781d_write_value(client,W83781D_REG_BEEP_CONFIG,data->beep[0]); 
     923    data->beep[1] = results[1]; 
     924    w83781d_write_value(client,W83781D_REG_BEEP_INTS1,data->beep[1]); 
     925    data->beep[2] = results[2]; 
     926    w83781d_write_value(client,W83781D_REG_BEEP_INTS2,data->beep[2]); 
    894927  } 
    895928}