Changeset 4689

Show
Ignore:
Timestamp:
08/19/07 17:07:05 (7 years ago)
Author:
khali
Message:

Add support for hardware monitoring chips on SPI buses.

SPI bus statements in the configuration file are not yet supported, as
SPI buses don't have a name attribute yet, it's not possible to identify
them and thus no substitution is possible.

Location:
lm-sensors/branches/lm-sensors-3.0.0
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/CHANGES

    r4677 r4689  
    2424           New function sensors_snprintf_chip_name() 
    2525           Drop support for dashes in chip names 
     26           Add support for devices on SPI adapters 
    2627  Makefile: Drop the package and version targets 
    2728  Man page sensors.conf.5: Update the chip statement section 
  • lm-sensors/branches/lm-sensors-3.0.0/lib/access.c

    r4687 r4689  
    323323        case SENSORS_BUS_TYPE_PCI: 
    324324                return "PCI adapter"; 
     325        /* SPI should not be here, but for now SPI adapters have no name 
     326           so we don't have any custom string to return. */ 
     327        case SENSORS_BUS_TYPE_SPI: 
     328                return "SPI adapter"; 
    325329        } 
    326330 
  • lm-sensors/branches/lm-sensors-3.0.0/lib/data.c

    r4688 r4689  
    107107        else if (!strncmp(name, "pci", dash - name)) 
    108108                res->bus.type = SENSORS_BUS_TYPE_PCI; 
     109        else if (!strncmp(name, "spi", dash - name)) 
     110                res->bus.type = SENSORS_BUS_TYPE_SPI; 
    109111        else 
    110112                goto ERROR; 
    111113        name = dash + 1; 
    112114 
    113         /* Some bus types (i2c) have an additional bus number. For these, the 
    114            next part is either a "*" (any bus of that type) or a decimal 
    115            number. */ 
     115        /* Some bus types (i2c, spi) have an additional bus number. 
     116           For these, the next part is either a "*" (any bus of that type) 
     117           or a decimal number. */ 
    116118        switch (res->bus.type) { 
    117119        case SENSORS_BUS_TYPE_I2C: 
     120        case SENSORS_BUS_TYPE_SPI: 
    118121                if (!strncmp(name, "*-", 2)) { 
    119122                        res->bus.nr = SENSORS_BUS_NR_ANY; 
     
    163166                return snprintf(str, size, "%s-i2c-%hd-%02x", chip->prefix, 
    164167                                chip->bus.nr, chip->addr); 
     168        case SENSORS_BUS_TYPE_SPI: 
     169                return snprintf(str, size, "%s-spi-%hd-%x", chip->prefix, 
     170                                chip->bus.nr, chip->addr); 
    165171        } 
    166172 
  • lm-sensors/branches/lm-sensors-3.0.0/lib/sensors.h

    r4688 r4689  
    3434#define SENSORS_BUS_TYPE_ISA    1 
    3535#define SENSORS_BUS_TYPE_PCI    2 
     36#define SENSORS_BUS_TYPE_SPI    3 
    3637#define SENSORS_BUS_NR_ANY      (-1) 
    3738#define SENSORS_BUS_NR_IGNORE   (-2) 
  • lm-sensors/branches/lm-sensors-3.0.0/lib/sysfs.c

    r4687 r4689  
    253253                        } 
    254254                } 
     255        } else if (sscanf(dev->name, "spi%hd.%d", &entry.chip.bus.nr, 
     256                          &entry.chip.addr) == 2) { 
     257                /* SPI */ 
     258                entry.chip.bus.type = SENSORS_BUS_TYPE_SPI; 
    255259        } else if (sscanf(dev->name, "%*[a-z0-9_].%d", &entry.chip.addr) == 1) { 
    256260                /* must be new ISA (platform driver) */