blob: 447c0702c0ecbf90ed25a7780579546ad52bed7b [file] [log] [blame]
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +00001Kernel driver pcf8591
2=====================
3
4Supported chips:
Jean Delvareafc31872009-09-15 17:18:14 +02005 * Philips/NXP PCF8591
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +00006 Prefix: 'pcf8591'
Jean Delvare6dfee852010-10-28 20:31:50 +02007 Addresses scanned: none
Jean Delvareafc31872009-09-15 17:18:14 +02008 Datasheet: Publicly available at the NXP website
9 http://www.nxp.com/pip/PCF8591_6.html
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000010
11Authors:
12 Aurelien Jarno <aurelien@aurel32.net>
13 valuable contributions by Jan M. Sendler <sendler@sendler.de>,
Jean Delvare7c81c602014-01-29 20:40:08 +010014 Jean Delvare <jdelvare@suse.de>
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000015
16
17Description
18-----------
Jean Delvareafc31872009-09-15 17:18:14 +020019
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000020The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one
Jean Delvareafc31872009-09-15 17:18:14 +020021analog output) for the I2C bus produced by Philips Semiconductors (now NXP).
22It is designed to provide a byte I2C interface to up to 4 separate devices.
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000023
24The PCF8591 has 4 analog inputs programmable as single-ended or
25differential inputs :
26- mode 0 : four single ended inputs
27 Pins AIN0 to AIN3 are single ended inputs for channels 0 to 3
28
29- mode 1 : three differential inputs
30 Pins AIN3 is the common negative differential input
31 Pins AIN0 to AIN2 are positive differential inputs for channels 0 to 2
32
33- mode 2 : single ended and differential mixed
34 Pins AIN0 and AIN1 are single ended inputs for channels 0 and 1
35 Pins AIN2 is the positive differential input for channel 3
36 Pins AIN3 is the negative differential input for channel 3
37
38- mode 3 : two differential inputs
39 Pins AIN0 is the positive differential input for channel 0
40 Pins AIN1 is the negative differential input for channel 0
41 Pins AIN2 is the positive differential input for channel 1
42 Pins AIN3 is the negative differential input for channel 1
43
44See the datasheet for details.
45
46Module parameters
47-----------------
48
49* input_mode int
50
51 Analog input mode:
52 0 = four single ended inputs
53 1 = three differential inputs
54 2 = single ended and differential mixed
55 3 = two differential inputs
56
57
58Accessing PCF8591 via /sys interface
59-------------------------------------
60
Jean Delvare6dfee852010-10-28 20:31:50 +020061The PCF8591 is plainly impossible to detect! Thus the driver won't even
62try. You have to explicitly instantiate the device at the relevant
63address (in the interval [0x48..0x4f]) either through platform data, or
64using the sysfs interface. See Documentation/i2c/instantiating-devices
65for details.
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000066
Jean Delvare6dfee852010-10-28 20:31:50 +020067Directories are being created for each instantiated PCF8591:
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000068
Jean Delvareafc31872009-09-15 17:18:14 +020069/sys/bus/i2c/devices/<0>-<1>/
Jean Delvare6dfee852010-10-28 20:31:50 +020070where <0> is the bus the chip is connected to (e. g. i2c-0)
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000071and <1> the chip address ([48..4f])
72
73Inside these directories, there are such files:
Jean Delvareafc31872009-09-15 17:18:14 +020074in0_input, in1_input, in2_input, in3_input, out0_enable, out0_output, name
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000075
76Name contains chip name.
77
Jean Delvareafc31872009-09-15 17:18:14 +020078The in0_input, in1_input, in2_input and in3_input files are RO. Reading gives
79the value of the corresponding channel. Depending on the current analog inputs
80configuration, files in2_input and in3_input may not exist. Values range
81from 0 to 255 for single ended inputs and -128 to +127 for differential inputs
82(8-bit ADC).
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000083
84The out0_enable file is RW. Reading gives "1" for analog output enabled and
85"0" for analog output disabled. Writing accepts "0" and "1" accordingly.
86
87The out0_output file is RW. Writing a number between 0 and 255 (8-bit DAC), send
88the value to the digital-to-analog converter. Note that a voltage will
89only appears on AOUT pin if aout0_enable equals 1. Reading returns the last
90value written.