<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 23, 2017 at 7:46 AM, Rajasekhar Pulluru <span dir="ltr">&lt;<a href="mailto:pullururajasekhar@gmail.com" target="_blank">pullururajasekhar@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>I have a query on device tree pertaining to modelling a gpio pin as an interrupt source. </div><div>I have searched mailing list archives and kernel documentation before posting this and couldn&#39;t get any direct solution.</div><div>(My understanding is limited and hence posting the query below:)</div><div><br></div><div>My SOC has a gpio controller and uart both sharing same interrupt line as specified below. </div><div><br></div><div><span class="m_-7514866219543690092gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>interrupt-parent = &lt;&amp;gic&gt;;</div><div><br></div><div>        mygpio: gpio@0x19008000 {</div><div>                compatible = &quot;mysoc,mygpio-controller,gc&quot;;</div><div>                #address-cells = &lt;1&gt;;</div><div>                #size-cells = &lt;1&gt;;</div><div>                #gpio-cells = &lt;2&gt;;</div><div>                reg = gpio: &lt;0x19008000 0x50&gt;;</div><div>                ngpios = &lt;12&gt;;</div><div>                pin-offset = &lt;4&gt;;</div><div>                pin-base = &lt;4&gt;;</div><div>                irq-base = &lt;256&gt;; /* sw irq base for irq handlers */</div><div>                gpio-controller;</div><div>                interrupt-controller;</div><div>                interrupts = &lt;GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH&gt;;</div><div>        };</div><div><br></div><div>        uart0: serial@0x19000300 {</div><div>                compatible = &quot;snps,dw-apb-uart&quot;;</div><div>                reg = &lt;0x19000300 0x100&gt;;</div><div>                interrupts = &lt;GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH&gt;;</div><div>                clock-frequency = &lt;62500000&gt;;</div><div>        };</div><div><br></div><div>gpio pin 0 of mygpio is used as an interrupt source for detecting the presence of external pluggable device (that is not driven by kernel). </div><div>And I intend to detect the presence of the pluggable device from user space by means of generic uio platform driver using below device</div></div></blockquote><div><br></div><div>What do you intend to achieve by detecting device in userspace?<br></div><div>You can directly get notification using udev notification.<br><br></div><div>However, you need to send udev notification from a kernel driver.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>tree configuration. (following <a href="https://yurovsky.github.io/2014/10/10/linux-uio-gpio-interrupt/" target="_blank">https://yurovsky.github.io/<wbr>2014/10/10/linux-uio-gpio-<wbr>interrupt/</a>)</div><div><br></div><div>        user_io@0 {</div><div>            compatible = &quot;mydevice,generic-uio,ui_pdrv&quot;<wbr>;</div><div>            status = &quot;okay&quot;;</div><div>            interrupt-parent = &lt;&amp;mygpio&gt;;</div><div>            interrupts = &lt;0 IRQ_TYPE_LEVEL_HIGH&gt;;</div><div>        };</div><div><br></div><div>Running modprobe uio_pdrv_genirq of_id=&quot;mydevice,generic-uio,<wbr>ui_pdrv&quot; and creating /dev/uio0 using mknod (major number from cat /proc/devices | grep uio),</div><div>I couldn&#39;t see an irq entry bind to uio driver under /proc/interrupts.</div><div>Am I doing anything wrong here?</div><div><br></div><div>Other method I have tried to get notified of the gpio pin0 interrupt in user space is to poll on /sys/class/gpio/gpio0/value. But merely exporting gpio0 </div><div>wasn&#39;t sufficient as kernel should make a call to request_irq on the gpio0 interrupt line. Is there a generic driver framework (like pinctrl) that can export</div><div>a device node to register the gpio pin0 as an interrupt source that allows me to poll on its sysfs entry?</div></div></blockquote><div><br></div><div>All sysfs nodes can be polled as it is supported in kernel. <br></div><div>You can simply create a dummy driver and register the<br></div><div>irq and in your irq handler send udev notifications using<br></div><div>kobj.<br></div><div><br>Or<br></div><div>just update a sysfs node which can be polled from userspace.<br><br></div><div>If this answer is not sufficient then please explain in detail<br></div><div>what you are planning to achieve rather than what you are<br></div><div>doing to achieve that. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Thanks,</div><div>Rajasekhar</div></div>
<br>______________________________<wbr>_________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.<wbr>org</a><br>
<a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">https://lists.kernelnewbies.<wbr>org/mailman/listinfo/<wbr>kernelnewbies</a><br>
<br></blockquote></div><br></div></div>