Commit graph

323 commits

Author SHA1 Message Date
Filipe Cavalcanti
88e7b37328 drivers/video: zero message on MIPI DSI driver
Use memset to clear the msg struct before using on mipi_dsi_dcs_write_buffer.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-07-24 20:57:57 -03:00
Catalin Visinescu
a30bbfee6b drivers/: Multiple Drivers Are Registered With World Writable Part 3
Summary

Permissions (Part 3)

Description:

In kernel builds, any unprivileged process running on the NuttX device can
open /dev/efuse and attempt to read/write fuse content. Reading the fuses
may provide valuable information to an attacker controlling the user process.
The write operation, in extreme cases where the fuse blocks are not locked,
may brick the device.

DISCLAIMER: I tried to be strict with the settings, better to relax them
later if it's needed.

This is part of https://github.com/apache/nuttx/issues/19410

Impact

See https://github.com/apache/nuttx/issues/19410

Testing

Compiles ok.

Signed-off-by: Catalin Visinescu <catalin_visinescu@yahoo.com>
2026-07-16 09:49:07 -03:00
Catalin Visinescu
081e4c478a drivers/: Multiple Drivers Are Registered With World Writable - Part 2
Permissions (Part 2)

Description:

In kernel builds, any unprivileged process running on the NuttX
device can open /dev/efuse and attempt to read/write fuse content.
Reading the fuses may provide valuable information to an attacker
controlling the user process. The write operation, in extreme cases
where the fuse blocks are not locked, may brick the device.

DISCLAIMER: I tried to be strict with the settings, better to relax them
later if it's needed.

This is part of https://github.com/apache/nuttx/issues/19410

See https://github.com/apache/nuttx/issues/19410

Compiles ok.

Signed-off-by: Catalin Visinescu <catalin_visinescu@yahoo.com>
2026-07-15 15:27:28 +08:00
Ilikara
acb9b36472 drivers: Fix comment typos — 'Pubic' → 'Public' across drivers and headers.
Fix spelling error in section header comments:
  'Pubic Function Prototypes' → 'Public Function Prototypes'
  'Pubic Functions' → 'Public Functions'

Affected files (12 files, 12 occurrences):
  arch/arm/src/at32/at32_tim.c
  arch/arm/src/common/stm32/stm32_tim_m3m4_v1v2v3.c
  arch/arm/src/stm32l4/stm32l4_tim.c
  arch/arm/src/stm32l5/stm32l5_tim.c
  arch/arm/src/stm32u5/stm32_tim.c
  arch/arm/src/stm32wb/stm32wb_tim.c
  arch/arm/src/stm32wl5/stm32wl5_tim.c
  arch/mips/src/pic32mz/pic32mz_timer.c
  arch/sparc/src/bm3803/bm3803_tim.c
  arch/sparc/src/s698pm/s698pm_tim.c
  drivers/video/vnc/vnc_server.c
  include/nuttx/wdog.h

These are all comment-only changes with no functional impact.

Signed-off-by: Ilikara <3435193369@qq.com>
2026-07-02 13:29:48 +08:00
Martin Vajnar
41381edb31 video/fb: Handle case of multiple displays where some do not require update
It can happen that multiple display configuration is used in which some
displays require explicit update while others do not.

If the updatearea() is NULL, simply skip the update instead of erroring out.

Signed-off-by: Martin Vajnar <martin.vajnar@gmail.com>
2026-06-07 10:01:05 -03:00
Martin Vajnar
155805c2e6 video/fb: Trigger updatearea() if CONFIG_FB_UPDATE is defined
When CONFIG_FB_UPDATE is defined the missing updatearea() trigger caused
the splashscreen to not be displayed.

Signed-off-by: Martin Vajnar <martin.vajnar@gmail.com>
2026-06-06 15:54:51 +08:00
rongyichang
47e3f5013f drivers/video: add HWCURSOR related config
There is no HWCURSOR config in Kconfig, but a lot of code
use it, we need to add it back.

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2026-06-05 00:01:09 +08:00
hanzj
7679bba75e drivers: Fix comment typos — 'register' → 'registered' across drivers.
Fix grammatical error in Returned Value documentation comments:
  'successfully register' → 'successfully registered'
  'successfully initialize' → 'successfully initialized'

