Some problems with my imx219 driver and dtb.

Now I’m developping the 6 imx219 driver on TX2.The probe() function runs well and does not output errors.However,I could not find /dev/video0.In the system log,I found some errors as follows.
tegra-vi4 15700000.vi: initialized
(null):i2c_client drvdata is NULL
tegra-vi4 15700000.vi:all channel register failed

We’re going to need more information than that.

What hardware adapter board are you using?
Where did you get the driver source from?
What version of Jetpack/Linux4Tegra are you using?
What are other I2C, Video, MIPI or CSI related debug messages from dmesg?

(1)We use Auvidea’s J20 adapter board.
(2)There is no drvers source on TX2 yet.I am developping it.
(3)I use Jetpack3.1 R28.1 TX2.

I developped the ov10640 driver on TX1 last year.Once the i2c address is configed well in dtb and the probe() function goes well,the /dev/video0 would occur.Is there any difference betwen TX1(linux 3.10) and TX2(linux 4.4)?Thank you!

Now,I could see /dev/video0.Maybe there were some errors in my dtb file or drvier.I have modified them.Thank you Snaky!

I meet some proble about imx219.After I run the commond nvgstcapture,I could not see the image.The output message is as follows:
root@tegra-ubuntu:~# nvgstcapture
Encoder null, cannot set bitrate!
Encoder Profile = Baseline
Supported resolutions in case of CSI Camera
(2) : 640x480
(3) : 1280x720
(4) : 1920x1080
(5) : 2104x1560
(6) : 2592x1944
(7) : 2616x1472
(8) : 3840x2160
(9) : 3896x2192
(10): 4208x3120
(11): 5632x3168
(12): 5632x4224

Runtime CSI Camera Commands:

Help : ‘h’
Quit : ‘q’
Set Capture Mode:
mo:
(1): image
(2): video
Get Capture Mode:
gmo
Set Sensor Id (0 to 10):
sid: e.g., sid:2
Get Sensor Id:
gsid
Set sensor orientation:
so:
(0): none
(1): Rotate counter-clockwise 90 degrees
(2): Rotate 180 degrees
(3): Rotate clockwise 90 degrees
Get sensor orientation:
gso
Set Whitebalance Mode:
wb:
(0): off
(1): auto
(2): incandescent
(3): fluorescent
(4): warm-fluorescent
(5): daylight
(6): cloudy-daylight
(7): twilight
(8): shade
(9): manual
Get Whitebalance Mode:
gwb
Set Scene-Mode:
scm:
(0): face-priority
(1): action
(2): portrait
(3): landscape
(4): night
(5): night-portrait
(6): theatre
(7): beach
(8): snow
(9): sunset
(10): steady-photo
(11): fireworks
(12): sports
(13): party
(14): candle-light
(15): barcode
Get Scene-Mode:
gscm
Set Color Effect Mode:
ce:
(1): off
(2): mono
(3): negative
(4): solarize
(5): sepia
(6): posterize
(7): aqua
Get Color Effect Mode:
gce
Set Auto-Exposure Mode:
ae:
(1): off
(2): on
(3): OnAutoFlash
(4): OnAlwaysFlash
(5): OnFlashRedEye
Get Auto-Exposure Mode:
gae
Set Flash Mode:
f:
(0): off
(1): on
(2): torch
(3): auto
Get Flash Mode:
gf
Set Flicker Detection and Avoidance Mode:
fl:
(0): off
(1): 50Hz
(2): 60Hz
(3): auto
Get Flicker Detection and Avoidance Mode:
gfl
Set Contrast (0 to 1):
ct: e.g., ct:0.75
Get Contrast:
gct
Set Saturation (0 to 2):
st: e.g., st:1.25
Get Saturation:
gst
Set Exposure Time in seconds:
ext: e.g., ext:0.033
Get Exposure Time:
gext
Set Auto Exposure Lock(0/1):
ael: e.g., ael:1
Get Auto Exposure Lock:
gael
Set Edge Enhancement (0 to 1):
ee: e.g., ee:0.75
Get Edge Enhancement:
gee
Set ROI for AE:
It needs five values, ROI coordinates(top,left,bottom,right)
and weight in that order
aer: e.g., aer:20 20 400 400 1.2
Get ROI for AE:
gaer
Set ROI for AWB:
It needs five values, ROI coordinates(top,left,bottom,right)
and weight in that order
wbr: e.g., wbr:20 20 400 400 1.2
Get ROI for AWB:
gwbr
Set FPS range:
It needs two values, FPS Range (low, high) in that order
fpsr: e.g., fpsr:15 30
Get FPS range:
gfpsr
Set WB Gains:
It needs four values (R, GR, GB, B) in that order
wbg: e.g., wbg:1.2 2.2 0.8 1.6
Get WB Gains:
gwbg
Set TNR Strength (0 to 1):
ts: e.g., ts:0.75
Get TNR Strength:
gts
Set TNR Mode:
tnr:
(0): NoiseReduction_Off
(1): NoiseReduction_Fast
(2): NoiseReduction_HighQuality
Get TNR Mode:
gtnr
Capture: enter ‘j’ OR
followed by a timer (e.g., jx5000, capture after 5 seconds) OR
followed by multishot count (e.g., j:6, capture 6 images)
timer/multihot values are optional, capture defaults to single shot with timer=0s
Start Recording : enter ‘1’
Stop Recording : enter ‘0’
Video snapshot : enter ‘2’ (While recording video)
Set Preview Resolution:
pcr: e.g., pcr:3
(2) : 640x480
(3) : 1280x720
(4) : 1920x1080
(5) : 2104x1560
(6) : 2592x1944
(7) : 2616x1472
(8) : 3840x2160
(9) : 3896x2192
(10): 4208x3120
(11): 5632x3168
(12): 5632x4224
Note - For preview resolutions 4208x3120 and more use option --svs=nveglglessink
Get Preview Resolution:
gpcr
Set Image Resolution:
icr: e.g., icr:3
(2) : 640x480
(3) : 1280x720
(4) : 1920x1080
(5) : 2104x1560
(6) : 2592x1944
(7) : 2616x1472
(8) : 3840x2160
(9) : 3896x2192
(10): 4208x3120
(11): 5632x3168
(12): 5632x4224
Get Image Capture Resolution:
gicr
Set Video Resolution:
vcr: e.g., vcr:3
(2) : 640x480
(3) : 1280x720
(4) : 1920x1080
(5) : 2104x1560
(6) : 2592x1944
(7) : 2616x1472
(8) : 3840x2160
(9) : 3896x2192
Get Video Capture Resolution:
gvcr

