Commit Graph

70 Commits

Author SHA1 Message Date
Abhijit Trivedi
7f3c540b78 Catch up diff
Change-Id: Ie11e070d33e9dc83e96f7ae783fcc2e5e0273a40
Signed-off-by: Abhijit Trivedi <quic_abhijitt@quicinc.com>
2022-11-16 14:14:20 -08:00
Mukund Madhusudan Atre
55f49dc3ab msm: camera: common: Enhance timestamp printing in camera
Add precision to nanosecond part of monotonic timestamps.
Update delimiters between second and nanosecond values.

CRs-Fixed: 3307225
Change-Id: I4e7aab0ea9256c2ff769a87c3873002d715ed3c9
Signed-off-by: Mukund Madhusudan Atre <quic_matre@quicinc.com>
2022-10-18 21:36:17 -07:00
Sokchetra Eung
56cc1d37bc msm: camera: common: Fix invalid packet access
Instead of caching packet address pointer, store packet handle
in page fault req info structutre to obtain packet address through
mem manager to avoid potential access to dangling packet pointer which
resulted from UMD called to free the packet buffer before kernel finishes
handling page fault. If the packet was freed, then querying to get packet
address from memory manager will fail since the mem handle is invalid.
If it is invalid, the page fault handler will return before accessing
the dangling packet.

CRs-Fixed: 3287554
Change-Id: I02bc0c706b64f1dc0d098d8189f2f129a91efba7
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
2022-09-19 18:36:54 -07:00
Mukund Madhusudan Atre
c73578236c msm: camera: common: Add support for bw update blob v3
Add support for bw update version 3. Add provision to
maintain cpas per path bw info internally in drivers.

CRs-Fixed: 3065551
Change-Id: I65e97c6e41f933818f1211bbc27651842e93c028
Signed-off-by: Mukund Madhusudan Atre <quic_matre@quicinc.com>
2022-06-09 12:07:17 -07:00
Sokchetra Eung
ed138ccd45 msm: camera: common: Fix TFE and OPE compilation errors
Fix syntactical errors that resulted in failed compilation
for TFE and OPE.

CRs-Fixed: 3179075
Change-Id: Iec4dc104160651fb46b18be17a556356dce3b3c0
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
2022-05-11 18:39:35 -07:00
Tejas Prajapati
2827395809 msm: camera: reqmgr: reader writer locks to avoid memory faults
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>
2022-04-13 17:06:43 -07:00
sokchetra eung
c52c83e7ce msm: camera: common: Page Fault notification to userspace
Upon Page Fault, smmu driver invokes faulted client's callback
which looks for faulted buffer and context. The client driver
can be ISP, ICP, JPEG, IFE CDM and CPAS CDM. The driver then
fills PF msg struct, logs related info, and notify PF msg to
userspace. Userspace is expected to abort and calls to shut
down kernel drivers. When Titan powers on next session, CAMSS
undergoes async reset.
This change also ensures the page fault related changes added
to TFE, OPE, CRE do not break the drivers compilation.

CRs-Fixed: 3156671
Change-Id: Icd6c8c9a38cac206fe8260d374d03964fb280879
Signed-off-by: sokchetra eung <quic_eung@quicinc.com>
2022-04-07 20:36:52 -07:00
Alok Chauhan
d43146eb4f msm: camera: ope: Update request timeout for NRT/RT context
Currently the ope request timeout value for RT and NRT context
are same. In some usecases, NRT request processing takes more time.

Hence, initialize the RT and NRT request timeout value separately.

CRs-Fixed: 3082993
Change-Id: I17e86d26403fb21cdff518a81dee7a19c865144e
Signed-off-by: Alok Chauhan <quic_alokc@quicinc.com>
2022-04-07 20:36:21 -07:00
Jigar Agrawal
3c8d5b58ea msm: camera: cdm: Remove Kernel Internal Buffer for Gen IRQ
Currently we allocate the memory for CDM GENIRQ command
within the Kernel on every stream on. Presil framework
do not have an ability to transfer the kernel only buffers
to the user daemon. For that reason we need to add support
to use the user allocated command buffer instead of the
kernel generated memory to add the GenIRQ cdm command
while submitting BLs. This change also helps to reduce
the stream on and stream off latency by not having to
allocate and free the GENIRQ memory on every stream on and
stream off respectively.

