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

RSS XML Feed