aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/i2c/chips/max6875
diff options
context:
space:
mode:
authorbgardner@wabtec.com <bgardner@wabtec.com>2005-07-12 14:21:50 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-05 12:14:03 -0400
commit93ffa435147abd47ebd7d7d24176b3c653aef940 (patch)
tree451f9bdfa2ec7e2c4399dd6ca3cc3c97f12c27b9 /Documentation/i2c/chips/max6875
parentbc769ff8f5f6e3d249bfde082653e5bf1c2b5698 (diff)
[PATCH] I2C: update max6875 documentation
Updates to the max6875 driver documentation. This brings the documentation in sync with the code, which was recently simplified. This patch is based off 2.6.13-rc2-mm2. Signed-off-by: Ben Gardner <bgardner@wabtec.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'Documentation/i2c/chips/max6875')
-rw-r--r--Documentation/i2c/chips/max687594
1 files changed, 68 insertions, 26 deletions
diff --git a/Documentation/i2c/chips/max6875 b/Documentation/i2c/chips/max6875
index b02002898a09..46b8dc34c971 100644
--- a/Documentation/i2c/chips/max6875
+++ b/Documentation/i2c/chips/max6875
@@ -4,22 +4,13 @@ Kernel driver max6875
4Supported chips: 4Supported chips:
5 * Maxim MAX6874, MAX6875 5 * Maxim MAX6874, MAX6875
6 Prefix: 'max6875' 6 Prefix: 'max6875'
7 Addresses scanned: 0x50, 0x52 7 Addresses scanned: None (see below)
8 Datasheet: 8 Datasheet:
9 http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf 9 http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf
10 10
11Author: Ben Gardner <bgardner@wabtec.com> 11Author: Ben Gardner <bgardner@wabtec.com>
12 12
13 13
14Module Parameters
15-----------------
16
17* allow_write int
18 Set to non-zero to enable write permission:
19 *0: Read only
20 1: Read and write
21
22
23Description 14Description
24----------- 15-----------
25 16
@@ -33,34 +24,85 @@ registers.
33 24
34The Maxim MAX6874 is a similar, mostly compatible device, with more intputs 25The Maxim MAX6874 is a similar, mostly compatible device, with more intputs
35and outputs: 26and outputs:
36
37 vin gpi vout 27 vin gpi vout
38MAX6874 6 4 8 28MAX6874 6 4 8
39MAX6875 4 3 5 29MAX6875 4 3 5
40 30
41MAX6874 chips can have four different addresses (as opposed to only two for 31See the datasheet for more information.
42the MAX6875). The additional addresses (0x54 and 0x56) are not probed by
43this driver by default, but the probe module parameter can be used if
44needed.
45
46See the datasheet for details on how to program the EEPROM.
47 32
48 33
49Sysfs entries 34Sysfs entries
50------------- 35-------------
51 36
52eeprom_user - 512 bytes of user-defined EEPROM space. Only writable if 37eeprom - 512 bytes of user-defined EEPROM space.
53 allow_write was set and register 0x43 is 0.
54
55eeprom_config - 70 bytes of config EEPROM. Note that changes will not get
56 loaded into register space until a power cycle or device reset.
57
58reg_config - 70 bytes of register space. Any changes take affect immediately.
59 38
60 39
61General Remarks 40General Remarks
62--------------- 41---------------
63 42
64A typical application will require that the EEPROMs be programmed once and 43Valid addresses for the MAX6875 are 0x50 and 0x52.
65never altered afterwards. 44Valid addresses for the MAX6874 are 0x50, 0x52, 0x54 and 0x56.
45The driver does not probe any address, so you must force the address.
46
47Example:
48$ modprobe max6875 force=0,0x50
49
50The MAX6874/MAX6875 ignores address bit 0, so this driver attaches to multiple
51addresses. For example, for address 0x50, it also reserves 0x51.
52The even-address instance is called 'max6875', the odd one is 'max6875-dummy'.
53
54
55Programming the chip using i2c-dev
56----------------------------------
57
58Use the i2c-dev interface to access and program the chips.
59Reads and write are performed differently depending on the address range.
60
61The configuration registers are at addresses 0x00 - 0x45.
62Use i2c_smbus_write_byte_data() to write a register and
63i2c_smbus_read_byte_data() to read a register.
64The command is the register number.
65
66Examples:
67To write a 1 to register 0x45:
68 i2c_smbus_write_byte_data(fd, 0x45, 1);
69
70To read register 0x45:
71 value = i2c_smbus_read_byte_data(fd, 0x45);
72
73
74The configuration EEPROM is at addresses 0x8000 - 0x8045.
75The user EEPROM is at addresses 0x8100 - 0x82ff.
76
77Use i2c_smbus_write_word_data() to write a byte to EEPROM.
78
79The command is the upper byte of the address: 0x80, 0x81, or 0x82.
80The data word is the lower part of the address or'd with data << 8.
81 cmd = address >> 8;
82 val = (address & 0xff) | (data << 8);
83
84Example:
85To write 0x5a to address 0x8003:
86 i2c_smbus_write_word_data(fd, 0x80, 0x5a03);
87
88
89Reading data from the EEPROM is a little more complicated.
90Use i2c_smbus_write_byte_data() to set the read address and then
91i2c_smbus_read_byte() or i2c_smbus_read_i2c_block_data() to read the data.
92
93Example:
94To read data starting at offset 0x8100, first set the address:
95 i2c_smbus_write_byte_data(fd, 0x81, 0x00);
96
97And then read the data
98 value = i2c_smbus_read_byte(fd);
99
100 or
101
102 count = i2c_smbus_read_i2c_block_data(fd, 0x84, buffer);
103
104The block read should read 16 bytes.
1050x84 is the block read command.
106
107See the datasheet for more details.
66 108