Commit Graph

4673 Commits

Author SHA1 Message Date
Michael Jung
f53c776d97 w25qxxxjv.c: Ensure Quad SPI mode is enabled
Certain variants of the W25QxxxJV Quad SPI NOR flash ICs have the Quad
SPI mode disabled after reset.  As the w25qxxxjv driver is operating the
device in Quad SPI mode, make sure it gets enabled if required during
device initialization.

Signed-off-by: Michael Jung <michael.jung@secore.ly>
2022-07-28 21:45:34 +08:00
ligd
5dcc905f27 rptun: change lock to recursive lock
[ap] [ 6] [<0x2c351a18>] arm_switchcontext+0xc/0x10
[ap] [ 6] [<0x2c321b36>] sem_wait+0x5a/0xbc
[ap] [ 6] [<0x2c333d68>] rptun_ns_bind+0x2c/0x128
[ap] [ 6] [<0x2c5f863c>] rpmsg_virtio_ns_callback+0x9c/0x140
[ap] [ 6] [<0x2c5f84a6>] rpmsg_virtio_rx_callback+0xba/0x1b4
[ap] [ 6] [<0x2c5f7b38>] rproc_virtio_notified+0x44/0x5c
[ap] [ 6] [<0x2c5f7504>] remoteproc_get_notification+0x1c/0x2c
[ap] [ 6] [<0x2c33432c>] rptun_wait_tx+0x11c/0x160
[ap] [ 6] [<0x2c5f8734>] rpmsg_virtio_get_tx_payload_buffer+0x54/0x100
[ap] [ 6] [<0x2c5f87f2>] rpmsg_virtio_send_offchannel_raw+0x12/0x6c
[ap] [ 6] [<0x2c321b4c>] sem_wait+0x70/0xbc
[ap] [ 6] [<0x2c5f8166>] rpmsg_create_ept+0x102/0x1a4
[ap] [ 6] [<0x2c5eafcc>] rpmsgfs_device_created+0x44/0x5c
[ap] [ 6] [<0x2c33407c>] rptun_dev_start.isra.0+0x218/0x3ac
[ap] [ 6] [<0x2c3343f4>] rptun_thread+0x84/0x164
[ap] [ 6] [<0x2c323762>] nxtask_start+0x3a/0x60

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
ligd
8a3683fb9f rptun: add ns_match callback to resolve rptun deadlock
thread A: accept -> net_lock -> socket_rpmsg_accept
          -> rpmsg_register_callabck -> rptun_lock
thread B: ns_bind -> rpmsg_socket_ns_bind -> get_tx_payload_buffer
          -> rptun_wait_tx -> usrsock_rpmsg_ept_cb -> usrsockdev_write
          -> net_lock -> deadlock

fix:
add ns_match callback

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
ligd
033cd4d7df rptun: use seperated lock
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
ligd
0017758fc1 rptun: add dump vring info support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
ligd
a014a19f0e rptun_ping: add sleep param to rptun_ping
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
anjiahao
f9bcf1d645 drivers:rptun use strlcpy inside of strcpy
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-07-27 20:36:51 +08:00
anjiahao
645ff50609 power:record features by add mask to drivers
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-26 12:07:51 +03:00
Jiuzhu Dong
4ef7cf068b driver/power: add charge protocol get
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-26 12:07:51 +03:00
ligd
7fa3ecde5a pm: modify for nxstyle
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
3ea2dbb7b4 power: change pm_count to pm_empty to optimize speed
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
487771033d power: move EXPLICIT_RELAX operation to pm_initialize()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
d8ebe98c6c pm: use rmutex_xx API for recursive lock
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
f9849c7f60 pm: memset when do pm_wakelock_init
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
Xiang Xiao
959031ebca power/greedy: Call pm_auto_updatestate in timeout callback
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
0d1515f7fb pm_procfs: show stay-time-to-now when pm in stay state
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
695b296681 pm: fix build warning
power/pm_procfs.c:282:27: warning: format specifies type 'unsigned long' but the argument has type 'time_t' (aka 'unsigned int') [-Wformat]
                          dom->wake[state].tv_sec,
                          ^~~~~~~~~~~~~~~~~~~~~~~
make[2]: Entering directory '/home/ligd/platform/m2/audio/frameworks/media'
power/pm_procfs.c:283:27: warning: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Wformat]
                          100 * dom->wake[state].tv_sec / sum,
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
power/pm_procfs.c:284:27: warning: format specifies type 'unsigned long' but the argument has type 'time_t' (aka 'unsigned int') [-Wformat]
                          dom->sleep[state].tv_sec,
                          ^~~~~~~~~~~~~~~~~~~~~~~~
power/pm_procfs.c:285:27: warning: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Wformat]
                          100 * dom->sleep[state].tv_sec / sum,
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
power/pm_procfs.c:286:27: warning: format specifies type 'unsigned long' but the argument has type 'time_t' (aka 'unsigned int') [-Wformat]
                          total.tv_sec,
                          ^~~~~~~~~~~~
power/pm_procfs.c:287:27: warning: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Wformat]
                          100 * total.tv_sec / sum);
                          ^~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