CRs-Fixed: 3115399
Change-Id: Ic159efd56fb9c4480ed1eb25cf2c058cbb914332
Signed-off-by: Jigar Agrawal <quic_jigar@quicinc.com>
2022-03-31 17:36:35 -07:00
Vikram Sharma
8a16e39373 msm: camera: ope: Increase max bl limit and max stripe to process
Increase “OPE_MAX_CDM_BLS” to 32 from 24 and MAX_STRIPES to
64 from 48.

CRs-Fixed: 3082993
Change-Id: I9e3631cc86c5e10e4e2020d4a9b2264ea282e437
Signed-off-by: Vikram Sharma <quic_vikramsa@quicinc.com>
2022-03-03 14:31:39 -08:00
Karthik Jayakumar
28239ed1e6 msm: camera: core: Control expanded memory patching per caller
Force callers to say if they are using 36 bit address patching or not.

CRs-fixed: 3121782
Change-Id: I4dee25e3f73104a1be043fe18a295cd4f8447821
Signed-off-by: Karthik Jayakumar <quic_kjayakum@quicinc.com>
2022-02-03 23:06:09 -08: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
Mukund Madhusudan Atre
5dba22d1fc msm: camera: common: Add buffer send and receive mechanism
Add packet based buffer send and retrieve mechanism for
presil testing.

CRs-Fixed: 2932495
Change-Id: Ifd1e0fdb8b12feabb884e02a07a3813db01a3899
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
2021-09-09 12:41:00 -07:00
Alok Chauhan
35c1f46e6b msm: camera: ope: Fix uninitialized variable access
Update ope pf dump function for uninitialized variables
access.

CRs-Fixed: 3020020
Change-Id: I7a996b15c8fe48297bcd160be3dbf4c7b65dc41d
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2021-08-31 10:24:12 -07:00
Savita Patted
a1e328751b Merge "msm: camera: core: v780 enhanced memory addresses" into camera-kernel.lnx.5.0 2021-07-08 13:23:13 -07:00
Karthik Anantha Ram
d785949196 msm: camera: common: Change shutdown sequence for subdevices
In subdev close call if CRM is still active wait for shutdown
from CRM [media device]. Remove subdevice check for active
handles, shutdown to happen irrespective of any active context.

If CRM is not active, subdevice shutdown should ensure there is
no access to kernel allocated buffers since at this point
memmgr is de-initialized.

As part of ICP close, remove usage of HFI queues, trigger PIL
to transfer FW memory ownership back to HLOS and power off ICP.

CRs-Fixed: 2976107
Change-Id: Ib05b3fbdcc33f4072da7ef77cf0118a807860e8c
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
2021-06-30 17:04:11 -07:00
Karthik Jayakumar
0d00f4feee msm: camera: core: v780 enhanced memory addresses
Added support for v780 enhanced memory address handling

CRs-Fixed: 2948659
Change-Id: I46ed16ad70103553a18cc69d762c6d93fc9fd8d9
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2021-06-29 11:08:03 -07:00
Karthik Jayakumar
9e5bc7a1f4 msm: camera: common: Fix dma_attr_t types
Fixes typecasts from dma_attr_t types to uint32_t types for memory
management.

CRs-Fixed: 2948659
Change-Id: Ie3898176195ac508f1a922a5e499e6e33ac8e490
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2021-06-23 10:09:24 -07:00
Savita Patted
68de607556 Merge "msm: camera: req_mgr: Enhance camera v4l2 subdev shutdown sequence" into camera-kernel.lnx.5.0 2021-06-21 18:38:47 -07:00
Jigar Agrawal
b5c4f91b83 msm: camera: common: Add a check for 0 reg-val pairs in cdm command
Add a check for reg-val count=0 in reg_random command. Count=0 in
reg_random cdm command will throw an invalid command HW error.

