1 ===================== 2 Kernel driver max6875 3 ===================== 4 5 Supported chips: 6 7 * Maxim MAX6874, MAX6875 8 9 Prefix: 'max6875' 10 11 Addresses scanned: None (see below) 12 13 Datasheet: http://pdfserv.maxim-ic.com/en/ 14 15 Author: Ben Gardner <bgardner@wabtec.com> 16 17 18 Description 19 ----------- 20 21 The Maxim MAX6875 is an EEPROM-programmable po 22 It provides timed outputs that can be used as 23 It also provides 512 bytes of user EEPROM. 24 25 At reset, the MAX6875 reads the configuration 26 registers. The chip then begins to operate ac 27 registers. 28 29 The Maxim MAX6874 is a similar, mostly compati 30 and outputs: 31 32 =========== === === ==== 33 - vin gpi vout 34 =========== === === ==== 35 MAX6874 6 4 8 36 MAX6875 4 3 5 37 =========== === === ==== 38 39 See the datasheet for more information. 40 41 42 Sysfs entries 43 ------------- 44 45 eeprom - 512 bytes of user-defined EEPR 46 47 48 General Remarks 49 --------------- 50 51 Valid addresses for the MAX6875 are 0x50 and 0 52 53 Valid addresses for the MAX6874 are 0x50, 0x52 54 55 The driver does not probe any address, so you 56 devices. 57 58 Example:: 59 60 $ modprobe max6875 61 $ echo max6875 0x50 > /sys/bus/i2c/devices/i 62 63 The MAX6874/MAX6875 ignores address bit 0, so 64 addresses. For example, for address 0x50, it 65 The even-address instance is called 'max6875', 66 67 68 Programming the chip using i2c-dev 69 ---------------------------------- 70 71 Use the i2c-dev interface to access and progra 72 73 Reads and writes are performed differently dep 74 75 The configuration registers are at addresses 0 76 77 Use i2c_smbus_write_byte_data() to write a reg 78 i2c_smbus_read_byte_data() to read a register. 79 80 The command is the register number. 81 82 Examples: 83 84 To write a 1 to register 0x45:: 85 86 i2c_smbus_write_byte_data(fd, 0x45, 1); 87 88 To read register 0x45:: 89 90 value = i2c_smbus_read_byte_data(fd, 0x45); 91 92 93 The configuration EEPROM is at addresses 0x800 94 95 The user EEPROM is at addresses 0x8100 - 0x82f 96 97 Use i2c_smbus_write_word_data() to write a byt 98 99 The command is the upper byte of the address: 100 The data word is the lower part of the address 101 102 cmd = address >> 8; 103 val = (address & 0xff) | (data << 8); 104 105 Example: 106 107 To write 0x5a to address 0x8003:: 108 109 i2c_smbus_write_word_data(fd, 0x80, 0x5a03); 110 111 112 Reading data from the EEPROM is a little more 113 114 Use i2c_smbus_write_byte_data() to set the rea 115 i2c_smbus_read_byte() or i2c_smbus_read_i2c_bl 116 117 Example: 118 119 To read data starting at offset 0x8100, first 120 121 i2c_smbus_write_byte_data(fd, 0x81, 0x00); 122 123 And then read the data:: 124 125 value = i2c_smbus_read_byte(fd); 126 127 or:: 128 129 count = i2c_smbus_read_i2c_block_data(fd, 0x 130 131 The block read should read 16 bytes. 132 133 0x84 is the block read command. 134 135 See the datasheet for more details. 136
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.