Commit Graph

304 Commits

Author SHA1 Message Date
xuxingliang d655569a7c cmake: add newly added sources to cmake
These newly added files are missing from cmake.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-14 17:19:45 +08:00
yintao 37a30023f5 nuttx/drivers: add ept_release_cb for destroy server resource
use ept_release_cb to destory rpmsg services server dile resource
to avoid the used-after-free issue

Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-10 08:44:29 +08:00
buxiasen 264252497c pm: fix pm_wakelock_uninit api block, wd api need irq not disabled
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-09 23:31:49 +08:00
dongjiuzhu1 a005f4bff1 drivers/power: using baterr/batinfo to avoid frequency log output
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-10-09 23:31:49 +08:00
zhangshengchao e26a01d9a6 regulator:add bypass logic when registering
do not control regulators when set bypass flag

Signed-off-by: zhangshengchao <zhangshengchao@xiaomi.com>
2024-10-09 23:31:49 +08:00
liwenxiang1 0647b49990 drivers/battery: Fix Goldfish Battery x64 unresponsive interrupt issue
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-09 18:32:29 +08:00
Bowen Wang 064eb5fd35 rpmsg services: should release the tx buffer when rpmsg_send_nocopy failed
Otherwise, the tx buffer will be discarded and can no longer be obtained

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-08 18:26:39 +08:00
Xiang Xiao 7c839d7a09 rptun: Remove include/nuttx/rptun/openamp.h
and use include/nuttx/rpmsg/rpmsg.h instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-07 00:44:28 +08:00
buxiasen 731af5b42f drivers/pm: pm_smp remove sched_lock
all os-api those have post/wait feature will not allowed in pm_callbacks
and pm_handler, until we support by cpu/tcb sched_lock and add
sched_lock/unlock back here. Then should revert this commit.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-30 20:23:11 +08:00
buxiasen 46d555e5d4 pm_idle: fix when prepare failed, possible relax error
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-30 20:23:11 +08:00
buxiasen 43176bbade pm: pm_idle add support for SMP
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-30 20:23:11 +08:00
liangdongdong 5238f2c200 feature: charge: Add battery operate
Signed-off-by: liangdongdong<liangdongdong@xiaomi.com>
2024-09-28 11:25:17 +08:00
dulibo1 5a796dfbff power: fix BQ27426 driver compile error
power/battery/bq27426.c:331:17: error: ‘BATTERY_UNKNOWN’ undeclared (first use in this function)
  331 |       *status = BATTERY_UNKNOWN;
      |                 ^~~~~~~~~~~~~~~
power/battery/bq27426.c:331:17: note: each undeclared identifier is reported only once for each function it appears in
Makefile:108: recipe for target 'bq27426.o' failed

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-28 11:25:17 +08:00
dulibo1 797df22802 power:add default protocol for the driver which not impl get_protocol
add default protocol for the driver which not impl get_protocol

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:25:17 +08:00
dulibo1 5a57aa0af8 pm:CMakeLists update for pm runtime
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:03:48 +08:00
dulibo1 15833a3cbd regualtor: use regulator_enable in idle task may casue assert
if regulator_get the supply which call kmm_zalloc

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-28 10:38:55 +08:00
dulibo1 f53ae757b8 regualtor:adjust the critical area protected
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-28 10:38:55 +08:00
chenzhijia f526b91165 nuttx/drivers:Modify errcode returned by relay_ioctl
Fixed system function call failure due to return errcode error

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-08-29 01:04:03 +08:00
Petro Karashchenko d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
buxiasen ed572174e1 pm_runtime: fix header missing, up_interrupt_context may undeclared
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-21 13:38:50 +08:00
buxiasen eae0dfd641 pm_runtime: fix missing header
if the sched.h not included by header already inside .c will cause
sched_idletask not defined

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-21 13:38:50 +08:00
buxiasen 47b2e00d51 pm: irq should disable before sched locked
If sched lock before irq save, and irq handler do post, scheduler will
be delayed after WFI until next sched unlock. which is not acceptable.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-21 10:53:33 +08:00
buxiasen 317afc5ab7 pm: add pm_idle, up_idle only handle pm state execution
pm process should be done by chip specific, but we can provide a standard
flow, then vendor & chip can only focus on handle different state change.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-21 10:53:33 +08:00
buxiasen a18e4e85e9 pm_activity: fix deadlock with spinlock and critcal_section
critical_section is not compatible with irq disabled, have to delay the
wd_start after spin_unlock_irqrestore.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-20 17:01:48 -03:00
buxiasen 9d396bf89e pm: add debug_assert for cb register/unregister api
avoid the register/unregister API access wrong memory

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-17 14:30:49 +08:00
simbit18 f12c4e05cc Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
Replace help => ---help---
Remove extra TABs
2024-07-12 06:37:59 +08:00
buxiasen 142a1e186e pm: remove pm_lock spinlock wrapper
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-23 11:16:56 +08:00
buxiasen d7ab3cc1be pm: change pm lock from mutex to spinlock
as we always want to take critical_section, and it is not long time job,
take mutex is not necessary, use spinlock_irq_save as a replace is
better, dont't have to take global critial_section in pm.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-21 12:28:57 -03:00
buxiasen 596aa1d51b pm_runtime: lock use pm_runtime_lock
isolate with pm_runtime and pm_domain, for further usage optimise

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-21 03:08:23 +08:00
buxiasen 292b213be2 pm: pm_runtime fix header
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-17 16:23:53 +08:00
buxiasen 3d1b3ba1f5 pm: shorten the pm procfs domain lock time.
snprintf and procfs_memcpy don't have to do inside lock.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-08 12:02:13 +08:00
buxiasen 1933f9648d pm: remove pm global, make per domain isolated
After change, when CONFIG_PM_NDOMAINS > 1,
the pm_register will not able to get notificaion
from not PM_IDLE_DOMAIN.
Should use pm_domain_register as a replacement.

