mirror of
https://github.com/apache/nuttx.git
synced 2026-05-25 09:45:55 +08:00
+11
-8
@@ -69,7 +69,7 @@ struct rptun_priv_s
|
||||
sem_t semrx;
|
||||
pid_t tid;
|
||||
#ifdef CONFIG_RPTUN_PM
|
||||
bool stay;
|
||||
struct pm_wakelock_s wakelock;
|
||||
uint16_t headrx;
|
||||
#endif
|
||||
};
|
||||
@@ -205,19 +205,20 @@ static inline void rptun_pm_action(FAR struct rptun_priv_s *priv,
|
||||
bool stay)
|
||||
{
|
||||
irqstate_t flags;
|
||||
int count;
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
if (stay && !priv->stay)
|
||||
count = pm_wakelock_staycount(&priv->wakelock);
|
||||
|
||||
if (stay && count == 0)
|
||||
{
|
||||
pm_stay(PM_IDLE_DOMAIN, PM_IDLE);
|
||||
priv->stay = true;
|
||||
pm_wakelock_stay(&priv->wakelock);
|
||||
}
|
||||
|
||||
if (!stay && priv->stay && !rptun_buffer_nused(&priv->rvdev, false))
|
||||
if (!stay && count > 0 && !rptun_buffer_nused(&priv->rvdev, false))
|
||||
{
|
||||
pm_relax(PM_IDLE_DOMAIN, PM_IDLE);
|
||||
priv->stay = false;
|
||||
pm_wakelock_relax(&priv->wakelock);
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
@@ -1063,7 +1064,9 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
|
||||
goto err_thread;
|
||||
}
|
||||
|
||||
/* Add priv to list */
|
||||
#ifdef CONFIG_RPTUN_PM
|
||||
pm_wakelock_init(&priv->wakelock, "rptun", PM_IDLE_DOMAIN, PM_IDLE);
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user