Kernel driver `pcf8591.o'
========================

Status: Status: Complete; Beta.

Supported chips:
  * Philips PCF8591
    Prefix: 'pcf8591'
    Addresses scanned: I2C 0x48 - 0x4f
    Datasheet: Publicly available at the Philips Semiconductors website
               http://www.semiconductors.philips.com/pip/PCF8591P.html

Author: Aurelien Jarno <aurelien@aurel32.net>
valuable contributions by Jan M. Sendler <sendler@sendler.de>

Module Parameters
-----------------

* force: short array (min = 1, max = 48)
  List of adapter,address pairs to boldly assume to be present
* force_pcf8591: short array (min = 1, max = 48)
  List of adapter,address pairs which are unquestionably assumed to
  contain a `pcf8591' chip
* ignore: short array (min = 1, max = 48)
  List of adapter,address pairs not to scan
* ignore_range: short array (min = 1, max = 48)
  List of adapter,start-addr,end-addr triples not to scan
* probe: short array (min = 1, max = 48)
  List of adapter,address pairs to scan additionally
* probe_range: short array (min = 1, max = 48)
  List of adapter,start-addr,end-addr triples to scan additionally


Description
-----------
The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one
analog ouput) for the I2C bus produced by Philips Semiconductors. It
is designed to provide a byte I2C interface to up to 4 separate devices.

The PCF8591 has 4 analog inputs programmable as single-ended or
differential inputs :
- mode 0 : four single ended inputs
        Pins AIN0 to AIN3 are single ended inputs for channels 0 to 3

- mode 1 : three differential inputs
        Pins AIN3 is the common negative differential input
        Pins AIN0 to AIN2 are positive differential inputs for channels 0 to 2

- mode 2 : single ended and differential mixed
        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

- mode 3 : two differential inputs
        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

For more informations see the datasheet.


Accessing PCF8591 via /proc interface
-------------------------------------

! Be careful !
The PCF8591 is plainly impossible to detect ! Stupid chip.
So every chip with adress in the interval [48..4f] is
detected as PCF8591. If you have other chips in this address
range, the workaround is to load this module after the one
for your others chips.

On detection (i.e. insmod, modprobe et al.), directories are being
created for each detected PCF8591:

/proc/sys/dev/sensors/pcf8591-<0>-<1>/
where <0> is the bus the chip was detected on (e. g. i2c-0)
and <1> the chip address ([48..4f]): ./pcf8591-i2c-0-48/

Inside these directories, there are five files each:
ain_conf, ch0, ch1, ch2, ch3, aout_enable, aout.

The ain_conf file is rw. Reading gives you the current analog inputs
configuration, and writing configure the analog inputs. It must be
a number between 0 and 3., other values are ignored. For the different
modes, see above in the description.

The ch0, ch1, ch2 and ch3 files are ro. Reading gives the value
of the corresponding channel. Depending on the current analog inputs
configuration, channel ch2 and/or ch3 may are not used by the chip
and so read as 0. Values range are from 0 to 255 for single
ended inputs and -128 to +127 for differential inputs (8-bit ADC).

The aout_enable is rw. Reading gives "1" for analog output enabled and
"0" for analog output disabled. Writing accepts "0" and "1" accordingly.

The aout 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 aout_enable equals 1. Reading returns the last
value written.

On module initialization the chip is configured as followed :
- four single ended differential inputs
- analog output set to 0 and enabled


Chip Features
-------------

Chip `pcf8591'
          LABEL     LABEL CLASS   COMPUTE CLASS ACCESS MAGNITUDE
       ain_conf            NONE            NONE     RW     0
            ch0            NONE            NONE     R      0
            ch1            NONE            NONE     R      0
            ch2            NONE            NONE     R      0
            ch3            NONE            NONE     R      0
    aout_enable            NONE            NONE     RW     0
           aout            NONE            NONE     RW     0

          LABEL                   FEATURE SYMBOL     SYSCTL FILE:OFFSET
       ain_conf         SENSORS_PCF8591_AIN_CONF        ain_conf:1
            ch0              SENSORS_PCF8591_CH0         ain_ch0:1
            ch1              SENSORS_PCF8591_CH1         ain_ch1:1
            ch2              SENSORS_PCF8591_CH2         ain_ch2:1
            ch3              SENSORS_PCF8591_CH3         ain_ch3:1
    aout_enable      SENSORS_PCF8591_AOUT_ENABLE     aout_enable:1
           aout             SENSORS_PCF8591_AOUT            aout:1
