0001 =====================
0002 Kernel driver max6875
0003 =====================
0004
0005 Supported chips:
0006
0007 * Maxim MAX6874, MAX6875
0008
0009 Prefix: 'max6875'
0010
0011 Addresses scanned: None (see below)
0012
0013 Datasheet: http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf
0014
0015 Author: Ben Gardner <bgardner@wabtec.com>
0016
0017
0018 Description
0019 -----------
0020
0021 The Maxim MAX6875 is an EEPROM-programmable power-supply sequencer/supervisor.
0022 It provides timed outputs that can be used as a watchdog, if properly wired.
0023 It also provides 512 bytes of user EEPROM.
0024
0025 At reset, the MAX6875 reads the configuration EEPROM into its configuration
0026 registers. The chip then begins to operate according to the values in the
0027 registers.
0028
0029 The Maxim MAX6874 is a similar, mostly compatible device, with more inputs
0030 and outputs:
0031
0032 =========== === === ====
0033 - vin gpi vout
0034 =========== === === ====
0035 MAX6874 6 4 8
0036 MAX6875 4 3 5
0037 =========== === === ====
0038
0039 See the datasheet for more information.
0040
0041
0042 Sysfs entries
0043 -------------
0044
0045 eeprom - 512 bytes of user-defined EEPROM space.
0046
0047
0048 General Remarks
0049 ---------------
0050
0051 Valid addresses for the MAX6875 are 0x50 and 0x52.
0052
0053 Valid addresses for the MAX6874 are 0x50, 0x52, 0x54 and 0x56.
0054
0055 The driver does not probe any address, so you explicitly instantiate the
0056 devices.
0057
0058 Example::
0059
0060 $ modprobe max6875
0061 $ echo max6875 0x50 > /sys/bus/i2c/devices/i2c-0/new_device
0062
0063 The MAX6874/MAX6875 ignores address bit 0, so this driver attaches to multiple
0064 addresses. For example, for address 0x50, it also reserves 0x51.
0065 The even-address instance is called 'max6875', the odd one is 'dummy'.
0066
0067
0068 Programming the chip using i2c-dev
0069 ----------------------------------
0070
0071 Use the i2c-dev interface to access and program the chips.
0072
0073 Reads and writes are performed differently depending on the address range.
0074
0075 The configuration registers are at addresses 0x00 - 0x45.
0076
0077 Use i2c_smbus_write_byte_data() to write a register and
0078 i2c_smbus_read_byte_data() to read a register.
0079
0080 The command is the register number.
0081
0082 Examples:
0083
0084 To write a 1 to register 0x45::
0085
0086 i2c_smbus_write_byte_data(fd, 0x45, 1);
0087
0088 To read register 0x45::
0089
0090 value = i2c_smbus_read_byte_data(fd, 0x45);
0091
0092
0093 The configuration EEPROM is at addresses 0x8000 - 0x8045.
0094
0095 The user EEPROM is at addresses 0x8100 - 0x82ff.
0096
0097 Use i2c_smbus_write_word_data() to write a byte to EEPROM.
0098
0099 The command is the upper byte of the address: 0x80, 0x81, or 0x82.
0100 The data word is the lower part of the address or'd with data << 8::
0101
0102 cmd = address >> 8;
0103 val = (address & 0xff) | (data << 8);
0104
0105 Example:
0106
0107 To write 0x5a to address 0x8003::
0108
0109 i2c_smbus_write_word_data(fd, 0x80, 0x5a03);
0110
0111
0112 Reading data from the EEPROM is a little more complicated.
0113
0114 Use i2c_smbus_write_byte_data() to set the read address and then
0115 i2c_smbus_read_byte() or i2c_smbus_read_i2c_block_data() to read the data.
0116
0117 Example:
0118
0119 To read data starting at offset 0x8100, first set the address::
0120
0121 i2c_smbus_write_byte_data(fd, 0x81, 0x00);
0122
0123 And then read the data::
0124
0125 value = i2c_smbus_read_byte(fd);
0126
0127 or::
0128
0129 count = i2c_smbus_read_i2c_block_data(fd, 0x84, 16, buffer);
0130
0131 The block read should read 16 bytes.
0132
0133 0x84 is the block read command.
0134
0135 See the datasheet for more details.
0136