CRs-Fixed: 2916477
Change-Id: Idb8654c3752963cf5a52147d350e291208b917d0
Signed-off-by: Jigar Agrawal <jigar@codeaurora.org>
2021-04-20 12:17:50 -07:00
Haritha Chintalapati
d62972c20f Merge "msm: camera: common: Use the appropriate header for spinlock" into camera-kernel.lnx.5.0 2021-04-14 19:20:47 -07:00
Alok Chauhan
2ebae4fabe msm: camera: req_mgr: Enhance camera v4l2 subdev shutdown sequence
when provider crash occurred, there was a CSID lane overflow
observed due to shutdown sequence from CRM(sensor, csid, csiphy).
To fix the issue need to change the shutdown sequence
(csid, sensor, csiphy).

This change will update the devices sequence in order while registering
and close the sequence accordingly.

CRs-Fixed: 2852076
Change-Id: Ia6d8022e995823bf031400c33528eb8544dc2e29
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2021-04-14 05:20:37 -07:00
Karthik Anantha Ram
9f4f8e114c msm: camera: common: Use the appropriate header for spinlock
With the allow list tightened, use the right header for spinlock
usage. Change replaces usage of linux/spinlock.h to
linux/spinlock_types.h.

CRs-Fixed: 2841729
Change-Id: I0247501b765436099f75c9725e9f614f0873c888
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
2021-04-12 14:42:58 -07:00
Alok Chauhan
12306c0a9e msm: camera: ope: Update for new IQ modules
Added changes to dump new IQ modules as well
in OPE during page fault and hang scenarios.

CRs-Fixed: 2878214
Change-Id: I97e7d4ee2ed9899ed299155c9aca8b094dff18f0
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2021-04-06 22:17:24 +05:30
Alok Chauhan
a78cf863fd msm: camera: ope: Dump stripe info at the time of hang
Add logic to dump stripe info and wait event status at the
time of cdm hang.

CRs-Fixed: 2878214
Change-Id: Ib9892b0273e4436988c5f1384d18d60d29529c94
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2021-04-06 21:48:51 +05:30
Pavan Kumar Chilamkurthi
7f750a59f0 msm: camera: common: Use pdev name for soc dev name
Having a global variable and using the same for all devices
will overwrite the name of previous device. Use pdev name
to be consistent and helps in debugging logs.

CRs-Fixed: 2901925
Change-Id: I086f3dbd12e720c5e6497355eae40ca242d3d408
Signed-off-by: Pavan Kumar Chilamkurthi <pchilamk@codeaurora.org>
2021-03-20 19:48:08 -07:00
Savita Patted
1ee4bca76c Merge "msm: camera: ope: Handle OPE smmu fault with pid info" into camera-kernel.lnx.5.0 2021-03-09 20:18:26 -08: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
Vikram Sharma
57bff5aede msm: camera: ope: Handle OPE smmu fault with pid info
Kernel apis provide information fault caused pid and mid data.
Handle the OPE smmu fault using pid and mid data. Based on the
mid data, dump only corresponding port info which caused the
fault. Pid and mid values are target dependent, these values
will be updated on the ope node dt entries.

CRs-Fixed: 2857868
Change-Id: I909f1787e71e67e5ed1d3464dfeb506418d151e4
Signed-off-by: Vikram Sharma <vikramsa@codeaurora.org>
2021-02-24 23:40:40 -08:00
Rishabh Jain
01249ea8d9 msm: camera: ope: Add support to dynamic switch pix_pattern
Add support to dynamically switch pix_pattern of read clients
based on data received in each request.

CRs-Fixed: 2811530
Change-Id: Icb3ebd33cae59b8db87bc0011d6560492ad29c3a
Signed-off-by: Rishabh Jain <risjai@codeaurora.org>
2021-02-23 10:58:45 -08:00
Karthik Jayakumar
2c67e897da msm: camera: common: Add cam_free_clear to cam_compat
Kernel 5.10 and up have renamed kzfree to kfree_secure. As such,
we have added a cam_free_clear function to redirect all uses of kzfree
uses to the appropriate function depending on the kernel version the
driver is built against.

