<?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 Re: Using gpio led triggers in device tree in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Using-gpio-led-triggers-in-device-tree/m-p/735398#M114451</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bryce,&lt;/P&gt;&lt;P&gt;AFAIK there is no led trigger GPIO and the idea behind LED triggers is to avoid userspace application to handle them. In case of of blinking try to use the LED trigger "timer" for a periodic one or "heartbeat" which is related to the system load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Always look at the binding documents for more information:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://elixir.free-electrons.com/linux/latest/source/Documentation/devicetree/bindings/leds/common.txt" title="http://elixir.free-electrons.com/linux/latest/source/Documentation/devicetree/bindings/leds/common.txt"&gt;linux/Documentation/devicetree/bindings/leds/common.txt - Elixir - Free Electrons&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Dec 2017 17:11:22 GMT</pubDate>
    <dc:creator>lategoodbye</dc:creator>
    <dc:date>2017-12-20T17:11:22Z</dc:date>
    <item>
      <title>Using gpio led triggers in device tree</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Using-gpio-led-triggers-in-device-tree/m-p/735395#M114448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working with a imx6ull custom board.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Was there a way to specify trigger parameters in the devicetree?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example I'll like gpio 122 to trigger the led to blink.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current DT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;leds {
 pinctrl-names = "default";
 pinctrl-0 = &amp;lt;&amp;amp;pinctrl_led&amp;gt;;
 compatible = "gpio-leds"; 
 led_wwan {
 label = "led_wwan";
 gpios = &amp;lt;&amp;amp;gpio2 4 GPIO_ACTIVE_LOW&amp;gt;;
};&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the userspace I can do this to make it work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;echo gpio &amp;gt; /sys/class/leds/led_wwan
echo 122 &amp;gt;&amp;nbsp;echo gpio &amp;gt; /sys/class/leds/led_wwan&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding trigger to DT:&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;leds {
pinctrl-names = "default";
pinctrl-0 = &amp;lt;&amp;amp;pinctrl_led&amp;gt;;
compatible = "gpio-leds";&amp;nbsp;
led_wwan {
label = "led_wwan";
gpios = &amp;lt;&amp;amp;gpio2 4 GPIO_ACTIVE_LOW&amp;gt;;
linux,default-trigger = "gpio";
};&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I set the 122 in the device tree or would I need to always do it in userland with&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;echo 122 &amp;gt; /sys/class/leds/led_wwan‍‍/gpio&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Dec 2017 17:51:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Using-gpio-led-triggers-in-device-tree/m-p/735395#M114448</guid>
      <dc:creator>brycejohnson</dc:creator>
      <dc:date>2017-12-19T17:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using gpio led triggers in device tree</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Using-gpio-led-triggers-in-device-tree/m-p/735396#M114449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi bryce&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no, seems there is no way to set gpio value from dts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Dec 2017 08:09:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Using-gpio-led-triggers-in-device-tree/m-p/735396#M114449</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2017-12-20T08:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using gpio led triggers in device tree</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Using-gpio-led-triggers-in-device-tree/m-p/735397#M114450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for checking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There appeared to be some work in that area from these posts:&amp;nbsp;&lt;A class="link-titled" href="https://www.spinics.net/lists/linux-leds/msg07702.html" title="https://www.spinics.net/lists/linux-leds/msg07702.html"&gt;[PATCH 1/4] dt-bindings: leds: document property for LED triggers — Linux LEDS Development&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I didn't see any of that in the stuff I am using, so I assume it uses a later version or didn't get pull in to the kernel.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Dec 2017 15:07:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Using-gpio-led-triggers-in-device-tree/m-p/735397#M114450</guid>
      <dc:creator>brycejohnson</dc:creator>
      <dc:date>2017-12-20T15:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using gpio led triggers in device tree</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Using-gpio-led-triggers-in-device-tree/m-p/735398#M114451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bryce,&lt;/P&gt;&lt;P&gt;AFAIK there is no led trigger GPIO and the idea behind LED triggers is to avoid userspace application to handle them. In case of of blinking try to use the LED trigger "timer" for a periodic one or "heartbeat" which is related to the system load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Always look at the binding documents for more information:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://elixir.free-electrons.com/linux/latest/source/Documentation/devicetree/bindings/leds/common.txt" title="http://elixir.free-electrons.com/linux/latest/source/Documentation/devicetree/bindings/leds/common.txt"&gt;linux/Documentation/devicetree/bindings/leds/common.txt - Elixir - Free Electrons&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Dec 2017 17:11:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Using-gpio-led-triggers-in-device-tree/m-p/735398#M114451</guid>
      <dc:creator>lategoodbye</dc:creator>
      <dc:date>2017-12-20T17:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using gpio led triggers in device tree</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Using-gpio-led-triggers-in-device-tree/m-p/735399#M114452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stefan,&lt;/P&gt;&lt;P&gt;For my use case, I need to pass through a signal to blink an LED.&amp;nbsp; I could constantly poll the input and set LED, but the trigger for GPIO seems to work much better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In at least the 4.9.11 kernel in the LED Trigger support you can enable LED GPIO Trigger.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then for the leds I get these triggers:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cat /sys/class/leds/led_wwan/trigger&lt;BR /&gt;none kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock mmc1 timer oneshot heartbeat [gpio] default-on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will set up the trigger with gpio 122 as a input:&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11pt; color: #000000; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;echo gpio &amp;gt; /sys/class/leds/led_wwan/trigger &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11pt; color: #000000; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;echo 122 &amp;gt; /sys/class/leds/led_wwan/gpio&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11pt; color: #000000; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;When GPIO 122 see a high signal it will turn the LED on and low signal turns it off.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11pt; color: #000000; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;I thought there might be a way to see the 122 in the device tree, but currently there is not.&amp;nbsp; I can set it up after boot.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11pt; color: #000000; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0pt; margin-bottom: 0pt;"&gt;&lt;SPAN style="font-size: 11pt; color: #000000; background-color: transparent; font-weight: 400; text-decoration: none;"&gt;Bryce&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Dec 2017 17:27:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Using-gpio-led-triggers-in-device-tree/m-p/735399#M114452</guid>
      <dc:creator>brycejohnson</dc:creator>
      <dc:date>2017-12-20T17:27:51Z</dc:date>
    </item>
  </channel>
</rss>

