drivers: gpio_adp5585: fix non-contiguous pin layout issue
Fixes #90988. The pin gap handling is wrong in the original code.
Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
(cherry picked from commit 41950cab0f)
This commit is contained in:
@@ -76,8 +76,7 @@ static int gpio_adp5585_config(const struct device *dev, gpio_pin_t pin, gpio_fl
|
||||
uint8_t reg_value;
|
||||
|
||||
/* ADP5585 has non-contiguous gpio pin layouts, account for this */
|
||||
if ((pin & cfg->common.port_pin_mask) == 0) {
|
||||
LOG_ERR("pin %d is invalid for this device", pin);
|
||||
if ((BIT(pin) & cfg->common.port_pin_mask) == 0) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
@@ -225,6 +224,11 @@ static int gpio_adp5585_port_write(const struct device *dev, gpio_port_pins_t ma
|
||||
uint8_t reg_value;
|
||||
int ret;
|
||||
|
||||
/* ADP5585 has non-contiguous gpio pin layouts, account for this */
|
||||
if ((mask & cfg->common.port_pin_mask) == 0) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
/* Can't do I2C bus operations from an ISR */
|
||||
if (k_is_in_isr()) {
|
||||
return -EWOULDBLOCK;
|
||||
@@ -288,8 +292,7 @@ static int gpio_adp5585_pin_interrupt_configure(const struct device *dev, gpio_p
|
||||
}
|
||||
|
||||
/* ADP5585 has non-contiguous gpio pin layouts, account for this */
|
||||
if ((pin & cfg->common.port_pin_mask) == 0) {
|
||||
LOG_ERR("pin %d is invalid for this device", pin);
|
||||
if ((BIT(pin) & cfg->common.port_pin_mask) == 0) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user