Lines Matching +full:device +full:- +full:id
2 * Copyright (c) 2022 Andrei-Edward Popa
4 * SPDX-License-Identifier: Apache-2.0
12 #include <zephyr/device.h>
22 static int reset_rpi_read_register(const struct device *dev, uint16_t offset, uint32_t *value) in reset_rpi_read_register()
24 const struct reset_rpi_config *config = dev->config; in reset_rpi_read_register()
25 uint32_t base_address = config->base_address; in reset_rpi_read_register()
27 switch (config->reg_width) { in reset_rpi_read_register()
38 return -EINVAL; in reset_rpi_read_register()
44 static int reset_rpi_write_register(const struct device *dev, uint16_t offset, uint32_t value) in reset_rpi_write_register()
46 const struct reset_rpi_config *config = dev->config; in reset_rpi_write_register()
47 uint32_t base_address = config->base_address; in reset_rpi_write_register()
49 switch (config->reg_width) { in reset_rpi_write_register()
60 return -EINVAL; in reset_rpi_write_register()
66 static int reset_rpi_status(const struct device *dev, uint32_t id, uint8_t *status) in reset_rpi_status() argument
68 const struct reset_rpi_config *config = dev->config; in reset_rpi_status()
74 offset = id / (config->reg_width * CHAR_BIT); in reset_rpi_status()
75 regbit = id % (config->reg_width * CHAR_BIT); in reset_rpi_status()
82 *status = !(value & BIT(regbit)) ^ !config->active_low; in reset_rpi_status()
87 static int reset_rpi_update(const struct device *dev, uint32_t id, uint8_t assert) in reset_rpi_update() argument
89 const struct reset_rpi_config *config = dev->config; in reset_rpi_update()
95 offset = id / (config->reg_width * CHAR_BIT); in reset_rpi_update()
96 regbit = id % (config->reg_width * CHAR_BIT); in reset_rpi_update()
103 if (assert ^ config->active_low) { in reset_rpi_update()
112 static int reset_rpi_line_assert(const struct device *dev, uint32_t id) in reset_rpi_line_assert() argument
114 return reset_rpi_update(dev, id, 1); in reset_rpi_line_assert()
117 static int reset_rpi_line_deassert(const struct device *dev, uint32_t id) in reset_rpi_line_deassert() argument
119 return reset_rpi_update(dev, id, 0); in reset_rpi_line_deassert()
122 static int reset_rpi_line_toggle(const struct device *dev, uint32_t id) in reset_rpi_line_toggle() argument
126 ret = reset_rpi_line_assert(dev, id); in reset_rpi_line_toggle()
131 return reset_rpi_line_deassert(dev, id); in reset_rpi_line_toggle()
134 static int reset_rpi_init(const struct device *dev) in reset_rpi_init()