c0f2b7811e pm: add pm procfs support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
f7a1c2a585 pm: move wdog from domain to wakelock
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
0ca0c017fd pm: move pm_wakelock_global_init to the top
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
82713d9eac pm: PM_RESTORE don't need do prepare_all
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
88def0244c power: add pm_wakelock support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
f606689715 power: change pm_stay_timeout to pm_staytimout
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
b34925e6eb power: move EXPLICIT_RELAX opreation to common place
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
f0a1a2dc0b power: add pm_stay_timeout API
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
479689eae9 power: fill acivity callback to greedy_governor
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
25b16576e8 pm: pm_lock support recursive_lock
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
zhuyanlin
4329967a01 pm: use pm_lock/unlock with domain lock
Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2022-07-26 11:11:00 +08:00
Jiuzhu Dong
01aa0c2d46 driver/sensor: change nbuffer and sensor event structure type
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-26 10:40:21 +08:00
Jiuzhu Dong
e3e59a03b1 driver/sensor: update sensor data structure and state structure
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-26 10:40:21 +08:00
Jiuzhu Dong
24040250f5 driver/sensor: support multi users to access device
1.Allow multi users to access the same sensor device simultaneously.
2.Get real state of sensor device by cmd SNIOC_GET_STATE for users.
3.Get update state since last read by poll without timeout for users.
4.Sensor device will be activated when first user open and will close when
  last user closed.
5.When multi users to access device, driver always set the minimum
  sampling interval and latency to the sensor device and allow
  downsampled for users above the minimum sampling interval.
6.The circbuffer will overwrite old data when buffer is full, so if users
  don't read data soon, data will be lost, and the oldest data in circbuffer
  are returned to the users.
7.Always read the last data in the circbuffer as initial value for new
  users when the sensor device has not yet generated new data.
8.when user uses poll, if subscription interval is satisfied, the POLLIN
  events is returned for each users.
9.When new user generate or the state of sensor device changed, the POLLPRI
  will notify to all users.
10.Support multi advertisers to subscribe their own data as loop test.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-26 10:40:21 +08:00
Jiuzhu Dong
b3ea6522f4 driver/usensor: support register user sensor
1.cmd:SNIOC_REGISTER with struct sensor_reginfo_s to register user sensor
2.cmd:SNIOC_UNREGISTER to unregister user sensor

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-26 10:40:21 +08:00
Jiuzhu Dong
8d971101cd driver/sensor: change protype of set_interval, batch to follow ioctl
1. change unsigned int to unsigned long

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-26 10:40:21 +08:00
Jiuzhu Dong
8f39c5f11b driver/sensor: simplify buffer operation
1.Simplify buffer opeations to avoid frequent resize for batch and no-batch mode.
2.When sensor event is first generated, the buffer is initialized.
3.Remove and merge batch_number to buffer_number when device support batch mode.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-26 10:40:21 +08:00
Jiuzhu Dong
dad5ab75ff driver/sensor: support userspace wirte data into sensor device
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-26 10:40:21 +08:00
ligd
434c49f282 rptun_dump: use METAL_LOG_EMERGENCY log level
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 09:36:05 +08:00
ligd
4a9bd26317 rptun: merge rptun_ioctl & rptun_ops to one
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 09:36:05 +08:00
ligd
631eb516c9 rptun_dump: don't get lock in IRQ handler
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 09:36:05 +08:00
Peter van der Perk
b3590f00b3 NXStyle and preprocessor fixes
Co-authored-by: Jari van Ewijk <jari.vanewijk@nxp.com>
2022-07-25 23:47:05 +08:00
Jari van Ewijk
dd1096695d Add initial support for NXP S32K3 MCU family
Co-authored-by: Peter van der Perk <peter.vanderperk@nxp.com>
2022-07-25 23:47:05 +08:00
Jari van Ewijk
d3b1ee9866 Macronix MX25RXX driver: add support for MX25LXX as well
Co-authored-by: Peter van der Perk <peter.vanderperk@nxp.com>
2022-07-25 23:47:05 +08:00
Jiuzhu Dong
fc84813b0a driver/sensor: add calibrate interface for sensor driver.
Add standard sensor interface for calibrate, can trigger
calibration and obtain calibration value.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-25 17:44:31 +08:00
Jiuzhu Dong
1c342328de rtc/rpmsg: when a client connection, server initiates time sync
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-25 14:58:16 +08:00
Jiuzhu Dong
3132f169ef driver/sensor: add sensor type of cap and wake_gesture
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-25 13:34:58 +08:00
raiden00pl
0570704cdc sensors: use the INA226 driver also for INA230 chips 2022-07-23 16:48:13 -03:00
curuvar
c21c7ac8dc Added Adafruit QT Py RP2040 board.
Added ability to configure indivdual UART, SPI and I2C pin location.
2022-07-23 18:25:38 +08:00
Jiuzhu Dong
40e86501f1 driver/ioe_rpmsg: split server and client ept_cb to simplify code
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-22 14:44:44 +08:00
Karel Kočí
3693d38763 drivers/lcd/st7789: update implementation of driver for ST7789
'putarea' function now has to select the appropriate values from the
whole frame buffer instead of the previous expectation of having just
specified rectangle passed to it.

This required extension of WRRAM handling function as we now are not
writing simply buffer but we want to skip some values and do that
multiple times. Having two implementation in this case is worst as this
function is actually called only twice in the whole code (thus making
dedicated function for every call if we would have two variants).
Calling `st7789_wrram` multiple times is not an option as command
ST7789_RAMWR resets the position and thus calling it multiple times just
overwrites the previous values.
2022-07-22 11:08:00 +08:00
Alan Carvalho de Assis
a9d3e1bd08 lcd/apa102: Fix APA102 RGB LED Matrix interleaving issue
I found an issue in the APA102 framebuffer that wasn't spot
before by fb test because this application draw symetric squares

Normally in a display each line starts at left and increase to the
right, however for this APA102 matrix the next line starts at the
end of previous line and move the opposite direction, forming a
zig-zag pattern.
2022-07-22 11:05:32 +08:00
Xiang Xiao
d04ed9587b drivers/syslog: Call up_nputs in syslog_default_write
since the buffer may not be terminated by null

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-21 21:26:10 +03:00