Back to home page

OSCL-LXR

 
 

    


0001 Kernel driver pcf8591
0002 =====================
0003 
0004 Supported chips:
0005 
0006   * Philips/NXP PCF8591
0007 
0008     Prefix: 'pcf8591'
0009 
0010     Addresses scanned: none
0011 
0012     Datasheet: Publicly available at the NXP website
0013 
0014                http://www.nxp.com/pip/PCF8591_6.html
0015 
0016 Authors:
0017       - Aurelien Jarno <aurelien@aurel32.net>
0018       - valuable contributions by Jan M. Sendler <sendler@sendler.de>,
0019       - Jean Delvare <jdelvare@suse.de>
0020 
0021 
0022 Description
0023 -----------
0024 
0025 The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one
0026 analog output) for the I2C bus produced by Philips Semiconductors (now NXP).
0027 It is designed to provide a byte I2C interface to up to 4 separate devices.
0028 
0029 The PCF8591 has 4 analog inputs programmable as single-ended or
0030 differential inputs:
0031 
0032 - mode 0 : four single ended inputs
0033         Pins AIN0 to AIN3 are single ended inputs for channels 0 to 3
0034 
0035 - mode 1 : three differential inputs
0036         Pins AIN3 is the common negative differential input
0037         Pins AIN0 to AIN2 are positive differential inputs for channels 0 to 2
0038 
0039 - mode 2 : single ended and differential mixed
0040         Pins AIN0 and AIN1 are single ended inputs for channels 0 and 1
0041         Pins AIN2 is the positive differential input for channel 3
0042         Pins AIN3 is the negative differential input for channel 3
0043 
0044 - mode 3 : two differential inputs
0045         Pins AIN0 is the positive differential input for channel 0
0046         Pins AIN1 is the negative differential input for channel 0
0047         Pins AIN2 is the positive differential input for channel 1
0048         Pins AIN3 is the negative differential input for channel 1
0049 
0050 See the datasheet for details.
0051 
0052 Module parameters
0053 -----------------
0054 
0055 * input_mode int
0056 
0057     Analog input mode:
0058 
0059          - 0 = four single ended inputs
0060          - 1 = three differential inputs
0061          - 2 = single ended and differential mixed
0062          - 3 = two differential inputs
0063 
0064 
0065 Accessing PCF8591 via /sys interface
0066 -------------------------------------
0067 
0068 The PCF8591 is plainly impossible to detect! Thus the driver won't even
0069 try. You have to explicitly instantiate the device at the relevant
0070 address (in the interval [0x48..0x4f]) either through platform data, or
0071 using the sysfs interface. See Documentation/i2c/instantiating-devices.rst
0072 for details.
0073 
0074 Directories are being created for each instantiated PCF8591:
0075 
0076 /sys/bus/i2c/devices/<0>-<1>/
0077    where <0> is the bus the chip is connected to (e. g. i2c-0)
0078    and <1> the chip address ([48..4f])
0079 
0080 Inside these directories, there are such files:
0081 
0082    in0_input, in1_input, in2_input, in3_input, out0_enable, out0_output, name
0083 
0084 Name contains chip name.
0085 
0086 The in0_input, in1_input, in2_input and in3_input files are RO. Reading gives
0087 the value of the corresponding channel. Depending on the current analog inputs
0088 configuration, files in2_input and in3_input may not exist. Values range
0089 from 0 to 255 for single ended inputs and -128 to +127 for differential inputs
0090 (8-bit ADC).
0091 
0092 The out0_enable file is RW. Reading gives "1" for analog output enabled and
0093 "0" for analog output disabled. Writing accepts "0" and "1" accordingly.
0094 
0095 The out0_output file is RW. Writing a number between 0 and 255 (8-bit DAC), send
0096 the value to the digital-to-analog converter. Note that a voltage will
0097 only appears on AOUT pin if aout0_enable equals 1. Reading returns the last
0098 value written.