Commit graph

7126 commits

Author SHA1 Message Date
chenzihan1
c21405d2d5 drivers/sensors/goldfish: goldfish support more sensors
add sensors type to align android

Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
2025-12-20 09:31:23 -03:00
zhanghongyu
2ebb08e78f netdev_upperhalf: avoid recursion during transmission
to avoid uncontrollable stack overhead, we actively
avoid scenarios where recursion occurs.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-20 10:58:16 +08:00
zhanghongyu
16947ddacd netdev_upperhalf: modify txavail to be sent directly in the current thread
avoid packet processing delays caused by task switching,
to support those applications that are extremely time-sensitive.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-20 10:58:16 +08:00
Julian Oes
7e46d282eb drivers/mtd: Add W25N SPI NAND flash driver
Add MTD driver for Winbond W25N series SPI NAND flash.

Currently supports W25N01GV (1Gbit/128MB).

Features:
- Standard SPI interface with configurable frequency (up to 104 MHz)
- Hardware ECC enabled by default
- Block erase with sleep-based wait (releases SPI bus)
- Page read/write with busy-wait for fast operations

Limitations:
- No bad block management (BBM). Factory bad blocks and runtime bad
  blocks are not tracked.
- No bad block table (BBT) scanning at initialization.
- No Quad SPI support (standard SPI only).
- No access to spare area (64 bytes/page) or OTP region.

Tested using:
- Board with STM32H743
- W25N01GV on SPI at 96 MHz with DMA enabled
- Flash mounted using littlefs
- Tested using sdbench:
  - Sequential write speed of 1760 KB/s
  - Sequential read speed of 4900 KB/s

Signed-off-by: Julian Oes <julian@oes.ch>
2025-12-19 10:00:33 +08:00
anjiahao
7003a2c14d rtc_time:set zero rtc_time struct
timegm set struct tm, not set nsec, so rtc_time->nsec will be a random
value, so set it zero.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2025-12-19 01:58:44 +01:00
chenzihan1
a9df67e56b drivers/gpio: gpio driver added debounce and interrupt mask functions
Add handling for GPIOC_SETDEBOUNCE to set GPIO pin debounce duration.
Add handling for GPIOC_SETMASK to enable/disable GPIO interrupt mask.

Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
2025-12-18 14:52:37 +01:00
wangchengdong
a86af7abcd drivers/timers: Implement up_alarm_start() in arch_alarm.c
Add the implementation of up_alarm_start() in arch_alarm.c.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-12-18 18:36:28 +08:00
anjiahao
56bdc0a035 virtio-blk:if in assert,don't wait semaphore
we use virtio-blk as coredump backend, so need support write it when
assert

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2025-12-18 18:21:55 +08:00
Antoine Juckler
d5633f75a8 mtd/at25ee: Use eeprom/spi_xx25xx internally
In order to reduce code duplication, use the eeprom/spi_xx25xx
driver within mtd/at25ee.

The eeprom/xxx.h includes have been merged into eeprom/eeprom.h, to
provide a common include file like mtd/mtd.h.

Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
2025-12-17 19:03:54 +01:00
rongyichang
963b421c39 drivers/virtio: Fix DRIVERS_VIRTIO_INPUT configuration dependencies
Changed the DRIVERS_VIRTIO_INPUT dependencies from 'depends on' to 'select'
for INPUT_TOUCHSCREEN, INPUT_KEYBOARD, and INPUT_MOUSE options. This ensures
that when DRIVERS_VIRTIO_INPUT is enabled, all required input subsystems are
automatically selected, fixing the issue where mouse device nodes were not
being created properly.

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2025-12-17 20:48:06 +08:00
fangpeina
cfbbd06957 input/ff: add control operation to force feedback driver interface
adds a generic control operation to the FF driver interface.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2025-12-17 20:10:09 +08:00
fangpeina
4f3a72ef59 input/ff: extend ioctrl to support get effect duration
support obtain effect duration interface

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2025-12-17 20:10:09 +08:00
fangpeina
e55ba8c82c drivers/input: support return effect duration in ff_dummy
add duration return of an uploaded effect in ff_dummy

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2025-12-17 20:10:09 +08:00
zhanghongyu
097dd84bba drivers/usbdev/cdcecm.c: fix cdcecm netdev can not enter running state
When the setinterface interface is called, it indicates that the underlying
USB link has been successfully established. At this point, the status of the
network card needs to be updated to RUNNING by calling the netdev_carrier_on
interface. It is similar to the logic after a Wi-Fi network card is
connected to a hotspot. Otherwise, an incorrect network card status may
cause packets to fail to be successfully sent.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-15 11:14:20 -03:00
dongjiuzhu1
b4c6a92757 drivers/battery: fix race condition in event handling
Move mutex lock before checking flist to prevent race condition where
events could be lost when occurring simultaneously with service opening.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-12-15 17:35:11 +08:00
raiden00pl
8c8a7484ab drivers/can/can.c: fix broken O_NONBLOCK
O_NONBLOCK open mode was broken since
https://github.com/apache/nuttx/pull/17360

