mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
+11
-8
@@ -69,7 +69,7 @@ struct rptun_priv_s
|
|||||||
sem_t semrx;
|
sem_t semrx;
|
||||||
pid_t tid;
|
pid_t tid;
|
||||||
#ifdef CONFIG_RPTUN_PM
|
#ifdef CONFIG_RPTUN_PM
|
||||||
bool stay;
|
struct pm_wakelock_s wakelock;
|
||||||
uint16_t headrx;
|
uint16_t headrx;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -205,19 +205,20 @@ static inline void rptun_pm_action(FAR struct rptun_priv_s *priv,
|
|||||||
bool stay)
|
bool stay)
|
||||||
{
|
{
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
int count;
|
||||||
|
|
||||||
flags = enter_critical_section();
|
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);
|
pm_wakelock_stay(&priv->wakelock);
|
||||||
priv->stay = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
pm_wakelock_relax(&priv->wakelock);
|
||||||
priv->stay = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
@@ -1063,7 +1064,9 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
|
|||||||
goto err_thread;
|
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;
|
return OK;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user