| R.Marek@sh.cvut.cz | 7f15b66 | 2005-05-26 12:42:19 +0000 | [diff] [blame] | 1 | Kernel driver pcf8591 | 
 | 2 | ===================== | 
 | 3 |  | 
 | 4 | Supported chips: | 
 | 5 |   * Philips PCF8591 | 
 | 6 |     Prefix: 'pcf8591' | 
 | 7 |     Addresses scanned: I2C 0x48 - 0x4f | 
 | 8 |     Datasheet: Publicly available at the Philips Semiconductor website | 
 | 9 |                http://www.semiconductors.philips.com/pip/PCF8591P.html | 
 | 10 |  | 
 | 11 | Authors: | 
 | 12 |         Aurelien Jarno <aurelien@aurel32.net> | 
 | 13 |         valuable contributions by Jan M. Sendler <sendler@sendler.de>, | 
 | 14 |         Jean Delvare <khali@linux-fr.org> | 
 | 15 |  | 
 | 16 |  | 
 | 17 | Description | 
 | 18 | ----------- | 
 | 19 | The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one | 
 | 20 | analog output) for the I2C bus produced by Philips Semiconductors. It | 
 | 21 | is designed to provide a byte I2C interface to up to 4 separate devices. | 
 | 22 |  | 
 | 23 | The PCF8591 has 4 analog inputs programmable as single-ended or | 
 | 24 | differential inputs : | 
 | 25 | - mode 0 : four single ended inputs | 
 | 26 |         Pins AIN0 to AIN3 are single ended inputs for channels 0 to 3 | 
 | 27 |  | 
 | 28 | - mode 1 : three differential inputs | 
 | 29 |         Pins AIN3 is the common negative differential input | 
 | 30 |         Pins AIN0 to AIN2 are positive differential inputs for channels 0 to 2 | 
 | 31 |  | 
 | 32 | - mode 2 : single ended and differential mixed | 
 | 33 |         Pins AIN0 and AIN1 are single ended inputs for channels 0 and 1 | 
 | 34 |         Pins AIN2 is the positive differential input for channel 3 | 
 | 35 |         Pins AIN3 is the negative differential input for channel 3 | 
 | 36 |  | 
 | 37 | - mode 3 : two differential inputs | 
 | 38 |         Pins AIN0 is the positive differential input for channel 0 | 
 | 39 |         Pins AIN1 is the negative differential input for channel 0 | 
 | 40 |         Pins AIN2 is the positive differential input for channel 1 | 
 | 41 |         Pins AIN3 is the negative differential input for channel 1 | 
 | 42 |  | 
 | 43 | See the datasheet for details. | 
 | 44 |  | 
 | 45 | Module parameters | 
 | 46 | ----------------- | 
 | 47 |  | 
 | 48 | * input_mode int | 
 | 49 |  | 
 | 50 |     Analog input mode: | 
 | 51 |          0 = four single ended inputs | 
 | 52 |          1 = three differential inputs | 
 | 53 |          2 = single ended and differential mixed | 
 | 54 |          3 = two differential inputs | 
 | 55 |  | 
 | 56 |  | 
 | 57 | Accessing PCF8591 via /sys interface | 
 | 58 | ------------------------------------- | 
 | 59 |  | 
 | 60 | ! Be careful ! | 
 | 61 | The PCF8591 is plainly impossible to detect ! Stupid chip. | 
 | 62 | So every chip with address in the interval [48..4f] is | 
 | 63 | detected as PCF8591. If you have other chips in this address | 
 | 64 | range, the workaround is to load this module after the one | 
 | 65 | for your others chips. | 
 | 66 |  | 
 | 67 | On detection (i.e. insmod, modprobe et al.), directories are being | 
 | 68 | created for each detected PCF8591: | 
 | 69 |  | 
 | 70 | /sys/bus/devices/<0>-<1>/ | 
 | 71 | where <0> is the bus the chip was detected on (e. g. i2c-0) | 
 | 72 | and <1> the chip address ([48..4f]) | 
 | 73 |  | 
 | 74 | Inside these directories, there are such files: | 
 | 75 | in0, in1, in2, in3, out0_enable, out0_output, name | 
 | 76 |  | 
 | 77 | Name contains chip name. | 
 | 78 |  | 
 | 79 | The in0, in1, in2 and in3 files are RO. Reading gives the value of the | 
 | 80 | corresponding channel. Depending on the current analog inputs configuration, | 
 | 81 | files in2 and/or in3 do not exist. Values range are from 0 to 255 for single | 
 | 82 | ended inputs and -128 to +127 for differential inputs (8-bit ADC). | 
 | 83 |  | 
 | 84 | The 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 |  | 
 | 87 | The out0_output file is RW. Writing a number between 0 and 255 (8-bit DAC), send | 
 | 88 | the value to the digital-to-analog converter. Note that a voltage will | 
 | 89 | only appears on AOUT pin if aout0_enable equals 1. Reading returns the last | 
 | 90 | value written. |