Runtime encoder configuration options:

Set Encoding Bit-rate(in bytes):
br: e.g., br:4000000
Get Encoding Bit-rate(in bytes):
gbr
Set Encoding Profile(only for H.264):
ep: e.g., ep:1
(0): Baseline
(1): Main
(2): High
Get Encoding Profile(only for H.264):
gep
Force IDR Frame on video Encoder(only for H.264):
Enter ‘f’

bitrate = 4000000
Encoder Profile = Baseline
Socket read error. Camera Daemon stopped functioning…
gst_nvcamera_open() failed ret=0

** (nvgstcapture:1850): CRITICAL **: <create_capture_pipeline:4565> can’t set camera to playing

** (nvgstcapture:1850): CRITICAL **: main:5367 Capture Pipeline creation failed
** Message: main:5374 Capture completed
** Message: main:5424 Camera application will now exit

I run the command: v4l2-compliance -d /dev/video0.The output information:
root@tegra-ubuntu:~# v4l2-compliance -d /dev/video0
Driver Info:
Driver name : tegra-video
Card type : vi-output, ov5693 1-0010
Bus info : platform:15700000.vi:0
Driver version: 4.4.38
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

Control ioctls:
	test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
	test VIDIOC_QUERYCTRL: OK
	test VIDIOC_G/S_CTRL: OK
	test VIDIOC_G/S/TRY_EXT_CTRLS: OK
	test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
	test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
	Standard Controls: 1 Private Controls: 11

Format ioctls:
	test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
	test VIDIOC_G/S_PARM: OK (Not Supported)
	test VIDIOC_G_FBUF: OK (Not Supported)
	test VIDIOC_G_FMT: OK
	test VIDIOC_TRY_FMT: OK
	test VIDIOC_S_FMT: OK
	test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
	test Cropping: OK (Not Supported)
	test Composing: OK (Not Supported)
	test Scaling: OK (Not Supported)

