mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-18 11:09:32 +00:00
From: Aurelien Jarno <aurelien@aurel32.net> Hello, I have to use the pcf8574 chip with my I2C interface, however, the pcf8574 drivers in lm-sensors is a bit basic. It supposes the pin P1 is used as an input and the others pin as outputs. Attached is a patch which corrects that, providing to files in /proc interface, one for writting, the other for reading. It also modifies a bit the driver to support the pcf8574a (it is a pcf8574 with a different address range), and add a documentation file in doc/chips. The patch also includes some cosmetic changes in the pcf8591 driver I wrote previously, that is to say it modify the chip name in some places I had forgotten to change when I made a copy/paste from another driver. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1318 7894878c-1315-0410-8ee3-d5d059ff63e0
98 lines
3.3 KiB
Plaintext
98 lines
3.3 KiB
Plaintext
Kernel driver `pcf8574.o'
|
|
========================
|
|
|
|
Status: Status: Complete;
|
|
|
|
Supported chips:
|
|
* Philips PCF8574
|
|
Prefix: `pcf8574'
|
|
Addresses scanned: I2C 0x20 - 0x27 (inclusive)
|
|
Datasheet: Publicly available at the Philips Semiconductor website
|
|
http://semiconductors.philips.com/
|
|
|
|
* Philips PCF8574A
|
|
Prefix: `pcf8574a'
|
|
Addresses scanned: I2C 0x38 - 0x3f (inclusive)
|
|
Datasheet: Publicly available at the Philips Semiconductor website
|
|
http://semiconductors.philips.com/
|
|
|
|
|
|
Authors: Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>,
|
|
and Dan Eaton <dan.eaton@rocketlogix.com>
|
|
|
|
Module Parameters
|
|
-----------------
|
|
|
|
* force: short array (min = 1, max = 48)
|
|
List of adapter,address pairs to boldly assume to be present
|
|
* force_pcf8574: short array (min = 1, max = 48)
|
|
List of adapter,address pairs which are unquestionably assumed to
|
|
contain a `pcf8574' 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 PCF8574(A) is an 8-bit I/O expander for the I2C bus produced by Philips
|
|
Semiconductors. It is designed to provide a byte I2C interface to up to 16
|
|
separate devices (8 x PCF8574 and 8 x PCF8574A).
|
|
|
|
This device consists of a quasi-bidirectionnal port. Each of the eight I/Os
|
|
can be independently used as an input or output. To setup an I/O as an
|
|
input, you have to write a 1 to the corresponding output.
|
|
|
|
For more informations see the datasheet.
|
|
|
|
|
|
Accessing PCF8574(A) via /proc interface
|
|
-------------------------------------
|
|
|
|
! Be careful !
|
|
The PCF8574(A) is plainly impossible to detect ! Stupid chip.
|
|
So every chip with adress in the interval [20..27] and (38..3f) are
|
|
detected as PCF8574(A). 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 PCF8574(A):
|
|
|
|
/proc/sys/dev/sensors/pcf8574-<0>-<1>/
|
|
where <0> is the bus the chip was detected on (e. g. i2c-0)
|
|
and <1> the chip address ([20..27] or [38..3f]):
|
|
./pcf8574-i2c-0-27/
|
|
|
|
Inside these directories, there are two files each:
|
|
read and write.
|
|
|
|
The read file is read-only. Reading gives you the current I/O input
|
|
if the corresponding output is set as 1, otherwise the current output
|
|
value, that is to say 0.
|
|
|
|
The write file is read/write. Writing a value outputs it on the I/O
|
|
port. Reading return the last written value.
|
|
|
|
On module initialization the chip is configured as eight I/Os input (all
|
|
outputs to 1), so you can connect any circuit to the PCF8574(A) without
|
|
to be afraid of short-circuit.
|
|
|
|
|
|
Chip Features
|
|
-------------
|
|
|
|
Chip `pcf8574'
|
|
LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE
|
|
read NONE NONE R 0
|
|
write NONE NONE RW 0
|
|
|
|
LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET
|
|
read SENSORS_PCF8591_READ read:1
|
|
write SENSORS_PCF8591_WRITE write:1
|