3 Replies Latest reply on Aug 29, 2014 2:58 AM by Simba

    Interrupt pins & Driver registration in Linux kernel


      What are the GPIO numbers for interrupts 0,1 [ Pins IO2, IO3  ] to be mentioned in linux kernel during driver registration?


      I intend to interface a hardware with the Galileo on SPI 1 interface, and I see that I need to register it as a SPI platform driver in the galileo platform file "Intel_qrk_plat_galileo.c", in structure spi_board_info.

      Even though I have been referring to Galileo I/O Mappings doc, I am confused in initializing the interrupt pin [irq] during the driver probe.


      Shall I initialize with 14 or 15 [for int 0 or 1 ] as given under Linux column of the above mentioned document? if so "gpio_cs" variable of the SPI master controller is initialized with values 8, 10 for respective SPI's [0,1] when the SP1_SS_B is available on IO10, with value 16 in the linux column hence I am confused with these numbers.


      I am on BSP v1.0.0, LSB image, using BSP user guide & Sergey's blog info for building.




        • 1. Re: Interrupt pins & Driver registration in Linux kernel

          If all you want to do is interface to an SPI peripheral, why mess with interrupts and drivers?

          Galileo's linux has good, standard, user-mode SPI libraries and I use them to interface to my LED Matrix which has 3 SPI devices on board.


          Attached is the entire source code for a test version of my LED Matrix, it shows setting up the GPIO and Accessing SPI from C code on Galileo.


          I hope this helps.



          • 2. Re: Interrupt pins & Driver registration in Linux kernel

            Hi Kenny,

            Thanks for the head's up on availability of "spidev" module, I am looking into that.

            My intentions are to build a real time data acquisition system, the driver code for my hardware is already in the main line, so I need not have to write a user space interface for the hardware. Hardware sends a signal on availability of data, in userspace I might have a setup a poll or similar methods, instead I would prefer a driver taking care of all these.



            • 3. Re: Interrupt pins & Driver registration in Linux kernel

              Refer to Galileo I/O Mappings documents to figure out which GPIO is being user,

              Use functions like gpio_request_one() or gpio_request_array() [in case of a single / multiple gpio(s) ] to allocate the GPIO's first, then use irq = gpio_to_irq(gpioX) function to get the IRQ number associated with the GPIO-x.