From 11c503c67b35269ab7e722af4233adad809197f5 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sun, 15 Sep 2024 02:17:33 +0900 Subject: [PATCH] 64bit --- boards/nordic/nrf9160dk/board.c | 4 +- doc/services/smf/index.rst | 2 +- drivers/adc/adc_ads114s0x.c | 4 +- drivers/adc/adc_ads1x1x.c | 4 +- drivers/adc/adc_lmp90xxx.c | 4 +- drivers/adc/adc_max1125x.c | 4 +- drivers/auxdisplay/auxdisplay_itron.c | 2 +- drivers/bluetooth/hci/apollox_blue.c | 8 +- drivers/bluetooth/hci/hci_spi_st.c | 4 +- drivers/bluetooth/hci/spi.c | 4 +- drivers/can/can_mcp2515.c | 4 +- drivers/can/can_mcp251xfd.c | 4 +- drivers/can/can_tcan4x5x.c | 2 +- drivers/charger/charger_max20335.c | 4 +- drivers/counter/maxim_ds3231.c | 4 +- drivers/counter/rtc_mcp7940n.c | 4 +- drivers/disk/sdmmc_stm32.c | 2 +- drivers/display/display_rm67162.c | 4 +- drivers/espi/espi_it8xxx2.c | 4 +- drivers/ethernet/eth_adin2111.c | 4 +- drivers/ethernet/eth_enc28j60.c | 4 +- drivers/ethernet/eth_enc424j600.c | 4 +- drivers/ethernet/eth_lan865x.c | 4 +- drivers/ethernet/eth_w5500.c | 4 +- drivers/ethernet/phy/phy_realtek_rtl8211f.c | 2 +- drivers/ethernet/phy/phy_tja1103.c | 4 +- drivers/gpio/gpio_ad559x.c | 2 +- drivers/gpio/gpio_axp192.c | 4 +- drivers/gpio/gpio_bd8lb600fs.c | 12 +- drivers/gpio/gpio_dw.c | 14 +- drivers/gpio/gpio_fxl6408.c | 10 +- drivers/gpio/gpio_mcp23xxx.c | 12 +- drivers/gpio/gpio_nct38xx_alert.c | 4 +- drivers/gpio/gpio_pca953x.c | 8 +- drivers/gpio/gpio_pca95xx.c | 12 +- drivers/gpio/gpio_pca_series.c | 5 +- drivers/gpio/gpio_pcal64xxa.c | 4 +- drivers/gpio/gpio_pcf857x.c | 6 +- drivers/gpio/gpio_rt1718s.c | 4 +- drivers/gpio/gpio_sx1509b.c | 6 +- drivers/gpio/gpio_tca6424a.c | 4 +- drivers/gpio/gpio_tle9104.c | 11 +- drivers/ieee802154/ieee802154_cc1200.c | 4 +- drivers/ieee802154/ieee802154_cc2520.c | 6 +- drivers/ieee802154/ieee802154_dw1000.c | 4 +- drivers/ieee802154/ieee802154_mcr20a.c | 4 +- drivers/ieee802154/ieee802154_rf2xx.c | 4 +- drivers/input/input_cap1203.c | 4 +- drivers/input/input_cf1133.c | 5 +- drivers/input/input_chsc6x.c | 5 +- drivers/input/input_cst816s.c | 5 +- drivers/input/input_ft5336.c | 4 +- drivers/input/input_gpio_kbd_matrix.c | 4 +- drivers/input/input_gpio_keys.c | 4 +- drivers/input/input_gpio_qdec.c | 4 +- drivers/input/input_gt911.c | 5 +- drivers/input/input_pat912x.c | 4 +- drivers/input/input_paw32xx.c | 4 +- drivers/input/input_pinnacle.c | 4 +- drivers/input/input_pmw3610.c | 4 +- drivers/input/input_stmpe811.c | 4 +- drivers/input/input_xpt2046.c | 5 +- drivers/led/ht16k33.c | 4 +- drivers/lora/sx126x_standalone.c | 4 +- drivers/lora/sx127x.c | 4 +- drivers/mfd/mfd_adp5585.c | 4 +- drivers/mfd/mfd_npm1300.c | 4 +- drivers/misc/ft8xx/ft8xx_drv.c | 4 +- drivers/modem/hl7800.c | 20 +- .../power_domain/power_domain_gpio_monitor.c | 2 +- drivers/rtc/rtc_am1805.c | 2 +- drivers/rtc/rtc_pcf8523.c | 2 +- drivers/rtc/rtc_pcf8563.c | 4 +- drivers/rtc/rtc_rv3028.c | 2 +- drivers/rtc/rtc_rv8263.c | 2 +- drivers/sdhc/imx_usdhc.c | 2 +- drivers/sensor/adi/adt7310/adt7310_trigger.c | 4 +- drivers/sensor/adi/adt7420/adt7420_trigger.c | 4 +- drivers/sensor/adi/adxl362/adxl362_trigger.c | 4 +- drivers/sensor/adi/adxl367/adxl367_trigger.c | 4 +- drivers/sensor/adi/adxl372/adxl372_trigger.c | 4 +- drivers/sensor/amg88xx/amg88xx_trigger.c | 4 +- drivers/sensor/ams/ccs811/ccs811_trigger.c | 4 +- drivers/sensor/ams/tcs3400/tcs3400.c | 4 +- drivers/sensor/ams/tmd2620/tmd2620.c | 5 +- drivers/sensor/ams/tsl2540/tsl2540_trigger.c | 4 +- drivers/sensor/ams/tsl2591/tsl2591_trigger.c | 5 +- drivers/sensor/apds9253/apds9253.c | 4 +- drivers/sensor/apds9960/apds9960.c | 4 +- drivers/sensor/bosch/bma280/bma280_trigger.c | 4 +- .../bosch/bmc150_magn/bmc150_magn_trigger.c | 4 +- drivers/sensor/bosch/bmg160/bmg160_trigger.c | 4 +- .../bosch/bmi08x/bmi08x_accel_trigger.c | 4 +- .../sensor/bosch/bmi08x/bmi08x_gyro_trigger.c | 4 +- drivers/sensor/bosch/bmi160/bmi160_trigger.c | 6 +- drivers/sensor/bosch/bmi270/bmi270_trigger.c | 6 +- drivers/sensor/bosch/bmi323/bmi323.c | 7 +- drivers/sensor/bosch/bmm150/bmm150_trigger.c | 4 +- drivers/sensor/bosch/bmp388/bmp388_trigger.c | 4 +- drivers/sensor/ens160/ens160_trigger.c | 5 +- .../sensor/grow_r502a/grow_r502a_trigger.c | 4 +- .../honeywell/hmc5883l/hmc5883l_trigger.c | 4 +- drivers/sensor/honeywell/sm351lt/sm351lt.c | 4 +- drivers/sensor/jedec/jc42/jc42_trigger.c | 4 +- drivers/sensor/lm75/lm75.c | 2 +- drivers/sensor/lm77/lm77.c | 2 +- drivers/sensor/memsic/mc3419/mc3419_trigger.c | 4 +- .../sensor/microchip/tcn75a/tcn75a_trigger.c | 4 +- .../sensor/nxp/fxas21002/fxas21002_trigger.c | 4 +- .../sensor/nxp/fxls8974/fxls8974_trigger.c | 4 +- .../sensor/nxp/fxos8700/fxos8700_trigger.c | 4 +- .../renesas/isl29035/isl29035_trigger.c | 4 +- .../sensor/sensirion/sht3xd/sht3xd_trigger.c | 4 +- drivers/sensor/st/hts221/hts221_trigger.c | 4 +- drivers/sensor/st/iis2dh/iis2dh_trigger.c | 4 +- drivers/sensor/st/iis2dlpc/iis2dlpc_trigger.c | 4 +- drivers/sensor/st/iis2iclx/iis2iclx_trigger.c | 4 +- drivers/sensor/st/iis2mdc/iis2mdc_trigger.c | 4 +- drivers/sensor/st/iis328dq/iis328dq_trigger.c | 8 +- drivers/sensor/st/iis3dhhc/iis3dhhc_trigger.c | 4 +- .../sensor/st/ism330dhcx/ism330dhcx_trigger.c | 4 +- drivers/sensor/st/lis2de12/lis2de12_trigger.c | 4 +- drivers/sensor/st/lis2dh/lis2dh_trigger.c | 8 +- drivers/sensor/st/lis2ds12/lis2ds12_trigger.c | 4 +- drivers/sensor/st/lis2du12/lis2du12_trigger.c | 4 +- .../sensor/st/lis2dux12/lis2dux12_trigger.c | 4 +- drivers/sensor/st/lis2dw12/lis2dw12_trigger.c | 4 +- drivers/sensor/st/lis2mdl/lis2mdl_trigger.c | 4 +- drivers/sensor/st/lis3mdl/lis3mdl_trigger.c | 4 +- drivers/sensor/st/lps22hh/lps22hh_trigger.c | 4 +- drivers/sensor/st/lps2xdf/lps2xdf_trigger.c | 4 +- drivers/sensor/st/lsm6dsl/lsm6dsl_trigger.c | 4 +- drivers/sensor/st/lsm6dso/lsm6dso_trigger.c | 4 +- .../st/lsm6dso16is/lsm6dso16is_trigger.c | 4 +- .../sensor/st/lsm6dsv16x/lsm6dsv16x_trigger.c | 4 +- .../st/lsm9ds0_gyro/lsm9ds0_gyro_trigger.c | 4 +- drivers/sensor/st/stts22h/stts22h_trigger.c | 4 +- drivers/sensor/st/stts751/stts751_trigger.c | 4 +- drivers/sensor/st/vl53l1x/vl53l1.c | 4 +- drivers/sensor/sx9500/sx9500_trigger.c | 4 +- .../sensor/tdk/icm42605/icm42605_trigger.c | 4 +- .../sensor/tdk/icm42670/icm42670_trigger.c | 4 +- .../sensor/tdk/icm42688/icm42688_trigger.c | 4 +- drivers/sensor/tdk/mpu6050/mpu6050_trigger.c | 4 +- drivers/sensor/tdk/mpu9250/mpu9250_trigger.c | 4 +- drivers/sensor/ti/bq274xx/bq274xx_trigger.c | 2 +- drivers/sensor/ti/fdc2x1x/fdc2x1x_trigger.c | 4 +- drivers/sensor/ti/ina23x/ina230_trigger.c | 4 +- drivers/sensor/ti/ina23x/ina23x_trigger.c | 4 +- drivers/sensor/ti/ti_hdc/ti_hdc.c | 4 +- drivers/sensor/ti/ti_hdc20xx/ti_hdc20xx.c | 4 +- drivers/sensor/ti/tmag5170/tmag5170_trigger.c | 4 +- drivers/sensor/ti/tmp007/tmp007_trigger.c | 4 +- drivers/sensor/ti/tmp108/tmp108.c | 2 +- .../sensor/vishay/vcnl4040/vcnl4040_trigger.c | 4 +- .../sensor/wsen/wsen_hids/wsen_hids_trigger.c | 169 ++++++++++++ drivers/sensor/wsen/wsen_itds/itds_trigger.c | 130 ++++++++++ .../sensor/wsen/wsen_pads/wsen_pads_trigger.c | 184 +++++++++++++ .../sensor/wsen/wsen_tids/wsen_tids_trigger.c | 243 ++++++++++++++++++ drivers/serial/uart_ite_it8xxx2.c | 8 +- drivers/serial/uart_mchp_xec.c | 4 +- drivers/serial/uart_smartbond.c | 8 +- drivers/spi/spi_nrfx_spis.c | 4 +- drivers/usb/bc12/bc12_pi3usb9201.c | 4 +- drivers/usb/uhc/uhc_max3421e.c | 4 +- drivers/usb_c/ppc/nxp_nx20p3483.c | 2 +- drivers/watchdog/wdt_nxp_fs26.c | 4 +- drivers/wifi/infineon/airoc_whd_hal.c | 2 +- drivers/wifi/nrfwifi/src/qspi/src/rpu_hw_if.c | 2 +- drivers/wifi/nrfwifi/src/shim.c | 3 +- drivers/wifi/winc1500/wifi_winc1500_nm_bsp.c | 2 +- samples/basic/button/src/main.c | 4 +- samples/bluetooth/central_otc/src/main.c | 3 +- .../encrypted_advertising/central/src/main.c | 5 +- .../peripheral/src/main.c | 5 +- samples/bluetooth/mesh/src/board.c | 2 +- samples/bluetooth/mesh/src/microbit.c | 4 +- samples/bluetooth/mesh_demo/src/microbit.c | 4 +- samples/bluetooth/mesh_provisioner/src/main.c | 5 +- .../bluetooth/st_ble_sensor/src/button_svc.c | 2 +- samples/bluetooth/st_ble_sensor/src/main.c | 2 +- .../microbit/line_follower_robot/src/main.c | 8 +- samples/boards/bbc/microbit/pong/src/main.c | 4 +- samples/boards/bbc/microbit/sound/src/main.c | 4 +- .../boards/nordic/mesh/onoff-app/src/main.c | 6 +- .../src/app_gpio.c | 4 +- samples/boards/nordic/nrfx_prs/src/main.c | 6 +- .../reel_board/mesh_badge/src/reel_board.c | 4 +- .../st/power_mgmt/standby_shutdown/src/main.c | 4 +- samples/drivers/can/babbling/src/main.c | 2 +- samples/drivers/i2s/echo/src/main.c | 6 +- samples/modules/canopennode/src/main.c | 4 +- samples/shields/npm1300_ek/src/main.c | 5 +- samples/shields/x_nucleo_53l0a1/src/main.c | 5 +- samples/subsys/display/lvgl/src/main.c | 4 +- .../bluetooth/controller/coex/coex_ticker.c | 4 +- .../backends/ec_host_cmd_backend_shi_ite.c | 2 +- .../backends/ec_host_cmd_backend_spi_stm32.c | 2 +- .../gpio_api_1pin/src/test_pin_interrupt.c | 4 +- .../gpio_basic_api/src/test_callback_manage.c | 10 +- .../src/test_callback_trigger.c | 6 +- .../gpio_basic_api/src/test_config_trigger.c | 9 +- .../gpio_enable_disable_interrupt/src/main.c | 4 +- .../gpio/gpio_ite_it8xxx2_v2/src/main.c | 12 +- 204 files changed, 1185 insertions(+), 432 deletions(-) create mode 100644 drivers/sensor/wsen/wsen_hids/wsen_hids_trigger.c create mode 100644 drivers/sensor/wsen/wsen_itds/itds_trigger.c create mode 100644 drivers/sensor/wsen/wsen_pads/wsen_pads_trigger.c create mode 100644 drivers/sensor/wsen/wsen_tids/wsen_tids_trigger.c diff --git a/boards/nordic/nrf9160dk/board.c b/boards/nordic/nrf9160dk/board.c index c8e680c45397afa..a21fa7f26a93838 100644 --- a/boards/nordic/nrf9160dk/board.c +++ b/boards/nordic/nrf9160dk/board.c @@ -95,7 +95,7 @@ static const struct switch_cfg routing_switches[] = { #if USE_RESET_GPIO static void chip_reset(const struct device *gpio, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { const uint32_t stamp = k_cycle_get_32(); @@ -136,7 +136,7 @@ static int reset_pin_configure(void) return rc; } - gpio_init_callback(&gpio_ctx, chip_reset, BIT(pin)); + gpio_init_callback(&gpio_ctx, chip_reset, GPIO_BIT(pin)); rc = gpio_add_callback(gpio, &gpio_ctx); if (rc) { diff --git a/doc/services/smf/index.rst b/doc/services/smf/index.rst index 9b5ee62af764212..31dae220ad59c96 100644 --- a/doc/services/smf/index.rst +++ b/doc/services/smf/index.rst @@ -495,7 +495,7 @@ Code:: return; } - gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); + gpio_init_callback(&button_cb_data, button_pressed, GPIO_BIT(button.pin)); gpio_add_callback(button.port, &button_cb_data); /* Initialize the event */ diff --git a/drivers/adc/adc_ads114s0x.c b/drivers/adc/adc_ads114s0x.c index 9864fd689f46d87..d0fa11287d037f2 100644 --- a/drivers/adc/adc_ads114s0x.c +++ b/drivers/adc/adc_ads114s0x.c @@ -442,7 +442,7 @@ struct ads114s0x_data { }; static void ads114s0x_data_ready_handler(const struct device *dev, struct gpio_callback *gpio_cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -1386,7 +1386,7 @@ static int ads114s0x_init(const struct device *dev) } gpio_init_callback(&data->callback_data_ready, ads114s0x_data_ready_handler, - BIT(config->gpio_data_ready.pin)); + GPIO_BIT(config->gpio_data_ready.pin)); result = gpio_add_callback(config->gpio_data_ready.port, &data->callback_data_ready); if (result != 0) { LOG_ERR("%s: failed to add data ready callback", dev->name); diff --git a/drivers/adc/adc_ads1x1x.c b/drivers/adc/adc_ads1x1x.c index 0502eb0c8780abb..20c40cf9677767b 100644 --- a/drivers/adc/adc_ads1x1x.c +++ b/drivers/adc/adc_ads1x1x.c @@ -680,7 +680,7 @@ static void ads1x1x_work_fn(struct k_work *work) static void ads1x1x_conv_ready_cb(const struct device *gpio_dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct ads1x1x_data *data; const struct device *dev; @@ -726,7 +726,7 @@ static int ads1x1x_init_interrupt(const struct device *dev) return rc; } gpio_init_callback(&data->gpio_cb, ads1x1x_conv_ready_cb, - BIT(config->alert_rdy.pin)); + GPIO_BIT(config->alert_rdy.pin)); rc = gpio_add_callback(config->alert_rdy.port, &data->gpio_cb); if (rc) { LOG_ERR("Could not set gpio callback."); diff --git a/drivers/adc/adc_lmp90xxx.c b/drivers/adc/adc_lmp90xxx.c index f71d6f4fa3879c5..6d3a1acb26a9c6b 100644 --- a/drivers/adc/adc_lmp90xxx.c +++ b/drivers/adc/adc_lmp90xxx.c @@ -708,7 +708,7 @@ static void lmp90xxx_acquisition_thread(void *p1, void *p2, void *p3) } static void lmp90xxx_drdyb_callback(const struct device *port, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lmp90xxx_data *data = CONTAINER_OF(cb, struct lmp90xxx_data, drdyb_cb); @@ -991,7 +991,7 @@ static int lmp90xxx_init(const struct device *dev) } gpio_init_callback(&data->drdyb_cb, lmp90xxx_drdyb_callback, - BIT(config->drdyb.pin)); + GPIO_BIT(config->drdyb.pin)); err = gpio_add_callback(config->drdyb.port, &data->drdyb_cb); if (err) { diff --git a/drivers/adc/adc_max1125x.c b/drivers/adc/adc_max1125x.c index a70748d420ef12a..d752e8b1bc58189 100644 --- a/drivers/adc/adc_max1125x.c +++ b/drivers/adc/adc_max1125x.c @@ -230,7 +230,7 @@ struct max1125x_data { }; static void max1125x_data_ready_handler(const struct device *dev, struct gpio_callback *gpio_cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -747,7 +747,7 @@ static int max1125x_init(const struct device *dev) } gpio_init_callback(&data->callback_data_ready, max1125x_data_ready_handler, - BIT(config->drdy_gpio.pin)); + GPIO_BIT(config->drdy_gpio.pin)); err = gpio_add_callback(config->drdy_gpio.port, &data->callback_data_ready); if (err != 0) { LOG_ERR("failed to add data ready callback (err %d)", err); diff --git a/drivers/auxdisplay/auxdisplay_itron.c b/drivers/auxdisplay/auxdisplay_itron.c index b5aa5d89f673f2e..4282f99382e922a 100644 --- a/drivers/auxdisplay/auxdisplay_itron.c +++ b/drivers/auxdisplay/auxdisplay_itron.c @@ -100,7 +100,7 @@ static int auxdisplay_itron_init(const struct device *dev) gpio_init_callback(&data->busy_wait_callback, auxdisplay_itron_busy_gpio_change_callback, - BIT(config->busy_gpio.pin)); + GPIO_BIT(config->busy_gpio.pin)); rc = gpio_add_callback(config->busy_gpio.port, &data->busy_wait_callback); if (rc != 0) { diff --git a/drivers/bluetooth/hci/apollox_blue.c b/drivers/bluetooth/hci/apollox_blue.c index 7994069a5a2a42d..80ff5f7e9d4fe0a 100644 --- a/drivers/bluetooth/hci/apollox_blue.c +++ b/drivers/bluetooth/hci/apollox_blue.c @@ -63,7 +63,7 @@ static const struct device *clk32k_dev = DEVICE_DT_GET(CLK_32K_NODE); #endif /* CONFIG_SOC_SERIES_APOLLO4X */ extern void bt_packet_irq_isr(const struct device *unused1, struct gpio_callback *unused2, - uint32_t unused3); + gpio_port_pins_t unused3); void bt_apollo_rcv_isr_preprocess(void) { @@ -92,7 +92,7 @@ static bool clkreq_pin_state(void) } static void bt_clkreq_isr(const struct device *unused1, struct gpio_callback *unused2, - uint32_t unused3) + gpio_port_pins_t unused3) { if (clkreq_pin_state()) { /* Enable XO32MHz */ @@ -271,7 +271,7 @@ int bt_hci_transport_setup(const struct device *dev) return ret; } - gpio_init_callback(&irq_gpio_cb, bt_packet_irq_isr, BIT(irq_gpio.pin)); + gpio_init_callback(&irq_gpio_cb, bt_packet_irq_isr, GPIO_BIT(irq_gpio.pin)); ret = gpio_add_callback(irq_gpio.port, &irq_gpio_cb); if (ret) { return ret; @@ -283,7 +283,7 @@ int bt_hci_transport_setup(const struct device *dev) return ret; } - gpio_init_callback(&clkreq_gpio_cb, bt_clkreq_isr, BIT(clkreq_gpio.pin)); + gpio_init_callback(&clkreq_gpio_cb, bt_clkreq_isr, GPIO_BIT(clkreq_gpio.pin)); ret = gpio_add_callback(clkreq_gpio.port, &clkreq_gpio_cb); if (ret) { return ret; diff --git a/drivers/bluetooth/hci/hci_spi_st.c b/drivers/bluetooth/hci/hci_spi_st.c index cc4d7f8b9d0e990..1aa543a3d846198 100644 --- a/drivers/bluetooth/hci/hci_spi_st.c +++ b/drivers/bluetooth/hci/hci_spi_st.c @@ -172,7 +172,7 @@ static inline uint16_t bt_spi_get_evt(uint8_t *msg) static void bt_spi_isr(const struct device *unused1, struct gpio_callback *unused2, - uint32_t unused3) + gpio_port_pins_t unused3) { LOG_DBG(""); @@ -656,7 +656,7 @@ static int bt_spi_open(const struct device *dev, bt_hci_recv_t recv) return err; } - gpio_init_callback(&gpio_cb, bt_spi_isr, BIT(irq_gpio.pin)); + gpio_init_callback(&gpio_cb, bt_spi_isr, GPIO_BIT(irq_gpio.pin)); err = gpio_add_callback(irq_gpio.port, &gpio_cb); if (err) { return err; diff --git a/drivers/bluetooth/hci/spi.c b/drivers/bluetooth/hci/spi.c index 05e46a1d182cfa8..167d19eca825431 100644 --- a/drivers/bluetooth/hci/spi.c +++ b/drivers/bluetooth/hci/spi.c @@ -121,7 +121,7 @@ static inline uint16_t bt_spi_get_evt(uint8_t *msg) static void bt_spi_isr(const struct device *unused1, struct gpio_callback *unused2, - uint32_t unused3) + gpio_port_pins_t unused3) { LOG_DBG(""); @@ -389,7 +389,7 @@ static int bt_spi_open(const struct device *dev, bt_hci_recv_t recv) return err; } - gpio_init_callback(&gpio_cb, bt_spi_isr, BIT(irq_gpio.pin)); + gpio_init_callback(&gpio_cb, bt_spi_isr, GPIO_BIT(irq_gpio.pin)); err = gpio_add_callback(irq_gpio.port, &gpio_cb); if (err) { return err; diff --git a/drivers/can/can_mcp2515.c b/drivers/can/can_mcp2515.c index 791f548cec5b436..e6821250d833f8d 100644 --- a/drivers/can/can_mcp2515.c +++ b/drivers/can/can_mcp2515.c @@ -869,7 +869,7 @@ static void mcp2515_int_thread(void *p1, void *p2, void *p3) } static void mcp2515_int_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct mcp2515_data *dev_data = CONTAINER_OF(cb, struct mcp2515_data, int_gpio_cb); @@ -949,7 +949,7 @@ static int mcp2515_init(const struct device *dev) } gpio_init_callback(&(dev_data->int_gpio_cb), mcp2515_int_gpio_callback, - BIT(dev_cfg->int_gpio.pin)); + GPIO_BIT(dev_cfg->int_gpio.pin)); if (gpio_add_callback(dev_cfg->int_gpio.port, &(dev_data->int_gpio_cb))) { diff --git a/drivers/can/can_mcp251xfd.c b/drivers/can/can_mcp251xfd.c index a367284e8f053dd..f1d6e5bd20b5ef2 100644 --- a/drivers/can/can_mcp251xfd.c +++ b/drivers/can/can_mcp251xfd.c @@ -1159,7 +1159,7 @@ static void mcp251xfd_int_thread(const struct device *dev) } static void mcp251xfd_int_gpio_callback(const struct device *dev_gpio, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(dev_gpio); struct mcp251xfd_data *dev_data = CONTAINER_OF(cb, struct mcp251xfd_data, int_gpio_cb); @@ -1553,7 +1553,7 @@ static int mcp251xfd_init(const struct device *dev) } gpio_init_callback(&dev_data->int_gpio_cb, mcp251xfd_int_gpio_callback, - BIT(dev_cfg->int_gpio_dt.pin)); + GPIO_BIT(dev_cfg->int_gpio_dt.pin)); if (gpio_add_callback_dt(&dev_cfg->int_gpio_dt, &dev_data->int_gpio_cb) < 0) { return -EINVAL; diff --git a/drivers/can/can_tcan4x5x.c b/drivers/can/can_tcan4x5x.c index a68ea5e22a48570..41b0e64ee2c93a0 100644 --- a/drivers/can/can_tcan4x5x.c +++ b/drivers/can/can_tcan4x5x.c @@ -624,7 +624,7 @@ static int tcan4x5x_init(const struct device *dev) } gpio_init_callback(&tcan_data->int_gpio_cb, tcan4x5x_int_gpio_callback_handler, - BIT(tcan_config->int_gpio.pin)); + GPIO_BIT(tcan_config->int_gpio.pin)); err = gpio_add_callback_dt(&tcan_config->int_gpio, &tcan_data->int_gpio_cb); if (err != 0) { diff --git a/drivers/charger/charger_max20335.c b/drivers/charger/charger_max20335.c index a58da7e57314909..fe05cce99683a17 100644 --- a/drivers/charger/charger_max20335.c +++ b/drivers/charger/charger_max20335.c @@ -512,7 +512,7 @@ static int max20335_enable_interrupt_pin(const struct device *dev, bool enabled) } static void max20335_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct charger_max20335_data *data = CONTAINER_OF(cb, struct charger_max20335_data, gpio_cb); @@ -597,7 +597,7 @@ static int max20335_configure_interrupt_pin(const struct device *dev) return ret; } - gpio_init_callback(&data->gpio_cb, max20335_gpio_callback, BIT(config->int_gpio.pin)); + gpio_init_callback(&data->gpio_cb, max20335_gpio_callback, GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback_dt(&config->int_gpio, &data->gpio_cb); if (ret < 0) { LOG_ERR("Could not add interrupt GPIO callback"); diff --git a/drivers/counter/maxim_ds3231.c b/drivers/counter/maxim_ds3231.c index 3fd63b1e17c8446..182b11434a37f01 100644 --- a/drivers/counter/maxim_ds3231.c +++ b/drivers/counter/maxim_ds3231.c @@ -961,7 +961,7 @@ static void sync_worker(struct k_work *work) static void isw_gpio_callback(const struct device *port, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct ds3231_data *data = CONTAINER_OF(cb, struct ds3231_data, isw_callback); @@ -1160,7 +1160,7 @@ static int ds3231_init(const struct device *dev) k_work_init(&data->sync_work, sync_worker); gpio_init_callback(&data->isw_callback, isw_gpio_callback, - BIT(cfg->isw_gpios.pin)); + GPIO_BIT(cfg->isw_gpios.pin)); rc = gpio_pin_configure_dt(&cfg->isw_gpios, GPIO_INPUT); if (rc >= 0) { diff --git a/drivers/counter/rtc_mcp7940n.c b/drivers/counter/rtc_mcp7940n.c index 7b441fb05a8f94f..ac0f4d92dff4dae 100644 --- a/drivers/counter/rtc_mcp7940n.c +++ b/drivers/counter/rtc_mcp7940n.c @@ -385,7 +385,7 @@ static void mcp7940n_work_handler(struct k_work *work) } static void mcp7940n_init_cb(const struct device *dev, - struct gpio_callback *gpio_cb, uint32_t pins) + struct gpio_callback *gpio_cb, gpio_port_pins_t pins) { struct mcp7940n_data *data = CONTAINER_OF(gpio_cb, struct mcp7940n_data, int_callback); @@ -710,7 +710,7 @@ static int mcp7940n_init(const struct device *dev) GPIO_INT_EDGE_TO_ACTIVE); gpio_init_callback(&data->int_callback, mcp7940n_init_cb, - BIT(cfg->int_gpios.pin)); + GPIO_BIT(cfg->int_gpios.pin)); gpio_add_callback(cfg->int_gpios.port, &data->int_callback); diff --git a/drivers/disk/sdmmc_stm32.c b/drivers/disk/sdmmc_stm32.c index 114e7d6b467ab23..c03d696565944c4 100644 --- a/drivers/disk/sdmmc_stm32.c +++ b/drivers/disk/sdmmc_stm32.c @@ -587,7 +587,7 @@ static void stm32_sdmmc_cd_handler(struct k_work *item) static void stm32_sdmmc_cd_callback(const struct device *gpiodev, struct gpio_callback *cb, - uint32_t pin) + gpio_port_pins_t pin) { struct stm32_sdmmc_priv *priv = CONTAINER_OF(cb, struct stm32_sdmmc_priv, diff --git a/drivers/display/display_rm67162.c b/drivers/display/display_rm67162.c index e63a44618101db5..859d103740db437 100644 --- a/drivers/display/display_rm67162.c +++ b/drivers/display/display_rm67162.c @@ -203,7 +203,7 @@ struct rm67162_data { }; static void rm67162_te_isr_handler(const struct device *gpio_dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct rm67162_data *data = CONTAINER_OF(cb, struct rm67162_data, te_gpio_cb); @@ -333,7 +333,7 @@ static int rm67162_init(const struct device *dev) /* Init and install GPIO callback */ gpio_init_callback(&data->te_gpio_cb, rm67162_te_isr_handler, - BIT(config->te_gpio.pin)); + GPIO_BIT(config->te_gpio.pin)); gpio_add_callback(config->te_gpio.port, &data->te_gpio_cb); /* Setup te pin semaphore */ diff --git a/drivers/espi/espi_it8xxx2.c b/drivers/espi/espi_it8xxx2.c index ef8eb7b7fbb5b53..0f3c97ec0a4e0f3 100644 --- a/drivers/espi/espi_it8xxx2.c +++ b/drivers/espi/espi_it8xxx2.c @@ -1807,7 +1807,7 @@ static void espi_it8xxx2_trans_isr(const struct device *dev) } void espi_it8xxx2_espi_reset_isr(const struct device *port, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct espi_it8xxx2_data *const data = ESPI_IT8XXX2_SOC_DEV->data; struct espi_event evt = {ESPI_BUS_RESET, 0, 0}; @@ -1838,7 +1838,7 @@ static void espi_it8xxx2_enable_reset(void) (IT8XXX2_GPIO_GCR_ESPI_RST_D2 << IT8XXX2_GPIO_GCR_ESPI_RST_POS); /* enable eSPI reset isr */ gpio_init_callback(&espi_reset_cb, espi_it8xxx2_espi_reset_isr, - BIT(ESPI_IT8XXX2_ESPI_RESET_PIN)); + GPIO_BIT(ESPI_IT8XXX2_ESPI_RESET_PIN)); gpio_add_callback(ESPI_IT8XXX2_ESPI_RESET_PORT, &espi_reset_cb); gpio_pin_interrupt_configure(ESPI_IT8XXX2_ESPI_RESET_PORT, ESPI_IT8XXX2_ESPI_RESET_PIN, diff --git a/drivers/ethernet/eth_adin2111.c b/drivers/ethernet/eth_adin2111.c index 536209a84efc4ed..f9bd41944d0bd91 100644 --- a/drivers/ethernet/eth_adin2111.c +++ b/drivers/ethernet/eth_adin2111.c @@ -771,7 +771,7 @@ static void adin2111_offload_thread(void *p1, void *p2, void *p3) static void adin2111_int_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -1406,7 +1406,7 @@ static int adin2111_init(const struct device *dev) gpio_init_callback(&(ctx->gpio_int_callback), adin2111_int_callback, - BIT(cfg->interrupt.pin)); + GPIO_BIT(cfg->interrupt.pin)); ret = gpio_add_callback(cfg->interrupt.port, &ctx->gpio_int_callback); if (ret < 0) { diff --git a/drivers/ethernet/eth_enc28j60.c b/drivers/ethernet/eth_enc28j60.c index d6e2b3691982559..9b43a93421715cb 100644 --- a/drivers/ethernet/eth_enc28j60.c +++ b/drivers/ethernet/eth_enc28j60.c @@ -328,7 +328,7 @@ static void eth_enc28j60_read_phy(const struct device *dev, static void eth_enc28j60_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct eth_enc28j60_runtime *context = CONTAINER_OF(cb, struct eth_enc28j60_runtime, gpio_cb); @@ -797,7 +797,7 @@ static int eth_enc28j60_init(const struct device *dev) } gpio_init_callback(&(context->gpio_cb), eth_enc28j60_gpio_callback, - BIT(config->interrupt.pin)); + GPIO_BIT(config->interrupt.pin)); if (gpio_add_callback(config->interrupt.port, &(context->gpio_cb))) { return -EINVAL; diff --git a/drivers/ethernet/eth_enc424j600.c b/drivers/ethernet/eth_enc424j600.c index 0e317c3d8ba948f..7216e7fc3c9ee21 100644 --- a/drivers/ethernet/eth_enc424j600.c +++ b/drivers/ethernet/eth_enc424j600.c @@ -218,7 +218,7 @@ static void enc424j600_read_mem(const struct device *dev, uint8_t opcode, static void enc424j600_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct enc424j600_runtime *context = CONTAINER_OF(cb, struct enc424j600_runtime, gpio_cb); @@ -713,7 +713,7 @@ static int enc424j600_init(const struct device *dev) } gpio_init_callback(&(context->gpio_cb), enc424j600_gpio_callback, - BIT(config->interrupt.pin)); + GPIO_BIT(config->interrupt.pin)); if (gpio_add_callback(config->interrupt.port, &(context->gpio_cb))) { return -EINVAL; diff --git a/drivers/ethernet/eth_lan865x.c b/drivers/ethernet/eth_lan865x.c index 870d6ab82cbaf32..1d0a92b34679bfb 100644 --- a/drivers/ethernet/eth_lan865x.c +++ b/drivers/ethernet/eth_lan865x.c @@ -386,7 +386,7 @@ static int lan865x_default_config(const struct device *dev, uint8_t silicon_rev) static void lan865x_int_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -513,7 +513,7 @@ static int lan865x_init(const struct device *dev) } gpio_init_callback(&(ctx->gpio_int_callback), lan865x_int_callback, - BIT(cfg->interrupt.pin)); + GPIO_BIT(cfg->interrupt.pin)); ret = gpio_add_callback(cfg->interrupt.port, &ctx->gpio_int_callback); if (ret < 0) { diff --git a/drivers/ethernet/eth_w5500.c b/drivers/ethernet/eth_w5500.c index 6f726c1c1ebc532..a4ec482ba335f68 100644 --- a/drivers/ethernet/eth_w5500.c +++ b/drivers/ethernet/eth_w5500.c @@ -489,7 +489,7 @@ static int w5500_soft_reset(const struct device *dev) static void w5500_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct w5500_runtime *ctx = CONTAINER_OF(cb, struct w5500_runtime, gpio_cb); @@ -549,7 +549,7 @@ static int w5500_init(const struct device *dev) } gpio_init_callback(&(ctx->gpio_cb), w5500_gpio_callback, - BIT(config->interrupt.pin)); + GPIO_BIT(config->interrupt.pin)); if (gpio_add_callback(config->interrupt.port, &(ctx->gpio_cb))) { return -EINVAL; diff --git a/drivers/ethernet/phy/phy_realtek_rtl8211f.c b/drivers/ethernet/phy/phy_realtek_rtl8211f.c index d0f25750128a9a4..61d5084a056ccd1 100644 --- a/drivers/ethernet/phy/phy_realtek_rtl8211f.c +++ b/drivers/ethernet/phy/phy_realtek_rtl8211f.c @@ -599,7 +599,7 @@ static int phy_rt_rtl8211f_init(const struct device *dev) } gpio_init_callback(&data->gpio_callback, phy_rt_rtl8211f_interrupt_handler, - BIT(config->interrupt_gpio.pin)); + GPIO_BIT(config->interrupt_gpio.pin)); ret = gpio_add_callback_dt(&config->interrupt_gpio, &data->gpio_callback); if (ret) { return ret; diff --git a/drivers/ethernet/phy/phy_tja1103.c b/drivers/ethernet/phy/phy_tja1103.c index 659fdbf80aa7e1d..04ade8d747ab042 100644 --- a/drivers/ethernet/phy/phy_tja1103.c +++ b/drivers/ethernet/phy/phy_tja1103.c @@ -270,7 +270,7 @@ static void phy_tja1103_irq_offload_thread(void *p1, void *p2, void *p3) } static void phy_tja1103_handle_irq(const struct device *port, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(pins); ARG_UNUSED(port); @@ -302,7 +302,7 @@ static void phy_tja1103_cfg_irq_poll(const struct device *dev) } gpio_init_callback(&(data->phy_tja1103_int_callback), phy_tja1103_handle_irq, - BIT(cfg->gpio_interrupt.pin)); + GPIO_BIT(cfg->gpio_interrupt.pin)); /* Add callback structure to global syslist */ ret = gpio_add_callback(cfg->gpio_interrupt.port, &data->phy_tja1103_int_callback); diff --git a/drivers/gpio/gpio_ad559x.c b/drivers/gpio/gpio_ad559x.c index afa3d1be10c7d45..479b945f77a77d6 100644 --- a/drivers/gpio/gpio_ad559x.c +++ b/drivers/gpio/gpio_ad559x.c @@ -29,7 +29,7 @@ struct gpio_ad559x_data { uint8_t gpio_pull_down; }; -static int gpio_ad559x_port_get_raw(const struct device *dev, uint32_t *value) +static int gpio_ad559x_port_get_raw(const struct device *dev, gpio_port_value_t *value) { const struct gpio_ad559x_config *config = dev->config; struct gpio_ad559x_data *drv_data = dev->data; diff --git a/drivers/gpio/gpio_axp192.c b/drivers/gpio/gpio_axp192.c index 661348bc1be3f24..3090bedb5313677 100644 --- a/drivers/gpio/gpio_axp192.c +++ b/drivers/gpio/gpio_axp192.c @@ -32,7 +32,7 @@ struct gpio_axp192_data { sys_slist_t cb_list_gpio; }; -static int gpio_axp192_port_get_raw(const struct device *dev, uint32_t *value) +static int gpio_axp192_port_get_raw(const struct device *dev, gpio_port_value_t *value) { int ret; uint8_t port_val; @@ -144,7 +144,7 @@ static int gpio_axp192_port_toggle_bits(const struct device *dev, gpio_port_pins { struct gpio_axp192_data *data = dev->data; int ret; - uint32_t value; + gpio_port_value_t value; k_mutex_lock(&data->mutex, K_FOREVER); diff --git a/drivers/gpio/gpio_bd8lb600fs.c b/drivers/gpio/gpio_bd8lb600fs.c index 4a2e5f7229f2dac..a495f1856152ebb 100644 --- a/drivers/gpio/gpio_bd8lb600fs.c +++ b/drivers/gpio/gpio_bd8lb600fs.c @@ -97,14 +97,14 @@ static int bd8lb600fs_gpio_pin_configure(const struct device *dev, gpio_pin_t pi return result; } -static int bd8lb600fs_gpio_port_get_raw(const struct device *dev, uint32_t *value) +static int bd8lb600fs_gpio_port_get_raw(const struct device *dev, gpio_port_value_t *value) { LOG_ERR("input pins are not available"); return -ENOTSUP; } -static int bd8lb600fs_gpio_port_set_masked_raw(const struct device *dev, uint32_t mask, - uint32_t value) +static int bd8lb600fs_gpio_port_set_masked_raw(const struct device *dev, gpio_port_pins_t mask, + gpio_port_value_t value) { const struct bd8lb600fs_gpio_config *config = dev->config; struct bd8lb600fs_gpio_data *data = dev->data; @@ -124,17 +124,17 @@ static int bd8lb600fs_gpio_port_set_masked_raw(const struct device *dev, uint32_ return result; } -static int bd8lb600fs_gpio_port_set_bits_raw(const struct device *dev, uint32_t mask) +static int bd8lb600fs_gpio_port_set_bits_raw(const struct device *dev, gpio_port_pins_t mask) { return bd8lb600fs_gpio_port_set_masked_raw(dev, mask, mask); } -static int bd8lb600fs_gpio_port_clear_bits_raw(const struct device *dev, uint32_t mask) +static int bd8lb600fs_gpio_port_clear_bits_raw(const struct device *dev, gpio_port_pins_t mask) { return bd8lb600fs_gpio_port_set_masked_raw(dev, mask, 0); } -static int bd8lb600fs_gpio_port_toggle_bits(const struct device *dev, uint32_t mask) +static int bd8lb600fs_gpio_port_toggle_bits(const struct device *dev, gpio_port_pins_t mask) { const struct bd8lb600fs_gpio_config *config = dev->config; struct bd8lb600fs_gpio_data *data = dev->data; diff --git a/drivers/gpio/gpio_dw.c b/drivers/gpio/gpio_dw.c index 1aaaaee6117ced1..fb357d582971590 100644 --- a/drivers/gpio/gpio_dw.c +++ b/drivers/gpio/gpio_dw.c @@ -26,9 +26,9 @@ #include #endif -static int gpio_dw_port_set_bits_raw(const struct device *port, uint32_t mask); +static int gpio_dw_port_set_bits_raw(const struct device *port, gpio_port_pins_t mask); static int gpio_dw_port_clear_bits_raw(const struct device *port, - uint32_t mask); + gpio_port_pins_t mask); /* * ARC architecture configure IP through IO auxiliary registers. @@ -301,7 +301,7 @@ static inline int gpio_dw_config(const struct device *port, return 0; } -static int gpio_dw_port_get_raw(const struct device *port, uint32_t *value) +static int gpio_dw_port_get_raw(const struct device *port, gpio_port_value_t *value) { struct gpio_dw_runtime *context = port->data; uint32_t base_addr = dw_base_to_block_base(context->base_addr); @@ -314,7 +314,7 @@ static int gpio_dw_port_get_raw(const struct device *port, uint32_t *value) } static int gpio_dw_port_set_masked_raw(const struct device *port, - uint32_t mask, uint32_t value) + gpio_port_pins_t mask, gpio_port_value_t value) { struct gpio_dw_runtime *context = port->data; uint32_t base_addr = dw_base_to_block_base(context->base_addr); @@ -329,7 +329,7 @@ static int gpio_dw_port_set_masked_raw(const struct device *port, return 0; } -static int gpio_dw_port_set_bits_raw(const struct device *port, uint32_t mask) +static int gpio_dw_port_set_bits_raw(const struct device *port, gpio_port_pins_t mask) { struct gpio_dw_runtime *context = port->data; uint32_t base_addr = dw_base_to_block_base(context->base_addr); @@ -345,7 +345,7 @@ static int gpio_dw_port_set_bits_raw(const struct device *port, uint32_t mask) } static int gpio_dw_port_clear_bits_raw(const struct device *port, - uint32_t mask) + gpio_port_pins_t mask) { struct gpio_dw_runtime *context = port->data; uint32_t base_addr = dw_base_to_block_base(context->base_addr); @@ -360,7 +360,7 @@ static int gpio_dw_port_clear_bits_raw(const struct device *port, return 0; } -static int gpio_dw_port_toggle_bits(const struct device *port, uint32_t mask) +static int gpio_dw_port_toggle_bits(const struct device *port, gpio_port_pins_t mask) { struct gpio_dw_runtime *context = port->data; uint32_t base_addr = dw_base_to_block_base(context->base_addr); diff --git a/drivers/gpio/gpio_fxl6408.c b/drivers/gpio/gpio_fxl6408.c index 7352390e371a9e0..6a078c94f82c88b 100644 --- a/drivers/gpio/gpio_fxl6408.c +++ b/drivers/gpio/gpio_fxl6408.c @@ -291,7 +291,7 @@ static int gpio_fxl6408_pin_config(const struct device *dev, gpio_pin_t pin, return ret; } -static int gpio_fxl6408_port_get_raw(const struct device *dev, uint32_t *value) +static int gpio_fxl6408_port_get_raw(const struct device *dev, gpio_port_value_t *value) { struct gpio_fxl6408_drv_data *const drv_data = (struct gpio_fxl6408_drv_data *const)dev->data; @@ -317,7 +317,7 @@ static int gpio_fxl6408_port_get_raw(const struct device *dev, uint32_t *value) } static int gpio_fxl6408_port_set_masked_raw(const struct device *dev, - uint32_t mask, uint32_t value) + gpio_port_pins_t mask, gpio_port_value_t value) { struct gpio_fxl6408_drv_data *const drv_data = (struct gpio_fxl6408_drv_data *const)dev->data; @@ -342,19 +342,19 @@ static int gpio_fxl6408_port_set_masked_raw(const struct device *dev, } static int gpio_fxl6408_port_set_bits_raw(const struct device *dev, - uint32_t mask) + gpio_port_pins_t mask) { return gpio_fxl6408_port_set_masked_raw(dev, mask, mask); } static int gpio_fxl6408_port_clear_bits_raw(const struct device *dev, - uint32_t mask) + gpio_port_pins_t mask) { return gpio_fxl6408_port_set_masked_raw(dev, mask, 0); } static int gpio_fxl6408_port_toggle_bits(const struct device *dev, - uint32_t mask) + gpio_port_pins_t mask) { struct gpio_fxl6408_drv_data *const drv_data = (struct gpio_fxl6408_drv_data *const)dev->data; diff --git a/drivers/gpio/gpio_mcp23xxx.c b/drivers/gpio/gpio_mcp23xxx.c index 3bfec31077bdf23..0cc77367db9b2b5 100644 --- a/drivers/gpio/gpio_mcp23xxx.c +++ b/drivers/gpio/gpio_mcp23xxx.c @@ -203,7 +203,7 @@ static int mcp23xxx_pin_cfg(const struct device *dev, gpio_pin_t pin, gpio_flags return ret; } -static int mcp23xxx_port_get_raw(const struct device *dev, uint32_t *value) +static int mcp23xxx_port_get_raw(const struct device *dev, gpio_port_value_t *value) { struct mcp23xxx_drv_data *drv_data = dev->data; uint16_t buf; @@ -224,7 +224,7 @@ static int mcp23xxx_port_get_raw(const struct device *dev, uint32_t *value) return ret; } -static int mcp23xxx_port_set_masked_raw(const struct device *dev, uint32_t mask, uint32_t value) +static int mcp23xxx_port_set_masked_raw(const struct device *dev, gpio_port_pins_t mask, gpio_port_value_t value) { struct mcp23xxx_drv_data *drv_data = dev->data; uint16_t buf; @@ -248,17 +248,17 @@ static int mcp23xxx_port_set_masked_raw(const struct device *dev, uint32_t mask, return ret; } -static int mcp23xxx_port_set_bits_raw(const struct device *dev, uint32_t mask) +static int mcp23xxx_port_set_bits_raw(const struct device *dev, gpio_port_pins_t mask) { return mcp23xxx_port_set_masked_raw(dev, mask, mask); } -static int mcp23xxx_port_clear_bits_raw(const struct device *dev, uint32_t mask) +static int mcp23xxx_port_clear_bits_raw(const struct device *dev, gpio_port_pins_t mask) { return mcp23xxx_port_set_masked_raw(dev, mask, 0); } -static int mcp23xxx_port_toggle_bits(const struct device *dev, uint32_t mask) +static int mcp23xxx_port_toggle_bits(const struct device *dev, gpio_port_pins_t mask) { struct mcp23xxx_drv_data *drv_data = dev->data; uint16_t buf; @@ -543,7 +543,7 @@ int gpio_mcp23xxx_init(const struct device *dev) } gpio_init_callback(&drv_data->int_gpio_cb, mcp23xxx_int_gpio_handler, - BIT(config->gpio_int.pin)); + GPIO_BIT(config->gpio_int.pin)); err = gpio_add_callback(config->gpio_int.port, &drv_data->int_gpio_cb); if (err != 0) { LOG_ERR("Failed to add INT callback: %d", err); diff --git a/drivers/gpio/gpio_nct38xx_alert.c b/drivers/gpio/gpio_nct38xx_alert.c index eb52339364a29b0..c97711842fe7557 100644 --- a/drivers/gpio/gpio_nct38xx_alert.c +++ b/drivers/gpio/gpio_nct38xx_alert.c @@ -48,7 +48,7 @@ struct nct38xx_alert_data { }; static void nct38xx_alert_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(pins); struct nct38xx_alert_data *data = CONTAINER_OF(cb, struct nct38xx_alert_data, gpio_cb); @@ -142,7 +142,7 @@ static int nct38xx_alert_init(const struct device *dev) gpio_pin_configure_dt(&config->irq_gpio, GPIO_INPUT); - gpio_init_callback(&data->gpio_cb, nct38xx_alert_callback, BIT(config->irq_gpio.pin)); + gpio_init_callback(&data->gpio_cb, nct38xx_alert_callback, GPIO_BIT(config->irq_gpio.pin)); ret = gpio_add_callback(config->irq_gpio.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/gpio/gpio_pca953x.c b/drivers/gpio/gpio_pca953x.c index 81898e83382b408..6ff3942aa9997df 100644 --- a/drivers/gpio/gpio_pca953x.c +++ b/drivers/gpio/gpio_pca953x.c @@ -170,7 +170,7 @@ static void gpio_pca953x_work_handler(struct k_work *work) * @param pins Bitmask of pins that triggered interrupt */ static void gpio_pca953x_init_cb(const struct device *dev, - struct gpio_callback *gpio_cb, uint32_t pins) + struct gpio_callback *gpio_cb, gpio_port_pins_t pins) { struct pca953x_drv_data *drv_data = CONTAINER_OF(gpio_cb, struct pca953x_drv_data, gpio_cb); @@ -307,8 +307,8 @@ static int gpio_pca953x_port_write(const struct device *dev, k_sem_give(&drv_data->lock); - LOG_DBG("write %x msk %08x val %08x => %x: %d", orig_out, mask, - value, out, rc); + //LOG_DBG("write %x msk %08x val %08x => %x: %d", orig_out, mask, + // value, out, rc); return rc; } @@ -439,7 +439,7 @@ static int gpio_pca953x_init(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, gpio_pca953x_init_cb, - BIT(cfg->gpio_int.pin)); + GPIO_BIT(cfg->gpio_int.pin)); rc = gpio_add_callback(cfg->gpio_int.port, &drv_data->gpio_cb); diff --git a/drivers/gpio/gpio_pca95xx.c b/drivers/gpio/gpio_pca95xx.c index 2cfffe7e198f26a..7755af7874a3a28 100644 --- a/drivers/gpio/gpio_pca95xx.c +++ b/drivers/gpio/gpio_pca95xx.c @@ -490,7 +490,7 @@ static int gpio_pca95xx_config(const struct device *dev, return ret; } -static int gpio_pca95xx_port_get_raw(const struct device *dev, uint32_t *value) +static int gpio_pca95xx_port_get_raw(const struct device *dev, gpio_port_value_t *value) { struct gpio_pca95xx_drv_data * const drv_data = (struct gpio_pca95xx_drv_data * const)dev->data; @@ -517,7 +517,7 @@ static int gpio_pca95xx_port_get_raw(const struct device *dev, uint32_t *value) } static int gpio_pca95xx_port_set_masked_raw(const struct device *dev, - uint32_t mask, uint32_t value) + gpio_port_pins_t mask, gpio_port_value_t value) { struct gpio_pca95xx_drv_data * const drv_data = (struct gpio_pca95xx_drv_data * const)dev->data; @@ -542,19 +542,19 @@ static int gpio_pca95xx_port_set_masked_raw(const struct device *dev, } static int gpio_pca95xx_port_set_bits_raw(const struct device *dev, - uint32_t mask) + gpio_port_pins_t mask) { return gpio_pca95xx_port_set_masked_raw(dev, mask, mask); } static int gpio_pca95xx_port_clear_bits_raw(const struct device *dev, - uint32_t mask) + gpio_port_pins_t mask) { return gpio_pca95xx_port_set_masked_raw(dev, mask, 0); } static int gpio_pca95xx_port_toggle_bits(const struct device *dev, - uint32_t mask) + gpio_port_pins_t mask) { struct gpio_pca95xx_drv_data * const drv_data = (struct gpio_pca95xx_drv_data * const)dev->data; @@ -820,7 +820,7 @@ static int gpio_pca95xx_init(const struct device *dev) /* Prepare GPIO callback for interrupt pin */ gpio_init_callback(&drv_data->gpio_callback, gpio_pca95xx_interrupt_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback(config->int_gpio.port, &drv_data->gpio_callback); if (ret != 0) { LOG_ERR("PCA95XX[0x%X]: failed to add interrupt callback for" diff --git a/drivers/gpio/gpio_pca_series.c b/drivers/gpio/gpio_pca_series.c index 6d7744e4eb2a737..536be8d280a0981 100644 --- a/drivers/gpio/gpio_pca_series.c +++ b/drivers/gpio/gpio_pca_series.c @@ -1619,7 +1619,8 @@ static void gpio_pca_series_interrupt_worker_extended(struct k_work *work) } static void gpio_pca_series_gpio_int_handler(const struct device *dev, - struct gpio_callback *gpio_cb, uint32_t pins) + struct gpio_callback *gpio_cb, + gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -1739,7 +1740,7 @@ static int gpio_pca_series_init(const struct device *dev) } gpio_init_callback(&data->gpio_cb, gpio_pca_series_gpio_int_handler, - BIT(cfg->gpio_int.pin)); + GPIO_BIT(cfg->gpio_int.pin)); ret = gpio_add_callback(cfg->gpio_int.port, &data->gpio_cb); } else { diff --git a/drivers/gpio/gpio_pcal64xxa.c b/drivers/gpio/gpio_pcal64xxa.c index b9b5a8383e3592b..3dbe753652ebe3a 100644 --- a/drivers/gpio/gpio_pcal64xxa.c +++ b/drivers/gpio/gpio_pcal64xxa.c @@ -263,7 +263,7 @@ static void pcal64xxa_work_handler(struct k_work *work) } static void pcal64xxa_int_gpio_handler(const struct device *dev, struct gpio_callback *gpio_cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -1052,7 +1052,7 @@ int pcal64xxa_init(const struct device *dev) } gpio_init_callback(&drv_data->int_gpio_cb, pcal64xxa_int_gpio_handler, - BIT(drv_cfg->gpio_interrupt.pin)); + GPIO_BIT(drv_cfg->gpio_interrupt.pin)); rc = gpio_add_callback(drv_cfg->gpio_interrupt.port, &drv_data->int_gpio_cb); if (rc != 0) { LOG_ERR("%s: failed to add INT callback: %d", dev->name, rc); diff --git a/drivers/gpio/gpio_pcf857x.c b/drivers/gpio/gpio_pcf857x.c index c30e1a5d36d02b0..cbee8da7a0edb75 100644 --- a/drivers/gpio/gpio_pcf857x.c +++ b/drivers/gpio/gpio_pcf857x.c @@ -88,7 +88,7 @@ static void pcf857x_work_handler(struct k_work *work) k_sem_take(&drv_data->lock, K_FOREVER); - uint32_t changed_pins; + gpio_port_value_t changed_pins; uint16_t input_port_last_temp = drv_data->input_port_last; int rc = pcf857x_process_input(drv_data->dev, &changed_pins); @@ -106,7 +106,7 @@ static void pcf857x_work_handler(struct k_work *work) /** Callback for interrupt through some level changes on pcf857x pins*/ static void pcf857x_int_gpio_handler(const struct device *dev, struct gpio_callback *gpio_cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -364,7 +364,7 @@ static int pcf857x_init(const struct device *dev) } gpio_init_callback(&drv_data->int_gpio_cb, pcf857x_int_gpio_handler, - BIT(drv_cfg->gpio_int.pin)); + GPIO_BIT(drv_cfg->gpio_int.pin)); rc = gpio_add_callback(drv_cfg->gpio_int.port, &drv_data->int_gpio_cb); if (rc != 0) { LOG_ERR("%s: failed to add INT callback: %d", dev->name, rc); diff --git a/drivers/gpio/gpio_rt1718s.c b/drivers/gpio/gpio_rt1718s.c index a448daddbde1d5f..730393e19411006 100644 --- a/drivers/gpio/gpio_rt1718s.c +++ b/drivers/gpio/gpio_rt1718s.c @@ -25,7 +25,7 @@ LOG_MODULE_REGISTER(gpio_rt1718s, CONFIG_GPIO_LOG_LEVEL); static void rt1718s_alert_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(pins); struct rt1718s_data *data = CONTAINER_OF(cb, struct rt1718s_data, gpio_cb); @@ -106,7 +106,7 @@ static int rt1718s_init(const struct device *dev) gpio_pin_configure_dt(&config->irq_gpio, GPIO_INPUT); gpio_init_callback(&data->gpio_cb, rt1718s_alert_callback, - BIT(config->irq_gpio.pin)); + GPIO_BIT(config->irq_gpio.pin)); ret = gpio_add_callback(config->irq_gpio.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/gpio/gpio_sx1509b.c b/drivers/gpio/gpio_sx1509b.c index b8ecdf4d772bed7..1e5816ea1116182 100644 --- a/drivers/gpio/gpio_sx1509b.c +++ b/drivers/gpio/gpio_sx1509b.c @@ -228,7 +228,7 @@ static void sx1509b_work_handler(struct k_work *work) static void sx1509_int_cb(const struct device *dev, struct gpio_callback *gpio_cb, - uint32_t pins) + gpio_port_pins_t pins) { struct sx1509b_drv_data *drv_data = CONTAINER_OF(gpio_cb, struct sx1509b_drv_data, gpio_cb); @@ -438,7 +438,7 @@ static int port_write(const struct device *dev, k_sem_give(&drv_data->lock); - LOG_DBG("write %04x msk %04x val %04x => %04x: %d", orig_out, mask, value, out, rc); + //LOG_DBG("write %04x msk %04x val %04x => %04x: %d", orig_out, mask, value, out, rc); return rc; } @@ -563,7 +563,7 @@ static int sx1509b_init(const struct device *dev) GPIO_INT_EDGE_TO_ACTIVE); gpio_init_callback(&drv_data->gpio_cb, sx1509_int_cb, - BIT(cfg->nint_gpio.pin)); + GPIO_BIT(cfg->nint_gpio.pin)); gpio_add_callback(cfg->nint_gpio.port, &drv_data->gpio_cb); drv_data->irq_state = (struct sx1509b_irq_state) { diff --git a/drivers/gpio/gpio_tca6424a.c b/drivers/gpio/gpio_tca6424a.c index 0ce59bd38f0e25e..c59abaffacf7295 100644 --- a/drivers/gpio/gpio_tca6424a.c +++ b/drivers/gpio/gpio_tca6424a.c @@ -236,7 +236,7 @@ static void tca6424a_work_handler(struct k_work *work) * @param pins Bitmask of pins that triggered interrupt */ static void tca6424a_int_gpio_handler(const struct device *dev, struct gpio_callback *gpio_cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -543,7 +543,7 @@ static int tca6424a_init(const struct device *dev) } gpio_init_callback(&drv_data->int_gpio_cb, tca6424a_int_gpio_handler, - BIT(drv_cfg->int_gpio.pin)); + GPIO_BIT(drv_cfg->int_gpio.pin)); ret = gpio_add_callback(drv_cfg->int_gpio.port, &drv_data->int_gpio_cb); if (ret != 0) { diff --git a/drivers/gpio/gpio_tle9104.c b/drivers/gpio/gpio_tle9104.c index 1bbead5281b08d3..381fdcc2632c874 100644 --- a/drivers/gpio/gpio_tle9104.c +++ b/drivers/gpio/gpio_tle9104.c @@ -107,7 +107,7 @@ static int tle9104_gpio_pin_configure(const struct device *dev, gpio_pin_t pin, return result; } -static int tle9104_gpio_port_get_raw(const struct device *dev, uint32_t *value) +static int tle9104_gpio_port_get_raw(const struct device *dev, gpio_port_value_t *value) { ARG_UNUSED(dev); ARG_UNUSED(value); @@ -116,7 +116,8 @@ static int tle9104_gpio_port_get_raw(const struct device *dev, uint32_t *value) return -ENOTSUP; } -static int tle9104_gpio_port_set_masked_raw(const struct device *dev, uint32_t mask, uint32_t value) +static int tle9104_gpio_port_set_masked_raw(const struct device *dev, gpio_port_pins_t mask, + gpio_port_value_t value) { const struct tle9104_gpio_config *config = dev->config; struct tle9104_gpio_data *data = dev->data; @@ -145,17 +146,17 @@ static int tle9104_gpio_port_set_masked_raw(const struct device *dev, uint32_t m return result; } -static int tle9104_gpio_port_set_bits_raw(const struct device *dev, uint32_t mask) +static int tle9104_gpio_port_set_bits_raw(const struct device *dev, gpio_port_pins_t mask) { return tle9104_gpio_port_set_masked_raw(dev, mask, mask); } -static int tle9104_gpio_port_clear_bits_raw(const struct device *dev, uint32_t mask) +static int tle9104_gpio_port_clear_bits_raw(const struct device *dev, gpio_port_pins_t mask) { return tle9104_gpio_port_set_masked_raw(dev, mask, 0); } -static int tle9104_gpio_port_toggle_bits(const struct device *dev, uint32_t mask) +static int tle9104_gpio_port_toggle_bits(const struct device *dev, gpio_port_pins_t mask) { const struct tle9104_gpio_config *config = dev->config; struct tle9104_gpio_data *data = dev->data; diff --git a/drivers/ieee802154/ieee802154_cc1200.c b/drivers/ieee802154/ieee802154_cc1200.c index 50dad26faee892f..a5bc218dfc380f4 100644 --- a/drivers/ieee802154/ieee802154_cc1200.c +++ b/drivers/ieee802154/ieee802154_cc1200.c @@ -166,7 +166,7 @@ static uint8_t get_status(const struct device *dev) *****************/ static inline void gpio0_int_handler(const struct device *port, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct cc1200_context *cc1200 = CONTAINER_OF(cb, struct cc1200_context, rx_tx_cb); @@ -202,7 +202,7 @@ static int setup_gpio_callback(const struct device *dev) const struct cc1200_config *cfg = dev->config; struct cc1200_context *cc1200 = dev->data; - gpio_init_callback(&cc1200->rx_tx_cb, gpio0_int_handler, BIT(cfg->interrupt.pin)); + gpio_init_callback(&cc1200->rx_tx_cb, gpio0_int_handler, GPIO_BIT(cfg->interrupt.pin)); if (gpio_add_callback(cfg->interrupt.port, &cc1200->rx_tx_cb) != 0) { return -EIO; diff --git a/drivers/ieee802154/ieee802154_cc2520.c b/drivers/ieee802154/ieee802154_cc2520.c index b1c7dd699e735dd..085bfc5262cccde 100644 --- a/drivers/ieee802154/ieee802154_cc2520.c +++ b/drivers/ieee802154/ieee802154_cc2520.c @@ -380,7 +380,7 @@ static inline uint32_t get_cca(const struct device *dev) } static inline void sfd_int_handler(const struct device *port, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct cc2520_context *cc2520 = CONTAINER_OF(cb, struct cc2520_context, sfd_cb); @@ -432,13 +432,13 @@ static inline int setup_gpio_callbacks(const struct device *dev) const struct cc2520_config *cfg = dev->config; struct cc2520_context *cc2520 = dev->data; - gpio_init_callback(&cc2520->sfd_cb, sfd_int_handler, BIT(cfg->sfd.pin)); + gpio_init_callback(&cc2520->sfd_cb, sfd_int_handler, GPIO_BIT(cfg->sfd.pin)); if (gpio_add_callback(cfg->sfd.port, &cc2520->sfd_cb) != 0) { return -EIO; } - gpio_init_callback(&cc2520->fifop_cb, fifop_int_handler, BIT(cfg->fifop.pin)); + gpio_init_callback(&cc2520->fifop_cb, fifop_int_handler, GPIO_BIT(cfg->fifop.pin)); if (gpio_add_callback(cfg->fifop.port, &cc2520->fifop_cb) != 0) { return -EIO; } diff --git a/drivers/ieee802154/ieee802154_dw1000.c b/drivers/ieee802154/ieee802154_dw1000.c index b0e06488731f4e0..fc035739805f85d 100644 --- a/drivers/ieee802154/ieee802154_dw1000.c +++ b/drivers/ieee802154/ieee802154_dw1000.c @@ -611,7 +611,7 @@ static void dwt_irq_work_handler(struct k_work *item) } static void dwt_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct dwt_context *ctx = CONTAINER_OF(cb, struct dwt_context, gpio_cb); @@ -1552,7 +1552,7 @@ static int dw1000_init(const struct device *dev) } gpio_init_callback(&(ctx->gpio_cb), dwt_gpio_callback, - BIT(hi_cfg->irq_gpio.pin)); + GPIO_BIT(hi_cfg->irq_gpio.pin)); if (gpio_add_callback(hi_cfg->irq_gpio.port, &(ctx->gpio_cb))) { LOG_ERR("Failed to add IRQ callback"); diff --git a/drivers/ieee802154/ieee802154_mcr20a.c b/drivers/ieee802154/ieee802154_mcr20a.c index a57de53754ea749..8afc6e4db7b930e 100644 --- a/drivers/ieee802154/ieee802154_mcr20a.c +++ b/drivers/ieee802154/ieee802154_mcr20a.c @@ -806,7 +806,7 @@ static void mcr20a_thread_main(void *p1, void *p2, void *p3) } static inline void irqb_int_handler(const struct device *port, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct mcr20a_context *mcr20a = CONTAINER_OF(cb, struct mcr20a_context, @@ -832,7 +832,7 @@ static inline void setup_gpio_callbacks(const struct device *dev) gpio_init_callback(&mcr20a->irqb_cb, irqb_int_handler, - BIT(config->irq_gpio.pin)); + GPIO_BIT(config->irq_gpio.pin)); gpio_add_callback(config->irq_gpio.port, &mcr20a->irqb_cb); } diff --git a/drivers/ieee802154/ieee802154_rf2xx.c b/drivers/ieee802154/ieee802154_rf2xx.c index 1dd00c213ba7dde..2850b54d7842f8c 100644 --- a/drivers/ieee802154/ieee802154_rf2xx.c +++ b/drivers/ieee802154/ieee802154_rf2xx.c @@ -72,7 +72,7 @@ static struct net_pkt rf2xx_ack_pkt = { /* Radio Transceiver ISR */ static inline void trx_isr_handler(const struct device *port, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct rf2xx_context *ctx = CONTAINER_OF(cb, struct rf2xx_context, @@ -924,7 +924,7 @@ static int power_on_and_setup(const struct device *dev) rf2xx_iface_reg_write(dev, RF2XX_IRQ_MASK_REG, config); gpio_init_callback(&ctx->irq_cb, trx_isr_handler, - BIT(conf->irq_gpio.pin)); + GPIO_BIT(conf->irq_gpio.pin)); if (gpio_add_callback(conf->irq_gpio.port, &ctx->irq_cb) < 0) { LOG_ERR("Could not set IRQ callback."); diff --git a/drivers/input/input_cap1203.c b/drivers/input/input_cap1203.c index 91965d3c255ce64..183aaa7dc991d94 100644 --- a/drivers/input/input_cap1203.c +++ b/drivers/input/input_cap1203.c @@ -107,7 +107,7 @@ static void cap1203_work_handler(struct k_work *work) } static void cap1203_isr_handler(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct cap1203_data *data = CONTAINER_OF(cb, struct cap1203_data, int_gpio_cb); @@ -158,7 +158,7 @@ static int cap1203_init(const struct device *dev) } gpio_init_callback(&data->int_gpio_cb, cap1203_isr_handler, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); r = gpio_add_callback(config->int_gpio.port, &data->int_gpio_cb); if (r < 0) { diff --git a/drivers/input/input_cf1133.c b/drivers/input/input_cf1133.c index 4907772f37d0855..0929de46389265d 100644 --- a/drivers/input/input_cf1133.c +++ b/drivers/input/input_cf1133.c @@ -246,7 +246,8 @@ static void cf1133_work_handler(struct k_work *work) #ifdef CONFIG_INPUT_CF1133_INTERRUPT -static void cf1133_isr_handler(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void cf1133_isr_handler(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { struct cf1133_data *data = CONTAINER_OF(cb, struct cf1133_data, int_gpio_cb); @@ -290,7 +291,7 @@ static int cf1133_init(const struct device *dev) return ret; } - gpio_init_callback(&data->int_gpio_cb, cf1133_isr_handler, BIT(config->int_gpio.pin)); + gpio_init_callback(&data->int_gpio_cb, cf1133_isr_handler, GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback(config->int_gpio.port, &data->int_gpio_cb); if (ret < 0) { diff --git a/drivers/input/input_chsc6x.c b/drivers/input/input_chsc6x.c index 2ef6880725ba181..8d02f0f346231c2 100644 --- a/drivers/input/input_chsc6x.c +++ b/drivers/input/input_chsc6x.c @@ -68,7 +68,8 @@ static void chsc6x_work_handler(struct k_work *work) chsc6x_process(data->dev); } -static void chsc6x_isr_handler(const struct device *dev, struct gpio_callback *cb, uint32_t mask) +static void chsc6x_isr_handler(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t mask) { struct chsc6x_data *data = CONTAINER_OF(cb, struct chsc6x_data, int_gpio_cb); @@ -115,7 +116,7 @@ static int chsc6x_init(const struct device *dev) return ret; } - gpio_init_callback(&data->int_gpio_cb, chsc6x_isr_handler, BIT(config->int_gpio.pin)); + gpio_init_callback(&data->int_gpio_cb, chsc6x_isr_handler, GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback(config->int_gpio.port, &data->int_gpio_cb); if (ret < 0) { diff --git a/drivers/input/input_cst816s.c b/drivers/input/input_cst816s.c index 84381bac4c2df92..cbecb58db4a479f 100644 --- a/drivers/input/input_cst816s.c +++ b/drivers/input/input_cst816s.c @@ -177,7 +177,8 @@ static void cst816s_work_handler(struct k_work *work) } #ifdef CONFIG_INPUT_CST816S_INTERRUPT -static void cst816s_isr_handler(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void cst816s_isr_handler(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { struct cst816s_data *data = CONTAINER_OF(cb, struct cst816s_data, int_gpio_cb); @@ -276,7 +277,7 @@ static int cst816s_init(const struct device *dev) return ret; } - gpio_init_callback(&data->int_gpio_cb, cst816s_isr_handler, BIT(config->int_gpio.pin)); + gpio_init_callback(&data->int_gpio_cb, cst816s_isr_handler, GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback(config->int_gpio.port, &data->int_gpio_cb); if (ret < 0) { diff --git a/drivers/input/input_ft5336.c b/drivers/input/input_ft5336.c index 2b82f7fbc7b9286..a34c9af97ffd3c3 100644 --- a/drivers/input/input_ft5336.c +++ b/drivers/input/input_ft5336.c @@ -149,7 +149,7 @@ static void ft5336_work_handler(struct k_work *work) #ifdef CONFIG_INPUT_FT5336_INTERRUPT static void ft5336_isr_handler(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct ft5336_data *data = CONTAINER_OF(cb, struct ft5336_data, int_gpio_cb); @@ -219,7 +219,7 @@ static int ft5336_init(const struct device *dev) } gpio_init_callback(&data->int_gpio_cb, ft5336_isr_handler, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); r = gpio_add_callback(config->int_gpio.port, &data->int_gpio_cb); if (r < 0) { LOG_ERR("Could not set gpio callback"); diff --git a/drivers/input/input_gpio_kbd_matrix.c b/drivers/input/input_gpio_kbd_matrix.c index 2ad1a08a033ea22..fb465b8c126c218 100644 --- a/drivers/input/input_gpio_kbd_matrix.c +++ b/drivers/input/input_gpio_kbd_matrix.c @@ -233,7 +233,7 @@ static int gpio_kbd_matrix_init(const struct device *dev) gpio_cb = &cfg->gpio_cb[i]; gpio_init_callback(gpio_cb, cfg->gpio_cb_handler, - BIT(gpio->pin)); + GPIO_BIT(gpio->pin)); ret = gpio_add_callback_dt(gpio, gpio_cb); if (ret < 0) { @@ -294,7 +294,7 @@ static const struct input_kbd_matrix_api gpio_kbd_matrix_api = { IF_ENABLED(DT_INST_ENUM_HAS_VALUE(n, idle_mode, interrupt), ( \ static struct gpio_callback gpio_kbd_matrix_gpio_cb_##n[DT_INST_PROP_LEN(n, row_gpios)];\ static void gpio_kbd_matrix_cb_##n(const struct device *gpio_dev, \ - struct gpio_callback *cb, uint32_t pins) \ + struct gpio_callback *cb, gpio_port_pins_t pins) \ { \ input_kbd_matrix_poll_start(DEVICE_DT_INST_GET(n)); \ } \ diff --git a/drivers/input/input_gpio_keys.c b/drivers/input/input_gpio_keys.c index 6d306ace4e5929c..fe959757ae62788 100644 --- a/drivers/input/input_gpio_keys.c +++ b/drivers/input/input_gpio_keys.c @@ -125,7 +125,7 @@ static __maybe_unused void gpio_keys_change_deferred(struct k_work *work) } static void gpio_keys_interrupt(const struct device *dev, struct gpio_callback *cbdata, - uint32_t pins) + gpio_port_pins_t pins) { struct gpio_keys_callback *keys_cb = CONTAINER_OF( cbdata, struct gpio_keys_callback, gpio_cb); @@ -144,7 +144,7 @@ static int gpio_keys_interrupt_configure(const struct gpio_dt_spec *gpio_spec, { int ret; - gpio_init_callback(&cb->gpio_cb, gpio_keys_interrupt, BIT(gpio_spec->pin)); + gpio_init_callback(&cb->gpio_cb, gpio_keys_interrupt, GPIO_BIT(gpio_spec->pin)); ret = gpio_add_callback(gpio_spec->port, &cb->gpio_cb); if (ret < 0) { diff --git a/drivers/input/input_gpio_qdec.c b/drivers/input/input_gpio_qdec.c index 4a9b524f461416d..4aac661e00130d4 100644 --- a/drivers/input/input_gpio_qdec.c +++ b/drivers/input/input_gpio_qdec.c @@ -239,7 +239,7 @@ static void gpio_qdec_idle_worker(struct k_work *work) } static void gpio_qdec_cb(const struct device *gpio_dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct gpio_qdec_data *data = CONTAINER_OF( cb, struct gpio_qdec_data, gpio_cb); @@ -263,7 +263,7 @@ static int gpio_qdec_init(const struct device *dev) k_timer_user_data_set(&data->sample_timer, (void *)dev); gpio_init_callback(&data->gpio_cb, gpio_qdec_cb, - BIT(cfg->ab_gpio[0].pin) | BIT(cfg->ab_gpio[1].pin)); + GPIO_BIT(cfg->ab_gpio[0].pin) | BIT(cfg->ab_gpio[1].pin)); for (int i = 0; i < GPIO_QDEC_GPIO_NUM; i++) { const struct gpio_dt_spec *gpio = &cfg->ab_gpio[i]; diff --git a/drivers/input/input_gt911.c b/drivers/input/input_gt911.c index 3b021032cf73e23..b556d0cd3deddb1 100644 --- a/drivers/input/input_gt911.c +++ b/drivers/input/input_gt911.c @@ -203,7 +203,8 @@ static void gt911_work_handler(struct k_work *work) } #ifdef CONFIG_INPUT_GT911_INTERRUPT -static void gt911_isr_handler(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void gt911_isr_handler(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { struct gt911_data *data = CONTAINER_OF(cb, struct gt911_data, int_gpio_cb); @@ -313,7 +314,7 @@ static int gt911_init(const struct device *dev) return r; } - gpio_init_callback(&data->int_gpio_cb, gt911_isr_handler, BIT(config->int_gpio.pin)); + gpio_init_callback(&data->int_gpio_cb, gt911_isr_handler, GPIO_BIT(config->int_gpio.pin)); #else k_timer_init(&data->timer, gt911_timer_handler, NULL); #endif diff --git a/drivers/input/input_pat912x.c b/drivers/input/input_pat912x.c index 2e0602fcedcbaec..eb41cd04d47dcf2 100644 --- a/drivers/input/input_pat912x.c +++ b/drivers/input/input_pat912x.c @@ -138,7 +138,7 @@ static void pat912x_motion_work_handler(struct k_work *work) static void pat912x_motion_handler(const struct device *gpio_dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct pat912x_data *data = CONTAINER_OF( cb, struct pat912x_data, motion_cb); @@ -269,7 +269,7 @@ static int pat912x_init(const struct device *dev) } gpio_init_callback(&data->motion_cb, pat912x_motion_handler, - BIT(cfg->motion_gpio.pin)); + GPIO_BIT(cfg->motion_gpio.pin)); ret = pat912x_configure(dev); if (ret != 0) { diff --git a/drivers/input/input_paw32xx.c b/drivers/input/input_paw32xx.c index be9db7c33949faa..9af91464658d47c 100644 --- a/drivers/input/input_paw32xx.c +++ b/drivers/input/input_paw32xx.c @@ -229,7 +229,7 @@ static void paw32xx_motion_work_handler(struct k_work *work) static void paw32xx_motion_handler(const struct device *gpio_dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct paw32xx_data *data = CONTAINER_OF( cb, struct paw32xx_data, motion_cb); @@ -381,7 +381,7 @@ static int paw32xx_init(const struct device *dev) } gpio_init_callback(&data->motion_cb, paw32xx_motion_handler, - BIT(cfg->motion_gpio.pin)); + GPIO_BIT(cfg->motion_gpio.pin)); ret = gpio_add_callback_dt(&cfg->motion_gpio, &data->motion_cb); if (ret < 0) { diff --git a/drivers/input/input_pinnacle.c b/drivers/input/input_pinnacle.c index c28fceeaeb3a2a0..d822bb046f0145a 100644 --- a/drivers/input/input_pinnacle.c +++ b/drivers/input/input_pinnacle.c @@ -682,7 +682,7 @@ static int pinnacle_handle_interrupt(const struct device *dev) } static void pinnacle_data_ready_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct pinnacle_data *drv_data = CONTAINER_OF(cb, struct pinnacle_data, dr_cb_data); @@ -727,7 +727,7 @@ int pinnacle_init_interrupt(const struct device *dev) } gpio_init_callback(&drv_data->dr_cb_data, pinnacle_data_ready_gpio_callback, - BIT(gpio->pin)); + GPIO_BIT(gpio->pin)); rc = gpio_add_callback(gpio->port, &drv_data->dr_cb_data); if (rc) { diff --git a/drivers/input/input_pmw3610.c b/drivers/input/input_pmw3610.c index f88e6b2b0e3ec1e..d740efc6bdda97d 100644 --- a/drivers/input/input_pmw3610.c +++ b/drivers/input/input_pmw3610.c @@ -252,7 +252,7 @@ static void pmw3610_motion_work_handler(struct k_work *work) static void pmw3610_motion_handler(const struct device *gpio_dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct pmw3610_data *data = CONTAINER_OF( cb, struct pmw3610_data, motion_cb); @@ -504,7 +504,7 @@ static int pmw3610_init(const struct device *dev) } gpio_init_callback(&data->motion_cb, pmw3610_motion_handler, - BIT(cfg->motion_gpio.pin)); + GPIO_BIT(cfg->motion_gpio.pin)); ret = gpio_add_callback_dt(&cfg->motion_gpio, &data->motion_cb); if (ret < 0) { diff --git a/drivers/input/input_stmpe811.c b/drivers/input/input_stmpe811.c index b2f95cb5066ce8a..05917976295d085 100644 --- a/drivers/input/input_stmpe811.c +++ b/drivers/input/input_stmpe811.c @@ -434,7 +434,7 @@ static void stmpe811_work_handler(struct k_work *work) } static void stmpe811_interrupt_handler(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct stmpe811_data *data = CONTAINER_OF(cb, struct stmpe811_data, int_gpio_cb); @@ -503,7 +503,7 @@ static int stmpe811_init(const struct device *dev) } gpio_init_callback(&data->int_gpio_cb, stmpe811_interrupt_handler, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); err = gpio_add_callback_dt(&config->int_gpio, &data->int_gpio_cb); if (err < 0) { LOG_ERR("Could not set GPIO callback (%d)", err); diff --git a/drivers/input/input_xpt2046.c b/drivers/input/input_xpt2046.c index 6e56fcb5874ee3c..4e637298d097869 100644 --- a/drivers/input/input_xpt2046.c +++ b/drivers/input/input_xpt2046.c @@ -73,7 +73,8 @@ static uint8_t tbuf[9] = { [6] = START | CHANNEL(CH_Y) | POWER_OFF, }; -static void xpt2046_isr_handler(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void xpt2046_isr_handler(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { struct xpt2046_data *data = CONTAINER_OF(cb, struct xpt2046_data, int_gpio_cb); const struct xpt2046_config *config = data->dev->config; @@ -221,7 +222,7 @@ static int xpt2046_init(const struct device *dev) return r; } - gpio_init_callback(&data->int_gpio_cb, xpt2046_isr_handler, BIT(config->int_gpio.pin)); + gpio_init_callback(&data->int_gpio_cb, xpt2046_isr_handler, GPIO_BIT(config->int_gpio.pin)); r = gpio_add_callback(config->int_gpio.port, &data->int_gpio_cb); if (r < 0) { diff --git a/drivers/led/ht16k33.c b/drivers/led/ht16k33.c index 8985dde6a4fd2b3..b007f363f86d6da 100644 --- a/drivers/led/ht16k33.c +++ b/drivers/led/ht16k33.c @@ -264,7 +264,7 @@ static void ht16k33_irq_thread(void *p1, void *p2, void *p3) } static void ht16k33_irq_callback(const struct device *gpiob, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct ht16k33_data *data; @@ -361,7 +361,7 @@ static int ht16k33_init(const struct device *dev) } gpio_init_callback(&data->irq_cb, &ht16k33_irq_callback, - BIT(config->irq.pin)); + GPIO_BIT(config->irq.pin)); err = gpio_add_callback(config->irq.port, &data->irq_cb); if (err) { diff --git a/drivers/lora/sx126x_standalone.c b/drivers/lora/sx126x_standalone.c index c9b16965bc799d8..a3cf33523ad0bff 100644 --- a/drivers/lora/sx126x_standalone.c +++ b/drivers/lora/sx126x_standalone.c @@ -51,7 +51,7 @@ void sx126x_dio1_irq_disable(struct sx126x_data *dev_data) } static void sx126x_dio1_irq_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct sx126x_data *dev_data = CONTAINER_OF(cb, struct sx126x_data, dio1_irq_callback); @@ -78,7 +78,7 @@ int sx126x_variant_init(const struct device *dev) } gpio_init_callback(&dev_data->dio1_irq_callback, - sx126x_dio1_irq_callback, BIT(sx126x_gpio_dio1.pin)); + sx126x_dio1_irq_callback, GPIO_BIT(sx126x_gpio_dio1.pin)); if (gpio_add_callback(sx126x_gpio_dio1.port, &dev_data->dio1_irq_callback) < 0) { LOG_ERR("Could not set GPIO callback for DIO1 interrupt."); diff --git a/drivers/lora/sx127x.c b/drivers/lora/sx127x.c index 4826ea47325ee08..8766ce750f42490 100644 --- a/drivers/lora/sx127x.c +++ b/drivers/lora/sx127x.c @@ -337,7 +337,7 @@ static void sx127x_dio_work_handle(struct k_work *work) } static void sx127x_irq_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { unsigned int i, pin; @@ -374,7 +374,7 @@ void SX127xIoIrqInit(DioIrqHandler **irqHandlers) gpio_init_callback(&callbacks[i], sx127x_irq_callback, - BIT(sx127x_dios[i].pin)); + GPIO_BIT(sx127x_dios[i].pin)); if (gpio_add_callback(sx127x_dios[i].port, &callbacks[i]) < 0) { LOG_ERR("Could not set gpio callback."); diff --git a/drivers/mfd/mfd_adp5585.c b/drivers/mfd/mfd_adp5585.c index d57b82035dca441..3a76761d2d103e9 100644 --- a/drivers/mfd/mfd_adp5585.c +++ b/drivers/mfd/mfd_adp5585.c @@ -37,7 +37,7 @@ static int mfd_adp5585_software_reset(const struct device *dev) } static void mfd_adp5585_int_gpio_handler(const struct device *dev, struct gpio_callback *gpio_cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -111,7 +111,7 @@ static int mfd_adp5585_init(const struct device *dev) } gpio_init_callback(&data->int_gpio_cb, mfd_adp5585_int_gpio_handler, - BIT(config->nint_gpio.pin)); + GPIO_BIT(config->nint_gpio.pin)); ret = gpio_add_callback_dt(&config->nint_gpio, &data->int_gpio_cb); if (ret != 0) { LOG_ERR("%s: failed to add INT callback: %d", dev->name, ret); diff --git a/drivers/mfd/mfd_npm1300.c b/drivers/mfd/mfd_npm1300.c index 2ea0818faeec489..6d4a4e85ca1de66 100644 --- a/drivers/mfd/mfd_npm1300.c +++ b/drivers/mfd/mfd_npm1300.c @@ -80,7 +80,7 @@ static const struct event_reg_t event_reg[NPM1300_EVENT_MAX] = { [NPM1300_EVENT_GPIO4_EDGE] = {0x22U, 0x10U}, }; -static void gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void gpio_callback(const struct device *dev, struct gpio_callback *cb, gpio_port_pins_t pins) { struct mfd_npm1300_data *data = CONTAINER_OF(cb, struct mfd_npm1300_data, gpio_cb); @@ -155,7 +155,7 @@ static int mfd_npm1300_init(const struct device *dev) } gpio_init_callback(&mfd_data->gpio_cb, gpio_callback, - BIT(config->host_int_gpios.pin)); + GPIO_BIT(config->host_int_gpios.pin)); ret = gpio_add_callback(config->host_int_gpios.port, &mfd_data->gpio_cb); if (ret < 0) { diff --git a/drivers/misc/ft8xx/ft8xx_drv.c b/drivers/misc/ft8xx/ft8xx_drv.c index 93b2522937dd7c9..5ef7d4418caab61 100644 --- a/drivers/misc/ft8xx/ft8xx_drv.c +++ b/drivers/misc/ft8xx/ft8xx_drv.c @@ -28,7 +28,7 @@ static const struct gpio_dt_spec irq_gpio = GPIO_DT_SPEC_INST_GET(0, irq_gpios); static struct gpio_callback irq_cb_data; __weak void ft8xx_drv_irq_triggered(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { /* Intentionally empty */ } @@ -78,7 +78,7 @@ int ft8xx_drv_init(void) return ret; } - gpio_init_callback(&irq_cb_data, ft8xx_drv_irq_triggered, BIT(irq_gpio.pin)); + gpio_init_callback(&irq_cb_data, ft8xx_drv_irq_triggered, GPIO_BIT(irq_gpio.pin)); gpio_add_callback(irq_gpio.port, &irq_cb_data); return 0; diff --git a/drivers/modem/hl7800.c b/drivers/modem/hl7800.c index a30d3cbd8c61cf0..3c1f0d1d242030a 100644 --- a/drivers/modem/hl7800.c +++ b/drivers/modem/hl7800.c @@ -4871,7 +4871,8 @@ static void mdm_vgpio_work_cb(struct k_work *item) hl7800_unlock(); } -void mdm_vgpio_callback_isr(const struct device *port, struct gpio_callback *cb, uint32_t pins) +void mdm_vgpio_callback_isr(const struct device *port, struct gpio_callback *cb, + gpio_port_pins_t pins) { ARG_UNUSED(port); ARG_UNUSED(cb); @@ -4909,7 +4910,8 @@ void mdm_vgpio_callback_isr(const struct device *port, struct gpio_callback *cb, k_work_submit_to_queue(&hl7800_workq, &iface_ctx.mdm_vgpio_work); } -void mdm_uart_dsr_callback_isr(const struct device *port, struct gpio_callback *cb, uint32_t pins) +void mdm_uart_dsr_callback_isr(const struct device *port, struct gpio_callback *cb, + gpio_port_pins_t pins) { ARG_UNUSED(port); ARG_UNUSED(cb); @@ -4935,7 +4937,8 @@ static void mark_sockets_for_reconfig(void) } #endif -void mdm_gpio6_callback_isr(const struct device *port, struct gpio_callback *cb, uint32_t pins) +void mdm_gpio6_callback_isr(const struct device *port, struct gpio_callback *cb, + gpio_port_pins_t pins) { ARG_UNUSED(port); ARG_UNUSED(cb); @@ -4974,7 +4977,8 @@ void mdm_gpio6_callback_isr(const struct device *port, struct gpio_callback *cb, #endif } -void mdm_uart_cts_callback_isr(const struct device *port, struct gpio_callback *cb, uint32_t pins) +void mdm_uart_cts_callback_isr(const struct device *port, struct gpio_callback *cb, + gpio_port_pins_t pins) { ARG_UNUSED(port); ARG_UNUSED(cb); @@ -6456,7 +6460,7 @@ static int hl7800_init(const struct device *dev) /* setup input pin callbacks */ /* VGPIO */ gpio_init_callback(&iface_ctx.mdm_vgpio_cb, mdm_vgpio_callback_isr, - BIT(hl7800_cfg.gpio[MDM_VGPIO].pin)); + GPIO_BIT(hl7800_cfg.gpio[MDM_VGPIO].pin)); ret = gpio_add_callback(hl7800_cfg.gpio[MDM_VGPIO].port, &iface_ctx.mdm_vgpio_cb); if (ret) { @@ -6471,7 +6475,7 @@ static int hl7800_init(const struct device *dev) /* UART DSR */ gpio_init_callback(&iface_ctx.mdm_uart_dsr_cb, mdm_uart_dsr_callback_isr, - BIT(hl7800_cfg.gpio[MDM_UART_DSR].pin)); + GPIO_BIT(hl7800_cfg.gpio[MDM_UART_DSR].pin)); ret = gpio_add_callback(hl7800_cfg.gpio[MDM_UART_DSR].port, &iface_ctx.mdm_uart_dsr_cb); if (ret) { @@ -6486,7 +6490,7 @@ static int hl7800_init(const struct device *dev) /* GPIO6 */ gpio_init_callback(&iface_ctx.mdm_gpio6_cb, mdm_gpio6_callback_isr, - BIT(hl7800_cfg.gpio[MDM_GPIO6].pin)); + GPIO_BIT(hl7800_cfg.gpio[MDM_GPIO6].pin)); ret = gpio_add_callback(hl7800_cfg.gpio[MDM_GPIO6].port, &iface_ctx.mdm_gpio6_cb); if (ret) { @@ -6501,7 +6505,7 @@ static int hl7800_init(const struct device *dev) /* UART CTS */ gpio_init_callback(&iface_ctx.mdm_uart_cts_cb, mdm_uart_cts_callback_isr, - BIT(hl7800_cfg.gpio[MDM_UART_CTS].pin)); + GPIO_BIT(hl7800_cfg.gpio[MDM_UART_CTS].pin)); ret = gpio_add_callback(hl7800_cfg.gpio[MDM_UART_CTS].port, &iface_ctx.mdm_uart_cts_cb); if (ret) { diff --git a/drivers/power_domain/power_domain_gpio_monitor.c b/drivers/power_domain/power_domain_gpio_monitor.c index a0a5af8aa7fd5c1..236895dc909eead 100644 --- a/drivers/power_domain/power_domain_gpio_monitor.c +++ b/drivers/power_domain/power_domain_gpio_monitor.c @@ -118,7 +118,7 @@ static int pd_gpio_monitor_init(const struct device *dev) } gpio_init_callback(&data->callback, pd_gpio_monitor_callback, - BIT(config->power_good_gpio.pin)); + GPIO_BIT(config->power_good_gpio.pin)); rc = gpio_add_callback_dt(&config->power_good_gpio, &data->callback); if (rc) { LOG_ERR("Failed to add GPIO callback"); diff --git a/drivers/rtc/rtc_am1805.c b/drivers/rtc/rtc_am1805.c index b6282d0f8ae5638..31ab8d9e506e916 100644 --- a/drivers/rtc/rtc_am1805.c +++ b/drivers/rtc/rtc_am1805.c @@ -552,7 +552,7 @@ static int am1805_init(const struct device *dev) } gpio_init_callback(&data->am1805_callback, am1805_gpio_callback_handler, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); err = gpio_add_callback_dt(&config->int_gpio, &data->am1805_callback); if (err != 0) { diff --git a/drivers/rtc/rtc_pcf8523.c b/drivers/rtc/rtc_pcf8523.c index 3e7287e3fe67e29..65e3964a01fbbec 100644 --- a/drivers/rtc/rtc_pcf8523.c +++ b/drivers/rtc/rtc_pcf8523.c @@ -792,7 +792,7 @@ static int pcf8523_init(const struct device *dev) } gpio_init_callback(&data->int1_callback, pcf8523_int1_callback_handler, - BIT(config->int1.pin)); + GPIO_BIT(config->int1.pin)); err = gpio_add_callback_dt(&config->int1, &data->int1_callback); if (err != 0) { diff --git a/drivers/rtc/rtc_pcf8563.c b/drivers/rtc/rtc_pcf8563.c index b687d095013c2a8..8d321a2d47f5de6 100644 --- a/drivers/rtc/rtc_pcf8563.c +++ b/drivers/rtc/rtc_pcf8563.c @@ -386,7 +386,7 @@ void callback_work_handler(struct k_work *work) /* The function called when the clock alarm activates the interrupt*/ void gpio_callback_function(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct pcf8563_data *data = CONTAINER_OF(cb, struct pcf8563_data, int1_callback); @@ -442,7 +442,7 @@ static int pcf8563_alarm_set_callback(const struct device *dev, uint16_t id, } - gpio_init_callback(&data->int1_callback, gpio_callback_function, BIT(config->int1.pin)); + gpio_init_callback(&data->int1_callback, gpio_callback_function, GPIO_BIT(config->int1.pin)); gpio_add_callback(config->int1.port, &data->int1_callback); LOG_DBG("Alarm set"); return 0; diff --git a/drivers/rtc/rtc_rv3028.c b/drivers/rtc/rtc_rv3028.c index 039c5f90e6ef2ed..9fa5630483df199 100644 --- a/drivers/rtc/rtc_rv3028.c +++ b/drivers/rtc/rtc_rv3028.c @@ -803,7 +803,7 @@ static int rv3028_init(const struct device *dev) } gpio_init_callback(&data->int_callback, rv3028_int_handler, - BIT(config->gpio_int.pin)); + GPIO_BIT(config->gpio_int.pin)); err = gpio_add_callback_dt(&config->gpio_int, &data->int_callback); if (err) { diff --git a/drivers/rtc/rtc_rv8263.c b/drivers/rtc/rtc_rv8263.c index 7e76e7fc55d1f67..6dd6bfab6696bb9 100644 --- a/drivers/rtc/rtc_rv8263.c +++ b/drivers/rtc/rtc_rv8263.c @@ -349,7 +349,7 @@ static int rv8263c8_init(const struct device *dev) } gpio_init_callback(&data->gpio_cb, rv8263c8_gpio_callback_handler, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); err = gpio_add_callback_dt(&config->int_gpio, &data->gpio_cb); if (err < 0) { diff --git a/drivers/sdhc/imx_usdhc.c b/drivers/sdhc/imx_usdhc.c index 5a7f372dd201ea4..b796f69b1954c87 100644 --- a/drivers/sdhc/imx_usdhc.c +++ b/drivers/sdhc/imx_usdhc.c @@ -1026,7 +1026,7 @@ static int imx_usdhc_init(const struct device *dev) return ret; } gpio_init_callback(&data->cd_callback, card_detect_gpio_cb, - BIT(cfg->detect_gpio.pin)); + GPIO_BIT(cfg->detect_gpio.pin)); ret = gpio_add_callback_dt(&cfg->detect_gpio, &data->cd_callback); if (ret) { return ret; diff --git a/drivers/sensor/adi/adt7310/adt7310_trigger.c b/drivers/sensor/adi/adt7310/adt7310_trigger.c index 4318293a35e0a92..7dd8b1421877784 100644 --- a/drivers/sensor/adi/adt7310/adt7310_trigger.c +++ b/drivers/sensor/adi/adt7310/adt7310_trigger.c @@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(ADT7310, CONFIG_SENSOR_LOG_LEVEL); static void adt7310_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct adt7310_data *drv_data = CONTAINER_OF(cb, struct adt7310_data, gpio_cb); @@ -113,7 +113,7 @@ int adt7310_init_interrupt(const struct device *dev) return -ENODEV; } - gpio_init_callback(&drv_data->gpio_cb, adt7310_gpio_callback, BIT(cfg->int_gpio.pin)); + gpio_init_callback(&drv_data->gpio_cb, adt7310_gpio_callback, GPIO_BIT(cfg->int_gpio.pin)); ret = gpio_pin_configure_dt(&cfg->int_gpio, GPIO_INPUT | GPIO_ACTIVE_LOW); if (ret < 0) { diff --git a/drivers/sensor/adi/adt7420/adt7420_trigger.c b/drivers/sensor/adi/adt7420/adt7420_trigger.c index d70813d6cf1ff4a..93f14e275cf3f00 100644 --- a/drivers/sensor/adi/adt7420/adt7420_trigger.c +++ b/drivers/sensor/adi/adt7420/adt7420_trigger.c @@ -67,7 +67,7 @@ static void process_int(const struct device *dev) } static void adt7420_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct adt7420_data *drv_data = CONTAINER_OF(cb, struct adt7420_data, gpio_cb); @@ -148,7 +148,7 @@ int adt7420_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, adt7420_gpio_callback, - BIT(cfg->int_gpio.pin)); + GPIO_BIT(cfg->int_gpio.pin)); rc = gpio_pin_configure_dt(&cfg->int_gpio, GPIO_INPUT | cfg->int_gpio.dt_flags); if (rc < 0) { diff --git a/drivers/sensor/adi/adxl362/adxl362_trigger.c b/drivers/sensor/adi/adxl362/adxl362_trigger.c index 725c89dc64a271c..80ca6957f5c8d85 100644 --- a/drivers/sensor/adi/adxl362/adxl362_trigger.c +++ b/drivers/sensor/adi/adxl362/adxl362_trigger.c @@ -51,7 +51,7 @@ static void adxl362_thread_cb(const struct device *dev) #endif /* CONFIG_ADXL362_TRIGGER_OWN_THREAD || CONFIG_ADXL362_TRIGGER_GLOBAL_THREAD */ static void adxl362_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct adxl362_data *drv_data = CONTAINER_OF(cb, struct adxl362_data, gpio_cb); @@ -168,7 +168,7 @@ int adxl362_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, adxl362_gpio_callback, - BIT(cfg->interrupt.pin)); + GPIO_BIT(cfg->interrupt.pin)); ret = gpio_add_callback(cfg->interrupt.port, &drv_data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/adi/adxl367/adxl367_trigger.c b/drivers/sensor/adi/adxl367/adxl367_trigger.c index 3c466f5087fa441..b9e9708f2fd2d5f 100644 --- a/drivers/sensor/adi/adxl367/adxl367_trigger.c +++ b/drivers/sensor/adi/adxl367/adxl367_trigger.c @@ -47,7 +47,7 @@ static void adxl367_thread_cb(const struct device *dev) } static void adxl367_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct adxl367_data *drv_data = CONTAINER_OF(cb, struct adxl367_data, gpio_cb); @@ -156,7 +156,7 @@ int adxl367_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, adxl367_gpio_callback, - BIT(cfg->interrupt.pin)); + GPIO_BIT(cfg->interrupt.pin)); ret = gpio_add_callback(cfg->interrupt.port, &drv_data->gpio_cb); if (ret != 0) { diff --git a/drivers/sensor/adi/adxl372/adxl372_trigger.c b/drivers/sensor/adi/adxl372/adxl372_trigger.c index 02f42f59767d991..03bf80e8c8918e9 100644 --- a/drivers/sensor/adi/adxl372/adxl372_trigger.c +++ b/drivers/sensor/adi/adxl372/adxl372_trigger.c @@ -56,7 +56,7 @@ static void adxl372_thread_cb(const struct device *dev) #endif /* CONFIG_ADXL372_TRIGGER_OWN_THREAD || CONFIG_ADXL372_TRIGGER_GLOBAL_THREAD */ static void adxl372_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct adxl372_data *drv_data = CONTAINER_OF(cb, struct adxl372_data, gpio_cb); @@ -174,7 +174,7 @@ int adxl372_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, adxl372_gpio_callback, - BIT(cfg->interrupt.pin)); + GPIO_BIT(cfg->interrupt.pin)); ret = gpio_add_callback(cfg->interrupt.port, &drv_data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/amg88xx/amg88xx_trigger.c b/drivers/sensor/amg88xx/amg88xx_trigger.c index 7b8d4979ec88d5e..1b9fd2400fd6fa4 100644 --- a/drivers/sensor/amg88xx/amg88xx_trigger.c +++ b/drivers/sensor/amg88xx/amg88xx_trigger.c @@ -75,7 +75,7 @@ int amg88xx_attr_set(const struct device *dev, } static void amg88xx_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct amg88xx_data *drv_data = CONTAINER_OF(cb, struct amg88xx_data, gpio_cb); @@ -187,7 +187,7 @@ int amg88xx_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, amg88xx_gpio_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); if (gpio_add_callback(config->int_gpio.port, &drv_data->gpio_cb) < 0) { LOG_DBG("Failed to set gpio callback!"); diff --git a/drivers/sensor/ams/ccs811/ccs811_trigger.c b/drivers/sensor/ams/ccs811/ccs811_trigger.c index 5a7ef006d0192da..29b70996cb3ade3 100644 --- a/drivers/sensor/ams/ccs811/ccs811_trigger.c +++ b/drivers/sensor/ams/ccs811/ccs811_trigger.c @@ -87,7 +87,7 @@ static void process_irq(const struct device *dev) static void gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct ccs811_data *data = CONTAINER_OF(cb, struct ccs811_data, gpio_cb); @@ -185,7 +185,7 @@ int ccs811_init_interrupt(const struct device *dev) gpio_pin_configure_dt(&config->irq_gpio, GPIO_INPUT); - gpio_init_callback(&drv_data->gpio_cb, gpio_callback, BIT(config->irq_gpio.pin)); + gpio_init_callback(&drv_data->gpio_cb, gpio_callback, GPIO_BIT(config->irq_gpio.pin)); if (gpio_add_callback(config->irq_gpio.port, &drv_data->gpio_cb) < 0) { LOG_DBG("Failed to set gpio callback!"); diff --git a/drivers/sensor/ams/tcs3400/tcs3400.c b/drivers/sensor/ams/tcs3400/tcs3400.c index 367359056050bcf..e0a451a8ca74084 100644 --- a/drivers/sensor/ams/tcs3400/tcs3400.c +++ b/drivers/sensor/ams/tcs3400/tcs3400.c @@ -77,7 +77,7 @@ static void tcs3400_setup_int(const struct tcs3400_config *config, bool enable) } static void tcs3400_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct tcs3400_data *data = CONTAINER_OF(cb, struct tcs3400_data, gpio_cb); @@ -279,7 +279,7 @@ static int tcs3400_init(const struct device *dev) } gpio_init_callback(&data->gpio_cb, tcs3400_gpio_callback, - BIT(cfg->int_gpio.pin)); + GPIO_BIT(cfg->int_gpio.pin)); ret = gpio_add_callback(cfg->int_gpio.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/ams/tmd2620/tmd2620.c b/drivers/sensor/ams/tmd2620/tmd2620.c index daa28d4be81f65a..54cddff3ba78134 100644 --- a/drivers/sensor/ams/tmd2620/tmd2620.c +++ b/drivers/sensor/ams/tmd2620/tmd2620.c @@ -23,7 +23,8 @@ LOG_MODULE_REGISTER(TMD2620, CONFIG_SENSOR_LOG_LEVEL); -static void tmd2620_gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void tmd2620_gpio_callback(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { LOG_DBG("Interrupt Callback was called"); @@ -57,7 +58,7 @@ static int tmd2620_configure_interrupt(const struct device *dev) return ret; } - gpio_init_callback(&data->gpio_cb, tmd2620_gpio_callback, BIT(config->int_gpio.pin)); + gpio_init_callback(&data->gpio_cb, tmd2620_gpio_callback, GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback(config->int_gpio.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/ams/tsl2540/tsl2540_trigger.c b/drivers/sensor/ams/tsl2540/tsl2540_trigger.c index 3251c3a45c93af2..33fe875d564d5ce 100644 --- a/drivers/sensor/ams/tsl2540/tsl2540_trigger.c +++ b/drivers/sensor/ams/tsl2540/tsl2540_trigger.c @@ -33,7 +33,7 @@ static void tsl2540_handle_int(const struct device *dev) } static void tsl2540_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pin_mask) + gpio_port_pins_t pin_mask) { struct tsl2540_data *data = CONTAINER_OF(cb, struct tsl2540_data, gpio_cb); @@ -182,7 +182,7 @@ int tsl2540_trigger_init(const struct device *dev) return rc; } - gpio_init_callback(&data->gpio_cb, tsl2540_gpio_callback, BIT(config->int_gpio.pin)); + gpio_init_callback(&data->gpio_cb, tsl2540_gpio_callback, GPIO_BIT(config->int_gpio.pin)); if (gpio_add_callback(config->int_gpio.port, &data->gpio_cb) < 0) { LOG_ERR("Failed to set gpio callback!"); diff --git a/drivers/sensor/ams/tsl2591/tsl2591_trigger.c b/drivers/sensor/ams/tsl2591/tsl2591_trigger.c index ea0e34d3f816229..3bdb254e51d3f95 100644 --- a/drivers/sensor/ams/tsl2591/tsl2591_trigger.c +++ b/drivers/sensor/ams/tsl2591/tsl2591_trigger.c @@ -16,7 +16,8 @@ static inline void tsl2591_setup_int(const struct device *dev, bool enable) gpio_pin_interrupt_configure_dt(&config->int_gpio, flags); } -static void tsl2591_gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void tsl2591_gpio_callback(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -128,7 +129,7 @@ int tsl2591_initialize_int(const struct device *dev) return ret; } - gpio_init_callback(&data->gpio_cb, tsl2591_gpio_callback, BIT(config->int_gpio.pin)); + gpio_init_callback(&data->gpio_cb, tsl2591_gpio_callback, GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback(config->int_gpio.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/apds9253/apds9253.c b/drivers/sensor/apds9253/apds9253.c index 539b88299835549..442b5da74e8659b 100644 --- a/drivers/sensor/apds9253/apds9253.c +++ b/drivers/sensor/apds9253/apds9253.c @@ -36,7 +36,7 @@ static void apds9253_handle_cb(struct apds9253_data *drv_data) } static void apds9253_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct apds9253_data *drv_data = CONTAINER_OF(cb, struct apds9253_data, gpio_cb); @@ -182,7 +182,7 @@ static int apds9253_init_interrupt(const struct device *dev) return ret; } - gpio_init_callback(&drv_data->gpio_cb, apds9253_gpio_callback, BIT(config->int_gpio.pin)); + gpio_init_callback(&drv_data->gpio_cb, apds9253_gpio_callback, GPIO_BIT(config->int_gpio.pin)); if (gpio_add_callback(config->int_gpio.port, &drv_data->gpio_cb) < 0) { LOG_ERR("Failed to set gpio callback!"); diff --git a/drivers/sensor/apds9960/apds9960.c b/drivers/sensor/apds9960/apds9960.c index c37baede45ef915..d800ab02d9a2ea9 100644 --- a/drivers/sensor/apds9960/apds9960.c +++ b/drivers/sensor/apds9960/apds9960.c @@ -38,7 +38,7 @@ static void apds9960_handle_cb(struct apds9960_data *drv_data) } static void apds9960_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct apds9960_data *drv_data = CONTAINER_OF(cb, struct apds9960_data, gpio_cb); @@ -370,7 +370,7 @@ static int apds9960_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, apds9960_gpio_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); if (gpio_add_callback(config->int_gpio.port, &drv_data->gpio_cb) < 0) { LOG_DBG("Failed to set gpio callback!"); diff --git a/drivers/sensor/bosch/bma280/bma280_trigger.c b/drivers/sensor/bosch/bma280/bma280_trigger.c index 5c39950b49feb71..d5e130294a950b0 100644 --- a/drivers/sensor/bosch/bma280/bma280_trigger.c +++ b/drivers/sensor/bosch/bma280/bma280_trigger.c @@ -69,7 +69,7 @@ int bma280_attr_set(const struct device *dev, } static void bma280_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct bma280_data *drv_data = CONTAINER_OF(cb, struct bma280_data, gpio_cb); @@ -239,7 +239,7 @@ int bma280_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, bma280_gpio_callback, - BIT(config->int1_gpio.pin)); + GPIO_BIT(config->int1_gpio.pin)); if (gpio_add_callback(config->int1_gpio.port, &drv_data->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback"); diff --git a/drivers/sensor/bosch/bmc150_magn/bmc150_magn_trigger.c b/drivers/sensor/bosch/bmc150_magn/bmc150_magn_trigger.c index 230b5daa8ae66b6..04322406de95b0c 100644 --- a/drivers/sensor/bosch/bmc150_magn/bmc150_magn_trigger.c +++ b/drivers/sensor/bosch/bmc150_magn/bmc150_magn_trigger.c @@ -69,7 +69,7 @@ int bmc150_magn_trigger_set(const struct device *dev, static void bmc150_magn_gpio_drdy_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct bmc150_magn_data *data = CONTAINER_OF(cb, struct bmc150_magn_data, gpio_cb); @@ -162,7 +162,7 @@ int bmc150_magn_init_interrupt(const struct device *dev) gpio_init_callback(&data->gpio_cb, bmc150_magn_gpio_drdy_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); if (gpio_add_callback(config->int_gpio.port, &data->gpio_cb) < 0) { LOG_DBG("failed to set gpio callback"); diff --git a/drivers/sensor/bosch/bmg160/bmg160_trigger.c b/drivers/sensor/bosch/bmg160/bmg160_trigger.c index dc6946e7ee91de2..9167ad5ed10f324 100644 --- a/drivers/sensor/bosch/bmg160/bmg160_trigger.c +++ b/drivers/sensor/bosch/bmg160/bmg160_trigger.c @@ -29,7 +29,7 @@ static inline int setup_int(const struct device *dev, static void bmg160_gpio_callback(const struct device *port, struct gpio_callback *cb, - uint32_t pin) + gpio_port_pins_t pin) { struct bmg160_device_data *bmg160 = CONTAINER_OF(cb, struct bmg160_device_data, gpio_cb); @@ -265,7 +265,7 @@ int bmg160_trigger_init(const struct device *dev) } gpio_init_callback(&bmg160->gpio_cb, bmg160_gpio_callback, - BIT(cfg->int_gpio.pin)); + GPIO_BIT(cfg->int_gpio.pin)); ret = gpio_add_callback(cfg->int_gpio.port, &bmg160->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/bosch/bmi08x/bmi08x_accel_trigger.c b/drivers/sensor/bosch/bmi08x/bmi08x_accel_trigger.c index 223b3df7f7402e7..61ff615d1691e9f 100644 --- a/drivers/sensor/bosch/bmi08x/bmi08x_accel_trigger.c +++ b/drivers/sensor/bosch/bmi08x/bmi08x_accel_trigger.c @@ -69,7 +69,7 @@ static void bmi08x_acc_work_handler(struct k_work *work) #endif static void bmi08x_acc_gpio_callback(const struct device *port, struct gpio_callback *cb, - uint32_t pin) + gpio_port_pins_t pin) { struct bmi08x_accel_data *data = CONTAINER_OF(cb, struct bmi08x_accel_data, gpio_cb); @@ -157,7 +157,7 @@ int bmi08x_acc_trigger_mode_init(const struct device *dev) gpio_pin_configure_dt(&cfg->int_gpio, GPIO_INPUT); - gpio_init_callback(&data->gpio_cb, bmi08x_acc_gpio_callback, BIT(cfg->int_gpio.pin)); + gpio_init_callback(&data->gpio_cb, bmi08x_acc_gpio_callback, GPIO_BIT(cfg->int_gpio.pin)); ret = gpio_add_callback(cfg->int_gpio.port, &data->gpio_cb); diff --git a/drivers/sensor/bosch/bmi08x/bmi08x_gyro_trigger.c b/drivers/sensor/bosch/bmi08x/bmi08x_gyro_trigger.c index 8be14312abb0739..adc11cbb6ff2438 100644 --- a/drivers/sensor/bosch/bmi08x/bmi08x_gyro_trigger.c +++ b/drivers/sensor/bosch/bmi08x/bmi08x_gyro_trigger.c @@ -69,7 +69,7 @@ static void bmi08x_gyr_work_handler(struct k_work *work) #endif static void bmi08x_gyr_gpio_callback(const struct device *port, struct gpio_callback *cb, - uint32_t pin) + gpio_port_pins_t pin) { struct bmi08x_gyro_data *data = CONTAINER_OF(cb, struct bmi08x_gyro_data, gpio_cb); @@ -121,7 +121,7 @@ int bmi08x_gyr_trigger_mode_init(const struct device *dev) gpio_pin_configure_dt(&cfg->int_gpio, GPIO_INPUT); - gpio_init_callback(&data->gpio_cb, bmi08x_gyr_gpio_callback, BIT(cfg->int_gpio.pin)); + gpio_init_callback(&data->gpio_cb, bmi08x_gyr_gpio_callback, GPIO_BIT(cfg->int_gpio.pin)); ret = gpio_add_callback(cfg->int_gpio.port, &data->gpio_cb); diff --git a/drivers/sensor/bosch/bmi160/bmi160_trigger.c b/drivers/sensor/bosch/bmi160/bmi160_trigger.c index 3cb870f1285d93c..f77b8d2d9645e70 100644 --- a/drivers/sensor/bosch/bmi160/bmi160_trigger.c +++ b/drivers/sensor/bosch/bmi160/bmi160_trigger.c @@ -1,4 +1,4 @@ -/* Bosch BMI160 inertial measurement unit driver, trigger implementation + /* Bosch BMI160 inertial measurement unit driver, trigger implementation * * Copyright (c) 2016 Intel Corporation * @@ -94,7 +94,7 @@ static void bmi160_work_handler(struct k_work *work) extern struct bmi160_data bmi160_data; static void bmi160_gpio_callback(const struct device *port, - struct gpio_callback *cb, uint32_t pin) + struct gpio_callback *cb, gpio_port_pins_t pin) { struct bmi160_data *data = CONTAINER_OF(cb, struct bmi160_data, gpio_cb); @@ -299,7 +299,7 @@ int bmi160_trigger_mode_init(const struct device *dev) gpio_init_callback(&data->gpio_cb, bmi160_gpio_callback, - BIT(cfg->interrupt.pin)); + GPIO_BIT(cfg->interrupt.pin)); ret = gpio_add_callback(cfg->interrupt.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/bosch/bmi270/bmi270_trigger.c b/drivers/sensor/bosch/bmi270/bmi270_trigger.c index 656b5d23d161d65..31d3862f19979b6 100644 --- a/drivers/sensor/bosch/bmi270/bmi270_trigger.c +++ b/drivers/sensor/bosch/bmi270/bmi270_trigger.c @@ -29,7 +29,7 @@ static void bmi270_raise_int_flag(const struct device *dev, int bit) } static void bmi270_int1_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct bmi270_data *data = CONTAINER_OF(cb, struct bmi270_data, int1_cb); @@ -37,7 +37,7 @@ static void bmi270_int1_callback(const struct device *dev, } static void bmi270_int2_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct bmi270_data *data = CONTAINER_OF(cb, struct bmi270_data, int2_cb); @@ -148,7 +148,7 @@ static int bmi270_init_int_pin(const struct gpio_dt_spec *pin, return -ENODEV; } - gpio_init_callback(pin_cb, handler, BIT(pin->pin)); + gpio_init_callback(pin_cb, handler, GPIO_BIT(pin->pin)); ret = gpio_pin_configure_dt(pin, GPIO_INPUT); if (ret) { diff --git a/drivers/sensor/bosch/bmi323/bmi323.c b/drivers/sensor/bosch/bmi323/bmi323.c index 65bdef619ec844b..b18778e65312c34 100644 --- a/drivers/sensor/bosch/bmi323/bmi323.c +++ b/drivers/sensor/bosch/bmi323/bmi323.c @@ -26,7 +26,7 @@ LOG_MODULE_REGISTER(bosch_bmi323); #define IMU_BOSCH_DIE_TEMP_MICRO_DEG_CELCIUS_LSB (1953L) typedef void (*bosch_bmi323_gpio_callback_ptr)(const struct device *dev, struct gpio_callback *cb, - uint32_t pins); + gpio_port_pins_t pins); struct bosch_bmi323_config { const struct bosch_bmi323_bus *bus; @@ -1134,7 +1134,7 @@ static int bosch_bmi323_init_irq(const struct device *dev) } gpio_init_callback(&data->gpio_callback, config->int_gpio_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback(config->int_gpio.port, &data->gpio_callback); @@ -1329,7 +1329,8 @@ static int bosch_bmi323_init(const struct device *dev) BMI323_DEVICE_BUS(inst); \ \ static void bosch_bmi323_irq_callback##inst(const struct device *dev, \ - struct gpio_callback *cb, uint32_t pins) \ + struct gpio_callback *cb, \ + gpio_port_pins_t pins) \ { \ bosch_bmi323_irq_callback(DEVICE_DT_INST_GET(inst)); \ } \ diff --git a/drivers/sensor/bosch/bmm150/bmm150_trigger.c b/drivers/sensor/bosch/bmm150/bmm150_trigger.c index c2ede99696d34aa..021f2abedbe957f 100644 --- a/drivers/sensor/bosch/bmm150/bmm150_trigger.c +++ b/drivers/sensor/bosch/bmm150/bmm150_trigger.c @@ -58,7 +58,7 @@ static void bmm150_work_handler(struct k_work *work) static void bmm150_gpio_callback(const struct device *port, struct gpio_callback *cb, - uint32_t pin) + gpio_port_pins_t pin) { struct bmm150_data *data = CONTAINER_OF(cb, struct bmm150_data, @@ -152,7 +152,7 @@ int bmm150_trigger_mode_init(const struct device *dev) gpio_init_callback(&data->gpio_cb, bmm150_gpio_callback, - BIT(cfg->drdy_int.pin)); + GPIO_BIT(cfg->drdy_int.pin)); return gpio_add_callback(cfg->drdy_int.port, &data->gpio_cb); } diff --git a/drivers/sensor/bosch/bmp388/bmp388_trigger.c b/drivers/sensor/bosch/bmp388/bmp388_trigger.c index cc5cc8cd48549ed..aabcc7760de8b25 100644 --- a/drivers/sensor/bosch/bmp388/bmp388_trigger.c +++ b/drivers/sensor/bosch/bmp388/bmp388_trigger.c @@ -58,7 +58,7 @@ static void bmp388_work_handler(struct k_work *work) static void bmp388_gpio_callback(const struct device *port, struct gpio_callback *cb, - uint32_t pin) + gpio_port_pins_t pin) { struct bmp388_data *data = CONTAINER_OF(cb, struct bmp388_data, @@ -153,7 +153,7 @@ int bmp388_trigger_mode_init(const struct device *dev) gpio_init_callback(&data->gpio_cb, bmp388_gpio_callback, - BIT(cfg->gpio_int.pin)); + GPIO_BIT(cfg->gpio_int.pin)); ret = gpio_add_callback(cfg->gpio_int.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/ens160/ens160_trigger.c b/drivers/sensor/ens160/ens160_trigger.c index 50e93b4bf6e2d2c..26f2f2a5f0828a6 100644 --- a/drivers/sensor/ens160/ens160_trigger.c +++ b/drivers/sensor/ens160/ens160_trigger.c @@ -20,7 +20,8 @@ static inline void ens160_setup_int(const struct device *dev, bool enable) (void)gpio_pin_interrupt_configure_dt(&config->int_gpio, flags); } -static void ens160_gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void ens160_gpio_callback(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { struct ens160_data *data = CONTAINER_OF(cb, struct ens160_data, gpio_cb); @@ -123,7 +124,7 @@ int ens160_init_interrupt(const struct device *dev) gpio_pin_configure_dt(&config->int_gpio, GPIO_INPUT); - gpio_init_callback(&data->gpio_cb, ens160_gpio_callback, BIT(config->int_gpio.pin)); + gpio_init_callback(&data->gpio_cb, ens160_gpio_callback, GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback(config->int_gpio.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/grow_r502a/grow_r502a_trigger.c b/drivers/sensor/grow_r502a/grow_r502a_trigger.c index 1513b896d94b69e..914e7bc61339233 100644 --- a/drivers/sensor/grow_r502a/grow_r502a_trigger.c +++ b/drivers/sensor/grow_r502a/grow_r502a_trigger.c @@ -56,7 +56,7 @@ int grow_r502a_trigger_set(const struct device *dev, } static void grow_r502a_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct grow_r502a_data *drv_data = CONTAINER_OF(cb, struct grow_r502a_data, gpio_cb); @@ -124,7 +124,7 @@ int grow_r502a_init_interrupt(const struct device *dev) #endif gpio_init_callback(&drv_data->gpio_cb, grow_r502a_gpio_callback, - BIT(cfg->int_gpios.pin)); + GPIO_BIT(cfg->int_gpios.pin)); rc = gpio_add_callback(cfg->int_gpios.port, &drv_data->gpio_cb); if (rc < 0) { diff --git a/drivers/sensor/honeywell/hmc5883l/hmc5883l_trigger.c b/drivers/sensor/honeywell/hmc5883l/hmc5883l_trigger.c index c3a1d00891cb5a6..3dcc7e0321e43a7 100644 --- a/drivers/sensor/honeywell/hmc5883l/hmc5883l_trigger.c +++ b/drivers/sensor/honeywell/hmc5883l/hmc5883l_trigger.c @@ -46,7 +46,7 @@ int hmc5883l_trigger_set(const struct device *dev, } static void hmc5883l_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct hmc5883l_data *drv_data = CONTAINER_OF(cb, struct hmc5883l_data, gpio_cb); @@ -115,7 +115,7 @@ int hmc5883l_init_interrupt(const struct device *dev) gpio_pin_configure_dt(&config->int_gpio, GPIO_INPUT); gpio_init_callback(&drv_data->gpio_cb, hmc5883l_gpio_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); if (gpio_add_callback(config->int_gpio.port, &drv_data->gpio_cb) < 0) { LOG_ERR("Failed to set gpio callback."); diff --git a/drivers/sensor/honeywell/sm351lt/sm351lt.c b/drivers/sensor/honeywell/sm351lt/sm351lt.c index 7ec832531522705..7a3dd571d00944e 100644 --- a/drivers/sensor/honeywell/sm351lt/sm351lt.c +++ b/drivers/sensor/honeywell/sm351lt/sm351lt.c @@ -52,7 +52,7 @@ static int sm351lt_trigger_set(const struct device *dev, } static void sm351lt_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct sm351lt_data *data = CONTAINER_OF(cb, struct sm351lt_data, gpio_cb); @@ -236,7 +236,7 @@ static int sm351lt_init(const struct device *dev) /* Setup callback struct but do not add it yet */ gpio_init_callback(&data->gpio_cb, sm351lt_gpio_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); #endif return 0; diff --git a/drivers/sensor/jedec/jc42/jc42_trigger.c b/drivers/sensor/jedec/jc42/jc42_trigger.c index 8ba9970720df14e..973c14b5155c486 100644 --- a/drivers/sensor/jedec/jc42/jc42_trigger.c +++ b/drivers/sensor/jedec/jc42/jc42_trigger.c @@ -118,7 +118,7 @@ int jc42_trigger_set(const struct device *dev, } static void alert_cb(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct jc42_data *data = CONTAINER_OF(cb, struct jc42_data, alert_cb); @@ -192,7 +192,7 @@ int jc42_setup_interrupt(const struct device *dev) } if (rc == 0) { - gpio_init_callback(&data->alert_cb, alert_cb, BIT(cfg->int_gpio.pin)); + gpio_init_callback(&data->alert_cb, alert_cb, GPIO_BIT(cfg->int_gpio.pin)); rc = gpio_add_callback(cfg->int_gpio.port, &data->alert_cb); } diff --git a/drivers/sensor/lm75/lm75.c b/drivers/sensor/lm75/lm75.c index dc6f7924b6f578a..fc51ab3d9c2128e 100644 --- a/drivers/sensor/lm75/lm75.c +++ b/drivers/sensor/lm75/lm75.c @@ -369,7 +369,7 @@ int lm75_init(const struct device *dev) } gpio_init_callback(&data->int_gpio_cb, lm75_int_gpio_callback_handler, - BIT(cfg->int_gpio.pin)); + GPIO_BIT(cfg->int_gpio.pin)); ret = gpio_add_callback(cfg->int_gpio.port, &data->int_gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/lm77/lm77.c b/drivers/sensor/lm77/lm77.c index 1b0b6fb17cb9361..fd19c8b22e25c40 100644 --- a/drivers/sensor/lm77/lm77.c +++ b/drivers/sensor/lm77/lm77.c @@ -347,7 +347,7 @@ static int lm77_init(const struct device *dev) } gpio_init_callback(&data->int_gpio_cb, lm77_int_gpio_callback_handler, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); err = gpio_add_callback(config->int_gpio.port, &data->int_gpio_cb); if (err < 0) { diff --git a/drivers/sensor/memsic/mc3419/mc3419_trigger.c b/drivers/sensor/memsic/mc3419/mc3419_trigger.c index ab44fe79d240f2e..ac7b2e6ba3bdae9 100644 --- a/drivers/sensor/memsic/mc3419/mc3419_trigger.c +++ b/drivers/sensor/memsic/mc3419/mc3419_trigger.c @@ -11,7 +11,7 @@ LOG_MODULE_DECLARE(MC3419, CONFIG_SENSOR_LOG_LEVEL); static void mc3419_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pin_mask) + gpio_port_pins_t pin_mask) { struct mc3419_driver_data *data = CONTAINER_OF(cb, struct mc3419_driver_data, gpio_cb); @@ -158,7 +158,7 @@ int mc3419_trigger_init(const struct device *dev) k_work_init(&data->work, mc3419_work_cb); #endif gpio_init_callback(&data->gpio_cb, mc3419_gpio_callback, - BIT(cfg->int_gpio.pin)); + GPIO_BIT(cfg->int_gpio.pin)); ret = gpio_add_callback(cfg->int_gpio.port, &data->gpio_cb); if (ret < 0) { LOG_ERR("Failed to set int callback"); diff --git a/drivers/sensor/microchip/tcn75a/tcn75a_trigger.c b/drivers/sensor/microchip/tcn75a/tcn75a_trigger.c index 12635eb00c22f65..e695871519c195e 100644 --- a/drivers/sensor/microchip/tcn75a/tcn75a_trigger.c +++ b/drivers/sensor/microchip/tcn75a/tcn75a_trigger.c @@ -132,7 +132,7 @@ static void tcn75a_handle_int(const struct device *dev) } static void tcn75a_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pin_mask) + gpio_port_pins_t pin_mask) { struct tcn75a_data *data = CONTAINER_OF(cb, struct tcn75a_data, gpio_cb); const struct tcn75a_config *config = data->dev->config; @@ -191,7 +191,7 @@ int tcn75a_trigger_init(const struct device *dev) return ret; } - gpio_init_callback(&data->gpio_cb, tcn75a_gpio_callback, BIT(config->alert_gpios.pin)); + gpio_init_callback(&data->gpio_cb, tcn75a_gpio_callback, GPIO_BIT(config->alert_gpios.pin)); ret = gpio_add_callback(config->alert_gpios.port, &data->gpio_cb); diff --git a/drivers/sensor/nxp/fxas21002/fxas21002_trigger.c b/drivers/sensor/nxp/fxas21002/fxas21002_trigger.c index b32d2f5f7d0216c..aac00ffcb23aa26 100644 --- a/drivers/sensor/nxp/fxas21002/fxas21002_trigger.c +++ b/drivers/sensor/nxp/fxas21002/fxas21002_trigger.c @@ -14,7 +14,7 @@ LOG_MODULE_DECLARE(FXAS21002, CONFIG_SENSOR_LOG_LEVEL); static void fxas21002_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pin_mask) + gpio_port_pins_t pin_mask) { struct fxas21002_data *data = CONTAINER_OF(cb, struct fxas21002_data, gpio_cb); @@ -208,7 +208,7 @@ int fxas21002_trigger_init(const struct device *dev) } gpio_init_callback(&data->gpio_cb, fxas21002_gpio_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback(config->int_gpio.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/nxp/fxls8974/fxls8974_trigger.c b/drivers/sensor/nxp/fxls8974/fxls8974_trigger.c index 82fd723f3d33a0a..981d51a3e8070a7 100644 --- a/drivers/sensor/nxp/fxls8974/fxls8974_trigger.c +++ b/drivers/sensor/nxp/fxls8974/fxls8974_trigger.c @@ -14,7 +14,7 @@ LOG_MODULE_DECLARE(FXLS8974, CONFIG_SENSOR_LOG_LEVEL); static void fxls8974_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pin_mask) + gpio_port_pins_t pin_mask) { struct fxls8974_data *data = CONTAINER_OF(cb, struct fxls8974_data, gpio_cb); @@ -163,7 +163,7 @@ int fxls8974_trigger_init(const struct device *dev) } gpio_init_callback(&data->gpio_cb, fxls8974_gpio_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback(config->int_gpio.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/nxp/fxos8700/fxos8700_trigger.c b/drivers/sensor/nxp/fxos8700/fxos8700_trigger.c index 53d493ac44ddd28..cd16553d9ecb402 100644 --- a/drivers/sensor/nxp/fxos8700/fxos8700_trigger.c +++ b/drivers/sensor/nxp/fxos8700/fxos8700_trigger.c @@ -14,7 +14,7 @@ LOG_MODULE_DECLARE(FXOS8700, CONFIG_SENSOR_LOG_LEVEL); static void fxos8700_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pin_mask) + gpio_port_pins_t pin_mask) { struct fxos8700_data *data = CONTAINER_OF(cb, struct fxos8700_data, gpio_cb); @@ -456,7 +456,7 @@ int fxos8700_trigger_init(const struct device *dev) } gpio_init_callback(&data->gpio_cb, fxos8700_gpio_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); ret = gpio_add_callback(config->int_gpio.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/renesas/isl29035/isl29035_trigger.c b/drivers/sensor/renesas/isl29035/isl29035_trigger.c index a0a5d2af21fe696..54f1b6f6bf3e029 100644 --- a/drivers/sensor/renesas/isl29035/isl29035_trigger.c +++ b/drivers/sensor/renesas/isl29035/isl29035_trigger.c @@ -90,7 +90,7 @@ int isl29035_attr_set(const struct device *dev, } static void isl29035_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct isl29035_driver_data *drv_data = CONTAINER_OF(cb, struct isl29035_driver_data, gpio_cb); @@ -195,7 +195,7 @@ int isl29035_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, isl29035_gpio_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); if (gpio_add_callback(config->int_gpio.port, &drv_data->gpio_cb) < 0) { LOG_DBG("Failed to set gpio callback."); diff --git a/drivers/sensor/sensirion/sht3xd/sht3xd_trigger.c b/drivers/sensor/sensirion/sht3xd/sht3xd_trigger.c index b6b398c5166b363..3b808986a7eb17c 100644 --- a/drivers/sensor/sensirion/sht3xd/sht3xd_trigger.c +++ b/drivers/sensor/sensirion/sht3xd/sht3xd_trigger.c @@ -142,7 +142,7 @@ int sht3xd_trigger_set(const struct device *dev, } static void sht3xd_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct sht3xd_data *data = CONTAINER_OF(cb, struct sht3xd_data, alert_cb); @@ -204,7 +204,7 @@ int sht3xd_init_interrupt(const struct device *dev) } gpio_init_callback(&data->alert_cb, sht3xd_gpio_callback, - BIT(cfg->alert_gpio.pin)); + GPIO_BIT(cfg->alert_gpio.pin)); rc = gpio_add_callback(cfg->alert_gpio.port, &data->alert_cb); if (rc < 0) { LOG_DBG("Failed to set gpio callback!"); diff --git a/drivers/sensor/st/hts221/hts221_trigger.c b/drivers/sensor/st/hts221/hts221_trigger.c index 1ebccb2a3c54ad5..a5a1301bb9e67b0 100644 --- a/drivers/sensor/st/hts221/hts221_trigger.c +++ b/drivers/sensor/st/hts221/hts221_trigger.c @@ -84,7 +84,7 @@ int hts221_trigger_set(const struct device *dev, } static void hts221_drdy_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct hts221_data *data = CONTAINER_OF(cb, struct hts221_data, drdy_cb); @@ -148,7 +148,7 @@ int hts221_init_interrupt(const struct device *dev) gpio_init_callback(&data->drdy_cb, hts221_drdy_callback, - BIT(cfg->gpio_drdy.pin)); + GPIO_BIT(cfg->gpio_drdy.pin)); status = gpio_add_callback(cfg->gpio_drdy.port, &data->drdy_cb); if (status < 0) { diff --git a/drivers/sensor/st/iis2dh/iis2dh_trigger.c b/drivers/sensor/st/iis2dh/iis2dh_trigger.c index d108c52c398b216..ba3d639ae9fdefb 100644 --- a/drivers/sensor/st/iis2dh/iis2dh_trigger.c +++ b/drivers/sensor/st/iis2dh/iis2dh_trigger.c @@ -92,7 +92,7 @@ static void iis2dh_handle_interrupt(const struct device *dev) } static void iis2dh_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct iis2dh_data *iis2dh = CONTAINER_OF(cb, struct iis2dh_data, gpio_cb); @@ -169,7 +169,7 @@ int iis2dh_init_interrupt(const struct device *dev) gpio_init_callback(&iis2dh->gpio_cb, iis2dh_gpio_callback, - BIT(cfg->int_gpio.pin)); + GPIO_BIT(cfg->int_gpio.pin)); if (gpio_add_callback(cfg->int_gpio.port, &iis2dh->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback"); diff --git a/drivers/sensor/st/iis2dlpc/iis2dlpc_trigger.c b/drivers/sensor/st/iis2dlpc/iis2dlpc_trigger.c index 90cdb4b857f91dd..5f00c39d3da3a7e 100644 --- a/drivers/sensor/st/iis2dlpc/iis2dlpc_trigger.c +++ b/drivers/sensor/st/iis2dlpc/iis2dlpc_trigger.c @@ -215,7 +215,7 @@ static void iis2dlpc_handle_interrupt(const struct device *dev) } static void iis2dlpc_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct iis2dlpc_data *iis2dlpc = CONTAINER_OF(cb, struct iis2dlpc_data, gpio_cb); @@ -290,7 +290,7 @@ int iis2dlpc_init_interrupt(const struct device *dev) gpio_init_callback(&iis2dlpc->gpio_cb, iis2dlpc_gpio_callback, - BIT(cfg->gpio_drdy.pin)); + GPIO_BIT(cfg->gpio_drdy.pin)); if (gpio_add_callback(cfg->gpio_drdy.port, &iis2dlpc->gpio_cb) < 0) { LOG_ERR("Could not set gpio callback"); diff --git a/drivers/sensor/st/iis2iclx/iis2iclx_trigger.c b/drivers/sensor/st/iis2iclx/iis2iclx_trigger.c index 6149a8bdd5d3d4d..42c100819dde34b 100644 --- a/drivers/sensor/st/iis2iclx/iis2iclx_trigger.c +++ b/drivers/sensor/st/iis2iclx/iis2iclx_trigger.c @@ -165,7 +165,7 @@ static void iis2iclx_handle_interrupt(const struct device *dev) } static void iis2iclx_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct iis2iclx_data *iis2iclx = CONTAINER_OF(cb, struct iis2iclx_data, gpio_cb); @@ -240,7 +240,7 @@ int iis2iclx_init_interrupt(const struct device *dev) gpio_init_callback(&iis2iclx->gpio_cb, iis2iclx_gpio_callback, - BIT(cfg->gpio_drdy.pin)); + GPIO_BIT(cfg->gpio_drdy.pin)); if (gpio_add_callback(cfg->gpio_drdy.port, &iis2iclx->gpio_cb) < 0) { LOG_ERR("Could not set gpio callback"); diff --git a/drivers/sensor/st/iis2mdc/iis2mdc_trigger.c b/drivers/sensor/st/iis2mdc/iis2mdc_trigger.c index fc9f203b033e745..f7d76dee8245713 100644 --- a/drivers/sensor/st/iis2mdc/iis2mdc_trigger.c +++ b/drivers/sensor/st/iis2mdc/iis2mdc_trigger.c @@ -65,7 +65,7 @@ static void iis2mdc_handle_interrupt(const struct device *dev) } static void iis2mdc_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct iis2mdc_data *iis2mdc = CONTAINER_OF(cb, struct iis2mdc_data, gpio_cb); @@ -138,7 +138,7 @@ int iis2mdc_init_interrupt(const struct device *dev) gpio_init_callback(&iis2mdc->gpio_cb, iis2mdc_gpio_callback, - BIT(config->gpio_drdy.pin)); + GPIO_BIT(config->gpio_drdy.pin)); if (gpio_add_callback(config->gpio_drdy.port, &iis2mdc->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback"); diff --git a/drivers/sensor/st/iis328dq/iis328dq_trigger.c b/drivers/sensor/st/iis328dq/iis328dq_trigger.c index 03a6ad9bee30356..3e814a7fdc6e9a4 100644 --- a/drivers/sensor/st/iis328dq/iis328dq_trigger.c +++ b/drivers/sensor/st/iis328dq/iis328dq_trigger.c @@ -203,7 +203,7 @@ static void iis328dq_handle_interrupt(const struct device *dev) } static void iis328dq_int1_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct iis328dq_data *iis328dq = CONTAINER_OF(cb, struct iis328dq_data, int1_cb); @@ -219,7 +219,7 @@ static void iis328dq_int1_gpio_callback(const struct device *dev, struct gpio_ca } static void iis328dq_int2_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct iis328dq_data *iis328dq = CONTAINER_OF(cb, struct iis328dq_data, int2_cb); @@ -301,7 +301,7 @@ int iis328dq_init_interrupt(const struct device *dev) return ret; } gpio_init_callback(&iis328dq->int1_cb, iis328dq_int1_gpio_callback, - BIT(cfg->gpio_int1.pin)); + GPIO_BIT(cfg->gpio_int1.pin)); if (gpio_add_callback(cfg->gpio_int1.port, &iis328dq->int1_cb) < 0) { LOG_ERR("Could not set INT1 callback"); return -EIO; @@ -315,7 +315,7 @@ int iis328dq_init_interrupt(const struct device *dev) return ret; } gpio_init_callback(&iis328dq->int2_cb, iis328dq_int2_gpio_callback, - BIT(cfg->gpio_int2.pin)); + GPIO_BIT(cfg->gpio_int2.pin)); if (gpio_add_callback(cfg->gpio_int2.port, &iis328dq->int2_cb) < 0) { LOG_ERR("Could not set INT2 callback"); return -EIO; diff --git a/drivers/sensor/st/iis3dhhc/iis3dhhc_trigger.c b/drivers/sensor/st/iis3dhhc/iis3dhhc_trigger.c index 0ce2df490b37f8c..52baa41c3d78d88 100644 --- a/drivers/sensor/st/iis3dhhc/iis3dhhc_trigger.c +++ b/drivers/sensor/st/iis3dhhc/iis3dhhc_trigger.c @@ -81,7 +81,7 @@ static void iis3dhhc_handle_interrupt(const struct device *dev) } static void iis3dhhc_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct iis3dhhc_data *iis3dhhc = CONTAINER_OF(cb, struct iis3dhhc_data, gpio_cb); @@ -154,7 +154,7 @@ int iis3dhhc_init_interrupt(const struct device *dev) return ret; } - gpio_init_callback(&iis3dhhc->gpio_cb, iis3dhhc_gpio_callback, BIT(cfg->int_gpio.pin)); + gpio_init_callback(&iis3dhhc->gpio_cb, iis3dhhc_gpio_callback, GPIO_BIT(cfg->int_gpio.pin)); if (gpio_add_callback(cfg->int_gpio.port, &iis3dhhc->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback"); diff --git a/drivers/sensor/st/ism330dhcx/ism330dhcx_trigger.c b/drivers/sensor/st/ism330dhcx/ism330dhcx_trigger.c index e5b92eeef07293f..759a52048074d26 100644 --- a/drivers/sensor/st/ism330dhcx/ism330dhcx_trigger.c +++ b/drivers/sensor/st/ism330dhcx/ism330dhcx_trigger.c @@ -209,7 +209,7 @@ static void ism330dhcx_handle_interrupt(const struct device *dev) } static void ism330dhcx_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct ism330dhcx_data *ism330dhcx = CONTAINER_OF(cb, struct ism330dhcx_data, gpio_cb); @@ -281,7 +281,7 @@ int ism330dhcx_init_interrupt(const struct device *dev) return ret; } - gpio_init_callback(&ism330dhcx->gpio_cb, ism330dhcx_gpio_callback, BIT(cfg->drdy_gpio.pin)); + gpio_init_callback(&ism330dhcx->gpio_cb, ism330dhcx_gpio_callback, GPIO_BIT(cfg->drdy_gpio.pin)); if (gpio_add_callback(cfg->drdy_gpio.port, &ism330dhcx->gpio_cb) < 0) { LOG_ERR("Could not set gpio callback"); diff --git a/drivers/sensor/st/lis2de12/lis2de12_trigger.c b/drivers/sensor/st/lis2de12/lis2de12_trigger.c index feee823bb9149dd..28f42a8dd405253 100644 --- a/drivers/sensor/st/lis2de12/lis2de12_trigger.c +++ b/drivers/sensor/st/lis2de12/lis2de12_trigger.c @@ -111,7 +111,7 @@ static void lis2de12_handle_interrupt(const struct device *dev) } static void lis2de12_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lis2de12_data *lis2de12 = CONTAINER_OF(cb, struct lis2de12_data, gpio_cb); @@ -183,7 +183,7 @@ int lis2de12_init_interrupt(const struct device *dev) gpio_init_callback(&lis2de12->gpio_cb, lis2de12_gpio_callback, - BIT(lis2de12->drdy_gpio->pin)); + GPIO_BIT(lis2de12->drdy_gpio->pin)); if (gpio_add_callback(lis2de12->drdy_gpio->port, &lis2de12->gpio_cb) < 0) { LOG_ERR("Could not set gpio callback"); diff --git a/drivers/sensor/st/lis2dh/lis2dh_trigger.c b/drivers/sensor/st/lis2dh/lis2dh_trigger.c index 16b0ea52fb850c5..a28c2c2a769ecdc 100644 --- a/drivers/sensor/st/lis2dh/lis2dh_trigger.c +++ b/drivers/sensor/st/lis2dh/lis2dh_trigger.c @@ -378,7 +378,7 @@ int lis2dh_acc_hp_filter_set(const struct device *dev, int32_t val) #endif static void lis2dh_gpio_int1_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lis2dh_data *lis2dh = CONTAINER_OF(cb, struct lis2dh_data, gpio_int1_cb); @@ -398,7 +398,7 @@ static void lis2dh_gpio_int1_callback(const struct device *dev, } static void lis2dh_gpio_int2_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lis2dh_data *lis2dh = CONTAINER_OF(cb, struct lis2dh_data, gpio_int2_cb); @@ -582,7 +582,7 @@ int lis2dh_init_interrupt(const struct device *dev) gpio_init_callback(&lis2dh->gpio_int1_cb, lis2dh_gpio_int1_callback, - BIT(cfg->gpio_drdy.pin)); + GPIO_BIT(cfg->gpio_drdy.pin)); status = gpio_add_callback(cfg->gpio_drdy.port, &lis2dh->gpio_int1_cb); if (status < 0) { @@ -622,7 +622,7 @@ int lis2dh_init_interrupt(const struct device *dev) gpio_init_callback(&lis2dh->gpio_int2_cb, lis2dh_gpio_int2_callback, - BIT(cfg->gpio_int.pin)); + GPIO_BIT(cfg->gpio_int.pin)); /* callback is going to be enabled by trigger setting function */ status = gpio_add_callback(cfg->gpio_int.port, &lis2dh->gpio_int2_cb); diff --git a/drivers/sensor/st/lis2ds12/lis2ds12_trigger.c b/drivers/sensor/st/lis2ds12/lis2ds12_trigger.c index d34949133156043..3cbd9377e23be6b 100644 --- a/drivers/sensor/st/lis2ds12/lis2ds12_trigger.c +++ b/drivers/sensor/st/lis2ds12/lis2ds12_trigger.c @@ -16,7 +16,7 @@ LOG_MODULE_DECLARE(LIS2DS12, CONFIG_SENSOR_LOG_LEVEL); static void lis2ds12_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lis2ds12_data *data = CONTAINER_OF(cb, struct lis2ds12_data, gpio_cb); @@ -151,7 +151,7 @@ int lis2ds12_trigger_init(const struct device *dev) gpio_init_callback(&data->gpio_cb, lis2ds12_gpio_callback, - BIT(cfg->gpio_int.pin)); + GPIO_BIT(cfg->gpio_int.pin)); ret = gpio_add_callback(cfg->gpio_int.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/st/lis2du12/lis2du12_trigger.c b/drivers/sensor/st/lis2du12/lis2du12_trigger.c index d2edbad3e2b4fb5..b8475af8db9ffdc 100644 --- a/drivers/sensor/st/lis2du12/lis2du12_trigger.c +++ b/drivers/sensor/st/lis2du12/lis2du12_trigger.c @@ -129,7 +129,7 @@ static void lis2du12_handle_interrupt(const struct device *dev) } static void lis2du12_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lis2du12_data *lis2du12 = CONTAINER_OF(cb, struct lis2du12_data, gpio_cb); @@ -203,7 +203,7 @@ int lis2du12_init_interrupt(const struct device *dev) gpio_init_callback(&lis2du12->gpio_cb, lis2du12_gpio_callback, - BIT(lis2du12->drdy_gpio->pin)); + GPIO_BIT(lis2du12->drdy_gpio->pin)); if (gpio_add_callback(lis2du12->drdy_gpio->port, &lis2du12->gpio_cb) < 0) { LOG_ERR("Could not set gpio callback"); diff --git a/drivers/sensor/st/lis2dux12/lis2dux12_trigger.c b/drivers/sensor/st/lis2dux12/lis2dux12_trigger.c index 30ede375ec3bbd4..30360c3672f1585 100644 --- a/drivers/sensor/st/lis2dux12/lis2dux12_trigger.c +++ b/drivers/sensor/st/lis2dux12/lis2dux12_trigger.c @@ -16,7 +16,7 @@ LOG_MODULE_DECLARE(LIS2DUX12, CONFIG_SENSOR_LOG_LEVEL); static void lis2dux12_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct lis2dux12_data *data = CONTAINER_OF(cb, struct lis2dux12_data, gpio_cb); int ret; @@ -135,7 +135,7 @@ int lis2dux12_trigger_init(const struct device *dev) return ret; } - gpio_init_callback(&data->gpio_cb, lis2dux12_gpio_callback, BIT(data->drdy_gpio->pin)); + gpio_init_callback(&data->gpio_cb, lis2dux12_gpio_callback, GPIO_BIT(data->drdy_gpio->pin)); ret = gpio_add_callback(data->drdy_gpio->port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/st/lis2dw12/lis2dw12_trigger.c b/drivers/sensor/st/lis2dw12/lis2dw12_trigger.c index 0f300d157b60b66..26d51eca5bc8577 100644 --- a/drivers/sensor/st/lis2dw12/lis2dw12_trigger.c +++ b/drivers/sensor/st/lis2dw12/lis2dw12_trigger.c @@ -324,7 +324,7 @@ static void lis2dw12_handle_interrupt(const struct device *dev) } static void lis2dw12_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lis2dw12_data *lis2dw12 = CONTAINER_OF(cb, struct lis2dw12_data, gpio_cb); @@ -517,7 +517,7 @@ int lis2dw12_init_interrupt(const struct device *dev) gpio_init_callback(&lis2dw12->gpio_cb, lis2dw12_gpio_callback, - BIT(cfg->gpio_int.pin)); + GPIO_BIT(cfg->gpio_int.pin)); if (gpio_add_callback(cfg->gpio_int.port, &lis2dw12->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback"); diff --git a/drivers/sensor/st/lis2mdl/lis2mdl_trigger.c b/drivers/sensor/st/lis2mdl/lis2mdl_trigger.c index 19930174ea03dd1..5ddee141d234101 100644 --- a/drivers/sensor/st/lis2mdl/lis2mdl_trigger.c +++ b/drivers/sensor/st/lis2mdl/lis2mdl_trigger.c @@ -78,7 +78,7 @@ static void lis2mdl_handle_interrupt(const struct device *dev) } static void lis2mdl_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lis2mdl_data *lis2mdl = CONTAINER_OF(cb, struct lis2mdl_data, gpio_cb); @@ -151,7 +151,7 @@ int lis2mdl_init_interrupt(const struct device *dev) gpio_init_callback(&lis2mdl->gpio_cb, lis2mdl_gpio_callback, - BIT(cfg->gpio_drdy.pin)); + GPIO_BIT(cfg->gpio_drdy.pin)); if (gpio_add_callback(cfg->gpio_drdy.port, &lis2mdl->gpio_cb) < 0) { LOG_ERR("Could not set gpio callback"); diff --git a/drivers/sensor/st/lis3mdl/lis3mdl_trigger.c b/drivers/sensor/st/lis3mdl/lis3mdl_trigger.c index ba94076bd14f43b..13a8c395d161393 100644 --- a/drivers/sensor/st/lis3mdl/lis3mdl_trigger.c +++ b/drivers/sensor/st/lis3mdl/lis3mdl_trigger.c @@ -55,7 +55,7 @@ int lis3mdl_trigger_set(const struct device *dev, } static void lis3mdl_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lis3mdl_data *drv_data = CONTAINER_OF(cb, struct lis3mdl_data, gpio_cb); @@ -125,7 +125,7 @@ int lis3mdl_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, lis3mdl_gpio_callback, - BIT(config->irq_gpio.pin)); + GPIO_BIT(config->irq_gpio.pin)); if (gpio_add_callback(config->irq_gpio.port, &drv_data->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback."); diff --git a/drivers/sensor/st/lps22hh/lps22hh_trigger.c b/drivers/sensor/st/lps22hh/lps22hh_trigger.c index e08a0259ee2c9a3..c200efddd72eccb 100644 --- a/drivers/sensor/st/lps22hh/lps22hh_trigger.c +++ b/drivers/sensor/st/lps22hh/lps22hh_trigger.c @@ -105,7 +105,7 @@ static void lps22hh_intr_callback(struct lps22hh_data *lps22hh) } static void lps22hh_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lps22hh_data *lps22hh = CONTAINER_OF(cb, struct lps22hh_data, gpio_cb); @@ -214,7 +214,7 @@ int lps22hh_init_interrupt(const struct device *dev) gpio_init_callback(&lps22hh->gpio_cb, lps22hh_gpio_callback, - BIT(cfg->gpio_int.pin)); + GPIO_BIT(cfg->gpio_int.pin)); ret = gpio_add_callback(cfg->gpio_int.port, &lps22hh->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/st/lps2xdf/lps2xdf_trigger.c b/drivers/sensor/st/lps2xdf/lps2xdf_trigger.c index de51ba14e6ef469..7c32073da532e0e 100644 --- a/drivers/sensor/st/lps2xdf/lps2xdf_trigger.c +++ b/drivers/sensor/st/lps2xdf/lps2xdf_trigger.c @@ -55,7 +55,7 @@ static void lps2xdf_intr_callback(struct lps2xdf_data *lps2xdf) } static void lps2xdf_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lps2xdf_data *lps2xdf = CONTAINER_OF(cb, struct lps2xdf_data, gpio_cb); @@ -159,7 +159,7 @@ int lps2xdf_init_interrupt(const struct device *dev, enum sensor_variant variant gpio_init_callback(&lps2xdf->gpio_cb, lps2xdf_gpio_callback, - BIT(cfg->gpio_int.pin)); + GPIO_BIT(cfg->gpio_int.pin)); ret = gpio_add_callback(cfg->gpio_int.port, &lps2xdf->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/st/lsm6dsl/lsm6dsl_trigger.c b/drivers/sensor/st/lsm6dsl/lsm6dsl_trigger.c index 989d322678e71bb..a770f7d7d9d81aa 100644 --- a/drivers/sensor/st/lsm6dsl/lsm6dsl_trigger.c +++ b/drivers/sensor/st/lsm6dsl/lsm6dsl_trigger.c @@ -74,7 +74,7 @@ int lsm6dsl_trigger_set(const struct device *dev, } static void lsm6dsl_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lsm6dsl_data *drv_data = CONTAINER_OF(cb, struct lsm6dsl_data, gpio_cb); @@ -135,7 +135,7 @@ int lsm6dsl_init_interrupt(const struct device *dev) gpio_pin_configure_dt(&config->int_gpio, GPIO_INPUT); gpio_init_callback(&drv_data->gpio_cb, - lsm6dsl_gpio_callback, BIT(config->int_gpio.pin)); + lsm6dsl_gpio_callback, GPIO_BIT(config->int_gpio.pin)); if (gpio_add_callback(config->int_gpio.port, &drv_data->gpio_cb) < 0) { LOG_ERR("Could not set gpio callback."); diff --git a/drivers/sensor/st/lsm6dso/lsm6dso_trigger.c b/drivers/sensor/st/lsm6dso/lsm6dso_trigger.c index 7c7a3c13f938179..faaac470400d0bb 100644 --- a/drivers/sensor/st/lsm6dso/lsm6dso_trigger.c +++ b/drivers/sensor/st/lsm6dso/lsm6dso_trigger.c @@ -211,7 +211,7 @@ static void lsm6dso_handle_interrupt(const struct device *dev) } static void lsm6dso_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lsm6dso_data *lsm6dso = CONTAINER_OF(cb, struct lsm6dso_data, gpio_cb); @@ -287,7 +287,7 @@ int lsm6dso_init_interrupt(const struct device *dev) gpio_init_callback(&lsm6dso->gpio_cb, lsm6dso_gpio_callback, - BIT(cfg->gpio_drdy.pin)); + GPIO_BIT(cfg->gpio_drdy.pin)); if (gpio_add_callback(cfg->gpio_drdy.port, &lsm6dso->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback"); diff --git a/drivers/sensor/st/lsm6dso16is/lsm6dso16is_trigger.c b/drivers/sensor/st/lsm6dso16is/lsm6dso16is_trigger.c index 93ce4f6c0b0c0bb..a85819efffb6953 100644 --- a/drivers/sensor/st/lsm6dso16is/lsm6dso16is_trigger.c +++ b/drivers/sensor/st/lsm6dso16is/lsm6dso16is_trigger.c @@ -238,7 +238,7 @@ static void lsm6dso16is_handle_interrupt(const struct device *dev) } static void lsm6dso16is_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lsm6dso16is_data *lsm6dso16is = CONTAINER_OF(cb, struct lsm6dso16is_data, gpio_cb); @@ -314,7 +314,7 @@ int lsm6dso16is_init_interrupt(const struct device *dev) gpio_init_callback(&lsm6dso16is->gpio_cb, lsm6dso16is_gpio_callback, - BIT(cfg->gpio_drdy.pin)); + GPIO_BIT(cfg->gpio_drdy.pin)); if (gpio_add_callback(cfg->gpio_drdy.port, &lsm6dso16is->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback"); diff --git a/drivers/sensor/st/lsm6dsv16x/lsm6dsv16x_trigger.c b/drivers/sensor/st/lsm6dsv16x/lsm6dsv16x_trigger.c index 52bd7d6c0dd0452..1a2dc5ff792fd36 100644 --- a/drivers/sensor/st/lsm6dsv16x/lsm6dsv16x_trigger.c +++ b/drivers/sensor/st/lsm6dsv16x/lsm6dsv16x_trigger.c @@ -183,7 +183,7 @@ static void lsm6dsv16x_handle_interrupt(const struct device *dev) } static void lsm6dsv16x_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lsm6dsv16x_data *lsm6dsv16x = CONTAINER_OF(cb, struct lsm6dsv16x_data, gpio_cb); @@ -262,7 +262,7 @@ int lsm6dsv16x_init_interrupt(const struct device *dev) gpio_init_callback(&lsm6dsv16x->gpio_cb, lsm6dsv16x_gpio_callback, - BIT(lsm6dsv16x->drdy_gpio->pin)); + GPIO_BIT(lsm6dsv16x->drdy_gpio->pin)); if (gpio_add_callback(lsm6dsv16x->drdy_gpio->port, &lsm6dsv16x->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback"); diff --git a/drivers/sensor/st/lsm9ds0_gyro/lsm9ds0_gyro_trigger.c b/drivers/sensor/st/lsm9ds0_gyro/lsm9ds0_gyro_trigger.c index 08441deff791d57..4a6a740715276ca 100644 --- a/drivers/sensor/st/lsm9ds0_gyro/lsm9ds0_gyro_trigger.c +++ b/drivers/sensor/st/lsm9ds0_gyro/lsm9ds0_gyro_trigger.c @@ -70,7 +70,7 @@ int lsm9ds0_gyro_trigger_set(const struct device *dev, } static void lsm9ds0_gyro_gpio_drdy_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct lsm9ds0_gyro_data *data = CONTAINER_OF(cb, struct lsm9ds0_gyro_data, gpio_cb); @@ -122,7 +122,7 @@ int lsm9ds0_gyro_init_interrupt(const struct device *dev) gpio_init_callback(&data->gpio_cb, lsm9ds0_gyro_gpio_drdy_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); if (gpio_add_callback(config->int_gpio.port, &data->gpio_cb) < 0) { LOG_DBG("failed to set gpio callback"); diff --git a/drivers/sensor/st/stts22h/stts22h_trigger.c b/drivers/sensor/st/stts22h/stts22h_trigger.c index 05a7a48d7268cf2..159b5d1fb0417c5 100644 --- a/drivers/sensor/st/stts22h/stts22h_trigger.c +++ b/drivers/sensor/st/stts22h/stts22h_trigger.c @@ -67,7 +67,7 @@ static void stts22h_handle_interrupt(const struct device *dev) } static void stts22h_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct stts22h_data *stts22h = CONTAINER_OF(cb, struct stts22h_data, gpio_cb); @@ -140,7 +140,7 @@ int stts22h_init_interrupt(const struct device *dev) return ret; } - gpio_init_callback(&stts22h->gpio_cb, stts22h_gpio_callback, BIT(cfg->int_gpio.pin)); + gpio_init_callback(&stts22h->gpio_cb, stts22h_gpio_callback, GPIO_BIT(cfg->int_gpio.pin)); if (gpio_add_callback(cfg->int_gpio.port, &stts22h->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback"); diff --git a/drivers/sensor/st/stts751/stts751_trigger.c b/drivers/sensor/st/stts751/stts751_trigger.c index 5d827d4f1b142a5..d1dd0792c398b50 100644 --- a/drivers/sensor/st/stts751/stts751_trigger.c +++ b/drivers/sensor/st/stts751/stts751_trigger.c @@ -78,7 +78,7 @@ static void stts751_handle_interrupt(const struct device *dev) } static void stts751_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct stts751_data *stts751 = CONTAINER_OF(cb, struct stts751_data, gpio_cb); @@ -149,7 +149,7 @@ int stts751_init_interrupt(const struct device *dev) return ret; } - gpio_init_callback(&stts751->gpio_cb, stts751_gpio_callback, BIT(cfg->int_gpio.pin)); + gpio_init_callback(&stts751->gpio_cb, stts751_gpio_callback, GPIO_BIT(cfg->int_gpio.pin)); if (gpio_add_callback(cfg->int_gpio.port, &stts751->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback"); diff --git a/drivers/sensor/st/vl53l1x/vl53l1.c b/drivers/sensor/st/vl53l1x/vl53l1.c index 24226024663724b..b81365ba868edcb 100644 --- a/drivers/sensor/st/vl53l1x/vl53l1.c +++ b/drivers/sensor/st/vl53l1x/vl53l1.c @@ -74,7 +74,7 @@ static void vl53l1x_worker(struct k_work *work) } static void vl53l1x_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct vl53l1x_data *drv_data = CONTAINER_OF(cb, struct vl53l1x_data, gpio_cb); @@ -102,7 +102,7 @@ static int vl53l1x_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, vl53l1x_gpio_callback, - BIT(config->gpio1.pin)); + GPIO_BIT(config->gpio1.pin)); ret = gpio_add_callback(config->gpio1.port, &drv_data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/sx9500/sx9500_trigger.c b/drivers/sensor/sx9500/sx9500_trigger.c index 146e6753ef94a7f..e07f0d3d3515cab 100644 --- a/drivers/sensor/sx9500/sx9500_trigger.c +++ b/drivers/sensor/sx9500/sx9500_trigger.c @@ -114,7 +114,7 @@ static void sx9500_thread_main(void *p1, void *p2, void *p3) #else /* CONFIG_SX9500_TRIGGER_GLOBAL_THREAD */ static void sx9500_gpio_cb(const struct device *port, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct sx9500_data *data = CONTAINER_OF(cb, struct sx9500_data, gpio_cb); @@ -160,7 +160,7 @@ int sx9500_setup_interrupt(const struct device *dev) return ret; } - gpio_init_callback(&data->gpio_cb, sx9500_gpio_cb, BIT(cfg->int_gpio.pin)); + gpio_init_callback(&data->gpio_cb, sx9500_gpio_cb, GPIO_BIT(cfg->int_gpio.pin)); ret = gpio_add_callback(cfg->int_gpio.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/tdk/icm42605/icm42605_trigger.c b/drivers/sensor/tdk/icm42605/icm42605_trigger.c index 90ce5aca8b62f57..4d7c4f328e75a0a 100644 --- a/drivers/sensor/tdk/icm42605/icm42605_trigger.c +++ b/drivers/sensor/tdk/icm42605/icm42605_trigger.c @@ -58,7 +58,7 @@ int icm42605_trigger_set(const struct device *dev, } static void icm42605_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct icm42605_data *drv_data = CONTAINER_OF(cb, struct icm42605_data, gpio_cb); @@ -116,7 +116,7 @@ int icm42605_init_interrupt(const struct device *dev) drv_data->dev = dev; gpio_pin_configure_dt(&cfg->gpio_int, GPIO_INPUT); - gpio_init_callback(&drv_data->gpio_cb, icm42605_gpio_callback, BIT(cfg->gpio_int.pin)); + gpio_init_callback(&drv_data->gpio_cb, icm42605_gpio_callback, GPIO_BIT(cfg->gpio_int.pin)); result = gpio_add_callback(cfg->gpio_int.port, &drv_data->gpio_cb); if (result < 0) { diff --git a/drivers/sensor/tdk/icm42670/icm42670_trigger.c b/drivers/sensor/tdk/icm42670/icm42670_trigger.c index 3d84d884e8049d5..06de70e4402e8f6 100644 --- a/drivers/sensor/tdk/icm42670/icm42670_trigger.c +++ b/drivers/sensor/tdk/icm42670/icm42670_trigger.c @@ -16,7 +16,7 @@ LOG_MODULE_DECLARE(ICM42670, CONFIG_SENSOR_LOG_LEVEL); static void icm42670_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -120,7 +120,7 @@ int icm42670_trigger_init(const struct device *dev) data->dev = dev; gpio_pin_configure_dt(&cfg->gpio_int, GPIO_INPUT); - gpio_init_callback(&data->gpio_cb, icm42670_gpio_callback, BIT(cfg->gpio_int.pin)); + gpio_init_callback(&data->gpio_cb, icm42670_gpio_callback, GPIO_BIT(cfg->gpio_int.pin)); res = gpio_add_callback(cfg->gpio_int.port, &data->gpio_cb); if (res < 0) { diff --git a/drivers/sensor/tdk/icm42688/icm42688_trigger.c b/drivers/sensor/tdk/icm42688/icm42688_trigger.c index 72ccd7e9059e4c2..b96223e8e2246a0 100644 --- a/drivers/sensor/tdk/icm42688/icm42688_trigger.c +++ b/drivers/sensor/tdk/icm42688/icm42688_trigger.c @@ -19,7 +19,7 @@ LOG_MODULE_DECLARE(ICM42688, CONFIG_SENSOR_LOG_LEVEL); static void icm42688_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct icm42688_dev_data *data = CONTAINER_OF(cb, struct icm42688_dev_data, gpio_cb); @@ -130,7 +130,7 @@ int icm42688_trigger_init(const struct device *dev) data->dev = dev; gpio_pin_configure_dt(&cfg->gpio_int1, GPIO_INPUT); - gpio_init_callback(&data->gpio_cb, icm42688_gpio_callback, BIT(cfg->gpio_int1.pin)); + gpio_init_callback(&data->gpio_cb, icm42688_gpio_callback, GPIO_BIT(cfg->gpio_int1.pin)); res = gpio_add_callback(cfg->gpio_int1.port, &data->gpio_cb); if (res < 0) { diff --git a/drivers/sensor/tdk/mpu6050/mpu6050_trigger.c b/drivers/sensor/tdk/mpu6050/mpu6050_trigger.c index 69d45ea01829956..4818d8b27c1f0ef 100644 --- a/drivers/sensor/tdk/mpu6050/mpu6050_trigger.c +++ b/drivers/sensor/tdk/mpu6050/mpu6050_trigger.c @@ -45,7 +45,7 @@ int mpu6050_trigger_set(const struct device *dev, } static void mpu6050_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct mpu6050_data *drv_data = CONTAINER_OF(cb, struct mpu6050_data, gpio_cb); @@ -117,7 +117,7 @@ int mpu6050_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, mpu6050_gpio_callback, - BIT(cfg->int_gpio.pin)); + GPIO_BIT(cfg->int_gpio.pin)); if (gpio_add_callback(cfg->int_gpio.port, &drv_data->gpio_cb) < 0) { LOG_ERR("Failed to set gpio callback"); diff --git a/drivers/sensor/tdk/mpu9250/mpu9250_trigger.c b/drivers/sensor/tdk/mpu9250/mpu9250_trigger.c index 5619bfb50dc554d..ec132450a20a550 100644 --- a/drivers/sensor/tdk/mpu9250/mpu9250_trigger.c +++ b/drivers/sensor/tdk/mpu9250/mpu9250_trigger.c @@ -52,7 +52,7 @@ int mpu9250_trigger_set(const struct device *dev, } static void mpu9250_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct mpu9250_data *drv_data = CONTAINER_OF(cb, struct mpu9250_data, gpio_cb); @@ -140,7 +140,7 @@ int mpu9250_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, mpu9250_gpio_callback, - BIT(cfg->int_pin.pin)); + GPIO_BIT(cfg->int_pin.pin)); ret = gpio_add_callback(cfg->int_pin.port, &drv_data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/ti/bq274xx/bq274xx_trigger.c b/drivers/sensor/ti/bq274xx/bq274xx_trigger.c index 40f20e8b955853a..545c4b72a003a31 100644 --- a/drivers/sensor/ti/bq274xx/bq274xx_trigger.c +++ b/drivers/sensor/ti/bq274xx/bq274xx_trigger.c @@ -99,7 +99,7 @@ int bq274xx_trigger_mode_init(const struct device *dev) } gpio_init_callback(&data->ready_callback, bq274xx_ready_callback_handler, - BIT(config->int_gpios.pin)); + GPIO_BIT(config->int_gpios.pin)); return 0; } diff --git a/drivers/sensor/ti/fdc2x1x/fdc2x1x_trigger.c b/drivers/sensor/ti/fdc2x1x/fdc2x1x_trigger.c index 519d5af0d61e2a5..af4a546367b43fc 100644 --- a/drivers/sensor/ti/fdc2x1x/fdc2x1x_trigger.c +++ b/drivers/sensor/ti/fdc2x1x/fdc2x1x_trigger.c @@ -47,7 +47,7 @@ static void fdc2x1x_thread_cb(const struct device *dev) } static void fdc2x1x_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct fdc2x1x_data *drv_data = CONTAINER_OF(cb, struct fdc2x1x_data, gpio_cb); @@ -149,7 +149,7 @@ int fdc2x1x_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, fdc2x1x_gpio_callback, - BIT(cfg->intb_gpio.pin)); + GPIO_BIT(cfg->intb_gpio.pin)); if (gpio_add_callback(cfg->intb_gpio.port, &drv_data->gpio_cb) < 0) { LOG_ERR("Failed to set gpio callback!"); diff --git a/drivers/sensor/ti/ina23x/ina230_trigger.c b/drivers/sensor/ti/ina23x/ina230_trigger.c index f449b1cbc2d3dc6..20a81097704a2d6 100644 --- a/drivers/sensor/ti/ina23x/ina230_trigger.c +++ b/drivers/sensor/ti/ina23x/ina230_trigger.c @@ -14,7 +14,7 @@ LOG_MODULE_DECLARE(INA230, CONFIG_SENSOR_LOG_LEVEL); static void ina230_gpio_callback(const struct device *port, - struct gpio_callback *cb, uint32_t pin) + struct gpio_callback *cb, gpio_port_pins_t pin) { struct ina230_data *ina230 = CONTAINER_OF(cb, struct ina230_data, gpio_cb); const struct device *dev = (const struct device *)ina230->dev; @@ -64,7 +64,7 @@ int ina230_trigger_mode_init(const struct device *dev) gpio_init_callback(&ina230->gpio_cb, ina230_gpio_callback, - BIT(config->alert_gpio.pin)); + GPIO_BIT(config->alert_gpio.pin)); ret = gpio_add_callback(config->alert_gpio.port, &ina230->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/ti/ina23x/ina23x_trigger.c b/drivers/sensor/ti/ina23x/ina23x_trigger.c index 0e9eb9fed11297e..12d28e293ea5ef8 100644 --- a/drivers/sensor/ti/ina23x/ina23x_trigger.c +++ b/drivers/sensor/ti/ina23x/ina23x_trigger.c @@ -11,7 +11,7 @@ LOG_MODULE_REGISTER(INA23X_TRIGGER, CONFIG_SENSOR_LOG_LEVEL); static void ina23x_gpio_callback(const struct device *port, - struct gpio_callback *cb, uint32_t pin) + struct gpio_callback *cb, gpio_port_pins_t pin) { ARG_UNUSED(pin); @@ -37,7 +37,7 @@ int ina23x_trigger_mode_init(struct ina23x_trigger *trigg, const struct gpio_dt_ gpio_init_callback(&trigg->gpio_cb, ina23x_gpio_callback, - BIT(alert_gpio->pin)); + GPIO_BIT(alert_gpio->pin)); ret = gpio_add_callback(alert_gpio->port, &trigg->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/ti/ti_hdc/ti_hdc.c b/drivers/sensor/ti/ti_hdc/ti_hdc.c index 688d56e3691aba6..e37868a50b05b15 100644 --- a/drivers/sensor/ti/ti_hdc/ti_hdc.c +++ b/drivers/sensor/ti/ti_hdc/ti_hdc.c @@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(TI_HDC, CONFIG_SENSOR_LOG_LEVEL); static void ti_hdc_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct ti_hdc_data *drv_data = CONTAINER_OF(cb, struct ti_hdc_data, gpio_cb); @@ -152,7 +152,7 @@ static int ti_hdc_init(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, ti_hdc_gpio_callback, - BIT(cfg->drdy.pin)); + GPIO_BIT(cfg->drdy.pin)); if (gpio_add_callback(cfg->drdy.port, &drv_data->gpio_cb) < 0) { LOG_DBG("Failed to set GPIO callback"); diff --git a/drivers/sensor/ti/ti_hdc20xx/ti_hdc20xx.c b/drivers/sensor/ti/ti_hdc20xx/ti_hdc20xx.c index f79a2225205756b..d9baa0234decfc2 100644 --- a/drivers/sensor/ti/ti_hdc20xx/ti_hdc20xx.c +++ b/drivers/sensor/ti/ti_hdc20xx/ti_hdc20xx.c @@ -57,7 +57,7 @@ struct ti_hdc20xx_data { }; static void ti_hdc20xx_int_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct ti_hdc20xx_data *data = CONTAINER_OF(cb, struct ti_hdc20xx_data, cb_int); @@ -204,7 +204,7 @@ static int ti_hdc20xx_init(const struct device *dev) } gpio_init_callback(&data->cb_int, ti_hdc20xx_int_callback, - BIT(config->gpio_int.pin)); + GPIO_BIT(config->gpio_int.pin)); rc = gpio_add_callback(config->gpio_int.port, &data->cb_int); if (rc) { diff --git a/drivers/sensor/ti/tmag5170/tmag5170_trigger.c b/drivers/sensor/ti/tmag5170/tmag5170_trigger.c index c1be9cd4e1f9a97..32cfbf6cc66ea3c 100644 --- a/drivers/sensor/ti/tmag5170/tmag5170_trigger.c +++ b/drivers/sensor/ti/tmag5170/tmag5170_trigger.c @@ -54,7 +54,7 @@ static void tmag5170_work_handler(struct k_work *work) static void tmag5170_gpio_callback(const struct device *port, struct gpio_callback *cb, - uint32_t pin) + gpio_port_pins_t pin) { struct tmag5170_data *data = CONTAINER_OF(cb, struct tmag5170_data, @@ -133,7 +133,7 @@ int tmag5170_trigger_init(const struct device *dev) return ret; } - gpio_init_callback(&data->gpio_cb, tmag5170_gpio_callback, BIT(cfg->int_gpio.pin)); + gpio_init_callback(&data->gpio_cb, tmag5170_gpio_callback, GPIO_BIT(cfg->int_gpio.pin)); ret = gpio_add_callback(cfg->int_gpio.port, &data->gpio_cb); if (ret < 0) { diff --git a/drivers/sensor/ti/tmp007/tmp007_trigger.c b/drivers/sensor/ti/tmp007/tmp007_trigger.c index a3eb0b073033761..378fa6d62262a66 100644 --- a/drivers/sensor/ti/tmp007/tmp007_trigger.c +++ b/drivers/sensor/ti/tmp007/tmp007_trigger.c @@ -67,7 +67,7 @@ int tmp007_attr_set(const struct device *dev, } static void tmp007_gpio_callback(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { struct tmp007_data *drv_data = CONTAINER_OF(cb, struct tmp007_data, gpio_cb); @@ -178,7 +178,7 @@ int tmp007_init_interrupt(const struct device *dev) gpio_init_callback(&drv_data->gpio_cb, tmp007_gpio_callback, - BIT(cfg->int_gpio.pin)); + GPIO_BIT(cfg->int_gpio.pin)); if (gpio_add_callback(cfg->int_gpio.port, &drv_data->gpio_cb) < 0) { LOG_DBG("Failed to set gpio callback!"); diff --git a/drivers/sensor/ti/tmp108/tmp108.c b/drivers/sensor/ti/tmp108/tmp108.c index 70dc1e8b5bdbf80..7db296ebb43ca0b 100644 --- a/drivers/sensor/ti/tmp108/tmp108.c +++ b/drivers/sensor/ti/tmp108/tmp108.c @@ -339,7 +339,7 @@ static int setup_interrupts(const struct device *dev) gpio_init_callback(&drv_data->temp_alert_gpio_cb, tmp108_trigger_handle_alert, - BIT(alert_gpio->pin)); + GPIO_BIT(alert_gpio->pin)); result = gpio_add_callback(alert_gpio->port, &drv_data->temp_alert_gpio_cb); diff --git a/drivers/sensor/vishay/vcnl4040/vcnl4040_trigger.c b/drivers/sensor/vishay/vcnl4040/vcnl4040_trigger.c index f2680b0b8befe89..f4065505d1d34c5 100644 --- a/drivers/sensor/vishay/vcnl4040/vcnl4040_trigger.c +++ b/drivers/sensor/vishay/vcnl4040/vcnl4040_trigger.c @@ -24,7 +24,7 @@ static void vcnl4040_handle_cb(struct vcnl4040_data *data) static void vcnl4040_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pin_mask) + gpio_port_pins_t pin_mask) { struct vcnl4040_data *data = CONTAINER_OF(cb, struct vcnl4040_data, gpio_cb); @@ -283,7 +283,7 @@ int vcnl4040_trigger_init(const struct device *dev) gpio_pin_configure_dt(&config->int_gpio, GPIO_INPUT); gpio_init_callback(&data->gpio_cb, vcnl4040_gpio_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); if (gpio_add_callback(config->int_gpio.port, &data->gpio_cb) < 0) { LOG_ERR("Failed to set gpio callback"); diff --git a/drivers/sensor/wsen/wsen_hids/wsen_hids_trigger.c b/drivers/sensor/wsen/wsen_hids/wsen_hids_trigger.c new file mode 100644 index 000000000000000..7e582241b62a4d2 --- /dev/null +++ b/drivers/sensor/wsen/wsen_hids/wsen_hids_trigger.c @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT we_wsen_hids + +#include + +#include "wsen_hids.h" + +LOG_MODULE_DECLARE(WSEN_HIDS, CONFIG_SENSOR_LOG_LEVEL); + +static inline void hids_setup_drdy_interrupt(const struct device *dev, bool enable) +{ + const struct hids_config *cfg = dev->config; + unsigned int flags = enable ? GPIO_INT_EDGE_TO_ACTIVE : GPIO_INT_DISABLE; + + gpio_pin_interrupt_configure_dt(&cfg->gpio_drdy, flags); +} + +static inline void hids_handle_drdy_interrupt(const struct device *dev) +{ + struct hids_data *data = dev->data; + + hids_setup_drdy_interrupt(dev, false); + +#if defined(CONFIG_WSEN_HIDS_TRIGGER_OWN_THREAD) + k_sem_give(&data->drdy_sem); +#elif defined(CONFIG_WSEN_HIDS_TRIGGER_GLOBAL_THREAD) + k_work_submit(&data->work); +#endif +} + +static void hids_process_drdy_interrupt(const struct device *dev) +{ + struct hids_data *data = dev->data; + + if (data->data_ready_handler != NULL) { + data->data_ready_handler(dev, data->data_ready_trigger); + } + + if (data->data_ready_handler != NULL) { + hids_setup_drdy_interrupt(dev, true); + } +} + +int hids_trigger_set(const struct device *dev, const struct sensor_trigger *trig, + sensor_trigger_handler_t handler) +{ + struct hids_data *data = dev->data; + const struct hids_config *cfg = dev->config; + + if (trig->type != SENSOR_TRIG_DATA_READY) { + LOG_ERR("Unsupported sensor trigger"); + return -ENOTSUP; + } + + hids_setup_drdy_interrupt(dev, false); + + data->data_ready_handler = handler; + if (handler == NULL) { + return 0; + } + + data->data_ready_trigger = trig; + + hids_setup_drdy_interrupt(dev, true); + + /* + * If DRDY is active we probably won't get the rising edge, so + * invoke the callback manually. + */ + if (gpio_pin_get_dt(&cfg->gpio_drdy) > 0) { + hids_handle_drdy_interrupt(dev); + } + + return 0; +} + +static void hids_drdy_callback(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) +{ + struct hids_data *data = CONTAINER_OF(cb, struct hids_data, data_ready_cb); + + ARG_UNUSED(pins); + + hids_handle_drdy_interrupt(data->dev); +} + +#ifdef CONFIG_WSEN_HIDS_TRIGGER_OWN_THREAD +static void hids_thread(void *p1, void *p2, void *p3) +{ + ARG_UNUSED(p2); + ARG_UNUSED(p3); + + struct hids_data *data = p1; + + while (true) { + k_sem_take(&data->drdy_sem, K_FOREVER); + hids_process_drdy_interrupt(data->dev); + } +} +#endif /* CONFIG_WSEN_HIDS_TRIGGER_OWN_THREAD */ + +#ifdef CONFIG_WSEN_HIDS_TRIGGER_GLOBAL_THREAD +static void hids_work_cb(struct k_work *work) +{ + struct hids_data *data = CONTAINER_OF(work, struct hids_data, work); + + hids_process_drdy_interrupt(data->dev); +} +#endif /* CONFIG_WSEN_HIDS_TRIGGER_GLOBAL_THREAD */ + +int hids_init_interrupt(const struct device *dev) +{ + struct hids_data *data = dev->data; + const struct hids_config *cfg = dev->config; + int status; + + data->dev = dev; + + if (cfg->gpio_drdy.port == NULL) { + LOG_ERR("drdy-gpios is not defined in the device tree."); + return -EINVAL; + } + + if (!gpio_is_ready_dt(&cfg->gpio_drdy)) { + LOG_ERR("Device %s is not ready", cfg->gpio_drdy.port->name); + return -ENODEV; + } + + /* Setup data-ready gpio interrupt */ + status = gpio_pin_configure_dt(&cfg->gpio_drdy, GPIO_INPUT); + if (status < 0) { + LOG_ERR("Could not configure %s.%02u", cfg->gpio_drdy.port->name, + cfg->gpio_drdy.pin); + return status; + } + + gpio_init_callback(&data->data_ready_cb, hids_drdy_callback, GPIO_BIT(cfg->gpio_drdy.pin)); + + status = gpio_add_callback(cfg->gpio_drdy.port, &data->data_ready_cb); + if (status < 0) { + LOG_ERR("Could not set gpio callback."); + return status; + } + + /* Enable data-ready interrupt */ + if (HIDS_enableDataReadyInterrupt(&data->sensor_interface, HIDS_enable) != WE_SUCCESS) { + LOG_ERR("Could not enable data-ready interrupt."); + return -EIO; + } + +#if defined(CONFIG_WSEN_HIDS_TRIGGER_OWN_THREAD) + k_sem_init(&data->drdy_sem, 0, K_SEM_MAX_LIMIT); + + k_thread_create(&data->thread, data->thread_stack, CONFIG_WSEN_HIDS_THREAD_STACK_SIZE, + hids_thread, data, NULL, NULL, + K_PRIO_COOP(CONFIG_WSEN_HIDS_THREAD_PRIORITY), 0, K_NO_WAIT); +#elif defined(CONFIG_WSEN_HIDS_TRIGGER_GLOBAL_THREAD) + data->work.handler = hids_work_cb; +#endif + + hids_setup_drdy_interrupt(dev, true); + + return 0; +} diff --git a/drivers/sensor/wsen/wsen_itds/itds_trigger.c b/drivers/sensor/wsen/wsen_itds/itds_trigger.c new file mode 100644 index 000000000000000..41e3c66c67dcba0 --- /dev/null +++ b/drivers/sensor/wsen/wsen_itds/itds_trigger.c @@ -0,0 +1,130 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Würth Elektronic WSEN-ITDS 3-axis accel sensor driver + * + * Copyright (c) 2020 Linumiz + * Author: Saravanan Sekar + */ + +#include +#include +#include +#include + +#include "itds.h" +LOG_MODULE_DECLARE(ITDS, CONFIG_SENSOR_LOG_LEVEL); + +static int itds_trigger_drdy_set(const struct device *dev, + enum sensor_channel chan, + const struct sensor_trigger *trig, + sensor_trigger_handler_t handler) +{ + struct itds_device_data *ddata = dev->data; + const struct itds_device_config *cfg = dev->config; + uint8_t drdy_en = 0U; + int ret; + + ddata->handler_drdy = handler; + ddata->trigger_drdy = trig; + if (ddata->handler_drdy) { + drdy_en = ITDS_MASK_INT_DRDY; + } + + ret = i2c_reg_update_byte_dt(&cfg->i2c, ITDS_REG_CTRL4, + ITDS_MASK_INT_DRDY, drdy_en); + if (ret) { + return ret; + } + + return 0; +} + +int itds_trigger_set(const struct device *dev, + const struct sensor_trigger *trig, + sensor_trigger_handler_t handler) +{ + const struct itds_device_config *cfg = dev->config; + + if (!cfg->int_gpio.port) { + return -ENOTSUP; + } + + if (trig->chan != SENSOR_CHAN_ACCEL_XYZ) { + return -ENOTSUP; + } + + switch (trig->type) { + case SENSOR_TRIG_DATA_READY: + return itds_trigger_drdy_set(dev, trig->chan, trig, handler); + + default: + return -ENOTSUP; + } +} + +static void itds_work_handler(struct k_work *work) +{ + struct itds_device_data *ddata = + CONTAINER_OF(work, struct itds_device_data, work); + const struct device *dev = (const struct device *)ddata->dev; + const struct itds_device_config *cfg = dev->config; + uint8_t status; + + if (i2c_reg_read_byte_dt(&cfg->i2c, ITDS_REG_STATUS, + &status) < 0) { + return; + } + + if (status & ITDS_EVENT_DRDY) { + if (ddata->handler_drdy) { + ddata->handler_drdy(dev, ddata->trigger_drdy); + } + } +} + +static void itds_gpio_callback(const struct device *port, + struct gpio_callback *cb, gpio_port_pins_t pin) +{ + struct itds_device_data *ddata = + CONTAINER_OF(cb, struct itds_device_data, gpio_cb); + + ARG_UNUSED(port); + ARG_UNUSED(pin); + + k_work_submit(&ddata->work); +} + +int itds_trigger_mode_init(const struct device *dev) +{ + struct itds_device_data *ddata = dev->data; + const struct itds_device_config *cfg = dev->config; + + /* dts doesn't have GPIO int pin set, so we dont support + * trigger mode for this instance + */ + if (!cfg->int_gpio.port) { + return 0; + } + + if (!gpio_is_ready_dt(&cfg->int_gpio)) { + LOG_ERR("%s: device %s is not ready", dev->name, + cfg->int_gpio.port->name); + return -ENODEV; + } + + ddata->work.handler = itds_work_handler; + ddata->dev = dev; + + gpio_pin_configure_dt(&cfg->int_gpio, GPIO_INPUT); + + gpio_init_callback(&ddata->gpio_cb, itds_gpio_callback, + GPIO_BIT(cfg->int_gpio.pin)); + + gpio_add_callback(cfg->int_gpio.port, &ddata->gpio_cb); + gpio_pin_interrupt_configure_dt(&cfg->int_gpio, GPIO_INT_EDGE_TO_ACTIVE); + + /* enable global interrupt */ + return i2c_reg_update_byte_dt(&cfg->i2c, ITDS_REG_CTRL7, + ITDS_MASK_INT_EN, ITDS_MASK_INT_EN); +} diff --git a/drivers/sensor/wsen/wsen_pads/wsen_pads_trigger.c b/drivers/sensor/wsen/wsen_pads/wsen_pads_trigger.c new file mode 100644 index 000000000000000..16b28bf6f8ec5b1 --- /dev/null +++ b/drivers/sensor/wsen/wsen_pads/wsen_pads_trigger.c @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT we_wsen_pads + +#include + +#include "wsen_pads.h" + +LOG_MODULE_DECLARE(WSEN_PADS, CONFIG_SENSOR_LOG_LEVEL); + +/* Enable/disable data-ready interrupt handling */ +static inline int pads_setup_drdy_interrupt(const struct device *dev, bool enable) +{ + const struct pads_config *cfg = dev->config; + unsigned int flags = enable ? GPIO_INT_EDGE_TO_ACTIVE : GPIO_INT_DISABLE; + + return gpio_pin_interrupt_configure_dt(&cfg->gpio_drdy, flags); +} + +/* + * Is called when a data-ready interrupt has occurred. Triggers + * asynchronous processing of the interrupt in pads_process_drdy_interrupt(). + */ +static inline void pads_handle_drdy_interrupt(const struct device *dev) +{ + struct pads_data *data = dev->data; + + /* Disable interrupt handling until the interrupt has been processed */ + pads_setup_drdy_interrupt(dev, false); + +#if defined(CONFIG_WSEN_PADS_TRIGGER_OWN_THREAD) + k_sem_give(&data->drdy_sem); +#elif defined(CONFIG_WSEN_PADS_TRIGGER_GLOBAL_THREAD) + k_work_submit(&data->work); +#endif +} + +/* Calls data-ready trigger handler (if any) */ +static void pads_process_drdy_interrupt(const struct device *dev) +{ + struct pads_data *data = dev->data; + + if (data->data_ready_handler != NULL) { + data->data_ready_handler(dev, data->data_ready_triggerP); + pads_setup_drdy_interrupt(dev, true); + } +} + +int pads_trigger_set(const struct device *dev, const struct sensor_trigger *trig, + sensor_trigger_handler_t handler) +{ + struct pads_data *data = dev->data; + const struct pads_config *cfg = dev->config; + int32_t pressure_dummy; + + if (trig->type != SENSOR_TRIG_DATA_READY) { + LOG_ERR("Unsupported sensor trigger"); + return -ENOTSUP; + } + + pads_setup_drdy_interrupt(dev, false); + + data->data_ready_handler = handler; + if (handler == NULL) { + /* Disable data-ready interrupt */ + if (PADS_enableDataReadyInterrupt(&data->sensor_interface, PADS_disable) != + WE_SUCCESS) { + LOG_ERR("Failed to disable data-ready interrupt."); + return -EIO; + } + return 0; + } + + data->data_ready_triggerP = trig; + + pads_setup_drdy_interrupt(dev, true); + + /* Read pressure to retrigger interrupt */ + if (PADS_getPressure_int(&data->sensor_interface, &pressure_dummy) != WE_SUCCESS) { + LOG_ERR("Failed to read sample"); + return -EIO; + } + + /* Enable data-ready interrupt */ + if (PADS_enableDataReadyInterrupt(&data->sensor_interface, PADS_enable) != WE_SUCCESS) { + LOG_ERR("Failed to enable data-ready interrupt."); + return -EIO; + } + + /* + * If data-ready is active we probably won't get the rising edge, so + * invoke the handler manually. + */ + if (gpio_pin_get_dt(&cfg->gpio_drdy) > 0) { + pads_handle_drdy_interrupt(dev); + } + + return 0; +} + +static void pads_drdy_callback(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) +{ + struct pads_data *data = CONTAINER_OF(cb, struct pads_data, data_ready_cb); + + ARG_UNUSED(pins); + + pads_handle_drdy_interrupt(data->dev); +} + +#ifdef CONFIG_WSEN_PADS_TRIGGER_OWN_THREAD +static void pads_thread(void *p1, void *p2, void *p3) +{ + ARG_UNUSED(p2); + ARG_UNUSED(p3); + + struct pads_data *data = p1; + + while (true) { + k_sem_take(&data->drdy_sem, K_FOREVER); + pads_process_drdy_interrupt(data->dev); + } +} +#endif /* CONFIG_WSEN_PADS_TRIGGER_OWN_THREAD */ + +#ifdef CONFIG_WSEN_PADS_TRIGGER_GLOBAL_THREAD +static void pads_work_cb(struct k_work *work) +{ + struct pads_data *data = CONTAINER_OF(work, struct pads_data, work); + + pads_process_drdy_interrupt(data->dev); +} +#endif /* CONFIG_WSEN_PADS_TRIGGER_GLOBAL_THREAD */ + +int pads_init_interrupt(const struct device *dev) +{ + struct pads_data *data = dev->data; + const struct pads_config *cfg = dev->config; + int status; + + data->dev = dev; + + if (cfg->gpio_drdy.port == NULL) { + LOG_ERR("drdy-gpios is not defined in the device tree."); + return -EINVAL; + } + + if (!gpio_is_ready_dt(&cfg->gpio_drdy)) { + LOG_ERR("Device %s is not ready", cfg->gpio_drdy.port->name); + return -ENODEV; + } + + /* Setup data-ready gpio interrupt */ + status = gpio_pin_configure_dt(&cfg->gpio_drdy, GPIO_INPUT); + if (status < 0) { + LOG_ERR("Failed to configure %s.%02u", cfg->gpio_drdy.port->name, + cfg->gpio_drdy.pin); + return status; + } + + gpio_init_callback(&data->data_ready_cb, pads_drdy_callback, GPIO_BIT(cfg->gpio_drdy.pin)); + + status = gpio_add_callback(cfg->gpio_drdy.port, &data->data_ready_cb); + if (status < 0) { + LOG_ERR("Failed to set gpio callback."); + return status; + } + +#if defined(CONFIG_WSEN_PADS_TRIGGER_OWN_THREAD) + k_sem_init(&data->drdy_sem, 0, K_SEM_MAX_LIMIT); + + k_thread_create(&data->thread, data->thread_stack, CONFIG_WSEN_PADS_THREAD_STACK_SIZE, + pads_thread, data, NULL, NULL, + K_PRIO_COOP(CONFIG_WSEN_PADS_THREAD_PRIORITY), 0, K_NO_WAIT); +#elif defined(CONFIG_WSEN_PADS_TRIGGER_GLOBAL_THREAD) + data->work.handler = pads_work_cb; +#endif + + return pads_setup_drdy_interrupt(dev, true); +} diff --git a/drivers/sensor/wsen/wsen_tids/wsen_tids_trigger.c b/drivers/sensor/wsen/wsen_tids/wsen_tids_trigger.c new file mode 100644 index 000000000000000..a5c55de7606d4f2 --- /dev/null +++ b/drivers/sensor/wsen/wsen_tids/wsen_tids_trigger.c @@ -0,0 +1,243 @@ +/* + * Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT we_wsen_tids + +#include + +#include + +#include "wsen_tids.h" + +LOG_MODULE_DECLARE(WSEN_TIDS, CONFIG_SENSOR_LOG_LEVEL); + +#define THRESHOLD_TEMPERATURE2REGISTER_OFFSET (double)63. +#define THRESHOLD_TEMPERATURE2REGISTER_STEP (double)0.64 + +/* Enable/disable threshold interrupt handling */ +static inline void tids_setup_threshold_interrupt(const struct device *dev, bool enable) +{ + const struct tids_config *cfg = dev->config; + unsigned int flags = enable ? GPIO_INT_EDGE_TO_ACTIVE : GPIO_INT_DISABLE; + + gpio_pin_interrupt_configure_dt(&cfg->gpio_threshold, flags); +} + +/* + * Is called when a "threshold exceeded" interrupt occurred. Triggers + * asynchronous processing of the interrupt in tids_process_threshold_interrupt(). + */ +static void tids_handle_threshold_interrupt(const struct device *dev) +{ + struct tids_data *data = dev->data; + + /* Disable interrupt handling until the interrupt has been processed */ + tids_setup_threshold_interrupt(dev, false); + +#if defined(CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD) + k_sem_give(&data->threshold_sem); +#elif defined(CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD) + k_work_submit(&data->work); +#endif +} + +/* + * Is called after a "threshold exceeded" interrupt occurred. + * Checks the sensor's status register for the limit exceeded flags and + * calls the trigger handler if one of the flags is set. + */ +static void tids_process_threshold_interrupt(const struct device *dev) +{ + struct tids_data *data = dev->data; + TIDS_status_t status; + + /* + * Read the sensor's status register - this also causes the interrupt pin + * to be de-asserted + */ + if (TIDS_getStatusRegister(&data->sensor_interface, &status) != WE_SUCCESS) { + LOG_ERR("Failed to read status register"); + return; + } + + if (data->threshold_handler != NULL && + (status.upperLimitExceeded != 0 || status.lowerLimitExceeded != 0)) { + data->threshold_handler(dev, data->threshold_trigger); + } + + if (data->threshold_handler != NULL) { + tids_setup_threshold_interrupt(dev, true); + } +} + +/* Enables/disables processing of the "threshold exceeded" interrupt. */ +int tids_trigger_set(const struct device *dev, const struct sensor_trigger *trig, + sensor_trigger_handler_t handler) +{ + struct tids_data *data = dev->data; + const struct tids_config *cfg = dev->config; + + if (trig->type != SENSOR_TRIG_THRESHOLD) { + LOG_ERR("Unsupported sensor trigger"); + return -ENOTSUP; + } + + tids_setup_threshold_interrupt(dev, false); + + data->threshold_handler = handler; + if (handler == NULL) { + return 0; + } + + data->threshold_trigger = trig; + + tids_setup_threshold_interrupt(dev, true); + + /* + * If threshold interrupt is active we probably won't get the rising edge, so + * invoke the callback manually. + */ + if (gpio_pin_get_dt(&cfg->gpio_threshold) > 0) { + tids_handle_threshold_interrupt(dev); + } + + return 0; +} + +static void tids_threshold_callback(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) +{ + struct tids_data *data = CONTAINER_OF(cb, struct tids_data, threshold_cb); + + ARG_UNUSED(pins); + + tids_handle_threshold_interrupt(data->dev); +} + +#ifdef CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD +static void tids_thread(void *p1, void *p2, void *p3) +{ + ARG_UNUSED(p2); + ARG_UNUSED(p3); + + struct tids_data *tids = p1; + + while (true) { + k_sem_take(&tids->threshold_sem, K_FOREVER); + tids_process_threshold_interrupt(tids->dev); + } +} +#endif /* CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD */ + +#ifdef CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD +static void tids_work_cb(struct k_work *work) +{ + struct tids_data *tids = CONTAINER_OF(work, struct tids_data, work); + + tids_process_threshold_interrupt(tids->dev); +} +#endif /* CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD */ + +int tids_threshold_set(const struct device *dev, const struct sensor_value *thresh_value, + bool upper) +{ + struct tids_data *data = dev->data; + double thresh = (sensor_value_to_double(thresh_value) / THRESHOLD_TEMPERATURE2REGISTER_STEP) + + THRESHOLD_TEMPERATURE2REGISTER_OFFSET; + + if (thresh < 0) { + thresh = 0; + } else if (thresh > 255) { + thresh = 255; + } + + if (upper) { + if (TIDS_setTempHighLimit(&data->sensor_interface, (uint8_t)thresh) != WE_SUCCESS) { + LOG_ERR("Failed to set high temperature threshold to %d.%d (%d).", + thresh_value->val1, abs(thresh_value->val2), (uint8_t)thresh); + return -EIO; + } + } else { + if (TIDS_setTempLowLimit(&data->sensor_interface, (uint8_t)thresh) != WE_SUCCESS) { + LOG_ERR("Failed to set low temperature threshold to %d.%d (%d).", + thresh_value->val1, abs(thresh_value->val2), (uint8_t)thresh); + return -EIO; + } + } + + return 0; +} + +int tids_init_interrupt(const struct device *dev) +{ + struct tids_data *data = dev->data; + const struct tids_config *cfg = dev->config; + int status; + struct sensor_value upper_limit; + struct sensor_value lower_limit; + + if (cfg->gpio_threshold.port == NULL) { + LOG_ERR("int-gpios is not defined in the device tree."); + return -EINVAL; + } + + if (!gpio_is_ready_dt(&cfg->gpio_threshold)) { + LOG_ERR("Device %s is not ready", cfg->gpio_threshold.port->name); + return -ENODEV; + } + + data->dev = dev; + + /* Setup threshold gpio interrupt */ + status = gpio_pin_configure_dt(&cfg->gpio_threshold, GPIO_INPUT); + if (status < 0) { + LOG_ERR("Failed to configure %s.%02u", cfg->gpio_threshold.port->name, + cfg->gpio_threshold.pin); + return status; + } + + gpio_init_callback(&data->threshold_cb, tids_threshold_callback, + GPIO_BIT(cfg->gpio_threshold.pin)); + + status = gpio_add_callback(cfg->gpio_threshold.port, &data->threshold_cb); + if (status < 0) { + LOG_ERR("Failed to set gpio callback."); + return status; + } + + /* + * Enable interrupt on high/low temperature (interrupt generation is enabled if at + * least one threshold is non-zero) + */ + upper_limit.val1 = cfg->high_threshold; + upper_limit.val2 = 0; + lower_limit.val1 = cfg->low_threshold; + lower_limit.val2 = 0; + + status = tids_threshold_set(dev, &upper_limit, true); + if (status < 0) { + return status; + } + + status = tids_threshold_set(dev, &lower_limit, false); + if (status < 0) { + return status; + } + +#if defined(CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD) + k_sem_init(&data->threshold_sem, 0, K_SEM_MAX_LIMIT); + + k_thread_create(&data->thread, data->thread_stack, CONFIG_WSEN_TIDS_THREAD_STACK_SIZE, + tids_thread, data, NULL, NULL, + K_PRIO_COOP(CONFIG_WSEN_TIDS_THREAD_PRIORITY), 0, K_NO_WAIT); +#elif defined(CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD) + data->work.handler = tids_work_cb; +#endif + + tids_setup_threshold_interrupt(dev, true); + + return 0; +} diff --git a/drivers/serial/uart_ite_it8xxx2.c b/drivers/serial/uart_ite_it8xxx2.c index edce029a901b911..7b141c5c2bb7727 100644 --- a/drivers/serial/uart_ite_it8xxx2.c +++ b/drivers/serial/uart_ite_it8xxx2.c @@ -45,7 +45,7 @@ enum uart_port_num { #ifdef CONFIG_PM_DEVICE void uart1_wui_isr(const struct device *gpio, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { /* Disable interrupts on UART1 RX pin to avoid repeated interrupts. */ (void)gpio_pin_interrupt_configure(gpio, (find_msb_set(pins) - 1), @@ -65,7 +65,7 @@ void uart1_wui_isr(const struct device *gpio, struct gpio_callback *cb, } void uart2_wui_isr(const struct device *gpio, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { /* Disable interrupts on UART2 RX pin to avoid repeated interrupts. */ (void)gpio_pin_interrupt_configure(gpio, (find_msb_set(pins) - 1), @@ -163,14 +163,14 @@ static int uart_it8xxx2_init(const struct device *dev) static struct gpio_callback uart1_wui_cb; gpio_init_callback(&uart1_wui_cb, uart1_wui_isr, - BIT(config->gpio_wui.pin)); + GPIO_BIT(config->gpio_wui.pin)); ret = gpio_add_callback(config->gpio_wui.port, &uart1_wui_cb); } else if (config->port == UART2) { static struct gpio_callback uart2_wui_cb; gpio_init_callback(&uart2_wui_cb, uart2_wui_isr, - BIT(config->gpio_wui.pin)); + GPIO_BIT(config->gpio_wui.pin)); ret = gpio_add_callback(config->gpio_wui.port, &uart2_wui_cb); } diff --git a/drivers/serial/uart_mchp_xec.c b/drivers/serial/uart_mchp_xec.c index 5b37d0aa7c8ebb0..884af7feb79a3f8 100644 --- a/drivers/serial/uart_mchp_xec.c +++ b/drivers/serial/uart_mchp_xec.c @@ -441,7 +441,7 @@ static int uart_xec_config_get(const struct device *dev, #ifdef CONFIG_PM_DEVICE static void uart_xec_wake_handler(const struct device *gpio, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { /* Disable interrupts on UART RX pin to avoid repeated interrupts. */ (void)gpio_pin_interrupt_configure(gpio, (find_msb_set(pins) - 1), @@ -534,7 +534,7 @@ static int uart_xec_init(const struct device *dev) static struct gpio_callback uart_xec_wake_cb; gpio_init_callback(&uart_xec_wake_cb, uart_xec_wake_handler, - BIT(dev_cfg->wakerx_gpio.pin)); + GPIO_BIT(dev_cfg->wakerx_gpio.pin)); ret = gpio_add_callback(dev_cfg->wakerx_gpio.port, &uart_xec_wake_cb); if (ret < 0) { diff --git a/drivers/serial/uart_smartbond.c b/drivers/serial/uart_smartbond.c index 6adb0650a5d4562..77724e6546a9214 100644 --- a/drivers/serial/uart_smartbond.c +++ b/drivers/serial/uart_smartbond.c @@ -331,7 +331,7 @@ static int uart_smartbond_config_get(const struct device *dev, #if CONFIG_PM_DEVICE static void uart_smartbond_wake_handler(const struct device *gpio, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct uart_smartbond_data *data = CONTAINER_OF(cb, struct uart_smartbond_data, rx_wake_cb); @@ -347,7 +347,7 @@ static void uart_smartbond_wake_handler(const struct device *gpio, struct gpio_c } static void uart_smartbond_dtr_handler(const struct device *gpio, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct uart_smartbond_data *data = CONTAINER_OF(cb, struct uart_smartbond_data, dtr_wake_cb); @@ -397,7 +397,7 @@ static int uart_smartbond_init(const struct device *dev) /* If DTR pin is configured, use it for power management */ if (config->dtr_gpio.port != NULL) { gpio_init_callback(&data->dtr_wake_cb, uart_smartbond_dtr_handler, - BIT(config->dtr_gpio.pin)); + GPIO_BIT(config->dtr_gpio.pin)); ret = gpio_add_callback(config->dtr_gpio.port, &data->dtr_wake_cb); if (ret == 0) { ret = gpio_pin_interrupt_configure_dt(&config->dtr_gpio, @@ -413,7 +413,7 @@ static int uart_smartbond_init(const struct device *dev) k_work_init_delayable(&data->rx_timeout_work, uart_smartbond_rx_refresh_timeout); gpio_init_callback(&data->rx_wake_cb, uart_smartbond_wake_handler, - BIT(config->rx_wake_gpio.pin)); + GPIO_BIT(config->rx_wake_gpio.pin)); ret = gpio_add_callback(config->rx_wake_gpio.port, &data->rx_wake_cb); if (ret == 0) { diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index 9a5fc3a0e67301a..9bb8dbff07cdbf0 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -136,7 +136,7 @@ static int prepare_for_transfer(const struct device *dev, } static void wake_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct spi_nrfx_data *dev_data = CONTAINER_OF(cb, struct spi_nrfx_data, wake_cb_data); @@ -326,7 +326,7 @@ static int spi_nrfx_init(const struct device *dev) } gpio_init_callback(&dev_data->wake_cb_data, wake_callback, - BIT(dev_config->wake_gpio.pin)); + GPIO_BIT(dev_config->wake_gpio.pin)); err = gpio_add_callback(dev_config->wake_gpio.port, &dev_data->wake_cb_data); if (err < 0) { diff --git a/drivers/usb/bc12/bc12_pi3usb9201.c b/drivers/usb/bc12/bc12_pi3usb9201.c index 8ca53b20c8a4172..cb50a73648c61c4 100644 --- a/drivers/usb/bc12/bc12_pi3usb9201.c +++ b/drivers/usb/bc12/bc12_pi3usb9201.c @@ -514,7 +514,7 @@ static void pi3usb9201_isr_work(struct k_work *item) } static void pi3usb9201_gpio_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct pi3usb9201_data *pi3usb9201_data = CONTAINER_OF(cb, struct pi3usb9201_data, gpio_cb); @@ -584,7 +584,7 @@ static int pi3usb9201_init(const struct device *dev) } gpio_init_callback(&pi3usb9201_data->gpio_cb, pi3usb9201_gpio_callback, - BIT(cfg->intb_gpio.pin)); + GPIO_BIT(cfg->intb_gpio.pin)); k_work_init(&pi3usb9201_data->work, pi3usb9201_isr_work); rv = gpio_add_callback(cfg->intb_gpio.port, &pi3usb9201_data->gpio_cb); diff --git a/drivers/usb/uhc/uhc_max3421e.c b/drivers/usb/uhc/uhc_max3421e.c index ac9aa2a526dff4c..2b0275be1efcb1e 100644 --- a/drivers/usb/uhc/uhc_max3421e.c +++ b/drivers/usb/uhc/uhc_max3421e.c @@ -717,7 +717,7 @@ static void uhc_max3421e_thread(void *p1, void *p2, void *p3) static void max3421e_gpio_cb(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct max3421e_data *priv = CONTAINER_OF(cb, struct max3421e_data, gpio_cb); @@ -1065,7 +1065,7 @@ static int max3421e_driver_init(const struct device *dev) } gpio_init_callback(&priv->gpio_cb, max3421e_gpio_cb, - BIT(config->dt_int.pin)); + GPIO_BIT(config->dt_int.pin)); ret = gpio_add_callback(config->dt_int.port, &priv->gpio_cb); if (ret) { return ret; diff --git a/drivers/usb_c/ppc/nxp_nx20p3483.c b/drivers/usb_c/ppc/nxp_nx20p3483.c index 35d1db70798106b..7a396c739630238 100644 --- a/drivers/usb_c/ppc/nxp_nx20p3483.c +++ b/drivers/usb_c/ppc/nxp_nx20p3483.c @@ -386,7 +386,7 @@ static int nx20p3483_dev_init(const struct device *dev) return ret; } - gpio_init_callback(&data->irq_cb, nx20p3483_irq_handler, BIT(cfg->irq_gpio.pin)); + gpio_init_callback(&data->irq_cb, nx20p3483_irq_handler, GPIO_BIT(cfg->irq_gpio.pin)); ret = gpio_add_callback(cfg->irq_gpio.port, &data->irq_cb); if (ret != 0) { return ret; diff --git a/drivers/watchdog/wdt_nxp_fs26.c b/drivers/watchdog/wdt_nxp_fs26.c index f6aed5079e4ecf6..6ed6950e9477649 100644 --- a/drivers/watchdog/wdt_nxp_fs26.c +++ b/drivers/watchdog/wdt_nxp_fs26.c @@ -615,7 +615,7 @@ static void wdt_nxp_fs26_int_thread(void *p1, void *p2, void *p3) static void wdt_nxp_fs26_int_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct wdt_nxp_fs26_data *data = CONTAINER_OF(cb, struct wdt_nxp_fs26_data, int_gpio_cb); @@ -652,7 +652,7 @@ static int wdt_nxp_fs26_init(const struct device *dev) } gpio_init_callback(&(data->int_gpio_cb), wdt_nxp_fs26_int_callback, - BIT(config->int_gpio.pin)); + GPIO_BIT(config->int_gpio.pin)); if (gpio_add_callback(config->int_gpio.port, &(data->int_gpio_cb))) { return -EINVAL; diff --git a/drivers/wifi/infineon/airoc_whd_hal.c b/drivers/wifi/infineon/airoc_whd_hal.c index b3a68102851f104..497cabe913c287b 100644 --- a/drivers/wifi/infineon/airoc_whd_hal.c +++ b/drivers/wifi/infineon/airoc_whd_hal.c @@ -362,7 +362,7 @@ whd_result_t whd_bus_sdio_register_oob_intr(whd_driver_t whd_driver) /* Initialize/add OOB pin callback */ gpio_init_callback(&data->host_oob_pin_cb, whd_bus_sdio_oob_irq_handler, - BIT(host_oob_pin->pin)); + GPIO_BIT(host_oob_pin->pin)); ret = gpio_add_callback_dt(host_oob_pin, &data->host_oob_pin_cb); if (ret != 0) { diff --git a/drivers/wifi/nrfwifi/src/qspi/src/rpu_hw_if.c b/drivers/wifi/nrfwifi/src/qspi/src/rpu_hw_if.c index 6fac74123621398..49e59ceb8348966 100644 --- a/drivers/wifi/nrfwifi/src/qspi/src/rpu_hw_if.c +++ b/drivers/wifi/nrfwifi/src/qspi/src/rpu_hw_if.c @@ -133,7 +133,7 @@ int rpu_irq_config(struct gpio_callback *irq_callback_data, void (*irq_handler)( gpio_init_callback(irq_callback_data, irq_handler, - BIT(host_irq_spec.pin)); + GPIO_BIT(host_irq_spec.pin)); ret = gpio_add_callback(host_irq_spec.port, irq_callback_data); if (ret) { diff --git a/drivers/wifi/nrfwifi/src/shim.c b/drivers/wifi/nrfwifi/src/shim.c index 93cafa905c2e034..aba24e4cde92e87 100644 --- a/drivers/wifi/nrfwifi/src/shim.c +++ b/drivers/wifi/nrfwifi/src/shim.c @@ -768,7 +768,8 @@ static void irq_work_handler(struct k_work *work) extern struct k_work_q zep_wifi_intr_q; -static void zep_shim_irq_handler(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void zep_shim_irq_handler(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { ARG_UNUSED(cb); ARG_UNUSED(pins); diff --git a/drivers/wifi/winc1500/wifi_winc1500_nm_bsp.c b/drivers/wifi/winc1500/wifi_winc1500_nm_bsp.c index d8e5a3da7f598ac..10884c45408317c 100644 --- a/drivers/wifi/winc1500/wifi_winc1500_nm_bsp.c +++ b/drivers/wifi/winc1500/wifi_winc1500_nm_bsp.c @@ -73,7 +73,7 @@ void nm_bsp_register_isr(void (*isr_fun)(void)) gpio_init_callback(&winc1500.gpio_cb, chip_isr, - BIT(winc1500_config.irq_gpio.pin)); + GPIO_BIT(winc1500_config.irq_gpio.pin)); gpio_add_callback(winc1500_config.irq_gpio.port, &winc1500.gpio_cb); } diff --git a/samples/basic/button/src/main.c b/samples/basic/button/src/main.c index 7c6ab66faa1457b..b23aadd3e1bad62 100644 --- a/samples/basic/button/src/main.c +++ b/samples/basic/button/src/main.c @@ -37,7 +37,7 @@ static struct gpio_dt_spec led = GPIO_DT_SPEC_GET_OR(DT_ALIAS(led0), gpios, {0}); void button_pressed(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { printk("Button pressed at %" PRIu32 "\n", k_cycle_get_32()); } @@ -67,7 +67,7 @@ int main(void) return 0; } - gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); + gpio_init_callback(&button_cb_data, button_pressed, GPIO_BIT(button.pin)); gpio_add_callback(button.port, &button_cb_data); printk("Set up button at %s pin %d\n", button.port->name, button.pin); diff --git a/samples/bluetooth/central_otc/src/main.c b/samples/bluetooth/central_otc/src/main.c index 9f1f3069fd4c1dc..68b73a0e3434ccc 100644 --- a/samples/bluetooth/central_otc/src/main.c +++ b/samples/bluetooth/central_otc/src/main.c @@ -178,7 +178,8 @@ static void otc_checksum_work_fn(struct k_work *work) } } -static void button_pressed(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void button_pressed(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { otc_btn_work.pins = pins; k_work_schedule(&otc_btn_work.work, K_MSEC(100)); diff --git a/samples/bluetooth/encrypted_advertising/central/src/main.c b/samples/bluetooth/encrypted_advertising/central/src/main.c index 122641b311a4e7d..5da490955e34fea 100644 --- a/samples/bluetooth/encrypted_advertising/central/src/main.c +++ b/samples/bluetooth/encrypted_advertising/central/src/main.c @@ -42,7 +42,8 @@ extern int run_central_sample(int get_passkey_confirmation(struct bt_conn *conn) static struct k_poll_signal button_pressed_signal; -static void button_pressed(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void button_pressed(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { LOG_DBG("Button pressed..."); @@ -96,7 +97,7 @@ static int setup_btn(void) return -1; } - gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); + gpio_init_callback(&button_cb_data, button_pressed, GPIO_BIT(button.pin)); gpio_add_callback(button.port, &button_cb_data); LOG_DBG("Set up button at %s pin %d", button.port->name, button.pin); diff --git a/samples/bluetooth/encrypted_advertising/peripheral/src/main.c b/samples/bluetooth/encrypted_advertising/peripheral/src/main.c index affa5430af2cffe..f441a45c971c211 100644 --- a/samples/bluetooth/encrypted_advertising/peripheral/src/main.c +++ b/samples/bluetooth/encrypted_advertising/peripheral/src/main.c @@ -36,7 +36,8 @@ extern int run_peripheral_sample(int get_passkey_confirmation(struct bt_conn *co static struct k_poll_signal button_pressed_signal; -static void button_pressed(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void button_pressed(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { LOG_DBG("Button pressed..."); @@ -90,7 +91,7 @@ static int setup_btn(void) return -1; } - gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); + gpio_init_callback(&button_cb_data, button_pressed, GPIO_BIT(button.pin)); gpio_add_callback(button.port, &button_cb_data); LOG_DBG("Set up button at %s pin %d", button.port->name, button.pin); diff --git a/samples/bluetooth/mesh/src/board.c b/samples/bluetooth/mesh/src/board.c index 3c16279774f5821..4fe7857be1fac44 100644 --- a/samples/bluetooth/mesh/src/board.c +++ b/samples/bluetooth/mesh/src/board.c @@ -97,7 +97,7 @@ static int button_init(struct k_work *button_pressed) button_work = button_pressed; - gpio_init_callback(&gpio_cb, button_cb, BIT(BUTTON0_PIN)); + gpio_init_callback(&gpio_cb, button_cb, GPIO_BIT(BUTTON0_PIN)); gpio_add_callback(button_dev, &gpio_cb); #else printk("WARNING: Buttons not supported on this board.\n"); diff --git a/samples/bluetooth/mesh/src/microbit.c b/samples/bluetooth/mesh/src/microbit.c index 79e78982892d198..4ef330bbe8df66f 100644 --- a/samples/bluetooth/mesh/src/microbit.c +++ b/samples/bluetooth/mesh/src/microbit.c @@ -30,7 +30,7 @@ static const struct mb_image onoff[] = { static struct k_work *button_work; static void button_pressed(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct mb_display *disp = mb_display_get(); @@ -53,7 +53,7 @@ static void configure_button(void) gpio_pin_configure_dt(&button, GPIO_INPUT); gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE); - gpio_init_callback(&button_cb, button_pressed, BIT(button.pin)); + gpio_init_callback(&button_cb, button_pressed, GPIO_BIT(button.pin)); gpio_add_callback(button.port, &button_cb); } diff --git a/samples/bluetooth/mesh_demo/src/microbit.c b/samples/bluetooth/mesh_demo/src/microbit.c index bfc608dc82970b4..42815383f416087 100644 --- a/samples/bluetooth/mesh_demo/src/microbit.c +++ b/samples/bluetooth/mesh_demo/src/microbit.c @@ -46,7 +46,7 @@ static void button_send_pressed(struct k_work *work) } static void button_pressed(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct mb_display *disp = mb_display_get(); @@ -260,7 +260,7 @@ static int configure_buttons(void) } gpio_init_callback(&button_cb, button_pressed, - BIT(button_a.pin) | BIT(button_b.pin)); + GPIO_BIT(button_a.pin) | BIT(button_b.pin)); return gpio_add_callback(button_a.port, &button_cb); } diff --git a/samples/bluetooth/mesh_provisioner/src/main.c b/samples/bluetooth/mesh_provisioner/src/main.c index d4be8601304f239..d612b5dd2c88b3f 100644 --- a/samples/bluetooth/mesh_provisioner/src/main.c +++ b/samples/bluetooth/mesh_provisioner/src/main.c @@ -319,7 +319,8 @@ static uint8_t check_unconfigured(struct bt_mesh_cdb_node *node, void *data) static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0}); static struct gpio_callback button_cb_data; -static void button_pressed(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void button_pressed(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { k_sem_give(&sem_button_pressed); } @@ -344,7 +345,7 @@ static void button_init(void) button.port->name, button.pin); return; } - gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); + gpio_init_callback(&button_cb_data, button_pressed, GPIO_BIT(button.pin)); gpio_add_callback(button.port, &button_cb_data); } #endif diff --git a/samples/bluetooth/st_ble_sensor/src/button_svc.c b/samples/bluetooth/st_ble_sensor/src/button_svc.c index 2f1ff573f6f40f1..f6adf09134d076a 100644 --- a/samples/bluetooth/st_ble_sensor/src/button_svc.c +++ b/samples/bluetooth/st_ble_sensor/src/button_svc.c @@ -42,7 +42,7 @@ int button_init(gpio_callback_handler_t handler) } - gpio_init_callback(&gpio_cb, handler, BIT(button.pin)); + gpio_init_callback(&gpio_cb, handler, GPIO_BIT(button.pin)); gpio_add_callback(button.port, &gpio_cb); ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE); if (ret != 0) { diff --git a/samples/bluetooth/st_ble_sensor/src/main.c b/samples/bluetooth/st_ble_sensor/src/main.c index b7c1547b04c7078..4409c125e26d7d8 100644 --- a/samples/bluetooth/st_ble_sensor/src/main.c +++ b/samples/bluetooth/st_ble_sensor/src/main.c @@ -111,7 +111,7 @@ static ssize_t recv(struct bt_conn *conn, } static void button_callback(const struct device *gpiob, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { int err; diff --git a/samples/boards/bbc/microbit/line_follower_robot/src/main.c b/samples/boards/bbc/microbit/line_follower_robot/src/main.c index d771863930abe9d..9e1dff3e6541391 100644 --- a/samples/boards/bbc/microbit/line_follower_robot/src/main.c +++ b/samples/boards/bbc/microbit/line_follower_robot/src/main.c @@ -30,13 +30,13 @@ static int left_line; static int right_line; static void left_irq(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { left_line = gpio_pin_get_dt(&left_gpio); } static void right_irq(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { right_line = gpio_pin_get_dt(&right_gpio); } @@ -115,9 +115,9 @@ int main(void) gpio_pin_interrupt_configure_dt(&left_gpio, GPIO_INT_EDGE_BOTH); gpio_pin_interrupt_configure_dt(&right_gpio, GPIO_INT_EDGE_BOTH); - gpio_init_callback(&left_cb, left_irq, BIT(left_gpio.pin)); + gpio_init_callback(&left_cb, left_irq, GPIO_BIT(left_gpio.pin)); gpio_add_callback(left_gpio.port, &left_cb); - gpio_init_callback(&right_cb, right_irq, BIT(right_gpio.pin)); + gpio_init_callback(&right_cb, right_irq, GPIO_BIT(right_gpio.pin)); gpio_add_callback(right_gpio.port, &right_cb); while (1) { diff --git a/samples/boards/bbc/microbit/pong/src/main.c b/samples/boards/bbc/microbit/pong/src/main.c index a8a85b3fc3a40e2..107c765bf38b61d 100644 --- a/samples/boards/bbc/microbit/pong/src/main.c +++ b/samples/boards/bbc/microbit/pong/src/main.c @@ -401,7 +401,7 @@ void pong_ball_received(int8_t x_pos, int8_t y_pos, int8_t x_vel, int8_t y_vel) } static void button_pressed(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { /* Filter out spurious presses */ if (pins & BIT(sw0_gpio.pin)) { @@ -512,7 +512,7 @@ static void configure_buttons(void) gpio_pin_interrupt_configure_dt(&sw1_gpio, GPIO_INT_EDGE_TO_ACTIVE); gpio_init_callback(&button_cb_data, button_pressed, - BIT(sw0_gpio.pin) | BIT(sw1_gpio.pin)); + GPIO_BIT(sw0_gpio.pin) | BIT(sw1_gpio.pin)); gpio_add_callback(sw0_gpio.port, &button_cb_data); } diff --git a/samples/boards/bbc/microbit/sound/src/main.c b/samples/boards/bbc/microbit/sound/src/main.c index 4d2317dddab6485..1aab1c038dd0159 100644 --- a/samples/boards/bbc/microbit/sound/src/main.c +++ b/samples/boards/bbc/microbit/sound/src/main.c @@ -48,7 +48,7 @@ static void beep(struct k_work *work) } static void button_pressed(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { struct mb_display *disp; @@ -105,7 +105,7 @@ int main(void) gpio_pin_interrupt_configure_dt(&sw1_gpio, GPIO_INT_EDGE_TO_ACTIVE); gpio_init_callback(&button_cb_data, button_pressed, - BIT(sw0_gpio.pin) | BIT(sw1_gpio.pin)); + GPIO_BIT(sw0_gpio.pin) | BIT(sw1_gpio.pin)); k_work_init(&beep_work, beep); /* Notify with a beep that we've started */ diff --git a/samples/boards/nordic/mesh/onoff-app/src/main.c b/samples/boards/nordic/mesh/onoff-app/src/main.c index 17b04c87fad638e..38165afd010a6be 100644 --- a/samples/boards/nordic/mesh/onoff-app/src/main.c +++ b/samples/boards/nordic/mesh/onoff-app/src/main.c @@ -414,7 +414,7 @@ static uint8_t pin_to_sw(uint32_t pin_pos) } static void button_pressed(const struct device *dev, struct gpio_callback *cb, - uint32_t pin_pos) + gpio_port_pins_t pin_pos) { /* * One button press within a 1 second interval sends an on message @@ -589,8 +589,8 @@ int main(void) k_timer_init(&sw.button_timer, button_cnt_timer, NULL); gpio_init_callback(&button_cb, button_pressed, - BIT(sw_device[0].pin) | BIT(sw_device[1].pin) | - BIT(sw_device[2].pin) | BIT(sw_device[3].pin)); + GPIO_BIT(sw_device[0].pin) | BIT(sw_device[1].pin) | + GPIO_BIT(sw_device[2].pin) | BIT(sw_device[3].pin)); for (i = 0; i < ARRAY_SIZE(sw_device); i++) { if (!gpio_is_ready_dt(&sw_device[i])) { diff --git a/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/src/app_gpio.c b/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/src/app_gpio.c index 38601c429a16eef..ff51183b6f926ca 100644 --- a/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/src/app_gpio.c +++ b/samples/boards/nordic/mesh/onoff_level_lighting_vnd_app/src/app_gpio.c @@ -14,7 +14,7 @@ K_WORK_DEFINE(button_work, publish); static void button_pressed(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { k_work_submit(&button_work); } @@ -79,7 +79,7 @@ void app_gpio_init(void) gpio_pin_interrupt_configure_dt(&button_device[i], GPIO_INT_EDGE_TO_ACTIVE); gpio_init_callback(&button_cb[i], button_pressed, - BIT(button_device[i].pin)); + GPIO_BIT(button_device[i].pin)); gpio_add_callback(button_device[i].port, &button_cb[i]); } } diff --git a/samples/boards/nordic/nrfx_prs/src/main.c b/samples/boards/nordic/nrfx_prs/src/main.c index cf989b4c4c9ecb9..1158c49e88b3fd1 100644 --- a/samples/boards/nordic/nrfx_prs/src/main.c +++ b/samples/boards/nordic/nrfx_prs/src/main.c @@ -42,14 +42,14 @@ static enum { static K_SEM_DEFINE(button_pressed, 0, 1); static void sw0_handler(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { user_request = PERFORM_TRANSFER; k_sem_give(&button_pressed); } static void sw1_handler(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { user_request = SWITCH_PERIPHERAL; k_sem_give(&button_pressed); @@ -103,7 +103,7 @@ static bool init_buttons(void) } gpio_init_callback(&btn_cb_data[i], - btn->handler, BIT(btn->gpio.pin)); + btn->handler, GPIO_BIT(btn->gpio.pin)); gpio_add_callback(btn->gpio.port, &btn_cb_data[i]); printk("-> press \"%s\" to %s\n", btn->label, btn->action); } diff --git a/samples/boards/phytec/reel_board/mesh_badge/src/reel_board.c b/samples/boards/phytec/reel_board/mesh_badge/src/reel_board.c index b7e71e06e5a1da6..533692451c35c2f 100644 --- a/samples/boards/phytec/reel_board/mesh_badge/src/reel_board.c +++ b/samples/boards/phytec/reel_board/mesh_badge/src/reel_board.c @@ -445,7 +445,7 @@ static bool button_is_pressed(void) static void button_interrupt(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { if (button_is_pressed() == pressed) { return; @@ -513,7 +513,7 @@ static int configure_button(void) gpio_pin_interrupt_configure_dt(&sw0_gpio, GPIO_INT_EDGE_BOTH); - gpio_init_callback(&button_cb, button_interrupt, BIT(sw0_gpio.pin)); + gpio_init_callback(&button_cb, button_interrupt, GPIO_BIT(sw0_gpio.pin)); gpio_add_callback(sw0_gpio.port, &button_cb); diff --git a/samples/boards/st/power_mgmt/standby_shutdown/src/main.c b/samples/boards/st/power_mgmt/standby_shutdown/src/main.c index b74051bc99f95d7..647ff94151e99af 100644 --- a/samples/boards/st/power_mgmt/standby_shutdown/src/main.c +++ b/samples/boards/st/power_mgmt/standby_shutdown/src/main.c @@ -55,7 +55,7 @@ void config_wakeup_features(void) } void button_pressed(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { k_sem_give(&button_sem); } @@ -133,7 +133,7 @@ int main(void) return 0; } - gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin)); + gpio_init_callback(&button_cb_data, button_pressed, GPIO_BIT(button.pin)); gpio_add_callback(button.port, &button_cb_data); printk("Device ready: %s\n\n\n", CONFIG_BOARD); diff --git a/samples/drivers/can/babbling/src/main.c b/samples/drivers/can/babbling/src/main.c index ada6852ae8f7379..8abe962e4837637 100644 --- a/samples/drivers/can/babbling/src/main.c +++ b/samples/drivers/can/babbling/src/main.c @@ -91,7 +91,7 @@ int main(void) return 0; } - gpio_init_callback(&btn_cb_ctx.callback, button_callback, BIT(btn.pin)); + gpio_init_callback(&btn_cb_ctx.callback, button_callback, GPIO_BIT(btn.pin)); gpio_add_callback(btn.port, &btn_cb_ctx.callback); #endif /* DT_NODE_EXISTS(BUTTON_NODE) */ diff --git a/samples/drivers/i2s/echo/src/main.c b/samples/drivers/i2s/echo/src/main.c index bffa794158b3f48..650d01b65bc5be3 100644 --- a/samples/drivers/i2s/echo/src/main.c +++ b/samples/drivers/i2s/echo/src/main.c @@ -49,7 +49,7 @@ static K_SEM_DEFINE(toggle_transfer, 1, 1); #if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) static void sw0_handler(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { bool enable = !echo_enabled; @@ -93,7 +93,7 @@ static bool init_buttons(void) return false; } - gpio_init_callback(&sw0_cb_data, sw0_handler, BIT(sw0_spec.pin)); + gpio_init_callback(&sw0_cb_data, sw0_handler, GPIO_BIT(sw0_spec.pin)); gpio_add_callback(sw0_spec.port, &sw0_cb_data); printk("Press \"%s\" to toggle the echo effect\n", sw0_spec.port->name); #endif @@ -121,7 +121,7 @@ static bool init_buttons(void) return false; } - gpio_init_callback(&sw1_cb_data, sw1_handler, BIT(sw1_spec.pin)); + gpio_init_callback(&sw1_cb_data, sw1_handler, GPIO_BIT(sw1_spec.pin)); gpio_add_callback(sw1_spec.port, &sw1_cb_data); printk("Press \"%s\" to stop/restart I2S streams\n", sw1_spec.port->name); #endif diff --git a/samples/modules/canopennode/src/main.c b/samples/modules/canopennode/src/main.c index e741f569466aeea..ba39771e58dffc4 100644 --- a/samples/modules/canopennode/src/main.c +++ b/samples/modules/canopennode/src/main.c @@ -142,7 +142,7 @@ static CO_SDO_abortCode_t odf_2102(CO_ODF_arg_t *odf_arg) */ static void button_isr_callback(const struct device *port, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { counter++; } @@ -173,7 +173,7 @@ static void config_button(void) } gpio_init_callback(&button_callback, button_isr_callback, - BIT(button_gpio.pin)); + GPIO_BIT(button_gpio.pin)); err = gpio_add_callback(button_gpio.port, &button_callback); if (err) { diff --git a/samples/shields/npm1300_ek/src/main.c b/samples/shields/npm1300_ek/src/main.c index 47ed6214677bed6..8a426fba65808d1 100644 --- a/samples/shields/npm1300_ek/src/main.c +++ b/samples/shields/npm1300_ek/src/main.c @@ -53,7 +53,8 @@ void configure_ui(void) } } -static void event_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void event_callback(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { printk("Event detected\n"); } @@ -68,7 +69,7 @@ void configure_events(void) /* Setup callback for shiphold button press */ static struct gpio_callback event_cb; - gpio_init_callback(&event_cb, event_callback, BIT(NPM1300_EVENT_SHIPHOLD_PRESS)); + gpio_init_callback(&event_cb, event_callback, GPIO_BIT(NPM1300_EVENT_SHIPHOLD_PRESS)); mfd_npm1300_add_callback(pmic, &event_cb); } diff --git a/samples/shields/x_nucleo_53l0a1/src/main.c b/samples/shields/x_nucleo_53l0a1/src/main.c index 9de9469ba7d7175..2873905561192ec 100644 --- a/samples/shields/x_nucleo_53l0a1/src/main.c +++ b/samples/shields/x_nucleo_53l0a1/src/main.c @@ -99,7 +99,8 @@ static fsm_state modes[] = { mode_show_presence, }; -static void change_mode(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +static void change_mode(const struct device *dev, struct gpio_callback *cb, + gpio_port_pins_t pins) { (void) dev; (void) cb; @@ -131,7 +132,7 @@ int main(void) gpio_pin_configure_dt(&button, GPIO_INPUT); gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_RISING); - gpio_init_callback(&button_cb_data, change_mode, BIT(button.pin)); + gpio_init_callback(&button_cb_data, change_mode, GPIO_BIT(button.pin)); gpio_add_callback(button.port, &button_cb_data); while (1) { diff --git a/samples/subsys/display/lvgl/src/main.c b/samples/subsys/display/lvgl/src/main.c index 9f704eb4423004f..730eb0c6d6c1387 100644 --- a/samples/subsys/display/lvgl/src/main.c +++ b/samples/subsys/display/lvgl/src/main.c @@ -27,7 +27,7 @@ static struct gpio_callback button_callback; static void button_isr_callback(const struct device *port, struct gpio_callback *cb, - uint32_t pins) + gpio_port_pins_t pins) { ARG_UNUSED(port); ARG_UNUSED(cb); @@ -78,7 +78,7 @@ int main(void) } gpio_init_callback(&button_callback, button_isr_callback, - BIT(button_gpio.pin)); + GPIO_BIT(button_gpio.pin)); err = gpio_add_callback(button_gpio.port, &button_callback); if (err) { diff --git a/subsys/bluetooth/controller/coex/coex_ticker.c b/subsys/bluetooth/controller/coex/coex_ticker.c index be349622ecd68e9..73716cdb6cf8b02 100644 --- a/subsys/bluetooth/controller/coex/coex_ticker.c +++ b/subsys/bluetooth/controller/coex/coex_ticker.c @@ -149,7 +149,7 @@ static int coex_ticker_grant_start(const struct device *dev) static void coex_ticker_grant_irq_handler(const struct device *dev, - struct gpio_callback *cb, uint32_t pins) + struct gpio_callback *cb, gpio_port_pins_t pins) { ARG_UNUSED(dev); ARG_UNUSED(pins); @@ -181,7 +181,7 @@ static int coex_ticker_init(const struct device *dev) gpio_init_callback(&data->grant_irq_cb, coex_ticker_grant_irq_handler, - BIT(config->grant_spec.pin)); + GPIO_BIT(config->grant_spec.pin)); res = gpio_add_callback(config->grant_spec.port, &data->grant_irq_cb); if (res) { diff --git a/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_ite.c b/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_ite.c index 3682709ccc3aee3..882421cc3362756 100644 --- a/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_ite.c +++ b/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_ite.c @@ -424,7 +424,7 @@ static int shi_ite_init(const struct device *dev) } /* Enable SPI chip select pin interrupt */ - gpio_init_callback(&data->cs_cb, shi_ite_cs_callback, BIT(cfg->cs.pin)); + gpio_init_callback(&data->cs_cb, shi_ite_cs_callback, GPIO_BIT(cfg->cs.pin)); ret = gpio_add_callback(cfg->cs.port, &data->cs_cb); if (ret < 0) { return -EINVAL; diff --git a/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_spi_stm32.c b/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_spi_stm32.c index bdc9faf6871fc0c..fd9cc1c9bddfc5c 100644 --- a/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_spi_stm32.c +++ b/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_spi_stm32.c @@ -698,7 +698,7 @@ static int ec_host_cmd_spi_init(const struct ec_host_cmd_backend *backend, return -EIO; } - gpio_init_callback(&hc_spi->cs_callback, gpio_cb_nss, BIT(hc_spi->cs.pin)); + gpio_init_callback(&hc_spi->cs_callback, gpio_cb_nss, GPIO_BIT(hc_spi->cs.pin)); gpio_add_callback(hc_spi->cs.port, &hc_spi->cs_callback); gpio_pin_interrupt_configure(hc_spi->cs.port, hc_spi->cs.pin, GPIO_INT_EDGE_BOTH); diff --git a/tests/drivers/gpio/gpio_api_1pin/src/test_pin_interrupt.c b/tests/drivers/gpio/gpio_api_1pin/src/test_pin_interrupt.c index 468fe1a7b2f07a8..d325357e336b802 100644 --- a/tests/drivers/gpio/gpio_api_1pin/src/test_pin_interrupt.c +++ b/tests/drivers/gpio/gpio_api_1pin/src/test_pin_interrupt.c @@ -80,7 +80,7 @@ void test_gpio_pin_interrupt_edge(unsigned int cfg_flags, cb_count = 0; cb_count_expected = 0; - gpio_init_callback(&gpio_cb, callback_edge, BIT(TEST_PIN)); + gpio_init_callback(&gpio_cb, callback_edge, GPIO_BIT(TEST_PIN)); ret = gpio_add_callback(port, &gpio_cb); ret = gpio_pin_interrupt_configure(port, TEST_PIN, int_flags); @@ -160,7 +160,7 @@ void test_gpio_pin_interrupt_level(unsigned int cfg_flags, cb_count_expected = 0; cb_count_target = interrupt_calls; - gpio_init_callback(&gpio_cb, callback_level, BIT(TEST_PIN)); + gpio_init_callback(&gpio_cb, callback_level, GPIO_BIT(TEST_PIN)); ret = gpio_add_callback(port, &gpio_cb); ret = gpio_pin_interrupt_configure(port, TEST_PIN, int_flags); diff --git a/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c b/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c index f06052645eed6bf..6369efb7108e458 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c +++ b/tests/drivers/gpio/gpio_basic_api/src/test_callback_manage.c @@ -11,20 +11,20 @@ static struct drv_data cb_data[2]; static int cb_cnt[2]; static void callback_1(const struct device *dev, - struct gpio_callback *gpio_cb, uint32_t pins) + struct gpio_callback *gpio_cb, gpio_port_pins_t pins) { TC_PRINT("%s triggered: %d\n", __func__, ++cb_cnt[0]); } static void callback_2(const struct device *dev, - struct gpio_callback *gpio_cb, uint32_t pins) + struct gpio_callback *gpio_cb, gpio_port_pins_t pins) { TC_PRINT("%s triggered: %d\n", __func__, ++cb_cnt[1]); } static void callback_remove_self(const struct device *dev, - struct gpio_callback *gpio_cb, uint32_t pins) + struct gpio_callback *gpio_cb, gpio_port_pins_t pins) { struct drv_data *dd = CONTAINER_OF(gpio_cb, struct drv_data, gpio_cb); @@ -51,12 +51,12 @@ static int init_callback(const struct device *dev_in, const struct device *dev_o } if (rc == 0) { - gpio_init_callback(&cb_data[0].gpio_cb, handler_1, BIT(PIN_IN)); + gpio_init_callback(&cb_data[0].gpio_cb, handler_1, GPIO_BIT(PIN_IN)); rc = gpio_add_callback(dev_in, &cb_data[0].gpio_cb); } if (rc == 0) { - gpio_init_callback(&cb_data[1].gpio_cb, handler_2, BIT(PIN_IN)); + gpio_init_callback(&cb_data[1].gpio_cb, handler_2, GPIO_BIT(PIN_IN)); rc = gpio_add_callback(dev_in, &cb_data[1].gpio_cb); } diff --git a/tests/drivers/gpio/gpio_basic_api/src/test_callback_trigger.c b/tests/drivers/gpio/gpio_basic_api/src/test_callback_trigger.c index 39823e9911c92cb..1ecc678e3ba1e38 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/test_callback_trigger.c +++ b/tests/drivers/gpio/gpio_basic_api/src/test_callback_trigger.c @@ -10,8 +10,8 @@ static struct drv_data data; static int cb_cnt; -static void callback(const struct device *dev_in, struct gpio_callback *gpio_cb, - uint32_t pins) +static void callback(const struct device *dev, + struct gpio_callback *gpio_cb, gpio_port_pins_t pins) { const struct device *const dev_out = DEVICE_DT_GET(DEV_OUT); const struct drv_data *dd = CONTAINER_OF(gpio_cb, @@ -63,7 +63,7 @@ static int test_callback(int mode) } drv_data->mode = mode; - gpio_init_callback(&drv_data->gpio_cb, callback, BIT(PIN_IN)); + gpio_init_callback(&drv_data->gpio_cb, callback, GPIO_BIT(PIN_IN)); rc = gpio_add_callback(dev_in, &drv_data->gpio_cb); if (rc == -ENOTSUP) { TC_PRINT("interrupts not supported\n"); diff --git a/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c b/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c index 881020a7281fad3..31929f4314f1b92 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c +++ b/tests/drivers/gpio/gpio_basic_api/src/test_config_trigger.c @@ -11,7 +11,7 @@ static struct drv_data data; static int cb_cnt; static void callback(const struct device *dev, - struct gpio_callback *gpio_cb, uint32_t pins) + struct gpio_callback *gpio_cb, gpio_port_pins_t pins) { /*= checkpoint: pins should be marked with correct pin number bit =*/ zassert_equal(pins, BIT(PIN_IN), @@ -35,7 +35,7 @@ ZTEST(after_flash_gpio_config_trigger, test_gpio_config_twice_trigger) ret = gpio_pin_configure(dev_in, PIN_IN, GPIO_INPUT); zassert_ok(ret, "config PIN_IN failed"); - gpio_init_callback(&drv_data->gpio_cb, callback, BIT(PIN_IN)); + gpio_init_callback(&drv_data->gpio_cb, callback, GPIO_BIT(PIN_IN)); ret = gpio_add_callback(dev_in, &drv_data->gpio_cb); zassert_ok(ret, "add callback failed"); @@ -86,8 +86,13 @@ ZTEST(after_flash_gpio_config_trigger, test_gpio_config_trigger) ret = gpio_pin_configure(dev_in, PIN_IN, GPIO_INPUT); zassert_ok(ret, "config PIN_IN failed"); +<<<<<<< HEAD gpio_init_callback(&drv_data->gpio_cb, callback, BIT(PIN_IN)); ret = gpio_add_callback(dev_in, &drv_data->gpio_cb); +======= + gpio_init_callback(&drv_data->gpio_cb, callback, GPIO_BIT(PIN_IN)); + ret = gpio_add_callback(dev, &drv_data->gpio_cb); +>>>>>>> 70d1705f79d (64bit) zassert_ok(ret, "add callback failed"); /* 2. Enable PIN callback as both edges */ diff --git a/tests/drivers/gpio/gpio_enable_disable_interrupt/src/main.c b/tests/drivers/gpio/gpio_enable_disable_interrupt/src/main.c index be89bdba15ed7d2..5950a7930ba71c6 100644 --- a/tests/drivers/gpio/gpio_enable_disable_interrupt/src/main.c +++ b/tests/drivers/gpio/gpio_enable_disable_interrupt/src/main.c @@ -14,7 +14,7 @@ static struct gpio_dt_spec irq_pin = static struct gpio_callback cb_data; static bool cb_called; -static void callback(const struct device *dev, struct gpio_callback *gpio_cb, uint32_t pins) +static void callback(const struct device *dev, struct gpio_callback *gpio_cb, gpio_port_pins_t pins) { cb_called = true; } @@ -45,7 +45,7 @@ static void gpio_enable_disable_interrupt_before(void *arg) cb_called = false; zassert_ok(gpio_pin_interrupt_configure_dt(fixture->irq_spec, GPIO_INT_DISABLE)); - gpio_init_callback(&cb_data, callback, BIT(fixture->irq_spec->pin)); + gpio_init_callback(&cb_data, callback, GPIO_BIT(fixture->irq_spec->pin)); zassert_ok(gpio_add_callback(fixture->irq_spec->port, &cb_data), "failed to add callback"); } diff --git a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c index 2746bb114396ff0..b1d8aef1b150b08 100644 --- a/tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c +++ b/tests/drivers/gpio/gpio_ite_it8xxx2_v2/src/main.c @@ -127,7 +127,7 @@ ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_edge_rising) zassert_true(device_is_ready(gpio_dev)); zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); + gpio_init_callback(&callback_struct, &callback, GPIO_BIT(TEST_PIN)); zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_TO_ACTIVE)); zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); @@ -151,7 +151,7 @@ ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_enable_disable) zassert_true(device_is_ready(gpio_dev)); zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); + gpio_init_callback(&callback_struct, &callback, GPIO_BIT(TEST_PIN)); zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_TO_ACTIVE)); zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); @@ -193,7 +193,7 @@ ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_edge_falling) zassert_true(device_is_ready(gpio_dev)); zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); + gpio_init_callback(&callback_struct, &callback, GPIO_BIT(TEST_PIN)); zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_TO_INACTIVE)); zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); @@ -217,7 +217,7 @@ ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_edge_both) zassert_true(device_is_ready(gpio_dev)); zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); + gpio_init_callback(&callback_struct, &callback, GPIO_BIT(TEST_PIN)); zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_EDGE_BOTH)); zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); @@ -247,7 +247,7 @@ ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_level_active) zassert_true(device_is_ready(gpio_dev)); zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); + gpio_init_callback(&callback_struct, &callback, GPIO_BIT(TEST_PIN)); zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_LEVEL_ACTIVE)); zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr); @@ -274,7 +274,7 @@ ZTEST(gpio_ite_it8xxx2_v2, test_interrupt_level_inactive) zassert_true(device_is_ready(gpio_dev)); zassert_ok(gpio_pin_configure(gpio_dev, TEST_PIN, GPIO_INPUT | GPIO_ACTIVE_HIGH)); - gpio_init_callback(&callback_struct, &callback, BIT(TEST_PIN)); + gpio_init_callback(&callback_struct, &callback, GPIO_BIT(TEST_PIN)); zassert_ok(gpio_add_callback(gpio_dev, &callback_struct)); zassert_ok(gpio_pin_interrupt_configure(gpio_dev, TEST_PIN, GPIO_INT_LEVEL_INACTIVE)); zexpect_equal(registers.gpotr, 0, "gpotr=%x", registers.gpotr);