diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2022-02-09 07:58:25 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2022-02-09 07:58:25 +0000 |
commit | badf3c55e7a1fd8f77fbfbe203f5ea736817b677 (patch) | |
tree | e3b600ddd4503f232ae79414998e2dc4da89fc8d /share/man | |
parent | e5a9220c6217b9923c1448c7956d0a6016b5e48c (diff) |
Add iic_is_compatible() for matching I2C devices
When using device trees, the ia_name field of struct i2c_attach_args
points to the first string of the device node's "compatible" array.
However, in many cases it would be preferable to use the last, most
general "compatible" entry as a device matching criterion.
Enable more flexible device matching by permitting ia_name to point to
the raw "compatible" data which is a concatenation of NUL-terminated
strings. I2C bus code will supply the data and set ia_name and
ia_namelen. I2C device drivers will use iic_is_compatible() to check
matches. This method is also backwards compatible with the old, direct
use of ia_name.
Prompted by a related patch from kettenis@.
OK kettenis@
Diffstat (limited to 'share/man')
-rw-r--r-- | share/man/man9/iic.9 | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/share/man/man9/iic.9 b/share/man/man9/iic.9 index 7fd3855910a..ce3bb00657c 100644 --- a/share/man/man9/iic.9 +++ b/share/man/man9/iic.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: iic.9,v 1.9 2015/11/23 17:53:57 jmc Exp $ +.\" $OpenBSD: iic.9,v 1.10 2022/02/09 07:58:24 visa Exp $ .\" .\" Copyright (c) 2003 Wasabi Systems, Inc. .\" All rights reserved. @@ -33,7 +33,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: November 23 2015 $ +.Dd $Mdocdate: February 9 2022 $ .Dt IIC_ACQUIRE_BUS 9 .Os .Sh NAME @@ -42,7 +42,8 @@ .Nm iic_exec , .Nm iic_smbus_write_byte , .Nm iic_smbus_read_byte , -.Nm iic_smbus_receive_byte +.Nm iic_smbus_receive_byte , +.Nm iic_is_compatible .Nd Inter IC (I2C) bus .Sh SYNOPSIS .In dev/i2c/i2cvar.h @@ -90,6 +91,11 @@ .Fa "uint8_t *datap" .Fa "int flags" .Fc +.Ft int +.Fo iic_is_compatible +.Fa "const struct i2c_attach_args *ia" +.Fa "const char *name" +.Fc .Sh DESCRIPTION I2C is a two-wire bus developed by Philips used for connecting integrated circuits. @@ -137,8 +143,11 @@ struct i2c_attach_args { i2c_addr_t ia_addr; /* address of device */ int ia_size; /* size (for EEPROMs) */ char *ia_name; /* chip name */ + size_t ia_namelen /* length of name concatenation */ void *ia_cookie; /* pass extra info from bus to dev */ + void *ia_intr /* interrupt info */ + int ia_poll; /* to force polling */ }; .Ed .El @@ -231,6 +240,9 @@ I2C_OP_READ_WITH_STOP with of 0 and .Fa len of 1. +.It Fn iic_is_compatible "ia" "name" +Test if the device is compatible with +.Fa name . .El .Sh CONTROLLER INTERFACE The I2C controller driver must fill in the function pointers of |