Affected files (17 files, 19 occurrences):
  drivers/i2c/i2c_driver.c
  drivers/i2s/i2schar.c
  drivers/i3c/i3c_driver.c
  drivers/i3c/master.c
  drivers/motor/motor.c
  drivers/motor/stepper.c
  drivers/rc/lirc_dev.c
  drivers/sensors/gnss_uorb.c
  drivers/sensors/sensor.c (2 occurrences)
  drivers/spi/spi_driver.c
  drivers/timers/ptp_clock.c
  drivers/timers/ptp_clock_dummy.c
  drivers/video/mipidsi/mipi_dsi.h (2 occurrences)
  drivers/video/mipidsi/mipi_dsi_device.c
  drivers/video/mipidsi/mipi_dsi_device_driver.c
  drivers/video/mipidsi/mipi_dsi_host.c
  drivers/video/mipidsi/mipi_dsi_host_driver.c

These are all comment-only changes with no functional impact.

Signed-off-by: hanzj <hanzjian@zepp.com>
2026-05-28 22:21:47 +08:00
jianglianfang
94733dd17e golfish_gpu_fb: clear fb when initialization
Commit an initial blank frame during goldfish_gpu_fb_register() to
avoid rendering a stale frame from the emulator after reboot.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2026-05-22 17:18:13 +08:00
jianglianfang
a8de4c998c drivers/video: use spinlock to replace critical section for goldfish_fb and vnc
Critical sections only disable interrupts on the local CPU, which
is insufficient for SMP. Replace with per-device spinlocks to
ensure proper mutual exclusion across all cores.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2026-05-22 15:38:50 +08:00
Carlos Santos
319ca656b8 drivers/video/vnc: fix typo in Kconfig
Mentioned header name is "kbd_codec.h", not "kbd_coded.h".

Signed-off-by: Carlos Santos <unixmania@gmail.com>
2026-05-19 08:40:22 +08:00
Alan Carvalho de Assis
2b8be4a3da drivers/fb: Fix a symbol missing CONFIG_
This was a mistake that was preveting the boot logo to stay visible
for more time.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-05-02 15:26:10 -03:00
zhanxiaoqi
249df8c1d9 video/fb: guarantee fb read-write integrity to prevent display tearing
Serialization has been added to the paths of fb_read/fb_write, as well as
partial reading of plane/video information, updatearea, pandisplay, etc.
This covers the scenario where "one thread draws/switches via the character
device interface while another thread reads the framebuffer via the
character device interface", ensuring that the read framebuffer data
is complete and preventing screen tearing.

Signed-off-by: zhanxiaoqi <zhanxiaoqi@bytedance.com>
2026-04-15 10:18:16 -03:00
wangjianyu3
bebfaf8bb4 video/gc0308: implement V4L2 horizontal flip control
Implement get_supported_value, get_value and set_value callbacks
for IMGSENSOR_ID_HFLIP_VIDEO / IMGSENSOR_ID_HFLIP_STILL.  This
allows applications to mirror the camera preview horizontally at
runtime via VIDIOC_S_CTRL + V4L2_CID_HFLIP.

The hardware mirror is controlled by register 0x14 (CISCTL_MODE1)
bit[0], which reverses the pixel readout order with zero CPU cost.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-04-10 10:47:07 +02:00
wangjianyu3
e6ad9d25d7 video/gc0308: report V4L2_PIX_FMT_RGB565X for 8-bit DVP output
GC0308 register 0x24 bits[3:0] = 0x06 selects RGB565 output per
datasheet.  On an 8-bit DVP bus the high byte is clocked out first,
so the pixel data arrives in memory in big-endian order (RGB565X).

Report V4L2_PIX_FMT_RGB565X so that userspace can detect this and
byte-swap if needed for a little-endian display path.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-04-10 10:47:07 +02:00
Piyush Patle
13d0e64ee6 style: fix checkpatch issues after debug.h move
Fixed copespell errors, for CI sucess!

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-07 07:50:06 -03:00
Piyush Patle
0dccc8ba21 include/debug.h: Move to include/nuttx/debug.h
debug.h is a NuttX-specific, non-POSIX header. Placing it in the
top-level include/ directory creates naming conflicts with external
projects that define their own debug.h.
This commit moves the canonical header to include/nuttx/debug.h,
following the NuttX convention for non-POSIX/non-standard headers,
and updates all in-tree references.