Codec ioctls:
	test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
	test VIDIOC_G_ENC_INDEX: OK (Not Supported)
	test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
	test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
	test VIDIOC_EXPBUF: OK

Test input 0:

Total: 42, Succeeded: 42, Failed: 0, Warnings: 0
root@tegra-ubuntu:~#

[ 54.136404] nvcamera-daemon[1854]: unhandled level 2 translation fault (11) at 0x00000000, esr 0x92000006
[ 54.145995] pgd = ffffffc1d9478000
[ 54.149468] [00000000] *pgd=00000002646fc003, *pud=00000002646fc003, *pmd=0000000000000000

[ 54.159339] CPU: 0 PID: 1854 Comm: nvcamera-daemon Not tainted 4.4.38 #8
[ 54.166077] Hardware name: quill (DT)
[ 54.169793] task: ffffffc1b0875780 ti: ffffffc1cc354000 task.ti: ffffffc1cc354000
[ 54.177305] PC is at 0x402efc
[ 54.180303] LR is at 0x402ef8
[ 54.183293] pc : [<0000000000402efc>] lr : [<0000000000402ef8>] pstate: 60000000
[ 54.190702] sp : 0000007f8d8e22d0
[ 54.194053] x29: 0000007f8d8e69d0 x28: 0000000000000000
[ 54.199449] x27: 0000000000000004 x26: 0000007f8d8e6340
[ 54.204887] x25: 0000000000404000 x24: 0000000000000334
[ 54.210221] x23: 0000007f8d8e4340 x22: 0000007f8d8e3340
[ 54.215562] x21: 0000007f8d8e4264 x20: 0000007f8d8e2350
[ 54.220913] x19: 0000007f8d8e4950 x18: 0000000000000014
[ 54.226251] x17: 0000007f8f157fb0 x16: 0000007f8eeac540
[ 54.231587] x15: 0000007f8fb54000 x14: 7265766972446172
[ 54.236919] x13: 656d61432f697061 x12: 2f637273206d6f72
[ 54.242248] x11: 6620676e69746167 x10: 61706f7270282020
[ 54.247585] x9 : 3a726574656d6172 x8 : 0000000000000040
[ 54.252921] x7 : 0000007f886b3290 x6 : 0000000000000001
[ 54.258249] x5 : 0000000000000000 x4 : 0000007f88000b10
[ 54.263590] x3 : 0000000000000000 x2 : 0000000000000001
[ 54.268924] x1 : 0000000000000000 x0 : 0000000000000000

[ 54.275753] Library at 0x402efc: 0x400000 /usr/sbin/nvcamera-daemon
[ 54.282017] Library at 0x402ef8: 0x400000 /usr/sbin/nvcamera-daemon
[ 54.288284] vdso base = 0x7f8fb53000

Looks like you have a MMU/page translation bug in the driver.

Now ,it seems that I could get the raw image data throuth command v4l2-ctl.However it still outputs “PXL_SOF syncpt timeout” error.I attched the image. Most part of the image is black and other is image.

Try to modify ths_settle it’s a 6 bit value range is 0 - 0x3F

drivers/media/platform/tegra/camera/csi/csi4_registers.h

#define T18X_BYPASS_LP_SEQ			(0x1 << 7)
#define DEFAULT_THS_SETTLE					(0x14 << 0)

@haijun,@ShaneCCC

Do you solve the problem?

I can get jpg image correctly using “gst-launch-1.0 v4l2src jpegenc ”command.
Image is normal and right.
However it outputs “PXL_SOF syncpt timeout” error. I don’t know why ? I use L4T R28.1

I am developing on TX2 and using a YUV sensor.

below is the debug info :

