Home | History | Annotate | only in /src/sys/dev/i2c
History log of /src/sys/dev/i2c
RevisionDateAuthorComments
 1.5 21-Sep-2025  thorpej Add support for enumerating i2c devices directly from the platform
device tree. Direct configuration still looks for i2c-child-devices
property on the controller, and will use it if it exists in order to
ease transition.
 1.4 11-Mar-2025  brad A driver and userland utility for a couple of families of the
Microchip Technology / SMSC fan controller chips.

The driver and utility supports the:

o EMC2101 and EMC2101-R
o EMC2103-1, EMC2102-2 and EMC2103-4
o EMC2104
o EMC2106
o EMC2301
o EMC2302
o EMC2303
o EMC2305

The EMC210X family supports 1 or 2 fans with tachometer. Depending on
the chip, it may support 2 additional fans without tach and might
support a high side attachment (i.e. a fan, usually 5v, driven
directly from the chip and not PWM or DAC). All versions of EMC210X
support internal temperature measurements, and depending on the chip,
may support up to 5 additional temperature zones. The tachometers and
temperature measurements are provided to the system via the envsys(4)
framework. Some chip types support GPIO pins and support is provided
via the gpio(4) framework.

The EMC230X family supports 1, 2, 3 or 5 fans with the same number of
tachometers. No temperature zone or GPIO support. The tachometers
are provided to the system via the envsys(4) framework. The fan
support can be provided by PWM signaling or DAC.

The two chip families mostly do PWM signaling for the fan speed, but a
number of them support DAC output, a 0 to 3v or so voltage. When the
chip supports external temperature zones, this is done usually by a
bipolar NPN or PNP transister configured as a diode, but some of the
chip varients support thermistors.

The emcfan(4) kernel driver provides a simple read / write / seek
device in /dev/ to the register set in the chip. The heavy lifting is
done in the userland utility emcfanctl(8) which provides the ability
to read and write to any valid register and provides some basic higher
level commands to control fan behavior. The output is simple text
lines, or JSON.

The kernel driver does not reset or other mess with the chip, aside
from reading registers. It is entirely possible that something else
in any particular system is the major manager of the fan controller
and it would not do for the kernel driver to mess too much with the
attached device. All interactions are intentional via the userland
utility.

It is known that a EMC2301 is present on the Raspberry PI 4 Compute IO
module (not to be confused with the Raspberry PI 4 Compute module
itself) and there is a breakout board from Adafruit with a EMC2101 on
it. The chips themselves are pretty inexpensive from Mouser or
Digi-key and can be soldered using the simpler SMD soldering
techniques. A number of the variants are QFN packages, but the pads
are exposed to the side of the chip. No other external components are
required to use these fan controllers.
 1.3 02-Oct-2011  jmcneill branches: 1.3.92;
Install dev/i2c/i2c_io.h and implement the API in the iic(4) driver.
Obsolete the I2C_SCAN option as this can now be done from userland.
 1.2 11-Apr-2001  jdolecek Only install headers which are actually used by our userland. This
saves about 2.2MB under /usr/include/dev/. Discussed on tech-kern@
recently.

I HOPE to get the list right. The headers I left in are ones
used for MI tools and those whose usage I discovered by grep over tree sources.
Feel free to put needed includes back in if you encounter anything which
should not be removed from lists.
 1.1 12-Jun-1998  cgd branches: 1.1.14; 1.1.26;
Rework the way kernel include files are installed. In the new method,
as with user-land programs, include files are installed by each directory
in the tree that has includes to install. (This allows more flexibility
as to what gets installed, makes 'partial installs' easier, and gives us
more options as to which machines' includes get installed at any given
time.) The old SYS_INCLUDES={symlinks,copies} behaviours are _both_
still supported, though at least one bug in the 'symlinks' case is
fixed by this change. Include files can't be build before installation,
so directories that have includes as targets (e.g. dev/pci) have to move
those targets into a different Makefile.
 1.1.26.1 28-Feb-2002  nathanw Catch up to -current.
 1.1.14.1 21-Apr-2001  bouyer Sync with HEAD
 1.3.92.1 02-Aug-2025  perseant Sync with HEAD
 1.11 17-Sep-2025  thorpej These drivers conditionally support FDT (with an #ifdef). Rather than
blindly assume that i2c_attach_args::ia_cookie is an FDT phandle, consult
self's devhandle and, if the type is DEVHANDLE_TYPE_OF, exctract the phandle
from there.

XXX These drivers should probably become FDT-only (like many others already
are) because the functionality is questionable without information from the
device tree.
 1.10 08-Sep-2025  thorpej Garbage-collect fdtbus_todr_attach(); todr_attach() does all the
necessary work now.

kern/59630
 1.9 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.8 07-Sep-2025  thorpej Attach the AC100 RTC as a separate child device node.

XXX This driver doesn't really work without FDT.
 1.7 27-Jan-2021  thorpej branches: 1.7.4; 1.7.14;
Use DEVICE_COMPAT_EOL.
 1.6 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.5 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.4 27-Jul-2019  thorpej branches: 1.4.10;
No need to check cold to add I2C_F_POLL; the i2c API does it for us now.
 1.3 27-May-2019  jmcneill FDT-ize AC100 driver
 1.2 16-Jun-2018  thorpej branches: 1.2.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.1 07-Dec-2014  jmcneill branches: 1.1.2; 1.1.18; 1.1.20;
Add driver for X-Powers AC100 integrated audio codec and RTC subsystem.
Only RTC functionality implemented for now.
 1.1.20.1 25-Jun-2018  pgoyette Sync with HEAD
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 07-Dec-2014  jdolecek file ac100.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 07-Dec-2014  skrll file ac100.c was added on branch nick-nhusb on 2015-04-06 15:18:09 +0000
 1.2.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.2.1 10-Jun-2019  christos Sync with HEAD
 1.4.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.7.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.7.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.6 27-Jul-2019  thorpej No need to check cold to add I2C_F_POLL; the i2c API does it for us now.
 1.5 16-Jun-2018  thorpej branches: 1.5.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.4 30-Apr-2018  jmcneill act8846_match: filter on ia_addr (device is expected at 0x5a)
 1.3 02-Jan-2015  jmcneill branches: 1.3.2; 1.3.18; 1.3.20;
disable ACT_DEBUG, but still print current state at attach
 1.2 01-Jan-2015  jmcneill write reg value not target freq in act8846_set_voltage
 1.1 01-Jan-2015  jmcneill Add driver for Active-Semi ACT8846 Power Management controller.
 1.3.20.2 25-Jun-2018  pgoyette Sync with HEAD
 1.3.20.1 02-May-2018  pgoyette Synch with HEAD
 1.3.18.2 03-Dec-2017  jdolecek update from HEAD
 1.3.18.1 02-Jan-2015  jdolecek file act8846.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.3.2.2 06-Apr-2015  skrll Sync with HEAD
 1.3.2.1 02-Jan-2015  skrll file act8846.c was added on branch nick-nhusb on 2015-04-06 15:18:09 +0000
 1.5.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1 01-Jan-2015  jmcneill branches: 1.1.2; 1.1.18;
Add driver for Active-Semi ACT8846 Power Management controller.
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 01-Jan-2015  jdolecek file act8846.h was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 01-Jan-2015  skrll file act8846.h was added on branch nick-nhusb on 2015-04-06 15:18:09 +0000
 1.12 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.11 30-Jun-2025  macallan find sensor names etc. on older G5 like PowerMac7,2
 1.10 27-Jan-2021  thorpej branches: 1.10.4; 1.10.14; 1.10.24;
Use DEVICE_COMPAT_EOL.
 1.9 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.8 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.7 15-Jun-2019  macallan branches: 1.7.10;
explicitly initialize sensor->state
 1.6 26-Jun-2018  thorpej branches: 1.6.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.5 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.4 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.3 16-Mar-2018  macallan get EEPROM data from uni_n instead of poking around in OF
 1.2 09-Mar-2018  macallan branches: 1.2.2;
remove some unused code, add comments for credits & explanations
 1.1 09-Mar-2018  macallan yet another temperature sensor / ADC
this one supports Analog Devices AD7417, found in some G5 macs
depends on OpenFirmware for calibration data
 1.2.2.5 28-Jul-2018  pgoyette Sync with HEAD
 1.2.2.4 25-Jun-2018  pgoyette Sync with HEAD
 1.2.2.3 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.2.2.2 15-Mar-2018  pgoyette Synch with HEAD
 1.2.2.1 09-Mar-2018  pgoyette file adadc.c was added on branch pgoyette-compat on 2018-03-15 09:12:05 +0000
 1.6.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.10.24.1 02-Aug-2025  perseant Sync with HEAD
 1.10.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.10.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.32 03-Oct-2025  thorpej Use device_{get,set}prop_string() for sensor names.
 1.31 21-Sep-2025  thorpej Get the sensor descriptive information from our device properties
dictionary, rather than from a secondary dictionary passed in the
i2c_attach_args (this secondary dictionary is deprecated and going
away).
 1.30 24-Jan-2022  andvar remove double "with" in comments and usage text. Also fix one typo.
 1.29 21-Jun-2021  christos branches: 1.29.6;
fix proplib deprecation
 1.28 15-Jun-2021  mlelstv iic_acquire_bus may fail.
 1.27 30-Jan-2021  thorpej branches: 1.27.4;
If we're going to keep a reference on the "props" dictionary from
the i2c_attach_args, we should retain it.
 1.26 28-Jan-2021  thorpej Use iic_compatible_lookup() in admtemp_setflags().
 1.25 27-Jan-2021  thorpej Use DEVICE_COMPAT_EOL.
 1.24 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.23 24-Jan-2021  rin Use temperature sensors as rnd(9) sources.
 1.22 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.21 10-Dec-2020  jdc Handle failing to acquire the iic bus.
Better handle errors when attaching sysmon sensors.
 1.20 21-Aug-2020  macallan branches: 1.20.2;
get sensore names from properties, remove OF code
 1.19 26-Jun-2018  thorpej In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.18 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.17 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.16 29-Sep-2017  macallan branches: 1.16.2;
get sensor descriptions from OpenFirmware if we know how
this needs to be generalized
 1.15 20-Sep-2017  macallan add MAX6690 which seems to be a straight up ADM1032 clone
 1.14 13-Sep-2017  macallan MAX6642 does not have lower limit registers
 1.13 01-Sep-2017  macallan support MAX6642 - yet another adm1021 kinda-sorta clone
 1.12 04-Jan-2016  christos PR/50621: David Binderman: Wrap iic_exec() in a simpler utility function
and fix all the pointer/sizeof botches in the proces.
 1.11 03-Jan-2016  jdc Add display and setting of chip temperature limits for envsys(4).
Different chips are recognised where possible, and the appropriate limits
are displayed/settable.
 1.10 07-Dec-2015  jdc Use the destination buffer size when copying strings.
(Didn't matter in practice, because the destination was large enough.)
 1.9 27-Sep-2015  phx Direct config: Only match via the list of compatible hardware when we have
such a list available (ia_ncompat > 0). Otherwise fall back to matching
the device name with ia_name.
 1.8 27-Oct-2012  chs branches: 1.8.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.7 20-Jun-2011  pgoyette branches: 1.7.2; 1.7.12;
Initialize sensor state before registering.

XXX Still need to fix i2c/ibmhawk.c
 1.6 19-Jun-2011  martin Initialize sensor states to SINVALID
 1.5 11-Mar-2010  mrg branches: 1.5.8;
various aprint_* fixes.
 1.4 28-Feb-2010  martin Add direct config support for a few devices
 1.3 05-Jun-2009  hubertf branches: 1.3.2;
From the specs: address 0xff gives the die revision
 1.2 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.1 29-Oct-2008  jkunz branches: 1.1.6; 1.1.8; 1.1.10; 1.1.12; 1.1.16;
Ported alipm(4) and admtemp(4) from OpenBSD.
 1.1.16.6 11-Aug-2010  yamt sync with head.
 1.1.16.5 11-Mar-2010  yamt sync with head
 1.1.16.4 20-Jun-2009  yamt sync with head
 1.1.16.3 16-May-2009  yamt sync with head
 1.1.16.2 04-May-2009  yamt sync with head.
 1.1.16.1 29-Oct-2008  yamt file adm1021.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:38 +0000
 1.1.12.2 23-Jul-2009  jym Sync with HEAD.
 1.1.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.10.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.10.1 29-Oct-2008  skrll file adm1021.c was added on branch nick-hppapmap on 2009-01-19 13:17:53 +0000
 1.1.8.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.8.1 29-Oct-2008  mjf file adm1021.c was added on branch mjf-devfs2 on 2009-01-17 13:28:54 +0000
 1.1.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.6.1 29-Oct-2008  haad file adm1021.c was added on branch haad-dm on 2008-12-13 01:14:13 +0000
 1.3.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.5.8.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.7.12.2 03-Dec-2017  jdolecek update from HEAD
 1.7.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.7.2.1 30-Oct-2012  yamt sync with head
 1.8.14.2 19-Mar-2016  skrll Sync with HEAD
 1.8.14.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.16.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.16.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.20.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.20.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.27.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.27.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.29.6.1 10-Sep-2021  thorpej Remove unnecessary references to i2c_attach_args::ia_prop and mark the ones
that remain as XXX.
 1.13 14-Jun-2021  jdc Call sysmon_envsys_destroy() if we receive any error from sysmon, rather
than just on some errors.
 1.12 14-Jun-2021  mlelstv Avoid double free when attach fails.
 1.11 27-Jan-2021  thorpej branches: 1.11.4;
Use DEVICE_COMPAT_EOL.
 1.10 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.9 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.8 26-Jun-2020  martin branches: 1.8.2;
Avoid creating a full temporary softc struct on the stack.
 1.7 23-Dec-2019  thorpej No need to do the poll-during-autoconfiguration dance; the i2c code
does the right thing for us.
 1.6 11-Dec-2019  jdc Chip matching improvements:
only match for currently known addresses
don't generate messages when matching
Tested on Sun Blade 2500 by martin@.
 1.5 26-Jun-2018  thorpej branches: 1.5.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.4 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.3 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.2 11-Jan-2016  jdc branches: 1.2.16; 1.2.18;
Increase the number of read retries (to 5).
 1.1 16-Dec-2015  jdc branches: 1.1.2;
Add a driver for the ADM1026 Thermal System Management Fan Controller
i2c chip.
 1.1.2.3 19-Mar-2016  skrll Sync with HEAD
 1.1.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.1 16-Dec-2015  skrll file adm1026.c was added on branch nick-nhusb on 2015-12-27 12:09:49 +0000
 1.2.18.2 28-Jul-2018  pgoyette Sync with HEAD
 1.2.18.1 25-Jun-2018  pgoyette Sync with HEAD
 1.2.16.2 03-Dec-2017  jdolecek update from HEAD
 1.2.16.1 11-Jan-2016  jdolecek file adm1026.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.5.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.8.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.11.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.5 16-Apr-2020  rin Revert previous for now:
http://mail-index.netbsd.org/source-changes/2020/04/16/msg116278.html

The reasoning turned out to be wrong; __KERNEL_RCSID() in header files
does *not* overwrite RCSID in main source files. The real problem is that
it inserts its RCSID into *every* object files. However, it can be still
useful even if heavily duplicated.
 1.4 16-Apr-2020  rin Stop using __KERNEL_RCSID() in header files; it confuses ident(1) by
overwriting RCSID in main source files.

XXX
The first argument of __KERNEL_RCSID() is neglected for ELF. If we wish
to have RCSID of header files in kernel binary, we need something like
__FBSDID() macro in FreeBSD.
 1.3 11-Dec-2019  jdc branches: 1.3.6;
Chip matching improvements:
only match for currently known addresses
don't generate messages when matching
Tested on Sun Blade 2500 by martin@.
 1.2 13-Oct-2019  mrg set ADM1026_ADDRMASK as 0x2f, not 0x3f8.

GCC-8 complained about always false condition, which indicated
the bug. patch from jdc@.
 1.1 16-Dec-2015  jdc branches: 1.1.2; 1.1.18; 1.1.22;
Add a driver for the ADM1026 Thermal System Management Fan Controller
i2c chip.
 1.1.22.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 16-Dec-2015  jdolecek file adm1026reg.h was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.1.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.1 16-Dec-2015  skrll file adm1026reg.h was added on branch nick-nhusb on 2015-12-27 12:09:49 +0000
 1.3.6.1 20-Apr-2020  bouyer Sync with HEAD
 1.15 07-Oct-2008  pgoyette Remove chip-specific drivers for ADT7463, ADT7467, and ADM1030; these
have been superseded by the dbcool(4) driver.
 1.14 08-May-2008  macallan branches: 1.14.4;
nuke clause 3
 1.13 04-May-2008  xtraeme branches: 1.13.2;
device_t/softc split for adt7467c(4) and adm1030, and other related
cosmetic changes.
 1.12 06-Apr-2008  cegger branches: 1.12.2; 1.12.4;
use aprint_*_dev and device_xname
 1.11 17-Nov-2007  kefren branches: 1.11.14;
Initialize sensor's state
on behalf of xtraeme
 1.10 16-Nov-2007  xtraeme Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.9 01-Jul-2007  xtraeme branches: 1.9.6; 1.9.8; 1.9.12; 1.9.14;
There's no need to use another envsys_data_t pointer that points to
sme->sme_sensor_data again, just use the edata pointer passed in
the gtredata function.
 1.8 01-Jul-2007  xtraeme Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.7 05-Jan-2007  jmcneill branches: 1.7.6; 1.7.8;
Remove include of machine/autoconf.h to make this compile.
 1.6 29-Mar-2006  thorpej branches: 1.6.6; 1.6.10;
Use device_private().
 1.5 17-Feb-2006  macallan branches: 1.5.2; 1.5.4; 1.5.6;
back out previous commit
 1.4 17-Feb-2006  macallan set I2C_OP_WRITE when passing a write buffer to iic_exec()
 1.3 11-Dec-2005  christos branches: 1.3.2; 1.3.4; 1.3.6;
merge ktrace-lwp.
 1.2 11-Sep-2005  macallan branches: 1.2.6;
Shuffle thermal sensor numbering so temp0 is always the on-chip sensor and temp1
is always CPU temperature.
 1.1 10-Aug-2005  macallan added drivers for Analog Devices ADT7467 and ADM1030 thermal monitor / fan controller chips found in various Apple laptops and probably other machines.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 11-Sep-2005  skrll file adm1030.c was added on branch ktrace-lwp on 2005-11-10 14:04:00 +0000
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3.2.1 18-Feb-2006  yamt sync with head.
 1.5.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.5.4.1 19-Apr-2006  elad sync with head.
 1.5.2.1 01-Apr-2006  yamt sync with head.
 1.6.10.1 12-Jan-2007  ad Sync with head.
 1.6.6.5 07-Dec-2007  yamt sync with head
 1.6.6.4 03-Sep-2007  yamt sync with head.
 1.6.6.3 26-Feb-2007  yamt sync with head.
 1.6.6.2 21-Jun-2006  yamt sync with head.
 1.6.6.1 29-Mar-2006  yamt file adm1030.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.7.8.1 11-Jul-2007  mjf Sync with head.
 1.7.6.1 15-Jul-2007  ad Sync with head.
 1.9.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.9.12.1 18-Nov-2007  bouyer Sync with HEAD
 1.9.8.1 09-Jan-2008  matt sync with HEAD
 1.9.6.1 21-Nov-2007  joerg Sync with HEAD.
 1.11.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.11.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.4.2 04-May-2009  yamt sync with head.
 1.12.4.1 16-May-2008  yamt sync with head.
 1.12.2.1 18-May-2008  yamt sync with head.
 1.13.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.13.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.14.4.1 19-Oct-2008  haad Sync with HEAD.
 1.7 07-Oct-2008  pgoyette Remove chip-specific drivers for ADT7463, ADT7467, and ADM1030; these
have been superseded by the dbcool(4) driver.
 1.6 08-May-2008  macallan branches: 1.6.4;
nuke clause 3
 1.5 04-May-2008  xtraeme branches: 1.5.2;
device_t/softc split for adt7467c(4) and adm1030, and other related
cosmetic changes.
 1.4 16-Nov-2007  xtraeme branches: 1.4.14; 1.4.16; 1.4.18;
Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.3 05-Jan-2007  jmcneill branches: 1.3.18; 1.3.20; 1.3.24; 1.3.26;
Remove include of machine/autoconf.h to make this compile.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.22;
merge ktrace-lwp.
 1.1 10-Aug-2005  macallan branches: 1.1.6;
added drivers for Analog Devices ADT7467 and ADM1030 thermal monitor / fan controller chips found in various Apple laptops and probably other machines.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 10-Aug-2005  skrll file adm1030var.h was added on branch ktrace-lwp on 2005-11-10 14:04:00 +0000
 1.2.22.1 12-Jan-2007  ad Sync with head.
 1.2.18.4 07-Dec-2007  yamt sync with head
 1.2.18.3 26-Feb-2007  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file adm1030var.h was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.3.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.3.24.1 18-Nov-2007  bouyer Sync with HEAD
 1.3.20.1 09-Jan-2008  matt sync with HEAD
 1.3.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.4.18.2 04-May-2009  yamt sync with head.
 1.4.18.1 16-May-2008  yamt sync with head.
 1.4.16.1 18-May-2008  yamt sync with head.
 1.4.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.5.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.4.1 19-Oct-2008  haad Sync with HEAD.
 1.18 07-Oct-2008  pgoyette Remove chip-specific drivers for ADT7463, ADT7467, and ADM1030; these
have been superseded by the dbcool(4) driver.
 1.17 08-Sep-2008  pgoyette Provide correct URL for current data sheet. This device is now owned
by ON Semi.
 1.16 07-Sep-2008  pgoyette Note that previous URL for ADT7463 datasheet is no longer operative, and
provide link to an earlier, but still active, revision.
 1.15 04-Apr-2008  xtraeme branches: 1.15.4; 1.15.6; 1.15.10;
Split device_t/softc and other related cosmetic changes.
 1.14 16-Nov-2007  njoly branches: 1.14.14;
Set sensor state to ENVSYS_SVALID for correct values. Otherwise,
envstat(8) will report an unknown state and won't print the sensor
value.

ok by xtraeme.
 1.13 16-Nov-2007  xtraeme Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.12 25-Jul-2007  njoly branches: 1.12.4; 1.12.6; 1.12.10; 1.12.12; 1.12.14;
Add missing STOP conditions at the end of I2C operations.
 1.11 11-Jul-2007  njoly branches: 1.11.2;
Mark sensor as invalid if no fan is connected.

ok by xtraeme
 1.10 02-Jul-2007  xtraeme adt74673_refresh_{fan,temp,volt}: use the edata pointer rather than
using softc's edata array index.
 1.9 01-Jul-2007  xtraeme Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.8 15-Jun-2007  christos KNF, from Anon Ymous. Also kill extra unneeded initializers and use size_t
for indexes.
 1.7 14-Jun-2007  christos Eliminate unnessary floating point.
XXX: someone should KNF this file.
 1.6 16-Nov-2006  christos branches: 1.6.2; 1.6.8; 1.6.10; 1.6.16;
__unused removal on arguments; approved by core.
 1.5 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.4 30-Apr-2006  xtraeme branches: 1.4.6; 1.4.10; 1.4.12; 1.4.14;
PR kern/32885: adt7463 i2c device does not always unlock i2c bus on error.
Apply patch from Nicolas Joly.
 1.3 29-Mar-2006  thorpej branches: 1.3.2;
Use device_private().
 1.2 19-Feb-2006  xtraeme branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.10;
* Add missing $NetBSD$ tag and __KERNEL_RCSID.
* Nuke completely __P().
 1.1 19-Feb-2006  tls Add support for i2c bus on AMD-8111 used on many Opteron server motherboards,
and ADT 7463c thermal and voltage monitor found on the Tyan S2881 and S2882-D
(and probably other boards as well). We do not currently support any kind
of detection of the i2c address of the thermal monitor; it appears to be
at 0x2D on the S2881 and 0x2E on the S2882-D (kernel config examples
forthcoming).

From PR kern/32463 submitted by Anil Gopinath, anil_public@yahoo.com.
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.2.8.2 11-May-2006  elad sync with head
 1.2.8.1 19-Apr-2006  elad sync with head.
 1.2.6.2 24-May-2006  yamt sync with head.
 1.2.6.1 01-Apr-2006  yamt sync with head.
 1.2.4.2 01-Mar-2006  yamt sync with head.
 1.2.4.1 19-Feb-2006  yamt file adt7463.c was added on branch yamt-uio_vmspace on 2006-03-01 09:28:12 +0000
 1.2.2.2 20-Feb-2006  tron Pull up following revision(s) (requested by tls in ticket #1179):
sys/dev/pci/amdpm.c: revision 1.11
sys/dev/i2c/files.i2c: revision 1.7
sys/dev/i2c/adt7463.c: revision 1.1
sys/dev/pci/files.pci: revision 1.242 via patch
sys/dev/pci/amdpmvar.h: revision 1.1
sys/dev/i2c/adt7463reg.h: revision 1.1
sys/dev/DEVNAMES: revision 1.192 via patch
sys/dev/pci/amdpm_smbus.c: revision 1.1
sys/dev/pci/amdpm_smbusreg.h: revision 1.1
Add support for i2c bus on AMD-8111 used on many Opteron server motherboards,
and ADT 7463c thermal and voltage monitor found on the Tyan S2881 and S2882-D
(and probably other boards as well). We do not currently support any kind
of detection of the i2c address of the thermal monitor; it appears to be
at 0x2D on the S2881 and 0x2E on the S2882-D (kernel config examples
forthcoming).
From PR kern/32463 submitted by Anil Gopinath, anil_public@yahoo.com.
 1.2.2.1 19-Feb-2006  tron file adt7463.c was added on branch netbsd-3 on 2006-02-20 23:00:27 +0000
 1.3.2.3 01-Jun-2006  kardel Sync with head.
 1.3.2.2 22-Apr-2006  simonb Sync with head.
 1.3.2.1 29-Mar-2006  simonb file adt7463.c was added on branch simonb-timecounters on 2006-04-22 11:38:52 +0000
 1.4.14.2 10-Dec-2006  yamt sync with head.
 1.4.14.1 22-Oct-2006  yamt sync with head
 1.4.12.2 09-Sep-2006  rpaulo sync with head
 1.4.12.1 30-Apr-2006  rpaulo file adt7463.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:51 +0000
 1.4.10.1 18-Nov-2006  ad Sync with head.
 1.4.6.5 07-Dec-2007  yamt sync with head
 1.4.6.4 03-Sep-2007  yamt sync with head.
 1.4.6.3 30-Dec-2006  yamt sync with head.
 1.4.6.2 21-Jun-2006  yamt sync with head.
 1.4.6.1 30-Apr-2006  yamt file adt7463.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.6.16.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.6.10.1 11-Jul-2007  mjf Sync with head.
 1.6.8.2 20-Aug-2007  ad Sync with HEAD.
 1.6.8.1 15-Jul-2007  ad Sync with head.
 1.6.2.1 15-Jun-2007  liamjfoy Pull up following revision(s) (requested by xtraeme in ticket #723):
sys/dev/i2c/adt7463.c: revision 1.7
sys/dev/i2c/adt7463reg.h: revision 1.4
Eliminate unnessary floating point.
XXX: someone should KNF this file.
 1.11.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.12.14.2 25-Jul-2007  njoly Add missing STOP conditions at the end of I2C operations.
 1.12.14.1 25-Jul-2007  njoly file adt7463.c was added on branch matt-mips64 on 2007-07-25 11:18:16 +0000
 1.12.12.1 19-Nov-2007  mjf Sync with HEAD.
 1.12.10.1 18-Nov-2007  bouyer Sync with HEAD
 1.12.6.1 09-Jan-2008  matt sync with HEAD
 1.12.4.1 21-Nov-2007  joerg Sync with HEAD.
 1.14.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.14.14.2 28-Sep-2008  mjf Sync with HEAD.
 1.14.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.10.1 19-Oct-2008  haad Sync with HEAD.
 1.15.6.2 10-Oct-2008  skrll Sync with HEAD.
 1.15.6.1 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.15.4.1 04-May-2009  yamt sync with head.
 1.9 07-Oct-2008  pgoyette Remove chip-specific drivers for ADT7463, ADT7467, and ADM1030; these
have been superseded by the dbcool(4) driver.
 1.8 04-Apr-2008  xtraeme branches: 1.8.4; 1.8.6; 1.8.10;
Split device_t/softc and other related cosmetic changes.
 1.7 16-Nov-2007  xtraeme branches: 1.7.14;
Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.6 01-Jul-2007  xtraeme branches: 1.6.6; 1.6.8; 1.6.12; 1.6.14;
Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.5 15-Jun-2007  christos KNF, from Anon Ymous. Also kill extra unneeded initializers and use size_t
for indexes.
 1.4 14-Jun-2007  christos Eliminate unnessary floating point.
XXX: someone should KNF this file.
 1.3 15-Apr-2007  njoly Fix envsys ranges.
 1.2 19-Feb-2006  xtraeme branches: 1.2.2; 1.2.4; 1.2.12; 1.2.18; 1.2.24; 1.2.28; 1.2.30; 1.2.34; 1.2.36; 1.2.42;
* Add missing $NetBSD$ tag and __KERNEL_RCSID.
* Nuke completely __P().
 1.1 19-Feb-2006  tls Add support for i2c bus on AMD-8111 used on many Opteron server motherboards,
and ADT 7463c thermal and voltage monitor found on the Tyan S2881 and S2882-D
(and probably other boards as well). We do not currently support any kind
of detection of the i2c address of the thermal monitor; it appears to be
at 0x2D on the S2881 and 0x2E on the S2882-D (kernel config examples
forthcoming).

From PR kern/32463 submitted by Anil Gopinath, anil_public@yahoo.com.
 1.2.42.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.2.36.1 11-Jul-2007  mjf Sync with head.
 1.2.34.2 15-Jul-2007  ad Sync with head.
 1.2.34.1 27-May-2007  ad Sync with head.
 1.2.30.1 07-May-2007  yamt sync with head.
 1.2.28.1 15-Jun-2007  liamjfoy Pull up following revision(s) (requested by xtraeme in ticket #723):
sys/dev/i2c/adt7463.c: revision 1.7
sys/dev/i2c/adt7463reg.h: revision 1.4
Eliminate unnessary floating point.
XXX: someone should KNF this file.
 1.2.24.2 09-Sep-2006  rpaulo sync with head
 1.2.24.1 19-Feb-2006  rpaulo file adt7463reg.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:51 +0000
 1.2.18.4 07-Dec-2007  yamt sync with head
 1.2.18.3 03-Sep-2007  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 19-Feb-2006  yamt file adt7463reg.h was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.2.12.2 22-Apr-2006  simonb Sync with head.
 1.2.12.1 19-Feb-2006  simonb file adt7463reg.h was added on branch simonb-timecounters on 2006-04-22 11:38:52 +0000
 1.2.4.2 01-Mar-2006  yamt sync with head.
 1.2.4.1 19-Feb-2006  yamt file adt7463reg.h was added on branch yamt-uio_vmspace on 2006-03-01 09:28:12 +0000
 1.2.2.2 20-Feb-2006  tron Pull up following revision(s) (requested by tls in ticket #1179):
sys/dev/pci/amdpm.c: revision 1.11
sys/dev/i2c/files.i2c: revision 1.7
sys/dev/i2c/adt7463.c: revision 1.1
sys/dev/pci/files.pci: revision 1.242 via patch
sys/dev/pci/amdpmvar.h: revision 1.1
sys/dev/i2c/adt7463reg.h: revision 1.1
sys/dev/DEVNAMES: revision 1.192 via patch
sys/dev/pci/amdpm_smbus.c: revision 1.1
sys/dev/pci/amdpm_smbusreg.h: revision 1.1
Add support for i2c bus on AMD-8111 used on many Opteron server motherboards,
and ADT 7463c thermal and voltage monitor found on the Tyan S2881 and S2882-D
(and probably other boards as well). We do not currently support any kind
of detection of the i2c address of the thermal monitor; it appears to be
at 0x2D on the S2881 and 0x2E on the S2882-D (kernel config examples
forthcoming).
From PR kern/32463 submitted by Anil Gopinath, anil_public@yahoo.com.
 1.2.2.1 19-Feb-2006  tron file adt7463reg.h was added on branch netbsd-3 on 2006-02-20 23:00:27 +0000
 1.6.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.6.12.1 18-Nov-2007  bouyer Sync with HEAD
 1.6.8.1 09-Jan-2008  matt sync with HEAD
 1.6.6.1 21-Nov-2007  joerg Sync with HEAD.
 1.7.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.7.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.10.1 19-Oct-2008  haad Sync with HEAD.
 1.8.6.1 10-Oct-2008  skrll Sync with HEAD.
 1.8.4.1 04-May-2009  yamt sync with head.
 1.16 07-Oct-2008  pgoyette Remove chip-specific drivers for ADT7463, ADT7467, and ADM1030; these
have been superseded by the dbcool(4) driver.
 1.15 17-Sep-2008  pgoyette Add verification of proper chip before blindly matching for consistency
with other drivers (notably adt7463).

NOTE: The verify routine in _both_ drivers might better be placed in-line
in the _match() routine. But these drivers will soon be superseded by the
dbcool driver any way.

OK gmcgarry@
 1.14 08-Sep-2008  pgoyette Fix typo - no functional changes.

OK macallan@
 1.13 08-May-2008  macallan branches: 1.13.4;
nuke clause 3
 1.12 04-May-2008  xtraeme branches: 1.12.2;
device_t/softc split for adt7467c(4) and adm1030, and other related
cosmetic changes.
 1.11 06-Apr-2008  cegger branches: 1.11.2; 1.11.4;
use aprint_*_dev and device_xname
 1.10 17-Nov-2007  kefren branches: 1.10.14;
Initialize sensor's state
on behalf of xtraeme
 1.9 16-Nov-2007  xtraeme Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.8 01-Jul-2007  xtraeme branches: 1.8.6; 1.8.8; 1.8.12; 1.8.14;
There's no need to use another envsys_data_t pointer that points to
sme->sme_sensor_data again, just use the edata pointer passed in
the gtredata function.
 1.7 01-Jul-2007  xtraeme Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.6 29-Mar-2006  thorpej branches: 1.6.6; 1.6.20; 1.6.22;
Use device_private().
 1.5 17-Feb-2006  macallan branches: 1.5.2; 1.5.4; 1.5.6;
back out previous commit
 1.4 17-Feb-2006  macallan set I2C_OP_WRITE when passing a write buffer to iic_exec()
 1.3 11-Dec-2005  christos branches: 1.3.2; 1.3.4; 1.3.6;
merge ktrace-lwp.
 1.2 11-Sep-2005  macallan branches: 1.2.6;
Shuffle thermal sensor numbering so temp0 is always the on-chip sensor and temp1
is always CPU temperature.
 1.1 10-Aug-2005  macallan added drivers for Analog Devices ADT7467 and ADM1030 thermal monitor / fan controller chips found in various Apple laptops and probably other machines.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 11-Sep-2005  skrll file adt7467.c was added on branch ktrace-lwp on 2005-11-10 14:04:00 +0000
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3.2.1 18-Feb-2006  yamt sync with head.
 1.5.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.5.4.1 19-Apr-2006  elad sync with head.
 1.5.2.1 01-Apr-2006  yamt sync with head.
 1.6.22.1 11-Jul-2007  mjf Sync with head.
 1.6.20.1 15-Jul-2007  ad Sync with head.
 1.6.6.4 07-Dec-2007  yamt sync with head
 1.6.6.3 03-Sep-2007  yamt sync with head.
 1.6.6.2 21-Jun-2006  yamt sync with head.
 1.6.6.1 29-Mar-2006  yamt file adt7467.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.8.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.8.12.1 18-Nov-2007  bouyer Sync with HEAD
 1.8.8.1 09-Jan-2008  matt sync with HEAD
 1.8.6.1 21-Nov-2007  joerg Sync with HEAD.
 1.10.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.10.14.2 28-Sep-2008  mjf Sync with HEAD.
 1.10.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.4.2 04-May-2009  yamt sync with head.
 1.11.4.1 16-May-2008  yamt sync with head.
 1.11.2.1 18-May-2008  yamt sync with head.
 1.12.2.3 10-Oct-2008  skrll Sync with HEAD.
 1.12.2.2 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.12.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.13.4.1 19-Oct-2008  haad Sync with HEAD.
 1.9 07-Oct-2008  pgoyette Remove chip-specific drivers for ADT7463, ADT7467, and ADM1030; these
have been superseded by the dbcool(4) driver.
 1.8 17-Sep-2008  pgoyette Add verification of proper chip before blindly matching for consistency
with other drivers (notably adt7463).

NOTE: The verify routine in _both_ drivers might better be placed in-line
in the _match() routine. But these drivers will soon be superseded by the
dbcool driver any way.

OK gmcgarry@
 1.7 08-Sep-2008  pgoyette Fix typo - no functional changes.

OK macallan@
 1.6 08-May-2008  macallan branches: 1.6.4;
nuke clause 3
 1.5 04-May-2008  xtraeme branches: 1.5.2;
device_t/softc split for adt7467c(4) and adm1030, and other related
cosmetic changes.
 1.4 16-Nov-2007  xtraeme branches: 1.4.14; 1.4.16; 1.4.18;
Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.3 02-Sep-2007  macallan branches: 1.3.4; 1.3.6;
don't include machine/autoconf.h - we don't need it (anymore?)
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.32; 1.2.42; 1.2.46; 1.2.48;
merge ktrace-lwp.
 1.1 10-Aug-2005  macallan branches: 1.1.6;
added drivers for Analog Devices ADT7467 and ADM1030 thermal monitor / fan controller chips found in various Apple laptops and probably other machines.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 10-Aug-2005  skrll file adt7467var.h was added on branch ktrace-lwp on 2005-11-10 14:04:00 +0000
 1.2.48.2 09-Jan-2008  matt sync with HEAD
 1.2.48.1 06-Nov-2007  matt sync with HEAD
 1.2.46.2 21-Nov-2007  joerg Sync with HEAD.
 1.2.46.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.2.42.1 03-Sep-2007  skrll Sync with HEAD.
 1.2.32.1 09-Oct-2007  ad Sync with head.
 1.2.18.4 07-Dec-2007  yamt sync with head
 1.2.18.3 03-Sep-2007  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file adt7467var.h was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.3.6.1 19-Nov-2007  mjf Sync with HEAD.
 1.3.4.1 18-Nov-2007  bouyer Sync with HEAD
 1.4.18.2 04-May-2009  yamt sync with head.
 1.4.18.1 16-May-2008  yamt sync with head.
 1.4.16.1 18-May-2008  yamt sync with head.
 1.4.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.4.14.2 28-Sep-2008  mjf Sync with HEAD.
 1.4.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.2.3 10-Oct-2008  skrll Sync with HEAD.
 1.5.2.2 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.5.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.4.1 19-Oct-2008  haad Sync with HEAD.
 1.1 17-Nov-2022  brad A driver for the Aosong AHT20 temperature and humidity sensor. While
slow for an I2C sensor it is inexpensive and should work well enough
in most indoor conditions. All features of the chip are supported.
 1.1 17-Nov-2022  brad A driver for the Aosong AHT20 temperature and humidity sensor. While
slow for an I2C sensor it is inexpensive and should work well enough
in most indoor conditions. All features of the chip are supported.
 1.1 17-Nov-2022  brad A driver for the Aosong AHT20 temperature and humidity sensor. While
slow for an I2C sensor it is inexpensive and should work well enough
in most indoor conditions. All features of the chip are supported.
 1.7 30-Mar-2022  pgoyette These modules need to depend on iic, not just on i2cexec. (They will
still recursively get i2cexec since the iic depends on it.)

Partial fix for kern/56772
 1.6 15-Jun-2021  mlelstv avoid double-free
 1.5 17-Jun-2018  thorpej branches: 1.5.20;
Oops, another one.
 1.4 17-Jun-2018  thorpej Remove now-unused variable.
 1.3 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.2 30-Dec-2017  christos branches: 1.2.2;
fixes from Brad Spenser
 1.1 28-Dec-2017  christos PR/52848: Brad Spencer: Two environment sensor drivers: AM2315 and SI70xx
XXX: Please check that my refactoring did not break them!
 1.2.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.5.20.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.2 29-Dec-2017  christos add RCSID's
 1.1 28-Dec-2017  christos PR/52848: Brad Spencer: Two environment sensor drivers: AM2315 and SI70xx
XXX: Please check that my refactoring did not break them!
 1.2 29-Dec-2017  christos add RCSID's
 1.1 28-Dec-2017  christos PR/52848: Brad Spencer: Two environment sensor drivers: AM2315 and SI70xx
XXX: Please check that my refactoring did not break them!
 1.9 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.8 19-Dec-2021  riastradh Sort includes.
 1.7 19-Dec-2021  riastradh Get drm to build on arm64 again.


Author: Jared McNeill <jmcneill@NetBSD.org>
Committer: Taylor R Campbell <riastradh@NetBSD.org>
 1.6 27-Jan-2021  thorpej branches: 1.6.4; 1.6.14;
Use DEVICE_COMPAT_EOL.
 1.5 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.4 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.3 01-Jan-2020  thorpej branches: 1.3.8;
No need to use I2C_F_POLL here.
 1.2 03-Feb-2019  jmcneill branches: 1.2.4;
Broadcast PMF display on/off events when our connector is handling dpms so we can turn off the backlight
 1.1 03-Feb-2019  jmcneill Add basic support for Analogix eDP transmitters. This driver doesn't
know how to mode set yet -- it only knows how to read EDID from a panel.
 1.2.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 03-Feb-2019  christos file anxedp.c was added on branch phil-wifi on 2019-06-10 22:07:09 +0000
 1.3.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.6.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.27 17-Sep-2025  thorpej These drivers conditionally support FDT (with an #ifdef). Rather than
blindly assume that i2c_attach_args::ia_cookie is an FDT phandle, consult
self's devhandle and, if the type is DEVHANDLE_TYPE_OF, exctract the phandle
from there.

XXX These drivers should probably become FDT-only (like many others already
are) because the functionality is questionable without information from the
device tree.
 1.26 08-Sep-2025  thorpej Garbage-collect fdtbus_todr_attach(); todr_attach() does all the
necessary work now.

kern/59630
 1.25 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.24 07-Aug-2021  thorpej branches: 1.24.2;
Merge thorpej-cfargs2.
 1.23 24-Apr-2021  thorpej branches: 1.23.2; 1.23.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.22 27-Jan-2021  thorpej branches: 1.22.2;
Use DEVICE_COMPAT_EOL.
 1.21 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.20 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.19 04-Jan-2020  thorpej branches: 1.19.8;
No need to use I2C_F_POLL here.
 1.18 23-Dec-2019  thorpej In as3722_poweroff and as3722_reboot(), check for errors from iic_acquire_bus()
before proceeding with writing to the device.
 1.17 23-Dec-2019  thorpej No need to do the poll-during-autoconfiguration dance; the i2c code
does the right thing for us.
 1.16 27-Jul-2019  thorpej No need to check cold to add I2C_F_POLL; the i2c API does it for us now.
 1.15 26-Jun-2018  thorpej branches: 1.15.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.14 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.13 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.12 28-May-2017  jmcneill branches: 1.12.8; 1.12.10;
Add facility for fdt devices to register reset and poweroff handlers.
Use this to remove as3722-specific code in tegra_machdep.c
 1.11 29-Apr-2017  jakllsch - Recognize the AS3722 sd0_v_minus_200mV bit, which is 1 on my Jetson TK1.
- Reduce intended core voltage for Tegra K1 124 by 200mV to 1.2V.

The actual value programmed into the SD0 regulator remains the same (0x50),
a value corresponding to 1.20V.
 1.10 29-Apr-2017  jakllsch Add AS3722 SD4 regulator frobbing bits.

Reduces aprint_error counter with TEGRA kernel on Jetson TK1 to 1 from 3.
 1.9 22-Apr-2017  jmcneill branches: 1.9.2;
remove unused field in softc
 1.8 22-Apr-2017  jmcneill Add SD0 regulator.
 1.7 22-Apr-2017  jmcneill Add LDO6 regulator support.
 1.6 22-Apr-2017  jmcneill Add support for AS3722 RTC.
 1.5 23-Jul-2016  jakllsch Fix typo in string.

This is a driver for the AS3722 PMIC, not the AS3822 LED driver.
 1.4 13-Dec-2015  jmcneill branches: 1.4.2; 1.4.4;
Support direct config.
 1.3 21-Nov-2015  jmcneill expose pmic reset functionality
 1.2 21-Nov-2015  jmcneill add watchdog support
 1.1 11-Nov-2015  jmcneill Add basic driver for AMS AS3722 power management IC
 1.4.4.2 26-Apr-2017  pgoyette Sync with HEAD
 1.4.4.1 26-Jul-2016  pgoyette Sync with HEAD
 1.4.2.4 28-Aug-2017  skrll Sync with HEAD
 1.4.2.3 05-Oct-2016  skrll Sync with HEAD
 1.4.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.4.2.1 13-Dec-2015  skrll file as3722.c was added on branch nick-nhusb on 2015-12-27 12:09:49 +0000
 1.9.2.1 02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.12.10.2 28-Jul-2018  pgoyette Sync with HEAD
 1.12.10.1 25-Jun-2018  pgoyette Sync with HEAD
 1.12.8.2 03-Dec-2017  jdolecek update from HEAD
 1.12.8.1 28-May-2017  jdolecek file as3722.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.15.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.15.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.19.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.22.2.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.23.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.23.2.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.24.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.2 21-Nov-2015  jmcneill branches: 1.2.2; 1.2.18;
expose pmic reset functionality
 1.1 11-Nov-2015  jmcneill Add basic driver for AMS AS3722 power management IC
 1.2.18.2 03-Dec-2017  jdolecek update from HEAD
 1.2.18.1 21-Nov-2015  jdolecek file as3722.h was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.2.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.2.2.1 21-Nov-2015  skrll file as3722.h was added on branch nick-nhusb on 2015-12-27 12:09:49 +0000
 1.4 27-Jan-2021  thorpej Use DEVICE_COMPAT_EOL.
 1.3 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.2 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.1 24-Apr-2020  macallan branches: 1.1.2; 1.1.4;
a very preliminary driver for the acclerometer found in later *Books
register definitions from OpenBSD
 1.1.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1.2.2 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.1.2.1 24-Apr-2020  bouyer file asms.c was added on branch bouyer-xenpvh on 2020-04-25 11:23:59 +0000
 1.41 28-Jan-2021  thorpej No need to consult ia->ia_ncompat before calling iic_compatible_lookup().
 1.40 27-Jan-2021  thorpej Use DEVICE_COMPAT_EOL.
 1.39 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.38 18-Jan-2021  thorpej Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup(). This pattern is less awkward to use.
 1.37 17-Jan-2021  thorpej Change the device_compatible_entry struct to have a union of
a scalar value (uintptr_t value) and a pointer value (const void *data),
rather than just "uintptr_t data". This eliminates the need for drivers
to cast this value, and doesn't lose const'ness of pointers assigned
to the field.

Update all of the users of this field to use the correct set of
designated initialisers for each specific case.
 1.36 15-Jan-2020  thorpej branches: 1.36.6;
tsleep -> kpause
 1.35 23-Dec-2019  thorpej branches: 1.35.2;
Oops, missed one more instance of unneeded-I2C_F_POLL.
 1.34 23-Dec-2019  thorpej seeprom_bootstrap_read(): no need to hard-code I2C_F_POLL here because
the i2c code will ensure it's there if the system is cold.
 1.33 29-Nov-2019  hkenken Support more than 128Kbit model.
 1.32 27-Oct-2019  jmcneill Add atmel,24c256 compat data
 1.31 26-Mar-2019  mlelstv branches: 1.31.4;
provide compatible names for all sizes.
 1.30 26-Jun-2018  thorpej branches: 1.30.2;
Remove the i2c "size" locator and corresponding property / attach arg.
It was a hack meant only for EEPROMs, which have another way to specify
size in the config directive ("flag" paramter), as well as a better way
to detect size based on "compatible" string.
 1.29 26-Jun-2018  thorpej Encode the size information in the compat data.
 1.28 26-Jun-2018  thorpej In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.27 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.26 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.25 28-Oct-2017  riastradh branches: 1.25.2;
Kill some more extern struct cfdriver declarations.

Down with externs in .c!
 1.24 21-Oct-2017  jmcneill match atmel,24c16
 1.23 10-Sep-2016  jakllsch Iterate over ia_ncompat array properly.
 1.22 23-Jul-2016  jakllsch Also check the compatibles table when the size is below zero.

Fixes an aprint_error() on Jetson TK1.
 1.21 13-Dec-2015  jmcneill branches: 1.21.2;
Support direct config.
 1.20 27-Sep-2015  phx Direct config: Only match via the list of compatible hardware when we have
such a list available (ia_ncompat > 0). Otherwise fall back to matching
the device name with ia_name.
 1.19 10-May-2015  jmcneill Many I2C drivers hold spin locks between iic_acquire_bus / iic_release_bus.
Avoid sleeping while owning the I2C bus.
 1.18 25-Jul-2014  dholland branches: 1.18.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.17 16-Mar-2014  dholland branches: 1.17.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.16 25-Oct-2013  jdc Add "i2c-at34c02" AT34C02 EEPROM. This is compatible with the AT24C02
EEPROM, apart from software write protection (not supported in our driver).
 1.15 25-Oct-2013  jdc Allow the EEPROM size to be specified in the kernel configuration by
using flags.
Add the flags values, and configuration examples to the manual page.
 1.14 07-Aug-2013  soren Allow i2c addr wildcard matching. Use with care!
 1.13 08-Feb-2013  jdc branches: 1.13.2;
Handle direct configuration if ia->ia_name is set, using iic_compat_match().
If ia->ia_name is set, display the name on attach.
Display the size (if known) on attach.
Move the iic_acquire_bus() and iic_release_bus() calls inside the read and
write loops, to avoid holding the bus for the full duration of the read or
write.
 1.12 08-Jun-2008  tsutsui branches: 1.12.32; 1.12.42;
Replace device_lookup() with device_lookup_private() to get softc
after device_t/softc split. PR kern/38885 from Jonathan A. Kollasch.
 1.11 04-May-2008  xtraeme branches: 1.11.2;
device_t/softc split and other related cosmetic changes.
 1.10 06-Apr-2008  cegger branches: 1.10.2; 1.10.4;
use aprint_*_dev and device_xname
 1.9 11-Dec-2007  lukem branches: 1.9.8;
use __KERNEL_RCSID()
 1.8 19-Oct-2007  ad branches: 1.8.4; 1.8.6; 1.8.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.7 12-Jan-2007  imp branches: 1.7.6; 1.7.18; 1.7.20; 1.7.24;
Update a few comments based on newer members of the at24xx family.
Add support for the 128kbit, 256kbit and 512kbit parts. Note issues
with the 1024kbit and larger parts, but don't add support for them at
this time. I've not updated with the explosion of part numbers in
this family.
 1.6 10-Jan-2007  cube Complete initialiser of the cdevsw structure.
 1.5 29-Mar-2006  thorpej branches: 1.5.8;
Use device_private().
 1.4 13-Dec-2005  abs branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10; 1.4.12;
Update some missed _close() and _open() functions from 'struct proc *p'
to 'struct lwp *l'.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 11-Mar-2004  christos branches: 1.2.4; 1.2.18;
PR/24746: Jared Momose: The _write routine in the at24cxx eeprom driver has
a =/== bug.
 1.1 30-Sep-2003  thorpej New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.2.18.4 21-Jan-2008  yamt sync with head
 1.2.18.3 27-Oct-2007  yamt sync with head.
 1.2.18.2 26-Feb-2007  yamt sync with head.
 1.2.18.1 21-Jun-2006  yamt sync with head.
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 11-Mar-2004  skrll file at24cxx.c was added on branch ktrace-lwp on 2004-08-03 10:46:05 +0000
 1.4.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.4.10.1 19-Apr-2006  elad sync with head.
 1.4.8.1 01-Apr-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.8.2 01-Feb-2007  ad Sync with head.
 1.5.8.1 12-Jan-2007  ad Sync with head.
 1.7.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.7.20.2 09-Jan-2008  matt sync with HEAD
 1.7.20.1 06-Nov-2007  matt sync with HEAD
 1.7.18.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.7.6.1 23-Oct-2007  ad Sync with head.
 1.8.8.1 13-Dec-2007  bouyer Sync with HEAD
 1.8.6.1 11-Dec-2007  yamt sync with head.
 1.8.4.1 26-Dec-2007  ad Sync with head.
 1.9.8.2 29-Jun-2008  mjf Sync with HEAD.
 1.9.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.4.2 04-May-2009  yamt sync with head.
 1.10.4.1 16-May-2008  yamt sync with head.
 1.10.2.2 17-Jun-2008  yamt sync with head.
 1.10.2.1 18-May-2008  yamt sync with head.
 1.11.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.12.42.3 03-Dec-2017  jdolecek update from HEAD
 1.12.42.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.42.1 25-Feb-2013  tls resync with head
 1.12.32.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.2.2 18-May-2014  rmind sync with head
 1.13.2.1 28-Aug-2013  rmind sync with head
 1.17.2.1 10-Aug-2014  tls Rebase.
 1.18.4.3 05-Oct-2016  skrll Sync with HEAD
 1.18.4.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.18.4.1 06-Jun-2015  skrll Sync with HEAD
 1.21.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.25.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.25.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.30.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.30.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.30.2.1 10-Jun-2019  christos Sync with HEAD
 1.31.4.1 27-Nov-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #491):

sys/arch/evbarm/conf/BEAGLEBOARD_INSTALL: file removal
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.2
sys/arch/arm/ti/ti_sysc.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.2
sys/dev/i2c/tps65950.c: file removal
sys/arch/evbarm/conf/std.ti: file removal
sys/dev/i2c/files.i2c: revision 1.101
sys/dev/i2c/files.i2c: revision 1.102
sys/dev/i2c/at24cxx.c: revision 1.32
sys/dev/i2c/files.i2c: revision 1.103
sys/dev/i2c/twl4030.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.104
sys/dev/i2c/twl4030.c: revision 1.2
sys/dev/i2c/twl4030.c: revision 1.3
sys/arch/arm/ti/ti_com.c: revision 1.6
sys/arch/arm/ti/ti_com.c: revision 1.7
sys/arch/arm/ti/ti_com.c: revision 1.8
sys/dev/fdt/cpufreq_dt.c: revision 1.11
sys/arch/arm/ti/ti_iic.c: revision 1.1
sys/dev/fdt/cpufreq_dt.c: revision 1.12
sys/arch/arm/ti/ti_usb.c: revision 1.1
sys/arch/arm/ti/ti_iic.c: revision 1.2
sys/dev/fdt/cpufreq_dt.c: revision 1.13
sys/arch/arm/ti/ti_iic.c: revision 1.3
sys/arch/arm/ti/ti_iic.c: revision 1.4
sys/arch/evbarm/conf/files.ti: file removal
sys/arch/evbarm/conf/BEAGLEBOARDXM: file removal
sys/arch/arm/dts/omap3-n900.dts: revision 1.1
sys/arch/arm/ti/ti_edma.h: revision 1.1
sys/arch/evbarm/conf/OVERO_INSTALL: file removal
sys/arch/arm/ti/ti_usbtll.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.5
etc/etc.evbarm/Makefile.inc: revision 1.108
sys/arch/arm/ti/files.ti: revision 1.6
sys/dev/i2c/tps65217pmic.c: revision 1.13
etc/etc.evbarm/Makefile.inc: revision 1.109
sys/arch/arm/ti/files.ti: revision 1.7
sys/dev/i2c/tps65217pmic.c: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.8
sys/arch/arm/ti/files.ti: revision 1.9
sys/dev/fdt/usbnopphy.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.55
sys/arch/evbarm/conf/GENERIC: revision 1.56
sys/arch/evbarm/conf/GENERIC: revision 1.57
sys/arch/evbarm/conf/GENERIC: revision 1.58
sys/arch/evbarm/conf/GENERIC: revision 1.59
sys/arch/evbarm/conf/BEAGLEBONE: file removal
sys/arch/arm/ti/omap2_gpmcreg.h: revision 1.1
sys/arch/arm/ti/ti_otgreg.h: revision 1.1
sys/arch/arm/ti/ti_tptc.c: revision 1.1
sys/arch/evbarm/conf/IGEPV2: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.10
sys/dev/i2c/tda19988.c: revision 1.1
sys/arch/evbarm/conf/OVERO: file removal
sys/dev/i2c/tda19988.c: revision 1.2
sys/dev/i2c/tda19988.c: revision 1.3
sys/arch/arm/ti/omap3_dss.c: revision 1.1
sys/arch/evbarm/conf/BEAGLEBONE_INSTALL: file removal
sys/arch/arm/ti/ti_omapintc.c: revision 1.2
etc/etc.evbarm/Makefile.inc: revision 1.112
etc/etc.evbarm/Makefile.inc: revision 1.113
sys/arch/arm/ti/ti_div_clock.c: revision 1.1
etc/etc.evbarm/Makefile.inc: revision 1.114
sys/arch/evbarm/conf/N900: revision 1.32
sys/arch/evbarm/conf/N900: revision 1.33
distrib/utils/embedded/conf/armv7.conf: revision 1.36
sys/arch/evbarm/conf/GENERIC: revision 1.60
distrib/utils/embedded/conf/armv7.conf: revision 1.37
sys/arch/arm/ti/omap2_nand.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.61
sys/arch/arm/ti/omap2_nand.c: revision 1.2
sys/arch/evbarm/conf/GENERIC: revision 1.62
distrib/utils/embedded/conf/armv7.conf: revision 1.39
sys/arch/evbarm/conf/GENERIC: revision 1.63
sys/arch/arm/ti/ti_fb.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.64
sys/arch/evbarm/conf/GENERIC: revision 1.65
sys/arch/evbarm/conf/GENERIC: revision 1.66
sys/arch/evbarm/conf/GENERIC: revision 1.67
sys/arch/arm/ti/ti_platform.c: revision 1.7
sys/arch/arm/ti/ti_platform.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.2
sys/arch/arm/ti/ti_platform.c: revision 1.9
sys/arch/arm/ti/am3_prcm.c: revision 1.3
sys/arch/arm/ti/am3_prcm.c: revision 1.4
sys/arch/arm/ti/am3_prcm.c: revision 1.5
sys/arch/arm/ti/am3_prcm.c: revision 1.6
sys/arch/arm/ti/am3_prcm.c: revision 1.7
sys/arch/evbarm/conf/DEVKIT8000: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.9
sys/dev/fdt/syscon.c: revision 1.4
sys/arch/arm/ti/files.ti: revision 1.10
sys/arch/arm/ti/ti_mux_clock.c: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.11
sys/arch/arm/ti/if_cpswreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.12
sys/arch/arm/ti/ti_sdhc.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.13
sys/arch/arm/ti/files.ti: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.15
sys/arch/arm/ti/files.ti: revision 1.16
sys/arch/arm/ti/omap3_cm.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.17
sys/arch/arm/ti/omap3_cm.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.18
sys/arch/arm/ti/omap3_cm.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.19
sys/arch/arm/ti/omap3_cm.c: revision 1.4
sys/arch/arm/ti/ti_motg.c: revision 1.1
sys/arch/arm/ti/ti_rngreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.1
sys/arch/arm/dts/omap3-beagle-xm.dts: revision 1.1
sys/arch/arm/ti/am3_platform.c: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARDXM_INSTALL: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.22
sys/arch/evbarm/conf/README.evbarm: revision 1.23
sys/arch/arm/ti/ti_platform.c: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.24
sys/arch/arm/ti/ti_omaptimer.c: revision 1.2
sys/arch/arm/ti/ti_prcm.c: revision 1.2
sys/arch/evbarm/conf/README.evbarm: revision 1.25
sys/arch/arm/ti/ti_omaptimer.c: revision 1.3
sys/arch/arm/ti/ti_prcm.c: revision 1.3
sys/arch/evbarm/conf/README.evbarm: revision 1.26
sys/arch/arm/ti/ti_omaptimer.c: revision 1.4
sys/arch/evbarm/conf/README.evbarm: revision 1.27
sys/arch/arm/ti/ti_ehci.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.20
sys/arch/arm/ti/ti_cpufreq.c: revision 1.1
sys/arch/arm/ti/ti_cpufreq.c: revision 1.2
sys/arch/arm/fdt/smsh_fdt.c: revision 1.2
sys/arch/arm/ti/omap3_dssreg.h: revision 1.1
sys/arch/evbarm/conf/OVERO: revision 1.56
sys/arch/evbarm/conf/TI: file removal
sys/arch/arm/dts/omap3-beagle.dts: revision 1.1
sys/dev/fdt/fdtvar.h: revision 1.55
sys/dev/fdt/fdtvar.h: revision 1.56
distrib/utils/embedded/files/armv7_boot_nonefi.cmd: revision 1.2
sys/dev/fdt/fdt_phy.c: revision 1.6
sys/arch/arm/ti/ti_iicreg.h: revision 1.1
sys/arch/arm/ti/ti_lcdc.c: revision 1.1
sys/arch/arm/ti/ti_gpio.c: revision 1.1
sys/arch/arm/ti/ti_iicreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.c: revision 1.2
sys/dev/fdt/files.fdt: revision 1.46
sys/arch/arm/ti/ti_gpio.c: revision 1.2
sys/arch/arm/ti/ti_iicreg.h: revision 1.3
sys/arch/arm/ti/ti_lcdc.c: revision 1.3
sys/dev/fdt/files.fdt: revision 1.47
sys/arch/arm/ti/ti_gpio.c: revision 1.3
sys/dev/fdt/pinctrl_single.c: revision 1.1
sys/arch/evbarm/conf/files.generic: revision 1.9
sys/arch/arm/ti/ti_gpmc.c: revision 1.1
sys/arch/arm/ti/ti_lcdcreg.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARD: file removal
sys/arch/arm/ti/omap3_prm.c: revision 1.1
sys/arch/arm/ti/ti_platform.h: file removal
sys/arch/arm/ti/omap3_platform.c: revision 1.1
sys/arch/arm/ti/ti_prcm.h: revision 1.2
sys/arch/arm/ti/omap3_platform.c: revision 1.2
sys/arch/arm/ti/ti_prcm.h: revision 1.3
sys/arch/arm/ti/ti_prcm.h: revision 1.4
sys/dev/fdt/fdt_clock.c: revision 1.9
sys/arch/arm/ti/ti_edma.c: revision 1.1
sys/arch/arm/ti/ti_otg.c: revision 1.1
distrib/utils/embedded/files/armv7_boot.cmd: revision 1.15
sys/arch/arm/ti/if_cpsw.c: revision 1.7
sys/arch/evbarm/conf/std.igepv2: file removal
sys/arch/arm/ti/if_cpsw.c: revision 1.8
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.1

Adapt ti fdt glue to support GENERIC kernel.

Do not search 64-bit directories for dts files

Fix am33xx_platform_early_putchar for pre-MMU output

Add bus driver for TI sysc interconncet.

Make com work again

Add EDMA TPCC and TPTC drivers.

Add driver for one-register-per-pin type pinctrl devices.

Add MMCHS support.

Add USB support.

Disable autoidle

Place devmap above KERNEL_IO_VBASE

Use Timer2 for timecounter, and enable hw module.

Add support for TI AM335x

Add atmel,24c256 compat data

Add I2C support.

Add tiiic, tps65217pmic

Add FDT support

Fix early putchar, add reset func

No support for tegra210 in armv7 kernel

Switch to GENERIC kernels only.

Get mac address from DT

Skip nodes with an "opp-suspend" property and fix tables that have disabled
nodes in the middle.

enumerate devices under child "clocks" node

Add support for platform specific opp table filters.

Add fdtbus_clock_count to count the number of clock references on a given node

enumerate devices under child "clocks" node

Add AM335x DVFS support.

Enable TI AM335x DVFS support

Add support for GPIO controller.

Add tigpio

Unhook BEAGLEBONE kernel from the build
Remove BEAGLEBONE kernel config (AM335x SoC is supported by GENERIC now).

Add support for hardware RNG.

Add tirng

Add explicit FDT_OPP for operating-points-v2 so the link set won't be empty

Rename SOC_TI_AM335X to SOC_AM33XX and rename ti_platform.c to
am3_platform.c

Set stdout-path on TI OMAP3 BeagleBoard

Add support for TI OMAP3.

Add OMAP3 support.

Move a lot of *.dtb files to a dtb/ subdirectory on the FAT partition.
Mkimage (eroneously) creates a FAT16 partition (despite the configuration
asking for FAT32), and that has a root directory size limit.
Idea from Jared.

Skip xref if it is 0

Add generic USB PHY driver

Add driver for TI TWL4030 Power Management IC

Use the hwmod clk to get the timer rate and explicitly enable the
timecounter timer.

Add OMAP3 USB support.

Add twl, usbnopphy, tiusb, tiusbtll

Move omap3 dtb files to /boot/dtb

Remove BEAGLEBOARD kernel from list of kernels to build
Remove BEAGLEBOARD kernel (supported by GENERIC now)

Fix PRM_RSTCTRL_RST_DPLL3 definition, now reset works.

Remove DEVKIT8000 kernel (GENERIC should work now)
Remove DPLL5 init ported from old omap code, it is not required

Set the stdout-path on xM like Ti OMAP3 BeagleBoard

Remove BEAGLEBOARDXM from the build
Remove BEAGLEBOARDXM kernel (supported by GENERIC now)

Handle different register layout on OMAP3

Add omapfb to FDT-ized TI port.

Use dss as console on Nokia N900.

Enable IRQ status bits for omap3 type and set speed properly

Add RTC support

Remove tps65950pm (hardware now supported by twl4030.c)

Add NAND flash support.

Add tigpmc, omapnand

Attach tiusb before the default pass since it adds a bus to reduce kernel output
Replace tps65950pm with twl (the former has been removed)

Fix non-FDT build

Cleanup and remove dependency on arch/arm/omap

Add support for GPIO interrupts and fix reading the state of output pins.
Match smsc,lan9115 and honour local-mac-address/mac-address properties

Only one instance of twl(4) is needed
Remove OVERO from build, and commented out N900 kernel config
OMAP3 SoC and all peripherals in the OVERO kernel are now supported by
GENERIC.

Remove commented out IGEPV2 entry

OMAP3 SoC and all peripherals in the IGEPV2 kernel are now supported by
GENERIC.

No longer used.

Also match ti,omap2-onenand

Defer power monitor polling to the sysmon taskq thread to avoid i2c transactions in intr context

Add driver for NXP TDA19988 HDMI encoder

Add support for AM335x display controller (LCDC).

Add tdahdmi, tilcdc, tifb

Test DRM_MODE_* flags, not VID_*

Comment out mode fixup (not needed it seems)

Use 297MHz for display clock

Select closest rate to desired pixel clock

Speed up mode setting a bit and turn off the display while changing modes
 1.35.2.1 17-Jan-2020  ad Sync with head.
 1.36.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file at24cxxvar.h was added on branch ktrace-lwp on 2004-08-03 10:46:05 +0000
 1.8 01-Jun-2017  chs remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.7 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.6 02-Oct-2011  jmcneill branches: 1.6.12; 1.6.28; 1.6.30;
now that iic is a module, add "iic" dependency to iic drivers
 1.5 10-Jul-2011  jmcneill add snr reporting
 1.4 09-Jul-2011  jmcneill add digital capture support
 1.3 26-May-2011  jmcneill add a function to mute/unmute the audio input
 1.2 28-Dec-2010  jmcneill branches: 1.2.2; 1.2.6;
don't make module declaration conditional on _MODULE
 1.1 27-Dec-2010  jmcneill add driver for the Auvitek AU0828 USB video controllers's analog video
capture functions:

auvitek0 at uhub6 port 2: AU0828
video0 at auvitek0: WinTV HVR-950Q
uaudio0 at auvitek0 port 2 configuration 1 interface 1
uaudio0: vendor 0x2040 product 0x7200, rev 2.00/0.05, addr 2
uaudio0: audio rev 1.00
audio1 at uaudio0: full duplex, playback, capture, independent
 1.2.6.3 31-May-2011  rmind sync with head
 1.2.6.2 05-Mar-2011  rmind sync with head
 1.2.6.1 28-Dec-2010  rmind file au8522.c was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.2.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.30.2 28-Aug-2017  skrll Sync with HEAD
 1.6.30.1 06-Apr-2015  skrll Sync with HEAD
 1.6.28.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.6.12.1 03-Dec-2017  jdolecek update from HEAD
 1.2 10-Jul-2011  jmcneill add snr reporting
 1.1 09-Jul-2011  jmcneill add digital capture support
 1.2 10-Jul-2011  jmcneill add snr reporting
 1.1 09-Jul-2011  jmcneill add digital capture support
 1.2 10-Jul-2011  jmcneill add snr reporting
 1.1 09-Jul-2011  jmcneill add digital capture support
 1.2 10-Jul-2011  jmcneill add snr reporting
 1.1 09-Jul-2011  jmcneill add digital capture support
 1.2 10-Jul-2011  jmcneill add snr reporting
 1.1 27-Dec-2010  jmcneill branches: 1.1.6;
add driver for the Auvitek AU0828 USB video controllers's analog video
capture functions:

auvitek0 at uhub6 port 2: AU0828
video0 at auvitek0: WinTV HVR-950Q
uaudio0 at auvitek0 port 2 configuration 1 interface 1
uaudio0: vendor 0x2040 product 0x7200, rev 2.00/0.05, addr 2
uaudio0: audio rev 1.00
audio1 at uaudio0: full duplex, playback, capture, independent
 1.1.6.2 05-Mar-2011  rmind sync with head
 1.1.6.1 27-Dec-2010  rmind file au8522reg.h was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.4 10-Jul-2011  jmcneill add snr reporting
 1.3 09-Jul-2011  jmcneill add digital capture support
 1.2 26-May-2011  jmcneill add a function to mute/unmute the audio input
 1.1 27-Dec-2010  jmcneill branches: 1.1.2; 1.1.6;
add driver for the Auvitek AU0828 USB video controllers's analog video
capture functions:

auvitek0 at uhub6 port 2: AU0828
video0 at auvitek0: WinTV HVR-950Q
uaudio0 at auvitek0 port 2 configuration 1 interface 1
uaudio0: vendor 0x2040 product 0x7200, rev 2.00/0.05, addr 2
uaudio0: audio rev 1.00
audio1 at uaudio0: full duplex, playback, capture, independent
 1.1.6.3 31-May-2011  rmind sync with head
 1.1.6.2 05-Mar-2011  rmind sync with head
 1.1.6.1 27-Dec-2010  rmind file au8522var.h was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.1.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.22 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.21 07-Aug-2021  thorpej branches: 1.21.2;
Merge thorpej-cfargs2.
 1.20 24-Apr-2021  thorpej branches: 1.20.2; 1.20.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.19 27-Jan-2021  thorpej branches: 1.19.2;
Use DEVICE_COMPAT_EOL.
 1.18 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.17 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.16 16-Feb-2020  thorpej branches: 1.16.6;
- Don't use I2C_F_POLL.
- G/C the non-FDT entry points; nothing uses them anymore.
 1.15 23-Dec-2019  thorpej branches: 1.15.2;
- Don't read/write the device if iic_acquire_bus() fails.
- axp20x_poweroff(): report the error code if power off fails.
- Don't use polled access in axp20xreg_{get,set}_voltage().
 1.14 23-Dec-2019  thorpej No need to do the poll-during-autoconfiguration dance; the i2c code
does the right thing for us.
 1.13 26-Jun-2018  thorpej branches: 1.13.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.12 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.11 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.10 22-Oct-2017  jmcneill branches: 1.10.2; 1.10.4;
AXP209 isn't an SMBus device, so don't use iic_smbus_* APIs.
 1.9 09-Oct-2017  jmcneill Change aprint_verbose on voltage change to aprint_debug to prevent dmesg
spam when running estd. While here, remove ": " prefix on aprint_*_dev
format strings.
 1.8 07-Oct-2017  jmcneill Hook axp20x into fdt regulator api
 1.7 29-Aug-2017  jmcneill Add powerdown support and hook it in to FDT
 1.6 29-Aug-2017  jmcneill Add direct configuration support.
 1.5 14-May-2017  tnn define control register and associated bits for RTC supercap charger
 1.4 15-Oct-2015  bouyer branches: 1.4.8;
Fix dcdc3 voltage settings (s/dcdc2/dcdc3/g).
While there convert some aprint_normal to aprint_verbose
 1.3 15-Oct-2015  bouyer Implement sensor reports for power supplies (voltage and intensities).
Implement a callback to change DCDC2 and DCDC3 voltages, so that
CPU management can change CPU core voltage when changing frequency.
 1.2 09-Sep-2014  jmcneill branches: 1.2.2; 1.2.4;
fix a sizeof typo
 1.1 09-Sep-2014  jmcneill AXP20x Power Management Unit driver, pretty basic at the moment -- only acts as a temperature sensor
 1.2.4.2 28-Aug-2017  skrll Sync with HEAD
 1.2.4.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.2.2.2 12-Nov-2014  martin Pull up following revision(s) (requested by skrll in ticket #223):
sys/arch/evbarm/conf/std.awin: revision 1.2
sys/dev/i2c/axp20x.c: revision 1.1
sys/dev/i2c/axp20x.c: revision 1.2
sys/dev/i2c/gttwsireg.h: revision 1.2
sys/dev/i2c/files.i2c: revision 1.55
sys/dev/i2c/files.i2c: revision 1.56
AllWinner implementation uses a different register layout, select it with options GTTWSI_ALLWINNER
AXP20x Power Management Unit driver, pretty basic at the moment -- only acts as a temperature sensor
fix a sizeof typo
options GTTWSI_ALLWINNER
 1.2.2.1 09-Sep-2014  martin file axp20x.c was added on branch netbsd-7 on 2014-11-12 20:07:20 +0000
 1.4.8.1 19-May-2017  pgoyette Resolve conflicts from previous merge (all resulting from $NetBSD
keywork expansion)
 1.10.4.2 28-Jul-2018  pgoyette Sync with HEAD
 1.10.4.1 25-Jun-2018  pgoyette Sync with HEAD
 1.10.2.2 03-Dec-2017  jdolecek update from HEAD
 1.10.2.1 22-Oct-2017  jdolecek file axp20x.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.13.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15.2.1 29-Feb-2020  ad Sync with head.
 1.16.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.19.2.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.20.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.20.2.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.21.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.4 16-Feb-2020  thorpej - Don't use I2C_F_POLL.
- G/C the non-FDT entry points; nothing uses them anymore.
 1.3 07-Oct-2017  jmcneill branches: 1.3.2; 1.3.6; 1.3.14;
Hook axp20x into fdt regulator api
 1.2 29-Aug-2017  jmcneill Add powerdown support and hook it in to FDT
 1.1 15-Oct-2015  bouyer branches: 1.1.2;
Implement sensor reports for power supplies (voltage and intensities).
Implement a callback to change DCDC2 and DCDC3 voltages, so that
CPU management can change CPU core voltage when changing frequency.
 1.1.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.1 15-Oct-2015  skrll file axp20xvar.h was added on branch nick-nhusb on 2015-12-27 12:09:49 +0000
 1.3.14.1 29-Feb-2020  ad Sync with head.
 1.3.6.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.2.2 03-Dec-2017  jdolecek update from HEAD
 1.3.2.1 07-Oct-2017  jdolecek file axp20xvar.h was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.9 27-Jan-2021  thorpej Use DEVICE_COMPAT_EOL.
 1.8 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.7 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.6 26-Jun-2018  thorpej branches: 1.6.16;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.5 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.4 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.3 07-Oct-2017  jmcneill branches: 1.3.2; 1.3.4;
add direct config support
 1.2 21-Nov-2014  jmcneill Change internal temperature base from -267.7C to -243.7C. The AXP223
datasheet says that the value is between -267.7C and 165.8C in steps of 0.1C,
but this doesn't make sense for a 12-bit field. If we take the maximum value
and subtract 4095 we get -243.7C, effectively adding +24C to the reported
temp. On my A31 board, this changes a chilly 15.3C to a more reasonable 39.3C.
 1.1 12-Oct-2014  jmcneill branches: 1.1.2;
add AXP22x Power Management Unit driver
 1.1.2.3 23-Nov-2014  martin Pull up following revision(s) (requested by jmcneill in ticket #255):
sys/dev/i2c/axp22x.c: revision 1.2
Change internal temperature base from -267.7C to -243.7C. The AXP223
datasheet says that the value is between -267.7C and 165.8C in steps of 0.1C,
but this doesn't make sense for a 12-bit field. If we take the maximum value
and subtract 4095 we get -243.7C, effectively adding +24C to the reported
temp. On my A31 board, this changes a chilly 15.3C to a more reasonable 39.3C.
 1.1.2.2 14-Nov-2014  martin Pull up following revision(s) (requested by skrll in ticket #230):
sys/dev/i2c/axp22x.c: revision 1.1
etc/etc.evbarm/Makefile.inc: revisions 1.65-1.66
sys/arch/evbarm/conf/HUMMINGBIRD_A31: revisions 1.1-1.15
sys/arch/evbarm/conf/HUMMINGBIRD_A31_INSTALL: revisions 1.1-1.3
sys/dev/i2c/axp22x.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.57

Add Merrii Hummingbird A31 board kernels.
Add AXP22x Power Management Unit driver.
 1.1.2.1 12-Oct-2014  martin file axp22x.c was added on branch netbsd-7 on 2014-11-14 10:04:40 +0000
 1.3.4.2 28-Jul-2018  pgoyette Sync with HEAD
 1.3.4.1 25-Jun-2018  pgoyette Sync with HEAD
 1.3.2.2 03-Dec-2017  jdolecek update from HEAD
 1.3.2.1 07-Oct-2017  jdolecek file axp22x.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.6.16.1 03-Apr-2021  thorpej Sync with HEAD.
 1.5 04-May-2018  jmcneill Rename axp806pmic to axppmic, and add support for AXP803.
 1.4 04-May-2018  jmcneill Fix pasto
 1.3 03-May-2018  jmcneill Add support for poweroff and the power on-off key (POK).
 1.2 03-May-2018  jmcneill FDT-ize X-Powers AXP805/806 PMIC driver.
 1.1 07-Dec-2014  jmcneill branches: 1.1.2; 1.1.18; 1.1.20;
Add AXP806 and AXP809 power management controller drivers.
 1.1.20.1 21-May-2018  pgoyette Sync with HEAD
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 07-Dec-2014  jdolecek file axp806.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 07-Dec-2014  skrll file axp806.c was added on branch nick-nhusb on 2015-04-06 15:18:09 +0000
 1.2 03-May-2018  jmcneill FDT-ize X-Powers AXP805/806 PMIC driver.
 1.1 07-Dec-2014  jmcneill branches: 1.1.2; 1.1.18; 1.1.20;
Add AXP806 and AXP809 power management controller drivers.
 1.1.20.1 21-May-2018  pgoyette Sync with HEAD
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 07-Dec-2014  jdolecek file axp806.h was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 07-Dec-2014  skrll file axp806.h was added on branch nick-nhusb on 2015-04-06 15:18:09 +0000
 1.3 27-Jul-2019  thorpej No need to check cold to add I2C_F_POLL; the i2c API does it for us now.
 1.2 16-Jun-2018  thorpej branches: 1.2.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.1 07-Dec-2014  jmcneill branches: 1.1.2; 1.1.18; 1.1.20;
Add AXP806 and AXP809 power management controller drivers.
 1.1.20.1 25-Jun-2018  pgoyette Sync with HEAD
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 07-Dec-2014  jdolecek file axp809.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 07-Dec-2014  skrll file axp809.c was added on branch nick-nhusb on 2015-04-06 15:18:09 +0000
 1.2.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1 07-Dec-2014  jmcneill branches: 1.1.2; 1.1.18;
Add AXP806 and AXP809 power management controller drivers.
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 07-Dec-2014  jdolecek file axp809.h was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 07-Dec-2014  skrll file axp809.h was added on branch nick-nhusb on 2015-04-06 15:18:09 +0000
 1.42 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.41 05-Jan-2025  skrll Remove WIP
 1.40 05-Jan-2025  skrll Add support for AXP15060
 1.39 05-Jan-2025  skrll Wrap a long line.
 1.38 04-Jan-2025  skrll Trailing whitespace.
 1.37 30-Oct-2022  jmcneill branches: 1.37.8;
Add GPIO support.

PR# kern/57030
 1.36 07-Aug-2021  thorpej branches: 1.36.2;
Merge thorpej-cfargs2.
 1.35 24-May-2021  skrll branches: 1.35.4;
Bail out of axpreg_attach if axpreg_get_voltage returns an error.

uvol isn't updated and shouldn't be used.
 1.34 24-Apr-2021  thorpej branches: 1.34.2; 1.34.4;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.33 27-Jan-2021  thorpej branches: 1.33.2;
Use DEVICE_COMPAT_EOL.
 1.32 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.31 18-Jan-2021  thorpej Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup(). This pattern is less awkward to use.
 1.30 17-Jan-2021  thorpej Change the device_compatible_entry struct to have a union of
a scalar value (uintptr_t value) and a pointer value (const void *data),
rather than just "uintptr_t data". This eliminates the need for drivers
to cast this value, and doesn't lose const'ness of pointers assigned
to the field.

Update all of the users of this field to use the correct set of
designated initialisers for each specific case.
 1.29 16-Feb-2020  thorpej branches: 1.29.6;
Don't access the i2c bus in interrupt context. Instead, mask the
interrupt and process it on a work queue.
 1.28 23-Dec-2019  thorpej branches: 1.28.2;
In axppmic_power_poweroff(), check for errors from iic_acquire_bus()
before proceeding with writing to the device.
 1.27 23-Dec-2019  thorpej No need to do the poll-during-autoconfiguration dance; the i2c code
does the right thing for us.
 1.26 01-Oct-2019  jmcneill Add support for devices with separate "init" and "default" pinctrl states.
 1.25 27-Jul-2019  thorpej branches: 1.25.2;
No need to check cold to add I2C_F_POLL; the i2c API does it for us now.
 1.24 28-May-2019  jmcneill Add more axp809 controls
 1.23 28-May-2019  jmcneill Fix ldo_io[01] enable and disable values for axp809
 1.22 28-May-2019  jmcneill Enable always-on and boot-on regulators at attach time
 1.21 27-May-2019  jmcneill Add basic support for AXP809
 1.20 27-May-2019  jmcneill Adjust regulator voltage at attach time to be between the min and max values specified in the dts
 1.19 27-May-2019  jmcneill Add support for AXP806
 1.18 02-Jan-2019  jmcneill Revert part of previous - do not reserve regulators, it's perfectly normal for devices to share one.
 1.17 02-Jan-2019  jmcneill Add support for AXP813 and only allow one consumer per regulator at a time
 1.16 13-Nov-2018  jakllsch Add AXP803 current and maximum battery capacity sensors
 1.15 13-Nov-2018  jakllsch Use semantically-correct "_lo" in AXP_ADC_RAW macro.
 1.14 26-Jun-2018  thorpej branches: 1.14.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.13 26-Jun-2018  thorpej Change device_compatible_match() and iic_compatible_match() to return
the weighted match value and take an optional compatible-entry pointer,
rather than the other way around.
 1.12 19-Jun-2018  thorpej Use the device_compatible_entry mechanism rather than of_compat_data;
all of the OF / FDT data we need is already in the i2c_attach_args.
 1.11 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.10 26-May-2018  jmcneill Add battery voltage, charge current, and discharge current sensors for
AXP803.
 1.9 13-May-2018  jmcneill branches: 1.9.2;
Battery charge state is invalid until we refresh the first time
 1.8 13-May-2018  jmcneill Use IRQs to update status whenever we can. Reduces the amount of work that
needs to be done whenever sysmon_envsys refreshes sensors.
 1.7 12-May-2018  jmcneill Trigger shutdown on POKLIRQ instead of POKSIRQ.

POKSIRQ is triggered if POK remains low for less than IRQLEVEL. This makes
it way too easy to accidentally trigger shutdown. POKLIRQ is triggered if
POK hold time is greater than IRQLEVEL, which is much more reasonable for
this use case.
 1.6 10-May-2018  jmcneill Fix off by one in axp803 dcdc2/3/4 definitions
 1.5 06-May-2018  jmcneill POKS IRQ register / bit differ between AXP803 and AXP805/806. Handle these
differences.
 1.4 05-May-2018  jmcneill No need to read battery capacity warning levels each time the sensor is refreshed
 1.3 05-May-2018  jmcneill Add ACIN and VBUS present sensors
 1.2 05-May-2018  jmcneill Add battery sensors.
 1.1 04-May-2018  jmcneill Rename axp806pmic to axppmic, and add support for AXP803.
 1.9.2.6 18-Jan-2019  pgoyette Synch with HEAD
 1.9.2.5 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.9.2.4 28-Jul-2018  pgoyette Sync with HEAD
 1.9.2.3 25-Jun-2018  pgoyette Sync with HEAD
 1.9.2.2 21-May-2018  pgoyette Sync with HEAD
 1.9.2.1 13-May-2018  pgoyette file axppmic.c was added on branch pgoyette-compat on 2018-05-21 04:36:05 +0000
 1.14.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.14.2.1 10-Jun-2019  christos Sync with HEAD
 1.25.2.1 03-Oct-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #276):

sys/arch/arm/samsung/exynos_pinctrl.c: revision 1.14
sys/arch/arm/rockchip/rk3399_iomux.c: revision 1.6
sys/dev/fdt/fdtvar.h: revision 1.54
sys/arch/arm/broadcom/bcm2835_gpio.c: revision 1.14
sys/dev/i2c/axppmic.c: revision 1.26
sys/arch/arm/nvidia/tegra_pinmux.c: revision 1.4
sys/arch/arm/rockchip/rk3328_iomux.c: revision 1.3
sys/dev/fdt/fdt_pinctrl.c: revision 1.10
sys/arch/arm/amlogic/meson_pinctrl.c: revision 1.6
sys/dev/fdt/fdtbus.c: revision 1.30
sys/arch/arm/sunxi/sunxi_gpio.c: revision 1.27

Add support for devices with separate "init" and "default" pinctrl states.
 1.28.2.1 29-Feb-2020  ad Sync with head.
 1.29.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.33.2.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.34.4.1 31-May-2021  cjep sync with head
 1.34.2.2 17-Jun-2021  thorpej Sync w/ HEAD.
 1.34.2.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.35.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.36.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.37.8.1 02-Aug-2025  perseant Sync with HEAD
 1.7 03-Dec-2022  brad Split the BMP280 / BME280 driver into common code and create I2C and
SPI attachments.
 1.6 01-Dec-2022  brad Use a better choice for the print format string.
 1.5 01-Dec-2022  brad Correct the humidity conversion for the BME280
 1.4 24-Nov-2022  brad Mention where in the datasheet the compensation algorithms came from.
 1.3 23-Nov-2022  brad Use kpause() instead of delay() in the measurement cycle. Try and
derive the proper wait delay for the measurement based upon the over
sampling setting and allow the wait factor multiplier to be adjusted.
 1.2 22-Nov-2022  brad Read the datasheet more closely and put in some delays. The chip will
just return junk if the wait is not long enough to allow a measurement
to start.
 1.1 21-Nov-2022  brad A driver for the Bosch BMP280 / BME280 temperature, humidity and
atmospheric pressure sensor. This is an inexpensive to moderately
expensive chip available from a large number of places. The driver
supports all aspects of the two chips, except for the repeating read
mode which would allow for sub-second queries, such as fall detection
or perhaps even as an altimeter. This driver also only supports the
I2C interface and not the SPI interface.

The BME280, the one with humidity, is not fully tested at this point,
awaiting upon a breakout board and may not show proper humidity.
 1.2 03-Dec-2022  brad Split the BMP280 / BME280 driver into common code and create I2C and
SPI attachments.
 1.1 21-Nov-2022  brad A driver for the Bosch BMP280 / BME280 temperature, humidity and
atmospheric pressure sensor. This is an inexpensive to moderately
expensive chip available from a large number of places. The driver
supports all aspects of the two chips, except for the repeating read
mode which would allow for sub-second queries, such as fall detection
or perhaps even as an altimeter. This driver also only supports the
I2C interface and not the SPI interface.

The BME280, the one with humidity, is not fully tested at this point,
awaiting upon a breakout board and may not show proper humidity.
 1.4 13-Sep-2025  thorpej Re-reactor more common code.
 1.3 13-Sep-2025  thorpej Don't put SPI- or I2C-specific stuff in common code.
 1.2 12-Sep-2025  thorpej Lip-service to direct configuration. More work here is needed to conform
to the device tree bindings.
 1.1 03-Dec-2022  brad Split the BMP280 / BME280 driver into common code and create I2C and
SPI attachments.
 1.3 03-Dec-2022  brad Split the BMP280 / BME280 driver into common code and create I2C and
SPI attachments.
 1.2 23-Nov-2022  brad Use kpause() instead of delay() in the measurement cycle. Try and
derive the proper wait delay for the measurement based upon the over
sampling setting and allow the wait factor multiplier to be adjusted.
 1.1 21-Nov-2022  brad A driver for the Bosch BMP280 / BME280 temperature, humidity and
atmospheric pressure sensor. This is an inexpensive to moderately
expensive chip available from a large number of places. The driver
supports all aspects of the two chips, except for the repeating read
mode which would allow for sub-second queries, such as fall detection
or perhaps even as an altimeter. This driver also only supports the
I2C interface and not the SPI interface.

The BME280, the one with humidity, is not fully tested at this point,
awaiting upon a breakout board and may not show proper humidity.
 1.6 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.5 07-Nov-2021  jmcneill cwfg: update for dts-5.15 binding changes
 1.4 27-Jan-2021  thorpej branches: 1.4.4; 1.4.14;
Use DEVICE_COMPAT_EOL.
 1.3 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.2 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.1 03-Jan-2020  jmcneill branches: 1.1.4; 1.1.8; 1.1.12;
Add driver for CellWise CW2015 Fuel Gauge IC.
 1.1.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1.8.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.8.1 03-Jan-2020  martin file cwfg.c was added on branch phil-wifi on 2020-04-08 14:08:05 +0000
 1.1.4.2 21-Jan-2020  martin Pull up following revision(s) (requested by mrg in ticket #616):

sys/dev/ic/anx_dp.c: revision 1.2
sys/arch/evbarm/conf/GENERIC64: revision 1.126
sys/dev/ic/anx_dp.h: revision 1.1
sys/arch/evbarm/conf/GENERIC64: revision 1.128
sys/dev/ic/anx_dp.h: revision 1.2
sys/dev/fdt/dwcmmc_fdt.c: revision 1.9
sys/dev/i2c/cwfg.c: revision 1.1
sys/conf/files: revision 1.1247
sys/dev/fdt/pwm_backlight.c: revision 1.5
sys/dev/fdt/pwm_backlight.c: revision 1.6
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.14
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.15
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.16
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.17
sys/dev/ic/dwc_mmc.c: revision 1.20
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.18
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.19
sys/dev/usb/usbdevs: revision 1.775
sys/arch/arm/rockchip/rk_dwhdmi.c: revision 1.4
sys/dev/fdt/simple_amplifier.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.105
sys/arch/evbarm/conf/GENERIC64: revision 1.117
sys/arch/evbarm/conf/GENERIC64: revision 1.118
sys/dev/i2c/files.i2c: revision 1.107
sys/dev/fdt/files.fdt: revision 1.49
sys/arch/arm/rockchip/rk_anxdp.c: revision 1.1
sys/dev/ic/dwc_mmc_var.h: revision 1.9
sys/dev/i2c/rkpmic.c: revision 1.4
sys/arch/arm/rockchip/rk_anxdp.c: revision 1.2
sys/dev/i2c/rkpmic.c: revision 1.5
sys/dev/i2c/rkpmic.c: revision 1.6
sys/arch/arm/rockchip/rk_vop.c: revision 1.4
sys/arch/arm/rockchip/rk_vop.c: revision 1.5
sys/dev/i2c/rkpmic.c: revision 1.8
sys/arch/arm/dts/rk3399-pinebook-pro.dts: revision 1.1
sys/dev/usb/ums.c: revision 1.96 (via patch)
sys/arch/arm/rockchip/rk_pwm.c: revision 1.3
sys/arch/arm/dts/rk3399-pinebook-pro.dts: revision 1.2
sys/dev/i2c/es8316ac.c: revision 1.1
sys/dev/fdt/dwcmmc_fdt.c: revision 1.10
sys/dev/i2c/es8316ac.c: revision 1.2
sys/dev/fdt/fdt_panel.c: revision 1.1
sys/dev/ic/dwc_mmc.c: revision 1.18
sys/dev/fdt/fdt_panel.c: revision 1.2
sys/dev/ic/dwc_mmc.c: revision 1.19
sys/arch/arm/dts/rk3399-rockpro64.dts: revision 1.10
sys/dev/fdt/fdt_port.c: revision 1.5
sys/dev/ic/dwc_mmc_var.h: revision 1.10
sys/dev/fdt/fdt_port.c: revision 1.6
sys/arch/evbarm/conf/GENERIC64: revision 1.122
sys/dev/ic/dwc_mmc_var.h: revision 1.11
sys/dev/fdt/files.fdt: revision 1.50
sys/arch/evbarm/conf/GENERIC64: revision 1.123
sys/arch/arm/rockchip/rk_i2s.c: revision 1.2
sys/arch/arm/rockchip/files.rockchip: revision 1.23
sys/arch/evbarm/conf/GENERIC64: revision 1.124
sys/dev/ic/anx_dp.c: revision 1.1

rkpmic: add RTC support; register w/ todr(9)
rkpmic: correct delay
Add support for SDIO interrupts.
fix copy/paste error in mux_pll_src_cpll_gpll_ppll_parents[]
add RK3399 eDP clocks
add RK3399 DisplayPort clocks
style fix/KNF
rk3399_cru: implement dclk_vop0_frac and dclk_vop1_frac
Move drm_encoder from rkvop(4) to the SoC-layer output pipe drivers (rk_dwhdmi).
rkvop: set stride using virtual framebuffer width instead of display mode
rk3399_cru: Reparent dclk_vop[01] to gpll via dclk_vop[01]_frac.
The previous source of dclk_vop[01] was vpll via dclk_vop[01]_div.
vpll is apparently used directly as a pixel clock source for the
HDMI PHY, and we don't want the other VOP's dclk changing out from
under it because we can't handle finding a replacement clock source
with the right rate yet.
gpll happens to run at 594MHz, which works well as a basis for pixel
clocks.
Linux suggests that the source clock of the fractional divider needs
to be more than twenty times greater than the resulting clock (or some
intermediate clock?) for output stability. This may not be the case
with 594MHz and the common pixel clocks I see used by displays in my
area of the wild, but it works for now.
add Analogix DisplayPort core driver
add Rockchip (RK3399) glue for Analogix DisplayPort core
add anxdp(4)
Add another panel@fdt driver, this time for DRM-style panels.
To do: migrate away from other panel driver.
enable panel at fdt drivers
paper over the rkpwm get_conf function that otherwise doesn't seem to
let things work
add template bits for optional eDP panel on RockPro64
Abort panel driver attach if required regulator is missing.
Add clk provider
Add Pinebook Pro dts, from Manjaro Linux.
https://gitlab.manjaro.org/tsys/linux-pinebook-pro/blob/877ca0e7283596f37845de50dc36bff5b88b91e1/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
+ rk3399-pinebook-pro.dts
Attach mmcpwrseq resource earlier
dwcmmc improvements:
- Use mmcpwrseq resources if available
- Only set 4- or 8-bit mode if specified in the dt properties
- Add quirk for implementations with inverted power enable logic
- Support switching signal voltage between 1.8V and 3.3V
- Fix a clock divider issue on Rockchip SoCs
Fix performance regression with previous
Quiet chatty printfs
No need to print all supported levels at attach, print the range and total number of steps
Disable SPI for now (rkspi driver hangs at boot)
Add driver for simple-audio-amplifier binding
Add driver for Everest Semi ES8316 Low Power Audio CODEC
add es8316, simpleamp
Avoid sleeping while the audio intr lock is held.
If the rockchip,system-power-controller property is present, try to power off with the PMIC
Add HAILUCK keyboard (product 1e)
Add a quirk for the HAILUCK USB keyboard / touchpad device with product 1e.
The keyboard does not function properly unless the touchpad's intr endpoint
is active.
Add driver for CellWise CW2015 Fuel Gauge IC.
add cwfg
Emit PMFE_DISPLAY_{ON,OFF} events in response to DPMS requests.
If the backlight node does not have an enable gpio, set the lowest duty
cycle to turn the display off instead.
Attach psci as early as possible. This allows other power controllers to
register their own poweroff / reset callbacks with a higher preference.
Add 2000 MHz to available armclkb rates
Remove debug printfs
 1.1.4.1 03-Jan-2020  martin file cwfg.c was added on branch netbsd-9 on 2020-01-21 10:39:58 +0000
 1.4.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.4.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.11 31-Dec-2019  thorpej Fix mis-placed parentheses. PR kern/54812.
 1.10 23-Dec-2019  thorpej No need to use I2C_F_POLL here.
 1.9 23-Dec-2019  thorpej In cx24227_writereg() / cx24227_readreg(), return the error
from iic_acquire_bus(), not some bogus return value that can
potentially be confused for a real error code.
 1.8 01-Jun-2017  chs branches: 1.8.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.7 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.6 15-Mar-2012  bouyer branches: 1.6.2; 1.6.14; 1.6.16;
always set *data to appease gcc -03 (some users of cx24227_readreg() don't
check return value for error).
 1.5 02-Oct-2011  jmcneill branches: 1.5.2; 1.5.6;
now that iic is a module, add "iic" dependency to iic drivers
 1.4 05-Aug-2011  jmcneill hide debug messages under CX24227_DEBUG
 1.3 05-Aug-2011  jmcneill add QAM64/256 support
 1.2 04-Aug-2011  jmcneill modularize cx24227
 1.1 04-Aug-2011  jakllsch Add Conexant/Samsung CX24227/S5H1409 demodulator subroutines.
 1.5.6.1 05-Apr-2012  mrg sync to latest -current.
 1.5.2.1 17-Apr-2012  yamt sync with head
 1.6.16.2 28-Aug-2017  skrll Sync with HEAD
 1.6.16.1 06-Apr-2015  skrll Sync with HEAD
 1.6.14.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.6.2.1 03-Dec-2017  jdolecek update from HEAD
 1.8.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 04-Aug-2011  jakllsch Add Conexant/Samsung CX24227/S5H1409 demodulator subroutines.
 1.68 05-Oct-2025  macallan fix polarity reversing tpyo
 1.67 03-Oct-2025  thorpej Use device_{get,set}prop_string() for sensor names.
 1.66 21-Sep-2025  thorpej Get the sensor descriptive information from our device properties
dictionary, rather than from a secondary dictionary passed in the
i2c_attach_args (this secondary dictionary is deprecated and going
away).
 1.65 18-May-2024  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.64 30-Mar-2022  pgoyette These modules need to depend on iic, not just on i2cexec. (They will
still recursively get i2cexec since the iic depends on it.)

Partial fix for kern/56772
 1.63 09-Aug-2021  andvar fix various typos in compatibility, mainly in comments.
 1.62 21-Jun-2021  christos branches: 1.62.6;
fix proplib deprecation
 1.61 15-Jun-2021  mlelstv avoid double-free
 1.60 30-Jan-2021  thorpej branches: 1.60.4;
If we're going to keep a reference on the "props" dictionary from
the i2c_attach_args, we should retain it.
 1.59 27-Jan-2021  thorpej Use DEVICE_COMPAT_EOL.
 1.58 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.57 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.56 12-Jul-2020  macallan branches: 1.56.2;
in sysctl_dbcool_behavior() - actually use the array index when translating
text from sysctl -w *.behavior=<whatever>
now this actually works on my sb2500's two adm1030s
 1.55 12-Jul-2020  macallan get sensor names from device properties if possible
 1.54 06-Feb-2019  martin Change a aprint_verbose into aprint_debug - the message does not add
real value to the dmesg(8) output.
 1.53 03-Feb-2019  mrg - dbcool_pmf_suspend() set the wrong bit out of the suspended data as
it is stored as a bool and thus when bit 2 was wanted, bit 1 was
restored. found by GCC7's "don't use ~ on bool" checker.
- consolidate the dbcool_pmf_suspend()/dbcool_pmf_resume() guts in to
a shared function dbcool_do_pmf() as they are identical except for
1 vs 2 lines.
 1.52 26-Jun-2018  thorpej branches: 1.52.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.51 22-Jun-2018  martin Add a kernel panic when we matched but can not handle a string - better
die explicitly instead of crashing a few lines later with strange NULL
derefs.
 1.50 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.49 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.48 06-Feb-2018  mrg branches: 1.48.2;
dbcool_read_volt() has a missing {} issue.
 1.47 22-Sep-2017  macallan add more names for direct config
 1.46 11-Jul-2016  msaitoh Fix compile error.
 1.45 11-Jul-2016  msaitoh KNF. No functional change.
 1.44 16-Dec-2015  jdc Add direct configuration support via compatible names.
 1.43 23-Apr-2015  pgoyette Update module dependencies for all the existing modules that depend on sysmon components.
 1.42 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.41 10-Aug-2014  tls branches: 1.41.2; 1.41.4;
Merge tls-earlyentropy branch into HEAD.
 1.40 25-Feb-2014  pooka branches: 1.40.2;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.39 12-Sep-2013  martin Remove unused variables
 1.38 02-Jun-2012  dsl branches: 1.38.2; 1.38.4;
Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.37 31-May-2012  pgoyette Update handling of sysctl stuff when built as modules
 1.36 28-Apr-2012  wiz Fix logical errors (&& instead of & in a few places).
 1.35 02-Oct-2011  jmcneill branches: 1.35.2; 1.35.6;
now that iic is a module, add "iic" dependency to iic drivers
 1.34 18-Aug-2011  christos fix gcc-4.5 warnings
 1.33 02-Aug-2011  pgoyette When detaching the device, tear down its sysctl tree.
 1.32 01-Aug-2011  macallan appease gcc 4.5
 1.31 31-Jul-2011  jmcneill modularize
 1.30 20-Jun-2011  pgoyette Initialize sensor state before registering.

XXX Still need to fix i2c/ibmhawk.c
 1.29 12-Mar-2011  pgoyette branches: 1.29.2;
Fix another instance of the same typo in the same comment! dosn't -->
doesn't

Thanks again, Jukka!
 1.28 11-Mar-2011  pgoyette Fix typo in previous - dosn't --> doesn't

Thanks, Jukka!
 1.27 11-Mar-2011  pgoyette Add support for SMSC EMC6D103S

From jasper@pointless.net in PR kern/44685
 1.26 13-Nov-2010  uebayasi branches: 1.26.2;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.25 17-Aug-2010  pgoyette Use SYSCTL_DESCR()
 1.24 10-Apr-2010  pgoyette Save initial, boot-time limit values, and restore them upon request
from sysmon_envsys(9).
 1.23 01-Apr-2010  macallan don't divide by zero. ever.
 1.22 01-Apr-2010  macallan add some more ADM1031 support:
- additional temperature and fan speed sensors work now
- limits on should work on all temperature sensors
Controlling fan behaviour doesn't work yet, the ADM1031 uses the same
register for both fans which doesn't quite fit with the way the dbcool
driver works.
 1.21 31-Mar-2010  macallan Add preliminary support for the ADM1031 found in the Sun Blade 2500 and similar
machines. For now we treat it like an ADM1030 - the only difference is the
device ID and a few previously reserved registers.
 1.20 20-Mar-2010  pgoyette Use correct format directive in aprint_debug_dev()

Thanks to Kurt Schreiner for reporting this on current-users@
 1.19 20-Mar-2010  pgoyette Fix the dbcool_{get,set}_limits() routines to properly deal with min/max
values on temp limits. The actual ranges for temp limits varies if the
chip is running in "extended temperature" mode, so we need to handle this
difference, too.

Verified on my home machine which runs in extended-temp mode and by
njoly@ on a machine which does runs in the older 2s-complement mode.
 1.18 01-Mar-2010  pgoyette branches: 1.18.2;
Now that sysmon_envsys(8) has learned how to retrieve and update sensor
limit values from the device driver, remove the high_limit and low_limit
entries from the hw.dbcool<#>.<sensor> sysctl(8) tree. These limits are
now directly accessible via envstat(8). Simplify the remaining code
somewhat.

No objections raised on either tech-kern@ or current-users@

XXX The fan controllers's parameters (including those that are tied to
XXX temperature sensors) are still in sysctl, since there isn't any clean
XXX way to implement the fan controllers in sysmon_envsys yet. It is on
XXX my To-Do list...
 1.17 26-Feb-2010  pgoyette Disable DBCOOL_DEBUG by default, and make it compile that way.
 1.16 24-Feb-2010  pgoyette Fix handling of 6bit VID register (6th bit takes place of 12VIn sensor).

Move VID out of sysctl tree - make it a separate sensor of type INTEGER.

Clean-up some of the chip-descriptors.
 1.15 24-Feb-2010  dyoung A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.14 08-Jan-2010  dyoung branches: 1.14.2;
Expand PMF_FN_* macros.
 1.13 02-Nov-2009  christos don't pull a 1.5K softc on the stack to do a chip ident. Idea from mrg.
 1.12 01-Jun-2009  pgoyette Since we no longer have individual events for each sensor value limit,
we don't need individual flag bits. Clean up extra bit definitions.
Bump kernel version - welcome to 5.99.13
 1.11 09-Feb-2009  pgoyette branches: 1.11.2;
Previous check for ADM1027 caused a kernel panic, since the read routine
can be called _before_ we've identified the chip. Ensure that sc_chip
is initialized to NULL before chip is identified, and if it is NULL or
ADM1027, use the less-efficient send_byte/receive_byte.

While here, don't attempt to release the i2c bus if we failed to acquire
it. This would cause a panic on a LOCKDEBUG kernel.

Thanks to Nicholas Joly for pointing out both of these bugs.
 1.10 08-Feb-2009  pgoyette branches: 1.10.2;
The ADM1027 chip doesn't support i2c read_byte protocol, so in this
case we use send_byte followed by receive_byte.
 1.9 08-Feb-2009  pgoyette Use pre-scripted i2c protocols rather than re-inventing our own. No
functional change intended.

While here, change some indentation to use tabs vs spaces.
 1.8 14-Jan-2009  pgoyette Include ADT7460 in chip table (it's identical to the ADT7463, except for
physical packaging).
 1.7 18-Dec-2008  pgoyette Add i2c bus address checking for these chips. All supported chips live
at predefined addresses 0x2c, 0x2d, or 0x2e.
 1.6 18-Nov-2008  jnemeth PR/39947 - Juan RP -- dbcool_detach implicitly called
sysmon_envsys_destroy() twice
 1.5 12-Oct-2008  pgoyette branches: 1.5.2; 1.5.4; 1.5.6;
Move the {read,write}reg() routine addresses into the dbcool_softc so
that we can use different routines for macppc's ki2c attachment. Fixes
problems reported by Robert Fritzsche on current-users@ list.
 1.4 10-Oct-2008  pgoyette branches: 1.4.2;
sysctl doesn't like names that start with digits, nor does it like names
with embedded '.' so change the names to be better-conforming. Reported
by njoly
 1.3 07-Oct-2008  pgoyette Increase accuracy in nominal voltage table.
 1.2 06-Oct-2008  pgoyette Various clean-ups:
1. Trange sysctl's belong to the temp sensors, not to the fan controllers
2. Trange really describes a slope on many chips, so modify the description
3. Most of the sysctl's are read/write even if the chip's config is
locked; reflect that in the CTLFLAGs
4. Apply correct 'nominal' values for voltage sensors/limits, specify
them in microVolts, and calculate once rather than each time needed
5. Be more consistent in register names - for example, use VCC instead of
SUPPLY_VOLTAGE, to match VCC_LOWLIM & VCC_HIGHLIM
6. Type of dbcool_islocked() should be bool, not int
7. Reduce some unnecessary code indentation
8. Define Vtt and Imon, and add ADT7490 support (excluding PECI sensors)
9. Split the huge (250+ lines) dbcool_setup() function into a few smaller
routines for better readability
10. Update sensor tables for ADT7476 and ADT7468 - these chips have five
voltage sensors, not two
11. Adjust flags for ADT7463 and ADM1027 - these chips can monitor CPU
VID data bits
12. Update man page
 1.1 02-Oct-2008  pgoyette branches: 1.1.2;
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.

Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
 1.1.2.3 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.2 05-Oct-2008  mjf Sync with HEAD.
 1.1.2.1 02-Oct-2008  mjf file dbcool.c was added on branch mjf-devfs2 on 2008-10-05 20:11:29 +0000
 1.4.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.4.2.1 10-Oct-2008  skrll file dbcool.c was added on branch wrstuden-revivesa on 2008-10-10 22:30:58 +0000
 1.5.6.3 16-Jan-2009  bouyer Pull up following revision(s) (requested by pgoyette in ticket #269):
sys/dev/i2c/dbcool.c: revision 1.8
Include ADT7460 in chip table (it's identical to the ADT7463, except for
physical packaging).
 1.5.6.2 23-Dec-2008  snj Pull up following revision(s) (requested by pgoyette in ticket #195):
sys/dev/i2c/dbcool.c: revision 1.7
sys/dev/i2c/dbcool_reg.h: revision 1.3
Add i2c bus address checking for these chips. All supported chips live
at predefined addresses 0x2c, 0x2d, or 0x2e.
 1.5.6.1 20-Nov-2008  snj Pull up following revision(s) (requested by jnemeth in ticket #82):
sys/dev/i2c/dbcool.c: revision 1.6
PR/39947 - Juan RP -- dbcool_detach implicitly called
sysmon_envsys_destroy() twice
 1.5.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.5.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.2.3 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.2.2 19-Oct-2008  haad Sync with HEAD.
 1.5.2.1 12-Oct-2008  haad file dbcool.c was added on branch haad-dm on 2008-10-19 22:16:24 +0000
 1.10.2.2 23-Jul-2009  jym Sync with HEAD.
 1.10.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.2.6 09-Oct-2010  yamt sync with head
 1.11.2.5 11-Aug-2010  yamt sync with head.
 1.11.2.4 11-Mar-2010  yamt sync with head
 1.11.2.3 20-Jun-2009  yamt sync with head
 1.11.2.2 04-May-2009  yamt sync with head.
 1.11.2.1 09-Feb-2009  yamt file dbcool.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:38 +0000
 1.14.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.14.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.18.2.3 21-Apr-2011  rmind sync with head
 1.18.2.2 05-Mar-2011  rmind sync with head
 1.18.2.1 30-May-2010  rmind sync with head
 1.26.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.29.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.35.6.2 02-Jun-2012  mrg sync to latest -current.
 1.35.6.1 29-Apr-2012  mrg sync to latest -current.
 1.35.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.35.2.2 30-Oct-2012  yamt sync with head
 1.35.2.1 23-May-2012  yamt sync with head.
 1.38.4.1 18-May-2014  rmind sync with head
 1.38.2.2 03-Dec-2017  jdolecek update from HEAD
 1.38.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.40.2.1 07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.41.4.4 05-Oct-2016  skrll Sync with HEAD
 1.41.4.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.41.4.2 06-Jun-2015  skrll Sync with HEAD
 1.41.4.1 06-Apr-2015  skrll Sync with HEAD
 1.41.2.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.48.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.48.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.52.2.1 10-Jun-2019  christos Sync with HEAD
 1.56.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.60.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.60.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.62.6.1 10-Sep-2021  thorpej Remove unnecessary references to i2c_attach_args::ia_prop and mark the ones
that remain as XXX.
 1.9 16-Apr-2020  rin Revert previous for now:
http://mail-index.netbsd.org/source-changes/2020/04/16/msg116278.html

The reasoning turned out to be wrong; __KERNEL_RCSID() in header files
does *not* overwrite RCSID in main source files. The real problem is that
it inserts its RCSID into *every* object files. However, it can be still
useful even if heavily duplicated.
 1.8 16-Apr-2020  rin Stop using __KERNEL_RCSID() in header files; it confuses ident(1) by
overwriting RCSID in main source files.

XXX
The first argument of __KERNEL_RCSID() is neglected for ELF. If we wish
to have RCSID of header files in kernel binary, we need something like
__FBSDID() macro in FreeBSD.
 1.7 07-Aug-2013  soren branches: 1.7.42;
Allow i2c addr wildcard matching. Use with care!
 1.6 11-Mar-2011  pgoyette branches: 1.6.4; 1.6.14; 1.6.18;
Add support for SMSC EMC6D103S

From jasper@pointless.net in PR kern/44685
 1.5 01-Apr-2010  macallan branches: 1.5.2;
add some more ADM1031 support:
- additional temperature and fan speed sensors work now
- limits on should work on all temperature sensors
Controlling fan behaviour doesn't work yet, the ADM1031 uses the same
register for both fans which doesn't quite fit with the way the dbcool
driver works.
 1.4 31-Mar-2010  macallan Add preliminary support for the ADM1031 found in the Sun Blade 2500 and similar
machines. For now we treat it like an ADM1030 - the only difference is the
device ID and a few previously reserved registers.
 1.3 18-Dec-2008  pgoyette branches: 1.3.4; 1.3.6; 1.3.8;
Add i2c bus address checking for these chips. All supported chips live
at predefined addresses 0x2c, 0x2d, or 0x2e.
 1.2 06-Oct-2008  pgoyette branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
Various clean-ups:
1. Trange sysctl's belong to the temp sensors, not to the fan controllers
2. Trange really describes a slope on many chips, so modify the description
3. Most of the sysctl's are read/write even if the chip's config is
locked; reflect that in the CTLFLAGs
4. Apply correct 'nominal' values for voltage sensors/limits, specify
them in microVolts, and calculate once rather than each time needed
5. Be more consistent in register names - for example, use VCC instead of
SUPPLY_VOLTAGE, to match VCC_LOWLIM & VCC_HIGHLIM
6. Type of dbcool_islocked() should be bool, not int
7. Reduce some unnecessary code indentation
8. Define Vtt and Imon, and add ADT7490 support (excluding PECI sensors)
9. Split the huge (250+ lines) dbcool_setup() function into a few smaller
routines for better readability
10. Update sensor tables for ADT7476 and ADT7468 - these chips have five
voltage sensors, not two
11. Adjust flags for ADT7463 and ADM1027 - these chips can monitor CPU
VID data bits
12. Update man page
 1.1 02-Oct-2008  pgoyette branches: 1.1.2;
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.

Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
 1.1.2.3 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.2 05-Oct-2008  mjf Sync with HEAD.
 1.1.2.1 02-Oct-2008  mjf file dbcool_reg.h was added on branch mjf-devfs2 on 2008-10-05 20:11:29 +0000
 1.2.8.1 23-Dec-2008  snj Pull up following revision(s) (requested by pgoyette in ticket #195):
sys/dev/i2c/dbcool.c: revision 1.7
sys/dev/i2c/dbcool_reg.h: revision 1.3
Add i2c bus address checking for these chips. All supported chips live
at predefined addresses 0x2c, 0x2d, or 0x2e.
 1.2.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.2 19-Oct-2008  haad Sync with HEAD.
 1.2.4.1 06-Oct-2008  haad file dbcool_reg.h was added on branch haad-dm on 2008-10-19 22:16:25 +0000
 1.2.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.2.2.1 06-Oct-2008  skrll file dbcool_reg.h was added on branch wrstuden-revivesa on 2008-10-10 22:30:58 +0000
 1.3.8.2 21-Apr-2011  rmind sync with head
 1.3.8.1 30-May-2010  rmind sync with head
 1.3.6.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.3.4.3 11-Aug-2010  yamt sync with head.
 1.3.4.2 04-May-2009  yamt sync with head.
 1.3.4.1 18-Dec-2008  yamt file dbcool_reg.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:39 +0000
 1.5.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.18.1 28-Aug-2013  rmind sync with head
 1.6.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.42.1 20-Apr-2020  bouyer Sync with HEAD
 1.18 21-Sep-2025  thorpej Get the sensor descriptive information from our device properties
dictionary, rather than from a secondary dictionary passed in the
i2c_attach_args (this secondary dictionary is deprecated and going
away).
 1.17 12-Jul-2020  kim Make this compile
 1.16 16-Apr-2020  rin Revert previous for now:
http://mail-index.netbsd.org/source-changes/2020/04/16/msg116278.html

The reasoning turned out to be wrong; __KERNEL_RCSID() in header files
does *not* overwrite RCSID in main source files. The real problem is that
it inserts its RCSID into *every* object files. However, it can be still
useful even if heavily duplicated.
 1.15 16-Apr-2020  rin Stop using __KERNEL_RCSID() in header files; it confuses ident(1) by
overwriting RCSID in main source files.

XXX
The first argument of __KERNEL_RCSID() is neglected for ELF. If we wish
to have RCSID of header files in kernel binary, we need something like
__FBSDID() macro in FreeBSD.
 1.14 02-Aug-2011  pgoyette branches: 1.14.66;
When detaching the device, tear down its sysctl tree.
 1.13 11-Mar-2011  pgoyette Set DBCOOL_DEBUG if global DEBUG is set
 1.12 10-Apr-2010  pgoyette branches: 1.12.2;
Save initial, boot-time limit values, and restore them upon request
from sysmon_envsys(9).
 1.11 01-Mar-2010  pgoyette branches: 1.11.2;
Now that sysmon_envsys(8) has learned how to retrieve and update sensor
limit values from the device driver, remove the high_limit and low_limit
entries from the hw.dbcool<#>.<sensor> sysctl(8) tree. These limits are
now directly accessible via envstat(8). Simplify the remaining code
somewhat.

No objections raised on either tech-kern@ or current-users@

XXX The fan controllers's parameters (including those that are tied to
XXX temperature sensors) are still in sysctl, since there isn't any clean
XXX way to implement the fan controllers in sysmon_envsys yet. It is on
XXX my To-Do list...
 1.10 26-Feb-2010  pgoyette Disable DBCOOL_DEBUG by default, and make it compile that way.
 1.9 24-Feb-2010  pgoyette Fix handling of 6bit VID register (6th bit takes place of 12VIn sensor).

Move VID out of sysctl tree - make it a separate sensor of type INTEGER.

Clean-up some of the chip-descriptors.
 1.8 24-Feb-2010  dyoung A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.7 08-Jan-2010  dyoung branches: 1.7.2;
Expand PMF_FN_* macros.
 1.6 02-Nov-2009  christos don't pull a 1.5K softc on the stack to do a chip ident. Idea from mrg.
 1.5 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.4 12-Oct-2008  pgoyette branches: 1.4.2; 1.4.10; 1.4.14;
Move the {read,write}reg() routine addresses into the dbcool_softc so
that we can use different routines for macppc's ki2c attachment. Fixes
problems reported by Robert Fritzsche on current-users@ list.
 1.3 09-Oct-2008  pgoyette branches: 1.3.2;
It's not necessary to #include "sysmon_envsys.h" any more.
 1.2 06-Oct-2008  pgoyette Various clean-ups:
1. Trange sysctl's belong to the temp sensors, not to the fan controllers
2. Trange really describes a slope on many chips, so modify the description
3. Most of the sysctl's are read/write even if the chip's config is
locked; reflect that in the CTLFLAGs
4. Apply correct 'nominal' values for voltage sensors/limits, specify
them in microVolts, and calculate once rather than each time needed
5. Be more consistent in register names - for example, use VCC instead of
SUPPLY_VOLTAGE, to match VCC_LOWLIM & VCC_HIGHLIM
6. Type of dbcool_islocked() should be bool, not int
7. Reduce some unnecessary code indentation
8. Define Vtt and Imon, and add ADT7490 support (excluding PECI sensors)
9. Split the huge (250+ lines) dbcool_setup() function into a few smaller
routines for better readability
10. Update sensor tables for ADT7476 and ADT7468 - these chips have five
voltage sensors, not two
11. Adjust flags for ADT7463 and ADM1027 - these chips can monitor CPU
VID data bits
12. Update man page
 1.1 02-Oct-2008  pgoyette branches: 1.1.2;
Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.

Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
 1.1.2.3 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.2 05-Oct-2008  mjf Sync with HEAD.
 1.1.2.1 02-Oct-2008  mjf file dbcool_var.h was added on branch mjf-devfs2 on 2008-10-05 20:11:29 +0000
 1.3.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.3.2.1 09-Oct-2008  skrll file dbcool_var.h was added on branch wrstuden-revivesa on 2008-10-10 22:30:58 +0000
 1.4.14.5 11-Aug-2010  yamt sync with head.
 1.4.14.4 11-Mar-2010  yamt sync with head
 1.4.14.3 16-May-2009  yamt sync with head
 1.4.14.2 04-May-2009  yamt sync with head.
 1.4.14.1 12-Oct-2008  yamt file dbcool_var.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:39 +0000
 1.4.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.2.2 19-Oct-2008  haad Sync with HEAD.
 1.4.2.1 12-Oct-2008  haad file dbcool_var.h was added on branch haad-dm on 2008-10-19 22:16:25 +0000
 1.7.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.11.2.2 21-Apr-2011  rmind sync with head
 1.11.2.1 30-May-2010  rmind sync with head
 1.12.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.66.1 20-Apr-2020  bouyer Sync with HEAD
 1.9 23-Dec-2019  thorpej No need to use I2C_F_POLL here.
 1.8 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.7 16-Jun-2018  thorpej branches: 1.7.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.6 25-Jul-2015  jmcneill branches: 1.6.16;
Fix block offsets for ddc_read_edid_block.
 1.5 17-May-2015  jmcneill add ddc_dev_read_edid{,_block} functions, same as ddc_read_edid{,_block} but takes a device_t instead of i2c_tag_t
 1.4 17-Nov-2014  jmcneill branches: 1.4.2;
add ddc_read_edid_block, which is the same as ddc_read_edid but takes an additional block number argument
 1.3 04-May-2008  xtraeme branches: 1.3.44; 1.3.62;
device_t/softc split and other related cosmetic changes.
 1.2 19-Oct-2007  ad branches: 1.2.16; 1.2.18; 1.2.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.1 25-Apr-2006  gdamore branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10; 1.1.14; 1.1.20; 1.1.30; 1.1.44; 1.1.46; 1.1.50;
Add basic DDC (VESA Data Display Channel) driver for use by framebuffers.
Reviewed by jmcneill@ and macallan@.
 1.1.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.1.46.1 06-Nov-2007  matt sync with HEAD
 1.1.44.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.1.30.1 23-Oct-2007  ad Sync with head.
 1.1.20.2 09-Sep-2006  rpaulo sync with head
 1.1.20.1 25-Apr-2006  rpaulo file ddc.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:51 +0000
 1.1.14.3 27-Oct-2007  yamt sync with head.
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 25-Apr-2006  yamt file ddc.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.1.10.2 01-Jun-2006  kardel Sync with head.
 1.1.10.1 25-Apr-2006  kardel file ddc.c was added on branch simonb-timecounters on 2006-06-01 22:36:20 +0000
 1.1.8.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.8.1 25-Apr-2006  tron file ddc.c was added on branch peter-altq on 2006-05-24 15:50:08 +0000
 1.1.6.2 24-May-2006  yamt sync with head.
 1.1.6.1 25-Apr-2006  yamt file ddc.c was added on branch yamt-pdpolicy on 2006-05-24 10:57:40 +0000
 1.1.2.2 11-May-2006  elad sync with head
 1.1.2.1 25-Apr-2006  elad file ddc.c was added on branch elad-kernelauth on 2006-05-11 23:28:30 +0000
 1.2.20.1 16-May-2008  yamt sync with head.
 1.2.18.1 18-May-2008  yamt sync with head.
 1.2.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.62.1 18-Nov-2014  snj Pull up following revision(s) (requested by jmcneill in ticket #244):
sys/arch/arm/allwinner/awin_hdmi.c: revision 1.13-1.15
sys/arch/arm/allwinner/awin_hdmiaudio.c: revision 1.4
sys/arch/arm/allwinner/awin_var.h: revision 1.25
sys/arch/evbarm/awin/awin_machdep.c: revision 1.29
sys/dev/i2c/ddc.c: revision 1.4
sys/dev/i2c/ddcvar.h: revision 1.2
sys/dev/videomode/edid.c: revision 1.13
sys/dev/videomode/edidreg.h: revision 1.4
sys/dev/videomode/edidvar.h: revision 1.3
Parse the extension block count field, and make it available in struct edid_info
--
add ddc_read_edid_block, which is the same as ddc_read_edid but takes an additional block number argument
--
Add support for DVI displays. Detect HDMI vs DVI mode by looking for a
CEA-861-D extension block in the EDID, and then searching this block for
an HDMI vendor-specific data block (HDMI VSDB).
--
Allow for overriding DVI/HDMI detection with a kernel boot arg. Set
hdmi.forcemode=dvi or hdmi.forcemode=hdmi to disable auto-detection.
--
report hotplug status for AUDIO_GETDEV fields, only allow playback if a capable display is connected
--
clear repeater sel bits before setting -- would cause an issue if we ever switched away from a pixel doubling mode
 1.3.44.1 03-Dec-2017  jdolecek update from HEAD
 1.4.2.2 22-Sep-2015  skrll Sync with HEAD
 1.4.2.1 06-Jun-2015  skrll Sync with HEAD
 1.6.16.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.6.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.7.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.2.1 10-Jun-2019  christos Sync with HEAD
 1.3 27-Jan-2019  jmcneill Add a definition for the DDC segment address (30h).
 1.2 14-May-2006  elad branches: 1.2.4; 1.2.6; 1.2.8; 1.2.12; 1.2.18; 1.2.162;
integrate kauth.
 1.1 25-Apr-2006  gdamore branches: 1.1.2;
Add basic DDC (VESA Data Display Channel) driver for use by framebuffers.
Reviewed by jmcneill@ and macallan@.
 1.1.2.2 11-May-2006  elad sync with head
 1.1.2.1 25-Apr-2006  elad file ddcreg.h was added on branch elad-kernelauth on 2006-05-11 23:28:30 +0000
 1.2.162.1 10-Jun-2019  christos Sync with HEAD
 1.2.18.2 09-Sep-2006  rpaulo sync with head
 1.2.18.1 14-May-2006  rpaulo file ddcreg.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:51 +0000
 1.2.12.2 21-Jun-2006  yamt sync with head.
 1.2.12.1 14-May-2006  yamt file ddcreg.h was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.2.8.2 01-Jun-2006  kardel Sync with head.
 1.2.8.1 14-May-2006  kardel file ddcreg.h was added on branch simonb-timecounters on 2006-06-01 22:36:20 +0000
 1.2.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.6.1 14-May-2006  tron file ddcreg.h was added on branch peter-altq on 2006-05-24 15:50:08 +0000
 1.2.4.2 24-May-2006  yamt sync with head.
 1.2.4.1 14-May-2006  yamt file ddcreg.h was added on branch yamt-pdpolicy on 2006-05-24 10:57:40 +0000
 1.3 17-May-2015  jmcneill add ddc_dev_read_edid{,_block} functions, same as ddc_read_edid{,_block} but takes a device_t instead of i2c_tag_t
 1.2 17-Nov-2014  jmcneill branches: 1.2.2;
add ddc_read_edid_block, which is the same as ddc_read_edid but takes an additional block number argument
 1.1 25-Apr-2006  gdamore branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10; 1.1.14; 1.1.20; 1.1.120; 1.1.138;
Add basic DDC (VESA Data Display Channel) driver for use by framebuffers.
Reviewed by jmcneill@ and macallan@.
 1.1.138.1 18-Nov-2014  snj Pull up following revision(s) (requested by jmcneill in ticket #244):
sys/arch/arm/allwinner/awin_hdmi.c: revision 1.13-1.15
sys/arch/arm/allwinner/awin_hdmiaudio.c: revision 1.4
sys/arch/arm/allwinner/awin_var.h: revision 1.25
sys/arch/evbarm/awin/awin_machdep.c: revision 1.29
sys/dev/i2c/ddc.c: revision 1.4
sys/dev/i2c/ddcvar.h: revision 1.2
sys/dev/videomode/edid.c: revision 1.13
sys/dev/videomode/edidreg.h: revision 1.4
sys/dev/videomode/edidvar.h: revision 1.3
Parse the extension block count field, and make it available in struct edid_info
--
add ddc_read_edid_block, which is the same as ddc_read_edid but takes an additional block number argument
--
Add support for DVI displays. Detect HDMI vs DVI mode by looking for a
CEA-861-D extension block in the EDID, and then searching this block for
an HDMI vendor-specific data block (HDMI VSDB).
--
Allow for overriding DVI/HDMI detection with a kernel boot arg. Set
hdmi.forcemode=dvi or hdmi.forcemode=hdmi to disable auto-detection.
--
report hotplug status for AUDIO_GETDEV fields, only allow playback if a capable display is connected
--
clear repeater sel bits before setting -- would cause an issue if we ever switched away from a pixel doubling mode
 1.1.120.1 03-Dec-2017  jdolecek update from HEAD
 1.1.20.2 09-Sep-2006  rpaulo sync with head
 1.1.20.1 25-Apr-2006  rpaulo file ddcvar.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:51 +0000
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 25-Apr-2006  yamt file ddcvar.h was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.1.10.2 01-Jun-2006  kardel Sync with head.
 1.1.10.1 25-Apr-2006  kardel file ddcvar.h was added on branch simonb-timecounters on 2006-06-01 22:36:20 +0000
 1.1.8.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.8.1 25-Apr-2006  tron file ddcvar.h was added on branch peter-altq on 2006-05-24 15:50:08 +0000
 1.1.6.2 24-May-2006  yamt sync with head.
 1.1.6.1 25-Apr-2006  yamt file ddcvar.h was added on branch yamt-pdpolicy on 2006-05-24 10:57:40 +0000
 1.1.2.2 11-May-2006  elad sync with head
 1.1.2.1 25-Apr-2006  elad file ddcvar.h was added on branch elad-kernelauth on 2006-05-11 23:28:30 +0000
 1.2.2.1 06-Jun-2015  skrll Sync with HEAD
 1.44 14-Oct-2025  tnn g/c opt_dsrtc.h reference
 1.43 13-Oct-2025  thorpej Garbage-collect the "base_year_is_2000" property and associated
DSRTC_YEAR_START_2K config option (only used by Iyonix GENERIC).
Instead, set the "start-year" property to 2000 as needed (matches
the property name in the Devicetree RTC bindings used for the same
purpose).
 1.42 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.41 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.40 24-Jan-2023  mlelstv Don't panic with invalid user data, just return an error.
 1.39 03-Aug-2021  andvar Fix various typos in comments. Also add missing NetBSD RCS Id in some of these files.
 1.38 27-Jan-2021  thorpej Use DEVICE_COMPAT_EOL.
 1.37 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.36 18-Jan-2021  thorpej Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup(). This pattern is less awkward to use.
 1.35 17-Jan-2021  thorpej Change the device_compatible_entry struct to have a union of
a scalar value (uintptr_t value) and a pointer value (const void *data),
rather than just "uintptr_t data". This eliminates the need for drivers
to cast this value, and doesn't lose const'ness of pointers assigned
to the field.

Update all of the users of this field to use the correct set of
designated initialisers for each specific case.
 1.34 02-Jan-2020  thorpej branches: 1.34.8;
No need to use I2C_F_POLL here.
 1.33 29-Sep-2019  macallan appease -Werror=stack-protector by avoiding variable sized arrays
Now this builds and works on sparc64
 1.32 29-Sep-2019  macallan add another matchstring for the ds1307 found in Sun Fire V210 ( and probably
V240 )
 1.31 20-Dec-2018  macallan make DSRTC_FLAG_YEAR_START_2K settable by device property
 1.30 14-Dec-2018  macallan add options DSRTC_YEAR_START_2K for machines which use 2000 and not 1970
as base to count years from, like Iyonix.
While there apply the offset when writing to the clock as well.
 1.29 26-Jun-2018  thorpej branches: 1.29.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.28 26-Jun-2018  thorpej Change device_compatible_match() and iic_compatible_match() to return
the weighted match value and take an optional compatible-entry pointer,
rather than the other way around.
 1.27 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.26 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.

In addition to the above:
- Add support for direct-config matching this driver based on
"compatible" properties.
- Address-only matching is now done based on the specific addresses
the requested model supports.
- "compatible" property can specify to the driver which model is to
be used, so that using config "flags" directives aren't required
in the direct-config case.

XXX More changes coming that require re-factoring some other code.
 1.25 28-Oct-2017  riastradh branches: 1.25.2;
Kill some more extern struct cfdriver declarations.

Down with externs in .c!
 1.24 18-Oct-2016  aymeric add support for the MCP7940 based Pi Face Real Time Clock
 1.23 04-Oct-2016  kiyohara Add DS1340.
 1.22 05-Apr-2016  bouyer branches: 1.22.2;
Fix DS1672 suppport: need to provide dm_ch_reg to avoid a KASSERT
on write. For consistency set dm_ch_value too, even if it's unused.
 1.21 20-Nov-2014  christos branches: 1.21.2;
use the inline bcdtobin and bintobcd directly instead through a macro.
 1.20 13-Oct-2014  martin Initialize a variable that gcc thinks might be used uninitialized.
 1.19 12-Oct-2014  macallan - support DS3231 ( more or less a DS3232 without NVRAM it seems )
- support the DS3231's temperature sensor
 1.18 25-Jul-2014  dholland branches: 1.18.2;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.17 16-Mar-2014  dholland branches: 1.17.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.16 25-Jul-2012  matt branches: 1.16.2; 1.16.4;
Clean up error messages.
Tidy some logic.
 1.15 23-Feb-2012  matt Rework this driver to support other dsrtc than just the DS1307.
Support both BCD and 32-bit binary type RTCs.
Supports DS1339, DS1672, and DS3232.
To select variant, put the module # in flags in the the config file.
dsrtc at iic0 addr 0x69 flags 1339
If the flags is not supplied, a 1307 is assumed (compatible).
 1.14 07-Jan-2012  phx Fixed 12/24h mode. Bit 6 from the hours register indicates 12h mode.
Do not overwrite the control register (0x07) with random contents.
 1.13 28-May-2011  phx branches: 1.13.4; 1.13.8;
Add direct config support for all devices used by sandpoint.
 1.12 08-Jun-2008  tsutsui branches: 1.12.20; 1.12.26;
Replace device_lookup() with device_lookup_private() to get softc
after device_t/softc split. PR kern/38885 from Jonathan A. Kollasch.
 1.11 04-May-2008  xtraeme branches: 1.11.2;
device_t/softc split and other related cosmetic changes.
 1.10 06-Apr-2008  cegger branches: 1.10.2; 1.10.4;
use aprint_*_dev and device_xname
 1.9 11-Dec-2007  lukem branches: 1.9.8;
use __KERNEL_RCSID()
 1.8 12-Jan-2007  cube branches: 1.8.20; 1.8.28; 1.8.30; 1.8.32;
Add missing initializers in cdevsw structs.
 1.7 09-Sep-2006  gdamore Convert to MI clock_ymdhms versions of todr calls.
 1.6 04-Sep-2006  gdamore branches: 1.6.2;
Remove unused todr_setcal/todr_getcal and all the assorted stub
implementations.
 1.5 29-Mar-2006  thorpej Use device_private().
 1.4 13-Dec-2005  abs branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10; 1.4.12;
Update some missed _close() and _open() functions from 'struct proc *p'
to 'struct lwp *l'.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Jun-2005  he branches: 1.2.2;
Fix the various todr_gettime() and todr_settime() fallouts from
-Wcast-qual differently, by instead changing the signatore of those
"functions" to take a "volatile struct timeval*" instead of a
"struct timeval*". Many places, these functions are called with
&time, and time is declared as volatile in <sys/kernel.h>. This
way we can get rid of all the ugly casts which now also triggered
warnings, and caused more code to be added to work around the
problem.

Reviewed by thorpej.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file ds1307.c was added on branch ktrace-lwp on 2004-08-03 10:46:05 +0000
 1.2.2.4 21-Jan-2008  yamt sync with head
 1.2.2.3 26-Feb-2007  yamt sync with head.
 1.2.2.2 30-Dec-2006  yamt sync with head.
 1.2.2.1 21-Jun-2006  yamt sync with head.
 1.4.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.4.10.1 19-Apr-2006  elad sync with head.
 1.4.8.2 14-Sep-2006  yamt sync with head.
 1.4.8.1 01-Apr-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.2 01-Feb-2007  ad Sync with head.
 1.6.2.1 18-Nov-2006  ad Sync with head.
 1.8.32.1 13-Dec-2007  bouyer Sync with HEAD
 1.8.30.1 11-Dec-2007  yamt sync with head.
 1.8.28.1 26-Dec-2007  ad Sync with head.
 1.8.20.1 09-Jan-2008  matt sync with HEAD
 1.9.8.2 29-Jun-2008  mjf Sync with HEAD.
 1.9.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.4.2 04-May-2009  yamt sync with head.
 1.10.4.1 16-May-2008  yamt sync with head.
 1.10.2.2 17-Jun-2008  yamt sync with head.
 1.10.2.1 18-May-2008  yamt sync with head.
 1.11.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.12.26.1 06-Jun-2011  jruoho Sync with HEAD.
 1.12.20.1 31-May-2011  rmind sync with head
 1.13.8.2 24-Feb-2012  mrg sync to -current.
 1.13.8.1 18-Feb-2012  mrg merge to -current.
 1.13.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.4.2 30-Oct-2012  yamt sync with head
 1.13.4.1 17-Apr-2012  yamt sync with head
 1.16.4.1 18-May-2014  rmind sync with head
 1.16.2.2 03-Dec-2017  jdolecek update from HEAD
 1.16.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.2.1 10-Aug-2014  tls Rebase.
 1.18.2.1 14-Apr-2015  snj Pull up following revision(s) (requested by nonaka in ticket #672):
sys/dev/i2c/ds1307.c: revisions 1.19, 1.20
sys/dev/i2c/ds1307reg.h: revision 1.5
- support DS3231 ( more or less a DS3232 without NVRAM it seems )
- support the DS3231's temperature sensor
--
Initialize a variable that gcc thinks might be used uninitialized.
 1.21.2.2 05-Dec-2016  skrll Sync with HEAD
 1.21.2.1 22-Apr-2016  skrll Sync with HEAD
 1.22.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.25.2.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.25.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.25.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.29.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.29.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.29.2.1 10-Jun-2019  christos Sync with HEAD
 1.34.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.8 18-Oct-2016  aymeric add support for the MCP7940 based Pi Face Real Time Clock
 1.7 04-Oct-2016  kiyohara Add DS1340.
 1.6 05-Apr-2016  bouyer branches: 1.6.2;
Fix DS1672 suppport: need to provide dm_ch_reg to avoid a KASSERT
on write. For consistency set dm_ch_value too, even if it's unused.
 1.5 12-Oct-2014  macallan branches: 1.5.2;
- support DS3231 ( more or less a DS3232 without NVRAM it seems )
- support the DS3231's temperature sensor
 1.4 23-Feb-2012  matt branches: 1.4.2; 1.4.14;
Rework this driver to support other dsrtc than just the DS1307.
Support both BCD and 32-bit binary type RTCs.
Supports DS1339, DS1672, and DS3232.
To select variant, put the module # in flags in the the config file.
dsrtc at iic0 addr 0x69 flags 1339
If the flags is not supplied, a 1307 is assumed (compatible).
 1.3 07-Jan-2012  phx Fixed 12/24h mode. Bit 6 from the hours register indicates 12h mode.
Do not overwrite the control register (0x07) with random contents.
 1.2 11-Dec-2005  christos branches: 1.2.110; 1.2.114;
merge ktrace-lwp.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file ds1307reg.h was added on branch ktrace-lwp on 2004-08-03 10:46:05 +0000
 1.2.114.2 24-Feb-2012  mrg sync to -current.
 1.2.114.1 18-Feb-2012  mrg merge to -current.
 1.2.110.1 17-Apr-2012  yamt sync with head
 1.4.14.1 14-Apr-2015  snj Pull up following revision(s) (requested by nonaka in ticket #672):
sys/dev/i2c/ds1307.c: revisions 1.19, 1.20
sys/dev/i2c/ds1307reg.h: revision 1.5
- support DS3231 ( more or less a DS3232 without NVRAM it seems )
- support the DS3231's temperature sensor
--
Initialize a variable that gcc thinks might be used uninitialized.
 1.4.2.1 03-Dec-2017  jdolecek update from HEAD
 1.5.2.2 05-Dec-2016  skrll Sync with HEAD
 1.5.2.1 22-Apr-2016  skrll Sync with HEAD
 1.6.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.1 10-Nov-2007  matt branches: 1.1.2;
file ds1672.c was initially added on branch matt-nb4-arm.
 1.1.2.1 10-Nov-2007  matt Add AT91 support from Sami Kantoluoto
Add TI OMAP2430 support from Marty Fouts @ Danger Inc
 1.1 10-Nov-2007  matt branches: 1.1.2;
file ds1672reg.h was initially added on branch matt-nb4-arm.
 1.1.2.1 10-Nov-2007  matt Add AT91 support from Sami Kantoluoto
Add TI OMAP2430 support from Marty Fouts @ Danger Inc
 1.2 06-Nov-2024  riastradh branches: 1.2.4;
ds2482ow(4): KNF

No functional change intended.

Non-whitespace changes:

1. Sort includes.

2. Say `if (sc->sc_is_800)', not `if (sc->sc_is_800 == true)'; no
need to have multiple redundant verbs and boolean tests in this
phrasing.

3. Use __nothing (a statement that has no effect), not empty token
sequence, for macros that have no effect. This avoids potential
confusion in places that expect exactly one statement. (If this
change does have a functional effect, well, something must have
been broken before!)

4. Omit needless `return;' at the end of void functions.
(ds2482_attach still needs something after `out:', though, and
`out: return;' is a little less obscure than `out:;'.)

Some of this nesting is a little excessive. It would help legibility
and avoid excessive nesting depth to rephrase things like

error = foo();
if (!error)
error = bar();
if (!error) {
error = baz();
if (!error)
error = quux();
if (!error) {
error = zot();
if (!error) {
error = mumble();
if (!error) {
error = frotz();
if (!error) {
*obuf = xbuf;
}
}
}
}
}

as

error = foo();
if (error)
goto out; /* or break, in this case */
error = bar();
if (error)
goto out;
error = baz();
if (error)
goto out;
error = quux();
if (error)
goto out;
error = zot();
if (error)
goto out;
error = mumble();
if (error)
goto out;
error = frotz();
if (error)
goto out;
*obuf = xbuf;

so that the indentation level doesn't grow indefinitely and the
expected-taken normal path remains unindented while the
expected-not-taken error branches get indentation. (But that's a lot
more churn to the code, and more error-prone, than seemed appropriate
here.)
 1.1 04-Nov-2024  brad Add a driver for the Maxim DS2482-100 and DS2482-800 I2C to 1-Wire
bridge.

This chip provides a I2C device that then has 1 or 8 1-Wire busses on
the other side. The 1-Wire buses show up as onewire(4) buses in the
NetBSD.

The chip can be used in situations where:

* You have a I2C bus extended a long distance, say with a LTC4311
active terminator / extender or one of the differential I2C
extenders and you would like to have a 1-Wire device on the far end
and it isn't possible to add wiring to get to the far end.

* You are either out of GPIO pins or the GPIO pins are not reliable
enough to use gpioow(4), but you do have working I2C.

The DS2482 does all of the 1-Wire signals in hardware and provides for
a couple of pullup options for the 1-Wire devices.

All of the functions of the DS2482-100 and -800 are supported except
for overdrive speed support. To do this will likely require some API
changes to onewire(4).

Breakout boards exist for the DS2482 for both variants, but they
appear to be more expensive than expected. The chip itself is quiet
cheap and wasn't all that hard to SMD solder to a board. No other
components are really needed.

There are other members in the same family, the DS2482-101, DS2484 and
DS2485. The DS2482-101 has a sleep pin, but from the datasheet
appears to program the same as the -100 variant. The DS2484 has a
slightly different way to set configuration information and probably
won't quite work with the driver, but isn't far off. The DS2485 is
very different and would require a new driver to function.
 1.2.4.2 02-Aug-2025  perseant Sync with HEAD
 1.2.4.1 06-Nov-2024  perseant file ds2482ow.c was added on branch perseant-exfatfs on 2025-08-02 05:56:39 +0000
 1.1 04-Nov-2024  brad branches: 1.1.4;


Add a driver for the Maxim DS2482-100 and DS2482-800 I2C to 1-Wire
bridge.

This chip provides a I2C device that then has 1 or 8 1-Wire busses on
the other side. The 1-Wire buses show up as onewire(4) buses in the
NetBSD.

The chip can be used in situations where:

* You have a I2C bus extended a long distance, say with a LTC4311
active terminator / extender or one of the differential I2C
extenders and you would like to have a 1-Wire device on the far end
and it isn't possible to add wiring to get to the far end.

* You are either out of GPIO pins or the GPIO pins are not reliable
enough to use gpioow(4), but you do have working I2C.

The DS2482 does all of the 1-Wire signals in hardware and provides for
a couple of pullup options for the 1-Wire devices.

All of the functions of the DS2482-100 and -800 are supported except
for overdrive speed support. To do this will likely require some API
changes to onewire(4).

Breakout boards exist for the DS2482 for both variants, but they
appear to be more expensive than expected. The chip itself is quiet
cheap and wasn't all that hard to SMD solder to a board. No other
components are really needed.

There are other members in the same family, the DS2482-101, DS2484 and
DS2485. The DS2482-101 has a sleep pin, but from the datasheet
appears to program the same as the -100 variant. The DS2484 has a
slightly different way to set configuration information and probably
won't quite work with the driver, but isn't far off. The DS2485 is
very different and would require a new driver to function.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 04-Nov-2024  perseant file ds2482owreg.h was added on branch perseant-exfatfs on 2025-08-02 05:56:39 +0000
 1.3 06-Nov-2024  riastradh branches: 1.3.4;
dev/i2c/ds4284owvar.h: Add missing includes.
 1.2 06-Nov-2024  riastradh ds2482ow(4): KNF

No functional change intended.

Non-whitespace changes:

1. Sort includes.

2. Say `if (sc->sc_is_800)', not `if (sc->sc_is_800 == true)'; no
need to have multiple redundant verbs and boolean tests in this
phrasing.

3. Use __nothing (a statement that has no effect), not empty token
sequence, for macros that have no effect. This avoids potential
confusion in places that expect exactly one statement. (If this
change does have a functional effect, well, something must have
been broken before!)

4. Omit needless `return;' at the end of void functions.
(ds2482_attach still needs something after `out:', though, and
`out: return;' is a little less obscure than `out:;'.)

Some of this nesting is a little excessive. It would help legibility
and avoid excessive nesting depth to rephrase things like

error = foo();
if (!error)
error = bar();
if (!error) {
error = baz();
if (!error)
error = quux();
if (!error) {
error = zot();
if (!error) {
error = mumble();
if (!error) {
error = frotz();
if (!error) {
*obuf = xbuf;
}
}
}
}
}

as

error = foo();
if (error)
goto out; /* or break, in this case */
error = bar();
if (error)
goto out;
error = baz();
if (error)
goto out;
error = quux();
if (error)
goto out;
error = zot();
if (error)
goto out;
error = mumble();
if (error)
goto out;
error = frotz();
if (error)
goto out;
*obuf = xbuf;

so that the indentation level doesn't grow indefinitely and the
expected-taken normal path remains unindented while the
expected-not-taken error branches get indentation. (But that's a lot
more churn to the code, and more error-prone, than seemed appropriate
here.)
 1.1 04-Nov-2024  brad Add a driver for the Maxim DS2482-100 and DS2482-800 I2C to 1-Wire
bridge.

This chip provides a I2C device that then has 1 or 8 1-Wire busses on
the other side. The 1-Wire buses show up as onewire(4) buses in the
NetBSD.

The chip can be used in situations where:

* You have a I2C bus extended a long distance, say with a LTC4311
active terminator / extender or one of the differential I2C
extenders and you would like to have a 1-Wire device on the far end
and it isn't possible to add wiring to get to the far end.

* You are either out of GPIO pins or the GPIO pins are not reliable
enough to use gpioow(4), but you do have working I2C.

The DS2482 does all of the 1-Wire signals in hardware and provides for
a couple of pullup options for the 1-Wire devices.

All of the functions of the DS2482-100 and -800 are supported except
for overdrive speed support. To do this will likely require some API
changes to onewire(4).

Breakout boards exist for the DS2482 for both variants, but they
appear to be more expensive than expected. The chip itself is quiet
cheap and wasn't all that hard to SMD solder to a board. No other
components are really needed.

There are other members in the same family, the DS2482-101, DS2484 and
DS2485. The DS2482-101 has a sleep pin, but from the datasheet
appears to program the same as the -100 variant. The DS2484 has a
slightly different way to set configuration information and probably
won't quite work with the driver, but isn't far off. The DS2485 is
very different and would require a new driver to function.
 1.3.4.2 02-Aug-2025  perseant Sync with HEAD
 1.3.4.1 06-Nov-2024  perseant file ds2482owvar.h was added on branch perseant-exfatfs on 2025-08-02 05:56:39 +0000
 1.17 04-Oct-2025  martin Remove (now) unused variable.
 1.16 03-Oct-2025  thorpej Use device_{get,set}prop_string() for sensor names.
 1.15 21-Sep-2025  thorpej Get the sensor descriptive information from our device properties
dictionary, rather than from a secondary dictionary passed in the
i2c_attach_args (this secondary dictionary is deprecated and going
away).
 1.14 21-Jun-2021  christos branches: 1.14.6;
fix proplib deprecation
 1.13 15-Jun-2021  mlelstv iic_acquire_bus may fail.
 1.12 01-Mar-2021  rin branches: 1.12.4;
Use dstemp(4) as entropy source.
 1.11 30-Jan-2021  thorpej Add the standard compat string from the Device Tree bindings.
 1.10 30-Jan-2021  thorpej If we're going to keep a reference on the "props" dictionary from
the i2c_attach_args, we should retain it.
 1.9 27-Jan-2021  thorpej Use DEVICE_COMPAT_EOL.
 1.8 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.7 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.6 21-Aug-2020  macallan branches: 1.6.2;
more OF -> properties for sensor names, this should be the last one
 1.5 28-Feb-2020  macallan - document the config register
- do some setup and send a start command
- mark the sensor as invalid if readings are out of range
now this works properly on my PCI-X G5
 1.4 26-Jun-2018  thorpej branches: 1.4.2; 1.4.10;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.3 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.2 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.1 01-Feb-2018  macallan branches: 1.1.2;
add driver for Maxim DS1631 High-Precision Digital Thermometer and Thermostat
temperature reading only for now
 1.1.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.1.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.4.10.1 29-Feb-2020  ad Sync with head.
 1.4.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.6.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.12.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.12.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.14.6.1 10-Sep-2021  thorpej Remove unnecessary references to i2c_attach_args::ia_prop and mark the ones
that remain as XXX.
 1.10 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.9 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.8 27-Jan-2021  thorpej Use DEVICE_COMPAT_EOL.
 1.7 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.6 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.5 23-Dec-2020  uwe G/c trailing whitespace.
 1.4 23-Dec-2020  thorpej Add direct-config support.
 1.3 27-Jul-2019  thorpej branches: 1.3.10;
No need to check cold to add I2C_F_POLL; the i2c API does it for us now.
 1.2 16-Jun-2018  thorpej branches: 1.2.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.1 05-Jan-2018  uwe branches: 1.1.2;
Driver for EM Microelectronic EM3027 RTC and temperature sensor.
 1.1.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.2.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.10.2 03-Apr-2021  thorpej Sync with HEAD.
 1.3.10.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.1 05-Jan-2018  uwe Driver for EM Microelectronic EM3027 RTC and temperature sensor.
 1.2 08-Jul-2025  gutteridge branches: 1.2.4;
emcfan.c: minor spelling and grammar tweaks in comments
 1.1 11-Mar-2025  brad A driver and userland utility for a couple of families of the
Microchip Technology / SMSC fan controller chips.

The driver and utility supports the:

o EMC2101 and EMC2101-R
o EMC2103-1, EMC2102-2 and EMC2103-4
o EMC2104
o EMC2106
o EMC2301
o EMC2302
o EMC2303
o EMC2305

The EMC210X family supports 1 or 2 fans with tachometer. Depending on
the chip, it may support 2 additional fans without tach and might
support a high side attachment (i.e. a fan, usually 5v, driven
directly from the chip and not PWM or DAC). All versions of EMC210X
support internal temperature measurements, and depending on the chip,
may support up to 5 additional temperature zones. The tachometers and
temperature measurements are provided to the system via the envsys(4)
framework. Some chip types support GPIO pins and support is provided
via the gpio(4) framework.

The EMC230X family supports 1, 2, 3 or 5 fans with the same number of
tachometers. No temperature zone or GPIO support. The tachometers
are provided to the system via the envsys(4) framework. The fan
support can be provided by PWM signaling or DAC.

The two chip families mostly do PWM signaling for the fan speed, but a
number of them support DAC output, a 0 to 3v or so voltage. When the
chip supports external temperature zones, this is done usually by a
bipolar NPN or PNP transister configured as a diode, but some of the
chip varients support thermistors.

The emcfan(4) kernel driver provides a simple read / write / seek
device in /dev/ to the register set in the chip. The heavy lifting is
done in the userland utility emcfanctl(8) which provides the ability
to read and write to any valid register and provides some basic higher
level commands to control fan behavior. The output is simple text
lines, or JSON.

The kernel driver does not reset or other mess with the chip, aside
from reading registers. It is entirely possible that something else
in any particular system is the major manager of the fan controller
and it would not do for the kernel driver to mess too much with the
attached device. All interactions are intentional via the userland
utility.

It is known that a EMC2301 is present on the Raspberry PI 4 Compute IO
module (not to be confused with the Raspberry PI 4 Compute module
itself) and there is a breakout board from Adafruit with a EMC2101 on
it. The chips themselves are pretty inexpensive from Mouser or
Digi-key and can be soldered using the simpler SMD soldering
techniques. A number of the variants are QFN packages, but the pads
are exposed to the side of the chip. No other external components are
required to use these fan controllers.
 1.2.4.2 02-Aug-2025  perseant Sync with HEAD
 1.2.4.1 08-Jul-2025  perseant file emcfan.c was added on branch perseant-exfatfs on 2025-08-02 05:56:39 +0000
 1.1 11-Mar-2025  brad branches: 1.1.4;



A driver and userland utility for a couple of families of the
Microchip Technology / SMSC fan controller chips.

The driver and utility supports the:

o EMC2101 and EMC2101-R
o EMC2103-1, EMC2102-2 and EMC2103-4
o EMC2104
o EMC2106
o EMC2301
o EMC2302
o EMC2303
o EMC2305

The EMC210X family supports 1 or 2 fans with tachometer. Depending on
the chip, it may support 2 additional fans without tach and might
support a high side attachment (i.e. a fan, usually 5v, driven
directly from the chip and not PWM or DAC). All versions of EMC210X
support internal temperature measurements, and depending on the chip,
may support up to 5 additional temperature zones. The tachometers and
temperature measurements are provided to the system via the envsys(4)
framework. Some chip types support GPIO pins and support is provided
via the gpio(4) framework.

The EMC230X family supports 1, 2, 3 or 5 fans with the same number of
tachometers. No temperature zone or GPIO support. The tachometers
are provided to the system via the envsys(4) framework. The fan
support can be provided by PWM signaling or DAC.

The two chip families mostly do PWM signaling for the fan speed, but a
number of them support DAC output, a 0 to 3v or so voltage. When the
chip supports external temperature zones, this is done usually by a
bipolar NPN or PNP transister configured as a diode, but some of the
chip varients support thermistors.

The emcfan(4) kernel driver provides a simple read / write / seek
device in /dev/ to the register set in the chip. The heavy lifting is
done in the userland utility emcfanctl(8) which provides the ability
to read and write to any valid register and provides some basic higher
level commands to control fan behavior. The output is simple text
lines, or JSON.

The kernel driver does not reset or other mess with the chip, aside
from reading registers. It is entirely possible that something else
in any particular system is the major manager of the fan controller
and it would not do for the kernel driver to mess too much with the
attached device. All interactions are intentional via the userland
utility.

It is known that a EMC2301 is present on the Raspberry PI 4 Compute IO
module (not to be confused with the Raspberry PI 4 Compute module
itself) and there is a breakout board from Adafruit with a EMC2101 on
it. The chips themselves are pretty inexpensive from Mouser or
Digi-key and can be soldered using the simpler SMD soldering
techniques. A number of the variants are QFN packages, but the pads
are exposed to the side of the chip. No other external components are
required to use these fan controllers.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 11-Mar-2025  perseant file emcfaninfo.h was added on branch perseant-exfatfs on 2025-08-02 05:56:39 +0000
 1.1 11-Mar-2025  brad branches: 1.1.4;



A driver and userland utility for a couple of families of the
Microchip Technology / SMSC fan controller chips.

The driver and utility supports the:

o EMC2101 and EMC2101-R
o EMC2103-1, EMC2102-2 and EMC2103-4
o EMC2104
o EMC2106
o EMC2301
o EMC2302
o EMC2303
o EMC2305

The EMC210X family supports 1 or 2 fans with tachometer. Depending on
the chip, it may support 2 additional fans without tach and might
support a high side attachment (i.e. a fan, usually 5v, driven
directly from the chip and not PWM or DAC). All versions of EMC210X
support internal temperature measurements, and depending on the chip,
may support up to 5 additional temperature zones. The tachometers and
temperature measurements are provided to the system via the envsys(4)
framework. Some chip types support GPIO pins and support is provided
via the gpio(4) framework.

The EMC230X family supports 1, 2, 3 or 5 fans with the same number of
tachometers. No temperature zone or GPIO support. The tachometers
are provided to the system via the envsys(4) framework. The fan
support can be provided by PWM signaling or DAC.

The two chip families mostly do PWM signaling for the fan speed, but a
number of them support DAC output, a 0 to 3v or so voltage. When the
chip supports external temperature zones, this is done usually by a
bipolar NPN or PNP transister configured as a diode, but some of the
chip varients support thermistors.

The emcfan(4) kernel driver provides a simple read / write / seek
device in /dev/ to the register set in the chip. The heavy lifting is
done in the userland utility emcfanctl(8) which provides the ability
to read and write to any valid register and provides some basic higher
level commands to control fan behavior. The output is simple text
lines, or JSON.

The kernel driver does not reset or other mess with the chip, aside
from reading registers. It is entirely possible that something else
in any particular system is the major manager of the fan controller
and it would not do for the kernel driver to mess too much with the
attached device. All interactions are intentional via the userland
utility.

It is known that a EMC2301 is present on the Raspberry PI 4 Compute IO
module (not to be confused with the Raspberry PI 4 Compute module
itself) and there is a breakout board from Adafruit with a EMC2101 on
it. The chips themselves are pretty inexpensive from Mouser or
Digi-key and can be soldered using the simpler SMD soldering
techniques. A number of the variants are QFN packages, but the pads
are exposed to the side of the chip. No other external components are
required to use these fan controllers.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 11-Mar-2025  perseant file emcfanreg.h was added on branch perseant-exfatfs on 2025-08-02 05:56:39 +0000
 1.1 11-Mar-2025  brad branches: 1.1.4;



A driver and userland utility for a couple of families of the
Microchip Technology / SMSC fan controller chips.

The driver and utility supports the:

o EMC2101 and EMC2101-R
o EMC2103-1, EMC2102-2 and EMC2103-4
o EMC2104
o EMC2106
o EMC2301
o EMC2302
o EMC2303
o EMC2305

The EMC210X family supports 1 or 2 fans with tachometer. Depending on
the chip, it may support 2 additional fans without tach and might
support a high side attachment (i.e. a fan, usually 5v, driven
directly from the chip and not PWM or DAC). All versions of EMC210X
support internal temperature measurements, and depending on the chip,
may support up to 5 additional temperature zones. The tachometers and
temperature measurements are provided to the system via the envsys(4)
framework. Some chip types support GPIO pins and support is provided
via the gpio(4) framework.

The EMC230X family supports 1, 2, 3 or 5 fans with the same number of
tachometers. No temperature zone or GPIO support. The tachometers
are provided to the system via the envsys(4) framework. The fan
support can be provided by PWM signaling or DAC.

The two chip families mostly do PWM signaling for the fan speed, but a
number of them support DAC output, a 0 to 3v or so voltage. When the
chip supports external temperature zones, this is done usually by a
bipolar NPN or PNP transister configured as a diode, but some of the
chip varients support thermistors.

The emcfan(4) kernel driver provides a simple read / write / seek
device in /dev/ to the register set in the chip. The heavy lifting is
done in the userland utility emcfanctl(8) which provides the ability
to read and write to any valid register and provides some basic higher
level commands to control fan behavior. The output is simple text
lines, or JSON.

The kernel driver does not reset or other mess with the chip, aside
from reading registers. It is entirely possible that something else
in any particular system is the major manager of the fan controller
and it would not do for the kernel driver to mess too much with the
attached device. All interactions are intentional via the userland
utility.

It is known that a EMC2301 is present on the Raspberry PI 4 Compute IO
module (not to be confused with the Raspberry PI 4 Compute module
itself) and there is a breakout board from Adafruit with a EMC2101 on
it. The chips themselves are pretty inexpensive from Mouser or
Digi-key and can be soldered using the simpler SMD soldering
techniques. A number of the variants are QFN packages, but the pads
are exposed to the side of the chip. No other external components are
required to use these fan controllers.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 11-Mar-2025  perseant file emcfanvar.h was added on branch perseant-exfatfs on 2025-08-02 05:56:39 +0000
 1.8 20-Sep-2025  mrg fix a error in the previous.

don't try to use sc->sc_dev before it has been assigned.

fixes crash on rockpro64.
 1.7 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.6 11-Dec-2023  mlelstv Output is always 16bit, the internal audio data type may differ.
 1.5 27-Jan-2021  thorpej branches: 1.5.4; 1.5.14;
Use DEVICE_COMPAT_EOL.
 1.4 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.3 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.2 03-Jan-2020  jmcneill branches: 1.2.4; 1.2.8; 1.2.12;
Avoid sleeping while the audio intr lock is held.
 1.1 02-Jan-2020  jmcneill Add driver for Everest Semi ES8316 Low Power Audio CODEC
 1.2.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2.8.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.8.1 03-Jan-2020  martin file es8316ac.c was added on branch phil-wifi on 2020-04-08 14:08:05 +0000
 1.2.4.2 21-Jan-2020  martin Pull up following revision(s) (requested by mrg in ticket #616):

sys/dev/ic/anx_dp.c: revision 1.2
sys/arch/evbarm/conf/GENERIC64: revision 1.126
sys/dev/ic/anx_dp.h: revision 1.1
sys/arch/evbarm/conf/GENERIC64: revision 1.128
sys/dev/ic/anx_dp.h: revision 1.2
sys/dev/fdt/dwcmmc_fdt.c: revision 1.9
sys/dev/i2c/cwfg.c: revision 1.1
sys/conf/files: revision 1.1247
sys/dev/fdt/pwm_backlight.c: revision 1.5
sys/dev/fdt/pwm_backlight.c: revision 1.6
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.14
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.15
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.16
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.17
sys/dev/ic/dwc_mmc.c: revision 1.20
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.18
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.19
sys/dev/usb/usbdevs: revision 1.775
sys/arch/arm/rockchip/rk_dwhdmi.c: revision 1.4
sys/dev/fdt/simple_amplifier.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.105
sys/arch/evbarm/conf/GENERIC64: revision 1.117
sys/arch/evbarm/conf/GENERIC64: revision 1.118
sys/dev/i2c/files.i2c: revision 1.107
sys/dev/fdt/files.fdt: revision 1.49
sys/arch/arm/rockchip/rk_anxdp.c: revision 1.1
sys/dev/ic/dwc_mmc_var.h: revision 1.9
sys/dev/i2c/rkpmic.c: revision 1.4
sys/arch/arm/rockchip/rk_anxdp.c: revision 1.2
sys/dev/i2c/rkpmic.c: revision 1.5
sys/dev/i2c/rkpmic.c: revision 1.6
sys/arch/arm/rockchip/rk_vop.c: revision 1.4
sys/arch/arm/rockchip/rk_vop.c: revision 1.5
sys/dev/i2c/rkpmic.c: revision 1.8
sys/arch/arm/dts/rk3399-pinebook-pro.dts: revision 1.1
sys/dev/usb/ums.c: revision 1.96 (via patch)
sys/arch/arm/rockchip/rk_pwm.c: revision 1.3
sys/arch/arm/dts/rk3399-pinebook-pro.dts: revision 1.2
sys/dev/i2c/es8316ac.c: revision 1.1
sys/dev/fdt/dwcmmc_fdt.c: revision 1.10
sys/dev/i2c/es8316ac.c: revision 1.2
sys/dev/fdt/fdt_panel.c: revision 1.1
sys/dev/ic/dwc_mmc.c: revision 1.18
sys/dev/fdt/fdt_panel.c: revision 1.2
sys/dev/ic/dwc_mmc.c: revision 1.19
sys/arch/arm/dts/rk3399-rockpro64.dts: revision 1.10
sys/dev/fdt/fdt_port.c: revision 1.5
sys/dev/ic/dwc_mmc_var.h: revision 1.10
sys/dev/fdt/fdt_port.c: revision 1.6
sys/arch/evbarm/conf/GENERIC64: revision 1.122
sys/dev/ic/dwc_mmc_var.h: revision 1.11
sys/dev/fdt/files.fdt: revision 1.50
sys/arch/evbarm/conf/GENERIC64: revision 1.123
sys/arch/arm/rockchip/rk_i2s.c: revision 1.2
sys/arch/arm/rockchip/files.rockchip: revision 1.23
sys/arch/evbarm/conf/GENERIC64: revision 1.124
sys/dev/ic/anx_dp.c: revision 1.1

rkpmic: add RTC support; register w/ todr(9)
rkpmic: correct delay
Add support for SDIO interrupts.
fix copy/paste error in mux_pll_src_cpll_gpll_ppll_parents[]
add RK3399 eDP clocks
add RK3399 DisplayPort clocks
style fix/KNF
rk3399_cru: implement dclk_vop0_frac and dclk_vop1_frac
Move drm_encoder from rkvop(4) to the SoC-layer output pipe drivers (rk_dwhdmi).
rkvop: set stride using virtual framebuffer width instead of display mode
rk3399_cru: Reparent dclk_vop[01] to gpll via dclk_vop[01]_frac.
The previous source of dclk_vop[01] was vpll via dclk_vop[01]_div.
vpll is apparently used directly as a pixel clock source for the
HDMI PHY, and we don't want the other VOP's dclk changing out from
under it because we can't handle finding a replacement clock source
with the right rate yet.
gpll happens to run at 594MHz, which works well as a basis for pixel
clocks.
Linux suggests that the source clock of the fractional divider needs
to be more than twenty times greater than the resulting clock (or some
intermediate clock?) for output stability. This may not be the case
with 594MHz and the common pixel clocks I see used by displays in my
area of the wild, but it works for now.
add Analogix DisplayPort core driver
add Rockchip (RK3399) glue for Analogix DisplayPort core
add anxdp(4)
Add another panel@fdt driver, this time for DRM-style panels.
To do: migrate away from other panel driver.
enable panel at fdt drivers
paper over the rkpwm get_conf function that otherwise doesn't seem to
let things work
add template bits for optional eDP panel on RockPro64
Abort panel driver attach if required regulator is missing.
Add clk provider
Add Pinebook Pro dts, from Manjaro Linux.
https://gitlab.manjaro.org/tsys/linux-pinebook-pro/blob/877ca0e7283596f37845de50dc36bff5b88b91e1/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
+ rk3399-pinebook-pro.dts
Attach mmcpwrseq resource earlier
dwcmmc improvements:
- Use mmcpwrseq resources if available
- Only set 4- or 8-bit mode if specified in the dt properties
- Add quirk for implementations with inverted power enable logic
- Support switching signal voltage between 1.8V and 3.3V
- Fix a clock divider issue on Rockchip SoCs
Fix performance regression with previous
Quiet chatty printfs
No need to print all supported levels at attach, print the range and total number of steps
Disable SPI for now (rkspi driver hangs at boot)
Add driver for simple-audio-amplifier binding
Add driver for Everest Semi ES8316 Low Power Audio CODEC
add es8316, simpleamp
Avoid sleeping while the audio intr lock is held.
If the rockchip,system-power-controller property is present, try to power off with the PMIC
Add HAILUCK keyboard (product 1e)
Add a quirk for the HAILUCK USB keyboard / touchpad device with product 1e.
The keyboard does not function properly unless the touchpad's intr endpoint
is active.
Add driver for CellWise CW2015 Fuel Gauge IC.
add cwfg
Emit PMFE_DISPLAY_{ON,OFF} events in response to DPMS requests.
If the backlight node does not have an enable gpio, set the lowest duty
cycle to turn the display off instead.
Attach psci as early as possible. This allows other power controllers to
register their own poweroff / reset callbacks with a higher preference.
Add 2000 MHz to available armclkb rates
Remove debug printfs
 1.2.4.1 03-Jan-2020  martin file es8316ac.c was added on branch netbsd-9 on 2020-01-21 10:39:58 +0000
 1.5.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.5.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.10 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.9 27-Jan-2021  thorpej branches: 1.9.4; 1.9.14;
Use DEVICE_COMPAT_EOL.
 1.8 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.7 18-Jan-2021  thorpej Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup(). This pattern is less awkward to use.
 1.6 17-Jan-2021  thorpej Change the device_compatible_entry struct to have a union of
a scalar value (uintptr_t value) and a pointer value (const void *data),
rather than just "uintptr_t data". This eliminates the need for drivers
to cast this value, and doesn't lose const'ness of pointers assigned
to the field.

Update all of the users of this field to use the correct set of
designated initialisers for each specific case.
 1.5 23-Dec-2019  thorpej branches: 1.5.8;
No need to use I2C_F_POLL here.
 1.4 12-Nov-2019  mrg match DIE_ID of 9 (SILERGY_DIE_ID_SYR83X), seen on some rockpro64s.
 1.3 29-Jun-2019  jmcneill Fix name of suspend voltage selector property
 1.2 29-Aug-2018  jmcneill branches: 1.2.4; 1.2.8;
Initialize transition slew rate if specified in the DT
 1.1 29-Aug-2018  jmcneill Add driver for Silergy SY827/SY828 step down regulator.
 1.2.8.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.8.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.8.2 10-Jun-2019  christos Sync with HEAD
 1.2.8.1 29-Aug-2018  christos file fan53555.c was added on branch phil-wifi on 2019-06-10 22:07:09 +0000
 1.2.4.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2.4.1 29-Aug-2018  pgoyette file fan53555.c was added on branch pgoyette-compat on 2018-09-06 06:55:49 +0000
 1.5.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.9.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.9.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.14 27-Jul-2021  macallan move the fcu driver into arch/macppc where it belongs
 1.13 25-Jul-2021  macallan don't put CPUs in separate zones, turns out there really isn't much that
keeps the airflow apart around them
 1.12 27-Jan-2021  thorpej branches: 1.12.4;
Use DEVICE_COMPAT_EOL.
 1.11 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.10 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.9 15-Jun-2019  macallan branches: 1.9.10;
explicitly initialize sensor->state
 1.8 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.7 28-Jun-2018  macallan fix a tpyo so now we get the correct maximum speed for CPU intake fans
while there, be a bit more responsive to temperature changes
 1.6 26-Jun-2018  thorpej branches: 1.6.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.5 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.4 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.3 21-Mar-2018  macallan effectively enforce fan speed limits, deal with negatives properly
 1.2 16-Mar-2018  macallan implement fan control, get calibration data from EEPROM via uni_n
 1.1 08-Mar-2018  macallan branches: 1.1.2;
preliminary driver for the fan control unit found in some G5
 1.1.2.6 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.5 28-Jul-2018  pgoyette Sync with HEAD
 1.1.2.4 25-Jun-2018  pgoyette Sync with HEAD
 1.1.2.3 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.1.2.2 15-Mar-2018  pgoyette Synch with HEAD
 1.1.2.1 08-Mar-2018  pgoyette file fcu.c was added on branch pgoyette-compat on 2018-03-15 09:12:05 +0000
 1.6.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.6.2.1 10-Jun-2019  christos Sync with HEAD
 1.9.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.12.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.12.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.136 13-Oct-2025  thorpej Garbage-collect the "base_year_is_2000" property and associated
DSRTC_YEAR_START_2K config option (only used by Iyonix GENERIC).
Instead, set the "start-year" property to 2000 as needed (matches
the property name in the Devicetree RTC bindings used for the same
purpose).
 1.135 07-Sep-2025  thorpej Attach the AC100 RTC as a separate child device node.

XXX This driver doesn't really work without FDT.
 1.134 06-Sep-2025  thorpej Step towards modularizing the Flattened Device Tree code.

Define attributes for each of the specific device bindings: clock,
dai, dma, gpio, i2c, iommu, mbox, mmc_pwrseq, phy, power, power domain,
pwm, regulator, reset controller, spi, system controller, pin
controller. Include these support files only if either a provider
or consumer with one of these attributes is present in the kernel
config.

Add the necessary attributes to the device / attach declarations for
each provider and consumer.

There are some bindings that are consumed by generic code (iommu, pinctrl,
power, power domain). Provide weak stubs for these routines to handle
situations where there is no provider.

No actual code changed; NFCI.
 1.133 03-Jun-2025  rjs Add driver for Onsemi FUSB302B USB-C power controller, mostly from OpenBSD.
 1.132 11-Mar-2025  brad A driver and userland utility for a couple of families of the
Microchip Technology / SMSC fan controller chips.

The driver and utility supports the:

o EMC2101 and EMC2101-R
o EMC2103-1, EMC2102-2 and EMC2103-4
o EMC2104
o EMC2106
o EMC2301
o EMC2302
o EMC2303
o EMC2305

The EMC210X family supports 1 or 2 fans with tachometer. Depending on
the chip, it may support 2 additional fans without tach and might
support a high side attachment (i.e. a fan, usually 5v, driven
directly from the chip and not PWM or DAC). All versions of EMC210X
support internal temperature measurements, and depending on the chip,
may support up to 5 additional temperature zones. The tachometers and
temperature measurements are provided to the system via the envsys(4)
framework. Some chip types support GPIO pins and support is provided
via the gpio(4) framework.

The EMC230X family supports 1, 2, 3 or 5 fans with the same number of
tachometers. No temperature zone or GPIO support. The tachometers
are provided to the system via the envsys(4) framework. The fan
support can be provided by PWM signaling or DAC.

The two chip families mostly do PWM signaling for the fan speed, but a
number of them support DAC output, a 0 to 3v or so voltage. When the
chip supports external temperature zones, this is done usually by a
bipolar NPN or PNP transister configured as a diode, but some of the
chip varients support thermistors.

The emcfan(4) kernel driver provides a simple read / write / seek
device in /dev/ to the register set in the chip. The heavy lifting is
done in the userland utility emcfanctl(8) which provides the ability
to read and write to any valid register and provides some basic higher
level commands to control fan behavior. The output is simple text
lines, or JSON.

The kernel driver does not reset or other mess with the chip, aside
from reading registers. It is entirely possible that something else
in any particular system is the major manager of the fan controller
and it would not do for the kernel driver to mess too much with the
attached device. All interactions are intentional via the userland
utility.

It is known that a EMC2301 is present on the Raspberry PI 4 Compute IO
module (not to be confused with the Raspberry PI 4 Compute module
itself) and there is a breakout board from Adafruit with a EMC2101 on
it. The chips themselves are pretty inexpensive from Mouser or
Digi-key and can be soldered using the simpler SMD soldering
techniques. A number of the variants are QFN packages, but the pads
are exposed to the side of the chip. No other external components are
required to use these fan controllers.
 1.131 13-Dec-2024  jmcneill Attempt to fix build for kernels w/o i2c or gpio.
 1.130 13-Dec-2024  jmcneill remove gpio dependency on ihidev
 1.129 09-Dec-2024  jmcneill Import ikbd(4) from OpenBSD.
 1.128 08-Dec-2024  jmcneill ihidev: Add support for GPIO interrupts.
 1.127 04-Nov-2024  brad Add a driver for the Maxim DS2482-100 and DS2482-800 I2C to 1-Wire
bridge.

This chip provides a I2C device that then has 1 or 8 1-Wire busses on
the other side. The 1-Wire buses show up as onewire(4) buses in the
NetBSD.

The chip can be used in situations where:

* You have a I2C bus extended a long distance, say with a LTC4311
active terminator / extender or one of the differential I2C
extenders and you would like to have a 1-Wire device on the far end
and it isn't possible to add wiring to get to the far end.

* You are either out of GPIO pins or the GPIO pins are not reliable
enough to use gpioow(4), but you do have working I2C.

The DS2482 does all of the 1-Wire signals in hardware and provides for
a couple of pullup options for the 1-Wire devices.

All of the functions of the DS2482-100 and -800 are supported except
for overdrive speed support. To do this will likely require some API
changes to onewire(4).

Breakout boards exist for the DS2482 for both variants, but they
appear to be more expensive than expected. The chip itself is quiet
cheap and wasn't all that hard to SMD solder to a board. No other
components are really needed.

There are other members in the same family, the DS2482-101, DS2484 and
DS2485. The DS2482-101 has a sleep pin, but from the datasheet
appears to program the same as the -100 variant. The DS2484 has a
slightly different way to set configuration information and probably
won't quite work with the driver, but isn't far off. The DS2485 is
very different and would require a new driver to function.
 1.126 03-Dec-2022  brad branches: 1.126.8;


Split the BMP280 / BME280 driver into common code and create I2C and
SPI attachments.
 1.125 21-Nov-2022  brad A driver for the Bosch BMP280 / BME280 temperature, humidity and
atmospheric pressure sensor. This is an inexpensive to moderately
expensive chip available from a large number of places. The driver
supports all aspects of the two chips, except for the repeating read
mode which would allow for sub-second queries, such as fall detection
or perhaps even as an altimeter. This driver also only supports the
I2C interface and not the SPI interface.

The BME280, the one with humidity, is not fully tested at this point,
awaiting upon a breakout board and may not show proper humidity.
 1.124 17-Nov-2022  brad A driver for the Aosong AHT20 temperature and humidity sensor. While
slow for an I2C sensor it is inexpensive and should work well enough
in most indoor conditions. All features of the chip are supported.
 1.123 20-Jul-2022  riastradh drm: Use CPPFLAGS.drmkms in all local drm drivers too.

This way we don't pollute the NetBSD kernel namespace with all the
Linux compat shim definitions needed to build drm, except for the
local drm drivers that need the API.
 1.122 17-Jan-2022  thorpej Re-factor and overhaul the "mcp23s17gpio" driver as "mcpgpio", and
add support for 8-bit and I2C variants of the chip:
- MCP23008 / MCP23S08: 8-bit (I2C / SPI)
- MCP23017 / MCP23S17: 16-bit (I2C / SPI)
- MCP23018 / MCP23S18: 16-bit (I2C / SPI), open-drain outputs

The MCP23x17 and MCP23x18 are essentially identical, software-wise; we
merely report different GPIO pin capabilities (no push-pull output for
MCP23x18). Also, remove the tri-state capability that was previously
advertised by the old version of this driver; these chips have no way
to put the pin into a HI-Z mode.

All 3 I2C versions are supported, but the SPI front-end still only
supports the MCP23S17 for now (SPI autoconfiguration needs an overhaul).

mcp23s17gpio(4) remains present as a link to the new mcpgpio(4) man page.

XXX Still to-do: FDT integration, interrupt suppoort.
 1.121 27-Dec-2021  andvar fix few typos in comments.
 1.120 07-Dec-2021  brad A driver and user land utility for the Sparkfun Serial Controlled Motor
Driver module as illustrated here:

https://www.sparkfun.com/products/13911

A SCMD module is a ARM SOC simular to a Arduino in front of a motor
driver chip. The single SCMD module can control two motors and up to
16 additional modules can be chained together using an internal I2C
bus. One can interface with the SCMD using tty uart commands, SPI or
I2C. The driver in this commit adds a kernel driver for the I2C and
SPI interfaces. The command line utility provides a set of
convenience commands that support most of the functions of the SCMD
and is able to use the tty uart mode, SPI user land or the included
kernel driver in a uniform manor.

The use of the SCMD module is mostly for small robots and the like,
but it can control anything that is controllable by voltage.
 1.119 06-Nov-2021  brad Driver for the Sensirion SHT30/SHT31/SHT35 temperature and humidity
sensor such as:

https://www.adafruit.com/product/2857

This is a higher priced sensor with a lot of features, including the
ability to do sub-second periodic updates. The driver supports
everything about the sensor except for the alert pin.
 1.118 14-Oct-2021  brad A driver for the Sensirion SGP40 MOx gas sensor. An example of this
chip from Adafruit is:

https://www.adafruit.com/product/4829

This is a moderately priced gas sensor that can detect volatile
organic compounds in the air. The driver uses the 3-clause BSD
licensed VOC algorithm provided by Sensirion to turn the raw sensor
metric into a VOC index which can indicate the quality of the air in a
particular indoor environment. All published functions of the chip
are supported and one unpublished feature.
 1.117 03-Oct-2021  brad A driver for the Sensirion SHT40/SHT41/SHT45 temperature and humidity
sensor. An example of this chip is:

https://www.adafruit.com/product/4885

This is a lower cost chip that provides higher then usual precision
according to the data sheet. This driver supports all of the published
functions that the chip has.
 1.116 27-Jul-2021  macallan branches: 1.116.6;
move the fcu driver into arch/macppc where it belongs
 1.115 04-Jan-2021  thorpej branches: 1.115.4;
Rename tsl256x.c -> tsllux.c. No other changes are made by this commit.
 1.114 29-Dec-2020  thorpej Add a driver for NXP PCA954x / PCA984x I2C switch / mux controllers.
 1.113 28-Dec-2020  thorpej Re-factor the "iicmux" driver to support other types of muxes that are
themselves i2c devices.
 1.112 29-Oct-2020  jdc branches: 1.112.2;
Add a driver for the PCF8574 I/O expander, used as a GPIO in some sparc64
hardware.
The driver currently handles pins configured as LED or INDICATOR and adds
them to the LED and sysmon_envsys subsystems, respectively.
 1.111 24-Apr-2020  macallan a very preliminary driver for the acclerometer found in later *Books
register definitions from OpenBSD
 1.110 02-Feb-2020  macallan branches: 1.110.4;
attach LEDs according to info passed as device properties
 1.109 29-Jan-2020  macallan the beginning of a driver for Philips Semiconductors PCA 9555 and 9556
GPIO controllers, found in Sun Fire v210 and some G5 macs.
Only prints configuration and line status so far.
 1.108 12-Jan-2020  thorpej Clean up gttwsi's register access stuff:
- Garbage-collect the obsolete GTTWSI_ALLWINNER option; it hasn't been
needed since FDT'ization of the Allwinner support code.
- Redefine thw "TWSI_*" register definitions to clearly call out:
-> The Marvell flavor of the offsets
-> The Allwinner flavor of the offsets
...and make the regular definitions indices into a register map.
- Pass the appropriate register map from the front-end to the core.
- Remove the customer register read/write callbacks -- they are no longer
needed now that each front-end passes an appropriate register map to
the core.
 1.107 03-Jan-2020  jmcneill branches: 1.107.2;
Add driver for CellWise CW2015 Fuel Gauge IC.
 1.106 03-Jan-2020  thorpej Eliminate all of the #ifdefs for the "strtc" driver. Define model
properties (similar to what the "dsrtc" driver does), and provide
DT compat strings corresponding to those models. Allow config flags
to specify the model for non-FDT platforms (also like "dsrtc").
 1.105 02-Jan-2020  jmcneill Add driver for Everest Semi ES8316 Low Power Audio CODEC
 1.104 03-Nov-2019  jmcneill Add driver for NXP TDA19988 HDMI encoder
 1.103 01-Nov-2019  jmcneill Remove tps65950pm (hardware now supported by twl4030.c)
 1.102 30-Oct-2019  jmcneill Add driver for TI TWL4030 Power Management IC
 1.101 27-Oct-2019  jmcneill Add FDT support
 1.100 24-Jul-2019  thorpej branches: 1.100.2;
Add a driver for the NXP PCA9685 16-channel, 12-bit PWM Fm+ LED controller.
 1.99 17-Mar-2019  tnn add i2c attachment for ssdfb
 1.98 03-Feb-2019  jmcneill Add basic support for Analogix eDP transmitters. This driver doesn't
know how to mode set yet -- it only knows how to read EDID from a panel.
 1.97 14-Dec-2018  macallan add options DSRTC_YEAR_START_2K for machines which use 2000 and not 1970
as base to count years from, like Iyonix.
While there apply the offset when writing to the clock as well.
 1.96 02-Sep-2018  jmcneill Add driver for Rockchip RK808 Power Management IC.
 1.95 29-Aug-2018  jmcneill Add driver for Silergy SY827/SY828 step down regulator.
 1.94 27-Jul-2018  rkujawa Add TEA5767 FM radio driver. From Karuna Grewal.
 1.93 26-Jun-2018  thorpej branches: 1.93.2;
Remove the i2c "size" locator and corresponding property / attach arg.
It was a hack meant only for EEPROMs, which have another way to specify
size in the config directive ("flag" paramter), as well as a better way
to detect size based on "compatible" string.
 1.92 27-May-2018  thorpej Add a driver for the Taos TSL256x light sensors.
 1.91 05-May-2018  jmcneill axppmic depends on sysmon_envsys
 1.90 04-May-2018  jmcneill Rename axp806pmic to axppmic, and add support for AXP803.
 1.89 03-May-2018  jmcneill Add support for poweroff and the power on-off key (POK).
 1.88 03-May-2018  jmcneill FDT-ize X-Powers AXP805/806 PMIC driver.
 1.87 16-Mar-2018  macallan implement fan control, get calibration data from EEPROM via uni_n
 1.86 09-Mar-2018  macallan yet another temperature sensor / ADC
this one supports Analog Devices AD7417, found in some G5 macs
depends on OpenFirmware for calibration data
 1.85 08-Mar-2018  macallan preliminary driver for the fan control unit found in some G5
 1.84 13-Feb-2018  uwe branches: 1.84.2;
Delete 'define dbcool {}' line commented out in previous. It's bogus
and the gcc6 correctly complains about that when it compiles ioconf.c

PR toolchain/53023
 1.83 13-Feb-2018  pgoyette Disable the 'define dbcool {}' line - it's not needed, and causes
problems with config(1) and gcc6. See PR toolchain/530223 for more
info.
 1.82 01-Feb-2018  macallan add driver for Maxim DS1631 High-Precision Digital Thermometer and Thermostat
temperature reading only for now
 1.81 05-Jan-2018  uwe Driver for EM Microelectronic EM3027 RTC and temperature sensor.
 1.80 28-Dec-2017  christos PR/52848: Brad Spencer: Two environment sensor drivers: AM2315 and SI70xx
XXX: Please check that my refactoring did not break them!
 1.79 10-Dec-2017  bouyer Add drivers for HID over I2C devices, and a driver for I2C mices.
From OpenBSD.
 1.78 07-Oct-2017  jmcneill Hook axp20x into fdt regulator api
 1.77 02-Oct-2017  jmcneill Add driver for Silergy SY8106A regulator
 1.76 22-Sep-2017  jmcneill Add GPIO drivers for MAX77620 and TCA9539 as found in Jetson TX1
 1.75 31-Aug-2017  jmcneill Instead of a Linux keymap, convert Linux event codes to USB scan codes and
use the ukbd keymaps instead.
 1.74 26-Aug-2017  jmcneill Add driver for Texas Instruments TCA8418 I2C Controller Keypad Scan IC.
 1.73 22-Apr-2017  jmcneill branches: 1.73.4;
Add LDO6 regulator support.
 1.72 03-Jul-2016  kiyohara branches: 1.72.2;
Add 'needs-flag' to tps65217pmic.
 1.71 20-Jun-2016  pgoyette For built-in modules, the iic driver requires i2c_bitbang
 1.70 07-Jun-2016  pgoyette Create separate modules for i2c_bitbang and bpf_filter so these files
can be included in kernels which need them without also duplicating
them in other modules. Removes the duplicate symbols I found which
prevented loading i2c and bpf modules after having fixed PR 45125.
 1.69 16-Dec-2015  jdc Add a driver for the ADM1026 Thermal System Management Fan Controller
i2c chip.
 1.68 21-Nov-2015  jmcneill add sysmon_wdog dependency to as3722pmic
 1.67 11-Nov-2015  jmcneill Add basic driver for AMS AS3722 power management IC
 1.66 21-Oct-2015  jmcneill needs-flag for axp20x
 1.65 12-May-2015  jmcneill Add driver for Texas Instruments TMP451 Temperature Sensor
 1.64 11-Jan-2015  jmcneill pcf8653 driver is compatible, delete this driver
 1.63 11-Jan-2015  jmcneill add Haoyu Microelectronic HYM8563 RTC driver
 1.62 01-Jan-2015  jmcneill Add driver for Active-Semi ACT8846 Power Management controller.
 1.61 07-Dec-2014  jmcneill Add driver for X-Powers AC100 integrated audio codec and RTC subsystem.
Only RTC functionality implemented for now.
 1.60 07-Dec-2014  jmcneill Add AXP806 and AXP809 power management controller drivers.
 1.59 07-Dec-2014  jmcneill Let kernel config override I2C_MAX_ADDR
 1.58 15-Oct-2014  uebayasi branches: 1.58.2;
dsrtc depends on sysmon_envsys.
 1.57 12-Oct-2014  jmcneill add AXP22x Power Management Unit driver
 1.56 09-Sep-2014  jmcneill AXP20x Power Management Unit driver, pretty basic at the moment -- only acts as a temperature sensor
 1.55 09-Sep-2014  jmcneill AllWinner implementation uses a different register layout, select it with options GTTWSI_ALLWINNER
 1.54 18-May-2014  kardel branches: 1.54.2;
add HYT-221/271/939 humidity/temperature I2C sensor
extend envsys(4) framework by %rH (relative humidity)
 1.53 15-Oct-2013  jdc branches: 1.53.2;
Add lmenv to the configuration framework.
 1.52 08-Sep-2013  rkujawa Preliminary support for MPL115A2 pressure sensor. It works, but accurracy is
awful.

I should add presure as a new type of sensor to envsys at some point...
 1.51 06-Sep-2013  matt Make gttswi MI and usuable from non-Marvell SoCs.
(should rename to mvi2c but ...)
 1.50 06-Aug-2013  soren Add driver for Nuvoton W83795G voltage/temp/fan/gpio monitoring device.

As used in the HP Microserver N36L/N40L/N54L:

w83795g* at iic? addr 0x2f
gpio* at gpiobus?

Note that the gpio and watchdog functionality appears to be useless on
the Microserver, as the gpio pins don't affect the LED's and a watchdog
trigger does not cause a reset. Perhaps the reset pin just isn't wired.

There are quite flexible fan control options as well as just monitoring,
but it is not clear to me how best to export that function to userspace.
 1.49 06-May-2013  rkujawa branches: 1.49.2; 1.49.4;
Add driver for Microchip MCP9800/1/2/3 temperature sensors.
 1.48 25-Apr-2013  rkujawa Add minimal support for TPS65217 PMIC as found on BeagleBone. Next step is to
expose regulated voltages through envsys(4).
 1.47 31-Dec-2012  jmcneill add support for TPS65950 watchdog timer
 1.46 31-Dec-2012  jmcneill TI TPS65950 driver, right now about all it can do is control LEDs
 1.45 18-Nov-2011  jmcneill branches: 1.45.6; 1.45.10;
remove Xbox support
 1.44 03-Oct-2011  jmcneill branches: 1.44.2;
fix build for kernels with i2c host controller drivers but no iic(4)
driver present
 1.43 02-Oct-2011  jmcneill Install dev/i2c/i2c_io.h and implement the API in the iic(4) driver.
Obsolete the I2C_SCAN option as this can now be done from userland.
 1.42 13-Aug-2011  jmcneill lg3303 depends on dtv_math, not xc3028
 1.41 09-Aug-2011  jmcneill modify the dtv device api so hardware drivers can be loaded independently
of the dtv module
 1.40 04-Aug-2011  jakllsch Add Conexant/Samsung CX24227/S5H1409 demodulator subroutines.
 1.39 04-Aug-2011  jakllsch Add subroutines to support Microtune MT2131 silicon tuner.
 1.38 14-Jul-2011  jmcneill nxt2k depends on firmload
 1.37 11-Jul-2011  jmcneill add LGDT3303 tuner and XC3028L demod drivers
 1.36 11-Jul-2011  jakllsch Add subdriver for Nextwave (subsequently acquired by ATI, then AMD, and
finally Broadcom) NXT200x series of 8VSB/QAM demodulator.

Still a bit crude and only supports the NXT2004 at this point.
 1.35 11-Jul-2011  jakllsch Add subdriver for generic PLL-based TV tuners.
 1.34 04-Apr-2011  phx s390rtc(4), an RTC driver for the Seiko Instruments S-35390A chip.
 1.33 14-Feb-2011  hannken Initial implementation of ibmhawk(4) driver for sensors behind the IBM Hawk
on-board Integrated Systems Management Processor found on some eServers.

Tested on an IBM eServer x335.
 1.32 21-Jan-2011  jakllsch Add pcf8563rtc(4), yet another I2C real time clock.
 1.31 04-Jan-2011  matt branches: 1.31.2; 1.31.4;
Add a generic Motorola/Freescale i2c driver. This was taken from sandpoint
and heavily modified. It works on most Freescale PowerPC and ARM SoCs.
 1.30 27-Dec-2010  jmcneill add au8522, xc5k, auvitek config glue
 1.29 10-Oct-2010  kiyohara Add options STRTC_NO_USERRAM and STRTC_NO_WATCHDOG for m41t80.
 1.28 02-Oct-2010  kiyohara Add G760a fan speed controller driver.
 1.27 24-Mar-2010  pgoyette Split spdmem driver into a bus attachment and a common back-end
probe and ROM decode, to follow similar changes made in OpenBSD:

http://article.gmane.org/gmane.os.openbsd.cvs/94948
http://article.gmane.org/gmane.os.openbsd.cvs/94956

There exists at least one alternative attachment (for SGI IP35
systems; see http://article.gmane.org/gmane.os.openbsd.cvs/94947),
and there could be more in the future.

Thanks to Christoph Egger for pointing out the OpenBSD activity.
 1.26 22-Feb-2010  pgoyette branches: 1.26.2;
Import smcsmon(4) driver for SMSC LPC47M192 hardware monitor

From Takahiro HAYASHI in PR kern/40420
 1.25 14-May-2009  pgoyette branches: 1.25.2;
Ooops - sdtemp(4) driver requires sysmon.
 1.24 09-May-2009  pgoyette Initial implementation of sdtemp(4) driver for on-DIMM temp sensor.

(These optional sensors are specified by JEDEC Standard No. 21-C
Section 4-7 and implemented by multiple vendors. Tested on my
amd64 machine with Kingston KVR1066D3E7S/2G memory which includes
a STMicro STTS424E02 sensor.)
 1.23 30-Oct-2008  nakayama branches: 1.23.6; 1.23.10; 1.23.14;
Add dependency on sysmon_envsys to admtemp.
 1.22 29-Oct-2008  jkunz Ported alipm(4) and admtemp(4) from OpenBSD.
 1.21 12-Oct-2008  pgoyette branches: 1.21.2;
Add an i2c attachment for the LM78 family of temp sensor/fan control

Tested by Martin Husemann
 1.20 07-Oct-2008  pgoyette Remove chip-specific drivers for ADT7463, ADT7467, and ADM1030; these
have been superseded by the dbcool(4) driver.
 1.19 02-Oct-2008  pgoyette Add new driver for dbCool(tm) family of Thermal Monitor and Fan Controller.
Supported chips: ADM1027, ADM1030, ADT7463, ADT7466, ADT7467, ADT7468,
ADT7473, ADT7475, and ADT7476. Notably missing is the ADT7490, and fan
controller support on the ADT7466 is still on the to-do list.

Tested by myself and njoly@
Reviewed by garbled@
Commit approved by christos@, bouyer@, cube@, and matt@
 1.18 11-Sep-2008  pgoyette Provide an option I2C_SCAN to enable sanning i2c bus for responses. This
is disabled by default, preserving current behavior.

OK garbled@
 1.17 26-Aug-2008  macallan allow wildcard for addr so we can have spdmem* at iic? addr ?
 1.16 02-Sep-2007  macallan branches: 1.16.20; 1.16.24; 1.16.26; 1.16.30;
defflag DEBUG_SGSMIX
 1.15 18-Aug-2007  tnn branches: 1.15.2;
Add spdmem(4) driver. This decodes technical specifications stored in
the eeprom on common types of memory modules. The specifications are
displayed during boot and can later be queried in the hw.spdmemN sysctl
subtree. Stub driver written by Nicolas Joly and greatly improved upon by
Paul Goyette. From PR 36745, with additional improvements by Paul and me.
 1.14 17-Jan-2007  macallan branches: 1.14.6; 1.14.14; 1.14.18;
add sgsmix
 1.13 06-Jan-2007  jmcneill Provide external functions for setting the LED, rebooting, and powering off
the system.
 1.12 06-Jan-2007  jmcneill Microsoft Xbox serial EEPROM driver. Currently reports the system serial
number as sysctl machdep.xbox_serial.
 1.11 06-Jan-2007  jmcneill Driver for the Xbox System Management Controller. Currently reports CPU and
motherboard temperatures, but will eventually be extended to replace
arch/i386/xbox/pic16l.S
 1.10 26-Apr-2006  gdamore branches: 1.10.8; 1.10.16;
Oops! ddc.c was accidentally getting included in *all* kernel configs.
Added a new define so it can be included without doing the attach dance.
 1.9 25-Apr-2006  gdamore Add basic DDC (VESA Data Display Channel) driver for use by framebuffers.
Reviewed by jmcneill@ and macallan@.
 1.8 06-Mar-2006  shige branches: 1.8.2; 1.8.4;
Add r2025rtc.
 1.7 19-Feb-2006  tls branches: 1.7.2;
Add support for i2c bus on AMD-8111 used on many Opteron server motherboards,
and ADT 7463c thermal and voltage monitor found on the Tyan S2881 and S2882-D
(and probably other boards as well). We do not currently support any kind
of detection of the i2c address of the thermal monitor; it appears to be
at 0x2D on the S2881 and 0x2E on the S2882-D (kernel config examples
forthcoming).

From PR kern/32463 submitted by Anil Gopinath, anil_public@yahoo.com.
 1.6 11-Dec-2005  christos branches: 1.6.2; 1.6.4; 1.6.6;
merge ktrace-lwp.
 1.5 16-Aug-2005  nonaka Added RICOH RS5C372[AB] Real Time Clock.
 1.4 10-Aug-2005  macallan added drivers for Analog Devices ADT7467 and ADM1030 thermal monitor / fan controller chips found in various Apple laptops and probably other machines.
 1.3 20-Oct-2003  briggs branches: 1.3.4; 1.3.16; 1.3.18;
As suggested by Jason Thorpe, rename m41t to m41trtc.
 1.2 06-Oct-2003  shige Add xrtc device for XICOR X1226 RTC.
 1.1 30-Sep-2003  thorpej New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.3.18.3 03-Sep-2007  yamt sync with head.
 1.3.18.2 26-Feb-2007  yamt sync with head.
 1.3.18.1 21-Jun-2006  yamt sync with head.
 1.3.16.1 20-Feb-2006  tron Pull up following revision(s) (requested by tls in ticket #1179):
sys/dev/pci/amdpm.c: revision 1.11
sys/dev/i2c/files.i2c: revision 1.7
sys/dev/i2c/adt7463.c: revision 1.1
sys/dev/pci/files.pci: revision 1.242 via patch
sys/dev/pci/amdpmvar.h: revision 1.1
sys/dev/i2c/adt7463reg.h: revision 1.1
sys/dev/DEVNAMES: revision 1.192 via patch
sys/dev/pci/amdpm_smbus.c: revision 1.1
sys/dev/pci/amdpm_smbusreg.h: revision 1.1
Add support for i2c bus on AMD-8111 used on many Opteron server motherboards,
and ADT 7463c thermal and voltage monitor found on the Tyan S2881 and S2882-D
(and probably other boards as well). We do not currently support any kind
of detection of the i2c address of the thermal monitor; it appears to be
at 0x2D on the S2881 and 0x2E on the S2882-D (kernel config examples
forthcoming).
From PR kern/32463 submitted by Anil Gopinath, anil_public@yahoo.com.
 1.3.4.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.4.2 03-Aug-2004  skrll Sync with HEAD
 1.3.4.1 20-Oct-2003  skrll file files.i2c was added on branch ktrace-lwp on 2004-08-03 10:46:05 +0000
 1.6.6.2 01-Jun-2006  kardel Sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.1 01-Mar-2006  yamt sync with head.
 1.7.2.2 24-May-2006  yamt sync with head.
 1.7.2.1 13-Mar-2006  yamt sync with head.
 1.8.4.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.2.1 11-May-2006  elad sync with head
 1.10.16.1 10-Nov-2007  matt Add AT91 support from Sami Kantoluoto
Add TI OMAP2430 support from Marty Fouts @ Danger Inc
 1.10.8.2 01-Feb-2007  ad Sync with head.
 1.10.8.1 12-Jan-2007  ad Sync with head.
 1.14.18.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.14.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.14.6.2 09-Oct-2007  ad Sync with head.
 1.14.6.1 20-Aug-2007  ad Sync with HEAD.
 1.15.2.1 06-Nov-2007  matt sync with HEAD
 1.16.30.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.16.30.1 19-Oct-2008  haad Sync with HEAD.
 1.16.26.3 10-Oct-2008  skrll Sync with HEAD.
 1.16.26.2 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.16.26.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.16.24.5 09-Oct-2010  yamt sync with head
 1.16.24.4 11-Aug-2010  yamt sync with head.
 1.16.24.3 11-Mar-2010  yamt sync with head
 1.16.24.2 16-May-2009  yamt sync with head
 1.16.24.1 04-May-2009  yamt sync with head.
 1.16.20.3 17-Jan-2009  mjf Sync with HEAD.
 1.16.20.2 05-Oct-2008  mjf Sync with HEAD.
 1.16.20.1 28-Sep-2008  mjf Sync with HEAD.
 1.21.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.23.14.1 07-Jan-2011  matt Add revamped support for motorola/freescale embedded i2c SoC controllers.
 1.23.10.1 24-Mar-2014  matt Merge mvi2c from HEAD
 1.23.6.2 23-Jul-2009  jym Sync with HEAD.
 1.23.6.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.25.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.26.2.3 21-Apr-2011  rmind sync with head
 1.26.2.2 05-Mar-2011  rmind sync with head
 1.26.2.1 30-May-2010  rmind sync with head
 1.31.4.2 17-Feb-2011  bouyer Sync with HEAD
 1.31.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.31.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.44.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.44.2.2 23-Jan-2013  yamt sync with head
 1.44.2.1 17-Apr-2012  yamt sync with head
 1.45.10.4 03-Dec-2017  jdolecek update from HEAD
 1.45.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.45.10.2 23-Jun-2013  tls resync from head
 1.45.10.1 25-Feb-2013  tls resync with head
 1.45.6.1 10-Aug-2013  riz Pull up following revision(s) (requested by matt in ticket #929):
sys/dev/i2c/w83795g.c: revision 1.1
sys/dev/i2c/w83795greg.h: revision 1.1
sys/dev/i2c/files.i2c: revision 1.50
Add driver for Nuvoton W83795G voltage/temp/fan/gpio monitoring device.
As used in the HP Microserver N36L/N40L/N54L:
w83795g* at iic? addr 0x2f
gpio* at gpiobus?
Note that the gpio and watchdog functionality appears to be useless on
the Microserver, as the gpio pins don't affect the LED's and a watchdog
trigger does not cause a reset. Perhaps the reset pin just isn't wired.
There are quite flexible fan control options as well as just monitoring,
but it is not clear to me how best to export that function to userspace.
 1.49.4.2 18-May-2014  rmind sync with head
 1.49.4.1 28-Aug-2013  rmind sync with head
 1.49.2.4 16-May-2013  khorben Initial import of the lp5523led(4) driver, a programmable 9-output LED
driver from Texas Instruments. This is not functional yet, but exposes
sysctl nodes and the internal temperature sensor (not refreshed at the
moment).

Tested on my Nokia N900 smartphone.
 1.49.2.3 12-May-2013  khorben Added keyboard support for the TPS65950 companion chip.

Tested on the Nokia N900 (multi-user)
 1.49.2.2 12-May-2013  khorben tps65950pm(4) can now expose a GPIO bus.
 1.49.2.1 10-May-2013  khorben Added two locators for I2C devices: "intr" and "intrbase".

They are required to allow the TPS65950 companion chip to both handle its
interrupts on the system, and allow its extra GPIO pins to be used as
interrupts as well.

XXX This change is not adequate because intr_establish() is a MD interface,
so it will have to be re-designed before merging to the main tree.
 1.53.2.1 10-Aug-2014  tls Rebase.
 1.54.2.3 17-Apr-2015  msaitoh Pull up following revision(s) (requested by nonaka in ticket #700):
sys/dev/i2c/files.i2c: revision 1.58
dsrtc depends on sysmon_envsys.
 1.54.2.2 14-Nov-2014  martin Pull up following revision(s) (requested by skrll in ticket #230):
sys/dev/i2c/axp22x.c: revision 1.1
etc/etc.evbarm/Makefile.inc: revisions 1.65-1.66
sys/arch/evbarm/conf/HUMMINGBIRD_A31: revisions 1.1-1.15
sys/arch/evbarm/conf/HUMMINGBIRD_A31_INSTALL: revisions 1.1-1.3
sys/dev/i2c/axp22x.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.57

Add Merrii Hummingbird A31 board kernels.
Add AXP22x Power Management Unit driver.
 1.54.2.1 12-Nov-2014  martin Pull up following revision(s) (requested by skrll in ticket #223):
sys/arch/evbarm/conf/std.awin: revision 1.2
sys/dev/i2c/axp20x.c: revision 1.1
sys/dev/i2c/axp20x.c: revision 1.2
sys/dev/i2c/gttwsireg.h: revision 1.2
sys/dev/i2c/files.i2c: revision 1.55
sys/dev/i2c/files.i2c: revision 1.56
AllWinner implementation uses a different register layout, select it with options GTTWSI_ALLWINNER
AXP20x Power Management Unit driver, pretty basic at the moment -- only acts as a temperature sensor
fix a sizeof typo
options GTTWSI_ALLWINNER
 1.58.2.5 28-Aug-2017  skrll Sync with HEAD
 1.58.2.4 09-Jul-2016  skrll Sync with HEAD
 1.58.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.58.2.2 06-Jun-2015  skrll Sync with HEAD
 1.58.2.1 06-Apr-2015  skrll Sync with HEAD
 1.72.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.73.4.1 15-Feb-2018  martin Pull up following revision(s) (requested by uwe in ticket #548):

sys/dev/i2c/files.i2c: revision 1.84 (via patch)

Delete 'define dbcool {}' line commented out in previous. It's bogus
and the gcc6 correctly complains about that when it compiles ioconf.c
PR toolchain/53023
 1.84.2.7 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.84.2.6 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.84.2.5 28-Jul-2018  pgoyette Sync with HEAD
 1.84.2.4 25-Jun-2018  pgoyette Sync with HEAD
 1.84.2.3 21-May-2018  pgoyette Sync with HEAD
 1.84.2.2 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.84.2.1 15-Mar-2018  pgoyette Synch with HEAD
 1.93.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.93.2.1 10-Jun-2019  christos Sync with HEAD
 1.100.2.2 21-Jan-2020  martin Pull up following revision(s) (requested by mrg in ticket #616):

sys/dev/ic/anx_dp.c: revision 1.2
sys/arch/evbarm/conf/GENERIC64: revision 1.126
sys/dev/ic/anx_dp.h: revision 1.1
sys/arch/evbarm/conf/GENERIC64: revision 1.128
sys/dev/ic/anx_dp.h: revision 1.2
sys/dev/fdt/dwcmmc_fdt.c: revision 1.9
sys/dev/i2c/cwfg.c: revision 1.1
sys/conf/files: revision 1.1247
sys/dev/fdt/pwm_backlight.c: revision 1.5
sys/dev/fdt/pwm_backlight.c: revision 1.6
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.14
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.15
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.16
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.17
sys/dev/ic/dwc_mmc.c: revision 1.20
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.18
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.19
sys/dev/usb/usbdevs: revision 1.775
sys/arch/arm/rockchip/rk_dwhdmi.c: revision 1.4
sys/dev/fdt/simple_amplifier.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.105
sys/arch/evbarm/conf/GENERIC64: revision 1.117
sys/arch/evbarm/conf/GENERIC64: revision 1.118
sys/dev/i2c/files.i2c: revision 1.107
sys/dev/fdt/files.fdt: revision 1.49
sys/arch/arm/rockchip/rk_anxdp.c: revision 1.1
sys/dev/ic/dwc_mmc_var.h: revision 1.9
sys/dev/i2c/rkpmic.c: revision 1.4
sys/arch/arm/rockchip/rk_anxdp.c: revision 1.2
sys/dev/i2c/rkpmic.c: revision 1.5
sys/dev/i2c/rkpmic.c: revision 1.6
sys/arch/arm/rockchip/rk_vop.c: revision 1.4
sys/arch/arm/rockchip/rk_vop.c: revision 1.5
sys/dev/i2c/rkpmic.c: revision 1.8
sys/arch/arm/dts/rk3399-pinebook-pro.dts: revision 1.1
sys/dev/usb/ums.c: revision 1.96 (via patch)
sys/arch/arm/rockchip/rk_pwm.c: revision 1.3
sys/arch/arm/dts/rk3399-pinebook-pro.dts: revision 1.2
sys/dev/i2c/es8316ac.c: revision 1.1
sys/dev/fdt/dwcmmc_fdt.c: revision 1.10
sys/dev/i2c/es8316ac.c: revision 1.2
sys/dev/fdt/fdt_panel.c: revision 1.1
sys/dev/ic/dwc_mmc.c: revision 1.18
sys/dev/fdt/fdt_panel.c: revision 1.2
sys/dev/ic/dwc_mmc.c: revision 1.19
sys/arch/arm/dts/rk3399-rockpro64.dts: revision 1.10
sys/dev/fdt/fdt_port.c: revision 1.5
sys/dev/ic/dwc_mmc_var.h: revision 1.10
sys/dev/fdt/fdt_port.c: revision 1.6
sys/arch/evbarm/conf/GENERIC64: revision 1.122
sys/dev/ic/dwc_mmc_var.h: revision 1.11
sys/dev/fdt/files.fdt: revision 1.50
sys/arch/evbarm/conf/GENERIC64: revision 1.123
sys/arch/arm/rockchip/rk_i2s.c: revision 1.2
sys/arch/arm/rockchip/files.rockchip: revision 1.23
sys/arch/evbarm/conf/GENERIC64: revision 1.124
sys/dev/ic/anx_dp.c: revision 1.1

rkpmic: add RTC support; register w/ todr(9)
rkpmic: correct delay
Add support for SDIO interrupts.
fix copy/paste error in mux_pll_src_cpll_gpll_ppll_parents[]
add RK3399 eDP clocks
add RK3399 DisplayPort clocks
style fix/KNF
rk3399_cru: implement dclk_vop0_frac and dclk_vop1_frac
Move drm_encoder from rkvop(4) to the SoC-layer output pipe drivers (rk_dwhdmi).
rkvop: set stride using virtual framebuffer width instead of display mode
rk3399_cru: Reparent dclk_vop[01] to gpll via dclk_vop[01]_frac.
The previous source of dclk_vop[01] was vpll via dclk_vop[01]_div.
vpll is apparently used directly as a pixel clock source for the
HDMI PHY, and we don't want the other VOP's dclk changing out from
under it because we can't handle finding a replacement clock source
with the right rate yet.
gpll happens to run at 594MHz, which works well as a basis for pixel
clocks.
Linux suggests that the source clock of the fractional divider needs
to be more than twenty times greater than the resulting clock (or some
intermediate clock?) for output stability. This may not be the case
with 594MHz and the common pixel clocks I see used by displays in my
area of the wild, but it works for now.
add Analogix DisplayPort core driver
add Rockchip (RK3399) glue for Analogix DisplayPort core
add anxdp(4)
Add another panel@fdt driver, this time for DRM-style panels.
To do: migrate away from other panel driver.
enable panel at fdt drivers
paper over the rkpwm get_conf function that otherwise doesn't seem to
let things work
add template bits for optional eDP panel on RockPro64
Abort panel driver attach if required regulator is missing.
Add clk provider
Add Pinebook Pro dts, from Manjaro Linux.
https://gitlab.manjaro.org/tsys/linux-pinebook-pro/blob/877ca0e7283596f37845de50dc36bff5b88b91e1/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
+ rk3399-pinebook-pro.dts
Attach mmcpwrseq resource earlier
dwcmmc improvements:
- Use mmcpwrseq resources if available
- Only set 4- or 8-bit mode if specified in the dt properties
- Add quirk for implementations with inverted power enable logic
- Support switching signal voltage between 1.8V and 3.3V
- Fix a clock divider issue on Rockchip SoCs
Fix performance regression with previous
Quiet chatty printfs
No need to print all supported levels at attach, print the range and total number of steps
Disable SPI for now (rkspi driver hangs at boot)
Add driver for simple-audio-amplifier binding
Add driver for Everest Semi ES8316 Low Power Audio CODEC
add es8316, simpleamp
Avoid sleeping while the audio intr lock is held.
If the rockchip,system-power-controller property is present, try to power off with the PMIC
Add HAILUCK keyboard (product 1e)
Add a quirk for the HAILUCK USB keyboard / touchpad device with product 1e.
The keyboard does not function properly unless the touchpad's intr endpoint
is active.
Add driver for CellWise CW2015 Fuel Gauge IC.
add cwfg
Emit PMFE_DISPLAY_{ON,OFF} events in response to DPMS requests.
If the backlight node does not have an enable gpio, set the lowest duty
cycle to turn the display off instead.
Attach psci as early as possible. This allows other power controllers to
register their own poweroff / reset callbacks with a higher preference.
Add 2000 MHz to available armclkb rates
Remove debug printfs
 1.100.2.1 27-Nov-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #491):

sys/arch/evbarm/conf/BEAGLEBOARD_INSTALL: file removal
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.2
sys/arch/arm/ti/ti_sysc.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.2
sys/dev/i2c/tps65950.c: file removal
sys/arch/evbarm/conf/std.ti: file removal
sys/dev/i2c/files.i2c: revision 1.101
sys/dev/i2c/files.i2c: revision 1.102
sys/dev/i2c/at24cxx.c: revision 1.32
sys/dev/i2c/files.i2c: revision 1.103
sys/dev/i2c/twl4030.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.104
sys/dev/i2c/twl4030.c: revision 1.2
sys/dev/i2c/twl4030.c: revision 1.3
sys/arch/arm/ti/ti_com.c: revision 1.6
sys/arch/arm/ti/ti_com.c: revision 1.7
sys/arch/arm/ti/ti_com.c: revision 1.8
sys/dev/fdt/cpufreq_dt.c: revision 1.11
sys/arch/arm/ti/ti_iic.c: revision 1.1
sys/dev/fdt/cpufreq_dt.c: revision 1.12
sys/arch/arm/ti/ti_usb.c: revision 1.1
sys/arch/arm/ti/ti_iic.c: revision 1.2
sys/dev/fdt/cpufreq_dt.c: revision 1.13
sys/arch/arm/ti/ti_iic.c: revision 1.3
sys/arch/arm/ti/ti_iic.c: revision 1.4
sys/arch/evbarm/conf/files.ti: file removal
sys/arch/evbarm/conf/BEAGLEBOARDXM: file removal
sys/arch/arm/dts/omap3-n900.dts: revision 1.1
sys/arch/arm/ti/ti_edma.h: revision 1.1
sys/arch/evbarm/conf/OVERO_INSTALL: file removal
sys/arch/arm/ti/ti_usbtll.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.5
etc/etc.evbarm/Makefile.inc: revision 1.108
sys/arch/arm/ti/files.ti: revision 1.6
sys/dev/i2c/tps65217pmic.c: revision 1.13
etc/etc.evbarm/Makefile.inc: revision 1.109
sys/arch/arm/ti/files.ti: revision 1.7
sys/dev/i2c/tps65217pmic.c: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.8
sys/arch/arm/ti/files.ti: revision 1.9
sys/dev/fdt/usbnopphy.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.55
sys/arch/evbarm/conf/GENERIC: revision 1.56
sys/arch/evbarm/conf/GENERIC: revision 1.57
sys/arch/evbarm/conf/GENERIC: revision 1.58
sys/arch/evbarm/conf/GENERIC: revision 1.59
sys/arch/evbarm/conf/BEAGLEBONE: file removal
sys/arch/arm/ti/omap2_gpmcreg.h: revision 1.1
sys/arch/arm/ti/ti_otgreg.h: revision 1.1
sys/arch/arm/ti/ti_tptc.c: revision 1.1
sys/arch/evbarm/conf/IGEPV2: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.10
sys/dev/i2c/tda19988.c: revision 1.1
sys/arch/evbarm/conf/OVERO: file removal
sys/dev/i2c/tda19988.c: revision 1.2
sys/dev/i2c/tda19988.c: revision 1.3
sys/arch/arm/ti/omap3_dss.c: revision 1.1
sys/arch/evbarm/conf/BEAGLEBONE_INSTALL: file removal
sys/arch/arm/ti/ti_omapintc.c: revision 1.2
etc/etc.evbarm/Makefile.inc: revision 1.112
etc/etc.evbarm/Makefile.inc: revision 1.113
sys/arch/arm/ti/ti_div_clock.c: revision 1.1
etc/etc.evbarm/Makefile.inc: revision 1.114
sys/arch/evbarm/conf/N900: revision 1.32
sys/arch/evbarm/conf/N900: revision 1.33
distrib/utils/embedded/conf/armv7.conf: revision 1.36
sys/arch/evbarm/conf/GENERIC: revision 1.60
distrib/utils/embedded/conf/armv7.conf: revision 1.37
sys/arch/arm/ti/omap2_nand.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.61
sys/arch/arm/ti/omap2_nand.c: revision 1.2
sys/arch/evbarm/conf/GENERIC: revision 1.62
distrib/utils/embedded/conf/armv7.conf: revision 1.39
sys/arch/evbarm/conf/GENERIC: revision 1.63
sys/arch/arm/ti/ti_fb.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.64
sys/arch/evbarm/conf/GENERIC: revision 1.65
sys/arch/evbarm/conf/GENERIC: revision 1.66
sys/arch/evbarm/conf/GENERIC: revision 1.67
sys/arch/arm/ti/ti_platform.c: revision 1.7
sys/arch/arm/ti/ti_platform.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.2
sys/arch/arm/ti/ti_platform.c: revision 1.9
sys/arch/arm/ti/am3_prcm.c: revision 1.3
sys/arch/arm/ti/am3_prcm.c: revision 1.4
sys/arch/arm/ti/am3_prcm.c: revision 1.5
sys/arch/arm/ti/am3_prcm.c: revision 1.6
sys/arch/arm/ti/am3_prcm.c: revision 1.7
sys/arch/evbarm/conf/DEVKIT8000: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.9
sys/dev/fdt/syscon.c: revision 1.4
sys/arch/arm/ti/files.ti: revision 1.10
sys/arch/arm/ti/ti_mux_clock.c: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.11
sys/arch/arm/ti/if_cpswreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.12
sys/arch/arm/ti/ti_sdhc.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.13
sys/arch/arm/ti/files.ti: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.15
sys/arch/arm/ti/files.ti: revision 1.16
sys/arch/arm/ti/omap3_cm.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.17
sys/arch/arm/ti/omap3_cm.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.18
sys/arch/arm/ti/omap3_cm.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.19
sys/arch/arm/ti/omap3_cm.c: revision 1.4
sys/arch/arm/ti/ti_motg.c: revision 1.1
sys/arch/arm/ti/ti_rngreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.1
sys/arch/arm/dts/omap3-beagle-xm.dts: revision 1.1
sys/arch/arm/ti/am3_platform.c: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARDXM_INSTALL: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.22
sys/arch/evbarm/conf/README.evbarm: revision 1.23
sys/arch/arm/ti/ti_platform.c: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.24
sys/arch/arm/ti/ti_omaptimer.c: revision 1.2
sys/arch/arm/ti/ti_prcm.c: revision 1.2
sys/arch/evbarm/conf/README.evbarm: revision 1.25
sys/arch/arm/ti/ti_omaptimer.c: revision 1.3
sys/arch/arm/ti/ti_prcm.c: revision 1.3
sys/arch/evbarm/conf/README.evbarm: revision 1.26
sys/arch/arm/ti/ti_omaptimer.c: revision 1.4
sys/arch/evbarm/conf/README.evbarm: revision 1.27
sys/arch/arm/ti/ti_ehci.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.20
sys/arch/arm/ti/ti_cpufreq.c: revision 1.1
sys/arch/arm/ti/ti_cpufreq.c: revision 1.2
sys/arch/arm/fdt/smsh_fdt.c: revision 1.2
sys/arch/arm/ti/omap3_dssreg.h: revision 1.1
sys/arch/evbarm/conf/OVERO: revision 1.56
sys/arch/evbarm/conf/TI: file removal
sys/arch/arm/dts/omap3-beagle.dts: revision 1.1
sys/dev/fdt/fdtvar.h: revision 1.55
sys/dev/fdt/fdtvar.h: revision 1.56
distrib/utils/embedded/files/armv7_boot_nonefi.cmd: revision 1.2
sys/dev/fdt/fdt_phy.c: revision 1.6
sys/arch/arm/ti/ti_iicreg.h: revision 1.1
sys/arch/arm/ti/ti_lcdc.c: revision 1.1
sys/arch/arm/ti/ti_gpio.c: revision 1.1
sys/arch/arm/ti/ti_iicreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.c: revision 1.2
sys/dev/fdt/files.fdt: revision 1.46
sys/arch/arm/ti/ti_gpio.c: revision 1.2
sys/arch/arm/ti/ti_iicreg.h: revision 1.3
sys/arch/arm/ti/ti_lcdc.c: revision 1.3
sys/dev/fdt/files.fdt: revision 1.47
sys/arch/arm/ti/ti_gpio.c: revision 1.3
sys/dev/fdt/pinctrl_single.c: revision 1.1
sys/arch/evbarm/conf/files.generic: revision 1.9
sys/arch/arm/ti/ti_gpmc.c: revision 1.1
sys/arch/arm/ti/ti_lcdcreg.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARD: file removal
sys/arch/arm/ti/omap3_prm.c: revision 1.1
sys/arch/arm/ti/ti_platform.h: file removal
sys/arch/arm/ti/omap3_platform.c: revision 1.1
sys/arch/arm/ti/ti_prcm.h: revision 1.2
sys/arch/arm/ti/omap3_platform.c: revision 1.2
sys/arch/arm/ti/ti_prcm.h: revision 1.3
sys/arch/arm/ti/ti_prcm.h: revision 1.4
sys/dev/fdt/fdt_clock.c: revision 1.9
sys/arch/arm/ti/ti_edma.c: revision 1.1
sys/arch/arm/ti/ti_otg.c: revision 1.1
distrib/utils/embedded/files/armv7_boot.cmd: revision 1.15
sys/arch/arm/ti/if_cpsw.c: revision 1.7
sys/arch/evbarm/conf/std.igepv2: file removal
sys/arch/arm/ti/if_cpsw.c: revision 1.8
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.1

Adapt ti fdt glue to support GENERIC kernel.

Do not search 64-bit directories for dts files

Fix am33xx_platform_early_putchar for pre-MMU output

Add bus driver for TI sysc interconncet.

Make com work again

Add EDMA TPCC and TPTC drivers.

Add driver for one-register-per-pin type pinctrl devices.

Add MMCHS support.

Add USB support.

Disable autoidle

Place devmap above KERNEL_IO_VBASE

Use Timer2 for timecounter, and enable hw module.

Add support for TI AM335x

Add atmel,24c256 compat data

Add I2C support.

Add tiiic, tps65217pmic

Add FDT support

Fix early putchar, add reset func

No support for tegra210 in armv7 kernel

Switch to GENERIC kernels only.

Get mac address from DT

Skip nodes with an "opp-suspend" property and fix tables that have disabled
nodes in the middle.

enumerate devices under child "clocks" node

Add support for platform specific opp table filters.

Add fdtbus_clock_count to count the number of clock references on a given node

enumerate devices under child "clocks" node

Add AM335x DVFS support.

Enable TI AM335x DVFS support

Add support for GPIO controller.

Add tigpio

Unhook BEAGLEBONE kernel from the build
Remove BEAGLEBONE kernel config (AM335x SoC is supported by GENERIC now).

Add support for hardware RNG.

Add tirng

Add explicit FDT_OPP for operating-points-v2 so the link set won't be empty

Rename SOC_TI_AM335X to SOC_AM33XX and rename ti_platform.c to
am3_platform.c

Set stdout-path on TI OMAP3 BeagleBoard

Add support for TI OMAP3.

Add OMAP3 support.

Move a lot of *.dtb files to a dtb/ subdirectory on the FAT partition.
Mkimage (eroneously) creates a FAT16 partition (despite the configuration
asking for FAT32), and that has a root directory size limit.
Idea from Jared.

Skip xref if it is 0

Add generic USB PHY driver

Add driver for TI TWL4030 Power Management IC

Use the hwmod clk to get the timer rate and explicitly enable the
timecounter timer.

Add OMAP3 USB support.

Add twl, usbnopphy, tiusb, tiusbtll

Move omap3 dtb files to /boot/dtb

Remove BEAGLEBOARD kernel from list of kernels to build
Remove BEAGLEBOARD kernel (supported by GENERIC now)

Fix PRM_RSTCTRL_RST_DPLL3 definition, now reset works.

Remove DEVKIT8000 kernel (GENERIC should work now)
Remove DPLL5 init ported from old omap code, it is not required

Set the stdout-path on xM like Ti OMAP3 BeagleBoard

Remove BEAGLEBOARDXM from the build
Remove BEAGLEBOARDXM kernel (supported by GENERIC now)

Handle different register layout on OMAP3

Add omapfb to FDT-ized TI port.

Use dss as console on Nokia N900.

Enable IRQ status bits for omap3 type and set speed properly

Add RTC support

Remove tps65950pm (hardware now supported by twl4030.c)

Add NAND flash support.

Add tigpmc, omapnand

Attach tiusb before the default pass since it adds a bus to reduce kernel output
Replace tps65950pm with twl (the former has been removed)

Fix non-FDT build

Cleanup and remove dependency on arch/arm/omap

Add support for GPIO interrupts and fix reading the state of output pins.
Match smsc,lan9115 and honour local-mac-address/mac-address properties

Only one instance of twl(4) is needed
Remove OVERO from build, and commented out N900 kernel config
OMAP3 SoC and all peripherals in the OVERO kernel are now supported by
GENERIC.

Remove commented out IGEPV2 entry

OMAP3 SoC and all peripherals in the IGEPV2 kernel are now supported by
GENERIC.

No longer used.

Also match ti,omap2-onenand

Defer power monitor polling to the sysmon taskq thread to avoid i2c transactions in intr context

Add driver for NXP TDA19988 HDMI encoder

Add support for AM335x display controller (LCDC).

Add tdahdmi, tilcdc, tifb

Test DRM_MODE_* flags, not VID_*

Comment out mode fixup (not needed it seems)

Use 297MHz for display clock

Select closest rate to desired pixel clock

Speed up mode setting a bit and turn off the display while changing modes
 1.107.2.2 29-Feb-2020  ad Sync with head.
 1.107.2.1 17-Jan-2020  ad Sync with head.
 1.110.4.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.112.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.112.2.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.115.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.115.4.1 08-May-2021  thorpej - Add an optional bus number to i2cbus_attach_args, and a corresponding
optional "bus" locator to the i2cbus interface attribute.
- Add a iicbus_print_multi() routine, which is like iicbus_print(),
but also prints the bus number.
- Use these new features in the iicmux driver rather than winging it.
 1.116.6.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.126.8.1 02-Aug-2025  perseant Sync with HEAD
 1.2 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.1 03-Jun-2025  rjs branches: 1.1.4;
Add driver for Onsemi FUSB302B USB-C power controller, mostly from OpenBSD.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 03-Jun-2025  perseant file fusbtc.c was added on branch perseant-exfatfs on 2025-08-02 05:56:39 +0000
 1.6 26-Nov-2020  skrll Fix build and improve error handling
 1.5 16-Jun-2018  thorpej branches: 1.5.16;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.4 29-Jul-2012  mlelstv branches: 1.4.38;
Use const nodes. Let sysctl_createv initialize sysctl_data.
 1.3 28-Jul-2012  matt Use (void *) instead of (type **) which gcc complains about.
 1.2 20-Jun-2011  pgoyette branches: 1.2.2;
Initialize sensor state before registering.

XXX Still need to fix i2c/ibmhawk.c
 1.1 02-Oct-2010  kiyohara branches: 1.1.2; 1.1.4; 1.1.10; 1.1.12;
Add G760a fan speed controller driver.
 1.1.12.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.1.10.2 05-Mar-2011  rmind sync with head
 1.1.10.1 02-Oct-2010  rmind file g760a.c was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.1.4.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.1.4.1 02-Oct-2010  uebayasi file g760a.c was added on branch uebayasi-xip on 2010-10-22 07:21:55 +0000
 1.1.2.2 09-Oct-2010  yamt sync with head
 1.1.2.1 02-Oct-2010  yamt file g760a.c was added on branch yamt-nfs-mp on 2010-10-09 03:32:05 +0000
 1.2.2.1 30-Oct-2012  yamt sync with head
 1.4.38.1 25-Jun-2018  pgoyette Sync with HEAD
 1.5.16.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.1 02-Oct-2010  kiyohara branches: 1.1.2; 1.1.4; 1.1.10;
Add G760a fan speed controller driver.
 1.1.10.2 05-Mar-2011  rmind sync with head
 1.1.10.1 02-Oct-2010  rmind file g760areg.h was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.1.4.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.1.4.1 02-Oct-2010  uebayasi file g760areg.h was added on branch uebayasi-xip on 2010-10-22 07:21:55 +0000
 1.1.2.2 09-Oct-2010  yamt sync with head
 1.1.2.1 02-Oct-2010  yamt file g760areg.h was added on branch yamt-nfs-mp on 2010-10-09 03:32:05 +0000
 1.20 25-Sep-2025  thorpej Don't use a property to set a value in the front end that can simply
be set directly in the softc instead.
 1.19 15-Sep-2025  thorpej Encapsulate what's needed to attach an I2C bus into a iicbus_attach()
inline.
 1.18 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.17 24-Apr-2021  thorpej branches: 1.17.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.16 15-Feb-2020  thorpej branches: 1.16.8;
Interrupt-driven I/O seems to completely go off the rails, at least
on AllWinner implementations of this controller, so force polled mode
for now.
 1.15 13-Jan-2020  thorpej Fix silly mistake in rev 1.12.
 1.14 13-Jan-2020  martin Fix debug printf formats.
 1.13 13-Jan-2020  thorpej Improve diagnostic messages:
- Pass an additional argument to gttwsi_wait() to indicate what's
going on, and report that, along with the error code from
cv_timedwait(), if a timeout occurs.
- In gttwsi_send_stop(), if we don't get the expected NRS status,
report which status we *did* get when a timeout occurs.
 1.12 12-Jan-2020  thorpej Clean up gttwsi's register access stuff:
- Garbage-collect the obsolete GTTWSI_ALLWINNER option; it hasn't been
needed since FDT'ization of the Allwinner support code.
- Redefine thw "TWSI_*" register definitions to clearly call out:
-> The Marvell flavor of the offsets
-> The Allwinner flavor of the offsets
...and make the regular definitions indices into a register map.
- Pass the appropriate register map from the front-end to the core.
- Remove the customer register read/write callbacks -- they are no longer
needed now that each front-end passes an appropriate register map to
the core.
 1.11 11-Jan-2020  thorpej In gttwsi_wait(), don't use cv_timedwait_sig() -- there's no reason to
catch signals here, and the code would need to handle them properly, which
this code does not.
 1.10 25-Dec-2019  thorpej branches: 1.10.2;
Remove assertions that no longer make sense now that the bus acquire / release
logic is handled by the upper layer.
 1.9 22-Dec-2019  thorpej Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.8 01-Oct-2018  bouyer Expand code covered by sc->sc_mtx, to make sure an interrupt would not be
handled before the cv_timedwait_sig() call, or while polling.
Seems to fix "sunxitwi0: send STOP failed" messages frequently seen related
to axp20x0 sensors.
 1.7 18-Jun-2018  jakllsch branches: 1.7.2;
Bail early if gttwsi_send_start() fails in gttwsi_initiate_xfer() to
avoid unexpected state error message later (on Allwinner H5).
 1.6 12-Jun-2018  thorpej When initiating a transfer, if a device isn't present, we won't
get an ACK after sending the address. Check for this alternate
state and suppress the error message when it occurs.

Fixes PR kern/53356.
 1.5 07-May-2018  jmcneill Don't sleep with IPL_VM lock held.
 1.4 03-May-2018  jmcneill Use IPL_VM for bus lock so we can do i2c xfers from interrupt context
 1.3 29-Oct-2017  jmcneill branches: 1.3.2;
Allow drivers to provide their own read/write register functions. While
here, sprinkle KASSERTs to verify that the i2c lock is held where it
should be.
 1.2 23-Nov-2014  jmcneill branches: 1.2.12;
On Allwinner A31 you need to set the CONTROL_IFLG bit to clear it. Add
a "iflg-rwc" property to enable this behaviour.
 1.1 06-Sep-2013  matt branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10; 1.1.12;
Make gttswi MI and usuable from non-Marvell SoCs.
(should rename to mvi2c but ...)
 1.1.12.3 03-Dec-2017  jdolecek update from HEAD
 1.1.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.12.1 06-Sep-2013  tls file gttwsi_core.c was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.1.10.1 25-Nov-2014  snj Pull up following revision(s) (requested by jmcneill in ticket #257):
sys/arch/arm/allwinner/awin_twi.c: revision 1.5
sys/arch/arm/allwinner/awin_reg.h: revision 1.53
sys/arch/evbarm/conf/HUMMINGBIRD_A31: revision 1.20
sys/dev/i2c/gttwsi_core.c: revision 1.2
sys/dev/i2c/gttwsivar.h: revision 1.2
On Allwinner A31 you need to set the CONTROL_IFLG bit to clear it. Add
a "iflg-rwc" property to enable this behaviour.
--
Don't assume that U-Boot has enabled the TWI clock. Also, for A31, set
the "iflg-rwc" device property for gttwsi.
--
The SoC RTC works on this board but does not seem to be hooked up to the
battery. Thankfully, there is a PCF8563 attached to TWI2 at address 51h,
so use that instead.
 1.1.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.8.1 06-Sep-2013  yamt file gttwsi_core.c was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.1.6.2 18-May-2014  rmind sync with head
 1.1.6.1 06-Sep-2013  rmind file gttwsi_core.c was added on branch rmind-smpnet on 2014-05-18 17:45:37 +0000
 1.1.2.2 24-Mar-2014  matt Merge mvi2c from HEAD
 1.1.2.1 06-Sep-2013  matt file gttwsi_core.c was added on branch matt-nb5-mips64 on 2014-03-24 18:48:52 +0000
 1.2.12.1 15-Oct-2018  snj Pull up following revision(s) (requested by bouyer in ticket #1061):
sys/dev/i2c/gttwsi_core.c: revision 1.4-1.8 via patch
sys/dev/i2c/gttwsivar.h: revision 1.4 via patch
Use IPL_VM for bus lock so we can do i2c xfers from interrupt context
Don't sleep with IPL_VM lock held.
When initiating a transfer, if a device isn't present, we won't
get an ACK after sending the address. Check for this alternate
state and suppress the error message when it occurs.
Fixes PR kern/53356.
Bail early if gttwsi_send_start() fails in gttwsi_initiate_xfer() to
avoid unexpected state error message later (on Allwinner H5).
Expand code covered by sc->sc_mtx, to make sure an interrupt would not be
handled before the cv_timedwait_sig() call, or while polling.
Seems to fix "sunxitwi0: send STOP failed" messages frequently seen related
to axp20x0 sensors.
 1.3.2.3 20-Oct-2018  pgoyette Sync with head
 1.3.2.2 25-Jun-2018  pgoyette Sync with HEAD
 1.3.2.1 21-May-2018  pgoyette Sync with HEAD
 1.7.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.2.1 10-Jun-2019  christos Sync with HEAD
 1.10.2.2 29-Feb-2020  ad Sync with head.
 1.10.2.1 17-Jan-2020  ad Sync with head.
 1.16.8.1 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.17.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.4 12-Jan-2020  thorpej Clean up gttwsi's register access stuff:
- Garbage-collect the obsolete GTTWSI_ALLWINNER option; it hasn't been
needed since FDT'ization of the Allwinner support code.
- Redefine thw "TWSI_*" register definitions to clearly call out:
-> The Marvell flavor of the offsets
-> The Allwinner flavor of the offsets
...and make the regular definitions indices into a register map.
- Pass the appropriate register map from the front-end to the core.
- Remove the customer register read/write callbacks -- they are no longer
needed now that each front-end passes an appropriate register map to
the core.
 1.3 11-Sep-2014  jmcneill branches: 1.3.20; 1.3.28;
correct softreset reg for allwinner boards
 1.2 09-Sep-2014  jmcneill AllWinner implementation uses a different register layout, select it with options GTTWSI_ALLWINNER
 1.1 06-Sep-2013  matt branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10; 1.1.12;
Make gttswi MI and usuable from non-Marvell SoCs.
(should rename to mvi2c but ...)
 1.1.12.3 03-Dec-2017  jdolecek update from HEAD
 1.1.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.12.1 06-Sep-2013  tls file gttwsireg.h was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.1.10.1 12-Nov-2014  martin Pull up following revision(s) (requested by skrll in ticket #223):
sys/arch/evbarm/conf/std.awin: revision 1.2
sys/dev/i2c/axp20x.c: revision 1.1
sys/dev/i2c/axp20x.c: revision 1.2
sys/dev/i2c/gttwsireg.h: revision 1.2
sys/dev/i2c/files.i2c: revision 1.55
sys/dev/i2c/files.i2c: revision 1.56
AllWinner implementation uses a different register layout, select it with options GTTWSI_ALLWINNER
AXP20x Power Management Unit driver, pretty basic at the moment -- only acts as a temperature sensor
fix a sizeof typo
options GTTWSI_ALLWINNER
 1.1.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.8.1 06-Sep-2013  yamt file gttwsireg.h was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.1.6.2 18-May-2014  rmind sync with head
 1.1.6.1 06-Sep-2013  rmind file gttwsireg.h was added on branch rmind-smpnet on 2014-05-18 17:45:37 +0000
 1.1.2.2 24-Mar-2014  matt Merge mvi2c from HEAD
 1.1.2.1 06-Sep-2013  matt file gttwsireg.h was added on branch matt-nb5-mips64 on 2014-03-24 18:48:52 +0000
 1.3.28.1 17-Jan-2020  ad Sync with head.
 1.3.20.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.6 12-Jan-2020  thorpej Clean up gttwsi's register access stuff:
- Garbage-collect the obsolete GTTWSI_ALLWINNER option; it hasn't been
needed since FDT'ization of the Allwinner support code.
- Redefine thw "TWSI_*" register definitions to clearly call out:
-> The Marvell flavor of the offsets
-> The Allwinner flavor of the offsets
...and make the regular definitions indices into a register map.
- Pass the appropriate register map from the front-end to the core.
- Remove the customer register read/write callbacks -- they are no longer
needed now that each front-end passes an appropriate register map to
the core.
 1.5 25-Dec-2019  thorpej branches: 1.5.2;
Remove assertions that no longer make sense now that the bus acquire / release
logic is handled by the upper layer.
 1.4 07-May-2018  jmcneill branches: 1.4.2;
Don't sleep with IPL_VM lock held.
 1.3 29-Oct-2017  jmcneill branches: 1.3.2;
Allow drivers to provide their own read/write register functions. While
here, sprinkle KASSERTs to verify that the i2c lock is held where it
should be.
 1.2 23-Nov-2014  jmcneill branches: 1.2.12;
On Allwinner A31 you need to set the CONTROL_IFLG bit to clear it. Add
a "iflg-rwc" property to enable this behaviour.
 1.1 06-Sep-2013  matt branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10; 1.1.12;
Make gttswi MI and usuable from non-Marvell SoCs.
(should rename to mvi2c but ...)
 1.1.12.3 03-Dec-2017  jdolecek update from HEAD
 1.1.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.12.1 06-Sep-2013  tls file gttwsivar.h was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.1.10.1 25-Nov-2014  snj Pull up following revision(s) (requested by jmcneill in ticket #257):
sys/arch/arm/allwinner/awin_twi.c: revision 1.5
sys/arch/arm/allwinner/awin_reg.h: revision 1.53
sys/arch/evbarm/conf/HUMMINGBIRD_A31: revision 1.20
sys/dev/i2c/gttwsi_core.c: revision 1.2
sys/dev/i2c/gttwsivar.h: revision 1.2
On Allwinner A31 you need to set the CONTROL_IFLG bit to clear it. Add
a "iflg-rwc" property to enable this behaviour.
--
Don't assume that U-Boot has enabled the TWI clock. Also, for A31, set
the "iflg-rwc" device property for gttwsi.
--
The SoC RTC works on this board but does not seem to be hooked up to the
battery. Thankfully, there is a PCF8563 attached to TWI2 at address 51h,
so use that instead.
 1.1.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.8.1 06-Sep-2013  yamt file gttwsivar.h was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.1.6.2 18-May-2014  rmind sync with head
 1.1.6.1 06-Sep-2013  rmind file gttwsivar.h was added on branch rmind-smpnet on 2014-05-18 17:45:37 +0000
 1.1.2.2 24-Mar-2014  matt Merge mvi2c from HEAD
 1.1.2.1 06-Sep-2013  matt file gttwsivar.h was added on branch matt-nb5-mips64 on 2014-03-24 18:48:52 +0000
 1.2.12.1 15-Oct-2018  snj Pull up following revision(s) (requested by bouyer in ticket #1061):
sys/dev/i2c/gttwsi_core.c: revision 1.4-1.8 via patch
sys/dev/i2c/gttwsivar.h: revision 1.4 via patch
Use IPL_VM for bus lock so we can do i2c xfers from interrupt context
Don't sleep with IPL_VM lock held.
When initiating a transfer, if a device isn't present, we won't
get an ACK after sending the address. Check for this alternate
state and suppress the error message when it occurs.
Fixes PR kern/53356.
Bail early if gttwsi_send_start() fails in gttwsi_initiate_xfer() to
avoid unexpected state error message later (on Allwinner H5).
Expand code covered by sc->sc_mtx, to make sure an interrupt would not be
handled before the cv_timedwait_sig() call, or while polling.
Seems to fix "sunxitwi0: send STOP failed" messages frequently seen related
to axp20x0 sensors.
 1.3.2.1 21-May-2018  pgoyette Sync with HEAD
 1.4.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.2.1 17-Jan-2020  ad Sync with head.
 1.2 11-Jan-2015  jmcneill pcf8653 driver is compatible, delete this driver
 1.1 11-Jan-2015  jmcneill add Haoyu Microelectronic HYM8563 RTC driver
 1.15 30-Mar-2022  pgoyette These modules need to depend on iic, not just on i2cexec. (They will
still recursively get i2cexec since the iic depends on it.)

Partial fix for kern/56772
 1.14 15-Jun-2021  mlelstv avoid double-free
 1.13 27-Jan-2021  thorpej branches: 1.13.4;
Use DEVICE_COMPAT_EOL.
 1.12 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.11 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.10 05-Dec-2020  jdc Make sure that we set sc->sc_sme to NULL in failure cases in order to avoid
calling sysmon_envsys_unregister() with an invalid struct when we detach.
 1.9 08-Oct-2019  kardel branches: 1.9.8;
enable FDT direct configuration.
remove address test as the i2c address can be changed on this device.
 1.8 16-Jun-2018  thorpej branches: 1.8.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.

XXX This driver is an odd-ball with respect to the hardware device.
See comments in the match routine. Unclear how best to handle it.
 1.7 03-Jul-2016  kardel branches: 1.7.16;
convert device polling from callout to kthread.
Solves:
- hung initialization on A20 (bananapi)
- allows iic_exec() implementations to use condvars
 1.6 18-Sep-2015  phx Declare sensor data invalid when reading the sensor failed (device is gone).
 1.5 09-Sep-2015  phx Tests showed that the sensor needs at least 30ms after a MR (measurement
request) to have valid data ready, so the driver didn't work very well.
Now the MR is sent in configurable intervals (hw.hythygtemp0.interval)
using callout(9), so that valid data is immediately available for
sysmon's sensor refresh. When the refresh comes too close after the last
MR, then the previous values are used.
 1.4 23-Apr-2015  pgoyette Update module dependencies for all the existing modules that depend on sysmon components.
 1.3 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.2 29-Jun-2014  kardel branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
allow i2c address 0x01-0x7F
ignore responses if the sensor is in command mode
 1.1 18-May-2014  kardel branches: 1.1.2;
add HYT-221/271/939 humidity/temperature I2C sensor
extend envsys(4) framework by %rH (relative humidity)
 1.1.2.2 18-May-2014  rmind sync with head
 1.1.2.1 18-May-2014  rmind file hytp14.c was added on branch rmind-smpnet on 2014-05-18 17:45:37 +0000
 1.2.8.4 09-Jul-2016  skrll Sync with HEAD
 1.2.8.3 22-Sep-2015  skrll Sync with HEAD
 1.2.8.2 06-Jun-2015  skrll Sync with HEAD
 1.2.8.1 06-Apr-2015  skrll Sync with HEAD
 1.2.6.3 03-Dec-2017  jdolecek update from HEAD
 1.2.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.1 29-Jun-2014  tls file hytp14.c was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.2.4.2 04-Nov-2015  riz Pull up following revision(s) (requested by phx in ticket #975):
sys/dev/i2c/hytp14.c: revision 1.5
share/man/man4/hythygtemp.4: revision 1.3
sys/dev/i2c/hytp14var.h: revision 1.3
Tests showed that the sensor needs at least 30ms after a MR (measurement
request) to have valid data ready, so the driver didn't work very well.
Now the MR is sent in configurable intervals (hw.hythygtemp0.interval)
using callout(9), so that valid data is immediately available for
sysmon's sensor refresh. When the refresh comes too close after the last
MR, then the previous values are used.
 1.2.4.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.2.2.2 10-Aug-2014  tls Rebase.
 1.2.2.1 29-Jun-2014  tls file hytp14.c was added on branch tls-earlyentropy on 2014-08-10 06:54:51 +0000
 1.7.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.8.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.9.8.2 03-Apr-2021  thorpej Sync with HEAD.
 1.9.8.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.13.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.4 06-Aug-2025  andvar s/revison/revision/ in comment.
 1.3 12-Dec-2016  maya acknowleg -> acknowledg, proceedure -> procedure.
only comments were changed.

from miod
 1.2 29-Jun-2014  kardel branches: 1.2.2; 1.2.6; 1.2.8; 1.2.12;
remove artifacts inspired by misleading documentation
fix address calculation macros
fix typoes
 1.1 18-May-2014  kardel branches: 1.1.2;
add HYT-221/271/939 humidity/temperature I2C sensor
extend envsys(4) framework by %rH (relative humidity)
 1.1.2.2 18-May-2014  rmind sync with head
 1.1.2.1 18-May-2014  rmind file hytp14reg.h was added on branch rmind-smpnet on 2014-05-18 17:45:37 +0000
 1.2.12.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.2.8.1 05-Feb-2017  skrll Sync with HEAD
 1.2.6.3 03-Dec-2017  jdolecek update from HEAD
 1.2.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.1 29-Jun-2014  tls file hytp14reg.h was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.2.2.2 10-Aug-2014  tls Rebase.
 1.2.2.1 29-Jun-2014  tls file hytp14reg.h was added on branch tls-earlyentropy on 2014-08-10 06:54:51 +0000
 1.4 03-Jul-2016  kardel convert device polling from callout to kthread.
Solves:
- hung initialization on A20 (bananapi)
- allows iic_exec() implementations to use condvars
 1.3 09-Sep-2015  phx Tests showed that the sensor needs at least 30ms after a MR (measurement
request) to have valid data ready, so the driver didn't work very well.
Now the MR is sent in configurable intervals (hw.hythygtemp0.interval)
using callout(9), so that valid data is immediately available for
sysmon's sensor refresh. When the refresh comes too close after the last
MR, then the previous values are used.
 1.2 10-Aug-2014  tls branches: 1.2.2; 1.2.4; 1.2.6;
Merge tls-earlyentropy branch into HEAD.
 1.1 18-May-2014  kardel branches: 1.1.2; 1.1.4;
add HYT-221/271/939 humidity/temperature I2C sensor
extend envsys(4) framework by %rH (relative humidity)
 1.1.4.2 10-Aug-2014  tls Rebase.
 1.1.4.1 18-May-2014  tls file hytp14var.h was added on branch tls-earlyentropy on 2014-08-10 06:54:51 +0000
 1.1.2.2 18-May-2014  rmind sync with head
 1.1.2.1 18-May-2014  rmind file hytp14var.h was added on branch rmind-smpnet on 2014-05-18 17:45:37 +0000
 1.2.6.2 09-Jul-2016  skrll Sync with HEAD
 1.2.6.1 22-Sep-2015  skrll Sync with HEAD
 1.2.4.3 03-Dec-2017  jdolecek update from HEAD
 1.2.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.4.1 10-Aug-2014  tls file hytp14var.h was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.2.2.1 04-Nov-2015  riz Pull up following revision(s) (requested by phx in ticket #975):
sys/dev/i2c/hytp14.c: revision 1.5
share/man/man4/hythygtemp.4: revision 1.3
sys/dev/i2c/hytp14var.h: revision 1.3
Tests showed that the sensor needs at least 30ms after a MR (measurement
request) to have valid data ready, so the driver didn't work very well.
Now the MR is sent in configurable intervals (hw.hythygtemp0.interval)
using callout(9), so that valid data is immediately available for
sysmon's sensor refresh. When the refresh comes too close after the last
MR, then the previous values are used.
 1.105 23-Sep-2025  thorpej Enumerate i2c devices directly from the ACPI device tree.
 1.104 23-Sep-2025  thorpej Fix typo in comment.
 1.103 23-Sep-2025  thorpej The I2C device address is sparesely populated, and there are lots
of addresses that have special reserved functions and thus cannot
have devices directly associated with them. As such, it is not really
necessary to keep an array of 1024 device_t pointers (4KB or 8KB,
depending on how LP64 you're feeling at any given moment) per I2C bus
instance (I know, right?).

Instead, associated address <--> device pairings are now kept in a linked
list. Each pairing also knows if the address is reserved for a direct-
config device (i.e. described by the platform device tree) and thus should
not allow indirect-config attempts haphazardly poke around at such addresses
even if no driver instance has currently claimed it.
 1.102 23-Sep-2025  thorpej G/C fdtbus_copy_i2c_devs() and directly enumerate the devices using
the device tree in the FDT case.
 1.101 21-Sep-2025  thorpej Add support for enumerating i2c devices directly from the platform
device tree. Direct configuration still looks for i2c-child-devices
property on the controller, and will use it if it exists in order to
ease transition.
 1.100 21-Sep-2025  thorpej Tidy up the i2c subsystem ABI:
- Remove unused structures and deprecated fields (ia_prop, ia_cookie,
ia_cookietype).
- Normalize the "compatible" list; we get it as a strlist, don't bother
converting to an array when we can use the strlist as-is. (This is
invisible to drivers using the API correctly, but it does change
the i2c_attach_args).
- Add a "channel" field to i2c_tag_t, for use by controllers with
built-in i2c muxes or discrete i2c muxes.

Bienvenido, NetBSD 11.99.3.
 1.99 18-Sep-2025  thorpej In the "i2c-child-devices" array, don't pass in a "cookie" and "cookietype".
Instead, just create the appropriate devhandle and pass that along as a
data object.
 1.98 17-Sep-2025  thorpej Deprecate i2c_attach_args::ia_cookie and ia_cookietype. They are gone
from the API surface, but remain for ABI compatibility until subsequent
changes requiring a version bump are made.
 1.97 16-Sep-2025  thorpej Split the code that does the direct configuration of I2C child devices
into a separate function.
 1.96 16-Sep-2025  thorpej As with ACPI, perform the fdtbus_register_i2c_controller() in a centralized
location.
 1.95 16-Sep-2025  thorpej As with ACPI, iic_attach() now fetches the child device array directly
in the FDT case. Adjust the OFW case so that we're not forced to indirect
through a dictionary if it's not needed.
 1.94 15-Sep-2025  thorpej Register the I2C controller with the ACPI subsystem centrally in
iic_attach().
 1.93 15-Sep-2025  thorpej Do the ACPI-specific get-child-devices dance in iic_attach(). This
obviously isn't ideal, but it funnels the issue into a central location
and provides for easier improvement later.
 1.92 27-Jan-2025  riastradh sys/dev/i2c/i2c.c: KNF

No functional change intended.
 1.91 23-Jan-2025  brad Fix a likely bug in iic_ioctl.

The error variable was being over written by the copyout call. The
effect here is that the I2C transaction could have errored, but then
the copyout is performed in the read case and if that worked, error
would end up 0. Just don't do the copyout if the I2C transaction
errored.

Also, don't return twice. Once is enough.

With this, "i2cscan -r ..." on a RPI and with the ds28e17iic(4)
masters will work as expected.
 1.90 24-Oct-2022  riastradh branches: 1.90.2; 1.90.8;
iic(4): Use config_detach_children to simplify.
 1.89 24-Oct-2022  riastradh i2c(9): Nix smbus intr API.

It was introduced in 2007 for some Xbox thing which was removed in
2011. The API and the threads it spawned have been sitting around
idly for over a decade serving no purpose -- sometimes causing kernel
lock spinouts in the event of panic.

Add ic_tag_private to obviate need for future ABI changes. Not
currently used, but we can privately allocate memory in iic_tag_init
for the purpose later if need be without changing ABI.

XXX kernel revbump -- changes struct i2c_controller
 1.88 23-Jul-2022  thorpej If there is a compat string list, parenthetically print the first one
in iic_print_direct(). (From thorpej-i2c-spi-conf2 branch.)
 1.87 29-Jun-2022  mlelstv Allocate data buffer instead of using the stack.
 1.86 01-Apr-2022  pgoyette Split i2c_subr.c into a separate module rather than including it in
the iic module. There are valid configurations where i2c_subr code
can be both built-in and part of a loaded module (eg, piixpm is in
the kernel, but the iic module is loaded later). This causes the
in-kernel linker to detect a duplicate symbol.
 1.85 28-Mar-2022  riastradh driver(9): devsw_detach never fails. Make it return void.

Prune a whole lotta dead branches as a result of this. (Some logic
calling this is also wrong for other reasons; devsw_detach is final
-- you should never have any reason to decide to roll it back. To be
cleaned up in subsequent commits...)

XXX kernel ABI change to devsw_detach signature requires bump
 1.84 24-Jan-2022  andvar remove double "with" in comments and usage text. Also fix one typo.
 1.83 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.82 21-Jan-2022  thorpej Replace devhandle_invalidate(), which invalidates a devhandle, with
devhandle_invalid(), which returns an invalid devhandle.
 1.81 17-Jan-2022  thorpej Minimal hack to pass child devices a devhandle created from the OF
or ACPI "cookie". Temporary measure until the i2c autoconfiguration
overhaul is merged (which fixes this in a more generic way).
 1.80 07-Aug-2021  thorpej branches: 1.80.2;
Merge thorpej-cfargs2.
 1.79 21-Jun-2021  christos branches: 1.79.2;
fix proplib deprecation
 1.78 24-Apr-2021  thorpej branches: 1.78.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.77 25-Jan-2021  jmcneill branches: 1.77.2;
Add support for ACPI-based I2C mux attachment.
 1.76 18-Jan-2021  thorpej Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup(). This pattern is less awkward to use.
 1.75 07-Jul-2020  thorpej branches: 1.75.2;
whitelist -> permitlist
 1.74 12-Jun-2020  thorpej i2c-indirect-config == false --> i2c-no-indirect-config == true
 1.73 11-Jun-2020  thorpej Update for proplib(3) API changes.
 1.72 23-Dec-2019  thorpej No need to use I2C_F_POLL here.
 1.71 22-Dec-2019  thorpej Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.70 05-Dec-2019  mlelstv Revert previous. Indirect matches are not wanted on platforms that
use external configuration data (FDT or OF).
 1.69 26-Mar-2019  mlelstv branches: 1.69.4;
touch match_result only on success.
 1.68 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.67 09-Dec-2018  jdolecek try to detach on shutdown; for now the only practical reason is to test that
the driver detach paths work
 1.66 26-Jun-2018  thorpej branches: 1.66.2;
Remove the i2c "size" locator and corresponding property / attach arg.
It was a hack meant only for EEPROMs, which have another way to specify
size in the config directive ("flag" paramter), as well as a better way
to detect size based on "compatible" string.
 1.65 26-Jun-2018  thorpej Change device_compatible_match() and iic_compatible_match() to return
the weighted match value and take an optional compatible-entry pointer,
rather than the other way around.
 1.64 22-Jun-2018  martin iic_use_direct_match(): when iic_compatible_match() does not find a
comptible entry, set match quality to 0. Otherwise callers might use
random stack garbage.
 1.63 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.62 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.61 07-Jun-2018  thorpej Changes / enhancements to i2c indirect device auto-configuration:

— iic_search() chooses a “probe strategy” based on the
"i2c-indirect-probe-strategy” property on the “iic” instance.
Valid values are "smbus-quick-write”, "smbus-receive-byte”, and
“none”. If no value is specified, the default is "smbus-quick-write”.

— If the "i2c-indirect-device-whitelist” exists on the “iic” instance,
iic_search() will first check the driver name in the cfdata_t against
this list, and only allow the match/probe to move forward if the
cfdata_t driver name is in the list. This is primarily to accommodate
the Intel integrated memory controller neutered-i2c-thing.

— If the cfdata_t specifies a wildcard address, each address of the i2c
bus will be consulted. If the cfdata_t contains a nailed-down address,
then we limit the bus scan to that specific address.

— We explicitly skip reserved / special i2c addresses, such as the
General-Call address, etc.

— We introduce the notion of a “match quality” for i2c drivers. From
lowest-quality to highest-quality: matched by plausible address only,
matched by plausible address and poking at the bus to see if the
device looks reasonable, matched by direct-config “compatible” string,
matched by direct-config “driver name” string.

— If the “match quality” is merely “plausible address only”, then
iic_search() will use the probe strategy selected above to see if
a device responds to that address.
 1.60 07-Jun-2018  thorpej Back out unintended commits.
 1.59 07-Jun-2018  thorpej Adjust come defaults:
- Initial gain -> 16x
- auto_gain -> true
 1.58 15-May-2018  thorpej Fix a problem reported by jmcneill@ where by a system with multuple i2c
busses would end up with "ghost" device instances on the second bus. This
issue was previously masked on ARM systems by the empty-child-devices
array issue fixed recently (that effectively blocked all indirect config
of i2c busses on those systems).

To fix this problem, we require that indirectly-configured devices have
to fully specify their parent spec and address, e.g.:

foo* at iic0 addr 0x55

NOT

foo* at iic? addr ?

or even:

foo* at iic? addr 0x55

This is needed because of how indirect configuration works... attach
directives in the kernel config file are enumerated, calling the bus's
search routine, which in the case of i2c, enumerates all i2c addresses
and calls the match routine for each address. Because we can't always
reliably probe for i2c devices, we ended up with erroneous matches.

Direct configuration of i2c is still allowed to use wildcarded parent specs
and locators.
 1.57 10-Dec-2017  bouyer branches: 1.57.2;
For direct-config devices, pass the whole dictionary to the child as
ia_prop, so that chil drivers can look up device-specific properties.
Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.
 1.56 28-Oct-2017  riastradh Kill some more extern struct cfdriver declarations.

Down with externs in .c!
 1.55 01-Jun-2017  chs remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.54 23-Jul-2016  jakllsch branches: 1.54.6;
Use one more value from "locators.h", also make sure 'size' is initialized.
 1.53 23-Jul-2016  jakllsch Use values from "locators.h" when constructing locators array to be sure
of correct index;
 1.52 07-Jun-2016  pgoyette branches: 1.52.2;
Create separate modules for i2c_bitbang and bpf_filter so these files
can be included in kernels which need them without also duplicating
them in other modules. Removes the duplicate symbols I found which
prevented loading i2c and bpf modules after having fixed PR 45125.
 1.51 13-Dec-2015  jmcneill allow child devices to be passed in attach args instead of device dictionary
 1.50 10-Dec-2015  pgoyette When loaded as a non-built-in module, make sure we attach the cdevsw.
Without this, the i2c bus works but userland programs (such as
i2cscan(8)) cannot open /dev/iic*.

While we're here, add a ref-count to make sure that the device doesn't
get detached while it is open.
 1.49 13-Apr-2015  pgoyette Add required dependency on i2cexec
 1.48 04-Apr-2015  christos dedup code.
 1.47 04-Apr-2015  riastradh Free cmd on error if we allocated it.

Found by Brainy, reported by maxv@.
 1.46 22-Jan-2015  jakllsch More correctly handle I²C exec ioctls with both a command and write data
phase. Previously the data phase of ioctl writes was sending uninitialized
kernel stack to the addressed device.
 1.45 07-Dec-2014  jmcneill Let kernel config override I2C_MAX_ADDR
 1.44 25-Jul-2014  dholland branches: 1.44.2; 1.44.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.43 16-Mar-2014  dholland branches: 1.43.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.42 24-Sep-2013  jdc Add a property "i2c-indirect-config" to allow/disallow i2c indirect config.
If missing, "allowed" is assumed. Set it to false for OFW machines.
Patch from martin@. Removes erroneous i2c probe messages that appeared with
wildcard support.
 1.41 12-Sep-2013  martin Remove unused variable
 1.40 07-Aug-2013  soren Allow i2c addr wildcard matching. Use with care!
 1.39 03-Feb-2013  jdc branches: 1.39.2; 1.39.6;
Also set ia.ia_size from size when doing direct config.
 1.38 14-Mar-2012  pgoyette branches: 1.38.2;
Don't try to match a device if there's already a device attached at
the specified address.
 1.37 11-Oct-2011  macallan branches: 1.37.2; 1.37.6;
remove spurious warning about duplicate devices when using info from MD
code ( like OpenFirmware )
ok jmcneill
 1.36 03-Oct-2011  jmcneill iic_ioctl_exec: if the i2c controller's "exec" function uses -1 instead of
an error code to report failure, convert it to EIO.
 1.35 03-Oct-2011  jmcneill fix build for kernels with i2c host controller drivers but no iic(4)
driver present
 1.34 02-Oct-2011  jmcneill iic_ioctl_exec: initialize cmd before using it
 1.33 02-Oct-2011  jmcneill add support for detaching iic(4)
 1.32 02-Oct-2011  jmcneill I2C_IOCTL_EXEC: only allow i2c write ops if the device was opened for writing
 1.31 02-Oct-2011  jmcneill Install dev/i2c/i2c_io.h and implement the API in the iic(4) driver.
Obsolete the I2C_SCAN option as this can now be done from userland.
 1.30 02-Oct-2011  mbalmer Consistent use of 'return'.
 1.29 02-Oct-2011  mbalmer Build iic(4) and gpioiic(4) as modules.
 1.28 02-Oct-2011  mbalmer ii2c can be built as module.
 1.27 02-Aug-2011  pgoyette Prevent multiple attachments at the same i2c address.

OK jmcneill@
 1.26 31-Jul-2011  jmcneill add rescan support
 1.25 01-Mar-2010  njoly Do initialise i2c_attach_args new members, for indirect configuration
too.
 1.24 28-Feb-2010  martin Generic (device property based) framework for optional direct configuration
of i2c devices, as discussed on tech-kern.
 1.23 03-Feb-2009  pgoyette branches: 1.23.4;
Change the i2c bus scan routine to use the write_quick protocol for most
addresses, rather than trying to read a byte of data from the device.

Some devices don't like to be read from (certain clock devices are, I'm
told, write-only!), while others expect to be asked only for words (or
pairs of bytes).

While here, skip a bunch of i2c addresses that can't (or at the very
least, shouldn't) have any slave devices.

This is the only use in NetBSD of the quick_read/quick_write protocol,
and it remains disabled by default. I've updated all the generic i2c
drivers to handle the quick_* protocols, but several port-specific
drivers have not been updated since I'm in no position to verify that
the changes work. Assistance from sandpoint, arm/xscale, evbarm/gumstix,
mips/alchemy, and macppc would be greatly appreciated.
 1.22 29-Sep-2008  pgoyette branches: 1.22.2;
When scanning i2c bus for responding devices, skip over the multicast
i2c Alert Response Address. Skipping this won't hurt (the address is
allegedly reserved), and it might avoid the lock-ups that have been
seen by others.
 1.21 11-Sep-2008  pgoyette Provide an option I2C_SCAN to enable sanning i2c bus for responses. This
is disabled by default, preserving current behavior.

OK garbled@
 1.20 04-May-2008  xtraeme branches: 1.20.2; 1.20.6;
device_t/softc split and other related cosmetic changes.
 1.19 06-Apr-2008  cegger branches: 1.19.2; 1.19.4;
use aprint_*_dev and device_xname
 1.18 11-Dec-2007  lukem branches: 1.18.8;
use __KERNEL_RCSID()
 1.17 09-Dec-2007  jmcneill branches: 1.17.2;
Merge jmcneill-pm branch.
 1.16 12-Nov-2007  joerg branches: 1.16.2; 1.16.4;
From jmcneill-pm: don't probe for I2C device. It has limited usefulness
and hangs a number of machines.
 1.15 01-Sep-2007  riz branches: 1.15.4; 1.15.6;
For SMBus, add the ability to enumerate devices on the bus.
This does NOT identify the devices, merely indicates the
presence of devices at certain addresses. Tested on ichsmb
and nfsmb - other SMBus devices will need to ensure the
proper bus type is set. (I2C_TYPE_SMBUS)

From Nicolas Joly, via Paul Goyette, in PR#36744.
 1.14 09-Jul-2007  ad branches: 1.14.2; 1.14.6; 1.14.8;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.13 06-Feb-2007  jmcneill branches: 1.13.6; 1.13.8;
Missing LIST_INIT. Pointed out by uebayasi@
 1.12 05-Feb-2007  jmcneill Remove debug printf accidentally added in last commit.
 1.11 05-Feb-2007  jmcneill Allow i2c child devices to register interrupt handlers to the smbus host
controller. Both interrupt context and process context type handlers are
supported.
 1.10 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.9 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.8 26-Jun-2006  drochner branches: 1.8.4; 1.8.6;
remove the "name" element from the i2cbus attach args, that's what
interface attributes are good for
 1.7 29-Mar-2006  thorpej branches: 1.7.4;
Use device_private().
 1.6 27-Mar-2006  jmcneill Implement a handful of missing smbus protocol functions. Proposed on
tech-kern: http://mail-index.netbsd.org/tech-kern/2006/03/16/0029.html
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.6; 1.5.8; 1.5.10; 1.5.12;
merge ktrace-lwp.
 1.4 26-Aug-2005  drochner s/locdesc_t/int/g
 1.3 13-Sep-2004  drochner branches: 1.3.12;
a round of autoconf cleanup:
-convert submatch() style functions (passed to config_search() or
config_found_sm()) to the locator passing variants
-pass interface attributes in some cases
-make submatch() functions look uniformly as far as possible
-avoid macros which just hide cfdata members, and reduce dependencies
on "locators.h"
 1.2 16-May-2004  wiz branches: 1.2.2;
Fix typo in comment, reported by Alexander Yurchenko grange at rt mipt ru.
 1.1 30-Sep-2003  thorpej New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.2.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.2 03-Aug-2004  skrll Sync with HEAD
 1.2.2.1 16-May-2004  skrll file i2c.c was added on branch ktrace-lwp on 2004-08-03 10:46:05 +0000
 1.3.12.6 21-Jan-2008  yamt sync with head
 1.3.12.5 15-Nov-2007  yamt sync with head.
 1.3.12.4 03-Sep-2007  yamt sync with head.
 1.3.12.3 26-Feb-2007  yamt sync with head.
 1.3.12.2 30-Dec-2006  yamt sync with head.
 1.3.12.1 21-Jun-2006  yamt sync with head.
 1.5.12.2 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.5.12.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.5.10.1 19-Apr-2006  elad sync with head.
 1.5.8.2 11-Aug-2006  yamt sync with head
 1.5.8.1 01-Apr-2006  yamt sync with head.
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.7.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.8.6.2 10-Dec-2006  yamt sync with head.
 1.8.6.1 22-Oct-2006  yamt sync with head
 1.8.4.2 09-Feb-2007  ad Sync with HEAD.
 1.8.4.1 18-Nov-2006  ad Sync with head.
 1.13.8.1 11-Jul-2007  mjf Sync with head.
 1.13.6.4 09-Oct-2007  ad Sync with head.
 1.13.6.3 13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.13.6.2 10-Apr-2007  ad Nuke the deferred kthread creation stuff, as it's no longer needed.
Pointed out by thorpej@.
 1.13.6.1 09-Apr-2007  ad - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.
 1.14.8.2 09-Jan-2008  matt sync with HEAD
 1.14.8.1 06-Nov-2007  matt sync with HEAD
 1.14.6.4 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.14.6.3 23-Nov-2007  joerg Register with PM framework. i2c is by definition dumb so nothing to
do...
 1.14.6.2 05-Sep-2007  jmcneill Disable i2c scan, it's dangerous.
 1.14.6.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.14.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.15.6.2 27-Dec-2007  mjf Sync with HEAD.
 1.15.6.1 19-Nov-2007  mjf Sync with HEAD.
 1.15.4.1 13-Nov-2007  bouyer Sync with HEAD
 1.16.4.1 11-Dec-2007  yamt sync with head.
 1.16.2.1 26-Dec-2007  ad Sync with head.
 1.17.2.1 13-Dec-2007  bouyer Sync with HEAD
 1.18.8.3 05-Oct-2008  mjf Sync with HEAD.
 1.18.8.2 28-Sep-2008  mjf Sync with HEAD.
 1.18.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.4.3 11-Mar-2010  yamt sync with head
 1.19.4.2 04-May-2009  yamt sync with head.
 1.19.4.1 16-May-2008  yamt sync with head.
 1.19.2.1 18-May-2008  yamt sync with head.
 1.20.6.1 19-Oct-2008  haad Sync with HEAD.
 1.20.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.20.2.1 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.22.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.23.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.37.6.1 05-Apr-2012  mrg sync to latest -current.
 1.37.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.37.2.1 17-Apr-2012  yamt sync with head
 1.38.2.3 03-Dec-2017  jdolecek update from HEAD
 1.38.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.2.1 25-Feb-2013  tls resync with head
 1.39.6.1 10-May-2013  khorben Added two locators for I2C devices: "intr" and "intrbase".

They are required to allow the TPS65950 companion chip to both handle its
interrupts on the system, and allow its extra GPIO pins to be used as
interrupts as well.

XXX This change is not adequate because intr_establish() is a MD interface,
so it will have to be re-designed before merging to the main tree.
 1.39.2.2 18-May-2014  rmind sync with head
 1.39.2.1 28-Aug-2013  rmind sync with head
 1.43.2.1 10-Aug-2014  tls Rebase.
 1.44.4.6 28-Aug-2017  skrll Sync with HEAD
 1.44.4.5 05-Oct-2016  skrll Sync with HEAD
 1.44.4.4 09-Jul-2016  skrll Sync with HEAD
 1.44.4.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.44.4.2 06-Jun-2015  skrll Sync with HEAD
 1.44.4.1 06-Apr-2015  skrll Sync with HEAD
 1.44.2.2 16-May-2015  snj Pull up following revision(s) (requested by maxv in ticket #761):
sys/arch/sgimips/dev/scn.c: revision 1.8
sys/arch/sgimips/mace/macekbc.c: revision 1.8
sys/dev/hpc/hpcfb.c: revision 1.59
sys/dev/i2c/i2c.c: revision 1.47
sys/dev/ic/mfi.c: revision 1.57
sys/dev/if_ndis/if_ndis_pci.c: revision 1.21
sys/dev/sysmon/sysmon_power.c: revisions 1.50-1.52
sys/dev/usb/umass_isdata.c: revision 1.31
fix double free, found by Brainy.
--
Free cmd on error if we allocated it.
Found by Brainy, reported by maxv@.
--
don't leak rl (but there are other leaks), found by Brainy.
--
Free ped if we can't hand it to the power daemon.
Found by Brainy, reported by maxv@.
--
don't forget to free the dictionary.
--
another missing free dict.
--
fix leak, found by Brainy.
--
don't malloc a tiny, fixed size buffer to scribble into, then not use it
and never free it either
found by Brainy
--
malloc() -> kmem_alloc() for private data, also kmem_free() them if we
don't finish attaching for whatever reason
found by Brainy
 1.44.2.1 23-Jan-2015  martin Pull up following revision(s) (requested by jakllsch in ticket #444):
sys/dev/i2c/i2c.c: revision 1.46
More correctly handle I�C exec ioctls with both a command and write data
phase. Previously the data phase of ioctl writes was sending uninitialized
kernel stack to the addressed device.
 1.52.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.54.6.2 29-Apr-2017  pgoyette Revise previous. Rather than explicitly including <sys/localcount.h>
in all the places where {b,c}devsw is initialized, just include it
from <sys/conf.h>. This avoids an include-sequence dependancy.
 1.54.6.1 29-Apr-2017  pgoyette Add DEVSW_MODULE_INIT to existing device-driver modules, so that they
willl have a localcount defined and thus be permitted to load. Without
a localcount, loading the module will return EINVAL.

XXX the dtrace and drm stuff might need to be fed back upstream?
 1.57.2.4 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.57.2.3 28-Jul-2018  pgoyette Sync with HEAD
 1.57.2.2 25-Jun-2018  pgoyette Sync with HEAD
 1.57.2.1 21-May-2018  pgoyette Sync with HEAD
 1.66.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.66.2.1 10-Jun-2019  christos Sync with HEAD
 1.69.4.1 14-Dec-2019  martin Pull up following revision(s) (requested by mlelstev in ticket #552):

sys/dev/i2c/i2c.c: revision 1.70

Revert previous. Indirect matches are not wanted on platforms that
use external configuration data (FDT or OF).
 1.75.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.77.2.8 05-Apr-2021  thorpej config_match() -> config_probe(). It's a little over-loaded here because
we're mixing direct and indirect in the same place, but that will be
addresed at a later time.
 1.77.2.7 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.77.2.6 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.77.2.5 28-Mar-2021  thorpej "iic" only has a single interface attribute, so no need to be explicit.
 1.77.2.4 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.77.2.3 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.77.2.2 21-Mar-2021  thorpej In "rescan" routines, always pass locators and the interface attribute
straight through to config_search(). Also, for devices that carry only
one interface attribute, no need to do an ifattr_match(), because
rescan_with_cfdata() will have already validated that the parent is
eligible, which includes an interface attribute check.
 1.77.2.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.78.2.7 18-May-2021  thorpej Correct a comment.
 1.78.2.6 17-May-2021  thorpej Remove "count" from the device enumeration callback arguments.
 1.78.2.5 16-May-2021  thorpej Check for errors from iic_acquire_bus() in iic_ioctl_exec().
 1.78.2.4 16-May-2021  thorpej - Set D_MCLOSE in the iic_cdevsw so that we get a d_close call for
each close so that the module ref counting works properly.
- Rearrange things a little to avoid holding the iic_mtx a long as
previously done.
 1.78.2.3 16-May-2021  thorpej Rather than allocating 8KB (!!) of space per i2c bus for a sparsely
populated array of child devices, use a sorted list instead, optimized
a bit for the common usage pattern.
 1.78.2.2 08-May-2021  thorpej iic_print_direct(): In the "not configured" case, parenthetically print
the first element of the compat list, if we got a compat list.
 1.78.2.1 25-Apr-2021  thorpej Stop using a prop_array of child device data to perform direct
configuration of i2c devices. Instead, introduce and use a new
device call "i2c-enumerate-devices" that can be implemented by
devhandle providers that have I2C bindings. This device call
gathers up the data into i2c_attach_args and invoked a callback
(back to the i2c layer) to attach the device. The I2C controller
device supplies its devhandle (or the appropriate devhandle for
the I2C bus) when attaching the i2c bus instance using CFARG_DEVHANDLE.
 1.79.2.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.80.2.8 13-Sep-2021  thorpej Move the i2c enumeration helpers to their own header file to detangle
it from reliance on "iic" being configured into the kernel.
 1.80.2.7 12-Sep-2021  thorpej iic_devslot_remove(): remove an errant "return false;" (the result of
a paste-o).
 1.80.2.6 11-Sep-2021  thorpej Re-factor the code in sandpoint and sparc64 that enumerates a static
table of i2c device entries into something sharable.
 1.80.2.5 10-Sep-2021  thorpej Remove unnecessary references to i2c_attach_args::ia_prop and mark the ones
that remain as XXX.
 1.80.2.4 22-Aug-2021  thorpej In iic_devslot_reserve(), don't set a pointer to NULL before dereferencing
it in a KASSERT().
 1.80.2.3 22-Aug-2021  thorpej Use designated initialiers in iic_attach().
 1.80.2.2 09-Aug-2021  thorpej In iic_close(), mark the "sc" variable as __diagused.
 1.80.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.90.8.1 02-Aug-2025  perseant Sync with HEAD
 1.90.2.1 02-Feb-2025  martin Pull up following revision(s) (requested by brad in ticket #1044):

sys/dev/i2c/i2c.c: revision 1.91

Fix a likely bug in iic_ioctl.

The error variable was being over written by the copyout call. The
effect here is that the I2C transaction could have errored, but then
the copyout is performed in the read case and if that worked, error
would end up 0. Just don't do the copyout if the I2C transaction
errored.

Also, don't return twice. Once is enough.

With this, "i2cscan -r ..." on a RPI will work as expected.
 1.14 07-Jun-2016  pgoyette Create separate modules for i2c_bitbang and bpf_filter so these files
can be included in kernels which need them without also duplicating
them in other modules. Removes the duplicate symbols I found which
prevented loading i2c and bpf modules after having fixed PR 45125.
 1.13 25-Apr-2010  tsutsui branches: 1.13.18; 1.13.36;
Fix typo in comments.
 1.12 12-Jul-2008  tsutsui branches: 1.12.14; 1.12.16;
Set SDA High (it means turning off open-collector driver
regardless of DIR() on the formal I2C hardware implementation)
during DIR() is set to INPUT. Some MD drivers might assume it.

tl(4) still works with this change.
 1.11 01-Jun-2008  tsutsui branches: 1.11.2; 1.11.4;
Reorganize I2C bitbang ops:
- don't set DIR(INPUT) in i2c_wait_for_scl() because it could cause
unexpected stop condition in SCL=H, SDL=L and DIR(OUTPUT) case,
and DIR() should be used only to switch SDA direction, not SCL
that is always output on the master device
(I'm not sure if reading SCL on the master is defined in the I2C spec)
- set SDA right after SCL H->L edge on Tx, fetch SDA at SCL L->H edge on Rx,
and make sure not to change SDA during SCL=H except start/stop conditions
so that we don't have to rely on data setup time which might be critical
- don't set DIR(OUTPUT) during SDA bit read in i2c_bitbang_read_byte()
- explicitly specify both SDA and SCL bits in SETBITS() for readability
- sprinkle comments

Fixes "tl0: error reading Ethernet address" problem on tl(4).
 1.10 31-May-2008  tsutsui - use 'us' for microsecond rather than 'uS'
- unwrap not so long lines
- some KNF
 1.9 11-Dec-2007  lukem branches: 1.9.8; 1.9.10; 1.9.12; 1.9.14;
use __KERNEL_RCSID()
 1.8 01-Dec-2007  kiyohara branches: 1.8.2; 1.8.4; 1.8.6;
Fix lost direction for the check on status, and read/writes.
 1.7 30-Apr-2007  macallan branches: 1.7.6; 1.7.8; 1.7.14;
add support for i2c waitstates so we can actually talk to slow slaves
Suggestions and review by simon
 1.6 16-Nov-2006  christos branches: 1.6.4; 1.6.8; 1.6.10;
__unused removal on arguments; approved by core.
 1.5 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.4 14-Jul-2006  gdamore branches: 1.4.4; 1.4.6;
Add support for 10-bit addressing, per i2c specs. This has not been tested
with any actual 10-bit devices (as I don't have any), but it doesn't seem to
impact 7-bit addressing any. Approved by christos@, briggs@, and thorpej@.
 1.3 05-Mar-2006  christos branches: 1.3.8;
cleanup more SET/CLR/ISSET lossage
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8;
merge ktrace-lwp.
 1.1 30-Sep-2003  thorpej branches: 1.1.4; 1.1.18;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.18.5 21-Jan-2008  yamt sync with head
 1.1.18.4 07-Dec-2007  yamt sync with head
 1.1.18.3 03-Sep-2007  yamt sync with head.
 1.1.18.2 30-Dec-2006  yamt sync with head.
 1.1.18.1 21-Jun-2006  yamt sync with head.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file i2c_bitbang.c was added on branch ktrace-lwp on 2004-08-03 10:46:05 +0000
 1.2.8.2 11-Aug-2006  yamt sync with head
 1.2.8.1 13-Mar-2006  yamt sync with head.
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.3.8.1 13-Jul-2006  gdamore Merge from HEAD.
 1.4.6.2 10-Dec-2006  yamt sync with head.
 1.4.6.1 22-Oct-2006  yamt sync with head
 1.4.4.1 18-Nov-2006  ad Sync with head.
 1.6.10.1 11-Jul-2007  mjf Sync with head.
 1.6.8.1 27-May-2007  ad Sync with head.
 1.6.4.1 07-May-2007  yamt sync with head.
 1.7.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.7.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.8.1 09-Jan-2008  matt sync with HEAD
 1.7.6.1 03-Dec-2007  joerg Sync with HEAD.
 1.8.6.1 13-Dec-2007  bouyer Sync with HEAD
 1.8.4.1 11-Dec-2007  yamt sync with head.
 1.8.2.1 26-Dec-2007  ad Sync with head.
 1.9.14.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.9.14.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.9.12.2 11-Aug-2010  yamt sync with head.
 1.9.12.1 04-May-2009  yamt sync with head.
 1.9.10.1 04-Jun-2008  yamt sync with head
 1.9.8.2 28-Sep-2008  mjf Sync with HEAD.
 1.9.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.4.1 19-Oct-2008  haad Sync with HEAD.
 1.11.2.1 18-Jul-2008  simonb Sync with head.
 1.12.16.1 30-May-2010  rmind sync with head
 1.12.14.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.13.36.1 09-Jul-2016  skrll Sync with HEAD
 1.13.18.1 03-Dec-2017  jdolecek update from HEAD
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file i2c_bitbang.h was added on branch ktrace-lwp on 2004-08-03 10:46:05 +0000
 1.3 30-Sep-2003  thorpej New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.2 13-Nov-2001  lukem branches: 1.2.16;
add RCSID
 1.1 17-Oct-1997  bouyer branches: 1.1.28; 1.1.30;
Generic driver for read/write i2c devices, and for Microchip Technology's
i2c eeproms.
 1.1.30.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.28.1 14-Nov-2001  nathanw Catch up to -current.
 1.2.16.1 03-Aug-2004  skrll Sync with HEAD
 1.2 30-Sep-2003  thorpej New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1 17-Oct-1997  bouyer branches: 1.1.50;
Generic driver for read/write i2c devices, and for Microchip Technology's
i2c eeproms.
 1.1.50.1 03-Aug-2004  skrll Sync with HEAD
 1.1 21-Sep-2025  thorpej Add support for enumerating i2c devices directly from the platform
device tree. Direct configuration still looks for i2c-child-devices
property on the controller, and will use it if it exists in order to
ease transition.
 1.2 21-Sep-2025  thorpej Regen for i2c_calls v1.1.
 1.1 21-Sep-2025  thorpej Add support for enumerating i2c devices directly from the platform
device tree. Direct configuration still looks for i2c-child-devices
property on the controller, and will use it if it exists in order to
ease transition.
 1.3 30-Sep-2003  thorpej New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.2 13-Nov-2001  lukem branches: 1.2.16;
add RCSID
 1.1 17-Oct-1997  bouyer branches: 1.1.28; 1.1.30;
Generic driver for read/write i2c devices, and for Microchip Technology's
i2c eeproms.
 1.1.30.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.28.1 14-Nov-2001  nathanw Catch up to -current.
 1.2.16.1 03-Aug-2004  skrll Sync with HEAD
 1.2 30-Sep-2003  thorpej New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1 17-Oct-1997  bouyer branches: 1.1.50;
Generic driver for read/write i2c devices, and for Microchip Technology's
i2c eeproms.
 1.1.50.1 03-Aug-2004  skrll Sync with HEAD
 1.3 23-Sep-2025  thorpej Make the i2c_enumerate_deventries() callback a bit more generic so
it can also be used for the filtering function that macppc::cuda
and sandpoint need.
 1.2 21-Sep-2025  thorpej Add support for enumerating i2c devices directly from the platform
device tree. Direct configuration still looks for i2c-child-devices
property on the controller, and will use it if it exists in order to
ease transition.
 1.1 13-Sep-2021  thorpej branches: 1.1.2;
file i2c_enum.h was initially added on branch thorpej-i2c-spi-conf2.
 1.1.2.1 13-Sep-2021  thorpej Move the i2c enumeration helpers to their own header file to detangle
it from reliance on "iic" being configured into the kernel.
 1.21 23-Sep-2025  thorpej Move iic_{acquire,release}_bus_lock() into i2c_exec.c from i2c_subr.c
to deal with MODULARization / attribute entanglements.

Fixes e.g. alpha INSTALL kernel build issue after recent i2c work.
 1.20 21-Sep-2025  thorpej Tidy up the i2c subsystem ABI:
- Remove unused structures and deprecated fields (ia_prop, ia_cookie,
ia_cookietype).
- Normalize the "compatible" list; we get it as a strlist, don't bother
converting to an array when we can use the strlist as-is. (This is
invisible to drivers using the API correctly, but it does change
the i2c_attach_args).
- Add a "channel" field to i2c_tag_t, for use by controllers with
built-in i2c muxes or discrete i2c muxes.

Bienvenido, NetBSD 11.99.3.
 1.19 20-Sep-2025  thorpej Put the "acquire i2c bus lock" logic (sleep vs try) into a helper function
so it can shared.
 1.18 24-Oct-2022  riastradh i2c(9): Nix smbus intr API.

It was introduced in 2007 for some Xbox thing which was removed in
2011. The API and the threads it spawned have been sitting around
idly for over a decade serving no purpose -- sometimes causing kernel
lock spinouts in the event of panic.

Add ic_tag_private to obviate need for future ABI changes. Not
currently used, but we can privately allocate memory in iic_tag_init
for the purpose later if need be without changing ABI.

XXX kernel revbump -- changes struct i2c_controller
 1.17 12-Oct-2021  andvar fix various typos, mainly in comments.
 1.16 19-Apr-2020  thorpej In iic_acquire_bus(), unlock the bus lock if the back-end returns an
error from its acquire-bus function.
 1.15 02-Jan-2020  thorpej branches: 1.15.6;
Also force I2C_F_POLL if shutting_down.
 1.14 23-Dec-2019  thorpej Disable the not-in-interrupt assertions for now; more work needs to be
done in several i2c client drivers.
 1.13 22-Dec-2019  thorpej Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.12 25-Jul-2019  thorpej If cold, automagically set I2C_F_POLL.
 1.11 10-Dec-2018  thorpej Make i2c_acquire_bus() / i2c_release_bus() real symbols.
 1.10 07-Mar-2015  jmcneill branches: 1.10.16; 1.10.18;
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.9 12-Sep-2013  martin branches: 1.9.4; 1.9.6;
Fix evil "sizeof(void*)" botch
 1.8 22-Apr-2012  pgoyette branches: 1.8.2; 1.8.4;
Identify SMBus block-mode operations.

XXX Nothing in the kernel issues block-mode commands, and each i2c bus
XXX driver needs its own support for the block-mode operations.
 1.7 03-Feb-2009  pgoyette branches: 1.7.14; 1.7.18;
Handle i2c quick_read/quick_write bus protocol in the generic i2c_exec()
routine, since we have already have the iic_smbus_* interfaces.

NOTE: i2c controllers that provide their own i2c_exec() routine also need
to be modified. I'll be committing most of these shortly.
 1.6 11-Dec-2007  lukem branches: 1.6.12; 1.6.20;
use __KERNEL_RCSID()
 1.5 27-Mar-2006  jmcneill branches: 1.5.34; 1.5.44; 1.5.46; 1.5.48;
Implement a handful of missing smbus protocol functions. Proposed on
tech-kern: http://mail-index.netbsd.org/tech-kern/2006/03/16/0029.html
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10; 1.4.12;
merge ktrace-lwp.
 1.3 29-Oct-2003  mycroft branches: 1.3.4; 1.3.18;
Remove bogus initializer, and instead fix an =/== typo.
 1.2 25-Oct-2003  christos Don't return random errors.
 1.1 30-Sep-2003  thorpej New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.3.18.2 21-Jan-2008  yamt sync with head
 1.3.18.1 21-Jun-2006  yamt sync with head.
 1.3.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.4.2 03-Aug-2004  skrll Sync with HEAD
 1.3.4.1 29-Oct-2003  skrll file i2c_exec.c was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.4.12.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.4.10.1 19-Apr-2006  elad sync with head.
 1.4.8.1 01-Apr-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.48.1 13-Dec-2007  bouyer Sync with HEAD
 1.5.46.1 11-Dec-2007  yamt sync with head.
 1.5.44.1 26-Dec-2007  ad Sync with head.
 1.5.34.1 09-Jan-2008  matt sync with HEAD
 1.6.20.1 03-Mar-2009  skrll Sync with HEAD.
 1.6.12.1 04-May-2009  yamt sync with head.
 1.7.18.1 29-Apr-2012  mrg sync to latest -current.
 1.7.14.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.14.1 23-May-2012  yamt sync with head.
 1.8.4.1 18-May-2014  rmind sync with head
 1.8.2.2 03-Dec-2017  jdolecek update from HEAD
 1.8.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.6.1 06-Apr-2015  skrll Sync with HEAD
 1.9.4.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.10.18.3 21-Apr-2020  martin Sync with HEAD
 1.10.18.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.10.18.1 10-Jun-2019  christos Sync with HEAD
 1.10.16.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.15.6.1 20-Apr-2020  bouyer Sync with HEAD
 1.5 29-Jun-2022  mlelstv Bump max transaction size from 32 Bytes to 4kB.
 1.4 28-Oct-2017  riastradh Add some #includes to make a few more header files compile.
 1.3 22-Apr-2012  pgoyette branches: 1.3.2;
Identify SMBus block-mode operations.

XXX Nothing in the kernel issues block-mode commands, and each i2c bus
XXX driver needs its own support for the block-mode operations.
 1.2 11-Dec-2005  christos branches: 1.2.110; 1.2.114;
merge ktrace-lwp.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file i2c_io.h was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.2.114.1 29-Apr-2012  mrg sync to latest -current.
 1.2.110.1 23-May-2012  yamt sync with head.
 1.3.2.1 03-Dec-2017  jdolecek update from HEAD
 1.7 23-Sep-2025  thorpej Move iic_{acquire,release}_bus_lock() into i2c_exec.c from i2c_subr.c
to deal with MODULARization / attribute entanglements.

Fixes e.g. alpha INSTALL kernel build issue after recent i2c work.
 1.6 21-Sep-2025  thorpej ...and make sure the bus # is printed in the not-not-configured case, too.
 1.5 21-Sep-2025  thorpej Fix brain-o in last commit (that'll teach me to make last minute changes).
 1.4 21-Sep-2025  thorpej iicbus_print(): report the bus number, if set in the tag.
 1.3 20-Sep-2025  thorpej Put the "acquire i2c bus lock" logic (sleep vs try) into a helper function
so it can shared.
 1.2 01-Apr-2022  pgoyette Split i2c_subr.c into a separate module rather than including it in
the iic module. There are valid configurations where i2c_subr code
can be both built-in and part of a loaded module (eg, piixpm is in
the kernel, but the iic module is loaded later). This causes the
in-kernel linker to detect a duplicate symbol.
 1.1 03-Oct-2011  jmcneill branches: 1.1.72; 1.1.82;
fix build for kernels with i2c host controller drivers but no iic(4)
driver present
 1.1.82.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.1.72.2 14-May-2021  thorpej Move the bus/channel number for multi-channel / mux controllers out of
i2cbus_attach_args and stash it in the i2c_tag_t instead. This makes it
accessible to platform device tree code when enumerating devices.
 1.1.72.1 08-May-2021  thorpej - Add an optional bus number to i2cbus_attach_args, and a corresponding
optional "bus" locator to the i2cbus interface attribute.
- Add a iicbus_print_multi() routine, which is like iicbus_print(),
but also prints the bus number.
- Use these new features in the iicmux driver rather than winging it.
 1.13 21-Sep-2025  thorpej Use ic_channel in the i2c_tag_t.
 1.12 16-Sep-2025  thorpej Now that the common I2C code hides many of the FDT vs ACPI differences,
perform the reductions currently possible in the I2C mux layer. Note
some additional enhancements necessary for further reductions.
 1.11 16-Sep-2025  thorpej As with ACPI, perform the fdtbus_register_i2c_controller() in a centralized
location.
 1.10 16-Sep-2025  thorpej Garbage-collect fdtbus_attach_i2cbus(); the regular iicbus_attach() is
sufficient now.
 1.9 15-Sep-2025  thorpej No longer need to include acpi_i2c.h here.
 1.8 15-Sep-2025  thorpej Do the ACPI-specific get-child-devices dance in iic_attach(). This
obviously isn't ideal, but it funnels the issue into a central location
and provides for easier improvement later.
 1.7 10-Nov-2021  msaitoh s/acutal/actual/ in comment.
 1.6 07-Aug-2021  thorpej branches: 1.6.2;
Merge thorpej-cfargs2.
 1.5 24-Apr-2021  thorpej branches: 1.5.2; 1.5.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.4 26-Jan-2021  jmcneill branches: 1.4.2;
Add a device_t parameter to acpi_enter_i2c_devs. If non-NULL, all child
acpi_devnodes will be claimed by that device so we don't later try to
attach a duplicate device to that node at acpinodebus.
 1.3 25-Jan-2021  jmcneill Add support for ACPI-based I2C mux attachment.
 1.2 24-Jan-2021  jmcneill trailing whitespace
 1.1 28-Dec-2020  thorpej branches: 1.1.2;
Re-factor the "iicmux" driver to support other types of muxes that are
themselves i2c devices.
 1.1.2.3 03-Apr-2021  thorpej Sync with HEAD.
 1.1.2.2 03-Jan-2021  thorpej Sync w/ HEAD.
 1.1.2.1 28-Dec-2020  thorpej file i2cmux.c was added on branch thorpej-futex on 2021-01-03 16:34:58 +0000
 1.4.2.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.5.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.5.2.4 14-May-2021  thorpej Move the bus/channel number for multi-channel / mux controllers out of
i2cbus_attach_args and stash it in the i2c_tag_t instead. This makes it
accessible to platform device tree code when enumerating devices.
 1.5.2.3 08-May-2021  thorpej Use device_enumerate_children() to eliminate all of the ACPI-specific
code and most of the FDT-specific code from the iicmux driver.
 1.5.2.2 08-May-2021  thorpej - Add an optional bus number to i2cbus_attach_args, and a corresponding
optional "bus" locator to the i2cbus interface attribute.
- Add a iicbus_print_multi() routine, which is like iicbus_print(),
but also prints the bus number.
- Use these new features in the iicmux driver rather than winging it.
 1.5.2.1 08-May-2021  thorpej Update the i2c mux code for the new enumeration methods.
 1.6.2.2 09-Aug-2021  thorpej Fix typo.
 1.6.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.4 16-Sep-2025  thorpej Now that the common I2C code hides many of the FDT vs ACPI differences,
perform the reductions currently possible in the I2C mux layer. Note
some additional enhancements necessary for further reductions.
 1.3 25-Jan-2021  jmcneill branches: 1.3.4; 1.3.14;
Add support for ACPI-based I2C mux attachment.
 1.2 24-Jan-2021  jmcneill trailing whitespace
 1.1 28-Dec-2020  thorpej branches: 1.1.2;
Re-factor the "iicmux" driver to support other types of muxes that are
themselves i2c devices.
 1.1.2.3 03-Apr-2021  thorpej Sync with HEAD.
 1.1.2.2 03-Jan-2021  thorpej Sync w/ HEAD.
 1.1.2.1 28-Dec-2020  thorpej file i2cmuxvar.h was added on branch thorpej-futex on 2021-01-03 16:34:58 +0000
 1.3.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.3.4.3 09-May-2021  thorpej Revert most of previous -- some consumers of this file still have
ACPI-specific requirements.
 1.3.4.2 08-May-2021  thorpej Use device_enumerate_children() to eliminate all of the ACPI-specific
code and most of the FDT-specific code from the iicmux driver.
 1.3.4.1 08-May-2021  thorpej Update the i2c mux code for the new enumeration methods.
 1.32 21-Sep-2025  thorpej Tidy up the i2c subsystem ABI:
- Remove unused structures and deprecated fields (ia_prop, ia_cookie,
ia_cookietype).
- Normalize the "compatible" list; we get it as a strlist, don't bother
converting to an array when we can use the strlist as-is. (This is
invisible to drivers using the API correctly, but it does change
the i2c_attach_args).
- Add a "channel" field to i2c_tag_t, for use by controllers with
built-in i2c muxes or discrete i2c muxes.

Bienvenido, NetBSD 11.99.3.
 1.31 20-Sep-2025  thorpej Put the "acquire i2c bus lock" logic (sleep vs try) into a helper function
so it can shared.
 1.30 17-Sep-2025  thorpej Deprecate i2c_attach_args::ia_cookie and ia_cookietype. They are gone
from the API surface, but remain for ABI compatibility until subsequent
changes requiring a version bump are made.
 1.29 16-Sep-2025  thorpej Garbage-collect i2cbus_attach_args::iba_child_devices -- it's no longer
used or referenced.
 1.28 15-Sep-2025  thorpej Do the ACPI-specific get-child-devices dance in iic_attach(). This
obviously isn't ideal, but it funnels the issue into a central location
and provides for easier improvement later.
 1.27 15-Sep-2025  thorpej Encapsulate what's needed to attach an I2C bus into a iicbus_attach()
inline.
 1.26 24-Oct-2022  riastradh i2c(9): Nix smbus intr API.

It was introduced in 2007 for some Xbox thing which was removed in
2011. The API and the threads it spawned have been sitting around
idly for over a decade serving no purpose -- sometimes causing kernel
lock spinouts in the event of panic.

Add ic_tag_private to obviate need for future ABI changes. Not
currently used, but we can privately allocate memory in iic_tag_init
for the purpose later if need be without changing ABI.

XXX kernel revbump -- changes struct i2c_controller
 1.25 28-May-2022  andvar fix various typos in comments.
 1.24 16-Apr-2021  skrll branches: 1.24.2; 1.24.12;
spello in comment
 1.23 25-Jan-2021  jmcneill branches: 1.23.2;
Add "cookietype" to i2c attach args, so the consumer knows if ia_cookie
is either an OF phandle or an ACPI_HANDLE. Add NXP0002 compatible mapping
while here.
 1.22 18-Jan-2021  thorpej Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup(). This pattern is less awkward to use.
 1.21 29-Dec-2020  thorpej - Use __BIT() macro to define I2C_F_* bits.
- Define an I2C_F_SPEED bitfield that can be used to specify an
I2C bus speed:

-> Standard Mode (100Kb/s)
-> Fast Mode (400Kb/s)
-> Fast Mode Plus (1Mb/s)
-> High Speed (3.4Mb/s)

The speed values are treated as advisory; if a controller does not support
the requested speed mode, fallback to a lower one is allowed.

(Currently, all controllers simply use Standard Mode.)
 1.20 07-Jul-2020  thorpej branches: 1.20.2;
whitelist -> permitlist
 1.19 22-Dec-2019  thorpej Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.18 10-Dec-2018  thorpej Make i2c_acquire_bus() / i2c_release_bus() real symbols.
 1.17 26-Jun-2018  thorpej branches: 1.17.2;
Remove the i2c "size" locator and corresponding property / attach arg.
It was a hack meant only for EEPROMs, which have another way to specify
size in the config directive ("flag" paramter), as well as a better way
to detect size based on "compatible" string.
 1.16 26-Jun-2018  thorpej Change device_compatible_match() and iic_compatible_match() to return
the weighted match value and take an optional compatible-entry pointer,
rather than the other way around.
 1.15 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.14 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.13 07-Jun-2018  thorpej Changes / enhancements to i2c indirect device auto-configuration:

— iic_search() chooses a “probe strategy” based on the
"i2c-indirect-probe-strategy” property on the “iic” instance.
Valid values are "smbus-quick-write”, "smbus-receive-byte”, and
“none”. If no value is specified, the default is "smbus-quick-write”.

— If the "i2c-indirect-device-whitelist” exists on the “iic” instance,
iic_search() will first check the driver name in the cfdata_t against
this list, and only allow the match/probe to move forward if the
cfdata_t driver name is in the list. This is primarily to accommodate
the Intel integrated memory controller neutered-i2c-thing.

— If the cfdata_t specifies a wildcard address, each address of the i2c
bus will be consulted. If the cfdata_t contains a nailed-down address,
then we limit the bus scan to that specific address.

— We explicitly skip reserved / special i2c addresses, such as the
General-Call address, etc.

— We introduce the notion of a “match quality” for i2c drivers. From
lowest-quality to highest-quality: matched by plausible address only,
matched by plausible address and poking at the bus to see if the
device looks reasonable, matched by direct-config “compatible” string,
matched by direct-config “driver name” string.

— If the “match quality” is merely “plausible address only”, then
iic_search() will use the probe strategy selected above to see if
a device responds to that address.
 1.12 07-Jun-2018  thorpej Back out unintended commits.
 1.11 07-Jun-2018  thorpej Adjust come defaults:
- Initial gain -> 16x
- auto_gain -> true
 1.10 10-Dec-2017  bouyer branches: 1.10.2;
For direct-config devices, pass the whole dictionary to the child as
ia_prop, so that chil drivers can look up device-specific properties.
Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.
 1.9 13-Dec-2015  jmcneill allow child devices to be passed in attach args instead of device dictionary
 1.8 28-Feb-2010  snj branches: 1.8.20; 1.8.28; 1.8.38;
Spelling police.
 1.7 28-Feb-2010  martin Generic (device property based) framework for optional direct configuration
of i2c devices, as discussed on tech-kern.
 1.6 09-Jul-2007  ad branches: 1.6.32; 1.6.54;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.5 05-Feb-2007  jmcneill branches: 1.5.6; 1.5.8;
Allow i2c child devices to register interrupt handlers to the smbus host
controller. Both interrupt context and process context type handlers are
supported.
 1.4 26-Jun-2006  drochner branches: 1.4.4;
remove the "name" element from the i2cbus attach args, that's what
interface attributes are good for
 1.3 27-Mar-2006  jmcneill branches: 1.3.4;
Implement a handful of missing smbus protocol functions. Proposed on
tech-kern: http://mail-index.netbsd.org/tech-kern/2006/03/16/0029.html
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8; 1.2.10; 1.2.12;
merge ktrace-lwp.
 1.1 30-Sep-2003  thorpej branches: 1.1.4; 1.1.18;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.18.4 03-Sep-2007  yamt sync with head.
 1.1.18.3 26-Feb-2007  yamt sync with head.
 1.1.18.2 30-Dec-2006  yamt sync with head.
 1.1.18.1 21-Jun-2006  yamt sync with head.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file i2cvar.h was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.2.12.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 19-Apr-2006  elad sync with head.
 1.2.8.2 11-Aug-2006  yamt sync with head
 1.2.8.1 01-Apr-2006  yamt sync with head.
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.3.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.4.4.1 09-Feb-2007  ad Sync with HEAD.
 1.5.8.1 11-Jul-2007  mjf Sync with head.
 1.5.6.1 09-Apr-2007  ad - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.
 1.6.54.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.6.32.1 11-Mar-2010  yamt sync with head
 1.8.38.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.8.28.1 10-May-2013  khorben Added two locators for I2C devices: "intr" and "intrbase".

They are required to allow the TPS65950 companion chip to both handle its
interrupts on the system, and allow its extra GPIO pins to be used as
interrupts as well.

XXX This change is not adequate because intr_establish() is a MD interface,
so it will have to be re-designed before merging to the main tree.
 1.8.20.1 03-Dec-2017  jdolecek update from HEAD
 1.10.2.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.10.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.10.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.17.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.17.2.1 10-Jun-2019  christos Sync with HEAD
 1.20.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.20.2.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.23.2.1 17-Apr-2021  thorpej Sync with HEAD.
 1.24.12.4 13-Sep-2021  thorpej Move the i2c enumeration helpers to their own header file to detangle
it from reliance on "iic" being configured into the kernel.
 1.24.12.3 11-Sep-2021  thorpej Re-factor the code in sandpoint and sparc64 that enumerates a static
table of i2c device entries into something sharable.
 1.24.12.2 10-Sep-2021  thorpej Remove unnecessary references to i2c_attach_args::ia_prop and mark the ones
that remain as XXX.
 1.24.12.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.24.2.5 17-May-2021  thorpej Remove "count" from the device enumeration callback arguments.
 1.24.2.4 14-May-2021  thorpej Move the bus/channel number for multi-channel / mux controllers out of
i2cbus_attach_args and stash it in the i2c_tag_t instead. This makes it
accessible to platform device tree code when enumerating devices.
 1.24.2.3 08-May-2021  thorpej There are no more consumers of i2c attach args "cookie" and "cookietype",
so garbage-collect them.
 1.24.2.2 08-May-2021  thorpej - Add an optional bus number to i2cbus_attach_args, and a corresponding
optional "bus" locator to the i2cbus interface attribute.
- Add a iicbus_print_multi() routine, which is like iicbus_print(),
but also prints the bus number.
- Use these new features in the iicmux driver rather than winging it.
 1.24.2.1 25-Apr-2021  thorpej Stop using a prop_array of child device data to perform direct
configuration of i2c devices. Instead, introduce and use a new
device call "i2c-enumerate-devices" that can be implemented by
devhandle providers that have I2C bindings. This device call
gathers up the data into i2c_attach_args and invoked a callback
(back to the i2c layer) to attach the device. The I2C controller
device supplies its devhandle (or the appropriate devhandle for
the I2C bus) when attaching the i2c bus instance using CFARG_DEVHANDLE.
 1.9 15-May-2020  maxv hardclock_ticks -> getticks()
 1.8 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.7 16-Jun-2018  thorpej branches: 1.7.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.6 06-Jun-2018  maya Remove duplicate ;
 1.5 09-May-2018  thorpej The probe this driver uses is potentially destructive; at the very
least, filter on the I2C address the device is expected at before we
unleash its fury.
 1.4 14-Jul-2016  msaitoh branches: 1.4.16;
Use aprint_error() instead of aprint_normal() on error.
 1.3 21-Jun-2011  hannken branches: 1.3.12; 1.3.30;
Make sure sensor state is valid before calling sysmon_envsys_sensor_attach().

Ok: Paul Goyette <pgoyette@netbsd.org>
 1.2 14-Feb-2011  hannken branches: 1.2.2; 1.2.4; 1.2.8;
ibmhawk_set: No need to set states ENVSYS_SWARNxxx, sysmon will do it.
 1.1 14-Feb-2011  hannken Initial implementation of ibmhawk(4) driver for sensors behind the IBM Hawk
on-board Integrated Systems Management Processor found on some eServers.

Tested on an IBM eServer x335.
 1.2.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.8.1 14-Feb-2011  jruoho file ibmhawk.c was added on branch jruoho-x86intr on 2011-06-06 09:07:49 +0000
 1.2.4.2 05-Mar-2011  rmind sync with head
 1.2.4.1 14-Feb-2011  rmind file ibmhawk.c was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.2.2.2 17-Feb-2011  bouyer Sync with HEAD
 1.2.2.1 14-Feb-2011  bouyer file ibmhawk.c was added on branch bouyer-quota2 on 2011-02-17 12:00:12 +0000
 1.3.30.1 05-Oct-2016  skrll Sync with HEAD
 1.3.12.1 03-Dec-2017  jdolecek update from HEAD
 1.4.16.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.4.16.2 25-Jun-2018  pgoyette Sync with HEAD
 1.4.16.1 21-May-2018  pgoyette Sync with HEAD
 1.7.2.1 10-Jun-2019  christos Sync with HEAD
 1.1 14-Feb-2011  hannken branches: 1.1.2; 1.1.4; 1.1.8;
Initial implementation of ibmhawk(4) driver for sensors behind the IBM Hawk
on-board Integrated Systems Management Processor found on some eServers.

Tested on an IBM eServer x335.
 1.1.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.8.1 14-Feb-2011  jruoho file ibmhawkreg.h was added on branch jruoho-x86intr on 2011-06-06 09:07:49 +0000
 1.1.4.2 05-Mar-2011  rmind sync with head
 1.1.4.1 14-Feb-2011  rmind file ibmhawkreg.h was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.1.2.2 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 14-Feb-2011  bouyer file ibmhawkreg.h was added on branch bouyer-quota2 on 2011-02-17 12:00:12 +0000
 1.1 14-Feb-2011  hannken branches: 1.1.2; 1.1.4; 1.1.8;
Initial implementation of ibmhawk(4) driver for sensors behind the IBM Hawk
on-board Integrated Systems Management Processor found on some eServers.

Tested on an IBM eServer x335.
 1.1.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.8.1 14-Feb-2011  jruoho file ibmhawkvar.h was added on branch jruoho-x86intr on 2011-06-06 09:07:49 +0000
 1.1.4.2 05-Mar-2011  rmind sync with head
 1.1.4.1 14-Feb-2011  rmind file ibmhawkvar.h was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.1.2.2 17-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 14-Feb-2011  bouyer file ibmhawkvar.h was added on branch bouyer-quota2 on 2011-02-17 12:00:12 +0000
 1.34 17-Sep-2025  thorpej This driver only works with ACPI. Rather than consult i2c_attach_args::
ia_cookietype, consult self's devhandle and check for DEVHANDLE_TYPE_ACPI.
Use the devhandle to get the ACPI handle where necessary, so it is no longer
necessary to store the ACPI handle in a softc field called "sc_phandle"
(which is not an accurate name).
 1.33 09-Dec-2024  jmcneill ihidev: Only reset the HID device once during attach.

From OpenBSD:
https://github.com/openbsd/src/commit/e773e7e3935196eea66382160eeee2d3f77d2e3f
 1.32 09-Dec-2024  jmcneill fixup! remove debug printf
 1.31 08-Dec-2024  jmcneill ihidev: Add support for GPIO interrupts.
 1.30 29-Apr-2024  andvar branches: 1.30.2;
ihidev(4): make driver compile with ACPI option disabled.

This change unlikely useful in practice, but adds consistency to already
available guards. Driver won't attach currently without ACPI.
 1.29 01-Aug-2023  riastradh ihidev(4): Use iic_use_direct_match as intended.

This appears to have been a mistake; there's no obvious explanation
in the commit history for why this is different from all other
iic_use_direct_match users.

Patch from Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>, thanks!

(If it really is intended to ues I2C_MATCH_DIRECT_COMPATIBLE here, we
need a clear explanation of why, written down in a nearby comment.)
 1.28 12-Feb-2022  riastradh sys: Fix various abuse of struct device internals.

Will help to make struct device opaque later.
 1.27 15-Jan-2022  skrll Trailing whitespace
 1.26 14-Jan-2022  riastradh ihidev(4): Prohibit closing an unopened ihidev.
 1.25 14-Jan-2022  riastradh ihidev(4): Avoid reference count overflow.
 1.24 14-Jan-2022  riastradh ihidev(4): Take the lock for ihidev_open, ihidev_close.

Need this to serialize access to sc_state, sc_refcnt.

XXX Should harmonize this with uhidev(4) and tighten assertions.
 1.23 14-Jan-2022  riastradh ihidev(4): Check kmem_alloc(..., KM_NOSLEEP) for failure.
 1.22 14-Jan-2022  riastradh ihidev(4): Allocate report buffer with KM_SLEEP.

Limited to 64k and only happens on attach anyway. Let's not leave a
rake to trip on here.
 1.21 14-Jan-2022  riastradh ihidev(4): Fix locking and interrupt handler.

- Can't run iic_exec in softint because it does cv_wait, at least on
some i2c controllers -- defer to workqueue instead.

- Fix violations of locking rules:
. Do not take a lock at higher IPL than it is defined at!
. Do not sleep under a lock!
. Definitely do not sleep under a spin lock!
In this case, sc_intr_lock was defined at IPL_VM but used at IPL_TTY,
and i2c transactions -- possibly causing sleep for cv_wait -- were
issued under it.

But in this case, the interrupt handler needs only a single bit to
mark whether the work is pending, so just use atomic_swap for that.

- Use an adaptive lock (IPL_NONE) for i2c transactions.

- Detach children, and do so before freeing anything.
 1.20 07-Aug-2021  thorpej branches: 1.20.2;
Merge thorpej-cfargs2.
 1.19 24-Apr-2021  thorpej branches: 1.19.2; 1.19.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.18 27-Jan-2021  thorpej branches: 1.18.2;
Use DEVICE_COMPAT_EOL.
 1.17 26-Jan-2021  thorpej Now that the ACPI layer no longer does this for us, evaluate the _DSM
that returns the HID descriptor address at attach time.
 1.16 26-Jan-2021  thorpej Don't map ACPI _HID / _CID strings to "compatible" strings from the
Device Tree bindings. Just pass those strings in the standard
most-specific-to-least-specific order to the drivers and let them
deal.
 1.15 26-Jan-2021  thorpej Back out unintended change in previous.
 1.14 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.13 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.12 09-Jan-2020  thorpej branches: 1.12.6;
Re-enable the intr / mask / softint / unmask dance now that the x86
interrupt issue is fixed. Verified working by ryoon@ (thanks!).
 1.11 25-Dec-2019  thorpej branches: 1.11.2;
Revert previous until issues can be sorted out.
 1.10 22-Dec-2019  thorpej The hid-over-i2c spec specifies that compliant devices use level-sensitive
interrupts. However, it's not safe to do i2c bus access in hard interrupt
context, and we must read the event data off the device in order to clear
the interrupt condition.

Address this by using acpi_intr_mask() to mask off the interrupt source
while a softint is pending to service the events, re-enabling it once
servicing is completed.

While here, re-factor the interrupt setup / tear-down code a bit to
eventually once day simplify supporting the FDT bindings for hid-over-i2c.
 1.9 01-Oct-2019  chs in many device attach paths, allocate memory with KM_SLEEP instead of KM_NOSLEEP
and remove code to handle failures that can no longer happen.
 1.8 26-Sep-2019  bouyer Abort attach if acpi_intr_establish() fails. From K. Schreiner on
current-users@.
 1.7 16-Nov-2018  jmcneill branches: 1.7.4;
Use acpi_md_intr_establish/disestablish to handle device IRQs. The existing
code abused AcpiOsInstallInterruptHandler, which is meant for installing
the SCI handler.
 1.6 15-Nov-2018  jakllsch Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.
 1.5 26-Jun-2018  thorpej branches: 1.5.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.4 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.3 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.2 20-Mar-2018  bouyer Allow registering ACPI interrupt handlers with a xname.
AcpiOsInstallInterruptHandler(), part of ACPICA API, doesn't allow passing
the xname. I extend the API with AcpiOsInstallInterruptHandler_xname()
for this purpose, and change acpi_md_OsInstallInterruptHandler() to
accept and use the xname (ia64 doens't use it).
The xname was hardcoded to "acpi SCI" in the
x86 acpi_md_OsInstallInterruptHandler(), so I make
AcpiOsInstallInterruptHandler() call
AcpiOsInstallInterruptHandler_xname with xname = "acpi SCI".

Now 'vmstat -i' shows the device's name instead of "acpi SCI" for for i2c HID
interrupts.

Proposed on tech-kern@ on Dec 29.
 1.1 10-Dec-2017  bouyer branches: 1.1.2;
Add drivers for HID over I2C devices, and a driver for I2C mices.
From OpenBSD.
 1.1.2.4 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.1.2.3 28-Jul-2018  pgoyette Sync with HEAD
 1.1.2.2 25-Jun-2018  pgoyette Sync with HEAD
 1.1.2.1 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.5.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.2.1 10-Jun-2019  christos Sync with HEAD
 1.7.4.1 26-Sep-2019  martin Pull up following revision(s) (requested by bouyer in ticket #244):

sys/dev/i2c/ihidev.c: revision 1.8

Abort attach if acpi_intr_establish() fails. From K. Schreiner on
current-users@.
 1.11.2.1 17-Jan-2020  ad Sync with head.
 1.12.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.18.2.2 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.18.2.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.19.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.19.2.1 08-May-2021  thorpej Rather than using the "cookie" from the i2c_attach_args, use the
device handle that's already associated with our device_t.
 1.20.2.2 09-Aug-2021  thorpej Use the same idiom to cast the ACPI_HANDLE to uint64_t as other drivers
when passing it to acpi_intr_establish().

XXX This is gross, but fixing it is outside the scope of this branch.
 1.20.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.30.2.1 02-Aug-2025  perseant Sync with HEAD
 1.8 17-Sep-2025  thorpej This driver only works with ACPI. Rather than consult i2c_attach_args::
ia_cookietype, consult self's devhandle and check for DEVHANDLE_TYPE_ACPI.
Use the devhandle to get the ACPI handle where necessary, so it is no longer
necessary to store the ACPI handle in a softc field called "sc_phandle"
(which is not an accurate name).
 1.7 08-Dec-2024  jmcneill ihidev: Add support for GPIO interrupts.
 1.6 14-Jan-2022  riastradh branches: 1.6.10;
ihidev(4): Fix locking and interrupt handler.

- Can't run iic_exec in softint because it does cv_wait, at least on
some i2c controllers -- defer to workqueue instead.

- Fix violations of locking rules:
. Do not take a lock at higher IPL than it is defined at!
. Do not sleep under a lock!
. Definitely do not sleep under a spin lock!
In this case, sc_intr_lock was defined at IPL_VM but used at IPL_TTY,
and i2c transactions -- possibly causing sleep for cv_wait -- were
issued under it.

But in this case, the interrupt handler needs only a single bit to
mark whether the work is pending, so just use atomic_swap for that.

- Use an adaptive lock (IPL_NONE) for i2c transactions.

- Detach children, and do so before freeing anything.
 1.5 14-Jan-2022  riastradh ihidev(4): Add missing includes and header guard.

Mark the sections that are conventionally separate files for hardware
interface (*reg.h) versus software state (*var.h).
 1.4 09-Jan-2020  thorpej branches: 1.4.10; 1.4.20;
Re-enable the intr / mask / softint / unmask dance now that the x86
interrupt issue is fixed. Verified working by ryoon@ (thanks!).
 1.3 25-Dec-2019  thorpej branches: 1.3.2;
Revert previous until issues can be sorted out.
 1.2 22-Dec-2019  thorpej The hid-over-i2c spec specifies that compliant devices use level-sensitive
interrupts. However, it's not safe to do i2c bus access in hard interrupt
context, and we must read the event data off the device in order to clear
the interrupt condition.

Address this by using acpi_intr_mask() to mask off the interrupt source
while a softint is pending to service the events, re-enabling it once
servicing is completed.

While here, re-factor the interrupt setup / tear-down code a bit to
eventually once day simplify supporting the FDT bindings for hid-over-i2c.
 1.1 10-Dec-2017  bouyer branches: 1.1.4;
Add drivers for HID over I2C devices, and a driver for I2C mices.
From OpenBSD.
 1.1.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.2.1 17-Jan-2020  ad Sync with head.
 1.4.20.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.4.10.1 08-May-2021  thorpej Rather than using the "cookie" from the i2c_attach_args, use the
device handle that's already associated with our device_t.
 1.6.10.1 02-Aug-2025  perseant Sync with HEAD
 1.1 09-Dec-2024  jmcneill branches: 1.1.4;
Import ikbd(4) from OpenBSD.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 09-Dec-2024  perseant file ikbd.c was added on branch perseant-exfatfs on 2025-08-02 05:56:39 +0000
 1.5 10-May-2023  riastradh ims(4): Use config_detach_children.
 1.4 14-Jan-2022  riastradh ims(4): Sprinkle KERNEL_LOCKED_P assertions.

Access to the softc and hidms state is currently kernel-locked.
 1.3 09-Jul-2019  ryoon Enable finger touch panel of HP Spectre x360 13-inch ae019TU
 1.2 09-Jul-2019  ryoon Add tpcalib, touch panel calibration to ims(4)

Suggested by ryo@ at Japan NetBSD Users' Group BOF 2019-07-06.
 1.1 10-Dec-2017  bouyer branches: 1.1.4;
Add drivers for HID over I2C devices, and a driver for I2C mices.
From OpenBSD.
 1.1.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.10 01-Jun-2017  chs remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.9 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.8 02-Oct-2011  jmcneill branches: 1.8.12; 1.8.28; 1.8.30;
now that iic is a module, add "iic" dependency to iic drivers
 1.7 09-Aug-2011  jmcneill lg3303 should depend on dtv_math, not xc3028
 1.6 09-Aug-2011  jmcneill add dtv_math.h
 1.5 15-Jul-2011  jmcneill add lg3303_get_snr, lg3303_get_signal_strength, lg3303_get_ucblocks
 1.4 15-Jul-2011  jmcneill lg3303_set_modulation: program the requested modulation on every request
 1.3 15-Jul-2011  jmcneill if no carrier, other status fields are invalid
 1.2 14-Jul-2011  jmcneill add a flags argument to lg3303, and use it for the caller to request
serial mpeg mode
 1.1 11-Jul-2011  jmcneill add LGDT3303 tuner and XC3028L demod drivers
 1.8.30.2 28-Aug-2017  skrll Sync with HEAD
 1.8.30.1 06-Apr-2015  skrll Sync with HEAD
 1.8.28.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.8.12.1 03-Dec-2017  jdolecek update from HEAD
 1.3 15-Jul-2011  jmcneill add lg3303_get_snr, lg3303_get_signal_strength, lg3303_get_ucblocks
 1.2 14-Jul-2011  jmcneill add a flags argument to lg3303, and use it for the caller to request
serial mpeg mode
 1.1 11-Jul-2011  jmcneill add LGDT3303 tuner and XC3028L demod drivers
 1.50 03-Oct-2025  thorpej Use device_{get,set}prop_string() for sensor names.
 1.49 21-Sep-2025  thorpej Get the sensor descriptive information from our device properties
dictionary, rather than from a secondary dictionary passed in the
i2c_attach_args (this secondary dictionary is deprecated and going
away).
 1.48 25-Aug-2025  macallan DS75 has extra resolution bits, let's use them
 1.47 02-Jan-2025  skrll KNF (whitespace)
 1.46 02-Jan-2025  skrll Trailing whitespace.
 1.45 21-Jun-2021  christos branches: 1.45.6; 1.45.16;
fix proplib deprecation
 1.44 13-Jun-2021  mlelstv iic_acquire_bus can fail.
 1.43 21-May-2021  macallan don't prop_object_retain(NULL)
 1.42 01-Mar-2021  rin branches: 1.42.4; 1.42.6;
Use lmtemp(4) as entropy source.
 1.41 06-Feb-2021  thorpej - Add some additional compat strings from the DT bindings.
- Use device_compatible_entry::value to hold the device type, and generally
tidy up device type selection.
 1.40 30-Jan-2021  thorpej If we're going to keep a reference on the "props" dictionary from
the i2c_attach_args, we should retain it.
 1.39 27-Jan-2021  thorpej Use DEVICE_COMPAT_EOL.
 1.38 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.37 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.36 21-Aug-2020  macallan branches: 1.36.2;
get sensor name from properties, remove macppc-specific OF support
 1.35 23-Dec-2019  thorpej No need to use I2C_F_POLL here.
 1.34 20-Feb-2019  macallan moar match string
 1.33 26-Jun-2018  thorpej branches: 1.33.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.32 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.31 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.30 01-Oct-2017  macallan branches: 1.30.2;
attach to ds1775 which was already more or less supported as DS75
also, get sensor name/location from OpenFirmware if we know how
 1.29 11-Jan-2016  jdc Don't use I2C_F_POLL when getting/setting limits.
Save/restore the correct values for LM77.
 1.28 03-Jan-2016  jdc Add display and setting of chip temperature limit(s) for envsys(4).
 1.27 01-Jan-2016  jdc Read the Tos limit from the chip, instead of assuming 80'C, in case
firmware has altered it. Make the *decode functions return temperatures
in either uK or C for envsys and sysctl, respectively.
 1.26 27-Sep-2015  phx Direct config: Only match via the list of compatible hardware when we have
such a list available (ia_ncompat > 0). Otherwise fall back to matching
the device name with ia_name.
 1.25 27-Oct-2012  chs branches: 1.25.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.24 02-Jun-2012  dsl branches: 1.24.2;
Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.23 09-Nov-2011  macallan Support setting the temperature threshold for the LM75's alarm/interrupt
output. Some hardware ( I'm looking at you, Gdium ) abuses it to control
a fan.
 1.22 20-Jun-2011  pgoyette branches: 1.22.2;
Initialize sensor state before registering.

XXX Still need to fix i2c/ibmhawk.c
 1.21 28-Feb-2010  martin branches: 1.21.8;
Add direct config support for a few devices
 1.20 09-Jan-2009  briggs branches: 1.20.4;
According to the datasheet, temperatures on the LM75 are kept in
0.5 degC-precision the most-significant 9 bits of a 16-bit register.
Interpret them as such and simplify the conversion.
 1.19 06-Apr-2008  cegger branches: 1.19.4; 1.19.12;
use aprint_*_dev and device_xname
 1.18 04-Apr-2008  xtraeme Split device_t/softc and other related cosmetic changes.
 1.17 11-Dec-2007  lukem branches: 1.17.8;
use __KERNEL_RCSID()
 1.16 16-Nov-2007  xtraeme branches: 1.16.2; 1.16.4; 1.16.6;
Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.15 02-Sep-2007  xtraeme branches: 1.15.4; 1.15.6;
typo: ENVSYS_FVALID -> ENVSYS_SVALID.
 1.14 13-Jul-2007  xtraeme branches: 1.14.2; 1.14.6; 1.14.8;
Forgot to set the description in the sensor.
 1.13 04-Jul-2007  xtraeme There's no need to set the "envsys-description" property in the
driver's dictionary anymore, because with envsys2 you can change
descriptions.
 1.12 01-Jul-2007  xtraeme Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.11 10-Jul-2006  thorpej branches: 1.11.14; 1.11.16;
Put appropriate prefixes on property names to reduce chances of name
collisions.
 1.10 12-Jun-2006  kiyohara branches: 1.10.2;
It necessary to mask to validate bits.
 1.9 17-May-2006  kiyohara branches: 1.9.2;
Support LM77 Temperature.
 1.8 05-May-2006  thorpej Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
 1.7 04-Apr-2006  riz Correct a couple of typos in comments ("Hook info" -> "Hook into",
"prescision"->"precision")
 1.6 29-Mar-2006  thorpej Use device_private().
 1.5 29-Mar-2006  thorpej Use device_cfdata().
 1.4 18-Feb-2006  thorpej branches: 1.4.2; 1.4.4; 1.4.6;
- Don't expose dev_propdb directly -- provide devprop_*() wrappers instead.
- Rework the ARMADILLO / epe device properties interaction so that it actually
associates the MAC address property with the epe device instance.
 1.3 11-Dec-2005  christos branches: 1.3.2; 1.3.4; 1.3.6;
merge ktrace-lwp.
 1.2 03-Aug-2004  scw branches: 1.2.12;
Support the DS75; a variant of the LM75 but with a slightly different
data format.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.4 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.3 12-Aug-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file lm75.c was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.2.12.5 21-Jan-2008  yamt sync with head
 1.2.12.4 07-Dec-2007  yamt sync with head
 1.2.12.3 03-Sep-2007  yamt sync with head.
 1.2.12.2 30-Dec-2006  yamt sync with head.
 1.2.12.1 21-Jun-2006  yamt sync with head.
 1.3.6.2 01-Jun-2006  kardel Sync with head.
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3.2.1 18-Feb-2006  yamt sync with head.
 1.4.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.4.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.4.4.2 11-May-2006  elad sync with head
 1.4.4.1 19-Apr-2006  elad sync with head.
 1.4.2.5 11-Aug-2006  yamt sync with head
 1.4.2.4 26-Jun-2006  yamt sync with head.
 1.4.2.3 24-May-2006  yamt sync with head.
 1.4.2.2 11-Apr-2006  yamt sync with head
 1.4.2.1 01-Apr-2006  yamt sync with head.
 1.9.2.1 19-Jun-2006  chap Sync with head.
 1.10.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.11.16.1 11-Jul-2007  mjf Sync with head.
 1.11.14.2 09-Oct-2007  ad Sync with head.
 1.11.14.1 15-Jul-2007  ad Sync with head.
 1.14.8.2 09-Jan-2008  matt sync with HEAD
 1.14.8.1 06-Nov-2007  matt sync with HEAD
 1.14.6.2 21-Nov-2007  joerg Sync with HEAD.
 1.14.6.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.14.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.15.6.2 27-Dec-2007  mjf Sync with HEAD.
 1.15.6.1 19-Nov-2007  mjf Sync with HEAD.
 1.15.4.1 18-Nov-2007  bouyer Sync with HEAD
 1.16.6.1 13-Dec-2007  bouyer Sync with HEAD
 1.16.4.1 11-Dec-2007  yamt sync with head.
 1.16.2.1 26-Dec-2007  ad Sync with head.
 1.17.8.2 17-Jan-2009  mjf Sync with HEAD.
 1.17.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.4.2 11-Mar-2010  yamt sync with head
 1.19.4.1 04-May-2009  yamt sync with head.
 1.20.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.21.8.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.22.2.2 30-Oct-2012  yamt sync with head
 1.22.2.1 10-Nov-2011  yamt sync with head
 1.24.2.2 03-Dec-2017  jdolecek update from HEAD
 1.24.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.25.14.2 19-Mar-2016  skrll Sync with HEAD
 1.25.14.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.30.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.30.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.33.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.33.2.1 10-Jun-2019  christos Sync with HEAD
 1.36.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.42.6.1 31-May-2021  cjep sync with head
 1.42.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.42.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.45.16.1 02-Aug-2025  perseant Sync with HEAD
 1.45.6.1 10-Sep-2021  thorpej Remove unnecessary references to i2c_attach_args::ia_prop and mark the ones
that remain as XXX.
 1.6 25-Aug-2025  macallan DS75 has extra resolution bits, let's use them
 1.5 03-Jan-2016  jdc Add LM75A ID register (for completeness).
 1.4 07-Aug-2013  soren branches: 1.4.6;
Allow i2c addr wildcard matching. Use with care!
 1.3 17-May-2006  kiyohara branches: 1.3.98; 1.3.108; 1.3.114;
Support LM77 Temperature.
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8; 1.2.12;
merge ktrace-lwp.
 1.1 30-Sep-2003  thorpej branches: 1.1.4; 1.1.18;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.18.1 21-Jun-2006  yamt sync with head.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file lm75reg.h was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.2.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.8.1 24-May-2006  yamt sync with head.
 1.2.6.1 01-Jun-2006  kardel Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.3.114.1 28-Aug-2013  rmind sync with head
 1.3.108.2 03-Dec-2017  jdolecek update from HEAD
 1.3.108.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.98.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.6.1 19-Mar-2016  skrll Sync with HEAD
 1.16 02-Jul-2022  andvar s/tempurature/temperature/
 1.15 13-Jun-2021  mlelstv iic_acquire_bus can fail.
 1.14 27-Jan-2021  thorpej branches: 1.14.4;
Use DEVICE_COMPAT_EOL.
 1.13 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.12 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.11 23-Dec-2019  thorpej branches: 1.11.8;
No need to use I2C_F_POLL here.
 1.10 26-Jun-2018  thorpej branches: 1.10.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.9 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.8 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.7 10-Jan-2016  jdc branches: 1.7.16;
Correct previous - external temperature 2 is read from the 2.5V register,
not the Vccp2 register.
 1.6 10-Jan-2016  jdc Add missing register definitions.
Handle LM87 external temperature 2 input, and Vcc input scaling (5V or 3.3V).
 1.5 27-Sep-2015  phx Direct config: Only match via the list of compatible hardware when we have
such a list available (ia_ncompat > 0). Otherwise fall back to matching
the device name with ia_name.
 1.4 04-Nov-2013  jdc branches: 1.4.4; 1.4.6; 1.4.10; 1.4.12;
Add missing braces.
Fix logic error - check the data read from the chip against 0xff.
 1.3 26-Oct-2013  jdc A fan reading of 0xff is also invalid (observed on AlphaServer DS20L).
 1.2 18-Oct-2013  jdc Remove extraneous printf().
 1.1 15-Oct-2013  jdc Add a driver for the LM81, LM87, and compatible iic hardware monitors
(lmenv). Ported from OpenBSD's lm87.c, revision 1.20.
 1.4.12.2 19-Mar-2016  skrll Sync with HEAD
 1.4.12.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.4.10.3 03-Dec-2017  jdolecek update from HEAD
 1.4.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.10.1 04-Nov-2013  tls file lm87.c was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.4.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.6.1 04-Nov-2013  yamt file lm87.c was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.4.4.2 18-May-2014  rmind sync with head
 1.4.4.1 04-Nov-2013  rmind file lm87.c was added on branch rmind-smpnet on 2014-05-18 17:45:37 +0000
 1.7.16.2 28-Jul-2018  pgoyette Sync with HEAD
 1.7.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.10.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.11.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.14.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.7 13-Jun-2021  mlelstv iic_acquire_bus can fail
 1.6 24-Jun-2020  jdolecek branches: 1.6.6;
avoid stack usage in match routine
 1.5 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.4 18-Aug-2017  msaitoh branches: 1.4.2;
- WBSIO_ID_W83627DHG and newer devices have 12bit device ID. So, change sioid
from 8bit to 16bit and check with it strictly.
- s/lm_match/nslm_match/
- split {wb,lm,def}_match() to XXX_match and XXX_attach().
- Rename lm_probe with lm_match and call {wb,nslm,def}_match() at the end of
the function to check strictly.
- NCT610[246]D is different from otehrs, so add new nct6102d_sensors[] table.
- Register offsets of vendor ID and chip id of NCT610[246]D are different
from others. When it failed reading vendor ID or chip ID, fallback to
NCT610[246]D's register offsets.
- Add debug messages.
 1.3 17-Aug-2017  msaitoh Use uint8_t instead of int. No functional change.
 1.2 13-Oct-2008  pgoyette branches: 1.2.2; 1.2.10; 1.2.16; 1.2.44; 1.2.64; 1.2.80;
Remove duplicated copy of the file - no idea where it came from.
 1.1 12-Oct-2008  pgoyette Add an i2c attachment for the LM78 family of temp sensor/fan control

Tested by Martin Husemann
 1.2.80.1 22-Nov-2017  martin Pull up following revision(s) (requested by msaitoh in ticket #374):
share/man/man4/lm.4: revision 1.33
share/man/man4/lm.4: revision 1.34
sys/dev/ic/nslm7x.c: revision 1.70
sys/dev/isa/lm_isa_common.c: revision 1.5
sys/dev/isa/lm_isa_common.c: revision 1.6
sys/dev/isa/wbsio.c: revision 1.11
sys/dev/i2c/lm_i2c.c: revision 1.3
sys/dev/isa/wbsio.c: revision 1.12
sys/dev/i2c/lm_i2c.c: revision 1.4
sys/dev/isa/wbsioreg.h: revision 1.1
sys/dev/isa/wbsio.c: revision 1.13
sys/dev/isa/wbsioreg.h: revision 1.2
sys/dev/isa/wbsio.c: revision 1.14
sys/dev/isa/wbsioreg.h: revision 1.3
sys/dev/isa/wbsio.c: revision 1.15
sys/dev/isa/wbsioreg.h: revision 1.4
sys/dev/isa/wbsioreg.h: revision 1.5
share/man/man4/wbsio.4: revision 1.4
share/man/man4/wbsio.4: revision 1.5
sys/dev/ic/nslm7xvar.h: revision 1.30
sys/dev/ic/nslm7x.c: revision 1.65
share/man/man4/wbsio.4: revision 1.6
sys/dev/ic/nslm7xvar.h: revision 1.31
sys/dev/ic/nslm7x.c: revision 1.66
sys/dev/ic/nslm7xvar.h: revision 1.32
sys/dev/ic/nslm7x.c: revision 1.67
sys/dev/ic/nslm7xvar.h: revision 1.33
sys/dev/ic/nslm7x.c: revision 1.68
sys/dev/ic/nslm7x.c: revision 1.69
Add Winbond W83627DHG-P, W83627SF, W83627UHG, W83667HGB, W83687THF, W83697UG,
Nuvoton NCT5104D, NCT610[246]D, NCT6775, NCT6779, NCT6791, NCT6792 and NCT6793.
lm(4): Add support for NCT5104D, NCT610[246]D, NCT6775F, NCT6779D and NCT679[1235]D.
wbsio(4): Add support for NCT6795D.
Add note about Nuvoton.
- Add new Nuvoton devices.
- Add CAVEATS section from OpenBSD.
Add space before left-paren
Remove superfluous Pp.
Whitespace.
Fix a bug that fan RPM wasn't printed correctly. 0xbX is not RPM but counter.
Use 0xcX.
Fix typo.
- Sprinkle static and const. No functional change.
- Print chip ID in hexadecimal instead of octal in def_match().
Use uint8_t instead of int. No functional change.
Print chip name correctly.
- WBSIO_ID_W83627DHG and newer devices have 12bit device ID. So, change sioid
from 8bit to 16bit and check with it strictly.
- s/lm_match/nslm_match/
- split {wb,lm,def}_match() to XXX_match and XXX_attach().
- Rename lm_probe with lm_match and call {wb,nslm,def}_match() at the end of
the function to check strictly.
- NCT610[246]D is different from others, so add new nct6102d_sensors[] table.
- Register offsets of vendor ID and chip id of NCT610[246]D are different
from others. When it failed reading vendor ID or chip ID, fallback to
NCT610[246]D's register offsets.
- Add debug messages.
Restore NetBSD RCS Id which was accidentally removed in rev. 1.2.
s/Id/NetBSD/. Pointed out by wiz!
 1.2.64.1 28-Aug-2017  skrll Sync with HEAD
 1.2.44.1 03-Dec-2017  jdolecek update from HEAD
 1.2.16.2 04-May-2009  yamt sync with head.
 1.2.16.1 13-Oct-2008  yamt file lm_i2c.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:39 +0000
 1.2.10.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.10.1 13-Oct-2008  mjf file lm_i2c.c was added on branch mjf-devfs2 on 2009-01-17 13:28:54 +0000
 1.2.2.2 19-Oct-2008  haad Sync with HEAD.
 1.2.2.1 13-Oct-2008  haad file lm_i2c.c was added on branch haad-dm on 2008-10-19 22:16:25 +0000
 1.4.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.6.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.1 16-May-2013  khorben branches: 1.1.2;
file lp5523.c was initially added on branch khorben-n900.
 1.1.2.2 16-May-2013  khorben Added a refresh callback for the temperature sensor.
 1.1.2.1 16-May-2013  khorben Initial import of the lp5523led(4) driver, a programmable 9-output LED
driver from Texas Instruments. This is not functional yet, but exposes
sysctl nodes and the internal temperature sensor (not refreshed at the
moment).

Tested on my Nokia N900 smartphone.
 1.1 16-May-2013  khorben branches: 1.1.2;
file lp5523reg.h was initially added on branch khorben-n900.
 1.1.2.1 16-May-2013  khorben Initial import of the lp5523led(4) driver, a programmable 9-output LED
driver from Texas Instruments. This is not functional yet, but exposes
sysctl nodes and the internal temperature sensor (not refreshed at the
moment).

Tested on my Nokia N900 smartphone.
 1.34 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.33 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.32 21-May-2021  macallan add \n to attach output
 1.31 27-Jan-2021  thorpej branches: 1.31.4; 1.31.6;
Use DEVICE_COMPAT_EOL.
 1.30 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.29 18-Jan-2021  thorpej Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup(). This pattern is less awkward to use.
 1.28 17-Jan-2021  thorpej Change the device_compatible_entry struct to have a union of
a scalar value (uintptr_t value) and a pointer value (const void *data),
rather than just "uintptr_t data". This eliminates the need for drivers
to cast this value, and doesn't lose const'ness of pointers assigned
to the field.

Update all of the users of this field to use the correct set of
designated initialisers for each specific case.
 1.27 03-Jan-2020  thorpej branches: 1.27.8;
Eliminate all of the #ifdefs for the "strtc" driver. Define model
properties (similar to what the "dsrtc" driver does), and provide
DT compat strings corresponding to those models. Allow config flags
to specify the model for non-FDT platforms (also like "dsrtc").
 1.26 02-Jan-2020  thorpej - Use todr_gettime_ymdhms / todr_settime_ymdhms.
- Correctly propagate errors up the stack.
 1.25 02-Jan-2020  thorpej No need to use I2C_F_POLL here.
 1.24 16-Jun-2018  thorpej branches: 1.24.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.23 28-Oct-2017  riastradh branches: 1.23.2;
Kill some more extern struct cfdriver declarations.

Down with externs in .c!
 1.22 20-Nov-2014  christos use the inline bcdtobin and bintobcd directly instead through a macro.
 1.21 25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.20 16-Mar-2014  dholland branches: 1.20.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.19 08-Nov-2013  nisimura fix an array bound error which was spotted by gcc 4.8
 1.18 28-May-2011  phx branches: 1.18.4; 1.18.14; 1.18.18;
Add direct config support for all devices used by sandpoint.
 1.17 17-Apr-2011  phx Do not print "M41ST84 Real-time Clock/NVRAM", but "M41T8x Real-time Clock"
when STRTC_NO_USERRAM is defined. This driver should work for all M41T8x
compatible chips (tested on my DSM-G600 with M41T80).
 1.16 10-Oct-2010  kiyohara branches: 1.16.2;
Add options STRTC_NO_USERRAM and STRTC_NO_WATCHDOG for m41t80.
 1.15 12-Dec-2009  tsutsui branches: 1.15.2; 1.15.4;
Remove `volatile' qualifier from argument types of
struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.

XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
 1.14 09-Jan-2009  briggs Provide a utility routine to configure/write the watchdog.
XXX This watchdog should eventually be integrated into the generic
watchdog framework.
 1.13 08-Jun-2008  tsutsui branches: 1.13.6;
Replace device_lookup() with device_lookup_private() to get softc
after device_t/softc split. PR kern/38885 from Jonathan A. Kollasch.
 1.12 04-May-2008  xtraeme branches: 1.12.2;
device_t/softc split and other related cosmetic changes.
 1.11 06-Apr-2008  cegger branches: 1.11.2; 1.11.4;
use aprint_*_dev and device_xname
 1.10 11-Dec-2007  lukem branches: 1.10.8;
use __KERNEL_RCSID()
 1.9 12-Jan-2007  cube branches: 1.9.20; 1.9.28; 1.9.30; 1.9.32;
Add missing initializers in cdevsw structs.
 1.8 04-Sep-2006  gdamore branches: 1.8.2;
Remove unused todr_setcal/todr_getcal and all the assorted stub
implementations.
 1.7 29-Mar-2006  thorpej Use device_private().
 1.6 13-Dec-2005  abs branches: 1.6.4; 1.6.6; 1.6.8; 1.6.10; 1.6.12;
Update some missed _close() and _open() functions from 'struct proc *p'
to 'struct lwp *l'.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 04-Jun-2005  he branches: 1.4.2;
Fix the various todr_gettime() and todr_settime() fallouts from
-Wcast-qual differently, by instead changing the signatore of those
"functions" to take a "volatile struct timeval*" instead of a
"struct timeval*". Many places, these functions are called with
&time, and time is declared as volatile in <sys/kernel.h>. This
way we can get rid of all the ugly casts which now also triggered
warnings, and caused more code to be added to work around the
problem.

Reviewed by thorpej.
 1.3 24-Nov-2004  scw Check and clear the HT bit in strtc_clock_read(), not just strtc_clock_write()
otherwise we end up reading the date/time of the previous powerfail event.
 1.2 20-Jan-2004  briggs branches: 1.2.4;
Handle the Halt Update Bit (HT), stored in the Alarm Hour register.
This bit will be set if the clock lost power (and may therefore
not have the correct time). If this bit is set, the stored time
does not advance. So, when setting the clock, if that bit is set,
we simply clear it. It might be nice in some applications to pass
the information up a few layers if the bit is set when we read the
register initially. For now, though, we ignore it.
 1.1 30-Sep-2003  thorpej New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.2.4.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.4.5 29-Nov-2004  skrll Sync with HEAD.
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 20-Jan-2004  skrll file m41st84.c was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.4.2.4 21-Jan-2008  yamt sync with head
 1.4.2.3 26-Feb-2007  yamt sync with head.
 1.4.2.2 30-Dec-2006  yamt sync with head.
 1.4.2.1 21-Jun-2006  yamt sync with head.
 1.6.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.6.10.1 19-Apr-2006  elad sync with head.
 1.6.8.2 14-Sep-2006  yamt sync with head.
 1.6.8.1 01-Apr-2006  yamt sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.8.2.1 01-Feb-2007  ad Sync with head.
 1.9.32.1 13-Dec-2007  bouyer Sync with HEAD
 1.9.30.1 11-Dec-2007  yamt sync with head.
 1.9.28.1 26-Dec-2007  ad Sync with head.
 1.9.20.1 09-Jan-2008  matt sync with HEAD
 1.10.8.3 17-Jan-2009  mjf Sync with HEAD.
 1.10.8.2 29-Jun-2008  mjf Sync with HEAD.
 1.10.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.4.3 11-Mar-2010  yamt sync with head
 1.11.4.2 04-May-2009  yamt sync with head.
 1.11.4.1 16-May-2008  yamt sync with head.
 1.11.2.2 17-Jun-2008  yamt sync with head.
 1.11.2.1 18-May-2008  yamt sync with head.
 1.12.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.13.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.15.4.3 31-May-2011  rmind sync with head
 1.15.4.2 21-Apr-2011  rmind sync with head
 1.15.4.1 05-Mar-2011  rmind sync with head
 1.15.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.16.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.18.18.1 18-May-2014  rmind sync with head
 1.18.14.2 03-Dec-2017  jdolecek update from HEAD
 1.18.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.20.2.1 10-Aug-2014  tls Rebase.
 1.23.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.24.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.27.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.31.6.1 31-May-2021  cjep sync with head
 1.31.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.4 23-Jan-2023  andvar fix typos in comments.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 20-Jan-2004  briggs branches: 1.2.4;
Handle the Halt Update Bit (HT), stored in the Alarm Hour register.
This bit will be set if the clock lost power (and may therefore
not have the correct time). If this bit is set, the stored time
does not advance. So, when setting the clock, if that bit is set,
we simply clear it. It might be nice in some applications to pass
the information up a few layers if the bit is set when we read the
register initially. For now, though, we ignore it.
 1.1 30-Sep-2003  thorpej New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 20-Jan-2004  skrll file m41st84reg.h was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.1 09-Jan-2009  briggs branches: 1.1.2; 1.1.4; 1.1.8;
Provide a utility routine to configure/write the watchdog.
XXX This watchdog should eventually be integrated into the generic
watchdog framework.
 1.1.8.2 04-May-2009  yamt sync with head.
 1.1.8.1 09-Jan-2009  yamt file m41st84var.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:39 +0000
 1.1.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.4.1 09-Jan-2009  skrll file m41st84var.h was added on branch nick-hppapmap on 2009-01-19 13:17:54 +0000
 1.1.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.1 09-Jan-2009  mjf file m41st84var.h was added on branch mjf-devfs2 on 2009-01-17 13:28:54 +0000
 1.26 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.25 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.24 07-Jan-2025  andvar s/remaing/remaining/ s/containg/containing/, mainly in comments.
 1.23 02-Jan-2020  thorpej branches: 1.23.32;
- Use todr_gettime_ymdhms / todr_settime_ymdhms.
- Correctly propagate errors up the stack.
 1.22 02-Jan-2020  thorpej No need to use I2C_F_POLL here.
 1.21 16-Jun-2018  thorpej branches: 1.21.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.20 28-Oct-2017  riastradh branches: 1.20.2;
Kill some more extern struct cfdriver declarations.

Down with externs in .c!
 1.19 20-Nov-2014  christos use the inline bcdtobin and bintobcd directly instead through a macro.
 1.18 25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.17 16-Mar-2014  dholland branches: 1.17.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.16 12-Dec-2009  tsutsui branches: 1.16.12; 1.16.22; 1.16.26;
Remove `volatile' qualifier from argument types of
struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.

XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
 1.15 08-Jun-2008  tsutsui Replace device_lookup() with device_lookup_private() to get softc
after device_t/softc split. PR kern/38885 from Jonathan A. Kollasch.
 1.14 04-May-2008  xtraeme branches: 1.14.2;
device_t/softc split and other related cosmetic changes.
 1.13 09-Apr-2008  cegger branches: 1.13.2; 1.13.4;
Re-add chunk of code that got lost in rev. 1.10. Makes this file build/work again. vi sometimes plays games with me. Spotted by dogcow.
 1.12 09-Apr-2008  dogcow deparenthesize 'return (x);' and add missing close-brace.
 1.11 06-Apr-2008  cegger use aprint_*_dev and device_xname
 1.10 11-Dec-2007  lukem branches: 1.10.8;
use __KERNEL_RCSID()
 1.9 19-Oct-2007  ad branches: 1.9.4; 1.9.6; 1.9.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.8 12-Jan-2007  cube branches: 1.8.6; 1.8.18; 1.8.20; 1.8.24;
Add missing initializers in cdevsw structs.
 1.7 04-Sep-2006  gdamore branches: 1.7.2;
Remove unused todr_setcal/todr_getcal and all the assorted stub
implementations.
 1.6 29-Mar-2006  thorpej Use device_private().
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.6; 1.5.8; 1.5.10; 1.5.12;
merge ktrace-lwp.
 1.4 04-Jun-2005  he branches: 1.4.2;
Fix the various todr_gettime() and todr_settime() fallouts from
-Wcast-qual differently, by instead changing the signatore of those
"functions" to take a "volatile struct timeval*" instead of a
"struct timeval*". Many places, these functions are called with
&time, and time is declared as volatile in <sys/kernel.h>. This
way we can get rid of all the ugly casts which now also triggered
warnings, and caused more code to be added to work around the
problem.

Reviewed by thorpej.
 1.3 30-Sep-2004  briggs PR kern/27088 from Jared Momose. The read function should specify the
length of the command buffer (1) instead of 0. Otherwise, data will
have an implied offset of 0 and reads at non-0 locations will incorrectly
return the data from 0. Fix as suggested in the report.
 1.2 20-Oct-2003  briggs branches: 1.2.4;
As suggested by Jason Thorpe, rename m41t to m41trtc.
 1.1 30-Sep-2003  thorpej New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.2.4.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.4.6 17-Jan-2005  skrll Adapt to branch.
 1.2.4.5 19-Oct-2004  skrll Sync with HEAD
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 20-Oct-2003  skrll file m41t00.c was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.4.2.5 21-Jan-2008  yamt sync with head
 1.4.2.4 27-Oct-2007  yamt sync with head.
 1.4.2.3 26-Feb-2007  yamt sync with head.
 1.4.2.2 30-Dec-2006  yamt sync with head.
 1.4.2.1 21-Jun-2006  yamt sync with head.
 1.5.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.5.10.1 19-Apr-2006  elad sync with head.
 1.5.8.2 14-Sep-2006  yamt sync with head.
 1.5.8.1 01-Apr-2006  yamt sync with head.
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.7.2.1 01-Feb-2007  ad Sync with head.
 1.8.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.8.20.2 09-Jan-2008  matt sync with HEAD
 1.8.20.1 06-Nov-2007  matt sync with HEAD
 1.8.18.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.8.6.1 23-Oct-2007  ad Sync with head.
 1.9.8.1 13-Dec-2007  bouyer Sync with HEAD
 1.9.6.1 11-Dec-2007  yamt sync with head.
 1.9.4.1 26-Dec-2007  ad Sync with head.
 1.10.8.2 29-Jun-2008  mjf Sync with HEAD.
 1.10.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.4.3 11-Mar-2010  yamt sync with head
 1.13.4.2 04-May-2009  yamt sync with head.
 1.13.4.1 16-May-2008  yamt sync with head.
 1.13.2.2 17-Jun-2008  yamt sync with head.
 1.13.2.1 18-May-2008  yamt sync with head.
 1.14.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.16.26.1 18-May-2014  rmind sync with head
 1.16.22.2 03-Dec-2017  jdolecek update from HEAD
 1.16.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.17.2.1 10-Aug-2014  tls Rebase.
 1.20.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.21.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.23.32.1 02-Aug-2025  perseant Sync with HEAD
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file m41t00reg.h was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.21 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.20 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.19 07-Jan-2025  andvar s/remaing/remaining/ s/containg/containing/, mainly in comments.
 1.18 02-Jan-2020  thorpej branches: 1.18.32;
- Use todr_gettime_ymdhms / todr_settime_ymdhms.
- Correctly propagate errors up the stack.
 1.17 02-Jan-2020  thorpej No need to use I2C_F_POLL here.
 1.16 16-Jun-2018  thorpej branches: 1.16.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.15 20-Nov-2014  christos branches: 1.15.18;
use the inline bcdtobin and bintobcd directly instead through a macro.
 1.14 25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.13 16-Mar-2014  dholland branches: 1.13.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.12 12-Dec-2009  tsutsui branches: 1.12.12; 1.12.22; 1.12.26;
Remove `volatile' qualifier from argument types of
struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.

XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
 1.11 08-Jun-2008  tsutsui Replace device_lookup() with device_lookup_private() to get softc
after device_t/softc split. PR kern/38885 from Jonathan A. Kollasch.
 1.10 04-May-2008  xtraeme branches: 1.10.2;
device_t/softc split and other related cosmetic changes.
 1.9 06-Apr-2008  cegger branches: 1.9.2; 1.9.4;
use aprint_*_dev and device_xname
 1.8 11-Dec-2007  lukem branches: 1.8.8;
use __KERNEL_RCSID()
 1.7 12-Jan-2007  cube branches: 1.7.20; 1.7.28; 1.7.30; 1.7.32;
Add missing initializers in cdevsw structs.
 1.6 04-Sep-2006  gdamore branches: 1.6.2;
Remove unused todr_setcal/todr_getcal and all the assorted stub
implementations.
 1.5 29-Mar-2006  thorpej Use device_private().
 1.4 13-Dec-2005  abs branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10; 1.4.12;
Update some missed _close() and _open() functions from 'struct proc *p'
to 'struct lwp *l'.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Jun-2005  he branches: 1.2.2;
Fix the various todr_gettime() and todr_settime() fallouts from
-Wcast-qual differently, by instead changing the signatore of those
"functions" to take a "volatile struct timeval*" instead of a
"struct timeval*". Many places, these functions are called with
&time, and time is declared as volatile in <sys/kernel.h>. This
way we can get rid of all the ugly casts which now also triggered
warnings, and caused more code to be added to work around the
problem.

Reviewed by thorpej.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file max6900.c was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.2.2.4 21-Jan-2008  yamt sync with head
 1.2.2.3 26-Feb-2007  yamt sync with head.
 1.2.2.2 30-Dec-2006  yamt sync with head.
 1.2.2.1 21-Jun-2006  yamt sync with head.
 1.4.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.4.10.1 19-Apr-2006  elad sync with head.
 1.4.8.2 14-Sep-2006  yamt sync with head.
 1.4.8.1 01-Apr-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.1 01-Feb-2007  ad Sync with head.
 1.7.32.1 13-Dec-2007  bouyer Sync with HEAD
 1.7.30.1 11-Dec-2007  yamt sync with head.
 1.7.28.1 26-Dec-2007  ad Sync with head.
 1.7.20.1 09-Jan-2008  matt sync with HEAD
 1.8.8.2 29-Jun-2008  mjf Sync with HEAD.
 1.8.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.4.3 11-Mar-2010  yamt sync with head
 1.9.4.2 04-May-2009  yamt sync with head.
 1.9.4.1 16-May-2008  yamt sync with head.
 1.9.2.2 17-Jun-2008  yamt sync with head.
 1.9.2.1 18-May-2008  yamt sync with head.
 1.10.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.12.26.1 18-May-2014  rmind sync with head
 1.12.22.2 03-Dec-2017  jdolecek update from HEAD
 1.12.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.2.1 10-Aug-2014  tls Rebase.
 1.15.18.1 25-Jun-2018  pgoyette Sync with HEAD
 1.16.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.18.32.1 02-Aug-2025  perseant Sync with HEAD
 1.3 07-Aug-2013  soren Allow i2c addr wildcard matching. Use with care!
 1.2 11-Dec-2005  christos branches: 1.2.110; 1.2.120; 1.2.126;
merge ktrace-lwp.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file max6900reg.h was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.2.126.1 28-Aug-2013  rmind sync with head
 1.2.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.11 27-Jan-2021  thorpej branches: 1.11.4; 1.11.14;
Use DEVICE_COMPAT_EOL.
 1.10 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.9 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.8 23-Dec-2019  thorpej branches: 1.8.8;
Actually, the local mutex is unnecesary; the i2c bus lock is held
across all register r/m/w cycles, so we can just piggy back on that.
(I misread the code previously.)
 1.7 23-Dec-2019  thorpej - No need to use I2C_F_POLL here.
- Use a local mutex to protect register read-modify-write cycles.
 1.6 26-Jun-2018  thorpej branches: 1.6.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.5 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.4 17-Jun-2018  thorpej Fix compilation error pointed out by nishimura@.
 1.3 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.2 28-Sep-2017  jmcneill branches: 1.2.2; 1.2.4;
Fix register write location
 1.1 22-Sep-2017  jmcneill Add GPIO drivers for MAX77620 and TCA9539 as found in Jetson TX1
 1.2.4.2 28-Jul-2018  pgoyette Sync with HEAD
 1.2.4.1 25-Jun-2018  pgoyette Sync with HEAD
 1.2.2.2 03-Dec-2017  jdolecek update from HEAD
 1.2.2.1 28-Sep-2017  jdolecek file max77620.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.6.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.8.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.11.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.11.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.2 17-Jan-2022  thorpej G/C mcpgpio_softc::sc_phandle; nothing is using it.
 1.1 17-Jan-2022  thorpej Re-factor and overhaul the "mcp23s17gpio" driver as "mcpgpio", and
add support for 8-bit and I2C variants of the chip:
- MCP23008 / MCP23S08: 8-bit (I2C / SPI)
- MCP23017 / MCP23S17: 16-bit (I2C / SPI)
- MCP23018 / MCP23S18: 16-bit (I2C / SPI), open-drain outputs

The MCP23x17 and MCP23x18 are essentially identical, software-wise; we
merely report different GPIO pin capabilities (no push-pull output for
MCP23x18). Also, remove the tri-state capability that was previously
advertised by the old version of this driver; these chips have no way
to put the pin into a HI-Z mode.

All 3 I2C versions are supported, but the SPI front-end still only
supports the MCP23S17 for now (SPI autoconfiguration needs an overhaul).

mcp23s17gpio(4) remains present as a link to the new mcpgpio(4) man page.

XXX Still to-do: FDT integration, interrupt suppoort.
 1.8 16-Jan-2024  andvar Fix typos in word "particularly", in comments.
 1.7 23-Dec-2019  thorpej No need to use I2C_F_POLL here.
 1.6 16-Jun-2018  thorpej branches: 1.6.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.5 28-Oct-2013  rkujawa branches: 1.5.4; 1.5.30;
Fix name of sysctl setup function.
 1.4 15-Oct-2013  rkujawa Add sysctl knobs to set temperature limit and hysteresis. Reaching the limit
causes alert line of the chip to be asserted. These limits could be tied to
critical limit set in envsys, but it's more versatile to keep it as separate
value.
 1.3 15-Oct-2013  rkujawa Simplify sysctl handling.
 1.2 15-Oct-2013  rkujawa Clean up register read and write functions, add functions for 8-bit read and
write (needed to access config register). Add sysctl knob to set resolution
from user space.
 1.1 06-May-2013  rkujawa branches: 1.1.4; 1.1.6;
Add driver for Microchip MCP9800/1/2/3 temperature sensors.
 1.1.6.1 18-May-2014  rmind sync with head
 1.1.4.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.4.2 23-Jun-2013  tls resync from head
 1.1.4.1 06-May-2013  tls file mcp980x.c was added on branch tls-maxphys on 2013-06-23 06:20:17 +0000
 1.5.30.1 25-Jun-2018  pgoyette Sync with HEAD
 1.5.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.4.1 28-Oct-2013  yamt file mcp980x.c was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.6.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2 15-Oct-2013  rkujawa branches: 1.2.4;
Add forgotten register definitions for previous commit.
 1.1 06-May-2013  rkujawa branches: 1.1.4; 1.1.6;
Add driver for Microchip MCP9800/1/2/3 temperature sensors.
 1.1.6.1 18-May-2014  rmind sync with head
 1.1.4.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.4.2 23-Jun-2013  tls resync from head
 1.1.4.1 06-May-2013  tls file mcp980xreg.h was added on branch tls-maxphys on 2013-06-23 06:20:17 +0000
 1.2.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.4.1 15-Oct-2013  yamt file mcp980xreg.h was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.17 16-Sep-2025  thorpej As with ACPI, perform the fdtbus_register_i2c_controller() in a centralized
location.
 1.16 16-Sep-2025  thorpej Garbage-collect fdtbus_attach_i2cbus(); the regular iicbus_attach() is
sufficient now.
 1.15 15-Sep-2025  thorpej Do the ACPI-specific get-child-devices dance in iic_attach(). This
obviously isn't ideal, but it funnels the issue into a central location
and provides for easier improvement later.
 1.14 15-Sep-2025  thorpej Encapsulate what's needed to attach an I2C bus into a iicbus_attach()
inline.
 1.13 22-Jul-2022  thorpej Normalize how motoi2c controllers are attached.
 1.12 07-Aug-2021  thorpej branches: 1.12.2;
Merge thorpej-cfargs2.
 1.11 24-Apr-2021  thorpej branches: 1.11.2; 1.11.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.10 25-Jan-2021  jmcneill branches: 1.10.2;
NXP Layerscape LX2160A has an almost compatible controller, with a few
quirks:
- IBCR bit 7 is "module disable" instead of "module enable".
- Status bits in IBSR are W1C.
Add quirk flags for both.
 1.9 24-Jan-2021  jmcneill Support non-FDT attachment.
 1.8 23-Dec-2020  thorpej Change fdtbus_register_i2c_controller() to directly register the i2c_tag_t,
rather than the device and a set of functions (the only of which was to
return the i2c_tag_t anyway). Previously, this assumed only a single
i2c controller node per device_t, which is not true with an i2c mux.
 1.7 22-Dec-2019  thorpej branches: 1.7.8;
Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.6 29-Nov-2019  hkenken Add wait for stop condition.
 1.5 05-Aug-2019  hkenken Add support FDT.
 1.4 17-Apr-2011  phx branches: 1.4.56;
Suppressing the ACK after the last byte read must not depend on
I2C_OP_STOP_P(), but all read-transfers have to be finished that way.
Otherwise a chip might hang after a read-operation without stop.

Removed sc_start from the softc structure, which is unused.
 1.3 12-Jan-2011  phx branches: 1.3.2; 1.3.6;
Fixed DPRINTF macro to make it compile when DEBUG is not defined.
 1.2 04-Jan-2011  nisimura branches: 1.2.2;
withdraw my name from the copyright notice as there is little code
substance made by me.
 1.1 04-Jan-2011  matt Add a generic Motorola/Freescale i2c driver. This was taken from sandpoint
and heavily modified. It works on most Freescale PowerPC and ARM SoCs.
 1.2.2.3 26-Jul-2011  matt cleanup DEBUG printf
 1.2.2.2 07-Jan-2011  matt Add revamped support for motorola/freescale embedded i2c SoC controllers.
 1.2.2.1 04-Jan-2011  matt file motoi2c.c was added on branch matt-nb5-pq3 on 2011-01-07 01:19:15 +0000
 1.3.6.3 21-Apr-2011  rmind sync with head
 1.3.6.2 05-Mar-2011  rmind sync with head
 1.3.6.1 12-Jan-2011  rmind file motoi2c.c was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.3.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.56.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.56.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.8.2 03-Apr-2021  thorpej Sync with HEAD.
 1.7.8.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.10.2.1 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.11.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.11.2.2 19-May-2021  thorpej fdtbus_attach_i2cbus() is no longer anything other than a wrapper around
config_found(); just get rid of it and make its callers look like all of
the other I2C controller drivers.
 1.11.2.1 25-Apr-2021  thorpej - Don't use acpi_enter_i2c_devs() -- it no longer exists.
- Pass along our devhandle to the i2c bus instance.
 1.12.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.3 07-Oct-2014  matt fix some c&p bugs.
 1.2 04-Jan-2011  nisimura branches: 1.2.2; 1.2.8; 1.2.22;
withdraw my name from the copyright notice as there is little code
substance made by me.
 1.1 04-Jan-2011  matt Add a generic Motorola/Freescale i2c driver. This was taken from sandpoint
and heavily modified. It works on most Freescale PowerPC and ARM SoCs.
 1.2.22.1 03-Dec-2017  jdolecek update from HEAD
 1.2.8.2 05-Mar-2011  rmind sync with head
 1.2.8.1 04-Jan-2011  rmind file motoi2creg.h was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.2.2.2 07-Jan-2011  matt Add revamped support for motorola/freescale embedded i2c SoC controllers.
 1.2.2.1 04-Jan-2011  matt file motoi2creg.h was added on branch matt-nb5-pq3 on 2011-01-07 01:19:15 +0000
 1.11 16-Sep-2025  thorpej As with ACPI, perform the fdtbus_register_i2c_controller() in a centralized
location.
 1.10 15-Sep-2025  thorpej Do the ACPI-specific get-child-devices dance in iic_attach(). This
obviously isn't ideal, but it funnels the issue into a central location
and provides for easier improvement later.
 1.9 22-Jul-2022  thorpej Normalize how motoi2c controllers are attached.
 1.8 25-Jan-2021  jmcneill branches: 1.8.4; 1.8.14;
NXP Layerscape LX2160A has an almost compatible controller, with a few
quirks:
- IBCR bit 7 is "module disable" instead of "module enable".
- Status bits in IBSR are W1C.
Add quirk flags for both.
 1.7 24-Jan-2021  jmcneill Support non-FDT attachment.
 1.6 22-Dec-2019  thorpej branches: 1.6.8;
Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.5 05-Aug-2019  hkenken Add support FDT.
 1.4 17-Apr-2011  phx branches: 1.4.56;
Suppressing the ACK after the last byte read must not depend on
I2C_OP_STOP_P(), but all read-transfers have to be finished that way.
Otherwise a chip might hang after a read-operation without stop.

Removed sc_start from the softc structure, which is unused.
 1.3 12-Jan-2011  phx branches: 1.3.2; 1.3.6;
Include i2cvar.h for i2c_controller, which is usually not needed by devices
using this MI driver, so they shouldn't have to bother with that.
 1.2 04-Jan-2011  nisimura branches: 1.2.2;
withdraw my name from the copyright notice as there is little code
substance made by me.
 1.1 04-Jan-2011  matt Add a generic Motorola/Freescale i2c driver. This was taken from sandpoint
and heavily modified. It works on most Freescale PowerPC and ARM SoCs.
 1.2.2.2 07-Jan-2011  matt Add revamped support for motorola/freescale embedded i2c SoC controllers.
 1.2.2.1 04-Jan-2011  matt file motoi2cvar.h was added on branch matt-nb5-pq3 on 2011-01-07 01:19:15 +0000
 1.3.6.3 21-Apr-2011  rmind sync with head
 1.3.6.2 05-Mar-2011  rmind sync with head
 1.3.6.1 12-Jan-2011  rmind file motoi2cvar.h was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.3.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.56.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.56.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.6.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.8.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.8.4.1 25-Apr-2021  thorpej - Don't use acpi_enter_i2c_devs() -- it no longer exists.
- Pass along our devhandle to the i2c bus instance.
 1.4 27-Jun-2025  andvar Grammar and spelling fixes, mainly in comments. A few in documentation,
logging, test description, and SCSI ASC/ASCQ assignment descriptions.
 1.3 23-Dec-2019  thorpej branches: 1.3.32;
No need to use I2C_F_POLL here.
 1.2 16-Jun-2018  thorpej branches: 1.2.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.1 08-Sep-2013  rkujawa branches: 1.1.4; 1.1.6; 1.1.10; 1.1.34;
Preliminary support for MPL115A2 pressure sensor. It works, but accurracy is
awful.

I should add presure as a new type of sensor to envsys at some point...
 1.1.34.1 25-Jun-2018  pgoyette Sync with HEAD
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 08-Sep-2013  tls file mpl115a.c was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.1.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.1 08-Sep-2013  yamt file mpl115a.c was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 08-Sep-2013  rmind file mpl115a.c was added on branch rmind-smpnet on 2014-05-18 17:45:37 +0000
 1.2.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.32.1 02-Aug-2025  perseant Sync with HEAD
 1.1 08-Sep-2013  rkujawa branches: 1.1.4; 1.1.6; 1.1.10;
Preliminary support for MPL115A2 pressure sensor. It works, but accurracy is
awful.

I should add presure as a new type of sensor to envsys at some point...
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 08-Sep-2013  tls file mpl115areg.h was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.1.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.1 08-Sep-2013  yamt file mpl115areg.h was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 08-Sep-2013  rmind file mpl115areg.h was added on branch rmind-smpnet on 2014-05-18 17:45:37 +0000
 1.7 23-Dec-2019  thorpej - No need to use I2C_F_POLL here.
- Don't write to the device if iic_acquire_bus() fails.
 1.6 01-Jun-2017  chs branches: 1.6.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.5 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.4 02-Oct-2011  jmcneill branches: 1.4.12; 1.4.28; 1.4.30;
now that iic is a module, add "iic" dependency to iic drivers
 1.3 05-Aug-2011  jakllsch Various cleanup, mostly reducing debugging spew.
 1.2 04-Aug-2011  jmcneill modularize mt2131
 1.1 04-Aug-2011  jakllsch Add subroutines to support Microtune MT2131 silicon tuner.
 1.4.30.2 28-Aug-2017  skrll Sync with HEAD
 1.4.30.1 06-Apr-2015  skrll Sync with HEAD
 1.4.28.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.4.12.1 03-Dec-2017  jdolecek update from HEAD
 1.6.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 04-Aug-2011  jakllsch Add subroutines to support Microtune MT2131 silicon tuner.
 1.7 31-Dec-2019  thorpej Fix mis-placed parentheses. PR kern/54813.
 1.6 23-Dec-2019  thorpej - No need to use I2C_F_POLL here.
- If iic_acquire_bus() fails, return the error, not false (because false
looks like "everything A-OK!" to the caller).
 1.5 01-Jun-2017  chs branches: 1.5.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.4 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.3 02-Oct-2011  jmcneill branches: 1.3.12; 1.3.28; 1.3.30;
now that iic is a module, add "iic" dependency to iic drivers
 1.2 14-Jul-2011  jmcneill add module support
 1.1 11-Jul-2011  jakllsch Add subdriver for Nextwave (subsequently acquired by ATI, then AMD, and
finally Broadcom) NXT200x series of 8VSB/QAM demodulator.

Still a bit crude and only supports the NXT2004 at this point.
 1.3.30.2 28-Aug-2017  skrll Sync with HEAD
 1.3.30.1 06-Apr-2015  skrll Sync with HEAD
 1.3.28.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.3.12.1 03-Dec-2017  jdolecek update from HEAD
 1.5.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 11-Jul-2011  jakllsch Add subdriver for Nextwave (subsequently acquired by ATI, then AMD, and
finally Broadcom) NXT200x series of 8VSB/QAM demodulator.

Still a bit crude and only supports the NXT2004 at this point.
 1.7 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.6 27-Jan-2021  thorpej branches: 1.6.4; 1.6.14;
Use DEVICE_COMPAT_EOL.
 1.5 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.4 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.3 25-Jul-2019  thorpej branches: 1.3.10; 1.3.12;
Do the iic_acquire_bus() / iic_release_bus() dance that I, um, forgot
to do. (oops) Also, no need to do the dance with 'cold' aymore; the i2c
code does it for us now.
 1.2 24-Jul-2019  thorpej I was a little over-zealous with the includes. Tone it down just
a wee bit.
 1.1 24-Jul-2019  thorpej Add a driver for the NXP PCA9685 16-channel, 12-bit PWM Fm+ LED controller.
 1.3.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.10.1 25-Jul-2019  martin file pca9685.c was added on branch phil-wifi on 2020-04-13 08:04:20 +0000
 1.6.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.6.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.1 24-Jul-2019  thorpej branches: 1.1.10;
Add a driver for the NXP PCA9685 16-channel, 12-bit PWM Fm+ LED controller.
 1.1.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.10.1 24-Jul-2019  martin file pca9685reg.h was added on branch phil-wifi on 2020-04-13 08:04:20 +0000
 1.13 09-Jul-2025  macallan remove callout-using debug code
 1.12 12-Feb-2022  riastradh branches: 1.12.10;
sys: Fix various abuse of struct device internals.

Will help to make struct device opaque later.
 1.11 21-Jun-2021  christos fix proplib deprecation
 1.10 27-Jan-2021  thorpej branches: 1.10.4;
Use DEVICE_COMPAT_EOL.
 1.9 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.8 18-Jan-2021  thorpej Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup(). This pattern is less awkward to use.
 1.7 17-Jan-2021  thorpej Change the device_compatible_entry struct to have a union of
a scalar value (uintptr_t value) and a pointer value (const void *data),
rather than just "uintptr_t data". This eliminates the need for drivers
to cast this value, and doesn't lose const'ness of pointers assigned
to the field.

Update all of the users of this field to use the correct set of
designated initialisers for each specific case.
 1.6 31-Oct-2020  jdc branches: 1.6.2;
Detach led's in our detach routine.
 1.5 29-Oct-2020  jdc Handle the change in the sparc64 OFW patching, where we now encode the
GPIO pin type in the pin name (only LED types are currently handled).
 1.4 27-Oct-2020  jdc Add additional debugging output.
Track more chip state in the softc and check the chip state via a timer.
This allows us to easily observe changes caused by external events
(e.g. disk removal or PSU failure).
 1.3 02-Feb-2020  macallan branches: 1.3.2; 1.3.6;
break long lines
 1.2 02-Feb-2020  macallan attach LEDs according to info passed as device properties
 1.1 29-Jan-2020  macallan the beginning of a driver for Philips Semiconductors PCA 9555 and 9556
GPIO controllers, found in Sun Fire v210 and some G5 macs.
Only prints configuration and line status so far.
 1.3.6.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.6.1 02-Feb-2020  martin file pcagpio.c was added on branch phil-wifi on 2020-04-08 14:08:05 +0000
 1.3.2.2 29-Feb-2020  ad Sync with head.
 1.3.2.1 02-Feb-2020  ad file pcagpio.c was added on branch ad-namecache on 2020-02-29 20:19:08 +0000
 1.6.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.10.4.1 01-Aug-2021  thorpej Sync with HEAD.
 1.12.10.1 02-Aug-2025  perseant Sync with HEAD
 1.11 17-Sep-2025  thorpej Don't consult i2c_attach_args::ia_cookietype or ia_cookie when looking
for an FDT / OF phandle; get the information from self's devhandle.
 1.10 16-Sep-2025  thorpej Now that the common I2C code hides many of the FDT vs ACPI differences,
perform the reductions currently possible in the I2C mux layer. Note
some additional enhancements necessary for further reductions.
 1.9 20-Jul-2022  thorpej Improve error reporting.
 1.8 27-Jan-2021  thorpej branches: 1.8.4; 1.8.14;
Use DEVICE_COMPAT_EOL.
 1.7 26-Jan-2021  thorpej Don't map ACPI _HID / _CID strings to "compatible" strings from the
Device Tree bindings. Just pass those strings in the standard
most-specific-to-least-specific order to the drivers and let them
deal.
 1.6 25-Jan-2021  jmcneill Add support for ACPI-based I2C mux attachment.
 1.5 24-Jan-2021  jmcneill remove part of previous that was committed by mistake
 1.4 24-Jan-2021  jmcneill trailing whitespace
 1.3 18-Jan-2021  thorpej Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup(). This pattern is less awkward to use.
 1.2 17-Jan-2021  thorpej Change the device_compatible_entry struct to have a union of
a scalar value (uintptr_t value) and a pointer value (const void *data),
rather than just "uintptr_t data". This eliminates the need for drivers
to cast this value, and doesn't lose const'ness of pointers assigned
to the field.

Update all of the users of this field to use the correct set of
designated initialisers for each specific case.
 1.1 29-Dec-2020  thorpej branches: 1.1.2;
Add a driver for NXP PCA954x / PCA984x I2C switch / mux controllers.
 1.1.2.3 03-Apr-2021  thorpej Sync with HEAD.
 1.1.2.2 03-Jan-2021  thorpej Sync w/ HEAD.
 1.1.2.1 29-Dec-2020  thorpej file pcai2cmux.c was added on branch thorpej-futex on 2021-01-03 16:34:58 +0000
 1.8.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.8.4.3 14-May-2021  thorpej No need to device_set_handle(); it's done for us by the i2c enumeration
code.
 1.8.4.2 09-May-2021  thorpej Don't include fdtvar.h directly here.
 1.8.4.1 08-May-2021  thorpej Update the i2c mux code for the new enumeration methods.
 1.18 08-Sep-2025  thorpej Garbage-collect fdtbus_todr_attach(); todr_attach() does all the
necessary work now.

kern/59630
 1.17 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.16 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.15 27-Jan-2021  thorpej branches: 1.15.4; 1.15.14;
Use DEVICE_COMPAT_EOL.
 1.14 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.13 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.12 02-Jan-2020  thorpej branches: 1.12.8;
- No need to use I2C_F_POLL here.
- Properly propagate errors up the stack.
 1.11 26-Jun-2018  thorpej branches: 1.11.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.10 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.9 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.8 07-Oct-2017  jmcneill branches: 1.8.2;
Add FDT support
 1.7 11-Apr-2015  joerg Always use polling mode for now, hummingbird doesn't work otherwise.
 1.6 11-Jan-2015  jmcneill dont read cs1/cs2 regs when reading clock, only use polling mode when cold, invert logic for century flag (1 means 1900, 0 means 2000), set dt_wday when reading clock
 1.5 11-Jan-2015  jmcneill initialize CS1/CS2 regs, honour century flag, return an error on read if voltage low bit is set
 1.4 20-Nov-2014  christos branches: 1.4.2;
use the inline bcdtobin and bintobcd directly instead through a macro.
 1.3 07-Jan-2012  phx branches: 1.3.6;
Add direct config support.
 1.2 21-Jan-2011  jakllsch branches: 1.2.2; 1.2.4; 1.2.8; 1.2.10; 1.2.14;
Per suggestion from tsutsui, convert to todr_[gs]ettime_ymdhms flavor.
 1.1 21-Jan-2011  jakllsch Add pcf8563rtc(4), yet another I2C real time clock.
 1.2.14.1 18-Feb-2012  mrg merge to -current.
 1.2.10.1 17-Apr-2012  yamt sync with head
 1.2.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.8.1 21-Jan-2011  jruoho file pcf8563.c was added on branch jruoho-x86intr on 2011-06-06 09:07:50 +0000
 1.2.4.2 05-Mar-2011  rmind sync with head
 1.2.4.1 21-Jan-2011  rmind file pcf8563.c was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.2.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.2.2.1 21-Jan-2011  bouyer file pcf8563.c was added on branch bouyer-quota2 on 2011-02-08 16:19:48 +0000
 1.3.6.1 03-Dec-2017  jdolecek update from HEAD
 1.4.2.2 06-Jun-2015  skrll Sync with HEAD
 1.4.2.1 06-Apr-2015  skrll Sync with HEAD
 1.8.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.8.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.11.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.12.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.15.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.15.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.2 11-Jan-2015  jmcneill add VL flags
 1.1 21-Jan-2011  jakllsch branches: 1.1.2; 1.1.4; 1.1.8; 1.1.20; 1.1.38;
Add pcf8563rtc(4), yet another I2C real time clock.
 1.1.38.1 06-Apr-2015  skrll Sync with HEAD
 1.1.20.1 03-Dec-2017  jdolecek update from HEAD
 1.1.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.8.1 21-Jan-2011  jruoho file pcf8563reg.h was added on branch jruoho-x86intr on 2011-06-06 09:07:50 +0000
 1.1.4.2 05-Mar-2011  rmind sync with head
 1.1.4.1 21-Jan-2011  rmind file pcf8563reg.h was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 21-Jan-2011  bouyer file pcf8563reg.h was added on branch bouyer-quota2 on 2011-02-08 16:19:48 +0000
 1.10 21-Jun-2021  christos fix proplib deprecation
 1.9 27-Jan-2021  thorpej branches: 1.9.4;
Use DEVICE_COMPAT_EOL.
 1.8 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.7 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.6 23-Dec-2020  jdc Handle pins that represent alerts.
split out common code for alert and indicator pins
change the previously debug-only callout to work for alerts too
split out common code for alerts in refresh and in callout
While here, remove redundant variable used for checking sysmon setup.
 1.5 06-Dec-2020  jdc Don't read from the chip when matching, fail the attach instead (requested
by jmcneill). Reverts previous.
 1.4 05-Dec-2020  jdc Return "match_result", not "1". Pointed out by jmcneill.
 1.3 05-Dec-2020  jdc When matching, try a read in case this is an optional device and isn't
actually present.
Make sure that we set sc->sc_sme to NULL in failure cases and when we
detach in order to avoid calling sysmon_envsys_unregister() with an
invalid struct.
 1.2 31-Oct-2020  jdc branches: 1.2.2;
Detach led's and sysmon in our detach routine.
 1.1 29-Oct-2020  jdc Add a driver for the PCF8574 I/O expander, used as a GPIO in some sparc64
hardware.
The driver currently handles pins configured as LED or INDICATOR and adds
them to the LED and sysmon_envsys subsystems, respectively.
 1.2.2.3 03-Apr-2021  thorpej Sync with HEAD.
 1.2.2.2 03-Jan-2021  thorpej Sync w/ HEAD.
 1.2.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.9.4.1 01-Aug-2021  thorpej Sync with HEAD.
 1.21 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.20 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.19 02-Jan-2020  thorpej No need to use I2C_F_POLL here.
 1.18 16-Jun-2018  thorpej branches: 1.18.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.17 28-Oct-2017  riastradh branches: 1.17.2;
Kill some more extern struct cfdriver declarations.

Down with externs in .c!
 1.16 20-Nov-2014  christos use the inline bcdtobin and bintobcd directly instead through a macro.
 1.15 25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.14 16-Mar-2014  dholland branches: 1.14.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.13 02-Apr-2011  mbalmer branches: 1.13.4; 1.13.14; 1.13.18;
Fix misplaced parenthesis. From henning.petersen@t-online.de, thanks.
 1.12 12-Dec-2009  tsutsui branches: 1.12.4; 1.12.6;
Remove `volatile' qualifier from argument types of
struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.

XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
 1.11 08-Jun-2008  tsutsui Replace device_lookup() with device_lookup_private() to get softc
after device_t/softc split. PR kern/38885 from Jonathan A. Kollasch.
 1.10 04-May-2008  xtraeme branches: 1.10.2;
device_t/softc split and other related cosmetic changes.
 1.9 06-Apr-2008  cegger branches: 1.9.2; 1.9.4;
use aprint_*_dev and device_xname
 1.8 11-Dec-2007  lukem branches: 1.8.8;
use __KERNEL_RCSID()
 1.7 13-Jan-2007  cube branches: 1.7.20; 1.7.28; 1.7.30; 1.7.32;
Complete initializers so those files compile.
 1.6 04-Sep-2006  gdamore branches: 1.6.2;
Remove unused todr_setcal/todr_getcal and all the assorted stub
implementations.
 1.5 23-Aug-2006  bjh21 gettime and settime functions are meant to return errno values. Make
the pcf8583 ones do so.
 1.4 29-Mar-2006  thorpej Use device_private().
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.6; 1.3.8; 1.3.10; 1.3.12;
merge ktrace-lwp.
 1.2 04-Jun-2005  he branches: 1.2.2;
Fix the various todr_gettime() and todr_settime() fallouts from
-Wcast-qual differently, by instead changing the signatore of those
"functions" to take a "volatile struct timeval*" instead of a
"struct timeval*". Many places, these functions are called with
&time, and time is declared as volatile in <sys/kernel.h>. This
way we can get rid of all the ugly casts which now also triggered
warnings, and caused more code to be added to work around the
problem.

Reviewed by thorpej.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.4 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.3 27-Aug-2004  skrll Adapt to branch.

acorn26 GENERIC compiles.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file pcf8583.c was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.2.2.4 21-Jan-2008  yamt sync with head
 1.2.2.3 26-Feb-2007  yamt sync with head.
 1.2.2.2 30-Dec-2006  yamt sync with head.
 1.2.2.1 21-Jun-2006  yamt sync with head.
 1.3.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.3.10.1 19-Apr-2006  elad sync with head.
 1.3.8.3 14-Sep-2006  yamt sync with head.
 1.3.8.2 03-Sep-2006  yamt sync with head.
 1.3.8.1 01-Apr-2006  yamt sync with head.
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.1 01-Feb-2007  ad Sync with head.
 1.7.32.1 13-Dec-2007  bouyer Sync with HEAD
 1.7.30.1 11-Dec-2007  yamt sync with head.
 1.7.28.1 26-Dec-2007  ad Sync with head.
 1.7.20.1 09-Jan-2008  matt sync with HEAD
 1.8.8.2 29-Jun-2008  mjf Sync with HEAD.
 1.8.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.4.3 11-Mar-2010  yamt sync with head
 1.9.4.2 04-May-2009  yamt sync with head.
 1.9.4.1 16-May-2008  yamt sync with head.
 1.9.2.2 17-Jun-2008  yamt sync with head.
 1.9.2.1 18-May-2008  yamt sync with head.
 1.10.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.12.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.12.4.1 21-Apr-2011  rmind sync with head
 1.13.18.1 18-May-2014  rmind sync with head
 1.13.14.2 03-Dec-2017  jdolecek update from HEAD
 1.13.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14.2.1 10-Aug-2014  tls Rebase.
 1.17.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.18.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3 07-Aug-2013  soren Allow i2c addr wildcard matching. Use with care!
 1.2 11-Dec-2005  christos branches: 1.2.110; 1.2.120; 1.2.126;
merge ktrace-lwp.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file pcf8583reg.h was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.2.126.1 28-Aug-2013  rmind sync with head
 1.2.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 30-Sep-2003  thorpej branches: 1.1.4;
New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc. Primarily written by Steve Woodford,
with some modification by me.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 30-Sep-2003  skrll file pcf8583var.h was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.19 18-Nov-2011  jmcneill remove Xbox support
 1.18 17-Nov-2011  christos tidy up.
 1.17 17-Nov-2011  jakllsch Fix last envsys2 conversion (1.10). From Tetsuya Isaki in PR#45622.
 1.16 20-Jun-2011  pgoyette branches: 1.16.2;
Initialize sensor state before registering.

XXX Still need to fix i2c/ibmhawk.c
 1.15 08-Jun-2008  tsutsui branches: 1.15.30;
Remove unnecessary casts against void pointers.
 1.14 05-May-2008  jmcneill branches: 1.14.2;
Use 2-clause license.
 1.13 04-May-2008  xtraeme device_t/softc split and other related cosmetic changes.
 1.12 27-Mar-2008  ad branches: 1.12.2; 1.12.4;
Make it compile again.
 1.11 27-Mar-2008  jmcneill Split device_t and softc, use cfdata_t
 1.10 16-Nov-2007  xtraeme branches: 1.10.14;
Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.9 04-Jul-2007  xtraeme branches: 1.9.6; 1.9.8; 1.9.12; 1.9.14;
There's no need to get initial sensor data before registering the driver
to the sysmon_envsys(9) framework, because at register time, the
framework will get initial data by itself.
 1.8 02-Jul-2007  xtraeme pic16lc_update: use the edata pointer rather than using softc's array
index.
 1.7 01-Jul-2007  xtraeme Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.6 05-Feb-2007  jmcneill branches: 1.6.4; 1.6.8; 1.6.10;
Register an SMBus interrupt handler to trap the reset on eject "feature"
on the Microsoft Xbox. Also print details on other system management type
events while we're here -- they may come in handy in the future.
 1.5 07-Jan-2007  jmcneill branches: 1.5.2;
Move register definitions to a separate header.
 1.4 06-Jan-2007  jmcneill Report the version string from the PIC16LC.
 1.3 06-Jan-2007  jmcneill Provide external functions for setting the LED, rebooting, and powering off
the system.
 1.2 06-Jan-2007  jmcneill Fix __KERNEL_RCSID text (missing $)
 1.1 06-Jan-2007  jmcneill Driver for the Xbox System Management Controller. Currently reports CPU and
motherboard temperatures, but will eventually be extended to replace
arch/i386/xbox/pic16l.S
 1.5.2.3 09-Feb-2007  ad Sync with HEAD.
 1.5.2.2 12-Jan-2007  ad Sync with head.
 1.5.2.1 07-Jan-2007  ad file pic16lc.c was added on branch newlock2 on 2007-01-12 00:57:35 +0000
 1.6.10.1 11-Jul-2007  mjf Sync with head.
 1.6.8.1 15-Jul-2007  ad Sync with head.
 1.6.4.4 07-Dec-2007  yamt sync with head
 1.6.4.3 03-Sep-2007  yamt sync with head.
 1.6.4.2 26-Feb-2007  yamt sync with head.
 1.6.4.1 05-Feb-2007  yamt file pic16lc.c was added on branch yamt-lazymbuf on 2007-02-26 09:10:03 +0000
 1.9.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.9.12.1 18-Nov-2007  bouyer Sync with HEAD
 1.9.8.1 09-Jan-2008  matt sync with HEAD
 1.9.6.1 21-Nov-2007  joerg Sync with HEAD.
 1.10.14.3 29-Jun-2008  mjf Sync with HEAD.
 1.10.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.10.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.12.4.2 04-May-2009  yamt sync with head.
 1.12.4.1 16-May-2008  yamt sync with head.
 1.12.2.2 17-Jun-2008  yamt sync with head.
 1.12.2.1 18-May-2008  yamt sync with head.
 1.14.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.15.30.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.16.2.1 17-Apr-2012  yamt sync with head
 1.5 01-Sep-2012  jakllsch pic16lcreg.h has been unused since removal of Xbox support, remove.
 1.4 05-May-2008  jmcneill branches: 1.4.34;
Use 2-clause license.
 1.3 05-Feb-2007  jmcneill branches: 1.3.4; 1.3.42; 1.3.44; 1.3.46;
Register an SMBus interrupt handler to trap the reset on eject "feature"
on the Microsoft Xbox. Also print details on other system management type
events while we're here -- they may come in handy in the future.
 1.2 07-Jan-2007  jmcneill branches: 1.2.2;
Rename a few possible avpack values to reflect reality.
 1.1 07-Jan-2007  jmcneill Move register definitions to a separate header.
 1.2.2.3 09-Feb-2007  ad Sync with HEAD.
 1.2.2.2 12-Jan-2007  ad Sync with head.
 1.2.2.1 07-Jan-2007  ad file pic16lcreg.h was added on branch newlock2 on 2007-01-12 00:57:35 +0000
 1.3.46.1 16-May-2008  yamt sync with head.
 1.3.44.1 18-May-2008  yamt sync with head.
 1.3.42.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.4.2 26-Feb-2007  yamt sync with head.
 1.3.4.1 05-Feb-2007  yamt file pic16lcreg.h was added on branch yamt-lazymbuf on 2007-02-26 09:10:03 +0000
 1.4.34.1 30-Oct-2012  yamt sync with head
 1.12 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.11 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.10 02-Jan-2020  thorpej Use todr_gettime_ymdhms / todr_settime_ymdhms.
 1.9 02-Jan-2020  thorpej - No need to use I2C_F_POLL here.
- Correctly propagate errors up the stack.
 1.8 16-Jun-2018  thorpej branches: 1.8.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.7 20-Nov-2014  christos branches: 1.7.18;
use the inline bcdtobin and bintobcd directly instead through a macro.
 1.6 12-Dec-2009  tsutsui branches: 1.6.22;
Remove `volatile' qualifier from argument types of
struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.

XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
 1.5 04-May-2008  xtraeme device_t/softc split and other related cosmetic changes.
 1.4 06-Apr-2008  cegger branches: 1.4.2; 1.4.4;
use aprint_*_dev and device_xname
 1.3 04-Sep-2006  gdamore branches: 1.3.4; 1.3.54;
Remove unused todr_setcal/todr_getcal and all the assorted stub
implementations.
 1.2 29-Mar-2006  thorpej branches: 1.2.2; 1.2.8;
Use device_private().
 1.1 06-Mar-2006  shige branches: 1.1.2; 1.1.4; 1.1.6;
Add a driver for RICOH R2025S/D I2C RTC.
 1.1.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.1.4.4 14-Sep-2006  yamt sync with head.
 1.1.4.3 01-Apr-2006  yamt sync with head.
 1.1.4.2 13-Mar-2006  yamt sync with head.
 1.1.4.1 06-Mar-2006  yamt file r2025.c was added on branch yamt-pdpolicy on 2006-03-13 09:07:20 +0000
 1.1.2.1 19-Apr-2006  elad sync with head.
 1.2.8.3 30-Dec-2006  yamt sync with head.
 1.2.8.2 21-Jun-2006  yamt sync with head.
 1.2.8.1 29-Mar-2006  yamt file r2025.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.2.2.2 22-Apr-2006  simonb Sync with head.
 1.2.2.1 29-Mar-2006  simonb file r2025.c was added on branch simonb-timecounters on 2006-04-22 11:38:52 +0000
 1.3.54.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.4.2 09-Sep-2006  rpaulo sync with head
 1.3.4.1 04-Sep-2006  rpaulo file r2025.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:51 +0000
 1.4.4.2 11-Mar-2010  yamt sync with head
 1.4.4.1 16-May-2008  yamt sync with head.
 1.4.2.1 18-May-2008  yamt sync with head.
 1.6.22.1 03-Dec-2017  jdolecek update from HEAD
 1.7.18.1 25-Jun-2018  pgoyette Sync with HEAD
 1.8.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 06-Mar-2006  shige branches: 1.1.4; 1.1.8; 1.1.14; 1.1.20;
Add a driver for RICOH R2025S/D I2C RTC.
 1.1.20.2 09-Sep-2006  rpaulo sync with head
 1.1.20.1 06-Mar-2006  rpaulo file r2025reg.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:49:51 +0000
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 06-Mar-2006  yamt file r2025reg.h was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.1.8.2 22-Apr-2006  simonb Sync with head.
 1.1.8.1 06-Mar-2006  simonb file r2025reg.h was added on branch simonb-timecounters on 2006-04-22 11:38:52 +0000
 1.1.4.2 13-Mar-2006  yamt sync with head.
 1.1.4.1 06-Mar-2006  yamt file r2025reg.h was added on branch yamt-pdpolicy on 2006-03-13 09:07:20 +0000
 1.17 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.16 08-Sep-2025  thorpej Garbage-collect fdtbus_todr_attach(); todr_attach() does all the
necessary work now.

kern/59630
 1.15 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.14 07-Aug-2021  thorpej branches: 1.14.2;
Merge thorpej-cfargs2.
 1.13 24-Apr-2021  thorpej branches: 1.13.2; 1.13.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.12 27-Jan-2021  thorpej branches: 1.12.2;
Use DEVICE_COMPAT_EOL.
 1.11 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.10 18-Jan-2021  thorpej Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup(). This pattern is less awkward to use.
 1.9 17-Jan-2021  thorpej Change the device_compatible_entry struct to have a union of
a scalar value (uintptr_t value) and a pointer value (const void *data),
rather than just "uintptr_t data". This eliminates the need for drivers
to cast this value, and doesn't lose const'ness of pointers assigned
to the field.

Update all of the users of this field to use the correct set of
designated initialisers for each specific case.
 1.8 03-Jan-2020  jmcneill branches: 1.8.8;
If the rockchip,system-power-controller property is present, try to power off with the PMIC
 1.7 02-Jan-2020  thorpej No need to use I2C_F_POLL here.

XXX This entire driver needs to have its error reporting overhauled.
 1.6 01-Jan-2020  jmcneill Add clk provider
 1.5 18-Sep-2019  tnn rkpmic: correct delay
 1.4 18-Sep-2019  tnn rkpmic: add RTC support; register w/ todr(9)
 1.3 03-Jul-2019  jmcneill branches: 1.3.2;
Fix enable mask for RK808 LDO regulators
 1.2 20-Sep-2018  jmcneill branches: 1.2.4;
Add support for RK805
 1.1 02-Sep-2018  jmcneill branches: 1.1.2;
Add driver for Rockchip RK808 Power Management IC.
 1.1.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 02-Sep-2018  pgoyette file rkpmic.c was added on branch pgoyette-compat on 2018-09-06 06:55:49 +0000
 1.2.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 20-Sep-2018  christos file rkpmic.c was added on branch phil-wifi on 2019-06-10 22:07:09 +0000
 1.3.2.1 21-Jan-2020  martin Pull up following revision(s) (requested by mrg in ticket #616):

sys/dev/ic/anx_dp.c: revision 1.2
sys/arch/evbarm/conf/GENERIC64: revision 1.126
sys/dev/ic/anx_dp.h: revision 1.1
sys/arch/evbarm/conf/GENERIC64: revision 1.128
sys/dev/ic/anx_dp.h: revision 1.2
sys/dev/fdt/dwcmmc_fdt.c: revision 1.9
sys/dev/i2c/cwfg.c: revision 1.1
sys/conf/files: revision 1.1247
sys/dev/fdt/pwm_backlight.c: revision 1.5
sys/dev/fdt/pwm_backlight.c: revision 1.6
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.14
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.15
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.16
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.17
sys/dev/ic/dwc_mmc.c: revision 1.20
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.18
sys/arch/arm/rockchip/rk3399_cru.c: revision 1.19
sys/dev/usb/usbdevs: revision 1.775
sys/arch/arm/rockchip/rk_dwhdmi.c: revision 1.4
sys/dev/fdt/simple_amplifier.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.105
sys/arch/evbarm/conf/GENERIC64: revision 1.117
sys/arch/evbarm/conf/GENERIC64: revision 1.118
sys/dev/i2c/files.i2c: revision 1.107
sys/dev/fdt/files.fdt: revision 1.49
sys/arch/arm/rockchip/rk_anxdp.c: revision 1.1
sys/dev/ic/dwc_mmc_var.h: revision 1.9
sys/dev/i2c/rkpmic.c: revision 1.4
sys/arch/arm/rockchip/rk_anxdp.c: revision 1.2
sys/dev/i2c/rkpmic.c: revision 1.5
sys/dev/i2c/rkpmic.c: revision 1.6
sys/arch/arm/rockchip/rk_vop.c: revision 1.4
sys/arch/arm/rockchip/rk_vop.c: revision 1.5
sys/dev/i2c/rkpmic.c: revision 1.8
sys/arch/arm/dts/rk3399-pinebook-pro.dts: revision 1.1
sys/dev/usb/ums.c: revision 1.96 (via patch)
sys/arch/arm/rockchip/rk_pwm.c: revision 1.3
sys/arch/arm/dts/rk3399-pinebook-pro.dts: revision 1.2
sys/dev/i2c/es8316ac.c: revision 1.1
sys/dev/fdt/dwcmmc_fdt.c: revision 1.10
sys/dev/i2c/es8316ac.c: revision 1.2
sys/dev/fdt/fdt_panel.c: revision 1.1
sys/dev/ic/dwc_mmc.c: revision 1.18
sys/dev/fdt/fdt_panel.c: revision 1.2
sys/dev/ic/dwc_mmc.c: revision 1.19
sys/arch/arm/dts/rk3399-rockpro64.dts: revision 1.10
sys/dev/fdt/fdt_port.c: revision 1.5
sys/dev/ic/dwc_mmc_var.h: revision 1.10
sys/dev/fdt/fdt_port.c: revision 1.6
sys/arch/evbarm/conf/GENERIC64: revision 1.122
sys/dev/ic/dwc_mmc_var.h: revision 1.11
sys/dev/fdt/files.fdt: revision 1.50
sys/arch/evbarm/conf/GENERIC64: revision 1.123
sys/arch/arm/rockchip/rk_i2s.c: revision 1.2
sys/arch/arm/rockchip/files.rockchip: revision 1.23
sys/arch/evbarm/conf/GENERIC64: revision 1.124
sys/dev/ic/anx_dp.c: revision 1.1

rkpmic: add RTC support; register w/ todr(9)
rkpmic: correct delay
Add support for SDIO interrupts.
fix copy/paste error in mux_pll_src_cpll_gpll_ppll_parents[]
add RK3399 eDP clocks
add RK3399 DisplayPort clocks
style fix/KNF
rk3399_cru: implement dclk_vop0_frac and dclk_vop1_frac
Move drm_encoder from rkvop(4) to the SoC-layer output pipe drivers (rk_dwhdmi).
rkvop: set stride using virtual framebuffer width instead of display mode
rk3399_cru: Reparent dclk_vop[01] to gpll via dclk_vop[01]_frac.
The previous source of dclk_vop[01] was vpll via dclk_vop[01]_div.
vpll is apparently used directly as a pixel clock source for the
HDMI PHY, and we don't want the other VOP's dclk changing out from
under it because we can't handle finding a replacement clock source
with the right rate yet.
gpll happens to run at 594MHz, which works well as a basis for pixel
clocks.
Linux suggests that the source clock of the fractional divider needs
to be more than twenty times greater than the resulting clock (or some
intermediate clock?) for output stability. This may not be the case
with 594MHz and the common pixel clocks I see used by displays in my
area of the wild, but it works for now.
add Analogix DisplayPort core driver
add Rockchip (RK3399) glue for Analogix DisplayPort core
add anxdp(4)
Add another panel@fdt driver, this time for DRM-style panels.
To do: migrate away from other panel driver.
enable panel at fdt drivers
paper over the rkpwm get_conf function that otherwise doesn't seem to
let things work
add template bits for optional eDP panel on RockPro64
Abort panel driver attach if required regulator is missing.
Add clk provider
Add Pinebook Pro dts, from Manjaro Linux.
https://gitlab.manjaro.org/tsys/linux-pinebook-pro/blob/877ca0e7283596f37845de50dc36bff5b88b91e1/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
+ rk3399-pinebook-pro.dts
Attach mmcpwrseq resource earlier
dwcmmc improvements:
- Use mmcpwrseq resources if available
- Only set 4- or 8-bit mode if specified in the dt properties
- Add quirk for implementations with inverted power enable logic
- Support switching signal voltage between 1.8V and 3.3V
- Fix a clock divider issue on Rockchip SoCs
Fix performance regression with previous
Quiet chatty printfs
No need to print all supported levels at attach, print the range and total number of steps
Disable SPI for now (rkspi driver hangs at boot)
Add driver for simple-audio-amplifier binding
Add driver for Everest Semi ES8316 Low Power Audio CODEC
add es8316, simpleamp
Avoid sleeping while the audio intr lock is held.
If the rockchip,system-power-controller property is present, try to power off with the PMIC
Add HAILUCK keyboard (product 1e)
Add a quirk for the HAILUCK USB keyboard / touchpad device with product 1e.
The keyboard does not function properly unless the touchpad's intr endpoint
is active.
Add driver for CellWise CW2015 Fuel Gauge IC.
add cwfg
Emit PMFE_DISPLAY_{ON,OFF} events in response to DPMS requests.
If the backlight node does not have an enable gpio, set the lowest duty
cycle to turn the display off instead.
Attach psci as early as possible. This allows other power controllers to
register their own poweroff / reset callbacks with a higher preference.
Add 2000 MHz to available armclkb rates
Remove debug printfs
 1.8.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.12.2.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.13.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.13.2.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.14.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.19 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.18 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.17 30-Jan-2021  thorpej Add standard compat strings from the Device Tree bindings.
 1.16 02-Jan-2020  thorpej branches: 1.16.8;
- No need to use I2C_F_POLL here.
- Correctly propagate errors up the stack.
 1.15 16-Jun-2018  thorpej branches: 1.15.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.14 20-Nov-2014  christos branches: 1.14.18;
use the inline bcdtobin and bintobcd directly instead through a macro.
 1.13 29-Jun-2014  tsutsui Use todr_[gs]ettime_ymdhms functions that handle ymdhms format properly.

Compile test only.
 1.12 21-Jan-2012  nonaka branches: 1.12.6; 1.12.20;
fix my license notice.
 1.11 28-May-2011  phx branches: 1.11.4; 1.11.8;
Add direct config support for all devices used by sandpoint.
 1.10 12-Dec-2009  tsutsui branches: 1.10.4; 1.10.6;
Remove `volatile' qualifier from argument types of
struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.

XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
 1.9 04-May-2008  xtraeme device_t/softc split and other related cosmetic changes.
 1.8 06-Apr-2008  cegger branches: 1.8.2; 1.8.4;
use aprint_*_dev and device_xname
 1.7 11-Dec-2007  lukem branches: 1.7.8;
use __KERNEL_RCSID()
 1.6 04-Sep-2006  gdamore branches: 1.6.28; 1.6.38; 1.6.40; 1.6.42;
Remove unused todr_setcal/todr_getcal and all the assorted stub
implementations.
 1.5 29-Mar-2006  thorpej branches: 1.5.6;
Use device_private().
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10; 1.4.12;
merge ktrace-lwp.
 1.3 22-Oct-2005  nonaka branches: 1.3.4;
Use I2C_OP_{READ,WRITE}_WITH_STOP instead of I2C_OP_{READ,WRITE}.
 1.2 16-Aug-2005  nonaka branches: 1.2.2;
Initialize CONTROL1 registers.
 1.1 16-Aug-2005  nonaka Added RICOH RS5C372[AB] Real Time Clock.
 1.2.2.1 26-Oct-2005  yamt sync with head
 1.3.4.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.4.1 22-Oct-2005  skrll file rs5c372.c was added on branch ktrace-lwp on 2005-11-10 14:04:00 +0000
 1.4.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.4.10.1 19-Apr-2006  elad sync with head.
 1.4.8.2 14-Sep-2006  yamt sync with head.
 1.4.8.1 01-Apr-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.6.4 21-Jan-2008  yamt sync with head
 1.5.6.3 30-Dec-2006  yamt sync with head.
 1.5.6.2 21-Jun-2006  yamt sync with head.
 1.5.6.1 29-Mar-2006  yamt file rs5c372.c was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.6.42.1 13-Dec-2007  bouyer Sync with HEAD
 1.6.40.1 11-Dec-2007  yamt sync with head.
 1.6.38.1 26-Dec-2007  ad Sync with head.
 1.6.28.1 09-Jan-2008  matt sync with HEAD
 1.7.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.4.2 11-Mar-2010  yamt sync with head
 1.8.4.1 16-May-2008  yamt sync with head.
 1.8.2.1 18-May-2008  yamt sync with head.
 1.10.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.4.1 31-May-2011  rmind sync with head
 1.11.8.1 18-Feb-2012  mrg merge to -current.
 1.11.4.1 17-Apr-2012  yamt sync with head
 1.12.20.1 10-Aug-2014  tls Rebase.
 1.12.6.2 03-Dec-2017  jdolecek update from HEAD
 1.12.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.18.1 25-Jun-2018  pgoyette Sync with HEAD
 1.15.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.16.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3 21-Jan-2012  nonaka fix my license notice.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.112; 1.2.116;
merge ktrace-lwp.
 1.1 16-Aug-2005  nonaka branches: 1.1.6;
Added RICOH RS5C372[AB] Real Time Clock.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 16-Aug-2005  skrll file rs5c372reg.h was added on branch ktrace-lwp on 2005-11-10 14:04:00 +0000
 1.2.116.1 18-Feb-2012  mrg merge to -current.
 1.2.112.1 17-Apr-2012  yamt sync with head
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file rs5c372reg.h was added on branch yamt-lazymbuf on 2006-06-21 15:02:51 +0000
 1.9 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.8 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.7 30-Jan-2021  thorpej Add the standard compat string from the Device Tree bindings.
 1.6 02-Jan-2020  thorpej branches: 1.6.8;
Use todr_gettime_ymdhms / todr_settime_ymdhms.
 1.5 02-Jan-2020  thorpej - No need to use I2C_F_POLL here.
- Correctly propagate errors up the stack.
 1.4 16-Jun-2018  thorpej branches: 1.4.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.3 20-Nov-2014  christos branches: 1.3.18;
use the inline bcdtobin and bintobcd directly instead through a macro.
 1.2 28-May-2011  phx branches: 1.2.4; 1.2.16;
Add direct config support for all devices used by sandpoint.
 1.1 04-Apr-2011  phx branches: 1.1.2;
s390rtc(4), an RTC driver for the Seiko Instruments S-35390A chip.
 1.1.2.3 31-May-2011  rmind sync with head
 1.1.2.2 21-Apr-2011  rmind sync with head
 1.1.2.1 04-Apr-2011  rmind file s390.c was added on branch rmind-uvmplock on 2011-04-21 01:41:46 +0000
 1.2.16.1 03-Dec-2017  jdolecek update from HEAD
 1.2.4.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.4.1 28-May-2011  jruoho file s390.c was added on branch jruoho-x86intr on 2011-06-06 09:07:50 +0000
 1.3.18.1 25-Jun-2018  pgoyette Sync with HEAD
 1.4.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.6.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1 04-Apr-2011  phx branches: 1.1.2; 1.1.6;
s390rtc(4), an RTC driver for the Seiko Instruments S-35390A chip.
 1.1.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.6.1 04-Apr-2011  jruoho file s390reg.h was added on branch jruoho-x86intr on 2011-06-06 09:07:50 +0000
 1.1.2.2 21-Apr-2011  rmind sync with head
 1.1.2.1 04-Apr-2011  rmind file s390reg.h was added on branch rmind-uvmplock on 2011-04-21 01:41:46 +0000
 1.3 12-Sep-2025  thorpej Support direct configuration via device tree.
 1.2 30-Mar-2022  pgoyette These modules need to depend on iic, not just on i2cexec. (They will
still recursively get i2cexec since the iic depends on it.)

Partial fix for kern/56772
 1.1 07-Dec-2021  brad A driver and user land utility for the Sparkfun Serial Controlled Motor
Driver module as illustrated here:

https://www.sparkfun.com/products/13911

A SCMD module is a ARM SOC simular to a Arduino in front of a motor
driver chip. The single SCMD module can control two motors and up to
16 additional modules can be chained together using an internal I2C
bus. One can interface with the SCMD using tty uart commands, SPI or
I2C. The driver in this commit adds a kernel driver for the I2C and
SPI interfaces. The command line utility provides a set of
convenience commands that support most of the functions of the SCMD
and is able to use the tty uart mode, SPI user land or the included
kernel driver in a uniform manor.

The use of the SCMD module is mostly for small robots and the like,
but it can control anything that is controllable by voltage.
 1.41 01-Dec-2021  msaitoh Use aprint_debug instead of aprint_error for expected failure.
 1.40 13-Jun-2021  mlelstv Clear sc_sme pointer to avoid double free.
 1.39 30-Jun-2020  msaitoh branches: 1.39.6;
If an error occurred in sme_refresh function, pass ENVSYS_SINVALID.
OK'd by pgoyette.
 1.38 29-Jun-2020  msaitoh Check the return value of iic_acquire_bus(). This function may fail.

One of the case is driver's detaching phase on shutdown. mutex_tryenter()
might fail and return with EBUSY. To avoid calling iic_release_bus() without
taking lock, check the return value of iic_acquire_bus().
 1.37 29-Jun-2020  msaitoh KNF. No functional change.
 1.36 01-Oct-2019  chs in many device attach paths, allocate memory with KM_SLEEP instead of KM_NOSLEEP
and remove code to handle failures that can no longer happen.
 1.35 28-Feb-2019  khorben branches: 1.35.4;
Typo (s/vaule/value/)
 1.34 16-Jun-2018  thorpej branches: 1.34.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.33 22-Feb-2018  msaitoh branches: 1.33.2;
- Add Maxim MAX6604.
- Microchip EMC1501.
- ADT7408's device ID is not 0x80 but 0x08.
 1.32 03-Aug-2016  msaitoh branches: 1.32.8;
IDT's TSE2002GB2 has the same ID as TS3000GB2, so remove TSE2002GB2.
 1.31 28-Jul-2016  msaitoh Add JEDEC TSE2004av support. OK'ed by pgoyette. If a device conforms
TES2004av, it can be used without adding new entry into the matching
table.
 1.30 27-Jul-2016  msaitoh Print device ID with 8bits again (revert part of rev. 1.27) because
the revision field also printed next.
 1.29 26-Jul-2016  msaitoh Move functions to make module related code at the bottom of this file.
 1.28 26-Jul-2016  msaitoh Reviewed and OK'd by pgoyette:
- Add support for Atmel AT30TS00, AT30TSE004, Giantec GT30TS00, GT34TS02,
Microchip MCP9804, MCP98244, IDT TS3000GB[02], TS3001GB2, TSE2004GB2,
and On Semiconductor CAT34TS04. Taken from OpenBSD.
- Add IDT TSE2002GB2.
- Check the temperature resolution field in the capability register instead
of the hard coded value in the match table. With this change, some devices'
temperature resolution would be fixed.
- The resolution register is a vendor specific register.
- All of IDT devices have the resolution register.
- The address of the resolution register of Microchip MCP98244 is different
from other Microchip devices.
- Show accuracy, range, resolution, high voltage standoff and shutdown with
aprint_normal().
- Show timeout with aprint_debug().
 1.27 26-Jul-2016  msaitoh - Print device ID in 16bits instead of 8bits in aprint_debug().
- s/STTS2002/STTS2004/ for STTS2004.
 1.26 20-May-2015  msaitoh branches: 1.26.2;
Add Catalyst CAT34TS02C support.
 1.25 23-Apr-2015  pgoyette Update module dependencies for all the existing modules that depend on sysmon components.
 1.24 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.23 09-Jan-2014  mlelstv branches: 1.23.4; 1.23.6;
add three temperature sensors from ST.
 1.22 22-Jul-2013  soren Use the standard i2c address to DIMM slot mapping to show the slot number.
 1.21 02-Feb-2012  pgoyette branches: 1.21.6; 1.21.10; 1.21.18;
Clean up display of initial hardware provided limits. No functional change.
 1.20 02-Oct-2011  jmcneill branches: 1.20.2; 1.20.6;
now that iic is a module, add "iic" dependency to iic drivers
 1.19 31-Jul-2011  jmcneill add detach support, modularize, build with WARNS=4
 1.18 29-Jul-2010  pgoyette When interpreting the alarm bits from the chip, don't report state for
any thresholds which have not been set. Fixes problem reported by
njoly@ in private E-mail, where chip was initialized with only a Critical
threshold, but was reporting a warning.
 1.17 29-Jul-2010  njoly Cleanup hardware monitor limits retrieval. Do use the softc variables
to be filled by sdtemp_get_limits() directly.

ok pgoyette.
 1.16 28-Jul-2010  pgoyette Fix a typo (missing digit) in chip name table.
 1.15 11-Jul-2010  pgoyette Add another pair of chips to the pile: IDT TS3000B3 & TSE2002B3
 1.14 08-Jul-2010  pgoyette Add additional chip IDs, and be more specific about which revs we match.

From Guenter Roeck on a Linux mailing list.
 1.13 10-Apr-2010  pgoyette Save initial, boot-time limit values, and restore them upon request
from sysmon_envsys(9).
 1.12 14-Mar-2010  pgoyette branches: 1.12.2;
Remove setting of edata->monitor since that member no longer exists.
 1.11 24-Feb-2010  dyoung A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.10 14-Feb-2010  pgoyette Adapt to changes in sysmon's limit structure
 1.9 08-Jan-2010  dyoung branches: 1.9.2;
Expand PMF_FN_* macros.
 1.8 01-Jan-2010  pgoyette Explicitly inform envsys that the driver is capable of doing its own
limit checking at initialization time. Later on, if user specifics any
unsupported limits, the driver will relinquish this task.
 1.7 10-Jul-2009  pgoyette Correct usage of PROP_DRIVER_LIMITS flag
 1.6 14-Jun-2009  pgoyette Update {get,set}_limits() routines.
 1.5 13-Jun-2009  pgoyette No need to set flag=I2C_F_POLL when releasing the bus. Pointed out
in private Email from njoly@
 1.4 13-Jun-2009  pgoyette Update sdtemp driver to use sysmon_envsys(9) for setting temp sensor
limits. Remove sysctl(9) interface to the limit registers since it's
no longer needed.
 1.3 01-Jun-2009  pgoyette Since we no longer have individual events for each sensor value limit,
we don't need individual flag bits. Clean up extra bit definitions.
Bump kernel version - welcome to 5.99.13
 1.2 19-May-2009  pgoyette When displaying boot-time trip-register settings, shift to exclude
fractional bits. Otherwise, a setting of 52C reports 832 during
boot, and that's way too hot for any memory!
 1.1 09-May-2009  pgoyette branches: 1.1.2; 1.1.4;
Initial implementation of sdtemp(4) driver for on-DIMM temp sensor.

(These optional sensors are specified by JEDEC Standard No. 21-C
Section 4-7 and implemented by multiple vendors. Tested on my
amd64 machine with Kingston KVR1066D3E7S/2G memory which includes
a STMicro STTS424E02 sensor.)
 1.1.4.6 11-Aug-2010  yamt sync with head.
 1.1.4.5 11-Mar-2010  yamt sync with head
 1.1.4.4 18-Jul-2009  yamt sync with head.
 1.1.4.3 20-Jun-2009  yamt sync with head
 1.1.4.2 16-May-2009  yamt sync with head
 1.1.4.1 09-May-2009  yamt file sdtemp.c was added on branch yamt-nfs-mp on 2009-05-16 10:41:21 +0000
 1.1.2.3 23-Jul-2009  jym Sync with HEAD.
 1.1.2.2 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.2.1 09-May-2009  jym file sdtemp.c was added on branch jym-xensuspend on 2009-05-13 17:19:21 +0000
 1.9.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.9.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.12.2.2 05-Mar-2011  rmind sync with head
 1.12.2.1 30-May-2010  rmind sync with head
 1.20.6.1 18-Feb-2012  mrg merge to -current.
 1.20.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.20.2.1 17-Apr-2012  yamt sync with head
 1.21.18.1 23-Jul-2013  riastradh sync with HEAD
 1.21.10.2 18-May-2014  rmind sync with head
 1.21.10.1 28-Aug-2013  rmind sync with head
 1.21.6.2 03-Dec-2017  jdolecek update from HEAD
 1.21.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.6.3 05-Oct-2016  skrll Sync with HEAD
 1.23.6.2 06-Jun-2015  skrll Sync with HEAD
 1.23.6.1 06-Apr-2015  skrll Sync with HEAD
 1.23.4.2 08-Dec-2016  snj Pull up following revision(s) (requested by msaitoh in ticket #1286):
sys/dev/i2c/sdtemp.c: revisions 1.26-1.32 via patch
sys/dev/i2c/sdtemp_reg.h: revisions 1.8-1.12
share/man/man4/sdtemp.4: revisions1.5-1.6
Changes for sdtemp(4):
- Add support for Atmel AT30TS00, AT30TSE004, Giantec GT30TS00,
GT34TS02, Microchip MCP9804, MCP98244, IDT TS3000GB[02], TS3001GB2,
TSE2004GB2, On Semiconductor CAT34TS02C and CAT34TS04.
- Add JEDEC TSE2004av support. If a device conforms TES2004av, it can
be used without adding new entry into the matching table.
- Check the temperature resolution field in the capability register
instead of the hard coded value in the match table. With this change,
some devices' temperature resolution would be fixed.
- The resolution register is a vendor specific register.
- All of IDT devices have the resolution register.
- The address of the resolution register of Microchip MCP98244 is
different from other Microchip devices.
- Show accuracy, range, resolution, high voltage standoff and shutdown.
- Show timeout with AB_DEBUG.
- Fix dmesg of STTS2004.
 1.23.4.1 21-Mar-2015  snj branches: 1.23.4.1.4;
Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.23.4.1.4.1 18-Jan-2017  skrll Sync with netbsd-5
 1.26.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.32.8.3 06-Dec-2021  martin Pull up following revision(s) (requested by msaitoh in ticket #1716):

sys/dev/i2c/sdtemp.c: revision 1.41

Use aprint_debug instead of aprint_error for expected failure.
 1.32.8.2 20-Jul-2020  martin Pull up the following revisions, requested by msaitoh in ticket #1580:

sys/dev/i2c/sdtemp.c 1.35, 1.37-1.39

- Check the return value of iic_acquire_bus() because this function
may fail.
- Fix typo in comment.
- KNF.
 1.32.8.1 08-Mar-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #615):
share/man/man4/sdtemp.4: revision 1.7-1.8
sys/dev/i2c/sdtemp_reg.h: revision 1.13
sys/dev/i2c/sdtemp.c: revision 1.33

- Add another device ID of Maxim MAX6604.

- Add Microchip EMC1501.

- ADT7408's device ID is not 0x80 but 0x08.

Add Microchip EMC1501.

Remove unnecessary macros.
 1.33.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.34.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.34.2.1 10-Jun-2019  christos Sync with HEAD
 1.35.4.2 06-Dec-2021  martin Pull up following revision(s) (requested by msaitoh in ticket #1387):

sys/dev/i2c/sdtemp.c: revision 1.41

Use aprint_debug instead of aprint_error for expected failure.
 1.35.4.1 10-Jul-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #992):

sys/dev/i2c/sdtemp.c: revision 1.37
sys/dev/i2c/sdtemp.c: revision 1.38
sys/dev/i2c/sdtemp.c: revision 1.39

KNF. No functional change.

Check the return value of iic_acquire_bus(). This function may fail.

One of the case is driver's detaching phase on shutdown. mutex_tryenter()
might fail and return with EBUSY. To avoid calling iic_release_bus() without
taking lock, check the return value of iic_acquire_bus().

If an error occurred in sme_refresh function, pass ENVSYS_SINVALID.
OK'd by pgoyette.
 1.39.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.13 22-Feb-2018  msaitoh - Add Maxim MAX6604.
- Microchip EMC1501.
- ADT7408's device ID is not 0x80 but 0x08.
 1.12 07-Dec-2016  nonaka branches: 1.12.8;
Device ID 0xa01 also matches Catalyst CAT34TS02C.

Found on SMD-N8G28CTP-18ML-BK.
 1.11 03-Aug-2016  msaitoh IDT's TSE2002GB2 has the same ID as TS3000GB2, so remove TSE2002GB2.
 1.10 28-Jul-2016  msaitoh Add JEDEC TSE2004av support. OK'ed by pgoyette. If a device conforms
TES2004av, it can be used without adding new entry into the matching
table.
 1.9 26-Jul-2016  msaitoh Reviewed and OK'd by pgoyette:
- Add support for Atmel AT30TS00, AT30TSE004, Giantec GT30TS00, GT34TS02,
Microchip MCP9804, MCP98244, IDT TS3000GB[02], TS3001GB2, TSE2004GB2,
and On Semiconductor CAT34TS04. Taken from OpenBSD.
- Add IDT TSE2002GB2.
- Check the temperature resolution field in the capability register instead
of the hard coded value in the match table. With this change, some devices'
temperature resolution would be fixed.
- The resolution register is a vendor specific register.
- All of IDT devices have the resolution register.
- The address of the resolution register of Microchip MCP98244 is different
from other Microchip devices.
- Show accuracy, range, resolution, high voltage standoff and shutdown with
aprint_normal().
- Show timeout with aprint_debug().
 1.8 20-May-2015  msaitoh branches: 1.8.2;
Add Catalyst CAT34TS02C support.
 1.7 09-Jan-2014  mlelstv branches: 1.7.4; 1.7.6; 1.7.10;
add three temperature sensors from ST.
 1.6 07-Aug-2013  soren Allow i2c addr wildcard matching. Use with care!
 1.5 12-Jul-2010  pgoyette branches: 1.5.8; 1.5.18; 1.5.22;
Fix typo.
 1.4 11-Jul-2010  pgoyette Add another pair of chips to the pile: IDT TS3000B3 & TSE2002B3
 1.3 08-Jul-2010  pgoyette Add additional chip IDs, and be more specific about which revs we match.

From Guenter Roeck on a Linux mailing list.
 1.2 13-Jun-2009  pgoyette branches: 1.2.2; 1.2.4;
Update sdtemp driver to use sysmon_envsys(9) for setting temp sensor
limits. Remove sysctl(9) interface to the limit registers since it's
no longer needed.
 1.1 09-May-2009  pgoyette branches: 1.1.2; 1.1.4;
Initial implementation of sdtemp(4) driver for on-DIMM temp sensor.

(These optional sensors are specified by JEDEC Standard No. 21-C
Section 4-7 and implemented by multiple vendors. Tested on my
amd64 machine with Kingston KVR1066D3E7S/2G memory which includes
a STMicro STTS424E02 sensor.)
 1.1.4.4 11-Aug-2010  yamt sync with head.
 1.1.4.3 20-Jun-2009  yamt sync with head
 1.1.4.2 16-May-2009  yamt sync with head
 1.1.4.1 09-May-2009  yamt file sdtemp_reg.h was added on branch yamt-nfs-mp on 2009-05-16 10:41:21 +0000
 1.1.2.3 23-Jul-2009  jym Sync with HEAD.
 1.1.2.2 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.2.1 09-May-2009  jym file sdtemp_reg.h was added on branch jym-xensuspend on 2009-05-13 17:19:21 +0000
 1.2.4.1 05-Mar-2011  rmind sync with head
 1.2.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.5.22.2 18-May-2014  rmind sync with head
 1.5.22.1 28-Aug-2013  rmind sync with head
 1.5.18.2 03-Dec-2017  jdolecek update from HEAD
 1.5.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.10.1 18-Jan-2017  skrll Sync with netbsd-5
 1.7.6.3 05-Feb-2017  skrll Sync with HEAD
 1.7.6.2 05-Oct-2016  skrll Sync with HEAD
 1.7.6.1 06-Jun-2015  skrll Sync with HEAD
 1.7.4.1 08-Dec-2016  snj Pull up following revision(s) (requested by msaitoh in ticket #1286):
sys/dev/i2c/sdtemp.c: revisions 1.26-1.32 via patch
sys/dev/i2c/sdtemp_reg.h: revisions 1.8-1.12
share/man/man4/sdtemp.4: revisions1.5-1.6
Changes for sdtemp(4):
- Add support for Atmel AT30TS00, AT30TSE004, Giantec GT30TS00,
GT34TS02, Microchip MCP9804, MCP98244, IDT TS3000GB[02], TS3001GB2,
TSE2004GB2, On Semiconductor CAT34TS02C and CAT34TS04.
- Add JEDEC TSE2004av support. If a device conforms TES2004av, it can
be used without adding new entry into the matching table.
- Check the temperature resolution field in the capability register
instead of the hard coded value in the match table. With this change,
some devices' temperature resolution would be fixed.
- The resolution register is a vendor specific register.
- All of IDT devices have the resolution register.
- The address of the resolution register of Microchip MCP98244 is
different from other Microchip devices.
- Show accuracy, range, resolution, high voltage standoff and shutdown.
- Show timeout with AB_DEBUG.
- Fix dmesg of STTS2004.
 1.8.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.8.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.12.8.1 08-Mar-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #615):
share/man/man4/sdtemp.4: revision 1.7-1.8
sys/dev/i2c/sdtemp_reg.h: revision 1.13
sys/dev/i2c/sdtemp.c: revision 1.33

- Add another device ID of Maxim MAX6604.

- Add Microchip EMC1501.

- ADT7408's device ID is not 0x80 but 0x08.

Add Microchip EMC1501.

Remove unnecessary macros.
 1.1 14-Oct-2021  brad A driver for the Sensirion SGP40 MOx gas sensor. An example of this
chip from Adafruit is:

https://www.adafruit.com/product/4829

This is a moderately priced gas sensor that can detect volatile
organic compounds in the air. The driver uses the 3-clause BSD
licensed VOC algorithm provided by Sensirion to turn the raw sensor
metric into a VOC index which can indicate the quality of the air in a
particular indoor environment. All published functions of the chip
are supported and one unpublished feature.
 1.2 18-Oct-2021  christos Fix llvm build: error: equality comparison with extraneous parentheses
[-Werror,-Wparentheses-equality]
 1.1 14-Oct-2021  brad A driver for the Sensirion SGP40 MOx gas sensor. An example of this
chip from Adafruit is:

https://www.adafruit.com/product/4829

This is a moderately priced gas sensor that can detect volatile
organic compounds in the air. The driver uses the 3-clause BSD
licensed VOC algorithm provided by Sensirion to turn the raw sensor
metric into a VOC index which can indicate the quality of the air in a
particular indoor environment. All published functions of the chip
are supported and one unpublished feature.
 1.2 25-Sep-2022  andvar s/inerrupt/interrupt/ and s/intrrupt/interrupt/ in comments.
 1.1 14-Oct-2021  brad A driver for the Sensirion SGP40 MOx gas sensor. An example of this
chip from Adafruit is:

https://www.adafruit.com/product/4829

This is a moderately priced gas sensor that can detect volatile
organic compounds in the air. The driver uses the 3-clause BSD
licensed VOC algorithm provided by Sensirion to turn the raw sensor
metric into a VOC index which can indicate the quality of the air in a
particular indoor environment. All published functions of the chip
are supported and one unpublished feature.
 1.5 24-May-2022  andvar fix various typos in comments, docs and log messages.
 1.4 22-May-2022  andvar fix various small typos, mainly in comments.
 1.3 30-Mar-2022  pgoyette These modules need to depend on iic, not just on i2cexec. (They will
still recursively get i2cexec since the iic depends on it.)

Partial fix for kern/56772
 1.2 20-Oct-2021  christos - fix clang compilation: add "%s" to format string
- comma is followed by space
- KNF multi-line comments
- fold long lines
- early returns, fixes a missed iic_release_bus() on error.
- foo == false -> !foo
 1.1 14-Oct-2021  brad A driver for the Sensirion SGP40 MOx gas sensor. An example of this
chip from Adafruit is:

https://www.adafruit.com/product/4829

This is a moderately priced gas sensor that can detect volatile
organic compounds in the air. The driver uses the 3-clause BSD
licensed VOC algorithm provided by Sensirion to turn the raw sensor
metric into a VOC index which can indicate the quality of the air in a
particular indoor environment. All published functions of the chip
are supported and one unpublished feature.
 1.1 14-Oct-2021  brad A driver for the Sensirion SGP40 MOx gas sensor. An example of this
chip from Adafruit is:

https://www.adafruit.com/product/4829

This is a moderately priced gas sensor that can detect volatile
organic compounds in the air. The driver uses the 3-clause BSD
licensed VOC algorithm provided by Sensirion to turn the raw sensor
metric into a VOC index which can indicate the quality of the air in a
particular indoor environment. All published functions of the chip
are supported and one unpublished feature.
 1.1 14-Oct-2021  brad A driver for the Sensirion SGP40 MOx gas sensor. An example of this
chip from Adafruit is:

https://www.adafruit.com/product/4829

This is a moderately priced gas sensor that can detect volatile
organic compounds in the air. The driver uses the 3-clause BSD
licensed VOC algorithm provided by Sensirion to turn the raw sensor
metric into a VOC index which can indicate the quality of the air in a
particular indoor environment. All published functions of the chip
are supported and one unpublished feature.
 1.11 18-May-2024  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.10 30-Jan-2021  thorpej Add a proper compat string for this device, following the standard
conventions.
 1.9 16-Jun-2018  thorpej branches: 1.9.16;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.8 22-Sep-2017  macallan branches: 1.8.2;
use direct config
 1.7 13-Nov-2010  uebayasi branches: 1.7.18;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.6 01-Aug-2008  macallan branches: 1.6.16;
fix incomplete device_t-ification
Now it works again.
 1.5 08-May-2008  macallan branches: 1.5.4;
nuke clause 3
 1.4 04-May-2008  xtraeme branches: 1.4.2;
device_t/softc split and other related cosmetic changes.
 1.3 06-Apr-2008  cegger branches: 1.3.2; 1.3.4;
use aprint_*_dev and device_xname
 1.2 02-Sep-2007  macallan branches: 1.2.20;
don't include machine/autoconf.h - we don't need it (anymore?)
 1.1 17-Jan-2007  macallan branches: 1.1.2; 1.1.6; 1.1.10; 1.1.18; 1.1.22; 1.1.24;
driver for the SGS 7433 mixer found in some G3 macs
 1.1.24.1 06-Nov-2007  matt sync with HEAD
 1.1.22.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.1.18.1 03-Sep-2007  skrll Sync with HEAD.
 1.1.10.1 09-Oct-2007  ad Sync with head.
 1.1.6.3 03-Sep-2007  yamt sync with head.
 1.1.6.2 26-Feb-2007  yamt sync with head.
 1.1.6.1 17-Jan-2007  yamt file sgsmix.c was added on branch yamt-lazymbuf on 2007-02-26 09:10:04 +0000
 1.1.2.2 01-Feb-2007  ad Sync with head.
 1.1.2.1 17-Jan-2007  ad file sgsmix.c was added on branch newlock2 on 2007-02-01 08:48:17 +0000
 1.2.20.2 28-Sep-2008  mjf Sync with HEAD.
 1.2.20.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.4.2 04-May-2009  yamt sync with head.
 1.3.4.1 16-May-2008  yamt sync with head.
 1.3.2.1 18-May-2008  yamt sync with head.
 1.4.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.5.4.1 19-Oct-2008  haad Sync with HEAD.
 1.6.16.1 05-Mar-2011  rmind sync with head
 1.7.18.1 03-Dec-2017  jdolecek update from HEAD
 1.8.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.9.16.1 03-Apr-2021  thorpej Sync with HEAD.
 1.4 16-Apr-2020  rin Revert previous for now:
http://mail-index.netbsd.org/source-changes/2020/04/16/msg116278.html

The reasoning turned out to be wrong; __KERNEL_RCSID() in header files
does *not* overwrite RCSID in main source files. The real problem is that
it inserts its RCSID into *every* object files. However, it can be still
useful even if heavily duplicated.
 1.3 16-Apr-2020  rin Stop using __KERNEL_RCSID() in header files; it confuses ident(1) by
overwriting RCSID in main source files.

XXX
The first argument of __KERNEL_RCSID() is neglected for ELF. If we wish
to have RCSID of header files in kernel binary, we need something like
__FBSDID() macro in FreeBSD.
 1.2 08-May-2008  macallan branches: 1.2.98;
nuke clause 3
 1.1 17-Jan-2007  macallan branches: 1.1.2; 1.1.6; 1.1.44; 1.1.46; 1.1.48; 1.1.50;
driver for the SGS 7433 mixer found in some G3 macs
 1.1.50.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.1.48.1 16-May-2008  yamt sync with head.
 1.1.46.1 18-May-2008  yamt sync with head.
 1.1.44.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.6.2 26-Feb-2007  yamt sync with head.
 1.1.6.1 17-Jan-2007  yamt file sgsmixvar.h was added on branch yamt-lazymbuf on 2007-02-26 09:10:04 +0000
 1.1.2.2 01-Feb-2007  ad Sync with head.
 1.1.2.1 17-Jan-2007  ad file sgsmixvar.h was added on branch newlock2 on 2007-02-01 08:48:17 +0000
 1.2.98.1 20-Apr-2020  bouyer Sync with HEAD
 1.10 23-Jan-2025  brad The SHT3x temperature and humidity sensor has a set of commands that
can do the measurement by using I2C clock stretching in single shot
mode. Add a sysctl to allow the driver to use those commands. This
is more efficient than doing the usual polling method of getting the
measurements back from the chip, but only works if the I2C master
supports clock stretching.
 1.9 08-Jan-2025  andvar s/peridoic/periodic/ in sysctl description and one more typo fix in comment.
 1.8 07-Nov-2024  brad The SHT3X_READ_SERIAL_NUMBER command on the SHT3x sensors is
undocumented, but used in a lot of other drivers. When I wrote the
driver it didn't seem like it needed any sort of delay, and that was
true if the I2C bus is short. However, when the I2C bus is extended
out to a great length using active terminators, or some such, you
won't get any data back from the SHT3X_READ_SERIAL_NUMBER command as
you will try to read from the bus before the data is there. The SHT3X
device works this way.. you can't start reading back data too soon
after issuing a command to the device. So, add a delay like the other
commands. The amount of delay was estimated based upon field
observation.
 1.7 27-Apr-2022  brad branches: 1.7.10;


After testing with a couple of more samples of the SHT3x sensor chip
it was found that the datasheet does not appear to provide enough
information to make use of the alarm and interrupt function work. So
actually remove the dead code that was an attempt at making that all
work. Adjust the man page to mention that this.
 1.6 31-Mar-2022  pgoyette For device modules that provide both auto-config and /dev/xxx
interfaces, make sure that initialization and destruction
follow the proper sequence. This is triggered by the recent
changes to the devsw stuff; per riastradh@ the required call
sequence is:

devsw_attach()
config_init_component() or config_cf*_attach()
...
config_fini_component() or config_cf*_detach()
devsw_detach()

While here, add a few missing calls to some of the detach
routines.

Testing of these changes has been limited to:
1. compile without build break
2. no related test failures from atf
3. modload/modunload work as well as
before.

No functional device testing done, since I don't have any
of these devices. Let me know of any damage I might cause
here!

XXX Some of the modules affected by this commit are already
XXX broken; see kern/56772. This commit does not break
any additional modules (as far as I know).
 1.5 30-Mar-2022  pgoyette These modules need to depend on iic, not just on i2cexec. (They will
still recursively get i2cexec since the iic depends on it.)

Partial fix for kern/56772
 1.4 14-Nov-2021  brad Fix some regressions that were introduced.

One must make sure that you release the i2c bus if you acquire.

One must not try to release the i2c bus if you failed to acquire it.

One can't leave too early from the single-shot refresh without
checking the status register as there may have been a reset
and releasing the i2c bus.
 1.3 13-Nov-2021  christos Brad wants the __did_not_work code back :-)
 1.2 12-Nov-2021  christos simplify the code and remove unused (it is in CVS anyway). Try to merge
duplicate code. Follow KNF. Brad, please test!
 1.1 06-Nov-2021  brad Driver for the Sensirion SHT30/SHT31/SHT35 temperature and humidity
sensor such as:

https://www.adafruit.com/product/2857

This is a higher priced sensor with a lot of features, including the
ability to do sub-second periodic updates. The driver supports
everything about the sensor except for the alert pin.
 1.7.10.1 02-Aug-2025  perseant Sync with HEAD
 1.4 02-Feb-2024  andvar fix various typos in comments.
 1.3 28-May-2022  andvar fix various typos, mainly in comments.
 1.2 27-Apr-2022  brad After testing with a couple of more samples of the SHT3x sensor chip
it was found that the datasheet does not appear to provide enough
information to make use of the alarm and interrupt function work. So
actually remove the dead code that was an attempt at making that all
work. Adjust the man page to mention that this.
 1.1 06-Nov-2021  brad Driver for the Sensirion SHT30/SHT31/SHT35 temperature and humidity
sensor such as:

https://www.adafruit.com/product/2857

This is a higher priced sensor with a lot of features, including the
ability to do sub-second periodic updates. The driver supports
everything about the sensor except for the alert pin.
 1.2 23-Jan-2025  brad The SHT3x temperature and humidity sensor has a set of commands that
can do the measurement by using I2C clock stretching in single shot
mode. Add a sysctl to allow the driver to use those commands. This
is more efficient than doing the usual polling method of getting the
measurements back from the chip, but only works if the I2C master
supports clock stretching.
 1.1 06-Nov-2021  brad branches: 1.1.10;


Driver for the Sensirion SHT30/SHT31/SHT35 temperature and humidity
sensor such as:

https://www.adafruit.com/product/2857

This is a higher priced sensor with a lot of features, including the
ability to do sub-second periodic updates. The driver supports
everything about the sensor except for the alert pin.
 1.1.10.1 02-Aug-2025  perseant Sync with HEAD
 1.3 30-Mar-2022  pgoyette These modules need to depend on iic, not just on i2cexec. (They will
still recursively get i2cexec since the iic depends on it.)

Partial fix for kern/56772
 1.2 29-Oct-2021  brad Correct an off by one degree error in the temperature conversion.
 1.1 03-Oct-2021  brad A driver for the Sensirion SHT40/SHT41/SHT45 temperature and humidity
sensor. An example of this chip is:

https://www.adafruit.com/product/4885

This is a lower cost chip that provides higher then usual precision
according to the data sheet. This driver supports all of the published
functions that the chip has.
 1.2 24-May-2022  andvar fix various typos in comments, docs and log messages.
 1.1 03-Oct-2021  brad A driver for the Sensirion SHT40/SHT41/SHT45 temperature and humidity
sensor. An example of this chip is:

https://www.adafruit.com/product/4885

This is a lower cost chip that provides higher then usual precision
according to the data sheet. This driver supports all of the published
functions that the chip has.
 1.1 03-Oct-2021  brad A driver for the Sensirion SHT40/SHT41/SHT45 temperature and humidity
sensor. An example of this chip is:

https://www.adafruit.com/product/4885

This is a lower cost chip that provides higher then usual precision
according to the data sheet. This driver supports all of the published
functions that the chip has.
 1.12 23-Jan-2025  brad The SI70XX temperature and humidity sensor has a set of commands that
can do the measurement by using I2C clock stretching. Add a sysctl to
allow the driver to use those commands. This is more efficient than
doing the usual polling method of getting the measurements back from
the chip, but only works if the I2C master supports clock stretching.

Also... change the use of the Read without Stop with a command and
zero length read to just a Write of the command in the non-clock
stretching case. I was confused by the datasheet when I write the
driver initially. This allows the driver to work with more I2C
masters.

Also... there were a couple of cases where more bytes were read on
the bus than would be sent by the chip. Fix those. The second part
of the serial number only has 6 bytes not 8, the firmware version has
1 byte not 8.
 1.11 30-Mar-2022  pgoyette branches: 1.11.10;
These modules need to depend on iic, not just on i2cexec. (They will
still recursively get i2cexec since the iic depends on it.)

Partial fix for kern/56772
 1.10 12-Nov-2021  brad Fix the serial number handling of the HTU21D chip and probably others.
Increase the number of read attempts as the HTU21D and probably others
do not respond as fast the actual SI70xx chip can.
 1.9 11-Nov-2021  brad Some HTU21D chips do not have a heater register and apparently no
heater element. Disable the heater features in the driver when that
condition is detected and let the attachment succeed. Also mention
that the SHT21 is another clone.
 1.8 21-Aug-2021  andvar fix some more typos in comments/log messages, improve wording as well.
 1.7 15-Jun-2021  mlelstv avoid double-free
 1.6 05-Dec-2020  jdc branches: 1.6.4;
Make sure that we set sc->sc_sme to NULL in failure cases in order to avoid
calling sysmon_envsys_unregister() with an invalid struct when we detach.
 1.5 03-Feb-2019  mrg branches: 1.5.12;
add missing break.

fairly sure this is correct, otherwise modelstr would be overwritten
with the next entry in this list..
 1.4 16-Jun-2018  thorpej branches: 1.4.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.3 30-Dec-2017  christos branches: 1.3.2;
fixes from Brad Spenser
 1.2 29-Dec-2017  christos Fix modules build.
 1.1 28-Dec-2017  christos PR/52848: Brad Spencer: Two environment sensor drivers: AM2315 and SI70xx
XXX: Please check that my refactoring did not break them!
 1.3.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.4.2.1 10-Jun-2019  christos Sync with HEAD
 1.5.12.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.6.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.11.10.1 02-Aug-2025  perseant Sync with HEAD
 1.2 29-Dec-2017  christos add RCSID's
 1.1 28-Dec-2017  christos PR/52848: Brad Spencer: Two environment sensor drivers: AM2315 and SI70xx
XXX: Please check that my refactoring did not break them!
 1.4 23-Jan-2025  brad The SI70XX temperature and humidity sensor has a set of commands that
can do the measurement by using I2C clock stretching. Add a sysctl to
allow the driver to use those commands. This is more efficient than
doing the usual polling method of getting the measurements back from
the chip, but only works if the I2C master supports clock stretching.

Also... change the use of the Read without Stop with a command and
zero length read to just a Write of the command in the non-clock
stretching case. I was confused by the datasheet when I write the
driver initially. This allows the driver to work with more I2C
masters.

Also... there were a couple of cases where more bytes were read on
the bus than would be sent by the chip. Fix those. The second part
of the serial number only has 6 bytes not 8, the firmware version has
1 byte not 8.
 1.3 11-Nov-2021  brad branches: 1.3.10;


Some HTU21D chips do not have a heater register and apparently no
heater element. Disable the heater features in the driver when that
condition is detected and let the attachment succeed. Also mention
that the SHT21 is another clone.
 1.2 29-Dec-2017  christos add RCSID's
 1.1 28-Dec-2017  christos PR/52848: Brad Spencer: Two environment sensor drivers: AM2315 and SI70xx
XXX: Please check that my refactoring did not break them!
 1.3.10.1 02-Aug-2025  perseant Sync with HEAD
 1.3 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.2 20-Jun-2011  pgoyette branches: 1.2.52;
Initialize sensor state before registering.

XXX Still need to fix i2c/ibmhawk.c
 1.1 22-Feb-2010  pgoyette branches: 1.1.2; 1.1.6; 1.1.12;
Import smcsmon(4) driver for SMSC LPC47M192 hardware monitor

From Takahiro HAYASHI in PR kern/40420
 1.1.12.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.1.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.6.1 22-Feb-2010  uebayasi file smscmon.c was added on branch uebayasi-xip on 2010-04-30 14:43:12 +0000
 1.1.2.2 11-Mar-2010  yamt sync with head
 1.1.2.1 22-Feb-2010  yamt file smscmon.c was added on branch yamt-nfs-mp on 2010-03-11 15:03:27 +0000
 1.2.52.1 25-Jun-2018  pgoyette Sync with HEAD
 1.1 22-Feb-2010  pgoyette branches: 1.1.2; 1.1.6;
Import smcsmon(4) driver for SMSC LPC47M192 hardware monitor

From Takahiro HAYASHI in PR kern/40420
 1.1.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.6.1 22-Feb-2010  uebayasi file smscmonvar.h was added on branch uebayasi-xip on 2010-04-30 14:43:12 +0000
 1.1.2.2 11-Mar-2010  yamt sync with head
 1.1.2.1 22-Feb-2010  yamt file smscmonvar.h was added on branch yamt-nfs-mp on 2010-03-11 15:03:27 +0000
 1.19 24-Mar-2010  pgoyette Split spdmem driver into a bus attachment and a common back-end
probe and ROM decode, to follow similar changes made in OpenBSD:

http://article.gmane.org/gmane.os.openbsd.cvs/94948
http://article.gmane.org/gmane.os.openbsd.cvs/94956

There exists at least one alternative attachment (for SGI IP35
systems; see http://article.gmane.org/gmane.os.openbsd.cvs/94947),
and there could be more in the future.

Thanks to Christoph Egger for pointing out the OpenBSD activity.
 1.18 23-Mar-2010  njoly Add some missing aprint_naive calls.
 1.17 28-Feb-2010  martin branches: 1.17.2;
Add direct config support for a few devices
 1.16 23-Feb-2010  pgoyette Correct calculation and display of SDR DRAM speed. From OpenBSD.

Fixes PR kern/42736
 1.15 09-May-2009  pgoyette branches: 1.15.2;
Minor white-space KNF nit. No functional change.
 1.14 22-Feb-2009  pgoyette 1. Reorganize code into memory-type-specific routines instead of multiple
monstrous if-then-else-if constructs.
2. Display module capacity in GB if it is at least 1GB.
3. Indicate if a memory module is "registered".
4. For DDR3, indicate if a temp-sensor is present.

Inspired by similar changes in OpenBSD's spdmem(4).
 1.13 22-Nov-2008  pgoyette branches: 1.13.4;
JEDEC has published the DDR3 SPD standard; update driver to match.

Verified on my single DDR3 machine to still produce correct data.
 1.12 16-Nov-2008  pgoyette For DDR3, the number of physical banks stored in the EEPROM needs to be
incremented by 1.
 1.11 28-Sep-2008  pgoyette branches: 1.11.2; 1.11.8;
Add support for DDR3.

OK garbled@
 1.10 27-Sep-2008  pgoyette Display memory latency/timing data via aprint_verbose()

spdmem0: tAA-tRCD-tRP-tRAS: 5-5-5-18

OK garbled@
 1.9 27-Sep-2008  pgoyette Miscellaneous clean-ups:
1. Use proper CRc check for FB-DIMMs rather than simple checksum
2. Provide access to entire SPD ROM contents via sysctl, rather than
only the first 64 bytes
3. Use macros to define i2c bus address checking
4. General fix-up for RAMBUS memory (not that anyone I know has one)

OK garbled@
 1.8 04-May-2008  xtraeme branches: 1.8.2; 1.8.6;
device_t/softc split and other related cosmetic changes.
 1.7 06-Apr-2008  cegger branches: 1.7.2; 1.7.4;
use aprint_*_dev and device_xname
 1.6 14-Dec-2007  njoly branches: 1.6.6;
Do not try to attach spdmem if i2c adress exceed 0x57.
It must follow the reserved eeprom adresses range.
 1.5 13-Dec-2007  xtraeme Check return value of pmf_device_register(), pointed out by joerg.

Looks like the pmf(9) manpage declared it as void and not bool...
 1.4 09-Dec-2007  xtraeme branches: 1.4.2;
Register to pmf(9).
 1.3 20-Sep-2007  xtraeme branches: 1.3.8; 1.3.10;
Make this report correct DDR2 speed/type, and round up the
MHz value as suggested by Alan Barret (apb@).

While I'm here make it report the correct type, it should be PC2 not PC
for DDR2.

spdmem0 at iic0 addr 0x50
spdmem0: DDR2 SDRAM memory, no parity or ECC, 1024MB, 800MHz, PC2-6400
spdmem0: 14 rows, 10 cols, 2 ranks, 4 banks/chip, 2.50ns cycle time
spdmem0: voltage SSTL 1.8V, refresh time 7.8us (self-refreshing)
spdmem1 at iic0 addr 0x51
spdmem1: DDR2 SDRAM memory, no parity or ECC, 1024MB, 667MHz, PC2-5300
spdmem1: 14 rows, 10 cols, 2 ranks, 4 banks/chip, 3.00ns cycle time
spdmem1: voltage SSTL 1.8V, refresh time 7.8us (self-refreshing)
 1.2 09-Sep-2007  xtraeme Add missing SYSCTL_SETUP_PROTO() to make the LKM happy.
 1.1 18-Aug-2007  tnn branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10;
Add spdmem(4) driver. This decodes technical specifications stored in
the eeprom on common types of memory modules. The specifications are
displayed during boot and can later be queried in the hw.spdmemN sysctl
subtree. Stub driver written by Nicolas Joly and greatly improved upon by
Paul Goyette. From PR 36745, with additional improvements by Paul and me.
 1.1.10.3 02-Oct-2007  joerg Sync with HEAD.
 1.1.10.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.1.10.1 18-Aug-2007  jmcneill file spdmem.c was added on branch jmcneill-pm on 2007-09-03 16:47:55 +0000
 1.1.8.4 21-Jan-2008  yamt sync with head
 1.1.8.3 27-Oct-2007  yamt sync with head.
 1.1.8.2 03-Sep-2007  yamt sync with head.
 1.1.8.1 18-Aug-2007  yamt file spdmem.c was added on branch yamt-lazymbuf on 2007-09-03 14:34:05 +0000
 1.1.6.3 10-Sep-2007  skrll Sync with HEAD.
 1.1.6.2 03-Sep-2007  skrll Sync with HEAD.
 1.1.6.1 18-Aug-2007  skrll file spdmem.c was added on branch nick-csl-alignment on 2007-09-03 10:20:15 +0000
 1.1.4.2 09-Jan-2008  matt sync with HEAD
 1.1.4.1 06-Nov-2007  matt sync with HEAD
 1.1.2.3 09-Oct-2007  ad Sync with head.
 1.1.2.2 20-Aug-2007  ad Sync with head.
 1.1.2.1 18-Aug-2007  ad file spdmem.c was added on branch vmlocking on 2007-08-20 22:42:50 +0000
 1.3.10.1 11-Dec-2007  yamt sync with head.
 1.3.8.1 26-Dec-2007  ad Sync with head.
 1.4.2.2 02-Jan-2008  bouyer Sync with HEAD
 1.4.2.1 13-Dec-2007  bouyer Sync with HEAD
 1.6.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.6.6.2 05-Oct-2008  mjf Sync with HEAD.
 1.6.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.4.5 11-Aug-2010  yamt sync with head.
 1.7.4.4 11-Mar-2010  yamt sync with head
 1.7.4.3 16-May-2009  yamt sync with head
 1.7.4.2 04-May-2009  yamt sync with head.
 1.7.4.1 16-May-2008  yamt sync with head.
 1.7.2.1 18-May-2008  yamt sync with head.
 1.8.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.6.1 19-Oct-2008  haad Sync with HEAD.
 1.8.2.1 10-Oct-2008  skrll Sync with HEAD.
 1.11.8.1 05-Nov-2013  matt Deal with larger DIMMs
 1.11.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.11.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.13.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.17.2.1 30-May-2010  rmind sync with head
 1.26 30-Mar-2022  pgoyette These modules need to depend on iic, not just on i2cexec. (They will
still recursively get i2cexec since the iic depends on it.)

Partial fix for kern/56772
 1.25 06-Dec-2021  msaitoh Check the return value correctly. Pointed out by pgoyette@.
 1.24 06-Dec-2021  msaitoh Carefully access to the I2C bus in the match function.
 1.23 30-Nov-2021  msaitoh Access byte2...
 1.22 13-Jun-2021  mlelstv branches: 1.22.6;
iic_acquire_bus can fail
 1.21 27-Jan-2021  thorpej branches: 1.21.4;
Use DEVICE_COMPAT_EOL.
 1.20 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.19 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.18 23-Dec-2019  thorpej branches: 1.18.8;
No need to use I2C_F_POLL here.
 1.17 20-Oct-2018  macallan branches: 1.17.4;
match "i2c-at34c02", found in various sparc64 boxes
 1.16 26-Sep-2018  jakllsch match spdmem_i2c on "atmel,spd" compatible string
 1.15 16-Jun-2018  thorpej branches: 1.15.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.14 01-Mar-2018  pgoyette branches: 1.14.2;
Use 1-byte data-buffers when writing to the "control" device for the
SPD ROMs (we do this for page-selection). The imcsmb doesn't support
zero-byte transfers.

With this, I'm able to get the data for all 8 of my DIMMs (on two
different imcsmb busses) using the spdmem(4) driver. And the data
decodes correctly using the decode-dimms utility (from the linux
i2ctools).
 1.13 09-Sep-2016  msaitoh branches: 1.13.8;
Add code to select page "0" for DDR4 and newer SPD ROM. If the value read
is not suitable as SPD ROM, try to select page 0 and try again. The passed
arguments of iic_exec(SPDCTL_SPA) might not be correct and/or our API of
iic_exec() should be improved. See the comment for the detail.

Use this change until we find a better (or correct?) way.
 1.12 05-Jan-2016  msaitoh Check whether iic_exec is failed or not.
- This change fixes a bug that a device that the checksum is really 0 fails
attaching.
- Reduce the number of access to one if a device doesn't exist. Without this
change and iic(4) does polling, it'll wait long time.
 1.11 07-Dec-2015  mlelstv Handle reading of 4kbit EEPROMs in SPD devices. This is needed for DDR4 DIMMs.
 1.10 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.9 14-Apr-2014  pooka branches: 1.9.2; 1.9.4;
Remove extraneous sysctl setup calls now done as part of regular attach.
 1.8 07-Aug-2013  soren branches: 1.8.2;
Allow i2c addr wildcard matching. Use with care!
 1.7 28-Jul-2013  kiyohara Call iic_exec() with I2C_F_POLL. Don't sleep in probe/attach time.
 1.6 12-Sep-2012  pgoyette branches: 1.6.2; 1.6.4;
Initialize the sysctl(9) stuff before configuring the spd(4) devices.

Otherwise, the devices do not create their own sysctl nodes!
 1.5 31-May-2012  pgoyette Update handling of sysctl stuff when built as modules
 1.4 22-Jan-2012  nakayama Add "dimm" found on Sun US-IIe based machines (eg. Netra X1, Blade 100).
 1.3 02-Oct-2011  jmcneill branches: 1.3.2; 1.3.6;
now that iic is a module, add "iic" dependency to iic drivers
 1.2 01-Aug-2011  pgoyette Modularize the spdmem(4) driver
 1.1 24-Mar-2010  pgoyette branches: 1.1.2; 1.1.4; 1.1.6;
Split spdmem driver into a bus attachment and a common back-end
probe and ROM decode, to follow similar changes made in OpenBSD:

http://article.gmane.org/gmane.os.openbsd.cvs/94948
http://article.gmane.org/gmane.os.openbsd.cvs/94956

There exists at least one alternative attachment (for SGI IP35
systems; see http://article.gmane.org/gmane.os.openbsd.cvs/94947),
and there could be more in the future.

Thanks to Christoph Egger for pointing out the OpenBSD activity.
 1.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 24-Mar-2010  yamt file spdmem_i2c.c was added on branch yamt-nfs-mp on 2010-08-11 22:53:22 +0000
 1.1.4.2 30-May-2010  rmind sync with head
 1.1.4.1 24-Mar-2010  rmind file spdmem_i2c.c was added on branch rmind-uvmplock on 2010-05-30 05:17:20 +0000
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 24-Mar-2010  uebayasi file spdmem_i2c.c was added on branch uebayasi-xip on 2010-04-30 14:43:12 +0000
 1.3.6.2 02-Jun-2012  mrg sync to latest -current.
 1.3.6.1 18-Feb-2012  mrg merge to -current.
 1.3.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.2.2 30-Oct-2012  yamt sync with head
 1.3.2.1 17-Apr-2012  yamt sync with head
 1.6.4.2 18-May-2014  rmind sync with head
 1.6.4.1 28-Aug-2013  rmind sync with head
 1.6.2.2 03-Dec-2017  jdolecek update from HEAD
 1.6.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.2.1 10-Aug-2014  tls Rebase.
 1.9.4.4 05-Oct-2016  skrll Sync with HEAD
 1.9.4.3 19-Mar-2016  skrll Sync with HEAD
 1.9.4.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.9.4.1 06-Apr-2015  skrll Sync with HEAD
 1.9.2.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.13.8.2 07-Dec-2021  martin Pull up the following revisions, requested by msaitoh in ticket #1717

sys/dev/i2c/spdmem_i2c.c 1.23-1.25 via patch

- Carefully access to the I2C bus in the match function.
- Improve bank reset code for DDR4.
 1.13.8.1 16-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1442):

sys/dev/i2c/spdmem_i2c.c: revision 1.14

Use 1-byte data-buffers when writing to the "control" device for the
SPD ROMs (we do this for page-selection). The imcsmb doesn't support
zero-byte transfers.

With this, I'm able to get the data for all 8 of my DIMMs (on two
different imcsmb busses) using the spdmem(4) driver. And the data
decodes correctly using the decode-dimms utility (from the linux
i2ctools).
 1.14.2.3 20-Oct-2018  pgoyette Sync with head
 1.14.2.2 30-Sep-2018  pgoyette Ssync with HEAD
 1.14.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.15.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15.2.1 10-Jun-2019  christos Sync with HEAD
 1.17.4.1 07-Dec-2021  martin Pull up the following revisions, requested by msaitoh in ticket #1388:

sys/dev/i2c/spdmem_i2c.c 1.23-1.25 via patch

- Carefully access to the I2C bus in the match function.
- Improve bank reset code for DDR4.
 1.18.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.21.4.6 17-Jun-2021  thorpej Sync w/ HEAD.
 1.21.4.5 16-May-2021  thorpej Tweak previous to deal better with "device tree node describes empty
DIMM slot" problem.
 1.21.4.4 16-May-2021  thorpej Go back to probing in the direct config case, and return a high confidence
match value if the SPD probe succeeds. This ensures that we beat a generic
i2c serial eeprom driver if the contents looks like they contain SPD data.
 1.21.4.3 16-May-2021  thorpej Check for errors from iic_acquire_bus().
 1.21.4.2 16-May-2021  thorpej The last change had an unfortunate side-effect on empty DIMM slots, so
roll that back. Instead, if we used direct config, then probe for the
module in the attach routine and report if the module is not present,
rather than assuming that it is.

Encapsulate the direct config logic for SPD into one place for clarity.
 1.21.4.1 16-May-2021  thorpej SPD stands for "Serial Presence Detect". This implies that
if we're using direct configuration that we should treat
that as a *hint*... it's entirely possible that a device
tree lists locations where SPD memory can be found, not
necessarily where memory is known to be present.

Accordingly, if we get a direct configuration match based
on compatible data or device name, we still check to see
if the device is there.
 1.22.6.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.4 24-Mar-2010  pgoyette Split spdmem driver into a bus attachment and a common back-end
probe and ROM decode, to follow similar changes made in OpenBSD:

http://article.gmane.org/gmane.os.openbsd.cvs/94948
http://article.gmane.org/gmane.os.openbsd.cvs/94956

There exists at least one alternative attachment (for SGI IP35
systems; see http://article.gmane.org/gmane.os.openbsd.cvs/94947),
and there could be more in the future.

Thanks to Christoph Egger for pointing out the OpenBSD activity.
 1.3 22-Feb-2009  pgoyette branches: 1.3.2; 1.3.4;
1. Reorganize code into memory-type-specific routines instead of multiple
monstrous if-then-else-if constructs.
2. Display module capacity in GB if it is at least 1GB.
3. Indicate if a memory module is "registered".
4. For DDR3, indicate if a temp-sensor is present.

Inspired by similar changes in OpenBSD's spdmem(4).
 1.2 27-Sep-2008  pgoyette branches: 1.2.2; 1.2.8;
Miscellaneous clean-ups:
1. Use proper CRc check for FB-DIMMs rather than simple checksum
2. Provide access to entire SPD ROM contents via sysctl, rather than
only the first 64 bytes
3. Use macros to define i2c bus address checking
4. General fix-up for RAMBUS memory (not that anyone I know has one)

OK garbled@
 1.1 18-Aug-2007  tnn branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10; 1.1.30; 1.1.34; 1.1.36; 1.1.40;
Add spdmem(4) driver. This decodes technical specifications stored in
the eeprom on common types of memory modules. The specifications are
displayed during boot and can later be queried in the hw.spdmemN sysctl
subtree. Stub driver written by Nicolas Joly and greatly improved upon by
Paul Goyette. From PR 36745, with additional improvements by Paul and me.
 1.1.40.1 19-Oct-2008  haad Sync with HEAD.
 1.1.36.1 10-Oct-2008  skrll Sync with HEAD.
 1.1.34.2 11-Aug-2010  yamt sync with head.
 1.1.34.1 04-May-2009  yamt sync with head.
 1.1.30.1 05-Oct-2008  mjf Sync with HEAD.
 1.1.10.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.1.10.1 18-Aug-2007  jmcneill file spdmemreg.h was added on branch jmcneill-pm on 2007-09-03 16:47:56 +0000
 1.1.8.2 03-Sep-2007  yamt sync with head.
 1.1.8.1 18-Aug-2007  yamt file spdmemreg.h was added on branch yamt-lazymbuf on 2007-09-03 14:34:05 +0000
 1.1.6.2 03-Sep-2007  skrll Sync with HEAD.
 1.1.6.1 18-Aug-2007  skrll file spdmemreg.h was added on branch nick-csl-alignment on 2007-09-03 10:20:15 +0000
 1.1.2.2 20-Aug-2007  ad Sync with head.
 1.1.2.1 18-Aug-2007  ad file spdmemreg.h was added on branch vmlocking on 2007-08-20 22:42:50 +0000
 1.2.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.3.4.1 30-May-2010  rmind sync with head
 1.3.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.8 24-Mar-2010  pgoyette Split spdmem driver into a bus attachment and a common back-end
probe and ROM decode, to follow similar changes made in OpenBSD:

http://article.gmane.org/gmane.os.openbsd.cvs/94948
http://article.gmane.org/gmane.os.openbsd.cvs/94956

There exists at least one alternative attachment (for SGI IP35
systems; see http://article.gmane.org/gmane.os.openbsd.cvs/94947),
and there could be more in the future.

Thanks to Christoph Egger for pointing out the OpenBSD activity.
 1.7 22-Nov-2008  pgoyette branches: 1.7.6; 1.7.8;
Ouch - too many bits to fit in a byte.
 1.6 22-Nov-2008  pgoyette JEDEC has published the DDR3 SPD standard; update driver to match.

Verified on my single DDR3 machine to still produce correct data.
 1.5 28-Sep-2008  pgoyette branches: 1.5.2;
Add support for DDR3.

OK garbled@
 1.4 27-Sep-2008  pgoyette Miscellaneous clean-ups:
1. Use proper CRc check for FB-DIMMs rather than simple checksum
2. Provide access to entire SPD ROM contents via sysctl, rather than
only the first 64 bytes
3. Use macros to define i2c bus address checking
4. General fix-up for RAMBUS memory (not that anyone I know has one)

OK garbled@
 1.3 04-May-2008  xtraeme branches: 1.3.2; 1.3.6;
device_t/softc split and other related cosmetic changes.
 1.2 25-Dec-2007  perry branches: 1.2.6; 1.2.8; 1.2.10;
Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.1 18-Aug-2007  tnn branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.16; 1.1.18; 1.1.22;
Add spdmem(4) driver. This decodes technical specifications stored in
the eeprom on common types of memory modules. The specifications are
displayed during boot and can later be queried in the hw.spdmemN sysctl
subtree. Stub driver written by Nicolas Joly and greatly improved upon by
Paul Goyette. From PR 36745, with additional improvements by Paul and me.
 1.1.22.1 02-Jan-2008  bouyer Sync with HEAD
 1.1.18.1 26-Dec-2007  ad Sync with head.
 1.1.16.1 18-Feb-2008  mjf Sync with HEAD.
 1.1.10.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.1.10.1 18-Aug-2007  jmcneill file spdmemvar.h was added on branch jmcneill-pm on 2007-09-03 16:47:56 +0000
 1.1.8.3 21-Jan-2008  yamt sync with head
 1.1.8.2 03-Sep-2007  yamt sync with head.
 1.1.8.1 18-Aug-2007  yamt file spdmemvar.h was added on branch yamt-lazymbuf on 2007-09-03 14:34:06 +0000
 1.1.6.2 03-Sep-2007  skrll Sync with HEAD.
 1.1.6.1 18-Aug-2007  skrll file spdmemvar.h was added on branch nick-csl-alignment on 2007-09-03 10:20:16 +0000
 1.1.4.1 09-Jan-2008  matt sync with HEAD
 1.1.2.2 20-Aug-2007  ad Sync with head.
 1.1.2.1 18-Aug-2007  ad file spdmemvar.h was added on branch vmlocking on 2007-08-20 22:42:51 +0000
 1.2.10.3 11-Aug-2010  yamt sync with head.
 1.2.10.2 04-May-2009  yamt sync with head.
 1.2.10.1 16-May-2008  yamt sync with head.
 1.2.8.1 18-May-2008  yamt sync with head.
 1.2.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.2.6.2 05-Oct-2008  mjf Sync with HEAD.
 1.2.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.3.6.1 19-Oct-2008  haad Sync with HEAD.
 1.3.2.1 10-Oct-2008  skrll Sync with HEAD.
 1.5.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.8.1 30-May-2010  rmind sync with head
 1.7.6.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.11 05-Aug-2021  tnn ssdfb: revert rev 1.14

Can't run the worker thread MPSAFE with spi(4) yet because most controller
drivers still lack MP safety. Cause issues when using multiple displays.
 1.10 30-Jul-2021  tnn ssdfb(4): remove code for dealing with non-MPSAFE attachment

spi(4) was marked MPSAFE some time ago, so we're always on an
MPSAFE parent device.
 1.9 28-Jan-2021  thorpej branches: 1.9.4;
Use iic_compatible_lookup() in ssdfb_i2c_attach().
 1.8 27-Jan-2021  thorpej Use DEVICE_COMPAT_EOL.
 1.7 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.6 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.5 05-Nov-2019  tnn branches: 1.5.8;
ssdfb: fix i2c transfer error with some controllers

If the controller doesn't support the full 128 byte transfer size we need,
then split the write across multiple transactions.
 1.4 02-Nov-2019  tnn set flag to indicate that worker thread should be created mpsafe

iic(4) is mpsafe, unlike spi(4) which hasn't been made mpsafe yet.
 1.3 28-May-2019  tnn branches: 1.3.2;
remove superfluous parentheses
 1.2 17-Mar-2019  tnn delete unused variable
 1.1 17-Mar-2019  tnn add i2c attachment for ssdfb
 1.3.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.2.2 10-Jun-2019  christos Sync with HEAD
 1.3.2.1 28-May-2019  christos file ssdfb_i2c.c was added on branch phil-wifi on 2019-06-10 22:07:09 +0000
 1.5.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.9.4.1 01-Aug-2021  thorpej Sync with HEAD.
 1.9 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.8 27-Jan-2021  thorpej branches: 1.8.4; 1.8.14;
Use DEVICE_COMPAT_EOL.
 1.7 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.6 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.5 23-Dec-2019  thorpej branches: 1.5.8;
No need to use I2C_F_POLL here.
 1.4 26-Jun-2018  thorpej branches: 1.4.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.3 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.2 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.1 02-Oct-2017  jmcneill branches: 1.1.2; 1.1.4;
Add driver for Silergy SY8106A regulator
 1.1.4.2 28-Jul-2018  pgoyette Sync with HEAD
 1.1.4.1 25-Jun-2018  pgoyette Sync with HEAD
 1.1.2.2 03-Dec-2017  jdolecek update from HEAD
 1.1.2.1 02-Oct-2017  jdolecek file sy8106a.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.4.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.8.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.8.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.9 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.8 27-Jan-2021  thorpej branches: 1.8.4; 1.8.14;
Use DEVICE_COMPAT_EOL.
 1.7 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.6 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.5 23-Dec-2019  thorpej branches: 1.5.8;
No need to use I2C_F_POLL here.
 1.4 26-Jun-2018  thorpej branches: 1.4.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.3 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.2 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.1 22-Sep-2017  jmcneill branches: 1.1.2; 1.1.4;
Add GPIO drivers for MAX77620 and TCA9539 as found in Jetson TX1
 1.1.4.2 28-Jul-2018  pgoyette Sync with HEAD
 1.1.4.1 25-Jun-2018  pgoyette Sync with HEAD
 1.1.2.2 03-Dec-2017  jdolecek update from HEAD
 1.1.2.1 22-Sep-2017  jdolecek file tcagpio.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.4.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.8.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.8.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.18 17-Sep-2025  thorpej These drivers conditionally support FDT (with an #ifdef). Rather than
blindly assume that i2c_attach_args::ia_cookie is an FDT phandle, consult
self's devhandle and, if the type is DEVHANDLE_TYPE_OF, exctract the phandle
from there.

XXX These drivers should probably become FDT-only (like many others already
are) because the functionality is questionable without information from the
device tree.
 1.17 07-Aug-2021  thorpej branches: 1.17.2;
Merge thorpej-cfargs2.
 1.16 24-Apr-2021  thorpej branches: 1.16.2; 1.16.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.15 27-Jan-2021  thorpej branches: 1.15.2;
Use DEVICE_COMPAT_EOL.
 1.14 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.13 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.12 16-Dec-2020  christos interupt -> interrupt
 1.11 23-Dec-2019  thorpej branches: 1.11.8;
- Don't use I2C_F_POLL.
- Don't access the i2c from hard interrupt context. Instead, schedule a
soft interrupt to do the real work. (No need to mask the interrupt
source, since this device has an edge-sensitive interrupt per the DT
info; will need to be revisited if there's ever a flavor that uses a
level-sensitive interrupt).
- Split out the i2c bus acquire / release from the register read / write
functions, allowing us to batch several i2c transactions under a single
acquire / release cycle.
 1.10 17-Oct-2018  jmcneill lock/unlock I2C bus around transfers as required by API
 1.9 26-Jun-2018  thorpej branches: 1.9.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.8 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.7 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.6 30-Apr-2018  jmcneill tcakp_match: filter on ia_addr for indirect config (device is expected at 0x34)
 1.5 10-Dec-2017  bouyer branches: 1.5.2;
Factor out bus-independant HID code so that it can be shared by USB, bluetooth
and i2c.
dev/usb/ukbdmap.c is renamed to dev/hid/hidkbdmap.c
dev/usb/hid.[ch] moved to dev/hid/
usage pages moved from dev/usb/usbhid.h moved to dev/hid/hid.h,
and updated with OpenBSD entries.
bus-independant code moved from dev/usb/ums.c to dev/hid/hidms.c
(the same should be done for keyboard and touchpad drivers)

Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.
 1.4 31-Aug-2017  jmcneill branches: 1.4.2;
Instead of a Linux keymap, convert Linux event codes to USB scan codes and
use the ukbd keymaps instead.
 1.3 30-Aug-2017  jmcneill Use linux_keymap instead of pckbd keymap
 1.2 26-Aug-2017  jmcneill wscons is not mpsafe, so take kernel lock for intr handler
 1.1 26-Aug-2017  jmcneill Add driver for Texas Instruments TCA8418 I2C Controller Keypad Scan IC.
 1.4.2.2 03-Dec-2017  jdolecek update from HEAD
 1.4.2.1 31-Aug-2017  jdolecek file tcakp.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.5.2.4 20-Oct-2018  pgoyette Sync with head
 1.5.2.3 28-Jul-2018  pgoyette Sync with HEAD
 1.5.2.2 25-Jun-2018  pgoyette Sync with HEAD
 1.5.2.1 02-May-2018  pgoyette Synch with HEAD
 1.9.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.9.2.1 10-Jun-2019  christos Sync with HEAD
 1.11.8.2 03-Apr-2021  thorpej Sync with HEAD.
 1.11.8.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.15.2.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.16.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.16.2.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.17.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.9 17-Sep-2025  thorpej These drivers blindly assume that i2c_attach_args::ia_cookie is an FDT / OF
phandle. Instead, extract the phandle from self's devhandle, both eliminating
the reference to ia_cookie and providing an assertion that it is, in fact,
an FDT / OF phandle.
 1.8 19-Dec-2021  riastradh drm: Fix tda19988 drm build.
 1.7 27-Jan-2021  thorpej branches: 1.7.4; 1.7.14;
Use DEVICE_COMPAT_EOL.
 1.6 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.5 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.4 23-Dec-2019  thorpej branches: 1.4.8; 1.4.10;
No need to check 'cold' for I2C_F_POLL; the i2c code does it for us.
 1.3 04-Nov-2019  jmcneill branches: 1.3.2;
Speed up mode setting a bit and turn off the display while changing modes
 1.2 03-Nov-2019  jmcneill Test DRM_MODE_* flags, not VID_*
 1.1 03-Nov-2019  jmcneill Add driver for NXP TDA19988 HDMI encoder
 1.3.2.2 27-Nov-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #491):

sys/arch/evbarm/conf/BEAGLEBOARD_INSTALL: file removal
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.2
sys/arch/arm/ti/ti_sysc.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.2
sys/dev/i2c/tps65950.c: file removal
sys/arch/evbarm/conf/std.ti: file removal
sys/dev/i2c/files.i2c: revision 1.101
sys/dev/i2c/files.i2c: revision 1.102
sys/dev/i2c/at24cxx.c: revision 1.32
sys/dev/i2c/files.i2c: revision 1.103
sys/dev/i2c/twl4030.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.104
sys/dev/i2c/twl4030.c: revision 1.2
sys/dev/i2c/twl4030.c: revision 1.3
sys/arch/arm/ti/ti_com.c: revision 1.6
sys/arch/arm/ti/ti_com.c: revision 1.7
sys/arch/arm/ti/ti_com.c: revision 1.8
sys/dev/fdt/cpufreq_dt.c: revision 1.11
sys/arch/arm/ti/ti_iic.c: revision 1.1
sys/dev/fdt/cpufreq_dt.c: revision 1.12
sys/arch/arm/ti/ti_usb.c: revision 1.1
sys/arch/arm/ti/ti_iic.c: revision 1.2
sys/dev/fdt/cpufreq_dt.c: revision 1.13
sys/arch/arm/ti/ti_iic.c: revision 1.3
sys/arch/arm/ti/ti_iic.c: revision 1.4
sys/arch/evbarm/conf/files.ti: file removal
sys/arch/evbarm/conf/BEAGLEBOARDXM: file removal
sys/arch/arm/dts/omap3-n900.dts: revision 1.1
sys/arch/arm/ti/ti_edma.h: revision 1.1
sys/arch/evbarm/conf/OVERO_INSTALL: file removal
sys/arch/arm/ti/ti_usbtll.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.5
etc/etc.evbarm/Makefile.inc: revision 1.108
sys/arch/arm/ti/files.ti: revision 1.6
sys/dev/i2c/tps65217pmic.c: revision 1.13
etc/etc.evbarm/Makefile.inc: revision 1.109
sys/arch/arm/ti/files.ti: revision 1.7
sys/dev/i2c/tps65217pmic.c: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.8
sys/arch/arm/ti/files.ti: revision 1.9
sys/dev/fdt/usbnopphy.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.55
sys/arch/evbarm/conf/GENERIC: revision 1.56
sys/arch/evbarm/conf/GENERIC: revision 1.57
sys/arch/evbarm/conf/GENERIC: revision 1.58
sys/arch/evbarm/conf/GENERIC: revision 1.59
sys/arch/evbarm/conf/BEAGLEBONE: file removal
sys/arch/arm/ti/omap2_gpmcreg.h: revision 1.1
sys/arch/arm/ti/ti_otgreg.h: revision 1.1
sys/arch/arm/ti/ti_tptc.c: revision 1.1
sys/arch/evbarm/conf/IGEPV2: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.10
sys/dev/i2c/tda19988.c: revision 1.1
sys/arch/evbarm/conf/OVERO: file removal
sys/dev/i2c/tda19988.c: revision 1.2
sys/dev/i2c/tda19988.c: revision 1.3
sys/arch/arm/ti/omap3_dss.c: revision 1.1
sys/arch/evbarm/conf/BEAGLEBONE_INSTALL: file removal
sys/arch/arm/ti/ti_omapintc.c: revision 1.2
etc/etc.evbarm/Makefile.inc: revision 1.112
etc/etc.evbarm/Makefile.inc: revision 1.113
sys/arch/arm/ti/ti_div_clock.c: revision 1.1
etc/etc.evbarm/Makefile.inc: revision 1.114
sys/arch/evbarm/conf/N900: revision 1.32
sys/arch/evbarm/conf/N900: revision 1.33
distrib/utils/embedded/conf/armv7.conf: revision 1.36
sys/arch/evbarm/conf/GENERIC: revision 1.60
distrib/utils/embedded/conf/armv7.conf: revision 1.37
sys/arch/arm/ti/omap2_nand.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.61
sys/arch/arm/ti/omap2_nand.c: revision 1.2
sys/arch/evbarm/conf/GENERIC: revision 1.62
distrib/utils/embedded/conf/armv7.conf: revision 1.39
sys/arch/evbarm/conf/GENERIC: revision 1.63
sys/arch/arm/ti/ti_fb.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.64
sys/arch/evbarm/conf/GENERIC: revision 1.65
sys/arch/evbarm/conf/GENERIC: revision 1.66
sys/arch/evbarm/conf/GENERIC: revision 1.67
sys/arch/arm/ti/ti_platform.c: revision 1.7
sys/arch/arm/ti/ti_platform.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.2
sys/arch/arm/ti/ti_platform.c: revision 1.9
sys/arch/arm/ti/am3_prcm.c: revision 1.3
sys/arch/arm/ti/am3_prcm.c: revision 1.4
sys/arch/arm/ti/am3_prcm.c: revision 1.5
sys/arch/arm/ti/am3_prcm.c: revision 1.6
sys/arch/arm/ti/am3_prcm.c: revision 1.7
sys/arch/evbarm/conf/DEVKIT8000: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.9
sys/dev/fdt/syscon.c: revision 1.4
sys/arch/arm/ti/files.ti: revision 1.10
sys/arch/arm/ti/ti_mux_clock.c: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.11
sys/arch/arm/ti/if_cpswreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.12
sys/arch/arm/ti/ti_sdhc.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.13
sys/arch/arm/ti/files.ti: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.15
sys/arch/arm/ti/files.ti: revision 1.16
sys/arch/arm/ti/omap3_cm.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.17
sys/arch/arm/ti/omap3_cm.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.18
sys/arch/arm/ti/omap3_cm.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.19
sys/arch/arm/ti/omap3_cm.c: revision 1.4
sys/arch/arm/ti/ti_motg.c: revision 1.1
sys/arch/arm/ti/ti_rngreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.1
sys/arch/arm/dts/omap3-beagle-xm.dts: revision 1.1
sys/arch/arm/ti/am3_platform.c: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARDXM_INSTALL: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.22
sys/arch/evbarm/conf/README.evbarm: revision 1.23
sys/arch/arm/ti/ti_platform.c: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.24
sys/arch/arm/ti/ti_omaptimer.c: revision 1.2
sys/arch/arm/ti/ti_prcm.c: revision 1.2
sys/arch/evbarm/conf/README.evbarm: revision 1.25
sys/arch/arm/ti/ti_omaptimer.c: revision 1.3
sys/arch/arm/ti/ti_prcm.c: revision 1.3
sys/arch/evbarm/conf/README.evbarm: revision 1.26
sys/arch/arm/ti/ti_omaptimer.c: revision 1.4
sys/arch/evbarm/conf/README.evbarm: revision 1.27
sys/arch/arm/ti/ti_ehci.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.20
sys/arch/arm/ti/ti_cpufreq.c: revision 1.1
sys/arch/arm/ti/ti_cpufreq.c: revision 1.2
sys/arch/arm/fdt/smsh_fdt.c: revision 1.2
sys/arch/arm/ti/omap3_dssreg.h: revision 1.1
sys/arch/evbarm/conf/OVERO: revision 1.56
sys/arch/evbarm/conf/TI: file removal
sys/arch/arm/dts/omap3-beagle.dts: revision 1.1
sys/dev/fdt/fdtvar.h: revision 1.55
sys/dev/fdt/fdtvar.h: revision 1.56
distrib/utils/embedded/files/armv7_boot_nonefi.cmd: revision 1.2
sys/dev/fdt/fdt_phy.c: revision 1.6
sys/arch/arm/ti/ti_iicreg.h: revision 1.1
sys/arch/arm/ti/ti_lcdc.c: revision 1.1
sys/arch/arm/ti/ti_gpio.c: revision 1.1
sys/arch/arm/ti/ti_iicreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.c: revision 1.2
sys/dev/fdt/files.fdt: revision 1.46
sys/arch/arm/ti/ti_gpio.c: revision 1.2
sys/arch/arm/ti/ti_iicreg.h: revision 1.3
sys/arch/arm/ti/ti_lcdc.c: revision 1.3
sys/dev/fdt/files.fdt: revision 1.47
sys/arch/arm/ti/ti_gpio.c: revision 1.3
sys/dev/fdt/pinctrl_single.c: revision 1.1
sys/arch/evbarm/conf/files.generic: revision 1.9
sys/arch/arm/ti/ti_gpmc.c: revision 1.1
sys/arch/arm/ti/ti_lcdcreg.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARD: file removal
sys/arch/arm/ti/omap3_prm.c: revision 1.1
sys/arch/arm/ti/ti_platform.h: file removal
sys/arch/arm/ti/omap3_platform.c: revision 1.1
sys/arch/arm/ti/ti_prcm.h: revision 1.2
sys/arch/arm/ti/omap3_platform.c: revision 1.2
sys/arch/arm/ti/ti_prcm.h: revision 1.3
sys/arch/arm/ti/ti_prcm.h: revision 1.4
sys/dev/fdt/fdt_clock.c: revision 1.9
sys/arch/arm/ti/ti_edma.c: revision 1.1
sys/arch/arm/ti/ti_otg.c: revision 1.1
distrib/utils/embedded/files/armv7_boot.cmd: revision 1.15
sys/arch/arm/ti/if_cpsw.c: revision 1.7
sys/arch/evbarm/conf/std.igepv2: file removal
sys/arch/arm/ti/if_cpsw.c: revision 1.8
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.1

Adapt ti fdt glue to support GENERIC kernel.

Do not search 64-bit directories for dts files

Fix am33xx_platform_early_putchar for pre-MMU output

Add bus driver for TI sysc interconncet.

Make com work again

Add EDMA TPCC and TPTC drivers.

Add driver for one-register-per-pin type pinctrl devices.

Add MMCHS support.

Add USB support.

Disable autoidle

Place devmap above KERNEL_IO_VBASE

Use Timer2 for timecounter, and enable hw module.

Add support for TI AM335x

Add atmel,24c256 compat data

Add I2C support.

Add tiiic, tps65217pmic

Add FDT support

Fix early putchar, add reset func

No support for tegra210 in armv7 kernel

Switch to GENERIC kernels only.

Get mac address from DT

Skip nodes with an "opp-suspend" property and fix tables that have disabled
nodes in the middle.

enumerate devices under child "clocks" node

Add support for platform specific opp table filters.

Add fdtbus_clock_count to count the number of clock references on a given node

enumerate devices under child "clocks" node

Add AM335x DVFS support.

Enable TI AM335x DVFS support

Add support for GPIO controller.

Add tigpio

Unhook BEAGLEBONE kernel from the build
Remove BEAGLEBONE kernel config (AM335x SoC is supported by GENERIC now).

Add support for hardware RNG.

Add tirng

Add explicit FDT_OPP for operating-points-v2 so the link set won't be empty

Rename SOC_TI_AM335X to SOC_AM33XX and rename ti_platform.c to
am3_platform.c

Set stdout-path on TI OMAP3 BeagleBoard

Add support for TI OMAP3.

Add OMAP3 support.

Move a lot of *.dtb files to a dtb/ subdirectory on the FAT partition.
Mkimage (eroneously) creates a FAT16 partition (despite the configuration
asking for FAT32), and that has a root directory size limit.
Idea from Jared.

Skip xref if it is 0

Add generic USB PHY driver

Add driver for TI TWL4030 Power Management IC

Use the hwmod clk to get the timer rate and explicitly enable the
timecounter timer.

Add OMAP3 USB support.

Add twl, usbnopphy, tiusb, tiusbtll

Move omap3 dtb files to /boot/dtb

Remove BEAGLEBOARD kernel from list of kernels to build
Remove BEAGLEBOARD kernel (supported by GENERIC now)

Fix PRM_RSTCTRL_RST_DPLL3 definition, now reset works.

Remove DEVKIT8000 kernel (GENERIC should work now)
Remove DPLL5 init ported from old omap code, it is not required

Set the stdout-path on xM like Ti OMAP3 BeagleBoard

Remove BEAGLEBOARDXM from the build
Remove BEAGLEBOARDXM kernel (supported by GENERIC now)

Handle different register layout on OMAP3

Add omapfb to FDT-ized TI port.

Use dss as console on Nokia N900.

Enable IRQ status bits for omap3 type and set speed properly

Add RTC support

Remove tps65950pm (hardware now supported by twl4030.c)

Add NAND flash support.

Add tigpmc, omapnand

Attach tiusb before the default pass since it adds a bus to reduce kernel output
Replace tps65950pm with twl (the former has been removed)

Fix non-FDT build

Cleanup and remove dependency on arch/arm/omap

Add support for GPIO interrupts and fix reading the state of output pins.
Match smsc,lan9115 and honour local-mac-address/mac-address properties

Only one instance of twl(4) is needed
Remove OVERO from build, and commented out N900 kernel config
OMAP3 SoC and all peripherals in the OVERO kernel are now supported by
GENERIC.

Remove commented out IGEPV2 entry

OMAP3 SoC and all peripherals in the IGEPV2 kernel are now supported by
GENERIC.

No longer used.

Also match ti,omap2-onenand

Defer power monitor polling to the sysmon taskq thread to avoid i2c transactions in intr context

Add driver for NXP TDA19988 HDMI encoder

Add support for AM335x display controller (LCDC).

Add tdahdmi, tilcdc, tifb

Test DRM_MODE_* flags, not VID_*

Comment out mode fixup (not needed it seems)

Use 297MHz for display clock

Select closest rate to desired pixel clock

Speed up mode setting a bit and turn off the display while changing modes
 1.3.2.1 04-Nov-2019  martin file tda19988.c was added on branch netbsd-9 on 2019-11-27 13:46:45 +0000
 1.4.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.4.8.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.8.1 23-Dec-2019  martin file tda19988.c was added on branch phil-wifi on 2020-04-13 08:04:20 +0000
 1.7.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.7.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.2 23-Dec-2019  thorpej No need to use I2C_F_POLL here. Also fix an uninitialized error variable
in tea5767_read().
 1.1 27-Jul-2018  rkujawa branches: 1.1.2; 1.1.8;
Add TEA5767 FM radio driver. From Karuna Grewal.
 1.1.8.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.8.2 10-Jun-2019  christos Sync with HEAD
 1.1.8.1 27-Jul-2018  christos file tea5767.c was added on branch phil-wifi on 2019-06-10 22:07:09 +0000
 1.1.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.1.2.1 27-Jul-2018  pgoyette file tea5767.c was added on branch pgoyette-compat on 2018-07-28 04:37:44 +0000
 1.1 27-Jul-2018  rkujawa branches: 1.1.2; 1.1.8;
Add TEA5767 FM radio driver. From Karuna Grewal.
 1.1.8.2 10-Jun-2019  christos Sync with HEAD
 1.1.8.1 27-Jul-2018  christos file tea5767reg.h was added on branch phil-wifi on 2019-06-10 22:07:09 +0000
 1.1.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.1.2.1 27-Jul-2018  pgoyette file tea5767reg.h was added on branch pgoyette-compat on 2018-07-28 04:37:44 +0000
 1.11 27-Jan-2021  thorpej Use DEVICE_COMPAT_EOL.
 1.10 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.9 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.8 23-Dec-2019  thorpej branches: 1.8.8;
No need to use I2C_F_POLL here.
 1.7 26-Jun-2018  thorpej branches: 1.7.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.6 18-Jun-2018  thorpej - Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.5 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.4 30-Apr-2018  jmcneill titemp_match: filter on ia_addr for indirect config (device is expected at 0x4c)
 1.3 16-Aug-2016  jakllsch branches: 1.3.14; 1.3.16;
Fix fractional temperature conversion.

Previously 0 to 15 whole degrees were added for each 1/16th degree fraction.
 1.2 13-Dec-2015  jmcneill Support direct config.
 1.1 12-May-2015  jmcneill branches: 1.1.2;
Add driver for Texas Instruments TMP451 Temperature Sensor
 1.1.2.4 05-Oct-2016  skrll Sync with HEAD
 1.1.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.2 06-Jun-2015  skrll Sync with HEAD
 1.1.2.1 12-May-2015  skrll file titemp.c was added on branch nick-nhusb on 2015-06-06 14:40:07 +0000
 1.3.16.3 28-Jul-2018  pgoyette Sync with HEAD
 1.3.16.2 25-Jun-2018  pgoyette Sync with HEAD
 1.3.16.1 02-May-2018  pgoyette Synch with HEAD
 1.3.14.2 03-Dec-2017  jdolecek update from HEAD
 1.3.14.1 16-Aug-2016  jdolecek file titemp.c was added on branch tls-maxphys on 2017-12-03 11:37:02 +0000
 1.7.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.8.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.21 17-Sep-2025  thorpej These drivers conditionally support FDT (with an #ifdef). Rather than
blindly assume that i2c_attach_args::ia_cookie is an FDT phandle, consult
self's devhandle and, if the type is DEVHANDLE_TYPE_OF, exctract the phandle
from there.

XXX These drivers should probably become FDT-only (like many others already
are) because the functionality is questionable without information from the
device tree.
 1.20 07-Aug-2021  thorpej branches: 1.20.2;
Merge thorpej-cfargs2.
 1.19 24-Apr-2021  thorpej branches: 1.19.2; 1.19.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.18 27-Jan-2021  thorpej branches: 1.18.2;
Use DEVICE_COMPAT_EOL.
 1.17 25-Jan-2021  thorpej Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.
 1.16 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.15 23-Dec-2019  thorpej branches: 1.15.8;
- No need to use I2C_F_POLL here.
- Refactor register read / write functions, splitting out i2c bus
acquire / release everywhere. This fixes what was almost certainly
a deadlock in the FDT regulator section of the code (acquire bus ->
read register, which again acquires bus -> locking against myself).
 1.14 03-Nov-2019  jmcneill Defer power monitor polling to the sysmon taskq thread to avoid i2c transactions in intr context
 1.13 27-Oct-2019  jmcneill Add FDT support
 1.12 16-Jun-2018  thorpej branches: 1.12.2; 1.12.8;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.11 15-Oct-2016  kiyohara branches: 1.11.14;
Add White LED initialize function.
 1.10 20-Jul-2014  bouyer branches: 1.10.4; 1.10.8;
Add a callback to change the regulator outputs.
Tested on beaglebone.
 1.9 08-Jan-2014  jakllsch branches: 1.9.2; 1.9.4;
Fix whitespace issues.
 1.8 08-Jan-2014  jakllsch Add unused tps65217pmic_reg_write() function.
 1.7 31-Dec-2013  skrll Remove unused variable.

OK rkujawa
 1.6 04-Aug-2013  rkujawa Monitor for power source changes and report with appropriate information in
dmesg, a pmf event and sysmon_pswitch event.
 1.5 16-May-2013  rkujawa branches: 1.5.2; 1.5.4;
Fix typo: s/300/500/ .
 1.4 28-Apr-2013  jakllsch remove trailing whitespace
 1.3 26-Apr-2013  rkujawa Add envsys(4) support to TPS65217 PMIC driver.
 1.2 26-Apr-2013  rkujawa Add sanity, flexibility and readability to TPS65217 driver. In preparation to
add envsys support.
 1.1 25-Apr-2013  rkujawa Add minimal support for TPS65217 PMIC as found on BeagleBone. Next step is to
expose regulated voltages through envsys(4).
 1.5.4.2 18-May-2014  rmind sync with head
 1.5.4.1 28-Aug-2013  rmind sync with head
 1.5.2.4 03-Dec-2017  jdolecek update from HEAD
 1.5.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.2.2 23-Jun-2013  tls resync from head
 1.5.2.1 16-May-2013  tls file tps65217pmic.c was added on branch tls-maxphys on 2013-06-23 06:20:17 +0000
 1.9.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.4.1 08-Jan-2014  yamt file tps65217pmic.c was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.9.2.1 10-Aug-2014  tls Rebase.
 1.10.8.1 04-Nov-2016  pgoyette Sync with HEAD
 1.10.4.1 05-Dec-2016  skrll Sync with HEAD
 1.11.14.1 25-Jun-2018  pgoyette Sync with HEAD
 1.12.8.1 27-Nov-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #491):

sys/arch/evbarm/conf/BEAGLEBOARD_INSTALL: file removal
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.2
sys/arch/arm/ti/ti_sysc.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.2
sys/dev/i2c/tps65950.c: file removal
sys/arch/evbarm/conf/std.ti: file removal
sys/dev/i2c/files.i2c: revision 1.101
sys/dev/i2c/files.i2c: revision 1.102
sys/dev/i2c/at24cxx.c: revision 1.32
sys/dev/i2c/files.i2c: revision 1.103
sys/dev/i2c/twl4030.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.104
sys/dev/i2c/twl4030.c: revision 1.2
sys/dev/i2c/twl4030.c: revision 1.3
sys/arch/arm/ti/ti_com.c: revision 1.6
sys/arch/arm/ti/ti_com.c: revision 1.7
sys/arch/arm/ti/ti_com.c: revision 1.8
sys/dev/fdt/cpufreq_dt.c: revision 1.11
sys/arch/arm/ti/ti_iic.c: revision 1.1
sys/dev/fdt/cpufreq_dt.c: revision 1.12
sys/arch/arm/ti/ti_usb.c: revision 1.1
sys/arch/arm/ti/ti_iic.c: revision 1.2
sys/dev/fdt/cpufreq_dt.c: revision 1.13
sys/arch/arm/ti/ti_iic.c: revision 1.3
sys/arch/arm/ti/ti_iic.c: revision 1.4
sys/arch/evbarm/conf/files.ti: file removal
sys/arch/evbarm/conf/BEAGLEBOARDXM: file removal
sys/arch/arm/dts/omap3-n900.dts: revision 1.1
sys/arch/arm/ti/ti_edma.h: revision 1.1
sys/arch/evbarm/conf/OVERO_INSTALL: file removal
sys/arch/arm/ti/ti_usbtll.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.5
etc/etc.evbarm/Makefile.inc: revision 1.108
sys/arch/arm/ti/files.ti: revision 1.6
sys/dev/i2c/tps65217pmic.c: revision 1.13
etc/etc.evbarm/Makefile.inc: revision 1.109
sys/arch/arm/ti/files.ti: revision 1.7
sys/dev/i2c/tps65217pmic.c: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.8
sys/arch/arm/ti/files.ti: revision 1.9
sys/dev/fdt/usbnopphy.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.55
sys/arch/evbarm/conf/GENERIC: revision 1.56
sys/arch/evbarm/conf/GENERIC: revision 1.57
sys/arch/evbarm/conf/GENERIC: revision 1.58
sys/arch/evbarm/conf/GENERIC: revision 1.59
sys/arch/evbarm/conf/BEAGLEBONE: file removal
sys/arch/arm/ti/omap2_gpmcreg.h: revision 1.1
sys/arch/arm/ti/ti_otgreg.h: revision 1.1
sys/arch/arm/ti/ti_tptc.c: revision 1.1
sys/arch/evbarm/conf/IGEPV2: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.10
sys/dev/i2c/tda19988.c: revision 1.1
sys/arch/evbarm/conf/OVERO: file removal
sys/dev/i2c/tda19988.c: revision 1.2
sys/dev/i2c/tda19988.c: revision 1.3
sys/arch/arm/ti/omap3_dss.c: revision 1.1
sys/arch/evbarm/conf/BEAGLEBONE_INSTALL: file removal
sys/arch/arm/ti/ti_omapintc.c: revision 1.2
etc/etc.evbarm/Makefile.inc: revision 1.112
etc/etc.evbarm/Makefile.inc: revision 1.113
sys/arch/arm/ti/ti_div_clock.c: revision 1.1
etc/etc.evbarm/Makefile.inc: revision 1.114
sys/arch/evbarm/conf/N900: revision 1.32
sys/arch/evbarm/conf/N900: revision 1.33
distrib/utils/embedded/conf/armv7.conf: revision 1.36
sys/arch/evbarm/conf/GENERIC: revision 1.60
distrib/utils/embedded/conf/armv7.conf: revision 1.37
sys/arch/arm/ti/omap2_nand.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.61
sys/arch/arm/ti/omap2_nand.c: revision 1.2
sys/arch/evbarm/conf/GENERIC: revision 1.62
distrib/utils/embedded/conf/armv7.conf: revision 1.39
sys/arch/evbarm/conf/GENERIC: revision 1.63
sys/arch/arm/ti/ti_fb.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.64
sys/arch/evbarm/conf/GENERIC: revision 1.65
sys/arch/evbarm/conf/GENERIC: revision 1.66
sys/arch/evbarm/conf/GENERIC: revision 1.67
sys/arch/arm/ti/ti_platform.c: revision 1.7
sys/arch/arm/ti/ti_platform.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.2
sys/arch/arm/ti/ti_platform.c: revision 1.9
sys/arch/arm/ti/am3_prcm.c: revision 1.3
sys/arch/arm/ti/am3_prcm.c: revision 1.4
sys/arch/arm/ti/am3_prcm.c: revision 1.5
sys/arch/arm/ti/am3_prcm.c: revision 1.6
sys/arch/arm/ti/am3_prcm.c: revision 1.7
sys/arch/evbarm/conf/DEVKIT8000: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.9
sys/dev/fdt/syscon.c: revision 1.4
sys/arch/arm/ti/files.ti: revision 1.10
sys/arch/arm/ti/ti_mux_clock.c: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.11
sys/arch/arm/ti/if_cpswreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.12
sys/arch/arm/ti/ti_sdhc.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.13
sys/arch/arm/ti/files.ti: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.15
sys/arch/arm/ti/files.ti: revision 1.16
sys/arch/arm/ti/omap3_cm.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.17
sys/arch/arm/ti/omap3_cm.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.18
sys/arch/arm/ti/omap3_cm.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.19
sys/arch/arm/ti/omap3_cm.c: revision 1.4
sys/arch/arm/ti/ti_motg.c: revision 1.1
sys/arch/arm/ti/ti_rngreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.1
sys/arch/arm/dts/omap3-beagle-xm.dts: revision 1.1
sys/arch/arm/ti/am3_platform.c: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARDXM_INSTALL: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.22
sys/arch/evbarm/conf/README.evbarm: revision 1.23
sys/arch/arm/ti/ti_platform.c: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.24
sys/arch/arm/ti/ti_omaptimer.c: revision 1.2
sys/arch/arm/ti/ti_prcm.c: revision 1.2
sys/arch/evbarm/conf/README.evbarm: revision 1.25
sys/arch/arm/ti/ti_omaptimer.c: revision 1.3
sys/arch/arm/ti/ti_prcm.c: revision 1.3
sys/arch/evbarm/conf/README.evbarm: revision 1.26
sys/arch/arm/ti/ti_omaptimer.c: revision 1.4
sys/arch/evbarm/conf/README.evbarm: revision 1.27
sys/arch/arm/ti/ti_ehci.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.20
sys/arch/arm/ti/ti_cpufreq.c: revision 1.1
sys/arch/arm/ti/ti_cpufreq.c: revision 1.2
sys/arch/arm/fdt/smsh_fdt.c: revision 1.2
sys/arch/arm/ti/omap3_dssreg.h: revision 1.1
sys/arch/evbarm/conf/OVERO: revision 1.56
sys/arch/evbarm/conf/TI: file removal
sys/arch/arm/dts/omap3-beagle.dts: revision 1.1
sys/dev/fdt/fdtvar.h: revision 1.55
sys/dev/fdt/fdtvar.h: revision 1.56
distrib/utils/embedded/files/armv7_boot_nonefi.cmd: revision 1.2
sys/dev/fdt/fdt_phy.c: revision 1.6
sys/arch/arm/ti/ti_iicreg.h: revision 1.1
sys/arch/arm/ti/ti_lcdc.c: revision 1.1
sys/arch/arm/ti/ti_gpio.c: revision 1.1
sys/arch/arm/ti/ti_iicreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.c: revision 1.2
sys/dev/fdt/files.fdt: revision 1.46
sys/arch/arm/ti/ti_gpio.c: revision 1.2
sys/arch/arm/ti/ti_iicreg.h: revision 1.3
sys/arch/arm/ti/ti_lcdc.c: revision 1.3
sys/dev/fdt/files.fdt: revision 1.47
sys/arch/arm/ti/ti_gpio.c: revision 1.3
sys/dev/fdt/pinctrl_single.c: revision 1.1
sys/arch/evbarm/conf/files.generic: revision 1.9
sys/arch/arm/ti/ti_gpmc.c: revision 1.1
sys/arch/arm/ti/ti_lcdcreg.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARD: file removal
sys/arch/arm/ti/omap3_prm.c: revision 1.1
sys/arch/arm/ti/ti_platform.h: file removal
sys/arch/arm/ti/omap3_platform.c: revision 1.1
sys/arch/arm/ti/ti_prcm.h: revision 1.2
sys/arch/arm/ti/omap3_platform.c: revision 1.2
sys/arch/arm/ti/ti_prcm.h: revision 1.3
sys/arch/arm/ti/ti_prcm.h: revision 1.4
sys/dev/fdt/fdt_clock.c: revision 1.9
sys/arch/arm/ti/ti_edma.c: revision 1.1
sys/arch/arm/ti/ti_otg.c: revision 1.1
distrib/utils/embedded/files/armv7_boot.cmd: revision 1.15
sys/arch/arm/ti/if_cpsw.c: revision 1.7
sys/arch/evbarm/conf/std.igepv2: file removal
sys/arch/arm/ti/if_cpsw.c: revision 1.8
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.1

Adapt ti fdt glue to support GENERIC kernel.

Do not search 64-bit directories for dts files

Fix am33xx_platform_early_putchar for pre-MMU output

Add bus driver for TI sysc interconncet.

Make com work again

Add EDMA TPCC and TPTC drivers.

Add driver for one-register-per-pin type pinctrl devices.

Add MMCHS support.

Add USB support.

Disable autoidle

Place devmap above KERNEL_IO_VBASE

Use Timer2 for timecounter, and enable hw module.

Add support for TI AM335x

Add atmel,24c256 compat data

Add I2C support.

Add tiiic, tps65217pmic

Add FDT support

Fix early putchar, add reset func

No support for tegra210 in armv7 kernel

Switch to GENERIC kernels only.

Get mac address from DT

Skip nodes with an "opp-suspend" property and fix tables that have disabled
nodes in the middle.

enumerate devices under child "clocks" node

Add support for platform specific opp table filters.

Add fdtbus_clock_count to count the number of clock references on a given node

enumerate devices under child "clocks" node

Add AM335x DVFS support.

Enable TI AM335x DVFS support

Add support for GPIO controller.

Add tigpio

Unhook BEAGLEBONE kernel from the build
Remove BEAGLEBONE kernel config (AM335x SoC is supported by GENERIC now).

Add support for hardware RNG.

Add tirng

Add explicit FDT_OPP for operating-points-v2 so the link set won't be empty

Rename SOC_TI_AM335X to SOC_AM33XX and rename ti_platform.c to
am3_platform.c

Set stdout-path on TI OMAP3 BeagleBoard

Add support for TI OMAP3.

Add OMAP3 support.

Move a lot of *.dtb files to a dtb/ subdirectory on the FAT partition.
Mkimage (eroneously) creates a FAT16 partition (despite the configuration
asking for FAT32), and that has a root directory size limit.
Idea from Jared.

Skip xref if it is 0

Add generic USB PHY driver

Add driver for TI TWL4030 Power Management IC

Use the hwmod clk to get the timer rate and explicitly enable the
timecounter timer.

Add OMAP3 USB support.

Add twl, usbnopphy, tiusb, tiusbtll

Move omap3 dtb files to /boot/dtb

Remove BEAGLEBOARD kernel from list of kernels to build
Remove BEAGLEBOARD kernel (supported by GENERIC now)

Fix PRM_RSTCTRL_RST_DPLL3 definition, now reset works.

Remove DEVKIT8000 kernel (GENERIC should work now)
Remove DPLL5 init ported from old omap code, it is not required

Set the stdout-path on xM like Ti OMAP3 BeagleBoard

Remove BEAGLEBOARDXM from the build
Remove BEAGLEBOARDXM kernel (supported by GENERIC now)

Handle different register layout on OMAP3

Add omapfb to FDT-ized TI port.

Use dss as console on Nokia N900.

Enable IRQ status bits for omap3 type and set speed properly

Add RTC support

Remove tps65950pm (hardware now supported by twl4030.c)

Add NAND flash support.

Add tigpmc, omapnand

Attach tiusb before the default pass since it adds a bus to reduce kernel output
Replace tps65950pm with twl (the former has been removed)

Fix non-FDT build

Cleanup and remove dependency on arch/arm/omap

Add support for GPIO interrupts and fix reading the state of output pins.
Match smsc,lan9115 and honour local-mac-address/mac-address properties

Only one instance of twl(4) is needed
Remove OVERO from build, and commented out N900 kernel config
OMAP3 SoC and all peripherals in the OVERO kernel are now supported by
GENERIC.

Remove commented out IGEPV2 entry

OMAP3 SoC and all peripherals in the IGEPV2 kernel are now supported by
GENERIC.

No longer used.

Also match ti,omap2-onenand

Defer power monitor polling to the sysmon taskq thread to avoid i2c transactions in intr context

Add driver for NXP TDA19988 HDMI encoder

Add support for AM335x display controller (LCDC).

Add tdahdmi, tilcdc, tifb

Test DRM_MODE_* flags, not VID_*

Comment out mode fixup (not needed it seems)

Use 297MHz for display clock

Select closest rate to desired pixel clock

Speed up mode setting a bit and turn off the display while changing modes
 1.12.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.15.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.18.2.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.19.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.19.2.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.20.2.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.7 20-Jul-2014  bouyer Add a callback to change the regulator outputs.
Tested on beaglebone.
 1.6 04-Aug-2013  rkujawa branches: 1.6.2; 1.6.4;
Monitor for power source changes and report with appropriate information in
dmesg, a pmf event and sysmon_pswitch event.
 1.5 07-May-2013  jakllsch branches: 1.5.4; 1.5.6;
Add WLED register defines.
 1.4 28-Apr-2013  jakllsch put the one out-of-order register info in its proper sequence
 1.3 28-Apr-2013  jakllsch remove trailing whitespace
 1.2 26-Apr-2013  rkujawa Add sanity, flexibility and readability to TPS65217 driver. In preparation to
add envsys support.
 1.1 25-Apr-2013  rkujawa Add minimal support for TPS65217 PMIC as found on BeagleBone. Next step is to
expose regulated voltages through envsys(4).
 1.5.6.1 28-Aug-2013  rmind sync with head
 1.5.4.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.4.2 23-Jun-2013  tls resync from head
 1.5.4.1 07-May-2013  tls file tps65217pmicreg.h was added on branch tls-maxphys on 2013-06-23 06:20:17 +0000
 1.6.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.4.1 04-Aug-2013  yamt file tps65217pmicreg.h was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.6.2.1 10-Aug-2014  tls Rebase.
 1.1 20-Jul-2014  bouyer branches: 1.1.2; 1.1.6;
Add a callback to change the regulator outputs.
Tested on beaglebone.
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 20-Jul-2014  tls file tps65217pmicvar.h was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 20-Jul-2014  tls file tps65217pmicvar.h was added on branch tls-earlyentropy on 2014-08-10 06:54:51 +0000
 1.7 01-Nov-2019  jmcneill Remove tps65950pm (hardware now supported by twl4030.c)
 1.6 16-Jun-2018  thorpej branches: 1.6.2; 1.6.8;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.5 20-Nov-2014  christos branches: 1.5.18;
use the inline bcdtobin and bintobcd directly instead through a macro.
 1.4 25-Feb-2014  pooka Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.3 31-Dec-2012  jmcneill branches: 1.3.2; 1.3.4; 1.3.6; 1.3.10;
add TPS65950 RTC support
 1.2 31-Dec-2012  jmcneill add support for TPS65950 watchdog timer
 1.1 31-Dec-2012  jmcneill TI TPS65950 driver, right now about all it can do is control LEDs
 1.3.10.6 27-May-2013  khorben KNF

Thanks jmcneill@ for the hint.
 1.3.10.5 27-May-2013  khorben Fixed use of workqueue_create(9), as it expects a pri_t as the priority.
The IPL level was changed to IPL_SOFTBIO which seems more correct.

Thanks jmcneill@ for the hint.

XXX test on the Nokia N900
 1.3.10.4 12-May-2013  khorben Added keyboard support for the TPS65950 companion chip.

Tested on the Nokia N900 (multi-user)
 1.3.10.3 12-May-2013  khorben Added GPIO support to the TPS65950 companion chip. I haven't been able to
test it properly thus far unfortunately.

XXX Implement level-triggered interrupts.
 1.3.10.2 11-May-2013  khorben Beginning to handle interrupts from the TPS65950 companion chip.
 1.3.10.1 11-May-2013  khorben Moved register values to a separate file
 1.3.6.4 03-Dec-2017  jdolecek update from HEAD
 1.3.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 31-Dec-2012  tls file tps65950.c was added on branch tls-maxphys on 2013-02-25 00:29:13 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 31-Dec-2012  yamt file tps65950.c was added on branch yamt-pagecache on 2013-01-23 00:06:06 +0000
 1.5.18.1 25-Jun-2018  pgoyette Sync with HEAD
 1.6.8.1 27-Nov-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #491):

sys/arch/evbarm/conf/BEAGLEBOARD_INSTALL: file removal
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.2
sys/arch/arm/ti/ti_sysc.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.2
sys/dev/i2c/tps65950.c: file removal
sys/arch/evbarm/conf/std.ti: file removal
sys/dev/i2c/files.i2c: revision 1.101
sys/dev/i2c/files.i2c: revision 1.102
sys/dev/i2c/at24cxx.c: revision 1.32
sys/dev/i2c/files.i2c: revision 1.103
sys/dev/i2c/twl4030.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.104
sys/dev/i2c/twl4030.c: revision 1.2
sys/dev/i2c/twl4030.c: revision 1.3
sys/arch/arm/ti/ti_com.c: revision 1.6
sys/arch/arm/ti/ti_com.c: revision 1.7
sys/arch/arm/ti/ti_com.c: revision 1.8
sys/dev/fdt/cpufreq_dt.c: revision 1.11
sys/arch/arm/ti/ti_iic.c: revision 1.1
sys/dev/fdt/cpufreq_dt.c: revision 1.12
sys/arch/arm/ti/ti_usb.c: revision 1.1
sys/arch/arm/ti/ti_iic.c: revision 1.2
sys/dev/fdt/cpufreq_dt.c: revision 1.13
sys/arch/arm/ti/ti_iic.c: revision 1.3
sys/arch/arm/ti/ti_iic.c: revision 1.4
sys/arch/evbarm/conf/files.ti: file removal
sys/arch/evbarm/conf/BEAGLEBOARDXM: file removal
sys/arch/arm/dts/omap3-n900.dts: revision 1.1
sys/arch/arm/ti/ti_edma.h: revision 1.1
sys/arch/evbarm/conf/OVERO_INSTALL: file removal
sys/arch/arm/ti/ti_usbtll.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.5
etc/etc.evbarm/Makefile.inc: revision 1.108
sys/arch/arm/ti/files.ti: revision 1.6
sys/dev/i2c/tps65217pmic.c: revision 1.13
etc/etc.evbarm/Makefile.inc: revision 1.109
sys/arch/arm/ti/files.ti: revision 1.7
sys/dev/i2c/tps65217pmic.c: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.8
sys/arch/arm/ti/files.ti: revision 1.9
sys/dev/fdt/usbnopphy.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.55
sys/arch/evbarm/conf/GENERIC: revision 1.56
sys/arch/evbarm/conf/GENERIC: revision 1.57
sys/arch/evbarm/conf/GENERIC: revision 1.58
sys/arch/evbarm/conf/GENERIC: revision 1.59
sys/arch/evbarm/conf/BEAGLEBONE: file removal
sys/arch/arm/ti/omap2_gpmcreg.h: revision 1.1
sys/arch/arm/ti/ti_otgreg.h: revision 1.1
sys/arch/arm/ti/ti_tptc.c: revision 1.1
sys/arch/evbarm/conf/IGEPV2: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.10
sys/dev/i2c/tda19988.c: revision 1.1
sys/arch/evbarm/conf/OVERO: file removal
sys/dev/i2c/tda19988.c: revision 1.2
sys/dev/i2c/tda19988.c: revision 1.3
sys/arch/arm/ti/omap3_dss.c: revision 1.1
sys/arch/evbarm/conf/BEAGLEBONE_INSTALL: file removal
sys/arch/arm/ti/ti_omapintc.c: revision 1.2
etc/etc.evbarm/Makefile.inc: revision 1.112
etc/etc.evbarm/Makefile.inc: revision 1.113
sys/arch/arm/ti/ti_div_clock.c: revision 1.1
etc/etc.evbarm/Makefile.inc: revision 1.114
sys/arch/evbarm/conf/N900: revision 1.32
sys/arch/evbarm/conf/N900: revision 1.33
distrib/utils/embedded/conf/armv7.conf: revision 1.36
sys/arch/evbarm/conf/GENERIC: revision 1.60
distrib/utils/embedded/conf/armv7.conf: revision 1.37
sys/arch/arm/ti/omap2_nand.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.61
sys/arch/arm/ti/omap2_nand.c: revision 1.2
sys/arch/evbarm/conf/GENERIC: revision 1.62
distrib/utils/embedded/conf/armv7.conf: revision 1.39
sys/arch/evbarm/conf/GENERIC: revision 1.63
sys/arch/arm/ti/ti_fb.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.64
sys/arch/evbarm/conf/GENERIC: revision 1.65
sys/arch/evbarm/conf/GENERIC: revision 1.66
sys/arch/evbarm/conf/GENERIC: revision 1.67
sys/arch/arm/ti/ti_platform.c: revision 1.7
sys/arch/arm/ti/ti_platform.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.2
sys/arch/arm/ti/ti_platform.c: revision 1.9
sys/arch/arm/ti/am3_prcm.c: revision 1.3
sys/arch/arm/ti/am3_prcm.c: revision 1.4
sys/arch/arm/ti/am3_prcm.c: revision 1.5
sys/arch/arm/ti/am3_prcm.c: revision 1.6
sys/arch/arm/ti/am3_prcm.c: revision 1.7
sys/arch/evbarm/conf/DEVKIT8000: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.9
sys/dev/fdt/syscon.c: revision 1.4
sys/arch/arm/ti/files.ti: revision 1.10
sys/arch/arm/ti/ti_mux_clock.c: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.11
sys/arch/arm/ti/if_cpswreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.12
sys/arch/arm/ti/ti_sdhc.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.13
sys/arch/arm/ti/files.ti: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.15
sys/arch/arm/ti/files.ti: revision 1.16
sys/arch/arm/ti/omap3_cm.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.17
sys/arch/arm/ti/omap3_cm.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.18
sys/arch/arm/ti/omap3_cm.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.19
sys/arch/arm/ti/omap3_cm.c: revision 1.4
sys/arch/arm/ti/ti_motg.c: revision 1.1
sys/arch/arm/ti/ti_rngreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.1
sys/arch/arm/dts/omap3-beagle-xm.dts: revision 1.1
sys/arch/arm/ti/am3_platform.c: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARDXM_INSTALL: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.22
sys/arch/evbarm/conf/README.evbarm: revision 1.23
sys/arch/arm/ti/ti_platform.c: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.24
sys/arch/arm/ti/ti_omaptimer.c: revision 1.2
sys/arch/arm/ti/ti_prcm.c: revision 1.2
sys/arch/evbarm/conf/README.evbarm: revision 1.25
sys/arch/arm/ti/ti_omaptimer.c: revision 1.3
sys/arch/arm/ti/ti_prcm.c: revision 1.3
sys/arch/evbarm/conf/README.evbarm: revision 1.26
sys/arch/arm/ti/ti_omaptimer.c: revision 1.4
sys/arch/evbarm/conf/README.evbarm: revision 1.27
sys/arch/arm/ti/ti_ehci.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.20
sys/arch/arm/ti/ti_cpufreq.c: revision 1.1
sys/arch/arm/ti/ti_cpufreq.c: revision 1.2
sys/arch/arm/fdt/smsh_fdt.c: revision 1.2
sys/arch/arm/ti/omap3_dssreg.h: revision 1.1
sys/arch/evbarm/conf/OVERO: revision 1.56
sys/arch/evbarm/conf/TI: file removal
sys/arch/arm/dts/omap3-beagle.dts: revision 1.1
sys/dev/fdt/fdtvar.h: revision 1.55
sys/dev/fdt/fdtvar.h: revision 1.56
distrib/utils/embedded/files/armv7_boot_nonefi.cmd: revision 1.2
sys/dev/fdt/fdt_phy.c: revision 1.6
sys/arch/arm/ti/ti_iicreg.h: revision 1.1
sys/arch/arm/ti/ti_lcdc.c: revision 1.1
sys/arch/arm/ti/ti_gpio.c: revision 1.1
sys/arch/arm/ti/ti_iicreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.c: revision 1.2
sys/dev/fdt/files.fdt: revision 1.46
sys/arch/arm/ti/ti_gpio.c: revision 1.2
sys/arch/arm/ti/ti_iicreg.h: revision 1.3
sys/arch/arm/ti/ti_lcdc.c: revision 1.3
sys/dev/fdt/files.fdt: revision 1.47
sys/arch/arm/ti/ti_gpio.c: revision 1.3
sys/dev/fdt/pinctrl_single.c: revision 1.1
sys/arch/evbarm/conf/files.generic: revision 1.9
sys/arch/arm/ti/ti_gpmc.c: revision 1.1
sys/arch/arm/ti/ti_lcdcreg.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARD: file removal
sys/arch/arm/ti/omap3_prm.c: revision 1.1
sys/arch/arm/ti/ti_platform.h: file removal
sys/arch/arm/ti/omap3_platform.c: revision 1.1
sys/arch/arm/ti/ti_prcm.h: revision 1.2
sys/arch/arm/ti/omap3_platform.c: revision 1.2
sys/arch/arm/ti/ti_prcm.h: revision 1.3
sys/arch/arm/ti/ti_prcm.h: revision 1.4
sys/dev/fdt/fdt_clock.c: revision 1.9
sys/arch/arm/ti/ti_edma.c: revision 1.1
sys/arch/arm/ti/ti_otg.c: revision 1.1
distrib/utils/embedded/files/armv7_boot.cmd: revision 1.15
sys/arch/arm/ti/if_cpsw.c: revision 1.7
sys/arch/evbarm/conf/std.igepv2: file removal
sys/arch/arm/ti/if_cpsw.c: revision 1.8
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.1

Adapt ti fdt glue to support GENERIC kernel.

Do not search 64-bit directories for dts files

Fix am33xx_platform_early_putchar for pre-MMU output

Add bus driver for TI sysc interconncet.

Make com work again

Add EDMA TPCC and TPTC drivers.

Add driver for one-register-per-pin type pinctrl devices.

Add MMCHS support.

Add USB support.

Disable autoidle

Place devmap above KERNEL_IO_VBASE

Use Timer2 for timecounter, and enable hw module.

Add support for TI AM335x

Add atmel,24c256 compat data

Add I2C support.

Add tiiic, tps65217pmic

Add FDT support

Fix early putchar, add reset func

No support for tegra210 in armv7 kernel

Switch to GENERIC kernels only.

Get mac address from DT

Skip nodes with an "opp-suspend" property and fix tables that have disabled
nodes in the middle.

enumerate devices under child "clocks" node

Add support for platform specific opp table filters.

Add fdtbus_clock_count to count the number of clock references on a given node

enumerate devices under child "clocks" node

Add AM335x DVFS support.

Enable TI AM335x DVFS support

Add support for GPIO controller.

Add tigpio

Unhook BEAGLEBONE kernel from the build
Remove BEAGLEBONE kernel config (AM335x SoC is supported by GENERIC now).

Add support for hardware RNG.

Add tirng

Add explicit FDT_OPP for operating-points-v2 so the link set won't be empty

Rename SOC_TI_AM335X to SOC_AM33XX and rename ti_platform.c to
am3_platform.c

Set stdout-path on TI OMAP3 BeagleBoard

Add support for TI OMAP3.

Add OMAP3 support.

Move a lot of *.dtb files to a dtb/ subdirectory on the FAT partition.
Mkimage (eroneously) creates a FAT16 partition (despite the configuration
asking for FAT32), and that has a root directory size limit.
Idea from Jared.

Skip xref if it is 0

Add generic USB PHY driver

Add driver for TI TWL4030 Power Management IC

Use the hwmod clk to get the timer rate and explicitly enable the
timecounter timer.

Add OMAP3 USB support.

Add twl, usbnopphy, tiusb, tiusbtll

Move omap3 dtb files to /boot/dtb

Remove BEAGLEBOARD kernel from list of kernels to build
Remove BEAGLEBOARD kernel (supported by GENERIC now)

Fix PRM_RSTCTRL_RST_DPLL3 definition, now reset works.

Remove DEVKIT8000 kernel (GENERIC should work now)
Remove DPLL5 init ported from old omap code, it is not required

Set the stdout-path on xM like Ti OMAP3 BeagleBoard

Remove BEAGLEBOARDXM from the build
Remove BEAGLEBOARDXM kernel (supported by GENERIC now)

Handle different register layout on OMAP3

Add omapfb to FDT-ized TI port.

Use dss as console on Nokia N900.

Enable IRQ status bits for omap3 type and set speed properly

Add RTC support

Remove tps65950pm (hardware now supported by twl4030.c)

Add NAND flash support.

Add tigpmc, omapnand

Attach tiusb before the default pass since it adds a bus to reduce kernel output
Replace tps65950pm with twl (the former has been removed)

Fix non-FDT build

Cleanup and remove dependency on arch/arm/omap

Add support for GPIO interrupts and fix reading the state of output pins.
Match smsc,lan9115 and honour local-mac-address/mac-address properties

Only one instance of twl(4) is needed
Remove OVERO from build, and commented out N900 kernel config
OMAP3 SoC and all peripherals in the OVERO kernel are now supported by
GENERIC.

Remove commented out IGEPV2 entry

OMAP3 SoC and all peripherals in the IGEPV2 kernel are now supported by
GENERIC.

No longer used.

Also match ti,omap2-onenand

Defer power monitor polling to the sysmon taskq thread to avoid i2c transactions in intr context

Add driver for NXP TDA19988 HDMI encoder

Add support for AM335x display controller (LCDC).

Add tdahdmi, tilcdc, tifb

Test DRM_MODE_* flags, not VID_*

Comment out mode fixup (not needed it seems)

Use 297MHz for display clock

Select closest rate to desired pixel clock

Speed up mode setting a bit and turn off the display while changing modes
 1.6.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1 11-May-2013  khorben branches: 1.1.2;
file tps65950reg.h was initially added on branch khorben-n900.
 1.1.2.4 12-May-2013  khorben Added keyboard support for the TPS65950 companion chip.

Tested on the Nokia N900 (multi-user)
 1.1.2.3 12-May-2013  khorben Added GPIO support to the TPS65950 companion chip. I haven't been able to
test it properly thus far unfortunately.

XXX Implement level-triggered interrupts.
 1.1.2.2 11-May-2013  khorben Beginning to handle interrupts from the TPS65950 companion chip.
 1.1.2.1 11-May-2013  khorben Moved register values to a separate file
 1.10 04-Jan-2021  thorpej Rename tsl256x.c -> tsllux.c. No other changes are made by this commit.
 1.9 04-Jan-2021  thorpej Tweak register bit names, in preparation for supporting younger siblings
of this chip.
 1.8 15-Jan-2020  thorpej branches: 1.8.6;
tsleep -> kpause
 1.7 25-Jul-2019  thorpej branches: 1.7.4;
The i2c code handles the 'cold' dance with I2C_F_POLL now; no need to
do it here.
 1.6 26-Jun-2018  thorpej branches: 1.6.2;
In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication). So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.
 1.5 18-Jun-2018  thorpej branches: 1.5.2;
- Rename iic_compat_match() to iic_compatible_match() and change it
to use the new device_compatible_match() routine. A pointer to
the matching device_compatible_entry is returned if a match is
found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
simplify model selection.

(I'm coming for you next, of_compat_data...)
 1.4 16-Jun-2018  thorpej More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.3 07-Jun-2018  thorpej Adjust come defaults:
- Initial gain -> 16x
- auto_gain -> true
 1.2 27-May-2018  thorpej Update the compat strings to match what Linux uses, per jmcneill@.
 1.1 27-May-2018  thorpej Add a driver for the Taos TSL256x light sensors.
 1.5.2.3 28-Jul-2018  pgoyette Sync with HEAD
 1.5.2.2 25-Jun-2018  pgoyette Sync with HEAD
 1.5.2.1 18-Jun-2018  pgoyette file tsl256x.c was added on branch pgoyette-compat on 2018-06-25 07:25:50 +0000
 1.6.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.6.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.4.1 17-Jan-2020  ad Sync with head.
 1.8.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2 04-Jan-2021  thorpej Tweak register bit names, in preparation for supporting younger siblings
of this chip.
 1.1 27-May-2018  thorpej branches: 1.1.2; 1.1.18;
Add a driver for the Taos TSL256x light sensors.
 1.1.18.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1.2.2 25-Jun-2018  pgoyette Sync with HEAD
 1.1.2.1 27-May-2018  pgoyette file tsl256xreg.h was added on branch pgoyette-compat on 2018-06-25 07:25:50 +0000
 1.4 12-Feb-2022  riastradh sys: Fix various abuse of struct device internals.

Will help to make struct device opaque later.
 1.3 27-Jan-2021  thorpej branches: 1.3.4;
Use DEVICE_COMPAT_EOL.
 1.2 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.1 04-Jan-2021  thorpej Rename tsl256x.c -> tsllux.c. No other changes are made by this commit.
 1.3.4.2 03-Apr-2021  thorpej Sync with HEAD.
 1.3.4.1 27-Jan-2021  thorpej file tsllux.c was added on branch thorpej-futex on 2021-04-03 22:28:44 +0000
 1.8 23-Dec-2019  thorpej No need to use I2C_F_POLL here.
 1.7 01-Jun-2017  chs branches: 1.7.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.6 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.5 17-Oct-2013  christos branches: 1.5.4; 1.5.6;
remove unused variable
 1.4 02-Oct-2011  jmcneill branches: 1.4.2; 1.4.12; 1.4.16;
now that iic is a module, add "iic" dependency to iic drivers
 1.3 15-Jul-2011  jmcneill add LG TDVS-H06xF support
 1.2 14-Jul-2011  jmcneill add module support
 1.1 11-Jul-2011  jakllsch Add subdriver for generic PLL-based TV tuners.
 1.4.16.1 18-May-2014  rmind sync with head
 1.4.12.2 03-Dec-2017  jdolecek update from HEAD
 1.4.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.6.2 28-Aug-2017  skrll Sync with HEAD
 1.5.6.1 06-Apr-2015  skrll Sync with HEAD
 1.5.4.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.7.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3 15-Jul-2011  jmcneill add LG TDVS-H06xF support
 1.2 14-Jul-2011  jmcneill correct pll entries for TDVS-H06xF
 1.1 11-Jul-2011  jakllsch Add subdriver for generic PLL-based TV tuners.
 1.2 15-Jul-2011  jmcneill struct tvpll_data foo -> extern struct tvpll_data foo
 1.1 11-Jul-2011  jakllsch Add subdriver for generic PLL-based TV tuners.
 1.2 15-Jul-2011  jmcneill add LG TDVS-H06xF support
 1.1 11-Jul-2011  jakllsch Add subdriver for generic PLL-based TV tuners.
 1.9 17-Sep-2025  thorpej These drivers conditionally support FDT (with an #ifdef). Rather than
blindly assume that i2c_attach_args::ia_cookie is an FDT phandle, consult
self's devhandle and, if the type is DEVHANDLE_TYPE_OF, exctract the phandle
from there.

XXX These drivers should probably become FDT-only (like many others already
are) because the functionality is questionable without information from the
device tree.
 1.8 08-Sep-2025  thorpej Garbage-collect fdtbus_todr_attach(); todr_attach() does all the
necessary work now.

kern/59630
 1.7 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.6 27-Jan-2021  thorpej branches: 1.6.4; 1.6.14;
Rename of_match_compat_data() to of_compatible_match(). Similarly,
rename of_search_compatible() to of_compatible_lookup().

Standardize on of_compatible_match() for driver matching, and adapt
all call sites.
 1.5 27-Jan-2021  thorpej Replace 2 uses of of_match_compatible(). Also use DEVICE_COMPAT_EOL.
 1.4 17-Jan-2021  thorpej Use designated initializers and a consistent termination style in
compat_data[].
 1.3 03-Nov-2019  jmcneill branches: 1.3.2; 1.3.10; 1.3.12;
Fix non-FDT build
 1.2 01-Nov-2019  jmcneill Add RTC support
 1.1 30-Oct-2019  jmcneill Add driver for TI TWL4030 Power Management IC
 1.3.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.10.1 03-Nov-2019  martin file twl4030.c was added on branch phil-wifi on 2020-04-13 08:04:20 +0000
 1.3.2.2 27-Nov-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #491):

sys/arch/evbarm/conf/BEAGLEBOARD_INSTALL: file removal
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.2
sys/arch/arm/ti/ti_sysc.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.1
sys/arch/arm/ti/ti_rng.c: revision 1.2
sys/dev/i2c/tps65950.c: file removal
sys/arch/evbarm/conf/std.ti: file removal
sys/dev/i2c/files.i2c: revision 1.101
sys/dev/i2c/files.i2c: revision 1.102
sys/dev/i2c/at24cxx.c: revision 1.32
sys/dev/i2c/files.i2c: revision 1.103
sys/dev/i2c/twl4030.c: revision 1.1
sys/dev/i2c/files.i2c: revision 1.104
sys/dev/i2c/twl4030.c: revision 1.2
sys/dev/i2c/twl4030.c: revision 1.3
sys/arch/arm/ti/ti_com.c: revision 1.6
sys/arch/arm/ti/ti_com.c: revision 1.7
sys/arch/arm/ti/ti_com.c: revision 1.8
sys/dev/fdt/cpufreq_dt.c: revision 1.11
sys/arch/arm/ti/ti_iic.c: revision 1.1
sys/dev/fdt/cpufreq_dt.c: revision 1.12
sys/arch/arm/ti/ti_usb.c: revision 1.1
sys/arch/arm/ti/ti_iic.c: revision 1.2
sys/dev/fdt/cpufreq_dt.c: revision 1.13
sys/arch/arm/ti/ti_iic.c: revision 1.3
sys/arch/arm/ti/ti_iic.c: revision 1.4
sys/arch/evbarm/conf/files.ti: file removal
sys/arch/evbarm/conf/BEAGLEBOARDXM: file removal
sys/arch/arm/dts/omap3-n900.dts: revision 1.1
sys/arch/arm/ti/ti_edma.h: revision 1.1
sys/arch/evbarm/conf/OVERO_INSTALL: file removal
sys/arch/arm/ti/ti_usbtll.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.5
etc/etc.evbarm/Makefile.inc: revision 1.108
sys/arch/arm/ti/files.ti: revision 1.6
sys/dev/i2c/tps65217pmic.c: revision 1.13
etc/etc.evbarm/Makefile.inc: revision 1.109
sys/arch/arm/ti/files.ti: revision 1.7
sys/dev/i2c/tps65217pmic.c: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.8
sys/arch/arm/ti/files.ti: revision 1.9
sys/dev/fdt/usbnopphy.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.55
sys/arch/evbarm/conf/GENERIC: revision 1.56
sys/arch/evbarm/conf/GENERIC: revision 1.57
sys/arch/evbarm/conf/GENERIC: revision 1.58
sys/arch/evbarm/conf/GENERIC: revision 1.59
sys/arch/evbarm/conf/BEAGLEBONE: file removal
sys/arch/arm/ti/omap2_gpmcreg.h: revision 1.1
sys/arch/arm/ti/ti_otgreg.h: revision 1.1
sys/arch/arm/ti/ti_tptc.c: revision 1.1
sys/arch/evbarm/conf/IGEPV2: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.10
sys/dev/i2c/tda19988.c: revision 1.1
sys/arch/evbarm/conf/OVERO: file removal
sys/dev/i2c/tda19988.c: revision 1.2
sys/dev/i2c/tda19988.c: revision 1.3
sys/arch/arm/ti/omap3_dss.c: revision 1.1
sys/arch/evbarm/conf/BEAGLEBONE_INSTALL: file removal
sys/arch/arm/ti/ti_omapintc.c: revision 1.2
etc/etc.evbarm/Makefile.inc: revision 1.112
etc/etc.evbarm/Makefile.inc: revision 1.113
sys/arch/arm/ti/ti_div_clock.c: revision 1.1
etc/etc.evbarm/Makefile.inc: revision 1.114
sys/arch/evbarm/conf/N900: revision 1.32
sys/arch/evbarm/conf/N900: revision 1.33
distrib/utils/embedded/conf/armv7.conf: revision 1.36
sys/arch/evbarm/conf/GENERIC: revision 1.60
distrib/utils/embedded/conf/armv7.conf: revision 1.37
sys/arch/arm/ti/omap2_nand.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.61
sys/arch/arm/ti/omap2_nand.c: revision 1.2
sys/arch/evbarm/conf/GENERIC: revision 1.62
distrib/utils/embedded/conf/armv7.conf: revision 1.39
sys/arch/evbarm/conf/GENERIC: revision 1.63
sys/arch/arm/ti/ti_fb.c: revision 1.1
sys/arch/evbarm/conf/GENERIC: revision 1.64
sys/arch/evbarm/conf/GENERIC: revision 1.65
sys/arch/evbarm/conf/GENERIC: revision 1.66
sys/arch/evbarm/conf/GENERIC: revision 1.67
sys/arch/arm/ti/ti_platform.c: revision 1.7
sys/arch/arm/ti/ti_platform.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.2
sys/arch/arm/ti/ti_platform.c: revision 1.9
sys/arch/arm/ti/am3_prcm.c: revision 1.3
sys/arch/arm/ti/am3_prcm.c: revision 1.4
sys/arch/arm/ti/am3_prcm.c: revision 1.5
sys/arch/arm/ti/am3_prcm.c: revision 1.6
sys/arch/arm/ti/am3_prcm.c: revision 1.7
sys/arch/evbarm/conf/DEVKIT8000: file removal
sys/arch/arm/ti/am3_prcm.c: revision 1.8
sys/arch/arm/ti/am3_prcm.c: revision 1.9
sys/dev/fdt/syscon.c: revision 1.4
sys/arch/arm/ti/files.ti: revision 1.10
sys/arch/arm/ti/ti_mux_clock.c: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.11
sys/arch/arm/ti/if_cpswreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhc.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.12
sys/arch/arm/ti/ti_sdhc.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.13
sys/arch/arm/ti/files.ti: revision 1.14
sys/arch/arm/ti/files.ti: revision 1.15
sys/arch/arm/ti/files.ti: revision 1.16
sys/arch/arm/ti/omap3_cm.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.17
sys/arch/arm/ti/omap3_cm.c: revision 1.2
sys/arch/arm/ti/files.ti: revision 1.18
sys/arch/arm/ti/omap3_cm.c: revision 1.3
sys/arch/arm/ti/files.ti: revision 1.19
sys/arch/arm/ti/omap3_cm.c: revision 1.4
sys/arch/arm/ti/ti_motg.c: revision 1.1
sys/arch/arm/ti/ti_rngreg.h: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.1
sys/arch/arm/dts/omap3-beagle-xm.dts: revision 1.1
sys/arch/arm/ti/am3_platform.c: revision 1.1
sys/arch/arm/ti/ti_sdhcreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARDXM_INSTALL: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.22
sys/arch/evbarm/conf/README.evbarm: revision 1.23
sys/arch/arm/ti/ti_platform.c: file removal
sys/arch/evbarm/conf/README.evbarm: revision 1.24
sys/arch/arm/ti/ti_omaptimer.c: revision 1.2
sys/arch/arm/ti/ti_prcm.c: revision 1.2
sys/arch/evbarm/conf/README.evbarm: revision 1.25
sys/arch/arm/ti/ti_omaptimer.c: revision 1.3
sys/arch/arm/ti/ti_prcm.c: revision 1.3
sys/arch/evbarm/conf/README.evbarm: revision 1.26
sys/arch/arm/ti/ti_omaptimer.c: revision 1.4
sys/arch/evbarm/conf/README.evbarm: revision 1.27
sys/arch/arm/ti/ti_ehci.c: revision 1.1
sys/arch/arm/ti/files.ti: revision 1.20
sys/arch/arm/ti/ti_cpufreq.c: revision 1.1
sys/arch/arm/ti/ti_cpufreq.c: revision 1.2
sys/arch/arm/fdt/smsh_fdt.c: revision 1.2
sys/arch/arm/ti/omap3_dssreg.h: revision 1.1
sys/arch/evbarm/conf/OVERO: revision 1.56
sys/arch/evbarm/conf/TI: file removal
sys/arch/arm/dts/omap3-beagle.dts: revision 1.1
sys/dev/fdt/fdtvar.h: revision 1.55
sys/dev/fdt/fdtvar.h: revision 1.56
distrib/utils/embedded/files/armv7_boot_nonefi.cmd: revision 1.2
sys/dev/fdt/fdt_phy.c: revision 1.6
sys/arch/arm/ti/ti_iicreg.h: revision 1.1
sys/arch/arm/ti/ti_lcdc.c: revision 1.1
sys/arch/arm/ti/ti_gpio.c: revision 1.1
sys/arch/arm/ti/ti_iicreg.h: revision 1.2
sys/arch/arm/ti/ti_lcdc.c: revision 1.2
sys/dev/fdt/files.fdt: revision 1.46
sys/arch/arm/ti/ti_gpio.c: revision 1.2
sys/arch/arm/ti/ti_iicreg.h: revision 1.3
sys/arch/arm/ti/ti_lcdc.c: revision 1.3
sys/dev/fdt/files.fdt: revision 1.47
sys/arch/arm/ti/ti_gpio.c: revision 1.3
sys/dev/fdt/pinctrl_single.c: revision 1.1
sys/arch/evbarm/conf/files.generic: revision 1.9
sys/arch/arm/ti/ti_gpmc.c: revision 1.1
sys/arch/arm/ti/ti_lcdcreg.h: revision 1.1
sys/arch/evbarm/conf/BEAGLEBOARD: file removal
sys/arch/arm/ti/omap3_prm.c: revision 1.1
sys/arch/arm/ti/ti_platform.h: file removal
sys/arch/arm/ti/omap3_platform.c: revision 1.1
sys/arch/arm/ti/ti_prcm.h: revision 1.2
sys/arch/arm/ti/omap3_platform.c: revision 1.2
sys/arch/arm/ti/ti_prcm.h: revision 1.3
sys/arch/arm/ti/ti_prcm.h: revision 1.4
sys/dev/fdt/fdt_clock.c: revision 1.9
sys/arch/arm/ti/ti_edma.c: revision 1.1
sys/arch/arm/ti/ti_otg.c: revision 1.1
distrib/utils/embedded/files/armv7_boot.cmd: revision 1.15
sys/arch/arm/ti/if_cpsw.c: revision 1.7
sys/arch/evbarm/conf/std.igepv2: file removal
sys/arch/arm/ti/if_cpsw.c: revision 1.8
sys/arch/arm/ti/ti_dpll_clock.c: revision 1.1

Adapt ti fdt glue to support GENERIC kernel.

Do not search 64-bit directories for dts files

Fix am33xx_platform_early_putchar for pre-MMU output

Add bus driver for TI sysc interconncet.

Make com work again

Add EDMA TPCC and TPTC drivers.

Add driver for one-register-per-pin type pinctrl devices.

Add MMCHS support.

Add USB support.

Disable autoidle

Place devmap above KERNEL_IO_VBASE

Use Timer2 for timecounter, and enable hw module.

Add support for TI AM335x

Add atmel,24c256 compat data

Add I2C support.

Add tiiic, tps65217pmic

Add FDT support

Fix early putchar, add reset func

No support for tegra210 in armv7 kernel

Switch to GENERIC kernels only.

Get mac address from DT

Skip nodes with an "opp-suspend" property and fix tables that have disabled
nodes in the middle.

enumerate devices under child "clocks" node

Add support for platform specific opp table filters.

Add fdtbus_clock_count to count the number of clock references on a given node

enumerate devices under child "clocks" node

Add AM335x DVFS support.

Enable TI AM335x DVFS support

Add support for GPIO controller.

Add tigpio

Unhook BEAGLEBONE kernel from the build
Remove BEAGLEBONE kernel config (AM335x SoC is supported by GENERIC now).

Add support for hardware RNG.

Add tirng

Add explicit FDT_OPP for operating-points-v2 so the link set won't be empty

Rename SOC_TI_AM335X to SOC_AM33XX and rename ti_platform.c to
am3_platform.c

Set stdout-path on TI OMAP3 BeagleBoard

Add support for TI OMAP3.

Add OMAP3 support.

Move a lot of *.dtb files to a dtb/ subdirectory on the FAT partition.
Mkimage (eroneously) creates a FAT16 partition (despite the configuration
asking for FAT32), and that has a root directory size limit.
Idea from Jared.

Skip xref if it is 0

Add generic USB PHY driver

Add driver for TI TWL4030 Power Management IC

Use the hwmod clk to get the timer rate and explicitly enable the
timecounter timer.

Add OMAP3 USB support.

Add twl, usbnopphy, tiusb, tiusbtll

Move omap3 dtb files to /boot/dtb

Remove BEAGLEBOARD kernel from list of kernels to build
Remove BEAGLEBOARD kernel (supported by GENERIC now)

Fix PRM_RSTCTRL_RST_DPLL3 definition, now reset works.

Remove DEVKIT8000 kernel (GENERIC should work now)
Remove DPLL5 init ported from old omap code, it is not required

Set the stdout-path on xM like Ti OMAP3 BeagleBoard

Remove BEAGLEBOARDXM from the build
Remove BEAGLEBOARDXM kernel (supported by GENERIC now)

Handle different register layout on OMAP3

Add omapfb to FDT-ized TI port.

Use dss as console on Nokia N900.

Enable IRQ status bits for omap3 type and set speed properly

Add RTC support

Remove tps65950pm (hardware now supported by twl4030.c)

Add NAND flash support.

Add tigpmc, omapnand

Attach tiusb before the default pass since it adds a bus to reduce kernel output
Replace tps65950pm with twl (the former has been removed)

Fix non-FDT build

Cleanup and remove dependency on arch/arm/omap

Add support for GPIO interrupts and fix reading the state of output pins.
Match smsc,lan9115 and honour local-mac-address/mac-address properties

Only one instance of twl(4) is needed
Remove OVERO from build, and commented out N900 kernel config
OMAP3 SoC and all peripherals in the OVERO kernel are now supported by
GENERIC.

Remove commented out IGEPV2 entry

OMAP3 SoC and all peripherals in the IGEPV2 kernel are now supported by
GENERIC.

No longer used.

Also match ti,omap2-onenand

Defer power monitor polling to the sysmon taskq thread to avoid i2c transactions in intr context

Add driver for NXP TDA19988 HDMI encoder

Add support for AM335x display controller (LCDC).

Add tdahdmi, tilcdc, tifb

Test DRM_MODE_* flags, not VID_*

Comment out mode fixup (not needed it seems)

Use 297MHz for display clock

Select closest rate to desired pixel clock

Speed up mode setting a bit and turn off the display while changing modes
 1.3.2.1 03-Nov-2019  martin file twl4030.c was added on branch netbsd-9 on 2019-11-27 13:46:45 +0000
 1.6.14.1 09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.6.4.1 08-May-2021  thorpej ia->ia_cookie -> devhandle_to_of(device_handle(self))
 1.6 11-Feb-2024  andvar s/Nuvaton/Nuvoton/ in log message.
 1.5 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.4 24-Apr-2021  thorpej branches: 1.4.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.3 16-Jun-2018  thorpej branches: 1.3.18;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.2 13-Apr-2014  christos branches: 1.2.2; 1.2.6; 1.2.30;
fix statement with no effect (Dave Tyson)
 1.1 06-Aug-2013  soren branches: 1.1.2; 1.1.4; 1.1.6;
Add driver for Nuvoton W83795G voltage/temp/fan/gpio monitoring device.

As used in the HP Microserver N36L/N40L/N54L:

w83795g* at iic? addr 0x2f
gpio* at gpiobus?

Note that the gpio and watchdog functionality appears to be useless on
the Microserver, as the gpio pins don't affect the LED's and a watchdog
trigger does not cause a reset. Perhaps the reset pin just isn't wired.

There are quite flexible fan control options as well as just monitoring,
but it is not clear to me how best to export that function to userspace.
 1.1.6.1 10-Aug-2014  tls Rebase.
 1.1.4.3 18-May-2014  rmind sync with head
 1.1.4.2 28-Aug-2013  rmind sync with head
 1.1.4.1 06-Aug-2013  rmind file w83795g.c was added on branch rmind-smpnet on 2013-08-28 23:59:25 +0000
 1.1.2.3 20-Oct-2013  bouyer apply patch, requested by simonb in ticket #970:
sys/dev/i2c/w83795g.c patch

Make this driver compile on the netbsd-6 branch (fix ticket #929).
 1.1.2.2 10-Aug-2013  riz Pull up following revision(s) (requested by matt in ticket #929):
sys/dev/i2c/w83795g.c: revision 1.1
sys/dev/i2c/w83795greg.h: revision 1.1
sys/dev/i2c/files.i2c: revision 1.50
Add driver for Nuvoton W83795G voltage/temp/fan/gpio monitoring device.
As used in the HP Microserver N36L/N40L/N54L:
w83795g* at iic? addr 0x2f
gpio* at gpiobus?
Note that the gpio and watchdog functionality appears to be useless on
the Microserver, as the gpio pins don't affect the LED's and a watchdog
trigger does not cause a reset. Perhaps the reset pin just isn't wired.
There are quite flexible fan control options as well as just monitoring,
but it is not clear to me how best to export that function to userspace.
 1.1.2.1 06-Aug-2013  riz file w83795g.c was added on branch netbsd-6 on 2013-08-10 22:50:56 +0000
 1.2.30.1 25-Jun-2018  pgoyette Sync with HEAD
 1.2.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.1 13-Apr-2014  tls file w83795g.c was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.2.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.2.1 13-Apr-2014  yamt file w83795g.c was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.3.18.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.4.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.1 06-Aug-2013  soren branches: 1.1.2; 1.1.4; 1.1.8; 1.1.12;
Add driver for Nuvoton W83795G voltage/temp/fan/gpio monitoring device.

As used in the HP Microserver N36L/N40L/N54L:

w83795g* at iic? addr 0x2f
gpio* at gpiobus?

Note that the gpio and watchdog functionality appears to be useless on
the Microserver, as the gpio pins don't affect the LED's and a watchdog
trigger does not cause a reset. Perhaps the reset pin just isn't wired.

There are quite flexible fan control options as well as just monitoring,
but it is not clear to me how best to export that function to userspace.
 1.1.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.12.1 06-Aug-2013  tls file w83795greg.h was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.1.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.8.1 06-Aug-2013  yamt file w83795greg.h was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.1.4.2 28-Aug-2013  rmind sync with head
 1.1.4.1 06-Aug-2013  rmind file w83795greg.h was added on branch rmind-smpnet on 2013-08-28 23:59:25 +0000
 1.1.2.2 10-Aug-2013  riz Pull up following revision(s) (requested by matt in ticket #929):
sys/dev/i2c/w83795g.c: revision 1.1
sys/dev/i2c/w83795greg.h: revision 1.1
sys/dev/i2c/files.i2c: revision 1.50
Add driver for Nuvoton W83795G voltage/temp/fan/gpio monitoring device.
As used in the HP Microserver N36L/N40L/N54L:
w83795g* at iic? addr 0x2f
gpio* at gpiobus?
Note that the gpio and watchdog functionality appears to be useless on
the Microserver, as the gpio pins don't affect the LED's and a watchdog
trigger does not cause a reset. Perhaps the reset pin just isn't wired.
There are quite flexible fan control options as well as just monitoring,
but it is not clear to me how best to export that function to userspace.
 1.1.2.1 06-Aug-2013  riz file w83795greg.h was added on branch netbsd-6 on 2013-08-10 22:50:56 +0000
 1.25 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.24 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.23 02-Jan-2020  thorpej Use todr_gettime_ymdhms / todr_settime_ymdhms.
 1.22 02-Jan-2020  thorpej - No need to use I2C_F_POLL here.
- Correctly propagate errors up the stack.
 1.21 16-Jun-2018  thorpej branches: 1.21.2;
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
all of the logic for direct-config matching. If it returns true,
the driver returns the match result (which may be 0). If it returns
false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
lower-indexed "compatible" device property are more-specific matches,
and return a better match quality accordingly.
 1.20 28-Oct-2017  riastradh branches: 1.20.2;
Kill some more extern struct cfdriver declarations.

Down with externs in .c!
 1.19 20-Nov-2014  christos use the inline bcdtobin and bintobcd directly instead through a macro.
 1.18 04-Aug-2014  joerg Assume bitops are meant here.
 1.17 25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.16 17-Mar-2014  skrll branches: 1.16.2;
Fix build.

Hi dh!
 1.15 16-Mar-2014  dholland Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.14 12-Dec-2009  tsutsui branches: 1.14.12; 1.14.22; 1.14.26;
Remove `volatile' qualifier from argument types of
struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.

XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
 1.13 08-Jun-2008  tsutsui Replace device_lookup() with device_lookup_private() to get softc
after device_t/softc split. PR kern/38885 from Jonathan A. Kollasch.
 1.12 04-May-2008  xtraeme branches: 1.12.2;
device_t/softc split and other related cosmetic changes.
 1.11 06-Apr-2008  cegger branches: 1.11.2; 1.11.4;
use aprint_*_dev and device_xname
 1.10 13-Jan-2007  cube branches: 1.10.40;
Complete initializers so those files compile.
 1.9 04-Sep-2006  gdamore branches: 1.9.2;
Remove unused todr_setcal/todr_getcal and all the assorted stub
implementations.
 1.8 29-Mar-2006  thorpej Use device_private().
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6; 1.7.8; 1.7.10; 1.7.12;
merge ktrace-lwp.
 1.6 04-Jun-2005  he branches: 1.6.2;
Fix the various todr_gettime() and todr_settime() fallouts from
-Wcast-qual differently, by instead changing the signatore of those
"functions" to take a "volatile struct timeval*" instead of a
"struct timeval*". Many places, these functions are called with
&time, and time is declared as volatile in <sys/kernel.h>. This
way we can get rid of all the ugly casts which now also triggered
warnings, and caused more code to be added to work around the
problem.

Reviewed by thorpej.
 1.5 03-Jun-2005  scw Appease -Wshadow
 1.4 13-Feb-2004  shige branches: 1.4.4;
Fix unlocking operation (RWEL register).

PR: kern/24231
Submitted by: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
 1.3 12-Feb-2004  shige Fix problem: checking 24H flag.

PR: kern/24229
Submitted by: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
 1.2 04-Feb-2004  shige Fix fatal bug.

1. read/write overflow to array size.
2. abnormal master addressing

PR: kern/23825 (splitted kern/{24227,24228,24229,24230,24231,24232})
Submitted by: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
 1.1 06-Oct-2003  shige Add XICOR X1226 RTC driver.
 1.4.4.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.4.5 17-Jan-2005  skrll Adapt to branch.
 1.4.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.4.4.2 03-Aug-2004  skrll Sync with HEAD
 1.4.4.1 13-Feb-2004  skrll file x1226.c was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.6.2.3 26-Feb-2007  yamt sync with head.
 1.6.2.2 30-Dec-2006  yamt sync with head.
 1.6.2.1 21-Jun-2006  yamt sync with head.
 1.7.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.7.10.1 19-Apr-2006  elad sync with head.
 1.7.8.2 14-Sep-2006  yamt sync with head.
 1.7.8.1 01-Apr-2006  yamt sync with head.
 1.7.6.1 22-Apr-2006  simonb Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.9.2.1 01-Feb-2007  ad Sync with head.
 1.10.40.2 29-Jun-2008  mjf Sync with HEAD.
 1.10.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.4.3 11-Mar-2010  yamt sync with head
 1.11.4.2 04-May-2009  yamt sync with head.
 1.11.4.1 16-May-2008  yamt sync with head.
 1.11.2.2 17-Jun-2008  yamt sync with head.
 1.11.2.1 18-May-2008  yamt sync with head.
 1.12.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.14.26.1 18-May-2014  rmind sync with head
 1.14.22.2 03-Dec-2017  jdolecek update from HEAD
 1.14.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16.2.1 10-Aug-2014  tls Rebase.
 1.20.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.21.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4 07-Aug-2013  soren Allow i2c addr wildcard matching. Use with care!
 1.3 11-Dec-2005  christos branches: 1.3.110; 1.3.120; 1.3.126;
merge ktrace-lwp.
 1.2 04-Feb-2004  shige branches: 1.2.4;
Fix fatal bug.

1. read/write overflow to array size.
2. abnormal master addressing

PR: kern/23825 (splitted kern/{24227,24228,24229,24230,24231,24232})
Submitted by: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
 1.1 06-Oct-2003  shige Add XICOR X1226 RTC driver.
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 04-Feb-2004  skrll file x1226reg.h was added on branch ktrace-lwp on 2004-08-03 10:46:06 +0000
 1.3.126.1 28-Aug-2013  rmind sync with head
 1.3.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7 18-Nov-2011  jmcneill remove Xbox support
 1.6 05-May-2008  jmcneill branches: 1.6.34;
Use 2-clause license.
 1.5 04-May-2008  xtraeme device_t/softc split and other related cosmetic changes.
 1.4 27-Mar-2008  ad branches: 1.4.2; 1.4.4;
Make it compile again.
 1.3 27-Mar-2008  jmcneill Use device_t, cfdata_t
 1.2 27-Mar-2008  jmcneill Split device_t and softc, replace malloc with kmem_alloc
 1.1 06-Jan-2007  jmcneill branches: 1.1.2; 1.1.6; 1.1.44;
Microsoft Xbox serial EEPROM driver. Currently reports the system serial
number as sysctl machdep.xbox_serial.
 1.1.44.2 02-Jun-2008  mjf Sync with HEAD.
 1.1.44.1 03-Apr-2008  mjf Sync with HEAD.
 1.1.6.2 26-Feb-2007  yamt sync with head.
 1.1.6.1 06-Jan-2007  yamt file xbseeprom.c was added on branch yamt-lazymbuf on 2007-02-26 09:10:04 +0000
 1.1.2.2 12-Jan-2007  ad Sync with head.
 1.1.2.1 06-Jan-2007  ad file xbseeprom.c was added on branch newlock2 on 2007-01-12 00:57:35 +0000
 1.4.4.1 16-May-2008  yamt sync with head.
 1.4.2.1 18-May-2008  yamt sync with head.
 1.6.34.1 17-Apr-2012  yamt sync with head
 1.9 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.8 01-Jun-2017  chs branches: 1.8.8; 1.8.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.7 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.6 07-Jan-2015  ozaki-r Pass a correct firmware size (instead of 0) to firmware_free

firmware_free now uses kmem_free(9) instead of free(9),
so we need to pass a correct size to it.
 1.5 02-Oct-2011  jmcneill branches: 1.5.12; 1.5.28; 1.5.30;
now that iic is a module, add "iic" dependency to iic drivers
 1.4 09-Aug-2011  jmcneill lg3303 should depend on dtv_math, not xc3028
 1.3 09-Aug-2011  jmcneill modify the dtv device api so hardware drivers can be loaded independently
of the dtv module
 1.2 22-Jul-2011  njoly Fix printf format
 1.1 11-Jul-2011  jmcneill add LGDT3303 tuner and XC3028L demod drivers
 1.5.30.2 28-Aug-2017  skrll Sync with HEAD
 1.5.30.1 06-Apr-2015  skrll Sync with HEAD
 1.5.28.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.5.12.1 03-Dec-2017  jdolecek update from HEAD
 1.8.10.1 10-Jun-2019  christos Sync with HEAD
 1.8.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1 11-Jul-2011  jmcneill add LGDT3303 tuner and XC3028L demod drivers
 1.1 11-Jul-2011  jmcneill add LGDT3303 tuner and XC3028L demod drivers
 1.9 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.8 12-Apr-2018  christos branches: 1.8.2;
PR/53177: David Binderman: Better error handling
 1.7 01-Jun-2017  chs branches: 1.7.8;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.6 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.5 07-Jan-2015  ozaki-r Pass a correct firmware size (instead of 0) to firmware_free

firmware_free now uses kmem_free(9) instead of free(9),
so we need to pass a correct size to it.
 1.4 02-Oct-2011  jmcneill branches: 1.4.12; 1.4.28; 1.4.30;
now that iic is a module, add "iic" dependency to iic drivers
 1.3 09-Jul-2011  jmcneill add digital capture support
 1.2 28-Dec-2010  jmcneill branches: 1.2.6;
don't make module declaration conditional on _MODULE
 1.1 27-Dec-2010  jmcneill add driver for the Auvitek AU0828 USB video controllers's analog video
capture functions:

auvitek0 at uhub6 port 2: AU0828
video0 at auvitek0: WinTV HVR-950Q
uaudio0 at auvitek0 port 2 configuration 1 interface 1
uaudio0: vendor 0x2040 product 0x7200, rev 2.00/0.05, addr 2
uaudio0: audio rev 1.00
audio1 at uaudio0: full duplex, playback, capture, independent
 1.2.6.2 05-Mar-2011  rmind sync with head
 1.2.6.1 28-Dec-2010  rmind file xc5k.c was added on branch rmind-uvmplock on 2011-03-05 20:53:10 +0000
 1.4.30.2 28-Aug-2017  skrll Sync with HEAD
 1.4.30.1 06-Apr-2015  skrll Sync with HEAD
 1.4.28.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.4.12.1 03-Dec-2017  jdolecek update from HEAD
 1.7.8.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.7.8.1 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.8.2.1 10-Jun-2019  christos Sync with HEAD
 1.2 09-Jul-2011  jmcneill add digital capture support
 1.1 27-Dec-2010  jmcneill branches: 1.1.6;
add driver for the Auvitek AU0828 USB video controllers's analog video
capture functions:

auvitek0 at uhub6 port 2: AU0828
video0 at auvitek0: WinTV HVR-950Q
uaudio0 at auvitek0 port 2 configuration 1 interface 1
uaudio0: vendor 0x2040 product 0x7200, rev 2.00/0.05, addr 2
uaudio0: audio rev 1.00
audio1 at uaudio0: full duplex, playback, capture, independent
 1.1.6.2 05-Mar-2011  rmind sync with head
 1.1.6.1 27-Dec-2010  rmind file xc5kreg.h was added on branch rmind-uvmplock on 2011-03-05 20:53:11 +0000
 1.2 09-Jul-2011  jmcneill add digital capture support
 1.1 27-Dec-2010  jmcneill branches: 1.1.6;
add driver for the Auvitek AU0828 USB video controllers's analog video
capture functions:

auvitek0 at uhub6 port 2: AU0828
video0 at auvitek0: WinTV HVR-950Q
uaudio0 at auvitek0 port 2 configuration 1 interface 1
uaudio0: vendor 0x2040 product 0x7200, rev 2.00/0.05, addr 2
uaudio0: audio rev 1.00
audio1 at uaudio0: full duplex, playback, capture, independent
 1.1.6.2 05-Mar-2011  rmind sync with head
 1.1.6.1 27-Dec-2010  rmind file xc5kvar.h was added on branch rmind-uvmplock on 2011-03-05 20:53:11 +0000
 1.5 01-Jun-2017  chs remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.4 07-Mar-2015  jmcneill i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.

A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.3 02-Oct-2011  jmcneill branches: 1.3.12; 1.3.28; 1.3.30;
now that iic is a module, add "iic" dependency to iic drivers
 1.2 29-Aug-2011  jruoho Fix RCS keyword string.
 1.1 29-Aug-2011  jruoho Add Zarlink ZL10353 DVB demodulator (or as it is now know, Intel CE623x).
 1.3.30.2 28-Aug-2017  skrll Sync with HEAD
 1.3.30.1 06-Apr-2015  skrll Sync with HEAD
 1.3.28.1 21-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #634):
distrib/sets/lists/modules/md.amd64: revision 1.51
distrib/sets/lists/modules/md.evbppc.powerpc: revision 1.5
distrib/sets/lists/modules/md.i386: revision 1.55
distrib/sets/lists/modules/mi: revision 1.71
sys/dev/i2c/au8522.c: revision 1.7
sys/dev/i2c/cx24227.c: revision 1.7
sys/dev/i2c/dbcool.c: revision 1.42
sys/dev/i2c/hytp14.c: revision 1.3
sys/dev/i2c/i2c_exec.c: revision 1.10
sys/dev/i2c/lg3303.c: revision 1.9
sys/dev/i2c/mt2131.c: revision 1.5
sys/dev/i2c/nxt2k.c: revision 1.4
sys/dev/i2c/sdtemp.c: revision 1.24
sys/dev/i2c/spdmem_i2c.c: revision 1.10
sys/dev/i2c/tvpll.c: revision 1.6
sys/dev/i2c/xc3028.c: revision 1.7
sys/dev/i2c/xc5k.c: revision 1.6
sys/dev/i2c/zl10353.c: revision 1.4
sys/modules/Makefile: revision 1.143
sys/modules/i2cexec/Makefile: revision 1.1
i2c devices don't actually have a dependency on "iic" (the bus driver)
but on "i2cexec". Create an i2cexec module (i2c_exec.c) to mirror the
dependencies in files.i2c and switch device drivers to depend on "i2cexec"
module instead.
A kernel with a USB stack and no I2C controller / bus attachment would spit
out a bunch of "WARNING: module error: can't find builtin dependency `iic'"
messages at boot. This change solves that problem.
 1.3.12.1 03-Dec-2017  jdolecek update from HEAD
 1.2 29-Aug-2011  jruoho Fix RCS keyword string.
 1.1 29-Aug-2011  jruoho Add Zarlink ZL10353 DVB demodulator (or as it is now know, Intel CE623x).
 1.2 29-Aug-2011  jruoho Fix RCS keyword string.
 1.1 29-Aug-2011  jruoho Add Zarlink ZL10353 DVB demodulator (or as it is now know, Intel CE623x).

RSS XML Feed