A backward-compatibility shim is left at include/debug.h that
emits a deprecation #warning and re-includes <nuttx/debug.h>,
allowing out-of-tree code to continue building while migrating.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-07 07:50:06 -03:00
wangjianyu3
99afb5ee34 drivers/video/gc0308: add YUYV output format support
GC0308 sensor supports multiple output formats via register 0x24.
Add YUYV (YCbCr422) alongside existing RGB565 in fmtdescs and
configure the output format register dynamically in start_capture()
based on the requested pixel format.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-03-29 12:35:22 -03:00
wangjianyu3
fadfa85296 drivers/video: add GC0308 VGA CMOS image sensor driver
Add support for the GalaxyCore GC0308 VGA CMOS image sensor.
The driver implements the NuttX imgsensor interface and supports
VGA (640x480), QVGA (320x240), and QQVGA (160x120) resolutions
via Kconfig selection. Output format is RGB565X (big-endian).

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-03-16 17:26:27 -03:00
wangjianyu3
a07a6a00f4 video: add V4L2_PIX_FMT_RGB565X pixel format support
Add big-endian RGB565 (RGB565X) pixel format throughout the V4L2
video pipeline:
- IMGDATA_PIX_FMT_RGB565X in imgdata.h
- IMGSENSOR_PIX_FMT_RGB565X in imgsensor.h
- Format conversion and buffer size handling in v4l2_cap.c

This is needed by 8-bit DVP camera sensors that output RGB565 in
big-endian byte order (high byte first on the data bus).

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-03-16 17:26:27 -03:00
yaojingwei
24a18d33af v4l2_cap: fix reqbuf return error when set count = 0.
Return success when reqbuf count is zero.


Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2026-02-10 16:20:21 -05:00
yangyalei
84bcb12fff nuttx/v4l2: Fix array access out of bounds
Fix out-of-bounds access in v4l2 array handling.


Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2026-02-10 16:20:21 -05:00
yaojingwei
c2efa96002 drivers/video: optimize critical section.
use spin/mutex lock to replace critial section.

Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2026-02-09 20:56:46 -03:00
Bartosz Wawrzynek
585d954d0b boards/sim: Fix watchdog callback
drivers: Fix types and sx127x driver rx
net/pkt: Fix type

Small fixes.

Signed-off-by: Bartosz <bartol2205@gmail.com>
2026-01-23 09:46:02 +08:00
chao an
87f134cfaa sched/sleep: replace all Signal-based sleep implement to Scheduled sleep
Nuttx currently has 2 types of sleep interfaces:

1. Signal-scheduled sleep: nxsig_sleep() / nxsig_usleep() / nxsig_nanosleep()
Weaknesses:
a. Signal-dependent: The signal-scheduled sleep method is bound to the signal framework, while some driver sleep operations do not depend on signals.
b. Timespec conversion: Signal-scheduled sleep involves timespec conversion, which has a significant impact on performance.

2. Busy sleep: up_mdelay() / up_udelay()
Weaknesses:
a. Does not actively trigger scheduling, occupy the CPU loading.

3. New interfaces: Scheduled sleep: nxsched_sleep() / nxsched_usleep() / nxsched_msleep() / nxsched_ticksleep()
Strengths:
a. Does not depend on the signal framework.
b. Tick-based, without additional computational overhead.

Currently, the Nuttx driver framework extensively uses nxsig_* interfaces. However, the driver does not need to rely on signals or timespec conversion.
Therefore, a new set of APIs is added to reduce dependencies on other modules.

(This PR also aims to make signals optional, further reducing the code size of Nuttx.)

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-10-17 14:05:02 +08:00
yushuailong1
097c594aba video/fb: add FBIOGET_PANINFOCNT ioctl
Add a new ioctl to get the count of paninfo

The framebuffer is usually in high-speed RAM. Getting the paninfo
count can help us get the idle state of the framebuffer so that we
can temporarily use this memory.

Signed-off-by: yushuailong1 <yushuailong1@xiaomi.com>
2025-10-14 17:50:42 +08:00
chao an
4c7deedd27 sched/clock: remove return value of clock_systime_timespec()
clock_systime_timespec() always returns 0, so there is no need to
check the return value in the caller code, let us remove the return
value directly.

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-10-10 23:15:27 +08:00
jianglianfang
b7156384d1 video: add sched_note_mark at fb_remove_paninfo and fb_notify_vsync
fb_notify_vsync is called when TE irq comming, and fb_remove_paninfo is called after paninfo comsumed

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2025-07-30 02:50:21 +08:00
Lars Kruse
3dc53adb28 arch | boards | drivers: fix whitespace issues for switch case statements 2025-05-23 10:48:41 +08:00
Lars Kruse
3ce85ca54e style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
simbit18
ea47f0cf42 [Kconfig]: Fix Kconfig style
Remove spaces from Kconfig files
Add comments
Add TABs

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-05-14 21:15:14 +08:00
Tim Hardisty
ed0c18c66c drivers/video/fb.c: Add startup splashscreen option
Adds Kconfig-selected splashscreen options used when the driver is first registered

