History log of /freebsd/sys/dev/gpio/gpioiic.c (Results 1 – 25 of 46)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# e9d38570 02-Jan-2025 John Baldwin <jhb@FreeBSD.org>

Use bus_detach_children instead of bus_generic_detach

These drivers perform additional teardown steps in between detaching
child devices and deleting child devices.

Differential Revision: https://r

Use bus_detach_children instead of bus_generic_detach

These drivers perform additional teardown steps in between detaching
child devices and deleting child devices.

Differential Revision: https://reviews.freebsd.org/D47957

show more ...


# 18250ec6 06-Dec-2024 John Baldwin <jhb@FreeBSD.org>

Replace calls to bus_generic_attach with bus_attach_children

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D47675


Revision tags: release/14.2.0, release/13.4.0
# 5b56413d 25-Jul-2024 Warner Losh <imp@FreeBSD.org>

newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANY

Sponsored by: Netflix


Revision tags: release/14.1.0, release/13.3.0, release/14.0.0
# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


Revision tags: release/13.2.0, release/12.4.0, release/13.1.0
# 84c5f982 09-May-2022 John Baldwin <jhb@FreeBSD.org>

gpio: Remove unused devclass arguments to DRIVER_MODULE.


# 8c13dd83 19-Apr-2022 John Baldwin <jhb@FreeBSD.org>

Remove unused iicbb_devclass.


Revision tags: release/12.3.0, release/13.0.0
# 519b64e2 23-Jan-2021 Mark Johnston <markj@FreeBSD.org>

Revert "Define PNP info after defining driver modules"

This reverts commit aa37baf3d7cf51da92fd367476182802e71838ae.

The reverted commit was motivated by a problem observed on stable/12,
but it tur

Revert "Define PNP info after defining driver modules"

This reverts commit aa37baf3d7cf51da92fd367476182802e71838ae.

The reverted commit was motivated by a problem observed on stable/12,
but it turns out that a better solution was committed in r348309 but not
MFCed. So, revert this change since it is unnecessary and not really
correct: it assumes that the order in which module metadata records is
defined determines their order in the output linker set. While this
seems to hold in my testing, it is not guaranteed.

Reported by: cem
Discussed with: imp
MFC after: 3 days

show more ...


# aa37baf3 21-Jan-2021 Mark Johnston <markj@FreeBSD.org>

Define PNP info after defining driver modules

PNP info definitions currently have an unfortunate requirement in that
they must follow the associated module definition in the module metadata
linker s

Define PNP info after defining driver modules

PNP info definitions currently have an unfortunate requirement in that
they must follow the associated module definition in the module metadata
linker set. Otherwise devmatch can segfault while processing the linker
hints file since kldxref maintains the order in the linker set.

A number of drivers violate this requirement. In some cases this can
cause devmatch(8) to segfault when processing the linker hints file.
Work around the problem for now simply by adjusting the drivers.

Reviewed by: imp
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D28260

show more ...


Revision tags: release/12.2.0
# c7aa572c 31-Jul-2020 Glen Barber <gjb@FreeBSD.org>

MFH

Sponsored by: Rubicon Communications, LLC (netgate.com)


# e57f9c8a 21-Jul-2020 Andriy Gapon <avg@FreeBSD.org>

gpioiic: never drive lines active high

I2C communication is done by a combination of driving a line low or
letting it float, so that it is either pulled up or driven low by
another party.

r355276 b

gpioiic: never drive lines active high

I2C communication is done by a combination of driving a line low or
letting it float, so that it is either pulled up or driven low by
another party.

r355276 besides the stated goal of the change -- using the new GPIO API
-- also changed the logic, so that active state is signaled by actively
driving a line.

That worked with iicbb prior to r362042, but stopped working after that
commit on at least some hardware. My guess that the breakage was
related to getting an ACK bit. A device expected to be able to drive
SDA actively low, but controller was actively driving it high for some
time.

Anyway, this change seems to fix the problem.
Tested using gpioiic on Orange Pi PC Plus with HTU21 sensor.

Reported by: Nick Kostirya <nikolay.kostirya@i11.co>
Reviewed by: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25684

show more ...


Revision tags: release/11.4.0
# 20077ec0 07-May-2020 Andriy Gapon <avg@FreeBSD.org>

gpioiic_attach: fix a NULL pointer crash on hints-based systems

The attach method uses GPIO_GET_BUS() to get a "newbus" device
that provides a pin. But on hints-based systems a GPIO controller
driv

gpioiic_attach: fix a NULL pointer crash on hints-based systems

The attach method uses GPIO_GET_BUS() to get a "newbus" device
that provides a pin. But on hints-based systems a GPIO controller
driver might not be fully initialized yet and it does not know gpiobus
hanging off it. Thus, GPIO_GET_BUS() cannot be called yet.
The reason is that controller drivers typically create a child gpiobus
using gpiobus_attach_bus() and that leads to the following call chain:
gpiobus_attach_bus() -> gpiobus_attach() ->
bus_generic_attach(gpiobus) -> gpioiic_attach().
So, gpioiic_attach() is called before gpiobus_attach_bus() returns.

I observed this bug with nctgpio driver on amd64.
I think that the problem was introduced in r355276.

