According to V4L2 doc, cap_q_ctx is for "output to memory"
queue and out_q_ctx is for "input from memory", so capature
should represent for output of ISI and output should represent
for ISI's input. But I reversed their relationship, so correct
it.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Add memory to memory support for qm and qxp. Because only
ISI channel0 can support memory to memory feature so this
feature only support one channel. User can use channel 0
as other function when it isn't used for m2m.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Sandor.yu <sandor.yu@nxp.com>
Use two chained descriptors for encoder (config desc & encode desc),
they are set-up in new function mxc_jpeg_config_enc_desc.
Refactor function mxc_jpeg_enc_config, in order for the encoder to
function correctly, the CAST_MODE register needs to be written after
the descriptor(s) are ready.
Set-up decoder descriptor in new function mxc_jpeg_config_dec_desc,
this was previously done in mxc_jpeg_device_run, which is
leaner & cleaner now.
Function mxc_jpeg_go cannot be used both for encoder and decoder, because
the CAST IP control registers are different, the decoder has CTRL
(offset 0x34) while the encoder has MODE register (offset 0x0).
So, have two functions instead: mxc_jpeg_go_enc and mxc_jpeg_go_dec.
Function mxc_jpeg_reset had no purpose anymore, instead use
mxc_jpeg_sw_reset, for soft reset.
Add function mxc_jpeg_set_l_endian.
Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Correct RGB to YUV conversion coefficients and change csc mode
to RGB to YCbCr
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby.Cai <robby.cai@nxp.com>
If build ISI driver as module and insmod it after system
boot up, it will fail. Because lack of MODULE_LICENSE("GPL")
,insmod isi driver will print many unknown symbol messages
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby.Cai <robby.cai@nxp.com>
When one ISI channel is receiving data, if an other process
just open it at the same time and then close, it will lead
to this channel hang. The reason is soft reset in release
callback, so it make the channel stop work. Add an counter
for open isi channel and really soft reset the channel when
the counter equal to zero.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby.Cai <robby.cai@nxp.com>
Add analog_test_pattern device attribute for ov16035 in order
to turn on/off its color bar test pattern to debug
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby.Cai <robby.cai@nxp.com>
1. Use ISI channel 2 instead of 1 for mipi ov5640 because if
image line resolution is more than 2k, isi line buffer need
to chain to recevice line data
2. Add 15fps QSXGA, 30fps NTSC and 720P support for mipi ov5640
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby.Cai <robby.cai@nxp.com>
When there is no free buffer in driver as isi output, isi
will still write buffer which has been dequeue to userspace
and the buffer maybe is being scanning out by DC. So add a
temporary buffer as its output when the case happen
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby.Cai <robby.cai@nxp.com>
1. Delete power state maintenance of mipi and parallel csi.
This can simplified driver's resume/suspend implementation.
2. parallel_csi_power_control is a helper function which is
used to turn on/ff power domain of CI_PI. CI_PI will restore
its default parent clock for pixel clock after system resume
and can't be changed when its power is on. This issue is fixed
in scfw, more detail, please refer to "SCF-76". So remove it
in driver.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby.Cai <robby.cai@nxp.com>
Do a soft reset before job run.
Encoder now runs succesivelly without crash or stuck, but outputs 0.
Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Fixed decoder crasher by creating a structure to encompass the descriptors
and associated it to the jpeg device, one for each slot.
Removed mxc_jpeg_buf, as writing to its fields was causing
memory corruption sometimes (depending on how src_buf & dst_buf
got allocated, writing to one was overwriting the other).
For now, only slot 0 is used (no regression here, just a TODO).
Note that the decoded image looks ok only on QXP B0, not A0.
The decoder_test application will be patched in linux-test,
the old one should work too, but needed cleanup.
Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
1. System will dump painc message and hang when do system
reboot stress test. It caused by ISI HW reset function. When
user open the video device, it will get the device and driver
will turn on ISI power domain, but after that, ISI HW reset
will first turn off and then turn on it's power. During this
time, the process which open ISI channel 0 maybe sleep and
the other process which open other ISI channel will active but
the other channel power domain depend on channel 0. It leads to
system panic. So change msleep to udelay and move HW reset to
other place.
2. Refine ISI system and runtime suspend/resume.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
if use stream on/off, the 5M resolution has timing problem causing
there's no CSI interrupt coming on some boards. remove them to fix.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
Driver enable clock will fail in isi system power resume
callback because isi power domain is power off after system
power suspend so driver need to get device before disable
clock in system power suspend/resume callback and then put
device after disable clock.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit 668fdea95f)
Image information can be extracted from the JPEG SOH marker:
image format (YUV444/YUV420/YUV422/Gray), width & height, precision.
Use that information and apply it to the JPEG-DEC_WRP control registers.
Also fixed the decoder for non-square images.
Replace pr_*() and printk() calls with dev_*().
Currently working image formats: YUV444, YUV422, Gray
Not working formats: YUV420
Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>, Sandor Yu <sandor.yu@nxp.com>
The wait time is short that cause recording failed sometimes
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Sandor.yu <sandor.yu@nxp.com>
After changing the deemphasis to 0dB in TX_DIG_CTRL_REG_1
the issue that ARC can't work with 4k resolution is fixed
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Sandor.yu <sandor.yu@nxp.com>
set scale divider for mipi in reg 0x3035 to 0x11 to achieve 15fps
Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
On i.MX8MM, IC design uses registers from CSI to do MIPI PHY reset. Need enable
disp_axi and disp_apb before the access, otherwise meet hang issue.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Camera sensor need to be enabled before ISI when
resolution of caputure image is less than 640*480,
but hdmi need to be enabled after ISI, so add this
patch to compatible these two cases
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit c8d17ffcb0)
Add NV12 output format support. Because nv12 is multi
planes format, so driver need add device for every planes
Reviewed-by: Sandor.yu <sandor.yu@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
on imx8mm, use different way rather than via SRC. so use different
device id to distinguish different MIPI-PHY reset method.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
It caused by 10ms delay during isi hardware reset. During this
10ms, runtime PM will call isi runtime suspend/resume callback
but isi is not ready, so delete the 10ms delay.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Sandor.Yu <sandor.yu@nxp.com>
(cherry picked from commit 7d0922252f)
Move startup function from s_power to probe function,
HDMI RX controller keep in running state after driver probe.
The startup function should move to cable plugin handle.
When iMX8QM B0 silicon HDMI RX hot plug function is ready.
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
This issue changes the OV10635 to use the 96 MHz timing. In the one camera the configuration, the 72MHz timing was causing vsync and hsync errors. The 96 MHz timing will work for any number of cameras.
Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
As IC team recommended, it is better to set vsync pulse
width as 2 lines pixels, otherwise ISI will lost half
of frames.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Sandor.Yu <sandor.yu@nxp.com>
Add VIDIOC_EXPBUF ioctl which exports a buffer as a DMABUF file descriptor.
After calling VIDIOC_EXPBUF the fd field will be set by a driver. This is a
DMABUF file descriptor. The application may pass it to other DMABUF-aware
devices. See V4L2 spec for more details.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
1. Divide ov5640_v3.c into two parts, one for parallel csi driver
and the other for mipi csi driver
2. Add parallel and mipi support in one dtb file. User can select
one of them without changing the dtb file
Reviewed-by: Sandor.yu <sandor.yu@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Driver only return camera name for max9286 before, but
the driver is now supporting ov5640. So refine this ioctl
implement and remove max9286 camera driver private data
Reviewed-by: Sandor.yu <sandor.yu@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Each camera will be reconfigured to use a different SCCB_ID
An i2c_new_dummy will be used to reconfigure
the camera's SCCB_ID.
When the default SCCB_ID will be used for one camera,
the other one will fail to reconfigure and remains disabled.
Update log messages, use dev_err/warn/info intead of
pr_err/warn/info.
Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
1. For QXP, after system suspend and resume, parent of pixel
and per clk will drop, so driver need to restore it. The rate
of pixel and per clk also will miss, so driver have to set it
in resume callback again.
2. I have to power off CI_PI subsystem power domain in resume
callback, otherwise setting clock parent will fail.
3. Driver need free gpio resouce after device do not use it.
Reviewed-by: Sandor.yu <sandor.yu@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit 986098a52e62b89d6f6f7afdb75d17d77649db59)
when enum frame interval, kernel will be panic. It caused by
an null pointer, so correct the subdev data structure pointer.
ov5640 only support 15fps when mode is 1080P, so add this info
when user enum frame interval.
Reviewed-by: Sandor.Yu <sandor.yu@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit 4089120ce5fbcb253728a23102a62c849b71c88b)
In order to use the same unit test for both mipi csi and parallel
csi, add pad and video subdev ops in mipi csi driver.
Reviewed-by: Sandor.Yu <sandor.yu@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit db9ba4cf63351453fb820270b7ece4d597c49072)
Delete redundant 15fps statements because max9286 does not
support.
Reviewed-by: Sandor.Yu <sandor.yu@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit 88089e8a6dd5f0d06c7c61562f5a1942840f23e3)
Add CI_PI and ov5640 camera sensor support in camera device
framework. The data flow is "ov5640->ci_pi->isi_ch0". Disable
the other channels of ISI.
Reviewed-by: Sandor.Yu <sandor.yu@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit 37bc5d225e8a3eeb21fef5d94335d1edb2036988)
Add version3.0 driver for ov5640 camera sensor. It works on DVP
mode
Reviewed-by: Sandor.Yu <sandor.yu@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit 64d7dd18ac3c768480df8390ab02a35142a220cd)