2005-05-26 20:42:19 +08:00
|
|
|
Kernel driver pcf8591
|
|
|
|
=====================
|
|
|
|
|
|
|
|
Supported chips:
|
2019-04-17 17:46:28 +08:00
|
|
|
|
2009-09-15 23:18:14 +08:00
|
|
|
* Philips/NXP PCF8591
|
2019-04-17 17:46:28 +08:00
|
|
|
|
2005-05-26 20:42:19 +08:00
|
|
|
Prefix: 'pcf8591'
|
2019-04-17 17:46:28 +08:00
|
|
|
|
2010-10-29 02:31:50 +08:00
|
|
|
Addresses scanned: none
|
2019-04-17 17:46:28 +08:00
|
|
|
|
2009-09-15 23:18:14 +08:00
|
|
|
Datasheet: Publicly available at the NXP website
|
2019-04-17 17:46:28 +08:00
|
|
|
|
|
|
|
http://www.nxp.com/pip/PCF8591_6.html
|
2005-05-26 20:42:19 +08:00
|
|
|
|
|
|
|
Authors:
|
2019-04-17 17:46:28 +08:00
|
|
|
- Aurelien Jarno <aurelien@aurel32.net>
|
|
|
|
- valuable contributions by Jan M. Sendler <sendler@sendler.de>,
|
|
|
|
- Jean Delvare <jdelvare@suse.de>
|
2005-05-26 20:42:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
Description
|
|
|
|
-----------
|
2009-09-15 23:18:14 +08:00
|
|
|
|
2005-05-26 20:42:19 +08:00
|
|
|
The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one
|
2009-09-15 23:18:14 +08:00
|
|
|
analog output) for the I2C bus produced by Philips Semiconductors (now NXP).
|
|
|
|
It is designed to provide a byte I2C interface to up to 4 separate devices.
|
2005-05-26 20:42:19 +08:00
|
|
|
|
|
|
|
The PCF8591 has 4 analog inputs programmable as single-ended or
|
2019-04-17 17:46:28 +08:00
|
|
|
differential inputs:
|
|
|
|
|
2005-05-26 20:42:19 +08:00
|
|
|
- mode 0 : four single ended inputs
|
2019-04-17 17:46:28 +08:00
|
|
|
Pins AIN0 to AIN3 are single ended inputs for channels 0 to 3
|
2005-05-26 20:42:19 +08:00
|
|
|
|
|
|
|
- mode 1 : three differential inputs
|
2019-04-17 17:46:28 +08:00
|
|
|
Pins AIN3 is the common negative differential input
|
|
|
|
Pins AIN0 to AIN2 are positive differential inputs for channels 0 to 2
|
2005-05-26 20:42:19 +08:00
|
|
|
|
|
|
|
- mode 2 : single ended and differential mixed
|
2019-04-17 17:46:28 +08:00
|
|
|
Pins AIN0 and AIN1 are single ended inputs for channels 0 and 1
|
|
|
|
Pins AIN2 is the positive differential input for channel 3
|
|
|
|
Pins AIN3 is the negative differential input for channel 3
|
2005-05-26 20:42:19 +08:00
|
|
|
|
|
|
|
- mode 3 : two differential inputs
|
2019-04-17 17:46:28 +08:00
|
|
|
Pins AIN0 is the positive differential input for channel 0
|
|
|
|
Pins AIN1 is the negative differential input for channel 0
|
|
|
|
Pins AIN2 is the positive differential input for channel 1
|
|
|
|
Pins AIN3 is the negative differential input for channel 1
|
2005-05-26 20:42:19 +08:00
|
|
|
|
|
|
|
See the datasheet for details.
|
|
|
|
|
|
|
|
Module parameters
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
* input_mode int
|
|
|
|
|
|
|
|
Analog input mode:
|
2019-04-17 17:46:28 +08:00
|
|
|
|
|
|
|
- 0 = four single ended inputs
|
|
|
|
- 1 = three differential inputs
|
|
|
|
- 2 = single ended and differential mixed
|
|
|
|
- 3 = two differential inputs
|
2005-05-26 20:42:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
Accessing PCF8591 via /sys interface
|
|
|
|
-------------------------------------
|
|
|
|
|
2010-10-29 02:31:50 +08:00
|
|
|
The PCF8591 is plainly impossible to detect! Thus the driver won't even
|
|
|
|
try. You have to explicitly instantiate the device at the relevant
|
|
|
|
address (in the interval [0x48..0x4f]) either through platform data, or
|
2019-07-26 20:51:16 +08:00
|
|
|
using the sysfs interface. See Documentation/i2c/instantiating-devices.rst
|
2010-10-29 02:31:50 +08:00
|
|
|
for details.
|
2005-05-26 20:42:19 +08:00
|
|
|
|
2010-10-29 02:31:50 +08:00
|
|
|
Directories are being created for each instantiated PCF8591:
|
2005-05-26 20:42:19 +08:00
|
|
|
|
2009-09-15 23:18:14 +08:00
|
|
|
/sys/bus/i2c/devices/<0>-<1>/
|
2019-04-17 17:46:28 +08:00
|
|
|
where <0> is the bus the chip is connected to (e. g. i2c-0)
|
|
|
|
and <1> the chip address ([48..4f])
|
2005-05-26 20:42:19 +08:00
|
|
|
|
|
|
|
Inside these directories, there are such files:
|
2019-04-17 17:46:28 +08:00
|
|
|
|
|
|
|
in0_input, in1_input, in2_input, in3_input, out0_enable, out0_output, name
|
2005-05-26 20:42:19 +08:00
|
|
|
|
|
|
|
Name contains chip name.
|
|
|
|
|
2009-09-15 23:18:14 +08:00
|
|
|
The in0_input, in1_input, in2_input and in3_input files are RO. Reading gives
|
|
|
|
the value of the corresponding channel. Depending on the current analog inputs
|
|
|
|
configuration, files in2_input and in3_input may not exist. Values range
|
|
|
|
from 0 to 255 for single ended inputs and -128 to +127 for differential inputs
|
|
|
|
(8-bit ADC).
|
2005-05-26 20:42:19 +08:00
|
|
|
|
|
|
|
The out0_enable file is RW. Reading gives "1" for analog output enabled and
|
|
|
|
"0" for analog output disabled. Writing accepts "0" and "1" accordingly.
|
|
|
|
|
|
|
|
The out0_output file is RW. Writing a number between 0 and 255 (8-bit DAC), send
|
|
|
|
the value to the digital-to-analog converter. Note that a voltage will
|
|
|
|
only appears on AOUT pin if aout0_enable equals 1. Reading returns the last
|
|
|
|
value written.
|