This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: Polling GPIO pin from IO expander exits immediately before any activity on GPIO

Part Number: TDA4VM
Other Parts Discussed in Thread: TCA9539

We have an activity to read a GPIO pin using sysfs and poll routine.
The GPIO pin which we are trying to read is on gpio expander.
We have added relevant pinmux entry in k3-j721e-common-proc-board.dts file.

J721E_IOPAD(0x18c, PIN_INPUT,  7) /* (V23) RGMII6_RX_CTL.GPIO0_98*   IOEXP_INT#*/

Also added node from which button is connected on GPIO Expander in dtsi file.

            exp3: gpio@74 {
            compatible = "ti,tca9539";
            reg = <0x74>;
            gpio-controller;
            #gpio-cells = <2>;
        interrupt-parent = <&main_gpio0>;
        interrupts = <98 IRQ_TYPE_EDGE_FALLING>;
        interrupt-controller;
        #interrupt-cells = <2>;
       };


The poll() is not blocking if event is set as POLLIN.
It continuously throws POLLIN in revents, even when there is no change in gpio value.
If we set POLLPRI, the poll remains blocked forever.


char buffer[64];
    pFd.fd             = gpioValFd;
    pFd.events     = POLLIN;
read(gpioValFd, buffer, 64); /* Dummy read */
while (1)
   {
      char buffer[64];
      printf("Waiting at poll\n");
      poll(&pFd, 1, -1);
      if (pFd.revents & POLLIN)
      {
         lseek(pFd.fd, 0, SEEK_SET);
         read(pFd.fd, buffer, 64);
printf("buffer->%s\n",buffer);
      }
   }