From 469357ce0cdb0ea6cd9f5be3a208c6e76ab5e14f Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Fri, 31 Jul 2026 11:52:18 +0200 Subject: [PATCH] gpio: Fix GPIO expanders warnings - ISO1H812G is *output* only expander, not input. - Warning make sense when we try to set the expander the wrong way. Signed-off-by: Jiri Vlasak --- drivers/ioexpander/iso1h812g.c | 11 ++++++++--- drivers/ioexpander/iso1i813t.c | 8 ++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/ioexpander/iso1h812g.c b/drivers/ioexpander/iso1h812g.c index c87ff278306..874488f939e 100644 --- a/drivers/ioexpander/iso1h812g.c +++ b/drivers/ioexpander/iso1h812g.c @@ -181,8 +181,8 @@ static void iso1h812g_deselect(FAR struct spi_dev_s *spi, * Name: iso1h812g_direction * * Description: - * ISO1H812G is only input pin. However interface is provided in order - * to avoid system falls if called. + * ISO1H812G is only output expander. However interface is provided in + * order to avoid system falls if called. * * Input Parameters: * dev - Device-specific state data @@ -201,7 +201,12 @@ static int iso1h812g_direction(FAR struct ioexpander_dev_s *dev, DEBUGASSERT(priv != NULL && priv->config != NULL); - gpiowarn("WARNING: ISO1H812G is only input expander!\n"); + if (IOEXPANDER_DIRECTION_IN == direction + || IOEXPANDER_DIRECTION_IN_PULLUP == direction + || IOEXPANDER_DIRECTION_IN_PULLDOWN == direction) + { + gpiowarn("WARNING: ISO1H812G is only output expander!\n"); + } return OK; } diff --git a/drivers/ioexpander/iso1i813t.c b/drivers/ioexpander/iso1i813t.c index 26018a3e8db..de265bb7600 100644 --- a/drivers/ioexpander/iso1i813t.c +++ b/drivers/ioexpander/iso1i813t.c @@ -180,7 +180,7 @@ static void iso1i813t_deselect(FAR struct spi_dev_s *spi, * Name: iso1i813t_direction * * Description: - * ISO1I813T is only input pin. However interface is provided in order + * ISO1I813T is only input expander. However interface is provided in order * to avoid system falls if called. * * Input Parameters: @@ -200,7 +200,11 @@ static int iso1i813t_direction(FAR struct ioexpander_dev_s *dev, DEBUGASSERT(priv != NULL && priv->config != NULL); - gpiowarn("WARNING: ISO1I813T is only input expander!\n"); + if (IOEXPANDER_DIRECTION_OUT == direction + || IOEXPANDER_DIRECTION_OUT_OPENDRAIN == direction) + { + gpiowarn("WARNING: ISO1I813T is only input expander!\n"); + } return OK; }