Skip to content

Commit 022c8ee

Browse files
AlessandroLuodkalowsk
authored andcommitted
drivers: gpio: ambiq: fix port status get error
It's not possible to get pinconfig of specific pin in ambiq_gpio_port_get_raw function, change to use OR value of RD and WT registers for one group of gpio. Signed-off-by: Hao Luo <[email protected]>
1 parent 4e5df11 commit 022c8ee

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

drivers/gpio/gpio_ambiq.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -270,22 +270,14 @@ static int ambiq_gpio_port_get_direction(const struct device *dev, gpio_port_pin
270270
static int ambiq_gpio_port_get_raw(const struct device *dev, gpio_port_value_t *value)
271271
{
272272
const struct ambiq_gpio_config *const dev_cfg = dev->config;
273-
am_hal_gpio_pincfg_t pincfg;
274273
uint32_t pin_offset;
275274

276275
#if defined(CONFIG_SOC_SERIES_APOLLO3X)
277276
pin_offset = dev_cfg->offset;
278-
am_hal_gpio_pinconfig_get(pin_offset, &pincfg);
279-
if (pincfg.eGPInput == AM_HAL_GPIO_PIN_INPUT_ENABLE) {
280277
#else
281278
pin_offset = dev_cfg->offset >> 2;
282-
am_hal_gpio_pinconfig_get(pin_offset, &pincfg);
283-
if (pincfg.GP.cfg_b.eGPInput == AM_HAL_GPIO_PIN_INPUT_ENABLE) {
284279
#endif
285-
*value = (*AM_HAL_GPIO_RDn(pin_offset));
286-
} else {
287-
*value = (*AM_HAL_GPIO_WTn(pin_offset));
288-
}
280+
*value = (*AM_HAL_GPIO_RDn(pin_offset)) | (*AM_HAL_GPIO_WTn(pin_offset));
289281

290282
return 0;
291283
}

0 commit comments

Comments
 (0)