Commit Graph

43 Commits

Author SHA1 Message Date
Petar Nedev
f22f48c91f msm: camera: sync: Add support for synx objects
Add support to create, release, signal and import a synx object
using the existing generic fence operations. Handle signaling of
underlying synx object when a sync object is signaled & vice versa.

CRs-Fixed: 3317280
Change-Id: Ia6fac6eb732ed7091ec62f04875bdb30d88c8676
Signed-off-by: Petar Nedev <quic_pnedev@quicinc.com>
2022-10-27 17:06:36 -07:00
Joshua Florez
80f048e0b7 msm: camera: sync: Fix out-of-bounds access in sync create and release
Fixes an out-of-bounds access caused by pointer casting in sync create
and sync release functions.

CRs-Fixed: 3309201
Change-Id: I2e206eeab59f627d0f724362483899cdecd14324
Signed-off-by: Joshua Florez <quic_jflorez@quicinc.com>
2022-10-13 16:06:37 -07:00
zhuo
a0ca9a026c msm: camera: common: Fix some compile errors
This change fix unannotated fall-through between switch labels error,
also fix unused label error.

CRs-Fixed: 3247171
Change-Id: Ida29c08eed0cebec05b36e0ebac3d55ce8c6a014
Signed-off-by: zhuo <quic_zhuo@quicinc.com>
2022-09-19 18:36:22 -07:00
Karthik Anantha Ram
167437bdeb msm: camera: sync: Avoid use after free
There is a narrow window, in which the critical section is
not fully protected which possibly could lead to use after free.
To avoid this, hold the row lock and validate the state prior
to processing the dma fence.

CRs-Fixed: 3273450
Change-Id: Ib1f09e62a5060a38b5cd8f3d4594bce2e533b3d3
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
2022-09-13 16:07:33 -07:00
Sokchetra Eung
d2a1f0c968 msm: camera: common: memset usage optimization
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>
2022-07-26 11:03:32 -07:00
Karthik Anantha Ram
07afaf5e79 msm: camera: sync: Remove third party copyright update for 2021
Update sync headers to remove third party update for year 2021.

CRs-Fixed: 3207212
Change-Id: I30d029d5755d4fb129c256f9771b20c115970388
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
2022-06-09 16:39:21 -07:00
Karthik Anantha Ram
a130199cd3 msm: camera: sync: Add support for dma fences
Add support to create, release, signal and import
a dma fence. When a sync object is imported for a dma fence
signal the dma fence when signaling the sync object with
appropriate status. This is achieved by implementing
generic fence scheme. The change also adds support
for batched fences.

CRs-Fixed: 3207212
Change-Id: I23fbc0992281cfee0303e213a30bce138ae7bdff
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
2022-06-08 13:06:40 -07:00
Anand Ravi
cbe499e9eb msm: camera: common: create a common root folder for debugfs
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>
2021-12-22 16:43:42 -08:00
Karthik Jayakumar
9716446091 msm: camera: common: Remove return from debugfs_create_bool
Remove return checks from debugfs_create_bool, as the API changed in
kernel 5.15+.

CRs-Fixed: 3048249
Change-Id: I2351776615a5fb17db1c54d285be2bf8e55443ab
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2021-11-01 13:15:33 -07:00
Trishansh Bhardwaj
0d847c06fe msm: camera: sync: Prevent OOB access of sync name
Issue:
strlcpy calls strlen on src ptr. If src is not NULL terminated then OOB
access will occur in below stack.
  strlen
  strlcpy
  cam_sync_init_row
  cam_sync_handle_create
  cam_sync_dev_ioctl

Fix:
Pad user-space supplied name with NULL.

CRs-Fixed: 3010262
Change-Id: Ib5c2fbfe395025ec05e0bb2980f86111e95ff54c
Signed-off-by: Trishansh Bhardwaj <tbhardwa@codeaurora.org>
2021-08-31 10:24:05 -07:00
Ayush Kumar
8554f46816 msm: camera: core: Add delay detection support
This changes is to detect workqueue and tasklet
scheduling and execution delay.