Isolate domains from global callbacks can decrease
not necessary execution, and reduce the
lock instruction requirements.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-04 22:04:25 +08:00
buxiasen 4197b5aec8 pm: do struct timespec copy to decrease api call times.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-05-25 12:07:38 +08:00
buxiasen 07f0e0c166 PM: add stability governer
only when first time change state can hold WFI for enough time thresh,
allow second time goto target state,
suitable for the case when wakeup from sleep too slow, etc.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-05-23 09:57:19 -03:00
buxiasen d3d52ee5e2 pm_procfs: update state up to now when pm procfs read
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-05-20 10:29:49 +08:00
dulibo1 3762bda5e2 pm: procfs add pm prepare fail stats
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-05-17 19:07:44 +08:00
buxiasen c9170c3b0a pm: fix when RTC_HIRES enabled pm procfs err
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-05-16 16:23:18 +08:00
buxiasen 6ef6d75840 PM: change domain field state after callback done
Swap the sequence of domain state update and statechanged callback,
Make sure inside statechanged callback can get the old domain state.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-05-15 16:32:41 -03:00
wangjianyu3 f0590eeaf0 drivers/power/pm: Fix warning of type cast
Env: sim (Ubuntu 22.04.3 LTS (x86_64 GNU/Linux)), enable PM
```
power/pm/pm_autoupdate.c: In function ‘pm_auto_updatestate’:
power/pm/pm_autoupdate.c:84:46: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   84 |                      pm_auto_updatestate_cb, (FAR void *)domain, 0);
      |                                              ^
power/pm/pm_autoupdate.c:89:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   89 |           pm_auto_updatestate_cb((FAR void *)domain);
      |                                  ^
```

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-04-10 22:51:28 +08:00
chao an 6d50274ebe nuttx/list: rename container_of to list_container_of from public header
Use private naming to avoid conflicts with user applications

In file included from libuv/src/unix/internal.h:25,
                 from libuv/src/unix/udp.c:23:
libuv/src/uv-common.h:57: warning: "container_of" redefined
   57 | #define container_of(ptr, type, member) \
      |
In file included from nuttx/include/nuttx/list.h:47,
                 from nuttx/include/nuttx/tls.h:40,
                 from nuttx/include/nuttx/sched.h:48,
                 from nuttx/include/nuttx/arch.h:87,
                 from nuttx/include/nuttx/userspace.h:35,
                 from nuttx/include/nuttx/mm/mm.h:30,
                 from nuttx/include/nuttx/kmalloc.h:34,
                 from nuttx/include/nuttx/lib/lib.h:31,
                 from nuttx/include/stdio.h:35,
                 from apps/system/libuv/libuv/include/uv.h:59,
                 from libuv/src/unix/udp.c:22:
nuttx/include/nuttx/nuttx.h:48: note: this is the location of the previous definition
   48 | #define container_of(ptr, type, member) \
      |

Signed-off-by: chao an <anchao@lixiang.com>
2024-02-29 19:44:54 +08:00
Bowen Wang 169f47beec rpmsg: make all the rpmsg services deponds on RPMSG
After decoupled the rpmsg and rptun, all the rpmsg service should
depends on the RPMSG.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-02-18 04:09:34 -08:00
yinshengkai 9852428953 fs: procfs add poll support
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-26 19:23:13 -08:00
Xiang Xiao ca5a9c711a Remove @ and % tag from all comments
and format the multiple line comments

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-11 17:00:10 -03:00
Xiang Xiao eddd90de78 poll: pollsetup should notify only one fd passd by caller
since it's redundant to iterate the whole fds array in setup

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-21 09:07:17 +01:00
ligd 978e124d42 pm: use pm_staytimeout() in greedy_governor_activity()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-10-31 09:05:40 +08:00
raiden00pl b565e28da3 Kconfigs: rename {Rpmsg|rpmsg} to RPMGS 2023-10-28 13:58:56 +08:00
Xiang Xiao 414491e340 pm: Let PM_PROCFS depend on FS_PROCFS_REGISTER
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-02 14:30:18 -04:00
dulibo1 7a417da65e pm:check the domain in pm_querystate
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-09-24 03:49:08 +08:00
dulibo1 2db471fab3 regulator:fix some issues when use rpmsg
1.client get the regualtor which is enabled by server, will disable the regualtor.
2.regulator_rpmsg_server_unbind will disable regualtor which maybe used by other client.
3.regulator_rpmsg_server_unbind will be deadloop when the regulator is always_on;
4.regulator_rpmsg_client_destroy does not match server cpu name,may destory by stop other rptun dev

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-09-21 19:41:34 -04:00
dulibo1 da1cd59f35 regualtor:fix regulator_register check rpmsg regulator which leads to recursion
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-09-21 19:41:34 -04:00