Commit Graph

83 Commits

Author SHA1 Message Date
Dharmender Sharma
c7e96a7e98 msm: camera: jpeg: Use spin lock irqsave to avoid preemption
Use spin_lock_irqsave utility to avoid preemtpion of process_cmd thread
in jpeg. This can come in rare conditions when IRQ is received on same
CPU which is handling the thread.
Such cases will result in deadlock conditions.

CRs-Fixed: 3712176
Change-Id: Ib0d9997495272ab49a75b0419eb1e0fd84b1962c
Signed-off-by: Dharmender Sharma <quic_dharshar@quicinc.com>
2024-02-01 21:58:42 -08:00
Ayush Kumar
aeef5b37db msm: camera: cpas: Add support for Crow Camera
This change adds camnoc interface changes and CPAS version
change for Crow camera.

CRs-Fixed: 3426117
Change-Id: I8735dc87ccd0ebcde98a53f6d695167fedb4cc35
Signed-off-by: Ayush Kumar <quic_ayushkr@quicinc.com>
2023-11-20 21:35:13 -08:00
mingpan
0c04a30b66 msm: camera: common: Fix possible OOB reads and writes operation
We need to check if the packet is valid before using it.

CRs-Fixed: 3605421
Change-Id: Ide4e005ba46690c1cac02cb77a2d9aaa497b15df
Signed-off-by: mingpan <quic_mingpan@quicinc.com>
(cherry picked from commit 0156c0475a4c6c042eb84fcfbc14b3e837e0cb4c)
2023-10-06 15:26:34 +05:30
Vikram Sharma
ec8012559c msm: camera: memmgr: Add missing calls of put buf to avoid leak
This change add missing calls to put cpu buf in few scenarios.

CRs-Fixed: 3578162
Change-Id: Iab6aa0324b5072390b38df296c7acee00f5102a1
Signed-off-by: Vikram Sharma <quic_vikramsa@quicinc.com>
2023-09-26 05:49:27 -07:00
Atiya Kailany
2bb45ffd4c msm: camera: common: Fixing memory leak issues
This change removes some dead code and fixes memory leak
issues and mismatched labels.

CRs-Fixed: 3394193
Change-Id: Ieb6f0d56cddc58be4caea6f0aece63a793a08c07
Signed-off-by: Atiya Kailany <quic_akailany@quicinc.com>
2023-07-13 17:36:44 -07:00
Atiya Kailany
57f43538c7 msm: camera: utils: Add support for LowSVS_D1
Currently, lowest clk voting level supported is LowSVS, this
change will add support to a lower voting level, LowSVS_D1.

CRs-Fixed: 3480799
Change-Id: Ibdfe9d1d05aa45439a537cebe828cceea83f39d4
Signed-off-by: Atiya Kailany <quic_akailany@quicinc.com>
2023-07-07 16:06:34 -07:00
Shivakumar Malke
3a40a7b5b9 msm: camera: jpeg: dump jpeg register during pagefault
This change dump jpeg dma/enc registers during pagefault
for debug purposes.

CRs-Fixed: 3503307
Change-Id: I3a9c9d76302f2cc1eb7d23193bfdd566767a6428
Signed-off-by: Shivakumar Malke <quic_smalke@quicinc.com>
2023-07-05 17:51:06 -07:00
Shivakumar Malke
6d99262523 msm: camera: mem_mgr: Add refcount to track in use buffers
The function cam_mem_mgr_release can unmap the buffers when in use.

This change prevents unmapping the buffers when in use.

CRs-Fixed: 3489559
Change-Id: I2e72e795d39ac15abfa56c19043c419a03686966
Signed-off-by: Shivakumar Malke <quic_smalke@quicinc.com>
2023-06-21 15:06:26 -07:00
Li Sha Lim
b3f493269c msm: camera: smmu: Early PF detection
This change adds support to detect early
unmapping of buffers from UMD, and signal
when the error occurs by sending an error
code to UMD.

At present, buffers are allocated and/or mapped
by UMD, and the following sequence occurs.

KMD prepares packets sent during a config ioctl,
and these packets reside in the mapped buffers;
HW blocks then access these buffers, and may
write output to other mapped buffers(io buffers);
Once HW is done(upon a buf done), KMD signals
this event to UMD;
UMD may free/unmap these relevant buffers.