MIN() comapres signed value (int) with unsigned value (size_t) which causes
an unexpected return value when ret is negative

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-12-14 15:42:35 -05:00
yangsong8
a87ad98343 usbhost: cdcacm exit wq after copy all received data
Fix issue: When the SIM CDCACM host receives data, the second packet
data reception is incorrect.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-14 10:37:53 -03:00
zhanghongyu
aa8ffea3cf netdev_upperhalf: convert Kconfig to variable
Upperhalf supports multiple working modes at the same time,
which is specified by NIC when register

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-14 10:01:22 +08:00
zhanghongyu
84895c8e70 Revert "e1000: add polling mode support for tx/rx"
Remove the previously supported polling mode. If necessary in the
future, switch to a new solution for implementation.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2025-12-14 10:01:22 +08:00
yangsong8
69cac3bd3a driver/usbdev: Fix usbtrace lock unpaired issue
Fix usbtrace lock unpaired issue

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 16:45:06 +08:00
yangsong8
444293e3b5 drivers/usbdev: Use small lock to protect usbdev trace
Use spin lock to replace enter_critical_section

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 16:45:06 +08:00
yangsong8
35a89be950 drivers/usbdev: Use small lock to protect usbdev msc
Use spin lock to replace enter_critical_section

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 16:45:06 +08:00
yangsong8
4d319c6816 driver/usbdev: Use small lock to protect usbdev fs
Use spin lock to replace enter_critical_section

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 16:45:06 +08:00
yangsong8
a1f5c269d7 driver/usbdev: Use small lock to protect composite device
Use spin lock to replace enter_critical_section

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 16:45:06 +08:00
Jiri Vlasak
f93a1b34e5 eeprom/spi_xx25xx: Add IOCTL to set Block Protect
Add IOCTL to set Block Protect, because we need a way to set Block
Protect of an EEPROM.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2025-12-13 13:33:48 +08:00
yangsong8
f2191a7e3b drivers/usbhost: fix build waring
usbhost/usbhost_hidkbd.c:1373:14: warning: unused variable ‘flags’ [-Wunused-variable]
 1373 |   irqstate_t flags;
      |              ^~~~~

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 13:03:52 +08:00
yangsong8
2660df6581 drivers/usbhost: use small lock to protect usbhost kbd
replace critical_section with spinlock

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 13:03:52 +08:00
yangsong8
25ec00c67c drivers/usbhost: improve usbhost hid kbd code
By passing parameters to the kthread_create process, reduce the global
variables and nxmutex lock.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 13:03:52 +08:00
yangsong8
a7af894cd3 driver/usbhost: use small lock to protect usbhost cdcmbim
replace critical_section with spinlock

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 12:39:48 +08:00
yangsong8
23cec99002 drivers/usbhost: use small lock to protect usbhost cdcacm
replace critical_section with spinlock

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 12:39:48 +08:00
yangsong8
62f7a8fa22 drivers/usbhost: use small lock to protect usbhost bthci
replace critical_section with spinlock

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 12:39:48 +08:00
yangsong8
5571ec8fa2 drivers/usbhost: use small lock to protect usbhost msc
replace critical_section with spinlock

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 12:39:48 +08:00
yangsong8
b9b62a9204 drivers/usbhost: Use small lock to protect usbhost common function
replace critical_section with spinlock

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-13 12:39:48 +08:00
yezhonghui
ceeeb73bd9 rpmsgdev: fix export null issue when rpmsgdev init
check rpmsgdev export null or not

Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2025-12-12 17:48:43 +08:00
yezhonghui
806c881595 rpmsgdev: fix rpmsg dev server name too long issue
rpmsgdev name too long, we can use prefix and key info

Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2025-12-12 17:48:43 +08:00
rongyichang
0b544d3359 drivers/rpmsg: add slash check for sepical rpmsg dev
rpmsgdev match name too long, so add prefix

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2025-12-12 17:48:43 +08:00
liaoao
ea1e38ef92 rpmsgdev_server: use a separate workqueue to process poll
it will block other works of the list of hpwork when it waits to get buffer for too long. so use a separate workqueue for rpmsgdev.

