Is there a way to setup device tree to use a pin for UART and as GPIO?

I am interfacing with a part that uses the same pin, P0.6, for two purposes:

1) The pin is used for UART communication.  MCU RX input.

2) The pin is used as a GPIO.  MCU GPIO output.

I am using runtime power management.  What I would like is that when the UART driver is in the default state then the pin is connected to the UART.  When the UART driver is in the sleep state then the pin is used as a GPIO.  Is this possible?

What I have right now in my dts as a (incorrect) starting point is:

arduino_serial: &uart0 {
  pinctrl-0 = <&uart0_default>;
  pinctrl-1 = <&uart0_sleep>;
  pinctrl-names = "default", "sleep";
...
};
 
uart0_default: uart0_default {
  group1 {
    psels = <NRF_PSEL(UART_RX, 0, 6)>;
    bias-pull-up;
  };
  group2 {
    psels = <NRF_PSEL(UART_TX, 0, 20)>;
  };
};
uart0_sleep: uart0_sleep {
  group1 {
    psels = <NRF_PSEL(UART_RX, 0, 6)>, <NRF_PSEL(UART_TX, 0, 20)>;
    low-power-enable;
  };
};
interface_ctl {
  compatible = "gpio-leds";
  uart_log_txd: uart_log_txd {
    gpios = <&gpio0 6 GPIO_PULL_UP>;
    label = "UART LOG TXD";
  };
};
Related