Home | History | Annotate | Download | only in i2c
History log of /src/sys/dev/i2c/i2cvar.h
RevisionDateAuthorComments
 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.

RSS XML Feed