Commit Graph

278 Commits

Author SHA1 Message Date
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
Xiang Xiao 4d2cc2ab4d supply/regulator: Refine rpmsg regulator
1.Change priv to client or server
2.Allocate memory for name in regulator_rpmsg_get
3.Lock/unlock regulator_list in regulator_rpmsg_server_s

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-19 10:33:09 +08:00
dulibo1 ac62a08ac9 support pm runtime base function
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-09-16 14:44:08 +08:00
wanggang26 dcadd87919 pm: fix issue that system crash when passed invalid relpath value
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-09-13 21:47:27 +08:00
chao an 664927c86e mm/alloc: remove all unnecessary cast for alloc
Fix the minor style issue and remove unnecessary cast

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-30 14:34:20 +08:00
chao an 7aa45305b7 fs/inode: remove all unnecessary check for filep/inode
Since VFS layer already contains sanity checks, so remove unnecessary lower half checks

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 09:47:11 +08:00
dulibo1 127bd81674 regulator:check id conflict when register
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-08-29 02:59:59 +08:00
dulibo1 3591de08c6 fix g_goldfish_gauge_ops init C89 compatible and align style
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-08-14 13:40:38 +08:00
dulibo1 3f9a76e131 battery:add goldfish battery driver
support the goldfish emulator battery driver

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-08-11 15:30:35 +08:00
dulibo1 af60bf8213 regulator:optimize the lock to support call the interface in idle task by pm
support call api in idle task

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-08-10 23:17:51 +08:00
dulibo1 1456919e58 regulator:support lp mode and auto pm register
1.add new intf regulator_set_mode to manual set rehulator lower power mode;
2.when add auto lp desc,the regulator lp mode is controlled by  pm framework;

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-08-10 23:17:51 +08:00
dulibo1 935359fa3f regulator: support link to supply
when add supply desc,the regulator is linked to the parent regulator
1.if enable the regualtor, the parent regulator is enabled
2.if disable all child regulator, the parent regualtor is disabled

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-08-10 23:17:51 +08:00
dulibo1 67aa12e762 regulator:support always on
when add always on desc,the regulator is always enabled

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-08-10 23:17:51 +08:00
ligd bfe962ce2c pm: fix second time add wakelock dq caused error
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-03 10:16:41 -07:00
chao an f10b54a081 cmake: fix CMake build break
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-15 23:32:36 +08:00
dulibo1 7ccdb2cfa8 battery:fix poll return type
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-07-12 11:06:47 -03:00
chao an 6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
simbit18 3f4151525d Fix Kconfig style
Remove TABs from Kconfig files
Add comments
2023-06-19 20:05:57 +03:00
simbit18 ca026a5b0f drivers\power\supply\Kconfig: Fix indentation
Remove TABs
2023-05-18 15:43:22 +03:00
simbit18 f12b9c44cb drivers/power/relay/Kconfig: Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
2023-05-10 22:51:11 +08:00
Xiang Xiao 51dc67ad5f fs: Add g_ prefix for all global file_operations instances
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 16:13:29 +02:00
Xiang Xiao 149cafe450 procfs: Add g_ prefix to all procfs_operations
to conform the coding style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
zhangyuan21 c239d19df0 nuttx: add more dependent header file
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-04-11 09:13:32 +03:00
TimJTi 94f0283bdd Correct DEBUGASSERT code error, _err format error, better C89 compatability
Update drivers/power/supply/act8945a.c

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-03-06 17:25:39 +02:00
Xiang Xiao 2c5f653bfd Remove the tail spaces from all files except Documentation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-26 13:24:24 -08:00
lilei19 38f64f559d change strcpy to strlcpy
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-02-24 12:15:40 +08:00
chao an 3a0fdb019d nuttx: replace all ARRAY_SIZE()/ARRAYSIZE() to nitems()
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:05:44 +08:00