[ 1437.099213] **w=720,h=576.
[ 1437.102736] tegra-vi4 15700000.vi: WAR:Calculation not precise.Ignore BW reqe
[ 1437.608620] tegra_mipi_cal 3990000.mipical: Mipi cal timeout,val:1007851, la0
[ 1437.616681] tegra_mipi_cal 3990000.mipical: MIPI_CAL_CTRL 00
[ 1437.625081] tegra_mipi_cal 3990000.mipical: CIL_MIPI_CAL_STATUS 01
[ 1437.633426] tegra_mipi_cal 3990000.mipical: CIL_MIPI_CAL_STATUS_2 00
[ 1437.641785] tegra_mipi_cal 3990000.mipical: CILA_MIPI_CAL_CONFIG 00
[ 1437.650135] tegra_mipi_cal 3990000.mipical: CILB_MIPI_CAL_CONFIG 00
[ 1437.658464] tegra_mipi_cal 3990000.mipical: CILC_MIPI_CAL_CONFIG 00
[ 1437.666768] tegra_mipi_cal 3990000.mipical: CILD_MIPI_CAL_CONFIG 00
[ 1437.675082] tegra_mipi_cal 3990000.mipical: CILE_MIPI_CAL_CONFIG 00
[ 1437.683368] tegra_mipi_cal 3990000.mipical: CILF_MIPI_CAL_CONFIG 00
[ 1437.691658] tegra_mipi_cal 3990000.mipical: DSIA_MIPI_CAL_CONFIG 00
[ 1437.699965] tegra_mipi_cal 3990000.mipical: DSIB_MIPI_CAL_CONFIG 00
[ 1437.708264] tegra_mipi_cal 3990000.mipical: DSIC_MIPI_CAL_CONFIG 00
[ 1437.716544] tegra_mipi_cal 3990000.mipical: DSID_MIPI_CAL_CONFIG 00
[ 1437.724823] tegra_mipi_cal 3990000.mipical: MIPI_BIAS_PAD_CFG0 00
[ 1437.733106] tegra_mipi_cal 3990000.mipical: MIPI_BIAS_PAD_CFG1 00
[ 1437.741384] tegra_mipi_cal 3990000.mipical: MIPI_BIAS_PAD_CFG2 00
[ 1437.749669] tegra_mipi_cal 3990000.mipical: DSIA_MIPI_CAL_CONFIG_2 02
[ 1437.757965] tegra_mipi_cal 3990000.mipical: DSIB_MIPI_CAL_CONFIG_2 02
[ 1437.766246] tegra_mipi_cal 3990000.mipical: DSIC_MIPI_CAL_CONFIG_2 02
[ 1437.774532] tegra_mipi_cal 3990000.mipical: DSID_MIPI_CAL_CONFIG_2 02
[ 1438.784671] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 1439.788665] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11

(1) “WAR:Calculation not precise.Ignore BW reqe”, what does this mean ? How can I fix it ?

@jermmy
There’s no problem for me after add the embedded_metadata_height = “2” for imx219. I guess your sensor didn’t need this.
Could you try the v4l2-ctl to dump the frame data to check if still have time out message?
Check below for the WAR message.
kernel-4.4/drivers/media/platform/tegra/camera/vi/vi2_fops.c

@ShaneCCC
Thanks for your share. I will try it later.

So, I am confused here, I have a pre-configured video stream generated by a FPGA board, do not need i2c configuration. How can I skip th i2c part to grab frame data from /dev/video?

@DaLT
You can remove all the REG access function from the sensor driver.

@ShaneCCC,
I had use the v4l2-ctl to get video , i still get PXL_SOF syncpt timeout! err = -11.

(1)cmd is :

v4l2-ctl -d /dev/video0 -w --verbose --set-fmt-video=width=720,height=576,pixelformat=YUYV --set-ctrl bypass_mode=1 --stream-mmap --stream-count=1 --stream-to=test.yuv