This change adds support to detect cases where a
free/unmap happens before/while HW is accessing
these buffers.

This feature is enabled by default, but a debugfs
variable disable_buf_tracking is added under smmu
which will enable the user to disable the feature.
Camera server needs to be restarted whenever this
variable is set/unset for changes to take place.

CRs-Fixed: 3382609
Change-Id: I39c3f0c373743c10bc2e6304ffbdc820e3c95970
Signed-off-by: Li Sha Lim <quic_lishlim@quicinc.com>
2023-05-20 10:06:15 -07:00
mingpan
12f52f25db msm: camera: common: Increase the max tag length to 128
Currently the maximum length of tag is 64, but in some
cases, the tag length we need is lager than 64, in
this case some information will be lost, which leads
to the failure to properly parse out the required
information. We need to make sure that all the tags
are the same length so that the parsing script can
parse them correctly. We also need to make sure that
the last character in tag is ":" in order for the
parsing script to get the full tag string correctly.

CRs-Fixed: 3467258
Change-Id: Ie8107ffd902d70d88026632a2c9fadaca0c276d8
Signed-off-by: mingpan <quic_mingpan@quicinc.com>
2023-05-01 19:36:09 -07:00
Sokchetra Eung
d525a7300c msm: camera: common: Return err on flush and log req id
When UMD requests to flush specific request that was submitted
to HW/FW, return error code back to userspace and log the particular
active request id if the device does not flush active request.
Currently devices that do not support flushing a specific active
request are ICP, OPE, and CRE.

Return error if there is no request to flush upon UMD call to
flush specific request.

Print all ICP requests' id from all active streams when encountering
WD or ICP fatal errors.

CRs-Fixed: 3438283
Change-Id: I7921463250c6e5e45ec263ccdce9d60d2b0f1ed3
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
2023-04-21 22:36:09 -07:00
Sokchetra Eung
740de40e65 msm: camera: utils: Add support for multiple IRQ lines per device
Update SOC util to be able to parse multiple irq names from DT and,
request, enable, disable multiple irq lines per soc.

All IRQ lines per SOC will have the same handler but different data,
so ISR will have their own private data to differentiate source of irq
in the same handling function.

CRs-Fixed: 3395596
Change-Id: Id9ca1cd3ef105d732a82decd7c8078bd29668326
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
2023-03-17 21:36:05 -07:00
Atiya Kailany
fc0c352ebe msm: camera: jpeg: Removing dead code
This change removes some flags and unused variables
in JPEG driver.

CRs-Fixed: 3394193
Change-Id: Iccdadebbd6943322e58da682986c4f6145ca9a64
Signed-off-by: Atiya Kailany <quic_akailany@quicinc.com>
2023-03-01 17:06:15 -08:00
Petar Ivanov
d82dbbff8a msm: camera: common: Add hw mgr intf query cap v2
Add switch case to handle query cap v2 ioctl, and add query cap
v2 hw mgr intf function pointer to handle query cap v2.

CRs-Fixed: 3364267
Change-Id: I1f992982f8d06755c977839ee61ee450306d65a5
Signed-off-by: Petar Ivanov <quic_pivanov@quicinc.com>
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
2023-01-20 15:06:11 -08:00
Mukund Madhusudan Atre
b2def29ddc msm: camera: common: Add support for cesta based clk scaling
On chipsets having cesta hw block support, for cesta supported clks
clk frequency can be changed during veritcal blanking based on
CSID DRV events. For this to happen, camera clients need to setup
high and low clock votes through hw clients. Use corresponding clk,
crm APIs to setup high, low clk frquencies and do channel switch
to apply newly set rates. Clients can also set clk frequency through
sw client which will set the floor. This feature helps in saving
power for usecases where vertical blanking is high such as
Fast Shutter usecase.

CRs-Fixed: 3294948
Change-Id: I1bcf650b439991a23b2a0f0f9a5162bdcd60dc64
Signed-off-by: Mukund Madhusudan Atre <quic_matre@quicinc.com>
Signed-off-by: Pavan Kumar Chilamkurthi <quic_pchilamk@quicinc.com>
2022-12-14 11:06:09 -08:00
Sokchetra Eung
d2e3088296 msm: camera: common: Add private data in mini dump
Each driver can pass private data in mini dump callback register, so
when mini dump is invoked, the mini dump handler will pass the private
data to the callback associated with the driver. With the private data,
ICP driver can determine which mini dump callback corresponds to which
ICP device/hw mgr.

CRs-Fixed: 3353541
Change-Id: I85171aa7ba31f92c5620ddbd8de8a9c168398856
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
2022-12-08 18:06:15 -08:00
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
Chandan Kumar Jha
92dda935d8 msm: camera: common: Fix return conditions in the camera driver
Fix return conditions in the camera driver.

CRs-Fixed: 3324123
Change-Id: I24b95dc8972fea4541ba01efe1b616062cd144ed
Signed-off-by: Chandan Kumar Jha <quic_cjha@quicinc.com>
2022-11-11 12:33:06 -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
c87d8891b9 msm: camera: common: Enhance error injection framework
Update from error injection framework to event injection framework to
support PF event inducement and node event. Different set of user
input parameters are required dependent on which event to injection.

ICP and ISP support error event and page fault event injection. JPEG
supports node event and page fault event injection. However, buf done
error injection is only supported for JPEG and ICP.

Create a query API to check whether PF is fatal for a context bank.
Using the API, if PF is fatal, page fault event injection is not
supported for the device that owns the context bank.

Make change to JPEG context event callback handling to account for
various events including Event Injection event.

CRs-Fixed: 3210139
Change-Id: I582ee0bda8dbf631ece2522a5a8145f38ec71928
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
2022-09-29 15:06:49 -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
chengxue
7504908856 msm: camera: jpeg: Increase the max context number to 24
Customer may have more than 3 physical cameras, and userland
may also create multi jpeg pipelines, so increase the max
context number to 24.

CRs-Fixed: 3228532
Change-Id: Ia90947f03a1543f19684aa7cad1b1972419e9c74
Signed-off-by: chengxue <quic_chengxue@quicinc.com>
2022-07-12 21:12:16 -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
Pranav Sanwal
1220255b08 msm: camera: common: Add camera error injection utility
Add and implement sysfs parameters to inject errors to
camera HW on demand through UMD for IFE,ICP and JPEG.

CRs-Fixed: 3115857
Change-Id: I4376fe31016cd81ad7e6f04cbc55e8ce010a6154
Signed-off-by: Pranav Sanwal <quic_psanwal@quicinc.com>
2022-03-24 12:36:48 -07: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
Suraj Dongre
56b320495d msm: camera: jpeg: Fix jpeg output in kailua presil
Changed code to fix wrong resource type causing blank output.

CRs-Fixed: 2932495
Change-Id: I7512b9784a6699d466e88e6f68dfc7144673bab1
Signed-off-by: Suraj Dongre <quic_sdongre@quicinc.com>
2022-02-02 22:37:00 -08:00
Anand Ravi
4355ad8cb4 msm: camera: jpeg: Add mechanism to verify IRQ lines
IRQ line verification can now be triggerred from JPEG HW manager by
writing to a debugfs file as follows:
    echo 1 > /d/camera/jpeg/test_irq_line

IRQ line verification can also be done at probe if
CONFIG_CAM_TEST_IRQ_LINE_AT_PROBE is set to true during compilation.
Both debugfs and probe-time verifications are only active if
CONFIG_CAM_TEST_IRQ_LINE is set to true during compilation.

CRs-Fixed: 3071027
Change-Id: Ib24022a12e3aa3ac529c7bc925fd4df1f2a96310
Signed-off-by: Anand Ravi <quic_ananravi@quicinc.com>
2022-01-05 11:50:31 -08:00
Haritha Chintalapati
124c3cf6ed Merge "msm: camera: common: create a common root folder for debugfs" into camera-kernel.lnx.6.0 2022-01-04 19:02:17 -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
Ridhi Shah
69e88523fe msm: camera: jpeg: Add v780 header for jpeg enc and dma
Add compatible string and header to support MISR
for JPEG DMA and encoder for v780.

CRs-Fixed: 3012752
Change-Id: I3f50506c20620dc46b6c5b3615887bbbc6027e36
Signed-off-by: Ridhi Shah <quic_ridhshah@quicinc.com>
2021-12-22 16:04:03 -08:00
Dharmender Sharma
06b7b57b28 msm: camera: jpeg: JPEG HW and Camnoc MISR
Support for Camnoc MISR for JPEG DMA and Encoder.
Also added support for seprate target files.