* Includes a new Python script in ./tools to create RLE bitmap files
* Includes default NS logo btimaps in 320x320, 160x160 and 80x80 resolutions along with their PNG files

Signed-off-by: Tim Hardisty  timh@jti.uk.com>
2025-04-30 06:38:05 -03:00
Jukka Laitinen
b5144afd03 drivers/video/vnc: Replace direct semcount access with nxsem_get_value
Use the dedicated nuttx internal interface for debugging semaphore value,
instead of accessing it directly.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-04-16 18:11:01 +08:00
Ville Juven
c3b2910178 drivers/video/fb.c: Replace sem_getvalue with nxsem_getvalue
Because sem_getvalue modifies errno.
2025-01-20 23:55:26 +08:00
rongyichang
553406e801 drivers/video: add BRGA8888 support for goldfish gpu fb
Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2025-01-07 21:47:56 +08:00
yangsen5
94c0f71db9 v4l2m2m: modify return value of g_bufsize to uint32_t
CID 1578530: (#1 of 1): INTEGER_OVERFLOW

Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
2024-12-25 17:06:48 +08:00
pengyiqiang
257339a442 video/fb: fix integer overflow issue
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-12-02 13:30:50 +08:00
liamHowatt
27e587b179 arch/esp32s3: fb add pandisplay
Signed-off-by: liamHowatt <liamjmh0@gmail.com>
2024-11-19 20:51:50 +08:00
Alin Jerpelea
286d37026c drivers: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-11-06 18:02:25 +08:00
Xiang Xiao
bce5dee0da Fix error: implicit declaration of function 'up_mdelay'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-03 21:08:50 +08:00
ouyangxiangzhen
17c51c0667 userspace: Exclude nuttx/arch.h
This patch fixed userspace headers conflict. Architecture-related definition and API should not be exposed to users.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-11-01 16:59:37 +08:00
YAMAMOTO Takashi
761ee81956 move readv/writev to the kernel
currently, nuttx implements readv/writev on the top of read/write.
while it might work for the simplest cases, it's broken by design.
for example, it's impossible to make it work correctly for files
which need to preserve data boundaries without allocating a single
contiguous buffer. (udp socket, some character devices, etc)

this change is a start of the migration to a better design.
that is, implement read/write on the top of readv/writev.

to avoid a single huge change, following things will NOT be done in
this commit:

* fix actual bugs caused by the original readv-based-on-read design.
  (cf. https://github.com/apache/nuttx/pull/12674)

* adapt filesystems/drivers to actually benefit from the new interface.
  (except a few trivial examples)

* eventually retire the old interface.

* retire read/write syscalls. implement them in libc instead.

* pread/pwrite/preadv/pwritev (except the introduction of struct uio,
  which is a preparation to back these variations with the new
  interface.)
2024-10-30 17:07:54 +08:00
Xiang Xiao
b068e2357a circbuf: Move from mm/circbuf to libs/libc/misc
so that it can be used by userspace program.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-09 08:41:49 +08:00
Xu Xingliang
f51a9d5ac5 drivers/fb: use ENOTTY to replace assert
Some drivers may not implement certain ioctls, but applications
may still call these ioctl functions for consistency.
In this case, to avoid an assertion, return ENOTTY.

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-10-08 23:23:26 +08:00
jianglianfang
7db5e6bdb0 driver: add GOLDFISH_GPU_FB_PRIORITY for goldfish_gpu_fb_vsync_thread
We need to configure the priority of FB Vsync thread to prevent nxcamera from preempting scheduling without sleep, which currently causes issues with Goldfish x86_64's default FIFO scheduling.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-10-08 23:23:08 +08:00
rongyichang
83c2a7f54e drivers/fb: add panbuffer clear ioctl
Some devices need to clear the fb panbuf when waking up from sleep
to avoid outputting residual buffers from before sleeping

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-09-13 09:15:38 +08:00
jianglianfang
7abd460131 fb:add select overlay FB_NO_OVERLAY
It is expected that select_overlay can switch from overlay to main
plane.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-26 16:26:53 +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
Petro Karashchenko
d252b6229f nuttx: use sizeof instead of define or number in snprintf
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
jianglianfang
4d42fdf195 video/fb: changed circbuf_write assert to warning
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-22 15:33:56 +08:00