CRs-Fixed: 2835738
Change-Id: I72d191c9fb0454a4dbb1392894a909e81fe07caa
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2021-01-15 08:55:04 -08:00
Gaurav Jindal
1a5797c6a8 msm: camera: common: Optimize cam context memory
In current implementation, cam_ctx_req has a array of
hw_update_entries, in_map_entries and out_map_entries. Each
context has array of N requests. Memory for all contexts is
allocated during probe. This causes a huge memory remaining
unutilized.
This commit moves the memory allocation to context acquire time
and freeing this memory during context release. In place
of using array, now dynamic allocation is used.
A top level calculation shows a memory reduction of around 2M-
2.5M with this change including all the camera drivers.

CRs-Fixed: 2830502
Change-Id: Id63cf2a52272e2a419704dc95100694e384330c3
Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
2021-01-06 06:53:08 -08:00
Camera Software Integration
3224cf35c3 Merge "msm: camera: cdm: Improve error handling during cdm hang" into camera-kernel.lnx.4.0 2020-12-10 10:59:56 -08:00
Camera Software Integration
a1aae58315 Merge "msm: camera: ope: free unused memory in ope acquire" into camera-kernel.lnx.4.0 2020-12-10 10:59:47 -08:00
Haritha Chintalapati
9d99a4fc95 Merge "msm: camera: ope: Avoid submitting NULL request to CDM" into camera-kernel.lnx.4.0 2020-12-02 19:10:56 -08:00
Alok Chauhan
63bca8c33d msm: camera: cdm: Improve error handling during cdm hang
Reduce logging as part of error handling to avoid
flooding kernel log with excessive log. Apart from
that send feedback to client irrespective of cdm
reset status.

CRs-Fixed: 2826285
Change-Id: I9b0d8c6f64ced4972bb20e26774508573c815e4f
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2020-12-02 10:38:53 +05:30
Shravya Samala
c3c2045115 msm: camera: ope: Check array size of input sync obj
Incase of input buffer, check array size of input sync obj before assigning
fence.

CRs-Fixed: 2821583
Change-Id: I5cd7968cfbe0be86a8967565616bf6eb1cf7fcf7
Signed-off-by: Shravya Samala <shravyas@codeaurora.org>
2020-11-30 00:02:02 -08:00
Alok Chauhan
5a24b2b912 msm: camera: ope: free unused memory in ope acquire
OPE driver allocate memory dynamically to store cdm
acquire and bw data in acquire time and don't use later.
These memories can be freed before returning from acquire.

CRs-Fixed: 2827058
Change-Id: Ibf87282862f2ae4655da3c69016bedb7f96bca1c
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2020-11-27 12:21:44 +05:30
Alok Chauhan
e874b94c3a msm: camera: ope: Avoid submitting NULL request to CDM
In corner case, there is a chance that userspace can submit
request while flush is ongoing. In some cases submitted request
can get flushed and corresponding data structures  memory gets
freed.

Add a logic to check for pending request before submitting request
to cdm hw.

CRs-Fixed: 2815901
Change-Id: I74096201e204f204c4f15d14698b4e9af6435f55
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2020-11-24 22:02:25 -08: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
Shravya Samala
ef90082f0b msm: camera: ope: Fix false hw hang detection
While preparing config packet at HW layer,
we are setting Ope request timer even before
processing command buffer and IO cfg. This is
leading to false hw hand detection.
Expectation is Ope request timer has to
start after req is submitted to HW.

CRs-Fixed: 2788900
Change-Id: Idd1420b2ee1aed4bfe947cf5617bbec9b39147d3
Signed-off-by: Shravya Samala <shravyas@codeaurora.org>
2020-10-07 13:13:56 +05:30
Vikram Sharma
345ff8c633 msm: camera: ope: Handle race while dumping ope req list
While dumping OPE req list we were not protecting it in context mutex,
this can result into unexpected behaviors. This change take care of
protecting the dump logic using mutex.

CRs-Fixed: 2750458
Change-Id: I916822b498cde3922274c18a06b98c898bff1d65
Signed-off-by: Vikram Sharma <vikramsa@codeaurora.org>
2020-09-29 22:21:52 -07:00
Rishabh Jain
b457f5fae5 msm: camera: ope: Increase max bl limit
Increase max bl limit for OPE to 24 to support maximum
48 stripes.

