Skip to content

Drivers: GPIO: Allow AW9523 to be used without interrupts #94298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pyhys
Copy link

@pyhys pyhys commented Aug 9, 2025

There will be an compilation error if there is no interrupt GPIO defined in the device tree file, as parts of the config and data structs have #if that depends on the presence of interrupt GPIO.

Use the same #if constructs also on the functions that use those structs.

There will be an compilation error if there is no interrupt GPIO defined
in the device tree file, as parts of the config and data structs
have #if that depends on the presence of interrupt GPIO.

Use the same #if constructs also on the functions that use those
structs.

Signed-off-by: Jonas Berg <[email protected]>
@pyhys
Copy link
Author

pyhys commented Aug 9, 2025

Steps to reproduce

west build -b adafruit_qt_py_rp2040 samples/sensor/sensor_shell --pristine --shield adafruit_aw9523 -- -DCONFIG_GPIO=y -DCONFIG_GPIO_SHELL=y

Impact

Functional Limitation – Some features not working as expected, but system usable.

Environment

Ubuntu 24.04.2 LTS

Zephyr main August 9, commit 62f62db

Relevant log output

-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/jonas/zephyrproject/zephyr/samples/sensor/sensor_shell
-- CMake version: 3.28.3
-- Found Python3: /home/jonas/zephyrproject/.venv/bin/python3 (found suitable version "3.12.3", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /home/jonas/.cache/zephyr
-- Zephyr version: 4.2.99 (/home/jonas/zephyrproject/zephyr)
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: adafruit_qt_py_rp2040, qualifiers: rp2040
-- Shield(s): adafruit_aw9523
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.17.0 (/home/jonas/zephyr-sdk-0.17.0)
-- Found toolchain: zephyr 0.17.0 (/home/jonas/zephyr-sdk-0.17.0)
-- Found Dtc: /home/jonas/zephyr-sdk-0.17.0/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/jonas/zephyrproject/zephyr/boards/adafruit/qt_py_rp2040/adafruit_qt_py_rp2040.dts
-- Found devicetree overlay: /home/jonas/zephyrproject/zephyr/boards/shields/adafruit_aw9523/adafruit_aw9523.overlay
-- Generated zephyr.dts: /home/jonas/zephyrproject/zephyr/build/zephyr/zephyr.dts
-- Generated pickled edt: /home/jonas/zephyrproject/zephyr/build/zephyr/edt.pickle
-- Generated devicetree_generated.h: /home/jonas/zephyrproject/zephyr/build/zephyr/include/generated/zephyr/devicetree_generated.h
Parsing /home/jonas/zephyrproject/zephyr/samples/sensor/sensor_shell/Kconfig
Loaded configuration '/home/jonas/zephyrproject/zephyr/boards/adafruit/qt_py_rp2040/adafruit_qt_py_rp2040_defconfig'
Merged configuration '/home/jonas/zephyrproject/zephyr/samples/sensor/sensor_shell/prj.conf'
Merged configuration '/home/jonas/zephyrproject/zephyr/build/zephyr/misc/generated/extra_kconfig_options.conf'
Configuration saved to '/home/jonas/zephyrproject/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/jonas/zephyrproject/zephyr/build/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: /home/jonas/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/jonas/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Using ccache: /usr/bin/ccache
-- Found gen_kobject_list: /home/jonas/zephyrproject/zephyr/scripts/build/gen_kobject_list.py
-- Configuring done (9.3s)
-- Generating done (0.1s)
-- Build files have been written to: /home/jonas/zephyrproject/zephyr/build
-- west build: building application
[1/205] Preparing syscall dependency handling

[3/205] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.2.99 (/home/jonas/zephyrproject/zephyr), build: v4.2.0-1440-g62f62dbb0bde
[8/205] Performing configure step for 'second_stage_bootloader'
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/jonas/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/jonas/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is GNU
-- Found assembler: /home/jonas/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Configuring done (1.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/jonas/zephyrproject/zephyr/build/bootloader
[9/205] Performing build step for 'second_stage_bootloader'
[1/2] Building ASM object CMakeFiles/boot_stage2.dir/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2040/boot_stage2/boot2_w25q080.S.obj
[2/2] Linking ASM executable boot_stage2
[131/205] Building C object zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_aw9523b.c.obj
FAILED: zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_aw9523b.c.obj
ccache /home/jonas/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DPICOLIBC_DOUBLE_PRINTF_SCANF -DPICO_RP2040 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -I/home/jonas/zephyrproject/zephyr/build/zephyr/include/generated/zephyr -I/home/jonas/zephyrproject/zephyr/include -I/home/jonas/zephyrproject/zephyr/build/zephyr/include/generated -I/home/jonas/zephyrproject/zephyr/soc/raspberrypi/rpi_pico -I/home/jonas/zephyrproject/zephyr/lib/posix/options/getopt -I/home/jonas/zephyrproject/zephyr/soc/raspberrypi/rpi_pico/common/. -I/home/jonas/zephyrproject/zephyr/soc/raspberrypi/rpi_pico/rp2040/. -I/home/jonas/zephyrproject/zephyr/subsys/rtio -I/home/jonas/zephyrproject/zephyr/subsys/shell/modules/kernel_service/thread/.. -I/home/jonas/zephyrproject/modules/hal/cmsis_6/CMSIS/Core/Include -I/home/jonas/zephyrproject/zephyr/modules/cmsis_6/. -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/common/pico_base_headers/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/boot_bootrom_headers/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_base/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_clocks/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_watchdog/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_xosc/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_pll/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_irq/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_sync/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_timer/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_resets/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_boot_lock/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_ticks/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_sync_spin_lock/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/pico_bootrom/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/pico_flash/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/pico_platform_compiler/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/pico_platform_sections/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/pico_platform_panic/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/common/boot_picoboot_headers/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/common/boot_picobin_headers/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2040/hardware_regs/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2040/hardware_structs/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2040/pico_platform/include -I/home/jonas/zephyrproject/zephyr/modules/hal_rpi_pico -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_gpio/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/rp2_common/hardware_pio/include -I/home/jonas/zephyrproject/modules/hal/rpi_pico/src/common/hardware_claim/include -I/home/jonas/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/. -I/home/jonas/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/m0p -I/home/jonas/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals -I/home/jonas/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p -I/home/jonas/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl -isystem /home/jonas/zephyrproject/zephyr/lib/libc/common/include -Wshadow -fno-strict-aliasing -Os -imacros /home/jonas/zephyrproject/zephyr/build/zephyr/include/generated/zephyr/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m0plus -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=/home/jonas/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi -imacros /home/jonas/zephyrproject/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/jonas/zephyrproject/zephyr/samples/sensor/sensor_shell=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/jonas/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/jonas/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -D_POSIX_THREADS -std=c99 -MD -MT zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_aw9523b.c.obj -MF zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_aw9523b.c.obj.d -o zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_aw9523b.c.obj -c /home/jonas/zephyrproject/zephyr/drivers/gpio/gpio_aw9523b.c
In file included from /home/jonas/zephyrproject/zephyr/include/zephyr/toolchain.h:52,
                 from /home/jonas/zephyrproject/zephyr/include/zephyr/kernel_includes.h:23,
                 from /home/jonas/zephyrproject/zephyr/include/zephyr/kernel.h:17,
                 from /home/jonas/zephyrproject/zephyr/drivers/gpio/gpio_aw9523b.c:9:
/home/jonas/zephyrproject/zephyr/drivers/gpio/gpio_aw9523b.c: In function 'gpio_aw9523b_interrupt_worker':
/home/jonas/zephyrproject/zephyr/include/zephyr/sys/util.h:257:51: error: 'struct gpio_aw9523b_data' has no member named 'intr_worker'
  257 |         BUILD_ASSERT(SAME_TYPE(*(ptr), ((type *)0)->field) || \
      |                                                   ^~
/home/jonas/zephyrproject/zephyr/include/zephyr/toolchain/gcc.h:87:52: note: in definition of macro 'BUILD_ASSERT'
   87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
      |                                                    ^~~~
/home/jonas/zephyrproject/zephyr/include/zephyr/sys/util.h:257:22: note: in expansion of macro 'SAME_TYPE'
  257 |         BUILD_ASSERT(SAME_TYPE(*(ptr), ((type *)0)->field) || \
      |                      ^~~~~~~~~
/home/jonas/zephyrproject/zephyr/include/zephyr/sys/util.h:287:17: note: in expansion of macro 'CONTAINER_OF_VALIDATE'
  287 |                 CONTAINER_OF_VALIDATE(ptr, type, field)              \
      |                 ^~~~~~~~~~~~~~~~~~~~~

... Lots of macrobatics ...

/home/jonas/zephyrproject/zephyr/include/zephyr/sys/util.h:287:17: note: in expansion of macro 'CONTAINER_OF_VALIDATE'
  287 |                 CONTAINER_OF_VALIDATE(ptr, type, field)              \
      |                 ^~~~~~~~~~~~~~~~~~~~~
/home/jonas/zephyrproject/zephyr/drivers/gpio/gpio_aw9523b.c:354:42: note: in expansion of macro 'CONTAINER_OF'
  354 |         struct gpio_aw9523b_data *data = CONTAINER_OF(cb, struct gpio_aw9523b_data, gpio_callback);
      |                                          ^~~~~~~~~~~~
/home/jonas/zephyrproject/zephyr/include/zephyr/toolchain/gcc.h:87:51: error: expression in static assertion is not an integer
   87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
      |                                                   ^
/home/jonas/zephyrproject/zephyr/include/zephyr/sys/util.h:257:9: note: in expansion of macro 'BUILD_ASSERT'
  257 |         BUILD_ASSERT(SAME_TYPE(*(ptr), ((type *)0)->field) || \
      |         ^~~~~~~~~~~~
/home/jonas/zephyrproject/zephyr/include/zephyr/sys/util.h:287:17: note: in expansion of macro 'CONTAINER_OF_VALIDATE'
  287 |                 CONTAINER_OF_VALIDATE(ptr, type, field)              \
      |                 ^~~~~~~~~~~~~~~~~~~~~
/home/jonas/zephyrproject/zephyr/drivers/gpio/gpio_aw9523b.c:354:42: note: in expansion of macro 'CONTAINER_OF'
  354 |         struct gpio_aw9523b_data *data = CONTAINER_OF(cb, struct gpio_aw9523b_data, gpio_callback);
      |                                          ^~~~~~~~~~~~
/home/jonas/zephyrproject/zephyr/include/zephyr/sys/util.h:288:45: error: 'struct gpio_aw9523b_data' has no member named 'gpio_callback'
  288 |                 ((type *)(((char *)(ptr)) - offsetof(type, field))); \
      |                                             ^~~~~~~~
/home/jonas/zephyrproject/zephyr/drivers/gpio/gpio_aw9523b.c:354:42: note: in expansion of macro 'CONTAINER_OF'
  354 |         struct gpio_aw9523b_data *data = CONTAINER_OF(cb, struct gpio_aw9523b_data, gpio_callback);
      |                                          ^~~~~~~~~~~~
/home/jonas/zephyrproject/zephyr/drivers/gpio/gpio_aw9523b.c:356:28: error: 'struct gpio_aw9523b_data' has no member named 'intr_worker'
  356 |         k_work_submit(&data->intr_worker);
      |                            ^~
[133/205] Building C object zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_shell.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/jonas/zephyrproject/zephyr/build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants