<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic libgpiod with Linux gpio-imx-rpmsg.c driver in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1352813#M181288</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Is there anyone familiar with&amp;nbsp;gpio-imx-rpmsg.c driver, { .compatible = "fsl,imx-rpmsg-gpio" }? Perhaps not, since it is demonstrated only with i.MX7ULP, forums search doesn't give a lot of hits.&lt;/P&gt;&lt;P&gt;Is that driver supposed to work with libgpiod? I'm using kernel 5.4.x. gpioget shell command works, gpioset command works as well , gpiomon doesn't work:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# gpiomon gpiochip8 16
gpiomon: error waiting for events: No such device&lt;/LI-CODE&gt;&lt;P&gt;As well sysfs doesn't list "edge" file here&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# echo 272 &amp;gt; /sys/class/gpio/export
# ls /sys/class/gpio/gpio272
active_low  device      power       suppliers   value
consumers   direction   subsystem   uevent&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"edge" is present with i.MX7D native GPIO driver:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# echo 176 &amp;gt; /sys/class/gpio/export
root@rcserv:~# ls /sys/class/gpio/gpio176
active_low  device      edge        subsystem   uevent
consumers   direction   power       suppliers   value&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;</description>
    <pubDate>Fri, 08 Oct 2021 16:35:58 GMT</pubDate>
    <dc:creator>kef2</dc:creator>
    <dc:date>2021-10-08T16:35:58Z</dc:date>
    <item>
      <title>libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1352813#M181288</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Is there anyone familiar with&amp;nbsp;gpio-imx-rpmsg.c driver, { .compatible = "fsl,imx-rpmsg-gpio" }? Perhaps not, since it is demonstrated only with i.MX7ULP, forums search doesn't give a lot of hits.&lt;/P&gt;&lt;P&gt;Is that driver supposed to work with libgpiod? I'm using kernel 5.4.x. gpioget shell command works, gpioset command works as well , gpiomon doesn't work:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# gpiomon gpiochip8 16
gpiomon: error waiting for events: No such device&lt;/LI-CODE&gt;&lt;P&gt;As well sysfs doesn't list "edge" file here&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# echo 272 &amp;gt; /sys/class/gpio/export
# ls /sys/class/gpio/gpio272
active_low  device      power       suppliers   value
consumers   direction   subsystem   uevent&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"edge" is present with i.MX7D native GPIO driver:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# echo 176 &amp;gt; /sys/class/gpio/export
root@rcserv:~# ls /sys/class/gpio/gpio176
active_low  device      edge        subsystem   uevent
consumers   direction   power       suppliers   value&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 16:35:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1352813#M181288</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2021-10-08T16:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1352884#M181291</link>
      <description>&lt;P&gt;to_irq is missing in the driver. With copy paste from other driver gpiomon seems waiting, proper RPMSG request seems being sent along with launch of gpiomon. Need to fix M4 part to make both parts working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;diff --git a/drivers/gpio/gpio-imx-rpmsg.c b/drivers/gpio/gpio-imx-rpmsg.c
index 418455f..4abbabb 100644
--- a/drivers/gpio/gpio-imx-rpmsg.c
+++ b/drivers/gpio/gpio-imx-rpmsg.c
@@ -310,6 +310,13 @@ static void imx_rpmsg_mask_irq(struct irq_data *d)
 	/* No need to implement the callback */
 }
 
