blob: 5c4e85f531777a8b7970bb5ea6d9de7dd16a5ab9 [file] [log] [blame]
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +00001Kernel driver pcf8591
2=====================
3
4Supported chips:
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -03005
Jean Delvareafc31872009-09-15 17:18:14 +02006 * Philips/NXP PCF8591
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -03007
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +00008 Prefix: 'pcf8591'
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -03009
Jean Delvare6dfee852010-10-28 20:31:50 +020010 Addresses scanned: none
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -030011
Jean Delvareafc31872009-09-15 17:18:14 +020012 Datasheet: Publicly available at the NXP website
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -030013
14 http://www.nxp.com/pip/PCF8591_6.html
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000015
16Authors:
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -030017 - Aurelien Jarno <aurelien@aurel32.net>
18 - valuable contributions by Jan M. Sendler <sendler@sendler.de>,
19 - Jean Delvare <jdelvare@suse.de>
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000020
21
22Description
23-----------
Jean Delvareafc31872009-09-15 17:18:14 +020024
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000025The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one
Jean Delvareafc31872009-09-15 17:18:14 +020026analog output) for the I2C bus produced by Philips Semiconductors (now NXP).
27It is designed to provide a byte I2C interface to up to 4 separate devices.
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000028
29The PCF8591 has 4 analog inputs programmable as single-ended or
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -030030differential inputs:
31
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000032- mode 0 : four single ended inputs
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -030033 Pins AIN0 to AIN3 are single ended inputs for channels 0 to 3
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000034
35- mode 1 : three differential inputs
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -030036 Pins AIN3 is the common negative differential input
37 Pins AIN0 to AIN2 are positive differential inputs for channels 0 to 2
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000038
39- mode 2 : single ended and differential mixed
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -030040 Pins AIN0 and AIN1 are single ended inputs for channels 0 and 1
41 Pins AIN2 is the positive differential input for channel 3
42 Pins AIN3 is the negative differential input for channel 3
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000043
44- mode 3 : two differential inputs
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -030045 Pins AIN0 is the positive differential input for channel 0
46 Pins AIN1 is the negative differential input for channel 0
47 Pins AIN2 is the positive differential input for channel 1
48 Pins AIN3 is the negative differential input for channel 1
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000049
50See the datasheet for details.
51
52Module parameters
53-----------------
54
55* input_mode int
56
57 Analog input mode:
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -030058
59 - 0 = four single ended inputs
60 - 1 = three differential inputs
61 - 2 = single ended and differential mixed
62 - 3 = two differential inputs
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000063
64
65Accessing PCF8591 via /sys interface
66-------------------------------------
67
Jean Delvare6dfee852010-10-28 20:31:50 +020068The PCF8591 is plainly impossible to detect! Thus the driver won't even
69try. You have to explicitly instantiate the device at the relevant
70address (in the interval [0x48..0x4f]) either through platform data, or
Mauro Carvalho Chehabccf988b2019-07-26 09:51:16 -030071using the sysfs interface. See Documentation/i2c/instantiating-devices.rst
Jean Delvare6dfee852010-10-28 20:31:50 +020072for details.
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000073
Jean Delvare6dfee852010-10-28 20:31:50 +020074Directories are being created for each instantiated PCF8591:
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000075
Jean Delvareafc31872009-09-15 17:18:14 +020076/sys/bus/i2c/devices/<0>-<1>/
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -030077 where <0> is the bus the chip is connected to (e. g. i2c-0)
78 and <1> the chip address ([48..4f])
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000079
80Inside these directories, there are such files:
Mauro Carvalho Chehabb04f2f72019-04-17 06:46:28 -030081
82 in0_input, in1_input, in2_input, in3_input, out0_enable, out0_output, name
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000083
84Name contains chip name.
85
Jean Delvareafc31872009-09-15 17:18:14 +020086The in0_input, in1_input, in2_input and in3_input files are RO. Reading gives
87the value of the corresponding channel. Depending on the current analog inputs
88configuration, files in2_input and in3_input may not exist. Values range
89from 0 to 255 for single ended inputs and -128 to +127 for differential inputs
90(8-bit ADC).
R.Marek@sh.cvut.cz7f15b662005-05-26 12:42:19 +000091
92The out0_enable file is RW. Reading gives "1" for analog output enabled and
93"0" for analog output disabled. Writing accepts "0" and "1" accordingly.
94
95The out0_output file is RW. Writing a number between 0 and 255 (8-bit DAC), send
96the value to the digital-to-analog converter. Note that a voltage will
97only appears on AOUT pin if aout0_enable equals 1. Reading returns the last
98value written.