Signed-off-by: liaoao <liaoao@xiaomi.com>
2025-12-12 17:48:43 +08:00
yezhonghui
582415318a rpmsgdev: destroy distinguish active and passive
rpmsgdev server will not destroy if client reboot

Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2025-12-12 17:48:43 +08:00
yangsong8
ae39301416 drivers/usbdev: not use wd timer when zero copy in cdcacm
When using the serial framework buffer, if the buffer is full, excess
data is cached in the usb req buffer. The CDCACM driver doesn't know
when the upper layer will read data from the serial buffer, so it
needs to periodically check if the cached data can be put into the
serial buffer. However, when using zero-copy, each usb req buffer
needs to be completely read before actively switching to the next
req buffer, so the timer is not needed to assist to query.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-12 09:34:47 +08:00
yangsong8
04fbce9d40 driver/usbdev: fix cdcacm wr container missing issue
in cdcacm_sndpacket, If `if (priv->wrcontainer)` is true, then
`priv->wrcontainer` is set to NULL. If an interrupt occurs before
`priv->wrcontainer` is reassigned after being NULL,
`priv->wrcontainer` will be reassigned once during the interrupt,
and `nwrq--` will be called, but no data will be sent at this time.
Only when data is sent by calling `txint` will `priv->wrcontainer`
be reassigned and `nwrq--` called again. This causes the issue.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-12 09:34:47 +08:00
yangsong8
10180ab4eb drivers/usb: use lock to protect reqbuf when cdcacm unbind
When CONFIG_CDCACM_DISABLE_TXBUF is enabled, if the USB is
unplugged during serial data transmission, it is possible
that cdcacm will enter the unbind process, and reqbuf will
be released, causing a crash during serial write.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-12 09:34:47 +08:00
yangsong8
a53223741e drivers/usbdev: fix usb cdcacm build warning
usbdev/cdcacm.c:371:11: warning: implicit declaration of function 'spin_lock_irqsave' [-Wimplicit-function-declaration]
  371 |   flags = spin_lock_irqsave(&priv->lock);
      |           ^~~~~~~~~~~~~~~~~
usbdev/cdcacm.c:375:3: warning: implicit declaration of function 'spin_unlock_irqrestore' [-Wimplicit-function-declaration]
  375 |   spin_unlock_irqrestore(&priv->lock, flags);
      |   ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-12 09:34:47 +08:00
yangsong8
d2daf66d38 drivers/usbdev/cdcacm: Fix the issue of missing release one req buf
When unbinding, if a req buf is held by priv->container, it also
needs to be released.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-12 09:34:47 +08:00
yangsong8
cc067ab199 drivers/usbdev/cdcacm.c: Use small lock to protect cdcacm
Use spin lock to replace enter_critical_section

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-12 09:34:47 +08:00
yangsong8
fe293ec9b5 drivers/usbdev/cdcacm.c: fix check priv->nwrq issue
When enable CONFIG_CDCACM_DISABLE_TXBUF, dev->xmit.buffer always
take one req, so just compare CONFIG_CDCACM_NWRREQS - 1.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-12 09:34:47 +08:00
yangsong8
e78e152cc7 drivers/usbdev/cdcacm.c: fix runtime error memcpy para is null
usbdev/cdcacm.c:2974:3: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x44716307 in cdcuart_dmasend usbdev/cdcacm.c:2974

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-12 09:34:47 +08:00
yangsong8
dd5a2662ac cdcacm: check present bit
When close the serial tool in PC, only the persent bit is cleared
on Windows but all bits are cleared on linux.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2025-12-12 09:34:47 +08:00
Jiri Vlasak
702e45155a lcd/ili9341: Improve initialization
- Re-select LCD after soft reset during init. It looks that (soft) reset
  affects SPI communication.

- Clear display during the initialization.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2025-12-10 23:54:44 +08:00
Jiri Vlasak
908ce01386 lcd/lcddrv: Implement 3-wire 9-bit SPI
Some display drivers, like ILI9341, support 3-wire 9-bit SPI. In
contrast to 4-wire 8-bit SPI, which uses dedicated CMD/DATA pin to
distinguish between CMD and DATA, 3-wire 9-bit SPI uses MSB of 9-bit
frame for this purpose.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2025-12-10 23:54:44 +08:00
Jiri Vlasak
3a4b53b37c lcd/ili9341: Add config option for BGR
Display's BGR mode should not depend on the endianness.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2025-12-10 23:54:44 +08:00