<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Zephyr Device Driver Developement dynamic Power Management Hoo in Trigger_OWN_THREAD</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/122028/zephyr-device-driver-developement-dynamic-power-management-hoo-in-trigger_own_thread</link><description>Hi there, I&amp;#180;m totally new to Zephyr &amp;amp; Nordic, started with some Trainings on NRF52840DK and jumped in with a device driver developement where I took a availalbe out of Tree driver of nuvton, nau7802 and enhanced it to my purposes. 
 I took the the latest</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 05 Jun 2025 14:40:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/122028/zephyr-device-driver-developement-dynamic-power-management-hoo-in-trigger_own_thread" /><item><title>RE: Zephyr Device Driver Developement dynamic Power Management Hoo in Trigger_OWN_THREAD</title><link>https://devzone.nordicsemi.com/thread/538269?ContentTypeID=1</link><pubDate>Thu, 05 Jun 2025 14:40:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86edf0be-130d-4546-b360-cae95b1d7d02</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;#39;&amp;#39;I have not figured out a better way as using a method to start/stop the thread from normal_user and hook in with the&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;calls of&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;-&amp;nbsp;&lt;/span&gt;&lt;span&gt;pm_device_runtime_put&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;dev&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;-&amp;nbsp;&lt;/span&gt;&lt;span&gt;pm_device_runtime_get&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;dev&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;for powering up/down the nau7802 device.&amp;#39;&amp;#39;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;When the device runtime power management strategy is enabled on a device, it will go into the suspend state during the initialization process. Then, when the&amp;nbsp;&lt;strong&gt;device is to be used&lt;/strong&gt;, it is the device driver’s responsibility to notify the power management subsystem about this fact. This can be done using the&amp;nbsp;&lt;code&gt;&lt;a href="https://docs.nordicsemi.com/bundle/zephyr-apis-latest/page/group_subsys_pm_device_runtime.html#ga530d4be65757fb2276ab6f631953e045" rel="noopener noreferrer" target="_blank"&gt;pm_device_runtime_get()&lt;/a&gt;&lt;/code&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;function.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;When the device’s operation is complete and the device does not need to be in operational mode anymore, the device driver needs to notify the PM subsystem to let it put the device into the suspend state by calling&amp;nbsp;&lt;code&gt;&lt;a href="https://docs.nordicsemi.com/bundle/zephyr-apis-latest/page/group_subsys_pm_device_runtime.html#ga98daba53a992fb6bd2c2b31cb445844f" rel="noopener noreferrer" target="_blank"&gt;pm_device_runtime_put(&lt;/a&gt;).&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;So, your approach using&amp;nbsp;&lt;code dir="ltr"&gt;pm_device_runtime_get()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code dir="ltr"&gt;pm_device_runtime_put()&lt;/code&gt;&amp;nbsp;in your thread management logic—is valid and in accordance the with Zephyr’s intended device power management strategy (&lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-7-device-driver-dev/topic/exercise-2-adding-power-management-to-a-custom-driver/"&gt;https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-7-device-driver-dev/topic/exercise-2-adding-power-management-to-a-custom-driver/&lt;/a&gt;).&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>