Changeset 1243

Show
Ignore:
Timestamp:
11/19/01 21:29:27 (7 years ago)
Author:
mds
Message:

new pcf8591 driver, patch from

Aurelien Jarno <aurelien.jarno@insa-lyon.fr>

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/CHANGES

    r1241 r1243  
    1717 
    1818----------------------------------------------------------------------------- 
     19 
     202.6.3 (2001????) 
     21  Library: Add PCF8591 support 
     22  Module pcf8591: new 
     23  Program sensors: Add PCF8591 support 
     24  Program sensors-detect: Add several Nvidia chips, add PCF8591 
     25 
    1926 
    20272.6.2 (20011118) 
  • lm-sensors/trunk/CONTRIBUTORS

    r1179 r1243  
    6565* Hermann Jung <hej@odn.de> 
    6666  Author of the fscpos driver. 
     67* Aurelien Jarno <aurelien.jarno@laposte.net> 
     68  Author of the pcf8591 driver. 
  • lm-sensors/trunk/README

    r1197 r1243  
    1919be the first to profit from new drivers and other changes. Have fun! 
    2020 
    21 WARNING! You also need the latest i2c package, 
     21WARNING! You may also need the latest i2c package, 
    2222EVEN IF your kernel does contain i2c support!!!!!!!!!, 
    2323unless i2c came bundled with lm_sensors. 
    2424 
    2525Kernels 2.3.34 and later, and all 2.4.x kernels, contain the 
    26 I2C package; however, you will still need to download and install 
    27 the latest I2C version if you want lm_sensors to compile. 
     26I2C package. Kernel 2.4.13 contains i2c-2.6.1, which is sufficient 
     27for most users. However, if you have problems compiling, 
     28you may still need to download and install the latest I2C version. 
    2829 
    2930See the lm_sensors download page for guidance: 
     
    5354  Dallas Semiconductor DS75, DS1621, DS1625, DS1775, and DS1780 
    5455  Hewlett Packard Maxilife (several revisions including '99 NBA) 
    55   Fujitsu Siemens Poseidon Chip 
     56  Fujitsu Siemens Poseidon, Scylla 
    5657  Genesys Logic GL518SM (rev 00, 80), GL520SM, GL523SM 
    5758  Intel Xeon processor embedded sensors 
     
    7475  Intel Xeon processor embedded EEPROMs 
    7576  DDC Monitor embedded EEPROMs 
     77  Philips Semiconductors PCF8591   
     78 
     79 
     80See our New Drivers page http://www.lm-sensors.nu/~lm78/newdrivers.html 
     81for the latest information on supported devices. 
    7682 
    7783 
     
    7985chip listed on our 'new drivers' page, and are willing to help us out, 
    8086please contact us. Even if you have no programming knowledge, you could 
    81 help us by running new modules and reporting on the results and output.  
     87help us by running new modules and reporting on the results and output. 
    8288If you want to offer more substantial help, this is very welcome too, of 
    8389course. 
  • lm-sensors/trunk/doc/chips/SUMMARY

    r1218 r1243  
    162162        Simple eight-bit parallel I/O 
    163163 
     164pcf8591 
     165        Quad A/D + one D/A 
     166 
    164167 
    165168----------------------------------------------------------------------------- 
  • lm-sensors/trunk/etc/sensors.conf.eg

    r1216 r1243  
    11751175    label voltbatt    "+3.3V" 
    11761176 
     1177 
     1178chip "pcf8591-*" 
     1179# 
     1180#    values for the Philips PCF8574 chip 
     1181# 
     1182# Analog inputs 
     1183 
     1184   ignore ain_conf 
     1185   set    ain_conf    0 
     1186   label  ch0         "Chan. 0" 
     1187   label  ch1         "Chan. 1" 
     1188   label  ch2         "Chan. 2" 
     1189   label  ch3         "Chan. 3" 
     1190 
     1191# Analog output 
     1192 
     1193   ignore aout_enable 
     1194   set    aout_enable 1 
     1195   label  aout        "Output" 
     1196   set    aout        0 
     1197 
  • lm-sensors/trunk/kernel/chips/Module.mk

    r1221 r1243  
    2525# defined value verbatim into the command-list of rules... 
    2626# These targets are NOT included in 'mkpatch' ... 
    27 KERNELCHIPSTARGETS :=  
     27KERNELCHIPSTARGETS := $(MODULE_DIR)/pcf8591.o 
    2828 
    2929# These targets ARE included in 'mkpatch', except for LTC1710, which we 
  • lm-sensors/trunk/lib/chips.c

    r1230 r1243  
    24542454  }; 
    24552455 
     2456  static sensors_chip_feature pcf8591_features[] = 
     2457  { 
     2458    { SENSORS_PCF8591_AIN_CONF, "ain_conf", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 
     2459                              SENSORS_MODE_RW, PCF8591_SYSCTL_AIN_CONF, VALUE(1), 0 }, 
     2460    { SENSORS_PCF8591_CH0, "ch0", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 
     2461                         SENSORS_MODE_R, PCF8591_SYSCTL_CH0, VALUE(1), 0 }, 
     2462    { SENSORS_PCF8591_CH1, "ch1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 
     2463                         SENSORS_MODE_R, PCF8591_SYSCTL_CH1, VALUE(1), 0 }, 
     2464    { SENSORS_PCF8591_CH2, "ch2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 
     2465                         SENSORS_MODE_R, PCF8591_SYSCTL_CH2, VALUE(1), 0 }, 
     2466    { SENSORS_PCF8591_CH3, "ch3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 
     2467                         SENSORS_MODE_R, PCF8591_SYSCTL_CH3, VALUE(1), 0 }, 
     2468    { SENSORS_PCF8591_AOUT_ENABLE, "aout_enable", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 
     2469                                 SENSORS_MODE_RW, PCF8591_SYSCTL_AOUT_ENABLE, VALUE(1), 0 }, 
     2470    { SENSORS_PCF8591_AOUT, "aout", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, 
     2471                          SENSORS_MODE_RW, PCF8591_SYSCTL_AOUT, VALUE(1), 0 }, 
     2472    { 0 } 
     2473  }; 
     2474 
     2475 
    24562476sensors_chip_features sensors_chip_features_list[] = 
    24572477{ 
     
    25032523 { SENSORS_FSCPOS_PREFIX, fscpos_features }, 
    25042524 { SENSORS_FSCSCY_PREFIX, fscscy_features }, 
     2525 { SENSORS_PCF8591_PREFIX, pcf8591_features },  
    25052526 { 0 } 
    25062527}; 
  • lm-sensors/trunk/lib/chips.h

    r1234 r1243  
    11141114#define SENSORS_FSCSCY_WDOG_CONTROL 52 /* RW */ 
    11151115 
     1116/* PCF8591 chip. */ 
     1117 
     1118#define SENSORS_PCF8591_PREFIX "pcf8591" 
     1119 
     1120#define SENSORS_PCF8591_AIN_CONF 1 /* RW */ 
     1121#define SENSORS_PCF8591_CH0 2 /* R */ 
     1122#define SENSORS_PCF8591_CH1 3 /* R */ 
     1123#define SENSORS_PCF8591_CH2 4 /* R */ 
     1124#define SENSORS_PCF8591_CH3 5 /* R */ 
     1125#define SENSORS_PCF8591_AOUT_ENABLE 6 /* RW */ 
     1126#define SENSORS_PCF8591_AOUT 7 /* RW */ 
    11161127 
    11171128 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r1242 r1243  
    519519            via686a_isa_detect adm1022_detect ltc1710_detect gl525sm_detect 
    520520            lm87_detect ite_detect ite_isa_detect ite_alias_detect 
    521             ddcmonitor_detect ds1621_detect adm1024_detect fscpos_detect fscscy_detect); 
     521            ddcmonitor_detect ds1621_detect adm1024_detect fscpos_detect fscscy_detect 
     522            pcf8591_detect); 
    522523 
    523524# This is a list of all recognized chips.  
     
    806807       i2c_addrs => [0x73], 
    807808       i2c_detect => sub { fscscy_detect @_ }, 
     809     }, 
     810     { 
     811       name => "Philips Semiconductors PCF8591", 
     812       driver => "pcf8591", 
     813       i2c_addrs => [0x48..0x4f], 
     814       i2c_detect => sub { pcf8591_detect @_}, 
    808815     }, 
    809816); 
     
    23292336} 
    23302337 
     2338# $_[0]: A reference to the file descriptor to access this chip. 
     2339#        We may assume an i2c_set_slave_addr was already done. 
     2340# $_[1]: Address 
     2341# Returns: undef if not detected, (1) if detected. 
     2342# Detection is impossible! 
     2343sub pcf8591_detect 
     2344{ 
     2345  return (1); 
     2346} 
     2347 
     2348 
    23312349################ 
    23322350# MAIN PROGRAM # 
  • lm-sensors/trunk/prog/sensors/chips.c

    r1229 r1243  
    29282928} 
    29292929 
     2930void print_pcf8591(const sensors_chip_name *name) 
     2931{ 
     2932  char *label; 
     2933  double ain_conf, ch0, ch1, ch2, ch3; 
     2934  double aout_enable, aout; 
     2935  int valid; 
     2936 
     2937  if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_AIN_CONF,&label,&valid) && 
     2938      !sensors_get_feature(*name,SENSORS_PCF8591_AIN_CONF,&ain_conf)) { 
     2939        if (valid) { 
     2940          print_label(label,10); 
     2941          switch ((int)ain_conf) 
     2942          { 
     2943            case 0: printf("four single ended inputs\n"); 
     2944                    break; 
     2945            case 1: printf("three differential inputs\n"); 
     2946                    break; 
     2947            case 2: printf("single ended and differential mixed\n"); 
     2948                    break; 
     2949            case 3: printf("two differential inputs\n"); 
     2950                    break; 
     2951          } 
     2952        } 
     2953      } 
     2954  else printf("ERROR: Can't read analog inputs configuration!\n"); 
     2955  free_the_label(&label); 
     2956 
     2957  if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH0,&label,&valid) && 
     2958      !sensors_get_feature(*name,SENSORS_PCF8591_CH0,&ch0)) { 
     2959        if (valid) { 
     2960          print_label(label,10); 
     2961          printf("%0.0f\n", ch0); 
     2962        } 
     2963      } 
     2964  else printf("ERROR: Can't read ch0!\n"); 
     2965  free_the_label(&label); 
     2966 
     2967  if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH1,&label,&valid) && 
     2968      !sensors_get_feature(*name,SENSORS_PCF8591_CH1,&ch1)) { 
     2969        if (valid) { 
     2970          print_label(label,10); 
     2971          printf("%0.0f\n", ch1); 
     2972        } 
     2973      } 
     2974  else printf("ERROR: Can't read ch1!\n"); 
     2975  free_the_label(&label); 
     2976 
     2977  if (ain_conf != 3) { 
     2978    if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH2,&label,&valid) && 
     2979        !sensors_get_feature(*name,SENSORS_PCF8591_CH2,&ch2)) { 
     2980          if (valid) { 
     2981            print_label(label,10); 
     2982            printf("%0.0f\n", ch2); 
     2983          } 
     2984        } 
     2985    else printf("ERROR: Can't read ch2!\n"); 
     2986    free_the_label(&label); 
     2987  } 
     2988 
     2989  if (ain_conf == 0) { 
     2990    if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH3,&label,&valid) && 
     2991        !sensors_get_feature(*name,SENSORS_PCF8591_CH3,&ch3)) { 
     2992          if (valid) { 
     2993            print_label(label,10); 
     2994            printf("%0.0f\n", ch3); 
     2995          } 
     2996        } 
     2997    else printf("ERROR: Can't read ch3!\n"); 
     2998    free_the_label(&label); 
     2999  } 
     3000 
     3001  if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_AOUT,&label,&valid) && 
     3002      !sensors_get_feature(*name,SENSORS_PCF8591_AOUT,&aout) && 
     3003      !sensors_get_feature(*name,SENSORS_PCF8591_AOUT_ENABLE,&aout_enable)) { 
     3004        if (valid) { 
     3005          print_label(label,10); 
     3006          printf("%0.0f (%s)\n", aout, aout_enable?"enabled":"disabled"); 
     3007        } 
     3008      } 
     3009  else printf("ERROR: Can't read aout!\n"); 
     3010  free_the_label(&label); 
     3011 
     3012} 
     3013 
     3014 
    29303015void print_unknown_chip(const sensors_chip_name *name) 
    29313016{ 
  • lm-sensors/trunk/prog/sensors/chips.h

    r1220 r1243  
    4545extern void print_fscpos(const sensors_chip_name *name); 
    4646extern void print_fscscy(const sensors_chip_name *name); 
     47extern void print_pcf8591(const sensors_chip_name *name); 
    4748 
    4849#endif /* def PROG_SENSORS_CHIPS_H */ 
  • lm-sensors/trunk/prog/sensors/main.c

    r1233 r1243  
    338338  else if (!strcmp(name.prefix,"fscscy")) 
    339339    print_fscscy(&name); 
     340  else if (!strcmp(name.prefix,"pcf8591")) 
     341    print_pcf8591(&name); 
    340342  else 
    341343    print_unknown_chip(&name);