CRs-Fixed: 2977775
Change-Id: Ia4b4845a067c22bd1f24bd63a971d103fcfc049c
Signed-off-by: Ayush Kumar <ayushkr@codeaurora.org>
2021-08-11 22:18:10 +05:30
Camera Software Integration
32701c91b2 Merge "msm: camera: sync: Append sync obj's name in log" into camera-kernel.lnx.5.0 2021-07-28 20:37:52 -07:00
Sokchetra Eung
56706b93b3 msm: camera: sync: Append sync obj's name in log
Append sync obj's name to logs to help debugging.

CRs-Fixed: 2998236
Change-Id: I461865b72e49b11267c2dc20176985b4545a42e8
Signed-off-by: Sokchetra Eung <eung@codeaurora.org>
2021-07-26 19:56:28 -07:00
Sokchetra Eung
ba664cddff msm: camera: common: Append workq name in log
Append workq name in workq delay detect API to identify
which workq is scheduled late. Create workq name macros for
cci and cpas to pass to workq delay detect API.

CRs-Fixed: 2994927
Change-Id: Iebc14520b918272e92b59c900de5fe17f38a2406
Signed-off-by: Sokchetra Eung <eung@codeaurora.org>
2021-07-26 17:43:37 -07:00
Gaurav Jindal
bc400e47fa msm: camera: common: Add common wait and poll interface
In current implementation, each driver call wait_for_completion_timeout
and readl_poll_timeout with own timeout values.
In case of slow environments like presil, lot of hacks are needed to
change the timeouts for each driver. It needs multiple code changes
and compilations, thus consuming time.
This commit implements a common interface to call
wait_for_completion_timeout and readl_poll_timeout.
Debug variable is also introduced to
change the timeout value. This will help to change the timeout
without compilations and changes at multiple places.

Change-Id: Iba51e0805a49ed325147a12688c2fe6619bb68e6
CRs-Fixed: 2830502
Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
2021-03-02 14:17:09 +05:30
Karthik Jayakumar
8615106476 msm: camera: req_mgr: Update V4L2 enum names for Waipio
V4L2 driver macro VFL_TYPE_GRABBER has been renamed to VFL_TYPE_VIDEO
in linux kernel 5.8+.

CRs-Fixed: 2835738
Change-Id: Iaddec45b3532094a110e386c6462f08c36a5fd21
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
Signed-off-by: Jeyaprakash Soundrapandian <jsoundra@codeaurora.org>
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2021-01-22 10:22:38 -08:00
Shravya Samala
41cdb719fd msm: camera: sync: Increase V4l2 queue size to 250
For MFHDR plus EIS case, both long and short exposure
input ports will be connected. Thus overall connected
ports for EIS will be 8, resulting in V4L2 queue
depth to 240.

CRs-Fixed: 2794286
Change-Id: I12a1ae4129ccb7e3b7211a22891016ecd769b949
Signed-off-by: Shravya Samala <shravyas@codeaurora.org>
2020-10-20 22:37:50 -07:00
Tejas Prajapati
4574450a12 msm: camera: common: Merge camera-kernel.3.1 changes in camera-kernel.4.0
msm: camera: cdm: Fix dangling pointer issue
msm: camera: cdm: change work record to atomic variable
msm: camera: utils: Adding device type to track device handles
msm: camera: tfe: Reduce stack footprint during bw vote
msm: camera: req_mgr: Thread switch delay detection mechanisms
msm: camera: cdm: Avoid submitting BL if FIFO is full
msm: camera: tfe: check cdm hang in the tfe config timeout
msm: camera: req_mgr: Delay detection mechanism
msm: camera: cdm: Debug info in case of cdm page fault
msm: camera: isp: Max context reduction for TFE in isp driver
msm: camera: ope: Maintain current clock value during acquire
msm: camera: req_mgr: Limit CAM_ERR log in case of no empty task
msm: camera: cdm: Decrement write-count only after Bl commit
msm: camera: isp: Added CSID recovery mechanism.