(2)the following is the debug info:
[ 343.552653] **adv7180_s_power.
VIDIOC_QUERYCAP: ok
VIDIOC_S_EXT_CTR[ 343.576075] **adv7180_set_pad_format.
LS: ok
VIDIOC_G_FMT: ok
[ 343.582846] **in adv7180_mbus_fmt.
[ 343.588386] **w=720,h=576.
[ 343.591185] **adv7180_set_pad_format.
[ 343.594893] **in adv7180_mbus_fmt.
[ 343.598332] **w=720,h=576.
[ 343.601062] **adv7180_set_pad_format.
[ 343.604744] **in adv7180_mbus_fmt.
[ 343.608172] **w=720,h=576.
VIDIOC_S_FMT: ok
Format Video Capture:
Width/He[ 343.612619] **adv7180_get_pad_format .
ight : 720/576
Pixel Form[ 343.619065] **adv7180_mbus_fmt.
at : ‘YUYV’
Field [ 343.624975] **in adv7180_mbus_fmt.
: Interlaced
Bytes per Li[ 343.631134] **w=720,h=576.
ne : 1536
Size Image : 88473[ 343.637419] tegra-vi4 15700000.vi: WAR:Calculation not pre
6
Colorspace : SMPTE 170M
Transfer Function : Default
YCbCr/HSV Encoding: Default
Quantization : Default
Flags :
VIDIOC_REQBUFS: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_STREAMON: ok
[ 344.148895] tegra_mipi_cal 3990000.mipical: Mipi cal timeout,val:1007851, lanes:3000000
[ 344.157265] tegra_mipi_cal 3990000.mipical: MIPI_CAL_CTRL 0x04 0x2a000010
[ 344.165658] tegra_mipi_cal 3990000.mipical: CIL_MIPI_CAL_STATUS 0x0c 0x01007851
[ 344.174022] tegra_mipi_cal 3990000.mipical: CIL_MIPI_CAL_STATUS_2 0x10 0x00000000
[ 344.182371] tegra_mipi_cal 3990000.mipical: CILA_MIPI_CAL_CONFIG 0x18 0x00000000
[ 344.190720] tegra_mipi_cal 3990000.mipical: CILB_MIPI_CAL_CONFIG 0x1c 0x00000000
[ 344.199040] tegra_mipi_cal 3990000.mipical: CILC_MIPI_CAL_CONFIG 0x20 0x00000000
[ 344.207348] tegra_mipi_cal 3990000.mipical: CILD_MIPI_CAL_CONFIG 0x24 0x00000000
[ 344.215664] tegra_mipi_cal 3990000.mipical: CILE_MIPI_CAL_CONFIG 0x28 0x00200000
[ 344.223965] tegra_mipi_cal 3990000.mipical: CILF_MIPI_CAL_CONFIG 0x2c 0x00200000
[ 344.232280] tegra_mipi_cal 3990000.mipical: DSIA_MIPI_CAL_CONFIG 0x3c 0x00000200
[ 344.240585] tegra_mipi_cal 3990000.mipical: DSIB_MIPI_CAL_CONFIG 0x40 0x00000200
[ 344.248858] tegra_mipi_cal 3990000.mipical: DSIC_MIPI_CAL_CONFIG 0x44 0x00000200
[ 344.257155] tegra_mipi_cal 3990000.mipical: DSID_MIPI_CAL_CONFIG 0x48 0x00000200
[ 344.265435] tegra_mipi_cal 3990000.mipical: MIPI_BIAS_PAD_CFG0 0x5c 0x00000000
[ 344.273717] tegra_mipi_cal 3990000.mipical: MIPI_BIAS_PAD_CFG1 0x60 0x00000000
[ 344.281999] tegra_mipi_cal 3990000.mipical: MIPI_BIAS_PAD_CFG2 0x64 0x00010010
[ 344.290277] tegra_mipi_cal 3990000.mipical: DSIA_MIPI_CAL_CONFIG_2 0x68 0x00000002
[ 344.298558] tegra_mipi_cal 3990000.mipical: DSIB_MIPI_CAL_CONFIG_2 0x6c 0x00000002
[ 344.306841] tegra_mipi_cal 3990000.mipical: DSIC_MIPI_CAL_CONFIG_2 0x74 0x00000002
[ 344.315118] tegra_mipi_cal 3990000.mipical: DSID_MIPI_CAL_CONFIG_2 0x78 0x00000002
[ 345.320941] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 346.324947] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
Index : 0
Type : Video Capture
Flags : mapped, done
Field : None
Sequence : 0
Length : 884736
Bytesused: 884736
Timestamp: 354.053604s (Monotonic, End-of-Frame)

[ 347.328927] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 348.332927] tegra-vi4 15700000.vi: ATOMP_FE syncpt timeout!
[ 348.340105] tegra-vi4 15700000.vi: WAR:Calculation not precise.Ignore BW request failure
VIDIOC_STREAMOFF: ok

[ 348.351571] **adv7180_s_power.

just mis-write
correction : bypass_mode=0 not 1.