CRs-Fixed: 3012752
Change-Id: I5e066d5d871f58073f669c01270d5b64ce16088e
Signed-off-by: Dharmender Sharma <quic_dharshar@quicinc.com>
2021-12-16 10:56:33 +05:30
Camera Software Integration
ad1e732da4 Merge "msm: camera: jpeg: Ensure in/out map entries are within allowed range" into camera-kernel.lnx.5.0 2021-09-30 17:54:02 -07:00
Shravya Samala
b281d0d19c msm: camera: jpeg: Ensure in/out map entries are within allowed range
Added checks to make sure in_map /out_map entries of
packet io configs are within expected maximum value.

CRs-Fixed: 3007258
Change-Id: I7e5a652cd8f9ae104a10a2af551fe49930849b2d
Signed-off-by: Shravya Samala <shravyas@codeaurora.org>
2021-09-28 00:11:48 +05:30
Karthik Jayakumar
f31aaa8d2d msm: camera: jpeg: Add null check for ctx_data in IRQ handler
Check if ctx_data is null after assignment but before checking if it's in use.

CRs-Fixed: 3026736
Change-Id: I366383cbd30b7c22c16610d7b73e4e0ad8f74a55
Signed-off-by: Karthik Jayakumar <kjayakum@codeaurora.org>
2021-09-17 16:03:07 -07:00
Mukund Madhusudan Atre
9d3054dddd msm: camera: jpeg: Add buffer copy mechanism for jpeg
Add support for copying buffers to and from presil in
jpeg.

CRs-Fixed: 2932495
Change-Id: I0ca7069feae3f063259d88f1d02177de9675388a
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
2021-09-09 12:41:26 -07: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
Gaurav Jindal
2f5933b075 msm: camera: common: Add Minidump changes for NRT devices
Based on targets, in case of device crash, in place
of complete memory dump, mini dump can be extracted.
This commit adds changes in context utils for NRT devices
and in ICP, JPEG drivers.

CRs-Fixed: 2993116
Change-Id: I7c4af2cdf44713f741d3d772316080124e8a9a7f
Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
2021-08-22 21:19:33 -07:00
Jigar Agrawal
7aaba7949c msm: camera: jpeg: Release the failed request for jpeg
Fix the incorrect implementation which keeps the failed
thumbnail requests in the active request list and do not
free up.

CRs-Fixed: 2999106
Change-Id: I8f34d8b24aa1e0e3afb1452cffbf5a4113e0dc0e
Signed-off-by: Jigar Agrawal <jigar@codeaurora.org>
2021-08-17 14:32:51 -07:00
Jigar Agrawal
e8f91ce471 msm: camera: jpeg: Add Support for JPEG retry mechanism
Add support for JPEG Thumbnail retry mechanism. Restructure
the command buffer arrangement, add JPEG generic blob functionality
and add support to notify user when the JPEG Thumbnail encoder
size increases than the threshold size received through blob.

CRs-Fixed: 2999106
Change-Id: Ica74f934939b562a3a88af551bfb5de79399e247
Signed-off-by: Jigar Agrawal <jigar@codeaurora.org>
2021-08-12 18:14:36 -07:00
Camera Software Integration
c836ea502b Merge "msm: camera: jpeg: Update jpeg traces" into camera-kernel.lnx.5.0 2021-07-26 17:32:55 -07:00
Pavan Kumar Chilamkurthi
458f4844b4 msm: camera: jpeg: Update jpeg traces
Add trace log at DMA bufdone IRQ.  Update jpeg ENC traces
with more info.

CRs-Fixed: 2993654
Change-Id: I85e0ea312188780c6756a3d8d71dc35995791541
Signed-off-by: Pavan Kumar Chilamkurthi <pchilamk@codeaurora.org>
2021-07-16 10:56:34 -07:00
Ravikishore Pampana
72a587b0fd msm: camera: jpeg: Handle JPEG smmu fault with pid info
Kernel apis provide information fault caused pid and mid data.
Handle the JPEG 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 jpeg node
dt entries.

CRs-Fixed: 2878371
Change-Id: I0d2d1e474d4662707d85efd022ccce87e67f0d93
Signed-off-by: Ravikishore Pampana <rpampana@codeaurora.org>
2021-07-11 15:51:59 +05:30
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
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