jtag: linuxgpiod: fix detection for line request bias
Commit290eac04b9("drivers/linuxgpiod: Migrate to adapter gpio commands") introduced an incorrect check to determine if the library libgpiod declares the line request flags: GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_DOWN The names above are declared by the library inside an enum, thus cannot be used by the C preprocessor in a #ifdef. Determine in configure if the version of libgpiod provides the line request flags for "bias" and define a C macro. Use the new macro in the driver code. Change-Id: Iaa452230f4753fce4c6e9daa254299cedb7cab7f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes:290eac04b9("drivers/linuxgpiod: Migrate to adapter gpio commands") Reviewed-on: https://review.openocd.org/c/openocd/+/8186 Tested-by: jenkins Reviewed-by: Michael Heimpold <michaheimpold@gmail.com>
This commit is contained in:
@@ -320,12 +320,12 @@ static int helper_get_line(enum adapter_gpio_config_index idx)
|
||||
|
||||
switch (adapter_gpio_config[idx].pull) {
|
||||
case ADAPTER_GPIO_PULL_NONE:
|
||||
#ifdef GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE
|
||||
#ifdef HAVE_LIBGPIOD1_FLAGS_BIAS
|
||||
flags |= GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE;
|
||||
#endif
|
||||
break;
|
||||
case ADAPTER_GPIO_PULL_UP:
|
||||
#ifdef GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP
|
||||
#ifdef HAVE_LIBGPIOD1_FLAGS_BIAS
|
||||
flags |= GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP;
|
||||
#else
|
||||
LOG_WARNING("linuxgpiod: ignoring request for pull-up on %s: not supported by gpiod v%s",
|
||||
@@ -333,7 +333,7 @@ static int helper_get_line(enum adapter_gpio_config_index idx)
|
||||
#endif
|
||||
break;
|
||||
case ADAPTER_GPIO_PULL_DOWN:
|
||||
#ifdef GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_DOWN
|
||||
#ifdef HAVE_LIBGPIOD1_FLAGS_BIAS
|
||||
flags |= GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_DOWN;
|
||||
#else
|
||||
LOG_WARNING("linuxgpiod: ignoring request for pull-down on %s: not supported by gpiod v%s",
|
||||
|
||||
Reference in New Issue
Block a user