Lines Matching +full:window +full:- +full:mode

3  * SPDX-License-Identifier: Apache-2.0
14 #include <zephyr/dt-bindings/gpio/nordic-npm1300-gpio.h>
42 const struct wdt_npm1300_config *config = dev->config; in wdt_npm1300_setup()
43 struct wdt_npm1300_data *data = dev->data; in wdt_npm1300_setup()
45 if (!data->timeout_valid) { in wdt_npm1300_setup()
46 return -EINVAL; in wdt_npm1300_setup()
49 return mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_START, 1U); in wdt_npm1300_setup()
54 const struct wdt_npm1300_config *config = dev->config; in wdt_npm1300_disable()
55 struct wdt_npm1300_data *data = dev->data; in wdt_npm1300_disable()
58 ret = mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_STOP, 1U); in wdt_npm1300_disable()
63 data->timeout_valid = false; in wdt_npm1300_disable()
71 const struct wdt_npm1300_config *config = dev->config; in wdt_npm1300_install_timeout()
72 struct wdt_npm1300_data *data = dev->data; in wdt_npm1300_install_timeout()
73 uint8_t mode; in wdt_npm1300_install_timeout() local
76 if (data->timeout_valid) { in wdt_npm1300_install_timeout()
77 return -ENOMEM; in wdt_npm1300_install_timeout()
80 if (timeout->window.min != 0U) { in wdt_npm1300_install_timeout()
81 return -EINVAL; in wdt_npm1300_install_timeout()
84 ret = mfd_npm1300_set_timer(config->mfd, timeout->window.max); in wdt_npm1300_install_timeout()
89 switch (timeout->flags & WDT_FLAG_RESET_MASK) { in wdt_npm1300_install_timeout()
92 mode = TIME_MODE_GEN; in wdt_npm1300_install_timeout()
96 mode = TIME_MODE_WARN; in wdt_npm1300_install_timeout()
100 mode = TIME_MODE_RESET; in wdt_npm1300_install_timeout()
103 return -EINVAL; in wdt_npm1300_install_timeout()
106 ret = mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_MODE, mode); in wdt_npm1300_install_timeout()
111 data->timeout_valid = true; in wdt_npm1300_install_timeout()
118 const struct wdt_npm1300_config *config = dev->config; in wdt_npm1300_feed()
121 return -EINVAL; in wdt_npm1300_feed()
124 return mfd_npm1300_reg_write(config->mfd, TIME_BASE, TIME_OFFSET_WDOG_KICK, 1U); in wdt_npm1300_feed()
136 const struct wdt_npm1300_config *config = dev->config; in wdt_npm1300_init()
139 if (!device_is_ready(config->mfd)) { in wdt_npm1300_init()
140 return -ENODEV; in wdt_npm1300_init()
143 if (config->reset_gpios.port != NULL) { in wdt_npm1300_init()
144 if (!gpio_is_ready_dt(&config->reset_gpios)) { in wdt_npm1300_init()
145 return -ENODEV; in wdt_npm1300_init()
148 ret = gpio_pin_configure_dt(&config->reset_gpios, NPM1300_GPIO_WDT_RESET_ON); in wdt_npm1300_init()