Sometimes current link has reset the slot, but the corresponding
sync slot hasn't been processed, then sync link won't get the
corresponding slot. This change reset the sync mode of sync slot.
CRs-Fixed: 3305718
Change-Id: I6f826fe32edfabe74986fc0586a29e2060412b82
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
We should make sure the sync link has streamed on
when current req bigger than or equal to the next
req of sync link.
CRs-Fixed: 3305718
Change-Id: I571d0d7ce4ced723c8a4885a475e555f667fd923
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
Remove direct shell commands from Android makefiles to better make use
of android function definitions.
Also changes mmrm dependency to be based on whether or not the driver
is detected in the build before setting it as a dependency.
CRs-Fixed: 3298147
Change-Id: I0d5f2c9eb34ac635604c515638c9f00e29ae0b2a
Signed-off-by: Suraj Dongre <quic_sdongre@quicinc.com>
The process_req is locked by session lock, then sub devices
on different links can't apply setting concurrently, it will
affect the performance for per frame req applying on bokeh
mode. This change removes the session lock for sending req
and adds it only for checking req ready.
CRs-Fixed: 3292804
Change-Id: I97025774ddb5f89fcc3a3d596921e1240a2d464c
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
Currently, the mechanism to create platform device out of i3c slave DT
nodes is done through "simple-bus" compatibility string in camera DT. The
addition of this compatibility string in parent nodes is causing probes
to be fired for parent drivers when they don't expect it. Change this
mechanism and add support to do the same using of_platform_populate()
call for camera sensor module nodes under i3c master DT node.
CRs-Fixed: 3259550
Change-Id: I92523e7178ff78cdc783ca0b67b2dfbcebd0be61
Signed-off-by: Mukund Madhusudan Atre <quic_matre@quicinc.com>
This change adds domain-id support for new
targets. This change involves adding information
to the SCM call currently in use such that it is
a superset, and the additional fields needed are
the IFE and CDM number being used, and VC mask.
These are in addition to existing PHY mask selection,
and lane/trio mask selection.
All the information above will be sent over from CSID
to the PHY driver, and the PHY driver will pack the
information in a generic format before sending it
over in an SCM call. Where previously, this information
is packed in format that matches the register, this
will be sent generically moving forward.
Given that there are multiple instances per physical
PHY hardware, and that the usual dev_handle used by
userspace to identify them are not accessible CSID
side, the lane_assign/lane_cfg parameter is used to find
the specific PHY instance used in conjunction with the
CSID instance in a session. lane_assign from PHY driver
and lane_cfg from CSID have the same values.
CRs-Fixed: 3259706
Change-Id: Ie050b1b9e742c6a63812eb38db7eca76db24667f
Signed-off-by: Li Sha Lim <quic_lishlim@quicinc.com>
When link A is flushed, its sync link B didn't do flush,
so link B can't get info from flushed request of link A.
This change adds a support to disconnect the link and
sync link for the flushed req.
CRs-Fixed: 3236148
Change-Id: I5ef8e608856851426ef4b51cc3bbb939cc81eddb
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
Signed-off-by: Wang Kan <quic_wkan@quicinc.com>
In case of sHDR to have a continuous flow of frames, program
scratch buffer even if there are no pending requests to apply
to lower pd devices.
CRs-Fixed: 3254135
Change-Id: I07cedcfdcf58f2a37c81e39a5f887945e7f05bc1
Signed-off-by: chengxue <quic_chengxue@quicinc.com>
This change fix ISP log error and function annotation error.
CRs-Fixed: 3248587
Change-Id: Ibe9305cb666831b98314a834049c3402b52bf389
Signed-off-by: Wang Kan <quic_wkan@quicinc.com>
Remove unnecessary memsets of the structure variables
whose fields are assigned prior to their usage or they
are dynamically allocated with calls that set the memory
to 0. This memset usage optimization is to improve
performance.
CRs-Fixed: 3228092
Change-Id: Iec68c6d072863627959ce603cff28afd26a1c408
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
Previous codes of schd_req ver1 and sync config has been removed
from KMD, and now these codes will be resumed to maintain backward
compatibility.
CRs-Fixed: 3230856
Change-Id: I19ac0549abf98ef9441380d86d49b04a86a2f95c
Signed-off-by: Stark Lin <quic_starlin@quicinc.com>
Currently, if i2c master has not probed by the time camera
request manager probes, the camera i2c slave device will not
be found on the i2c bus. In this case, compoenent framework
can't keep track of those i2c driver probes and synchronize
them. Add condition to defer crm probe in case i2c device is
not available on the bus, if we have added DTSI node for it.
CRs-Fixed: 3241160
Change-Id: I6cad2be8afd96de52f559d4b88563247a0ec6627
Signed-off-by: Mukund Madhusudan Atre <quic_matre@quicinc.com>
The apply_data can be accessed by DELAY_MAX if min delay
is initial value, it will cause out of array bound issue.
This change assign DELAY_2 to the min delay, DELAY_2 is a
value array index to apply_data.
CRs-Fixed: 3244492
Change-Id: I16e73e562488058cea68c76c1aaa9dcfeb0c2d9a
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
This change uses half frame interval as workqueue congestion
detection threshold and record the last trigger time before
sending req, we can get correct last tirgger time in this way.
CRs-Fixed: 3237172
Change-Id: I2d583f7758062340fe6b0c598bfa7e90f49211c2
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
we can't set dma buffer name when it has been attached to hardware.
As usually UMD allocate one buffer then map it at KMD side. So most of time,
set mapped dma buffer name failed. But it's not a fault error. So
we move log to debug level.
CRs-Fixed: 3219506
Change-Id: If635f9fbeb26b96f45c83b1d03cbba97576c92b2
Signed-off-by: Fengjie Chen <quic_fengjiec@quicinc.com>
Mark bubble flagged slot as applied state in tasklet
context.
Due to scheduling delay, CRM bubble process error
work-queue is taking more than 60ms for scheduling.
We had received back-to-back epochs due to tasklet
scheduling delay which invoked process requests for
applying further requests.
We reset the Nth-3rd slot during the process request.
We had done slot reset for bubble requests during
process request call as process error work-queue yet
to schedule which had to mark the slot as the
applied state.
CRs-Fixed: 3191903
Change-Id: If8154b7de8b3981fc9de64be2cd400c7b432c571
Signed-off-by: Chandan Kumar Jha <quic_cjha@quicinc.com>
Add memmgr interface and support to allocate buffers from
ubwcp heap.
CRs-Fixed: 3197463
Change-Id: Ic3368e5ff81710dba795c9625f9a461833f915e3
Signed-off-by: Pavan Kumar Chilamkurthi <quic_pchilamk@quicinc.com>
Add ioctl interfaces to support dma begin and end cpu access
operations for camera buffers.
CRs-Fixed: 3197463
Change-Id: Ibeb31e8f425489abfdd47df6f92271ac40ace407
Signed-off-by: Pavan Kumar Chilamkurthi <quic_pchilamk@quicinc.com>
To optimize SAT switch latency, Link handles will be passed along
with OpenRequest so that KMD can get sync link info per request and
UMD don't need to wait all pending requests to be done before activing
new links.
CRs-Fixed: 3094388
Change-Id: Ia52a95d9eaf444bd982a288bacf1e62b276130f2
Signed-off-by: Stark Lin <quic_starlin@quicinc.com>
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
In bokeh mode, if we set flash on one link and flash off
on the other link, will lead to out of sync between these
two links. So keep them in sync by syncing the according
req table slot info on the sync link.
CRs-Fixed: 3199523
Change-Id: I11ae4df36aa4363d136112284e1c94cadff323db
Signed-off-by: Wang Kan <quic_wkan@quicinc.com>
For dma buffer profiling,we don't konw the owner of one dma
buffer. So we add it's name to show it's owner.
If you use v1 struct to alloc/map dma buffer it will use
default buffer name "UNKNOWN". For v2 struct you can set dma
buffer name at UMD side.
CRs-Fixed: 3131442
Change-Id: I24ce6aa1d97cd9fc26d9bd8796ab2367607008f6
Signed-off-by: Fengjie Chen <quic_fengjiec@quicinc.com>
Correct log of applied req id in case the highest pd dev ranks last in
send sequence.
CRs-Fixed: 3198237
Change-Id: I5b12828e4dbf03c01b0b06bbcd21f384b7373333
Signed-off-by: Stark Lin <quic_starlin@quicinc.com>
Fd is a user-accessible value, referring it multiple times
leads to TOCTOU issues. Dma_buf can be freed after the 1st
use of fd and userspace can create another dma_buf but with
same fd. In such scenario, during 2nd use of fd, we may get
a different dma_buf with different length. To avoid this, we
can use same dma_buf instead of retrieving it twice using same
fd. In this change FD is accessed only once in syscall.
CRs-Fixed: 3159446
Change-Id: I00eb6dd3d798165f5c6c0bd59feabe80a68592b1
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
This change adds supoort for variable fps feature, this
feature needs to stream off the sensor at EOF. So, this
change sends an EOF event to sensor to do the streamimg
off. Since sensor only outputs one frame every round, so
we need to apply the IFE packet to HW immediately, then
the every frame will be valid frame.
CRs-Fixed: 3178221
Change-Id: Ifc57987aac11c9655edd979734e5568c19262571
Signed-off-by: Wang Kan <quic_wkan@quicinc.com>
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
In case of bubble recovery stalling try internal recovery,
halt, reset and resume IFE pipeline. If internal recovery
succeeds skip notifying userland for pipeline recovery.
If the same slot [same request] is stalled again, it will
flag for userspace recovery.
CRs-Fixed: 3098892
Change-Id: I6fff844fecd653897451ab920ddf6c4d8ca2f49e
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
Optimize the names of some functions and add declaration
for them in head file.
CRs-Fixed: 3164829
Change-Id: Ia10ab83e0b6164a82fdd21b351477294bf4bbe4b
Signed-off-by: mingpan <quic_mingpan@quicinc.com>
When the req id of a slot is -1, we don't update the
last applied idx for this slot, if a bubble issue is
reported on previous slot, then we won't reset its
status to ADDED, then we will force reset it during
moving to new slot, then this slot will be reset, its
status will be NO_REQ after reset, then wr idx will be
increased even though the wr idx isn't equal to rd idx.
This change updates the wr idx only when wr idx is equal
to rd idx, and always update last applied idx.
CRs-Fixed: 3157732
Change-Id: I9e6cae019f93c7c12e81708a84e1ac28bf64bbc8
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
In rare scenarios, FD is getting released by userspace
before incrementing the ref count. We see failure in
dma_buf_get API as FD is released but we are still
tying to decrement ref count in case of dma
buf get failure.
We are seeing use-after-free as the buffer is released.
This fix includes get_file API to increment ref count
before dma_buf_fd.
CRs-Fixed: 3156174
Change-Id: Ie9588ec10e65cbb8fa155badda4f3e5fb81c0525
Signed-off-by: Chandan Kumar Jha <quic_cjha@quicinc.com>
This change does hw recovery and reapply all alive requests
for bus overflow issues.
When we face bus overflow KMD fatal errors, instead of
sending error to UMD, we will try internal recovery and
send a warn message to UMD once internal recovery happens,
if we fail to do recovery, then sending error to UMD.
CRs-Fixed: 3098892
Change-Id: Idee3679ff06227f985e106470bc1f5a14c9cb404
Signed-off-by: chengxue <quic_chengxue@quicinc.com>
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
Shared memory is initialized by CRM and used by
other drivers; with CRM not active other drivers
would fail to access the shared memory if
memory manager is deinit. Reader Writer locks can
prevent the open/close/ioctl calls from other drivers
if CRM open/close is already being processed.
Issue observed with the below sequence if drivers
are opened from UMD directly without this change.
CRM Open successful,ICP open successful,
CRM close in progress, ICP open successful,
mem mgr deinit and CRM close successful,
ICP tries to access HFI memory and result in crash.
This change helps to serialze the calls and prevents
issue.
CRs-Fixed: 3019488
Change-Id: I84d50918713686a067c0e3deb64c9c6ae9edfcb5
Signed-off-by: Tejas Prajapati <quic_tpraja@quicinc.com>
This change is to print log in rate limit on unified SOF v4l2
error.
CRs-Fixed: 3099416
Change-Id: I2fed0c05a8180527cf5870406c43c952505956c6
Signed-off-by: Ayush Kumar <quic_ayushkr@quicinc.com>
The 'l_device' pointer in __cam_req_mgr_destroy_subdev is
set to NULL after freeing but this is done on a
local copy of the variable in stack. This results in
double-free when this function is called again. To avoid
this, pass 'l_device' pointer by reference and assign it
to NULL after freeing.
CRs-Fixed: 3120468
Change-Id: If2dde6f1c702bee26a3c8a68c2f45bafbf0f7cd6
Signed-off-by: Nirmal Abraham <quic_c_nabrah@quicinc.com>
On CSID encountering a fatal rx error, notify phy to update it's
aux settings for the given data rate when it streams on the
next time. The phy device will book keep all the data
rates that need updated aux settings and on all the
occasions they are streamed on the updated aux settings will
be configured. This is supported for all data rates
from 1.2 - 2.35 GSpS. The change also adds a debugfs in phy driver
to disable aux settings update altogether.
CRs-Fixed: 3120043
Change-Id: Ia1ea3b9278c2eb918a527ee3d7b1ecfe53c4f2c2
Signed-off-by: Jigar Agrawal <quic_jigar@quicinc.com>
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
Instead of correct link handle, if some other handle like
dev handle is passed then it may access some other data space.
To avoid such scenario, need to check whether link handle
passed by ioctl is same as retrieved link handle.
CRs-Fixed: 3120454
Change-Id: Idff2e3c25b60563788ffb426c7cabc367c3c97f8
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
bufq mutex can be destroyed at unmap, if other thread
is trying to lock the bufq mutex it can result in
bad magic number. To avoid such race condition
check bitmap with protection of global mutex lock.
CRs-Fixed: 3120472
Change-Id: Id95be0faa5b0d921c4a0370ea5d2f3b23c229280
Signed-off-by: Tejas Prajapati <quic_tpraja@quicinc.com>
When set, buffers will be mapped within 32-bit region
address space and in patching, if Shared or CmdBUffer is
not set for such buffers - patch the value with right shift
by 8. kmd does as below.
Map:
Shared or CmdBuffer : Mapped within 32bit.
HwAndCDMOrShared : Mapped within 32bit
others(HwAccess) : Mapped within 40bit
Patching:
Shared or CmdBuffer : as is
HwAndCDMOrShared : iova >> 8
others (HwAccess) : iova >> 8
Shared/CmdBuffer takes precedence over HwAndCDMOrShared.
CRs-Fixed: 3128094
Change-Id: Ifd9f5beaf2659f77544cd0722ef7f60d6c0684a7
Signed-off-by: Pavan Kumar Chilamkurthi <quic_pchilamk@quicinc.com>
After flushed, KMD reports ERR including isp, actuator, sensor, flash.
However many CRs don't have fatal KMD error log, but participant is KMD.
Remove the non-fatal KMD error log.
CRs-Fixed: 3095401
Change-Id: I0e5e370c0c4d1daceb72d9eed8d0c45baad5179e
Signed-off-by: Wang Kan <quic_wkan@quicinc.com>
Fix few incorrect log and add ctx id for
irq handling log.
CRs-Fixed: 3101894
Change-Id: Ibd2783124ed6354a379b9804e6e6bc01f2ab6fb3
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
Create common root folder under debugfs root named camera at probe. Add
utility functions to create subdirectories under the common camera root.
CRs-Fixed: 3093049
Change-Id: Ia4cefb5d2263ecabf1b9d70deefa1ee624b04f07
Signed-off-by: Anand Ravi <quic_ananravi@quicinc.com>
Based on compilation flag CONFIG_CAM_TEST_ICP_FW_DOWNLOAD, ICP
FW load/unload sequence can be verified. This change initializes
memory manager for load and de-initializes memmgr during unload.
To trigger FW download-
adb shell "echo "load" > /sys/kernel/debug/camera_icp/icp_fw_load_unload"
FW unload -
adb shell "echo "unload" > /sys/kernel/debug/camera_icp/icp_fw_load_unload"
CONFIG_CAM_TEST_FW_DOWNLOAD needs to be set only for testing
FW loading when camera server is not enabled.
The change also adds protection for repeated memmgr init/deinit calls.
CRs-Fixed: 3097781
Change-Id: Iceb5089793313b086b9d4fc3770a87860237e741
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
Currently sensor and csiphy has the same priority in shutdown
sequence. This is sometime calls sensor shutdown before csiphy
and with the AON usecase it is failing with CPAS related operation.
This change introducing the new enum entry for the Medium_low, which
make sure the csiphy shutdown gets call before the sensor shutdown
in order to make the operation in align with cross modules.
CRs-Fixed: 3084672
Change-Id: I40f495151392f96ac89caf8df852ed8326b79d9b
Signed-off-by: Jigarkumar Zala <quic_jzala@quicinc.com>
In case of bubble, reset all slots starting from bubbled
request slot to the last applied slot. On occasions of
workq delays, this might lead to having a slot in the
wrong state.
CRs-Fixed: 3079337
Change-Id: I08dc4cf4f00f487b34eddd1771c67b3c1a8319ce
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
dma_buf_vunmap function signature changed between kernel version
5.10 and 5.15.
CRs-Fixed: 3088126
Change-Id: If6ef72aa7839e358bc6d7a384e628b760ecaf265
Signed-off-by: zhuo <quic_zhuo@quicinc.com>