The fix is to avoid calling GPIO_GET_BUS() from the attach method.
Instead, we know that on hints-based systems only the parent gpiobus can
provide the pins.
Nothing is changed for FDT-based systems.

MFC after: 1 week

show more ...


# 6ef3bf45 02-Dec-2019 Ian Lepore <ian@FreeBSD.org>

Remove "all rights reserved" from copyright after getting a response from
Luiz that he also was not intentionally asserting that right, it was already
there when he added his name.


# 772b3a87 02-Dec-2019 Ian Lepore <ian@FreeBSD.org>

Fix leading whitespace (spaces->tabs) in comments; no functional change.


# 56ad49b2 02-Dec-2019 Ian Lepore <ian@FreeBSD.org>

Rewrite gpioiic(4) to use the gpio_pin_* API, and to conform to the modern
FDT bindings document for gpio-i2c devices.

Using the gpio_pin_* functions to acquire/release/manipulate gpio pins
removes

Rewrite gpioiic(4) to use the gpio_pin_* API, and to conform to the modern
FDT bindings document for gpio-i2c devices.

Using the gpio_pin_* functions to acquire/release/manipulate gpio pins
removes the constraint that both gpio pins must belong to the same gpio
controller/bank, and that the gpioiic instance must be a child of gpiobus.
Removing those constraints allows the driver to be fully compatible with
the modern dts bindings for a gpio bitbanged i2c bus.

For hinted attachment, the two gpio pins still must be on the same gpiobus,
and the device instance must be a child of that bus. This preserves
compatibility for existing installations that have use gpioiic(4) with hints.

show more ...


Revision tags: release/12.1.0
# ab0a2028 25-Oct-2019 Andriy Gapon <avg@FreeBSD.org>

gpioiic: set output after switching to output mode if presetting it failed

Some controllers cannot preset future output value while the pin is in
input mode. This adds a fallback for those controll

gpioiic: set output after switching to output mode if presetting it failed

Some controllers cannot preset future output value while the pin is in
input mode. This adds a fallback for those controllers. The new code
assumes that a controller reports an error in that case.

For example, all hardware supported by nctgpio behaves in that way.

This is a temporary measure. In the future we will use
GPIO_PIN_PRESET_LOW / GPIO_PIN_PRESET_HIGH to preset the output either
in hardware, if supported, or in software (e.g., in
gpiobus_pin_setflags).

While here, I extracted common functionality of gpioiic_set{sda,scl} and
gpioiic_get{sda,scl} to gpioiic_setpin and gpioiic_getpin respectively.

MFC after: 2 weeks

show more ...


# 44a57bfe 18-Oct-2019 Andriy Gapon <avg@FreeBSD.org>

gpioiic: add the detach method

bus_generic_detach was not enough, we also need to clean up the iicbus
child device.

MFC after: 1 week


Revision tags: release/11.3.0, release/12.0.0, release/11.2.0
# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

show more ...


Revision tags: release/10.4.0, release/11.1.0, release/11.0.1, release/11.0.0
# 0397efe8 22-May-2016 Luiz Otavio O Souza <loos@FreeBSD.org>

Sort and remove a couple of unnecessary headers.


# 03302aa3 22-May-2016 Luiz Otavio O Souza <loos@FreeBSD.org>

Get rid of two consumers of gpiobus acquire/release.

The GPIO hardware should not be owned by a single device, this defeats any
chance of use of the GPIO controller as an interrupt source.

ow(4) is

Get rid of two consumers of gpiobus acquire/release.

The GPIO hardware should not be owned by a single device, this defeats any
chance of use of the GPIO controller as an interrupt source.

ow(4) is now the only consumer of this 'feature' before we can remove it
for good.

Discussed with: ian, bsdimp

show more ...


# 16119eed 22-May-2016 Luiz Otavio O Souza <loos@FreeBSD.org>

Use a better prefix for defines, return BUS_PROBE_DEFAULT for probe routine.

Refuse to attach if the number of given pins is not enough for our needs.


# e2a1919d 11-May-2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org>

Use DEVMETHOD_END instead of its value to indicate end of methods table


# 876d357f 11-Apr-2016 Glen Barber <gjb@FreeBSD.org>

MFH

Sponsored by: The FreeBSD Foundation


# 71c1e744 11-Apr-2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org>

Fix IIC "how" argument dereferencing on big-endian platforms

"how" argument is passed as value of int* pointer to callback
function but dereferenced as char* so only one byte taken into
into account

Fix IIC "how" argument dereferencing on big-endian platforms

"how" argument is passed as value of int* pointer to callback
function but dereferenced as char* so only one byte taken into
into account. On little-endian systems it happens to work because
first byte is LSB that contains actual value, on big-endian it's
MSB and in this case it's always equal zero

PR: 207786
Submitted by: chadf@triularity.org

show more ...


Revision tags: release/10.3.0, release/10.2.0
# 8f0ea33f 13-Jan-2015 Glen Barber <gjb@FreeBSD.org>

Reintegrate head revisions r273096-r277147

Sponsored by: The FreeBSD Foundation


# 9268022b 19-Nov-2014 Simon J. Gerraty <sjg@FreeBSD.org>

Merge from head@274682


12