+static int imx_rpmsg_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
+{
+	struct imx_rpmsg_gpio_port *port = gpiochip_get_data(gc);
+
+	return irq_find_mapping(port-&amp;gt;domain, offset);
+}
+
 static struct irq_chip imx_rpmsg_irq_chip = {
 	.irq_mask = imx_rpmsg_mask_irq,
 	.irq_unmask = imx_rpmsg_unmask_irq,
@@ -337,6 +344,7 @@ static int imx_rpmsg_gpio_probe(struct platform_device *pdev)
 	gc = &amp;amp;port-&amp;gt;gc;
 	gc-&amp;gt;of_node = np;
 	gc-&amp;gt;parent = dev;
+	gc-&amp;gt;to_irq = imx_rpmsg_gpio_to_irq;
 	gc-&amp;gt;label = "imx-rpmsg-gpio";
 	gc-&amp;gt;ngpio = IMX_RPMSG_GPIO_PER_PORT;
 	gc-&amp;gt;base = of_alias_get_id(np, "gpio") * IMX_RPMSG_GPIO_PER_PORT;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: as well "edge" file is present using GPIO sysfs.&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 21:40:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1352884#M181291</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2021-10-08T21:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1353119#M181312</link>
      <description>&lt;P&gt;Hi Edward&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks for sharing patch, you are right by default gpio-imx-rpmsg driver is not supposed to work with libgpiod.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2021 09:19:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1353119#M181312</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2021-10-10T09:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1353130#M181314</link>
      <description>&lt;P&gt;Hi Igor,&lt;/P&gt;&lt;P&gt;Indeed it doesn't matter, libgpiod or sysfs+poll(). RPMSG GPIO interrupts are documented ... but not implemented.&lt;/P&gt;&lt;P&gt;&lt;A href="https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/gpio/gpio-imx-rpmsg.c?h=rel_imx_5.4.70_2.3.2" target="_blank" rel="noopener"&gt;gpio-imx-rpmsg.c\gpio\drivers - linux-imx - i.MX Linux kernel (codeaurora.org)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here's RPMSG callback with TBD:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;static int gpio_rpmsg_cb(struct rpmsg_device *rpdev,
	void *data, int len, void *priv, u32 src)
{
	struct gpio_rpmsg_data *msg = (struct gpio_rpmsg_data *)data;

	if (msg-&amp;gt;header.type == GPIO_RPMSG_REPLY) {
		gpio_rpmsg.reply_msg = msg;
		complete(&amp;amp;gpio_rpmsg.cmd_complete);
	} else if (msg-&amp;gt;header.type == GPIO_RPMSG_NOTIFY) {
		gpio_rpmsg.notify_msg = msg;
		/* TBD for interrupt handler */
	} else
		dev_err(&amp;amp;gpio_rpmsg.rpdev-&amp;gt;dev, "wrong command type!\n");

	return 0;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Replacing TBD with generic_handle_irq() with right arguments make interrupts working. Both libgpiod and sysfs.&lt;/P&gt;&lt;P&gt;Perhaps complete version of driver is lost somewhere? It's of course good to write documentation first and then implement according to documentation. But, hm, I'd prefer both complete and working :-). As I understand iMX7ULP EVK doesn't use RPMSG GPIO interrupts, buttons are used by RPMSG keyboard driver.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 16:55:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1353130#M181314</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2021-11-12T16:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1370761#M182987</link>
      <description>"Replacing TBD with generic_handle_irq() with right arguments make interrupts working. Both libgpiod and sysfs." What are the right arguments if I may ask? &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;</description>
      <pubDate>Fri, 12 Nov 2021 16:18:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1370761#M182987</guid>
      <dc:creator>nxf77080</dc:creator>
      <dc:date>2021-11-12T16:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1370762#M182988</link>
      <description>"Replacing TBD with generic_handle_irq() with right arguments make interrupts working. Both libgpiod and sysfs."

What are the right arguments?  &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;  Thanks in advance.</description>
      <pubDate>Fri, 12 Nov 2021 16:21:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1370762#M182988</guid>
      <dc:creator>nxf77080</dc:creator>
      <dc:date>2021-11-12T16:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1370764#M182989</link>
      <description>Oops...did not see the patch.  Thanks so much!!!</description>
      <pubDate>Fri, 12 Nov 2021 16:22:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1370764#M182989</guid>
      <dc:creator>nxf77080</dc:creator>
      <dc:date>2021-11-12T16:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1370779#M182990</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/193463"&gt;@nxf77080&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that patch above was only to fix missing interrupt `edge` file. See attached whole driver source file after additional mods. Interrupts and IO seem working well. Would be nice to get rid of static gpio_rpmsg struct, I've no time for it&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 17:06:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1370779#M182990</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2021-11-12T17:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1374645#M183333</link>
      <description>Hi kef2, Where is the corresponding M4 FreeRTOS application? Thanks in advance. Best Regards, Rob</description>
      <pubDate>Sun, 21 Nov 2021 12:50:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1374645#M183333</guid>
      <dc:creator>nxf77080</dc:creator>
      <dc:date>2021-11-21T12:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1374648#M183335</link>
      <description>&lt;P&gt;As a NXP employee you should know much better than me where to get examples for corresponding Cortex-M code. It was quite hard to get answer: get MCUXpresso SDK for i.MX7ULP.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 19:18:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1374648#M183335</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2021-11-21T19:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1374649#M183336</link>
      <description>&lt;P&gt;Yep, have the SDK. &amp;nbsp;Thought maybe you had made mods to the M4 side.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 19:24:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1374649#M183336</guid>
      <dc:creator>nxf77080</dc:creator>
      <dc:date>2021-11-21T19:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1374919#M183358</link>
      <description>&lt;P&gt;Of course I had to shave tons of codes unsuitable for i.MX7D code, I can't share it.&lt;/P&gt;&lt;P&gt;GPIO interrupts already are implemented in SDK. Cortex-M GPIO interrupt handler includes SRTM_IoService_NotifyInputEvent() call. This call is used to signal GPIO interrupt over RPMSG. This works well with edge sensitive interrupts. Level sensitive interrupts should limit reporting rate, else RPMSG queue may overflow. It should be implemented on Cortex-M.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 09:26:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1374919#M183358</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2021-11-22T09:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: libgpiod with Linux gpio-imx-rpmsg.c driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1375047#M183372</link>
      <description>&lt;P&gt;Thanks. &amp;nbsp;I figured some rate limiting would have to be employed on the M4 side for level sensitive interrupts.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Rob&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 13:27:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/libgpiod-with-Linux-gpio-imx-rpmsg-c-driver/m-p/1375047#M183372</guid>
      <dc:creator>nxf77080</dc:creator>
      <dc:date>2021-11-22T13:27:22Z</dc:date>
    </item>
  </channel>
</rss>