CRs-Fixed: 2792394
Change-Id: I1c7a903ae15b572acf3f6318cda7394cb6549c8d
Signed-off-by: Tejas Prajapati <tpraja@codeaurora.org>
2020-10-13 12:08:01 +05:30
Karthik Jayakumar
8f95314e74 msm: camera: sync: Fix imports for types
Fix the order of imports for to resolve cam_sync
typedef for kernel CFI.

CRs-Fixed: 2772200
Change-Id: I4e5e642e6b45412904585aaa68c0ef77fedeee2d
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2020-09-18 16:11:21 -07:00
Alok Chauhan
baf2d520ed msm: camera: sync: Rearrange sync reason events
Rearrange sync error reason code for better code
readability.

CRs-Fixed: 2750553
Change-Id: Ia64694155921c074946167763815a87beb856b35
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2020-08-24 13:48:40 +05:30
Alok Chauhan
1d1edb7030 msm: camera: sync: Add SYNC_V4L_EVENT_V2 support in sync driver
Add SYNC_V4L_EVENT_V2 support in sync driver. As part of this
change, added the reason code field as part of sync event header.
This failure reason code is filled by camera kernel driver and
propagate to userspace.

CRs-Fixed: 2750553
Change-Id: I206d0d51c38cfe4214814b89d241f51c1f50605b
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2020-08-16 11:14:20 +05:30
Karthik Jayakumar
7c8204a42d msm: camera: common: Enable debugfs compile check
Guards debugfs features in camera driver to only be compiled when
CONFIG_DEBUG_FS is enabled.

CRs-Fixed: 2717236
Change-Id: I0de77741301d259cbec64e8a2e27830981b2b69d
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2020-07-01 10:59:24 -07:00
Jigarkumar Zala
279dfebf8c msm: camera: common: Fixes the exit module code flow
Fixes exit call flow as a part of rmmod.

CRs-Fixed: 2675526
Change-Id: I47111a737cb06d9bb3d0a417a471c5c9fb545999
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
2020-06-09 12:08:22 -07:00
Camera Software Integration
f458d8e16a Merge "msm: camera: sync: Increase number of fences in sync" into camera-kernel.lnx.4.0 2020-05-26 13:14:29 -07:00
Pavan Kumar Chilamkurthi
74410fea6b msm: camera: sync: Add SYNC_CANCEL support in sync driver
Add SYNC_CANCEL definition and signal CANCEL instead of
ERROR in flush cases.

CRs-Fixed: 2673810
Change-Id: I1bd83e382f9b38f5f020a5af3b883083e211e3d2
Signed-off-by: Pavan Kumar Chilamkurthi <pchilamk@codeaurora.org>
2020-05-20 12:48:36 -07:00
Mukund Madhusudan Atre
bfdaaba4eb msm: camera: sync: Increase number of fences in sync
Some mfhdr usecases require more than 1024 fences because of
delayed request processing and bypass. Increase maximum number
of fences or sync objects to 2048.

CRs-Fixed: 2598592
Change-Id: If11fa2986fce0cd97c14370d29a117230134d6f5
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
2020-05-11 14:26:17 -07:00
Karthik Jayakumar
28be26b740 msm: camera: sync: Fix kbuild config checks for synx driver
External configs should be checked by using IS_REACHABLE/IS_ENABLED
macro's to check if the config option is set for the build target.

CRs-Fixed: 2584631
Change-Id: I07a0d95391a83a2264f826e2935d67686d295317
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2020-04-22 10:43:31 -07:00
Ayush Kumar
320ae57bb9 msm: camera: core: Fix context release timing issue
When sync object is invalid and num_in_map > 1,
it will lead to context ref leak. Check sync
object first, then register sync call back.

CRs-Fixed: 2594185
Change-Id: I2d39ce3ea43bbe7bc05420b86b37fdfba4aa795a
Signed-off-by: Ayush Kumar <ayushkr@codeaurora.org>
2020-03-13 12:16:46 -07:00
Mukund Madhusudan Atre
0a649b3063 msm: camera: common: Fix failures in v4l2 unregister during error
Missing video unregister was causing list delete corruption.
Also, there were double free errors in Sync and CRM driver. Fix
v4l2 issues by adding the missing unregister calls and changing
release callback to empty, because we are freeing it during
cleanup. Improve logging during bind/unbind to better reflect what
is happening.

