freebsd-dev/sys/dev/iicbus
Ian Lepore b897b02c6c Create a mechanism for encoding a system errno into the IIC_Exxxxx space.
Errors are communicated between the i2c controller layer and upper layers
(iicbus and slave device drivers) using a set of IIC_Exxxxxx constants which
effectively define a private number space separate from (and having values
that conflict with) the system errno number space. Sometimes it is necessary
to report a plain old system error (especially EINTR) from the controller or
bus layer and have that value make it back across the syscall interface
intact.

I initially considered replicating a few "crucial" errno values with similar
names and new numbers, e.g., IIC_EINTR, IIC_ERESTART, etc. It seemed like
that had the potential to grow over time until many of the errno names were
duplicated into the IIC_Exxxxx space.

So instead, this defines a mechanism to "encode" an errno into the IIC_Exxxx
space by setting the high bit and putting the errno into the lower-order
bits; a new errno2iic() function does this. The existing iic2errno()
recognizes the encoded values and extracts the original errno out of the
encoded value. An interesting wrinkle occurs with the pseudo-error values
such as ERESTART -- they aleady have the high bit set, and turning it off
would be the wrong thing to do. Instead, iic2errno() recognizes that lots of
high bits are on (i.e., it's a negative number near to zero) and just
returns that value as-is.

Thus, existing drivers continue to work without needing any changes, and
there is now a way to return errno values from the lower layers. The first
use of that is in iicbus_poll() which does mtx_sleep() with the PCATCH flag,
and needs to return the errno from that up the call chain.

Differential Revision:	https://reviews.freebsd.org/D20975
2019-09-14 19:33:36 +00:00
..
twsi twsi: Fix build when DEBUG is used on 32bits arch. 2019-08-15 18:59:52 +00:00
ad7417.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
ad7418.c Remove some unused header files from the ad7418 driver. 2019-06-23 17:20:39 +00:00
adm1030.c
ads111x.c Use a single write of 3 bytes instead of iicdev_writeto() in ads111x. 2019-09-05 19:17:53 +00:00
adt746x.c Clean up OF_getprop_alloc API 2018-04-08 22:59:34 +00:00
ds13rtc.c Add pnpinfo to all i2c drivers that have FDT compat data. 2019-05-23 18:24:27 +00:00
ds1307.c Add pnpinfo to all i2c drivers that have FDT compat data. 2019-05-23 18:24:27 +00:00
ds1307reg.h DS1307: Add the mcp7941x enable bit 2017-11-08 01:28:20 +00:00
ds1631.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
ds1672.c Build the ds1672 driver as a module. Add a detach() to unregister the rtc. 2018-03-06 02:30:34 +00:00
ds1775.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
ds3231.c Switch to the new bcd_clocktime conversion routines, and add calls to the 2018-03-05 00:15:56 +00:00
ds3231reg.h Bugfixes and enhancements... 2017-07-31 22:00:00 +00:00
icee.c Rename IICBUS_FDT_PNPINFO -> IICBUS_FDT_PNP_INFO because all the other 2019-05-23 16:03:30 +00:00
if_ic.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
iic_recover_bus.c Add iic_recover_bus(), a helper function that can be used by any i2c driver 2017-06-29 01:50:58 +00:00
iic_recover_bus.h Add iic_recover_bus(), a helper function that can be used by any i2c driver 2017-06-29 01:50:58 +00:00
iic.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
iic.h sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
iicbb_if.m
iicbb.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
iicbus_if.m Add a default implementation that returns ENODEV for start, repeat_start, 2017-09-11 23:47:49 +00:00
iicbus.c revert r273728 and parts of r306589, iicbus no-stop by default feature 2019-05-29 09:08:20 +00:00
iicbus.h Restore the ability for i2c slave devices to do IO from their probe method. 2019-07-08 20:26:56 +00:00
iicoc.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
iicoc.h sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
iiconf.c Create a mechanism for encoding a system errno into the IIC_Exxxxx space. 2019-09-14 19:33:36 +00:00
iiconf.h Create a mechanism for encoding a system errno into the IIC_Exxxxx space. 2019-09-14 19:33:36 +00:00
iicsmb.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
isl12xx.c Add pnpinfo to all i2c drivers that have FDT compat data. 2019-05-23 18:24:27 +00:00
lm75.c
max6690.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
nxprtc.c Add support for setting the aging/frequency-offset register via sysctl. 2019-07-21 17:14:39 +00:00
ofw_iicbus.c Allow i2c hardware drivers to declare their own relationships to ofw_iicbus 2018-02-18 19:33:28 +00:00
rtc8583.c Add pnpinfo to all i2c drivers that have FDT compat data. 2019-05-23 18:24:27 +00:00
s35390a.c Switch to the new bcd_clocktime conversion routines, and add calls to the 2018-03-05 00:43:53 +00:00
sy8106a.c Add pnpinfo to all i2c drivers that have FDT compat data. 2019-05-23 18:24:27 +00:00
syr827.c Add pnpinfo to all i2c drivers that have FDT compat data. 2019-05-23 18:24:27 +00:00