CRs-Fixed: 2761455
Change-Id: I961be1344fac0084649df321225e94a50d4e5a98
Signed-off-by: Rishabh Jain <risjai@codeaurora.org>
2020-09-17 21:18:40 -07:00
Tejas Prajapati
8e746194c9 msm: camera: ope: remove the check for dev_type
Calculate the total clk of all the ctx
irrespective of the use case for the ctx. Remove
dev_type check to add all the ctx clk while
calculating total clk.

CRs-Fixed: 2754351
Change-Id: I5c1681ac1a88cfec752ff58fd8b1f6ac5d05b28a
Signed-off-by: Tejas Prajapati <tpraja@codeaurora.org>
2020-09-12 08:36:35 -07:00
Alok Chauhan
19dbfda860 msm: camera: ope: Updated logic to calculate num bw path
Ope driver was incorrectly calculating the number
of bw path. This is causing bw to be skip for some
of the ports.

Updated logic to correctly calculate number of path
based on valid path type.

CRs-Fixed: 2715586
Change-Id: I95b6dcfae454713a7b5db6d629310244bb304b19
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2020-09-04 00:13:31 -07:00
Trishansh Bhardwaj
7aa0932eeb msm: camera: common: Merge camera-kernel.3.1 changes in camera-kernel.4.0
msm: camera: ope: Fix OPE hang dump
msm: camera: cdm: Add a check for fifo list in cdm workqueue
msm: camera: ope: Add a check to validate dmi cmd address
msm: camera: ope: Add check for number of stripe
msm: camera: tfe: Support tfe pdaf port
msm: camera: ope: Handle reset IRQ delay
msm: camera: ope: enable pp modules hw status dump
msm: camera: ope: Fix OPE clock issue
msm: camera: ope: Add LDAR dump support
msm: camera: ope: Add context state check in process cmd
msm: camera: ope: Change parameters to find time difference
msm: camera: ope: Add debug fs for dumping frame setting logs
msm: camera: ope: Add debugfs support to dump ope hang dump
msm: camera: tfe: Handle unsupported outport format
msm: camera: ope: add page fault handlers in ope driver
msm: camera: ope: Reduce OPE BUS memory
msm: camera: ope: Change turbo clock limit.

CRs-Fixed: 2729996
Change-Id: I683ed07082b455599f89dbc18f353b6a1e48b129
Signed-off-by: Trishansh Bhardwaj <tbhardwa@codeaurora.org>
2020-08-30 14:22:47 +05:30
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
Camera Software Integration
73fd4e6bef Merge "msm: camera: core: Send event on smmu page fault" into camera-kernel.lnx.4.0 2020-08-21 14:07:01 -07:00
Ravikishore Pampana
b746c4f527 msm: camera: core: Send event on smmu page fault
Currently when page fault happen, iommu driver callers camera
handler with CB details and iova address which caused the page
fault. With iommu iova address cam smmu driver finds the
closest mapping address for that cb and call the
corresponding driver to find the which port caused page fault.
This has limitation has page fault address always not mapped.
New approach is get the page fault ids from iommu driver.
Based on the Pid and Mid values, get the HW id and port ids,
go through all context which has this hw id and port id and log
the data. Once context id is identified, log the acquire data and
last consumed client address details. Dump the hw register data
in the given buffer. Send the smmu page fault event through
v4l2 queue to user.

CRs-Fixed: 2750690
Change-Id: I87c809b3229992c7c95655a4f3c6c70ebc035ae8
Signed-off-by: Ravikishore Pampana <rpampana@codeaurora.org>
2020-08-19 14:16:38 +05:30
Alok Chauhan
acb34abbad msm: camera: core: Handle event failure reason propagation
Handle event failure reason propagation in camera kernel
driver. Individual camera kernel driver will fill reason
codes for sync failure and send it to sync driver. Sync
driver will add this as part of sync event header and
propagate to user space.

CRs-Fixed: 2750553
Change-Id: I284390fc45757ba8291a44400e2263b9be64b092
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2020-08-16 11:15:21 +05:30