CRs-Fixed: 2584631
Change-Id: Idc5db655d22df54e8bdb470d29896e10f6987796
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
2020-02-28 16:02:56 -08:00
Mukund Madhusudan Atre
5cb000ee7f msm: camera: common: Add component helper support in camera
Due to the asynchronous nature of platform probes, inter
dependency between drivers needs to be taken care during
kernel boot up. Component helper provides the facility of
adding matching drivers in a list ordered in the way we want
to bind those drivers. The CRM driver acts as component master
to make sure all slave drivers are bound before it returns
from its own bind call. Add support for serializing platform
probes through component framework.

CRs-Fixed: 2584631
Change-Id: I345da1d2b9cccf6021ac6fc899143013b7714ec4
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
2020-02-05 22:58:13 -08:00
Alok Pandey
cc79abb0a5 msm: camera: sync: correcting atomic read operation
This change rectifies the reading of atomic variable.

CRs-Fixed: 2591537
Change-Id: I13c289bc00a07d5c2289e2e3f13245bbc521d4ee
Signed-off-by: Alok Pandey <akumarpa@codeaurora.org>
2020-01-30 13:18:30 -08:00
Jigarkumar Zala
376b7a3351 msm: camera: sync: Enable driver registration with dtsi match
Currently sync driver is independent from dtsi matching in order
to get it probe. Update the logic to make sure probe is getting
invoked if respective dtsi is present.

CRs-Fixed: 2590413
Change-Id: I69124e49d68e223d082521a9431cb7e8d846e8d7
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
2020-01-15 16:39:25 -08:00
Mukund Madhusudan Atre
42021c8b76 msm: camera: common: Add device caps for full devices during probe
The v4l2 registration requires all devices that are not subdevs
to have device caps field to be non zero. Add device caps for
CRM and SYNC devices during probe.

CRs-Fixed: 2582994
Change-Id: I804e7bc00d597debc39d1f71259cf607c60ed069
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
2019-12-20 17:44:51 -08:00
Jigarkumar Zala
03b6c2140f msm: camera: common: Make platform register centralized
Currently camera modules platform registration/remove function
is being called as a part of module_init function individually.
Building camera as module, current infrastructure cannot support
it, as DLKM only support single module_init/exit function.
This change enables that support by combining all platform
entry/remove functions centrally. Also, remove all submodule
makefiles and combined into one root makefile in order to generate
single kernel object file to dynamically loading the kernel module
in case of DLKM compilation.

CRs-Fixed: 2569808
Change-Id: I59db3ed6cef60123e474db2f222c39836056bd6e
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2019-12-04 12:33:01 -08:00
Abhijit Trivedi
9b6110b579 UPSTREAM: 11/12/19: Merge 'quic/camera-kernel.lnx.1.0' into 'quic/camera-kernel.lnx.4.0'
* quic/camera-kernel.lnx.1.0:
  msm: camera: common: Update uapi to support custom hw features
  msm: camera: ife: calculate accurate boot timestamp at CSID SOF
  msm: camera: cpas: Update ife_rd safe lut value
  msm: camera: sensor: Remove true/false redefinitions
  msm: camera: reqmgr: Add support to modify timer for long exposure
  msm: camera: reqmgr: Add provision to obtain exposure time
  msm: camera: cpas: Fix TCSR Register programming
  msm: camera: cci: Fix cam_cci_get_subdev for conditional compilation
  msm: camera: utils: Remove deprecated clk_set_flag functions
  msm: camera: csiphy: Update DPHY combo mode sequence
  msm: camera: csiphy: Correct Dphy mission mode sequence
  msm: camera: core: Fix extraneous variable declaration
  msm: camera: icp: Remove qcom soc dependency
  msm: camera: sync: Dump fence info in case of fence exhaust
  msm: camera: icp: Use CAM_PERF for clock, bw related logs
  msm: camera: common: va_end should follow va_start
  msm: camera: common: Fix integer overflow in shift
  msm: camera: reqmgr: Remove division on uint64_t
  msm: camera: isp: Improve isp substate logging
  msm: camera: isp: Limit sof_in_epoch log to first frame
  msm: camera: jpeg: Add plane stride & slice height debug info
  msm: camera: isp: Change state immediately in flush
  msm: camera: isp: Dump isp req for cdm timeout
  msm: camera: ife: Add packing format support
  msm: camera: icp: Fix AHB, AXI voting in icp
  msm: camera: ife: Remove duplicate add to port counters
  msm: camera: csiphy: Update CPHY 3-phase registers for CSIPHY v1.2

