Changeset 4355

Show
Ignore:
Timestamp:
03/27/07 17:46:14 (2 years ago)
Author:
khali
Message:

Add user-space support for the SMSC DME1737. Patch from Juerg Haefliger.

Files:

Legend:

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

    r4354 r4355  
    33 
    44SVN HEAD 
     5  File sensors.conf.eg: Add a dme1737 section 
    56  Library: Clean up pwm symbol names translation 
     7           Add dme1737 support 
    68  Program isadump: Detect when address bit 7 is a busy flag 
    79  Program sensors: Drop ddcmon and eeprom support 
     10                   Add dme1737 support 
    811  Program sensors-detect: Stop Super-I/O probe after first family success 
     12                          Fix SMSC DME1737 detection 
    913 
    1014 
  • lm-sensors/trunk/etc/sensors.conf.eg

    r4264 r4355  
    28142814   label temp3 "Core1 Temp" 
    28152815   label temp4 "Core1 Temp" 
     2816 
     2817 
     2818# 
     2819# Sample configuration for the SMSC DME1737 and ASUS A8000 
     2820# 
     2821chip "dme1737-*" 
     2822 
     2823# Voltage inputs 
     2824   label in0   "V5stby" 
     2825   label in1   "Vccp" 
     2826   label in2   "V3.3" 
     2827   label in3   "V5" 
     2828   label in4   "V12" 
     2829   label in5   "V3.3stby" 
     2830   label in6   "Vbat" 
     2831 
     2832# Temperature inputs 
     2833   label temp1   "RD1 Temp" 
     2834   label temp2   "Int Temp" 
     2835   label temp3   "CPU Temp" 
     2836 
     2837# Fan inputs 
     2838   label fan1   "CPU_Fan" 
     2839   label fan2   "Fan2" 
     2840   label fan3   "Fan3" 
     2841   label fan4   "Fan4" 
     2842   label fan5   "Fan5" 
     2843   label fan6   "Fan6" 
     2844 
     2845# PWM Outputs 
     2846   label pwm1   "CPU_PWM" 
     2847   label pwm2   "Fan2_PWM" 
     2848   label pwm3   "Fan3_PWM" 
     2849   label pwm5   "Fan5_PWM" 
     2850   label pwm6   "Fan6_PWM" 
     2851 
     2852# Set voltage limits 
     2853#   set in0_min   5.0 * 0.95 
     2854#   set in0_max   5.0 * 1.05 
     2855#   set in1_min   1.4 * 0.95 
     2856#   set in1_max   1.4 * 1.05 
     2857#   set in2_min   3.3 * 0.95 
     2858#   set in2_max   3.3 * 1.05 
     2859#   set in3_min   5.0 * 0.95 
     2860#   set in3_max   5.0 * 1.05 
     2861#   set in4_min  12.0 * 0.95 
     2862#   set in4_max  12.0 * 1.05 
     2863#   set in5_min   3.3 * 0.95 
     2864#   set in5_max   3.3 * 1.05 
     2865#   set in6_min   3.0 * 0.95 
     2866#   set in6_max   3.0 * 1.05 
     2867 
     2868# Set Temp Limits 
     2869#   set temp1_min 10 
     2870#   set temp1_max 75 
     2871#   set temp2_min 10 
     2872#   set temp2_max 75 
     2873#   set temp3_min 10 
     2874#   set temp3_max 75 
     2875 
     2876# Set Fan limits 
     2877#   set fan1_min 1000 
     2878#   set fan2_min 1000 
     2879#   set fan3_min 1000 
     2880#   set fan4_min 1000 
     2881#   set fan5_min 1000 
     2882#   set fan6_min 1000 
  • lm-sensors/trunk/lib/chips.c

    r4345 r4355  
    59665966  }; 
    59675967 
     5968#define SENSORS_DME1737_IN_FEATURES(nr) \ 
     5969        { { SENSORS_DME1737_IN(nr), "in" #nr, \ 
     5970                NOMAP, NOMAP, R }, \ 
     5971                NOSYSCTL, VALUE(3), 3 }, \ 
     5972        { { SENSORS_DME1737_IN_MIN(nr), "in" #nr "_min", \ 
     5973                SENSORS_DME1737_IN(nr), SENSORS_DME1737_IN(nr), RW }, \ 
     5974                NOSYSCTL, VALUE(1), 3 }, \ 
     5975        { { SENSORS_DME1737_IN_MAX(nr), "in" #nr "_max", \ 
     5976                SENSORS_DME1737_IN(nr), SENSORS_DME1737_IN(nr), RW }, \ 
     5977                NOSYSCTL, VALUE(2), 3 }, \ 
     5978        { { SENSORS_DME1737_IN_ALARM(nr), "in" #nr "_alarm", \ 
     5979                SENSORS_DME1737_IN(nr), NOMAP, R }, \ 
     5980                NOSYSCTL, VALUE(1), 0 } 
     5981 
     5982#define SENSORS_DME1737_TEMP_FEATURES(nr) \ 
     5983        { { SENSORS_DME1737_TEMP(nr), "temp" #nr, \ 
     5984                NOMAP, NOMAP, R }, \ 
     5985                NOSYSCTL, VALUE(3), 3 }, \ 
     5986        { { SENSORS_DME1737_TEMP_MIN(nr), "temp" #nr "_min", \ 
     5987                SENSORS_DME1737_TEMP(nr), SENSORS_DME1737_TEMP(nr), RW }, \ 
     5988                NOSYSCTL, VALUE(2), 3 }, \ 
     5989        { { SENSORS_DME1737_TEMP_MAX(nr), "temp" #nr "_max", \ 
     5990                SENSORS_DME1737_TEMP(nr), SENSORS_DME1737_TEMP(nr), RW }, \ 
     5991                NOSYSCTL, VALUE(1), 3 }, \ 
     5992        { { SENSORS_DME1737_TEMP_ALARM(nr), "temp" #nr "_alarm", \ 
     5993                SENSORS_DME1737_TEMP(nr), NOMAP, R }, \ 
     5994                NOSYSCTL, VALUE(1), 0 }, \ 
     5995        { { SENSORS_DME1737_TEMP_FAULT(nr), "temp" #nr "_fault", \ 
     5996                SENSORS_DME1737_TEMP(nr), NOMAP, R }, \ 
     5997                NOSYSCTL, VALUE(2), 0 } 
     5998 
     5999#define SENSORS_DME1737_FAN_FEATURES(nr) \ 
     6000        { { SENSORS_DME1737_FAN(nr), "fan" #nr, \ 
     6001                NOMAP, NOMAP, R }, \ 
     6002                NOSYSCTL, VALUE(2), 0 }, \ 
     6003        { { SENSORS_DME1737_FAN_MIN(nr), "fan" #nr "_min", \ 
     6004                SENSORS_DME1737_FAN(nr), SENSORS_DME1737_FAN(nr), RW }, \ 
     6005                NOSYSCTL, VALUE(1), 0 }, \ 
     6006        { { SENSORS_DME1737_FAN_ALARM(nr), "fan" #nr "_alarm", \ 
     6007                SENSORS_DME1737_FAN(nr), NOMAP, R }, \ 
     6008                NOSYSCTL, VALUE(1), 0 } 
     6009 
     6010#define SENSORS_DME1737_PWM_FEATURES(nr) \ 
     6011        { { SENSORS_DME1737_PWM(nr), "pwm" #nr, \ 
     6012                NOMAP, NOMAP, RW }, \ 
     6013                NOSYSCTL, VALUE(1), 0 }, \ 
     6014        { { SENSORS_DME1737_PWM_ENABLE(nr), "pwm" #nr "_enable", \ 
     6015                SENSORS_DME1737_PWM(nr), SENSORS_DME1737_PWM(nr), RW }, \ 
     6016                NOSYSCTL, VALUE(2), 0 }, \ 
     6017        { { SENSORS_DME1737_PWM_FREQ(nr), "pwm" #nr "_freq", \ 
     6018                SENSORS_DME1737_PWM(nr), SENSORS_DME1737_PWM(nr), RW }, \ 
     6019                NOSYSCTL, VALUE(3), 0 } 
     6020 
     6021static sensors_chip_feature dme1737_features[] = 
     6022{ 
     6023        SENSORS_DME1737_IN_FEATURES(0), 
     6024        SENSORS_DME1737_IN_FEATURES(1), 
     6025        SENSORS_DME1737_IN_FEATURES(2), 
     6026        SENSORS_DME1737_IN_FEATURES(3), 
     6027        SENSORS_DME1737_IN_FEATURES(4), 
     6028        SENSORS_DME1737_IN_FEATURES(5), 
     6029        SENSORS_DME1737_IN_FEATURES(6), 
     6030        SENSORS_DME1737_TEMP_FEATURES(1), 
     6031        SENSORS_DME1737_TEMP_FEATURES(2), 
     6032        SENSORS_DME1737_TEMP_FEATURES(3), 
     6033        SENSORS_DME1737_FAN_FEATURES(1), 
     6034        SENSORS_DME1737_FAN_FEATURES(2), 
     6035        SENSORS_DME1737_FAN_FEATURES(3), 
     6036        SENSORS_DME1737_FAN_FEATURES(4), 
     6037        SENSORS_DME1737_FAN_FEATURES(5), 
     6038        SENSORS_DME1737_FAN_FEATURES(6), 
     6039        SENSORS_DME1737_PWM_FEATURES(1), 
     6040        SENSORS_DME1737_PWM_FEATURES(2), 
     6041        SENSORS_DME1737_PWM_FEATURES(3), 
     6042        SENSORS_DME1737_PWM_FEATURES(5), 
     6043        SENSORS_DME1737_PWM_FEATURES(6), 
     6044        { { SENSORS_DME1737_VID, "cpu0_vid", NOMAP, NOMAP, R }, 
     6045                NOSYSCTL, VALUE(1), 3 }, 
     6046        { { SENSORS_DME1737_VRM, "vrm", NOMAP, NOMAP, RW }, 
     6047                NOSYSCTL, VALUE(1), 1 }, 
     6048        { { 0 }, 0 } 
     6049}; 
     6050 
    59686051sensors_chip_features sensors_chip_features_list[] = 
    59696052{ 
     
    60786161 { SENSORS_K8TEMP_PREFIX, k8temp_features }, 
    60796162 { SENSORS_CORETEMP_PREFIX, coretemp_features }, 
     6163 { SENSORS_DME1737_PREFIX, dme1737_features }, 
    60806164 { 0 } 
    60816165}; 
  • lm-sensors/trunk/lib/chips.h

    r4331 r4355  
    22632263#define SENSORS_CORETEMP_TEMP1_CRIT_ALARM       0x03 /* R */ 
    22642264 
     2265/* DME1737 */ 
     2266 
     2267#define SENSORS_DME1737_PREFIX "dme1737" 
     2268 
     2269/* in n from 0 to 6 */ 
     2270#define SENSORS_DME1737_IN(n)                   (0x01 + (n)) /* R */ 
     2271#define SENSORS_DME1737_IN_MIN(n)               (0x11 + (n)) /* RW */ 
     2272#define SENSORS_DME1737_IN_MAX(n)               (0x21 + (n)) /* RW */ 
     2273#define SENSORS_DME1737_IN_ALARM(n)             (0x31 + (n)) /* R */ 
     2274 
     2275/* temp n from 1 to 3*/ 
     2276#define SENSORS_DME1737_TEMP(n)                 (0x41 + (n)) /* R */ 
     2277#define SENSORS_DME1737_TEMP_MIN(n)             (0x51 + (n)) /* RW */ 
     2278#define SENSORS_DME1737_TEMP_MAX(n)             (0x61 + (n)) /* RW */ 
     2279#define SENSORS_DME1737_TEMP_ALARM(n)           (0x71 + (n)) /* R */ 
     2280#define SENSORS_DME1737_TEMP_FAULT(n)           (0x81 + (n)) /* R */ 
     2281 
     2282/* fan n from 1 to 6 */ 
     2283#define SENSORS_DME1737_FAN(n)                  (0x91 + (n)) /* R */ 
     2284#define SENSORS_DME1737_FAN_MIN(n)              (0xa1 + (n)) /* RW */ 
     2285#define SENSORS_DME1737_FAN_ALARM(n)            (0xb1 + (n)) /* R */ 
     2286 
     2287/* pwm n from 1 to 3 and 5 to 6 */ 
     2288#define SENSORS_DME1737_PWM(n)                  (0xc1 + (n)) /* RW */ 
     2289#define SENSORS_DME1737_PWM_ENABLE(n)           (0xd1 + (n)) /* RW */ 
     2290#define SENSORS_DME1737_PWM_FREQ(n)             (0xe1 + (n)) /* RW */ 
     2291 
     2292#define SENSORS_DME1737_VID                     (0xf0) /* R */ 
     2293#define SENSORS_DME1737_VRM                     (0xf1) /* RW */ 
     2294 
    22652295#endif /* def LIB_SENSORS_CHIPS_H */ 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r4353 r4355  
    14261426     { 
    14271427       name => "SMSC DME1737", 
    1428        driver => "to-be-written", 
     1428       driver => "dme1737", 
    14291429       i2c_addrs => [0x2c..0x2e], 
    14301430       i2c_detect => sub { dme1737_detect(@_); }, 
     
    15591559#      capabilities (listing such chips here removes the need of manual 
    15601560#      lookup when people report them). 
     1561#      Put in exactly "via-smbus-only" if this is a Super-I/O chip whose 
     1562#      hardware monitoring registers can only be accessed via the SMBus. 
    15611563#  devid: The device ID(s) we have to match (base device) 
    15621564#  devid_mask (optional): Bitmask to apply before checking the device ID 
     
    17921794        name => "SMSC DME1737 Super IO", 
    17931795        # Hardware monitoring features are accessed on the SMBus 
    1794         driver => "not-a-sensor", 
     1796        driver => "via-smbus-only", 
    17951797        devid => 0x78, 
     1798      }, 
     1799      { 
     1800        name => "SMSC DME1737 Super IO", 
     1801        # The DME1737 shows up twice in this list because it can return either 
     1802        # 0x78 or 0x77 as its device ID. 
     1803        # Hardware monitoring features are accessed on the SMBus 
     1804        driver => "via-smbus-only", 
     1805        devid => 0x77, 
    17961806      }, 
    17971807    ], 
     
    31113121    return; 
    31123122  } 
     3123  if ($chip->{driver} eq "via-smbus-only") { 
     3124    print "\n    (hardware monitoring capabilities accessible via SMBus only)\n"; 
     3125    return; 
     3126  } 
    31133127 
    31143128  # Switch to the sensor logical device 
     
    48464860#   0x3E: Manufacturer ID 
    48474861#   0x3F: Version/Stepping 
    4848 #   0x40: Configuration (2 reserved bits) 
    4849 #   0x42: Interrupt Status 2 (1 reserved bit) 
    4850 #   0x43: VID (2 reserved bits) 
     4862#   0x73: Read-only test register (4 test bits) 
     4863#   0x8A: Read-only test register (7 test bits) 
    48514864sub dme1737_detect 
    48524865{ 
    48534866  my ($file, $addr) = @_; 
    4854   return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x55 
     4867  return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x5c 
    48554868           and (i2c_smbus_read_byte_data($file, 0x3F) & 0xF8) == 0x88 
    4856            and (i2c_smbus_read_byte_data($file, 0x40) & 0xC4) == 0x04 
    4857            and (i2c_smbus_read_byte_data($file, 0x42) & 0x02) == 0x00 
    4858            and (i2c_smbus_read_byte_data($file, 0x43) & 0xC0) == 0x00; 
     4869           and (i2c_smbus_read_byte_data($file, 0x73) & 0x0F) == 0x09 
     4870           and (i2c_smbus_read_byte_data($file, 0x8A) & 0x7F) == 0x4D; 
    48594871  return ($addr == 0x2e ? 6 : 5); 
    48604872} 
  • lm-sensors/trunk/prog/sensors/chips.c

    r4352 r4355  
    59275927} 
    59285928 
     5929static void print_dme1737_in(const sensors_chip_name *name, int i) 
     5930{ 
     5931  char *label; 
     5932  double cur, min, max, alarm; 
     5933  int valid; 
     5934 
     5935  if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_IN(i), &label, 
     5936                                   &valid) && 
     5937      !sensors_get_feature(*name, SENSORS_DME1737_IN(i), &cur) && 
     5938      !sensors_get_feature(*name, SENSORS_DME1737_IN_MIN(i), &min) && 
     5939      !sensors_get_feature(*name, SENSORS_DME1737_IN_MAX(i), &max) && 
     5940      !sensors_get_feature(*name, SENSORS_DME1737_IN_ALARM(i), &alarm)) { 
     5941    if (valid) { 
     5942      print_label(label, 10); 
     5943      printf("%+6.2f V  (min = %+6.2f V, max = %+6.2f V)  %s\n", 
     5944             cur, min, max, alarm ? "ALARM" : ""); 
     5945    } 
     5946  } else { 
     5947    printf("ERROR: Can't get in%d data!\n", i); 
     5948  } 
     5949  free(label); 
     5950} 
     5951 
     5952static void print_dme1737_temp(const sensors_chip_name *name, int i) 
     5953{ 
     5954  char *label; 
     5955  double cur, min, max, alarm, fault; 
     5956  int valid; 
     5957 
     5958  if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_TEMP(i), &label, 
     5959                                   &valid) && 
     5960      !sensors_get_feature(*name, SENSORS_DME1737_TEMP(i), &cur) && 
     5961      !sensors_get_feature(*name, SENSORS_DME1737_TEMP_MIN(i), &min) && 
     5962      !sensors_get_feature(*name, SENSORS_DME1737_TEMP_MAX(i), &max) && 
     5963      !sensors_get_feature(*name, SENSORS_DME1737_TEMP_ALARM(i), &alarm) && 
     5964      !sensors_get_feature(*name, SENSORS_DME1737_TEMP_FAULT(i), &fault)) { 
     5965    if (valid) { 
     5966      print_label(label, 10); 
     5967      print_temp_info(cur, max, min, MINMAX, 0, 0); 
     5968      printf("%s  %s\n", fault ? "FAULT" : "", alarm ? "ALARM" : ""); 
     5969    } 
     5970  } else { 
     5971    printf("ERROR: Can't get temp%d data!\n", i); 
     5972  } 
     5973  free(label); 
     5974} 
     5975 
     5976static void print_dme1737_fan(const sensors_chip_name *name, int i) 
     5977{ 
     5978  char *label; 
     5979  double cur, min, alarm; 
     5980  int valid; 
     5981 
     5982  if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_FAN(i), &label, 
     5983                                   &valid) && 
     5984      !sensors_get_feature(*name, SENSORS_DME1737_FAN(i), &cur) && 
     5985      !sensors_get_feature(*name, SENSORS_DME1737_FAN_MIN(i), &min) && 
     5986      !sensors_get_feature(*name, SENSORS_DME1737_FAN_ALARM(i), &alarm)) { 
     5987    if (valid) { 
     5988      print_label(label, 10); 
     5989      printf("%4.0f RPM  (min = %4.0f RPM)  %s\n",  
     5990             cur, min, alarm ? "ALARM" : ""); 
     5991    } 
     5992  } else { 
     5993    printf("ERROR: Can't get fan%d data!\n", i); 
     5994  } 
     5995  free(label); 
     5996} 
     5997 
     5998static void print_dme1737_pwm(const sensors_chip_name *name, int i) 
     5999{ 
     6000  char *label; 
     6001  double cur, enable, freq; 
     6002  int valid; 
     6003 
     6004  if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_PWM(i), &label, 
     6005                                   &valid) && 
     6006      !sensors_get_feature(*name, SENSORS_DME1737_PWM(i), &cur) && 
     6007      !sensors_get_feature(*name, SENSORS_DME1737_PWM_ENABLE(i), &enable) && 
     6008      !sensors_get_feature(*name, SENSORS_DME1737_PWM_FREQ(i), &freq)) { 
     6009    if (valid) { 
     6010      print_label(label, 10); 
     6011      printf("%4.0f      (enable = %1.0f, freq = %6.0f Hz)\n", cur, enable, freq); 
     6012    } 
     6013  } else { 
     6014    printf("ERROR: Can't get pwm%d data!\n", i); 
     6015  } 
     6016  free(label); 
     6017} 
     6018 
     6019void print_dme1737(const sensors_chip_name *name) 
     6020{ 
     6021  int i; 
     6022 
     6023  for (i = 0; i < 7; i++) { 
     6024    print_dme1737_in(name, i); 
     6025  } 
     6026 
     6027  for (i = 1; i < 4; i++) { 
     6028    print_dme1737_temp(name, i); 
     6029  } 
     6030 
     6031  for (i = 1; i < 7; i++) { 
     6032    print_dme1737_fan(name, i); 
     6033  } 
     6034 
     6035  for (i = 1; i < 7; i++) { 
     6036    if (i == 4) 
     6037      continue; 
     6038    print_dme1737_pwm(name, i); 
     6039  } 
     6040 
     6041  print_vid_info(name, SENSORS_DME1737_VID, SENSORS_DME1737_VRM); 
     6042} 
     6043 
    59296044void print_unknown_chip(const sensors_chip_name *name) 
    59306045{ 
  • lm-sensors/trunk/prog/sensors/chips.h

    r4352 r4355  
    7777extern void print_k8temp(const sensors_chip_name *name); 
    7878extern void print_coretemp(const sensors_chip_name *name); 
     79extern void print_dme1737(const sensors_chip_name *name); 
    7980 
    8081#endif /* def PROG_SENSORS_CHIPS_H */ 
  • lm-sensors/trunk/prog/sensors/main.c

    r4352 r4355  
    422422        { "k8temp", print_k8temp }, 
    423423        { "coretemp", print_coretemp }, 
     424        { "dme1737", print_dme1737 }, 
    424425        { NULL, NULL } 
    425426};