Solve the problem that when a user modifies the sampling rate,
the difference between the generation and the mainline generation
may be greater than the own sampling interval.
After this problem occurs, sensor_is_update() will continue to
return true, resulting in a busy loop in the upper-layer application,
so, need update user generation according to mainline generation.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
When the upper layer calls goldfish_camera_data_uninit, priv->capture_cb=NULL, but when there is data transmission in goldfish_camera_thread, priv->capture_cb will be called, which will cause a crash.
Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
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>
It uses the memory block as the serial communication medium, which can communicate between different processes or different CPUs
Using the following configuration, the cross-core communication rate of 200MHz cortex-M55 is about 461KB/s
RAM_UART_BUFSIZE=1024
RAM_UART_POLLING_INTERVAL=100
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
A dead lock may happen before this patch:
rptun thread (usrsock_rpmsg_recvfrom_handler):
Gets all tx payload but waiting net_lock in psock_recvfrom
net driver thread (higher priority):
Receives a packet, holding net_lock, calling usrsock_rpmsg_send_event
But no tx buffer left, so rpmsg_send blocks, and won't release net_lock
In short:
Rptun: Hold all `tx_payload_buffer` -> want `net_lock`
Driver: Hold `net_lock` -> want `tx_payload_buffer`
This patch use net_lock to combine get_tx_payload and recvfrom together,
then:
- If it's waiting net_lock, tx payload will not be held, other threads
may get tx buffer and do their work.
- If net_lock is got, it won't be disturbed before finish receiving,
then tx payload won't have chance to be blocked before releasing.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
Note:
tcp_poll_eventhandler have logic after poll_notify, if we teardown poll
inside poll callback without clearing revents, use-after-free will
happen.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
The circbuf part is implemented by the fb driver, and goldfish needs to
delete the part related to circbuf and adapt to the interface of the fb
driver.
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
refact vsync queue to support multi fb poll and overlay poll.
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Signed-off-by: rongyichang <rongyichang@xiaomi.com>
Summary
The following compilation error occurs after configuring CONFIG_DEBUG_OPTLEVEL="-O3"
CC: ping.c video/video.c: In function 'video_ioctl':
video/video.c:2347:22: error: 'control.size' may be used uninitialized [-Werror=maybe-uninitialized]
2347 | control->size,
| ^~
video/video.c:2273:28: note: 'control' declared here
2273 | struct v4l2_ext_control control;
| ^~~~~~~
Signed-off-by: wangming9 <wangming9@xiaomi.com>
Add usb_fs driver so that userspace can directly transfer USB packets
through the EP node. ADB, Fastboot, MTP will use usb_fs, these class
driver only need to provide the descriptors and register the usb_fs device.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
The RPMB partition cannot be accessed via standard block layer, but by a set of specific commands: WRITE, READ, GET_WRITE_COUNTER, and PROGRAM_KEY. Such a partition provides authenticated and replay protected access, hence suitable as a secure storage.
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
In sensor_rpmsg_ioctl, when rpmsg_get_tx_payload_buffer is block,
The rptun thread will continue to process rx_buffers from other cores,
So the proxy may be released in sensor_unadv_handler, then if using
the proxy, It causes a crash.
backtrace:
0 0x06007c2e in is_rpmsg_ept_ready (ept=0x5a5a5a5a) at nuttx/include/openamp/rpmsg.h:172
1 0x06013354 in rpmsg_send_nocopy (len=<optimized out>,
data=<optimized out>, ept=<optimized out>) at nuttx/include/openamp/rpmsg.h:521
2 rpmsg_send_nocopy (ept=0x5a5a5a5a, data=data@entry=0x201facf0,
len=len@entry=40) at nuttx/include/openamp/rpmsg.h:512
3 0x06013b34 in sensor_rpmsg_ioctl (dev=dev@entry=0x201b7388,
cmd=538701816, cmd@entry=2690, arg=0, len=len@entry=0,
wait=<error reading variable: dwarf2_find_location_expression:
Corrupted DWARF expression.>) at ../../../drivers/sensors/sensor_rpmsg.c:395
4 0x06013cce in sensor_rpmsg_alloc_proxy (dev=dev@entry=0x201b7388,
ept=ept@entry=0x202073d0, msg=msg@entry=0x201684f0) at ../../../drivers/sensors/sensor_rpmsg.c:498
5 0x06013d12 in sensor_rpmsg_adv_handler (ept=0x202073d0,
data=0x201684f0, len=49, src=<optimized out>, priv=0x202073c8) at ../../../drivers/sensors/sensor_rpmsg.c:905
6 0x0600d45e in sensor_rpmsg_ept_cb (ept=<optimized out>,
data=<optimized out>, len=<optimized out>, src=<optimized out>,
priv=0x202073c8) at ../../../drivers/sensors/sensor_rpmsg.c:1168
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
vfork use waitpid hang father process,
but waitpid release child processs information by default.
So when user call wait, it return errno 10.
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
When the machine is cold started, the psram area where the syslog
buffer is located contains some random values, so it will cause
loss of valid log.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
When the system starts up, the hw count may not start counting from 0,
which can cause the processing time of the first oneshot handler to be
too long. Therefore, the current tick value should be set based on the
hw count during initialization.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
The class device only handles descriptor information specific to the class,
and shared descriptor information is passed through parameters and
handled by the composite driver.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Whevenever the bit rate is going to be set, it's necessary to first
set the master clock if the underlying device supports it. If it
fails, just return the error code.
According to the struct `mclk_rate_s`, set the default sample rate
to its lowest valid value. This prevents the underlying driver from
setting unsupported values.
Create bmi160_base.h, bmi160_base.c bmi160_uorb.c files, the bmi160_base file stores
public function interfaces, and the bmi160_uorb file stores functions related to the
uorb framework. Switch the character interface and UORB interface through the
macro CONFIG_SENSORS_BMI160_UORB.
Signed-off-by: likun17 <likun17@xiaomi.com>
A usbdev has only one serial string, so use a unique macro to control it.
For boards that enable board serial string using COMPOSITE_BOARD_SERIALSTR,
PL2303_BOARD_SERIALSTR, CDCACM_BOARD_SERIALSTR, USBADB_BOARD_SERIALSTR,
USBMSC_BOARD_SERIALSTR, and RNDIS_BOARD_SERIALSTR, they need to be replaced
with BOARD_USBDEV_SERIALSTR.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Commit 50a8ec6 broke many mmc devices. Only if the flag
priv->caps & SDIO_CAPS_4BIT_ONLY was set, it migth work.
Without the flag, the mmc clock is never set (mmcsd_widebus()
call is terminated early stopping the clock). This flag
is probably not very generic because most mmc hw support
1, 4 and 8 bit modes.
JEDEC specifies a bus width selection procedure, but it's
not implemented in this mmcsd_sdio.c driver. Thus, it's
not known whether the hw supports 1, 4 anf 8 bit modes or
a combination of them.
However, with priv->caps & SDIO_CAPS_4BIT_ONLY the driver
suddenly assigns priv->buswidth = MMCSD_SCR_BUSWIDTH_4BIT
making it the only way to have the driver working.
Fix this by relaxing the above mentioned restrictions.
Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
This commit adds basic support for electrically isolated 8 bit expander.
The expander communicates with the MCU via SPI interface. Both single
and multiple pin read are supported.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
isx019 driver freezes by I2C access in the interrupt context.
This I2C access is intended to stop data output from FPGA.
Delete this I2C access for the following reasons.
- Data output from FPGA does not affect power consumption
- There are no problems in capture restart without data output stop
since restart is done by image data block first.
This commit adds support for galvanic isolated ISO1H812G SPI expander.
Both single pin and multiple pin writes are supported.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
Documentation for PWMIOC_SETCHARACTERISTICS ioctl command mentioned
that this command will neither start nor stop the pulsed output. This
however is incorrect as PWMIOC_SETCHARACTERISTICS command leads to
pwm_start() function which starts the pulsed output.
While this might not be the correct behaviour (I would probably welcome
the option to set PWM characteristics without starting the pulsed output)
it is the way the PWM driver is coded for many architectures. Future
enhancement might be to add function pwm_setchar() for example to just
set characteristics without starting the PWM output.
Signed-off-by: Michal Lenc <michallenc@seznam.cz>