1 /* 2 * Copyright (c) 2022 Intel Corporation 3 * Copyright (c) 2025 Croxel Inc. 4 * Copyright (c) 2025 CogniPilot Foundation 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 #ifndef ZEPHYR_DRIVERS_SENSOR_BROADCOM_AFBR_S50_PLATFORM_H_ 10 #define ZEPHYR_DRIVERS_SENSOR_BROADCOM_AFBR_S50_PLATFORM_H_ 11 12 #include <zephyr/kernel.h> 13 #include <zephyr/drivers/gpio.h> 14 #include <zephyr/drivers/pinctrl.h> 15 #include <zephyr/rtio/rtio.h> 16 #include <zephyr/sys/slist.h> 17 18 #include <platform/argus_s2pi.h> 19 20 struct afbr_s50_platform_data { 21 struct { 22 argus_hnd_t *handle; 23 const uint8_t id; 24 } argus; 25 struct { 26 struct k_timer timer; 27 uint32_t interval_us; 28 void *param; 29 } timer; 30 struct { 31 atomic_t mode; 32 const struct pinctrl_dev_config *pincfg; 33 struct { 34 struct rtio_iodev *iodev; 35 struct rtio *ctx; 36 atomic_t state; 37 struct { 38 s2pi_callback_t handler; 39 void *data; 40 } callback; 41 } rtio; 42 struct { 43 struct gpio_callback cb; 44 s2pi_irq_callback_t handler; 45 void *data; 46 } irq; 47 struct { 48 struct { 49 const struct gpio_dt_spec *cs; 50 const struct gpio_dt_spec *clk; 51 const struct gpio_dt_spec *mosi; 52 const struct gpio_dt_spec *miso; 53 } spi; 54 const struct gpio_dt_spec * const irq; 55 } gpio; 56 } s2pi; 57 }; 58 59 struct afbr_s50_platform_init_node { 60 sys_snode_t node; 61 int (*init_fn)(struct afbr_s50_platform_data *data); 62 }; 63 64 void afbr_s50_platform_init_hooks_add(struct afbr_s50_platform_init_node *node); 65 66 int afbr_s50_platform_get_by_id(s2pi_slave_t slave, 67 struct afbr_s50_platform_data **data); 68 int afbr_s50_platform_get_by_hnd(argus_hnd_t *hnd, 69 struct afbr_s50_platform_data **data); 70 71 #endif /* ZEPHYR_DRIVERS_SENSOR_BROADCOM_AFBR_S50_PLATFORM_H_ */ 72