Lines Matching +full:dead +full:- +full:battery
3 * SPDX-License-Identifier: Apache-2.0
37 /** Boolean value whether to use high-voltage source if true or 5V source if false */
63 const struct nx20p3483_cfg *cfg = dev->config; in read_reg()
66 ret = i2c_reg_read_byte(cfg->bus.bus, cfg->bus.addr, reg, value); in read_reg()
77 const struct nx20p3483_cfg *cfg = dev->config; in write_reg()
80 ret = i2c_reg_write_byte(cfg->bus.bus, cfg->bus.addr, reg, value); in write_reg()
94 return -EINVAL; in nx20p3483_set_snk_ovp_limit()
170 const struct nx20p3483_cfg *cfg = dev->config; in nx20p3483_set_vbus_sink()
177 return nx20p3483_set_snk_ovp_limit(dev, cfg->snk_ovp_thresh); in nx20p3483_set_vbus_sink()
204 struct nx20p3483_data *data = dev->data; in nx20p3483_set_event_handler()
206 data->event_cb = handler; in nx20p3483_set_event_handler()
207 data->event_cb_data = handler_data; in nx20p3483_set_event_handler()
214 const struct nx20p3483_cfg *cfg = dev->config; in nx20p3483_dump_regs()
217 LOG_INF("NX20P alert: %d", gpio_pin_get(cfg->irq_gpio.port, cfg->irq_gpio.pin)); in nx20p3483_dump_regs()
218 LOG_INF("PPC %s:%s registers:", cfg->bus.bus->name, dev->name); in nx20p3483_dump_regs()
220 i2c_reg_read_byte(cfg->bus.bus, cfg->bus.addr, a, &val); in nx20p3483_dump_regs()
223 LOG_INF("- [%s] = 0x%02x", nx20p3483_reg_names[a], val); in nx20p3483_dump_regs()
225 LOG_INF("- [%02x] = 0x%02x", a, val); in nx20p3483_dump_regs()
251 return -EINVAL; in nx20p3483_set_src_ovc_limit()
257 return -EINVAL; in nx20p3483_set_src_ovc_limit()
276 struct nx20p3483_data *data = dev->data; in nx20p3483_send_event()
278 if (data->event_cb != NULL) { in nx20p3483_send_event()
279 data->event_cb(dev, data->event_cb_data, ev); in nx20p3483_send_event()
288 k_work_submit(&data->irq_work); in nx20p3483_irq_handler()
294 const struct device *dev = data->dev; in nx20p3483_irq_worker()
310 if (data->event_cb == NULL) { in nx20p3483_irq_worker()
316 LOG_INF("PPC dead battery exit failed"); in nx20p3483_irq_worker()
370 const struct nx20p3483_cfg *cfg = dev->config; in nx20p3483_dev_init()
371 struct nx20p3483_data *data = dev->data; in nx20p3483_dev_init()
378 ret = gpio_pin_configure(cfg->irq_gpio.port, cfg->irq_gpio.pin, GPIO_INPUT | GPIO_PULL_UP); in nx20p3483_dev_init()
383 ret = gpio_pin_interrupt_configure(cfg->irq_gpio.port, cfg->irq_gpio.pin, in nx20p3483_dev_init()
389 gpio_init_callback(&data->irq_cb, nx20p3483_irq_handler, BIT(cfg->irq_gpio.pin)); in nx20p3483_dev_init()
390 ret = gpio_add_callback(cfg->irq_gpio.port, &data->irq_cb); in nx20p3483_dev_init()
396 k_work_init(&data->irq_work, nx20p3483_irq_worker); in nx20p3483_dev_init()
397 k_work_submit(&data->irq_work); in nx20p3483_dev_init()
401 if (cfg->src_use_hv) { in nx20p3483_dev_init()
410 ret = nx20p3483_set_snk_ovp_limit(dev, cfg->snk_ovp_thresh); in nx20p3483_dev_init()
415 ret = nx20p3483_set_src_ovc_limit(dev, cfg->src_5v_ocp_thresh, cfg->src_hv_ocp_thresh); in nx20p3483_dev_init()