Change-Id: I93948d5cfcf2c8dea921d34696456490abd6f1e5
Signed-off-by: Abhijit Trivedi <abhijitt@codeaurora.org>
2019-11-12 12:51:34 -08:00
Karthik Jayakumar
524b1ab1d4 msm: camera: config: Makefile fixes to support legacy kernel build system
Adds fixes to makefile in order to support legacy kernel build systems.

CRs-Fixed: 2560543
Change-Id: Iab571871e5171aab501c41496cc09e3c5d942985
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2019-11-06 13:26:57 -08:00
Camera Software Integration
62977f2492 Merge "msm: camera: sync: Dump fence info in case of fence exhaust" into camera-kernel.lnx.1.0 2019-11-06 07:07:36 -08:00
Karthik Jayakumar
2a7ffe9697 msm: camera: sync: Dump fence info in case of fence exhaust
Add error message in case of fence exhaust.
Add support to dump fence table in case of fence exhaust.

CRs-Fixed: 2556458
Change-Id: I9910a04c69b54fe99541524b6581fa9994fd523f
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2019-10-31 14:19:17 -07:00
Trishansh Bhardwaj
3619ae634b msm: camera: reqmgr: Logs v4l2 event queue failure
Kernel uses v4l2 events to communicate with userspace.
If userspace is not dequeuing events and kernel is pushing more events
then v4l2_event_queue fails silently.
This change uses v4l2 callbacks to log v4l2_event_queue failure.

CRs-Fixed: 2541894
Change-Id: I98f8f609f615104ec6dde569bf1f39de1eb368fc
Signed-off-by: Trishansh Bhardwaj <tbhardwa@codeaurora.org>
2019-10-15 17:46:51 -07:00
Trishansh Bhardwaj
f648ceeca6 msm: camera: req_mgr: Increase v4l2 queue length
EIS have 6 fences per request and uses 15 frame window. On camera close
it signals ~90 fences at once. This can overflow v4l2 event queue.

Increase v4l2 queue length for sync events to prevent overflow.

CRs-Fixed: 2498880
Change-Id: Ie886318168e326c1525b4f8be5cacc5f70d0c477
Signed-off-by: Trishansh Bhardwaj <tbhardwa@codeaurora.org>
2019-09-09 18:36:39 -07:00
Jigarkumar Zala
5b016ad220 Camera: Correct makefiles for correct header inclusion
Correct some Makefiles and drivers header inclusion.

Change-Id: Iec3e6e0333ae55e8f1cff9780723e0dad954ff83
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
2019-08-09 16:27:18 -07:00
Jigarkumar Zala
f1135e91b9 msm: camara: sync: Add callback registration logic for synx
Synx driver is dependent on camera driver for registering callback
functions of sync driver. This change invert the logic, and camera
driver will register the callback functions for synx driver at the
time of sync driver probe.

Change-Id: I2dbee15ba4c7a9dde336a4bb1f2a4dddcd90348b
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
2019-07-09 10:34:33 -07:00
Jigarkumar Zala
05349feaa2 Camera: Bring over camera driver changes
Bring over camera driver changes as of msm-4.19
commit  5a5551a7 (Merge "msm: camera: reqmgr: Fix CRM
shift one req issue").

Change-Id: Ic0c2b2d74d1b3470c1c51d98228e312fb13c501a
Signed-off-by: Jigarkumar Zala <jzala@codeaurora.org>
2019-07-08 10:24:55 -07:00