diff options
| author | David Barksdale <amatus@amat.us> | 2025-07-11 10:45:25 -0500 |
|---|---|---|
| committer | David Barksdale <amatus@amat.us> | 2025-07-11 10:45:25 -0500 |
| commit | 982a528d9089bf551a8b49aeb1342c376a75026f (patch) | |
| tree | f72be12dce8c47040c5edc24b09af7afbcd9fb68 | |
| parent | 88ac3f9423feebf200040a5d35c091b3e91fd96d (diff) | |
GPIO config is input upon enablerpi-mipi
| -rw-r--r-- | drivers/spi/spi-sc18is602.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c index edd418ff02e2..bcd9742b1b24 100644 --- a/drivers/spi/spi-sc18is602.c +++ b/drivers/spi/spi-sc18is602.c @@ -365,13 +365,20 @@ static void sc18is602_gpio_set(struct gpio_chip *gc, unsigned int offset, int va static int sc18is602_gpio_request(struct gpio_chip *gc, unsigned int offset) { struct sc18is602 *hw = gpiochip_get_data(gc); + u8 enable_bits; int ret; mutex_lock(&hw->gpio_lock); /* Enable GPIO mode for this pin */ - hw->gpio_enable |= BIT(offset); + enable_bits = hw->gpio_enable; + enable_bits |= BIT(offset); ret = i2c_smbus_write_byte_data(hw->client, SC18IS602_REG_GPIO_ENABLE, hw->gpio_enable); + if (ret >= 0) { + hw->gpio_enable = enable_bits; + hw->gpio_config &= ~(0x3 << (offset * 2)); + hw->gpio_config |= SC18IS602_GPIO_CONF_INPUT_ONLY << (offset * 2); + } mutex_unlock(&hw->gpio_lock); return ret; |
