[Letux-kernel] ov9655 madness in 4.20

H. Nikolaus Schaller hns at goldelico.com
Wed Jan 9 17:40:01 CET 2019


Hi Andreas,

> Am 09.01.2019 um 11:07 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> Hi,
> 
>> Am 08.01.2019 um 22:12 schrieb Andreas Kemnade <andreas at kemnade.info>:
>>> 
>> I wrote a dumping tool using /dev/mem.
>> 
>> Some interesting results I have found now.
>> Clock/Vsync polarity changes between 3.7 and 4.20. That might explain
>> the green border in 3.7.
> 
> Yes, I remember this was fixed for 3.12 (and maybe other things in
> the camera driver).
> 
>> 
>> Accessibility of registers:
>> 3.7 when camera is active
>> 4.20 without iommu patch: when the module is loaded
>> 4.20 with iommu patch: only if there is activity (matches behavior
>>      of other devices)
>> 
>> No idea why this iommu patch has that effect especially since
>> the iommu calls look the same as in 3.7.
>> 
>> Dump diff between first and second camera demo run on 4.20:
>> 
>> --- isp-4.20-mplayer-1	2000-01-01 01:08:05.000000000 +0100
>> +++ isp-4.20-mplayer-2	2000-01-01 01:09:41.000000000 +0100
>> @@ -262,7 +262,7 @@
>> 
>> ISP_CCDC
>> 480bc600 (0000): 0001fe01
>> -480bc604 (0004): 00000000
>> +480bc604 (0004): 00000001
> 
> ^^^ CCDC
> 
>> 480bc608 (0008): 00031704
>> 480bc60c (000c): 00000000
>> 480bc610 (0010): 00000000
>> @@ -272,7 +272,7 @@
>> 480bc620 (0020): ffff00ff
>> 480bc624 (0024): 00000a00
>> 480bc628 (0028): 00000000
>> -480bc62c (002c): 40300000
>> +480bc62c (002c): 40000000
> 
> ^^^ CCDC_SDR_ADDR
> 
> Memory address
> Sets the CCDC module output address. The address should be aligned on a 32-byte boundary: the 5 least significant bits are ignored.
> For optimal performance in the system, the address must be on a 256-byte boundary.
> This bit field is latched by the VS sync pulse.
> 
> This seems to depend on memory assignment by the driver.
> 
>> 480bc630 (0030): 00000010
>> 480bc634 (0034): 00000000
>> 480bc638 (0038): bb11bb11
>> @@ -403,8 +403,8 @@
>> 480bca24 (0024): 00000000
>> 480bca28 (0028): 00000000
>> 480bca2c (002c): 00000000
>> -480bca30 (0030): 00000000
>> -480bca34 (0034): 000d0db2
>> +480bca30 (0030): 00000002
>> +480bca34 (0034): 000eaee9
> 
> ^^^ HIST_ADDR and HIST_DATA
> 
> IMHO not relevant to the issue.
> 
>> 480bca38 (0038): 00000000
>> 480bca3c (003c): 00000000
>> 480bca40 (0040): 00000000
>> @@ -921,10 +921,10 @@
>> 480bd21c (001c): 00000098
>> 480bd220 (0020): 00000118
>> 480bd224 (0024): 00000198
>> -480bd228 (0028): 00040529
>> -480bd22c (002c): 00040529
>> -480bd230 (0030): 00040529
>> -480bd234 (0034): 00040529
>> +480bd228 (0028): 0004057f
>> +480bd22c (002c): 0004057f
>> +480bd230 (0030): 0004057f
>> +480bd234 (0034): 0004057f
> 
> ^^^ SBL_CCDC_WR_0 .. SBL_CCDC_WR_3
> 
> CCDC WRITE REQUEST 1 REGISTER
> 
> contains "Upper 20 bits of the write address."
> 
> So this change may also just depend on memory assignment by the driver.
> 
>> 480bd238 (0038): 00000000
>> 480bd23c (003c): 00000000
>> 480bd240 (0040): 00000000
>> 
>> 
>> 
>>>> Hmm, then we have the iommu. Not sure if there might happen something
>>>> interesting.
>>>> 
>>>> And i2c access comparison. But I guess that is already boiled.  
>>> 
>>> Yes, I had checked register values with 3.12. So it is not a problem
>>> of the camera module. It *might* be something missing in the driver
>>> not properly calling some core V4L2 functions, but I have compared
>>> several times with other drivers.
>>> 
>>> It might also be something that clock is not properly stopped and
>>> re-enabled between two attempts.
>>> 
>>> But the omap3isp and its driver is a complex beast... And that the
>>> select() does timeout is when V4L2 tries to read a video stream from
>>> the isp (not the camera). I.e. there is no data coming from isp.
>>> 
>> That leaves still the question whether the isp delivers no date because
>> it gets nothing from the camera. Well, since the camera gets its clock
>> so that we can access it via i2c, I doubt that the problem is on camera
>> side.
> 
> I tend to agree... And AFAIR, there is no I2C possible if there is no
> clock. Other chips have a stand-alone I2C engine without external clock,
> but the camera module seems to need it.

Now I started to test letux-5.0-rc1 and had just booted a gta04a4 with
camera. So it was just some key clicks to type camera-demo.

Result was a green image - on first attempt. And some kernel issues ending
in a kernel panic :(

Also intersting is "omap3isp 480bc000.isp: CCDC won't become idle!".

Maybe there are some fixes from -rc2 missing...

BTW: this seems to be an old bug: https://www.isee.biz/support/ccdc-won-t-become-idle
https://e2e.ti.com/support/processors/f/791/t/236405?DM3730-CCDC-won-t-become-idle-
https://www.spinics.net/lists/linux-media/msg67894.html

The error itself comes from here:

https://elixir.bootlin.com/linux/v5.0-rc1/source/drivers/media/platform/omap3isp/ispccdc.c#L1605

Since CCDC is inside the omap3isp [http://omappedia.org/wiki/Camera-ISP_Driver]
we may have some picture format issue...

Finally some other idea:

https://linuxtv.org/downloads/v4l-dvb-apis/v4l-drivers/omap3isp.html

Chapter 20.4 indicates that there are Vertical sync frame events sent around.
Maybe we can simply printk the V4L2_EVENT_FRAME_SYNC and see if it starts/stops.
It might also indicate wrong VSYNC polarity (although I have checked at least
10 times...).

BR,
Nikolaus


[   99.650756] Address Hole seen by CAM  at address 40000000
[   99.656433] ------------[ cut here ]------------
[   99.661285] WARNING: CPU: 0 PID: 2580 at drivers/bus/omap_l3_smx.c:166 omap3_l3_app_irq+0xd8/0x11c
[   99.670654] Modules linked in: usb_f_ecm g_ether usb_f_rndis u_ether libcomposite configfs ipv6 omapdrm drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops panel_tpo_td028ttec1 snd_soc_simple_card snd_soc_simple_card_utils snd_soc_omap_twl4030 encoder_opa362 snd_soc_gtm601 connector_analog_tv pwm_omap_dmtimer generic_adc_battery pwm_bl bmp280_spi omap3_isp bq27xxx_battery_hdq bq27xxx_battery videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_common omap_hdq omap2430 bmp280_i2c bmp280 ov9655 v4l2_fwnode v4l2_common at24 itg3200 videodev tsc2007 leds_tca6507 media lis3lv02d_i2c bma180 hmc5843_i2c hmc5843_core industrialio_triggered_buffer kfifo_buf lis3lv02d hci_uart input_polldev btbcm snd_soc_si47xx snd_soc_omap_mcbsp phy_twl4030_usb snd_soc_ti_sdma musb_hdrc snd_soc_twl4030 twl4030_pwrbutton twl4030_vibra bluetooth gnss_w2sg0004 twl4030_madc twl4030_charger industrialio ecdh_generic ehci_omap gnss omapdss drm drm_panel_orientation_quirks omapdss_base cec
[   99.761322] CPU: 0 PID: 2580 Comm: loginwindow Not tainted 5.0.0-rc1-letux+ #3187
[   99.769134] Hardware name: Generic OMAP36xx (Flattened Device Tree)
[   99.775726] [<c0110bc8>] (unwind_backtrace) from [<c010c194>] (show_stack+0x10/0x14)
[   99.783874] [<c010c194>] (show_stack) from [<c07d97b8>] (dump_stack+0x7c/0x9c)
[   99.791412] [<c07d97b8>] (dump_stack) from [<c0132804>] (__warn+0xd8/0x108)
[   99.798736] [<c0132804>] (__warn) from [<c0132944>] (warn_slowpath_null+0x38/0x44)
[   99.806671] [<c0132944>] (warn_slowpath_null) from [<c04586d4>] (omap3_l3_app_irq+0xd8/0x11c)
[   99.815612] [<c04586d4>] (omap3_l3_app_irq) from [<c017db98>] (__handle_irq_event_percpu+0xa8/0x264)
[   99.825195] [<c017db98>] (__handle_irq_event_percpu) from [<c017dd78>] (handle_irq_event_percpu+0x24/0x78)
[   99.835327] [<c017dd78>] (handle_irq_event_percpu) from [<c017de04>] (handle_irq_event+0x38/0x5c)
[   99.844604] [<c017de04>] (handle_irq_event) from [<c0181950>] (handle_level_irq+0xd4/0x110)
[   99.853363] [<c0181950>] (handle_level_irq) from [<c017cf90>] (generic_handle_irq+0x18/0x28)
[   99.862213] [<c017cf90>] (generic_handle_irq) from [<c017d524>] (__handle_domain_irq+0x8c/0xb4)
[   99.871337] [<c017d524>] (__handle_domain_irq) from [<c0101df0>] (__irq_usr+0x50/0x80)
[   99.879638] Exception stack(0xdced7fb0 to 0xdced7ff8)
[   99.884948] 7fa0:                                     00000000 00000000 000c15b0 b6ed4c0d
[   99.893524] 7fc0: b6f2eae4 b6f43c44 0032d958 0032d850 b6f241fc b6f24234 b6f24304 001590b0
[   99.902099] 7fe0: b6ef3780 beb59300 b6ed4c2b b6ebfa74 20070030 ffffffff
[   99.909027] ---[ end trace e1ffe8e8597730b0 ]---
[   99.916137] omap3isp 480bc000.isp: CCDC won't become idle!
[   99.921905] Address Hole seen by CAM  at address 4000b700
[   99.927551] ------------[ cut here ]------------
[   99.932403] WARNING: CPU: 0 PID: 2580 at drivers/bus/omap_l3_smx.c:166 omap3_l3_app_irq+0xd8/0x11c
[   99.941772] Modules linked in: usb_f_ecm g_ether usb_f_rndis u_ether libcomposite configfs ipv6 omapdrm drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops panel_tpo_td028ttec1 snd_soc_simple_card snd_soc_simple_card_utils snd_soc_omap_twl4030 encoder_opa362 snd_soc_gtm601 connector_analog_tv pwm_omap_dmtimer generic_adc_battery pwm_bl bmp280_spi omap3_isp bq27xxx_battery_hdq bq27xxx_battery videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_common omap_hdq omap2430 bmp280_i2c bmp280 ov9655 v4l2_fwnode v4l2_common at24 itg3200 videodev tsc2007 leds_tca6507 media lis3lv02d_i2c bma180 hmc5843_i2c hmc5843_core industrialio_triggered_buffer kfifo_buf lis3lv02d hci_uart input_polldev btbcm snd_soc_si47xx snd_soc_omap_mcbsp phy_twl4030_usb snd_soc_ti_sdma musb_hdrc snd_soc_twl4030 twl4030_pwrbutton twl4030_vibra bluetooth gnss_w2sg0004 twl4030_madc twl4030_charger industrialio ecdh_generic ehci_omap gnss omapdss drm drm_panel_orientation_quirks omapdss_base cec
[  100.032501] CPU: 0 PID: 2580 Comm: loginwindow Tainted: G        W         5.0.0-rc1-letux+ #3187
[  100.041809] Hardware name: Generic OMAP36xx (Flattened Device Tree)
[  100.048370] [<c0110bc8>] (unwind_backtrace) from [<c010c194>] (show_stack+0x10/0x14)
[  100.056488] [<c010c194>] (show_stack) from [<c07d97b8>] (dump_stack+0x7c/0x9c)
[  100.064056] [<c07d97b8>] (dump_stack) from [<c0132804>] (__warn+0xd8/0x108)
[  100.071380] [<c0132804>] (__warn) from [<c0132944>] (warn_slowpath_null+0x38/0x44)
[  100.079284] [<c0132944>] (warn_slowpath_null) from [<c04586d4>] (omap3_l3_app_irq+0xd8/0x11c)
[  100.088226] [<c04586d4>] (omap3_l3_app_irq) from [<c017db98>] (__handle_irq_event_percpu+0xa8/0x264)
[  100.097808] [<c017db98>] (__handle_irq_event_percpu) from [<c017dd78>] (handle_irq_event_percpu+0x24/0x78)
[  100.107910] [<c017dd78>] (handle_irq_event_percpu) from [<c017de04>] (handle_irq_event+0x38/0x5c)
[  100.117218] [<c017de04>] (handle_irq_event) from [<c0181950>] (handle_level_irq+0xd4/0x110)
[  100.125976] [<c0181950>] (handle_level_irq) from [<c017cf90>] (generic_handle_irq+0x18/0x28)
[  100.134826] [<c017cf90>] (generic_handle_irq) from [<c017d524>] (__handle_domain_irq+0x8c/0xb4)
[  100.143951] [<c017d524>] (__handle_domain_irq) from [<c0101a0c>] (__irq_svc+0x6c/0xa8)
[  100.152252] Exception stack(0xdced7ef0 to 0xdced7f38)
[  100.157531] 7ee0:                                     ddbe47c0 c0b90f80 00000000 1ee20000
[  100.166107] 7f00: c0b90f80 c0c02080 00000002 00000035 dced7f40 b6f24234 0000000a c0b8831c
[  100.174713] 7f20: 1639cee3 dced7f40 c0102190 c01021d8 60070113 ffffffff
[  100.181640] [<c0101a0c>] (__irq_svc) from [<c01021d8>] (__do_softirq+0x98/0x3d4)
[  100.189392] [<c01021d8>] (__do_softirq) from [<c0138800>] (irq_exit+0x78/0xd8)
[  100.196990] [<c0138800>] (irq_exit) from [<c017d528>] (__handle_domain_irq+0x90/0xb4)
[  100.205200] [<c017d528>] (__handle_domain_irq) from [<c0101df0>] (__irq_usr+0x50/0x80)
[  100.213500] Exception stack(0xdced7fb0 to 0xdced7ff8)
[  100.218780] 7fa0:                                     00000000 00000000 000c15b0 b6ed4c0d
[  100.227355] 7fc0: b6f2eae4 b6f43c44 0032d958 0032d850 b6f241fc b6f24234 b6f24304 001590b0
[  100.235931] 7fe0: b6ef3780 beb59300 b6ed4c2b b6ebfa74 20070030 ffffffff
[  100.242828] ---[ end trace e1ffe8e8597730b1 ]---
[  100.251434] ov9655 1-0030: OV9655 write register 3b : 05
[  100.261596] ov9655 1-0030: OV9655 write register 40 : c0
[  100.274108] ov9655 1-0030: busfmt: h=1024 w=1280 code=8198 field=1 csp=8
[  100.294067] ov9655 1-0030: OV9655 read register 12 : 02
[  100.304412] ov9655 1-0030: OV9655 read register 6b : 0a
[  100.309875] ov9655 1-0030: OV9655 write register 6b : 4a
[  100.334045] ov9655 1-0030: OV9655 write register 11 : 00
[  100.344268] ov9655 1-0030: OV9655 write register 73 : 00
[  100.364135] ov9655 1-0030: OV9655 read register 41 : 40
[  100.374389] ov9655 1-0030: OV9655 read register c7 : 80
[  100.379852] ov9655 1-0030: OV9655 write register 72 : 00
[  100.404052] ov9655 1-0030: OV9655 write register 17 : 19
[  100.414489] ov9655 1-0030: OV9655 read register 32 : a4
[  100.419952] ov9655 1-0030: OV9655 write register 18 : b9
[  100.444274] ov9655 1-0030: OV9655 read register 32 : a4
[  100.449737] ov9655 1-0030: OV9655 write register 32 : 84
[  100.464080] ov9655 1-0030: OV9655 write register 19 : 00
[  100.484161] ov9655 1-0030: OV9655 read register 03 : 12
[  100.489654] ov9655 1-0030: OV9655 write register 03 : 10
[  100.504058] ov9655 1-0030: OV9655 write register 1a : 80
[  100.524139] ov9655 1-0030: OV9655 read register 03 : 10
[  100.529632] ov9655 1-0030: OV9655 write register 03 : 00
[  100.544097] ov9655 1-0030: OV9655 write register 36 : f9
[  100.563964] ov9655 1-0030: OV9655 write register 69 : 02
[  100.569885] ov9655 1-0030: OV9655 read register 8c : 0c
[  100.583984] ov9655 1-0030: OV9655 write register a9 : 8d
[  100.594329] ov9655 1-0030: format->code=00002006
[  100.604309] ov9655 1-0030: OV9655 read register 0c : 00
[  100.614196] ov9655 1-0030: OV9655 read register 12 : 02
[  100.624420] ov9655 1-0030: OV9655 read register 3a : 8c
[  100.644042] ov9655 1-0030: OV9655 read register 40 : c0
[  100.649505] ov9655 1-0030: format->field=00000001
[  100.664154] ov9655 1-0030: OV9655 read register 10 : 05
v4l2: ioctl queue buffer failed: Input/output error
[ass] auto-open
Opening video filter: [rotate=2]
VIDEO:  1280x1024  15.000 fps    0.0 kbps ( 0.0 kB/s)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
[swscaler @ 0xb5ca3980]using unscaled uyvy422 -> yuv420p special converter
VO: [x11] 1024x1280 => 1024x1280 Planar YV12 
[swscaler @ 0xb5ca3980]No accelerated colorspace conversion found from yuv420p to bgra.
Colorspace details not fully supported by selected vo.
Selected video codec: RAW UYVY [raw]
Audio: no sound
Starting playback...
V:   0.0   9/  9 ??% ??% ??,?% 0 0 $<3>


MPlayer interrupted by signal 2 in module: filter_video
[  108.456817] ov9655 1-0030: ov9655_s_stream(0)
[  108.474487] ov9655 1-0030: OV9655 read register 09 : 03
[  108.479980] ov9655 1-0030: OV9655 write register 09 : 13

v4l2: ioctl set mute failed: Inappropriate ioctl for device
[  108.506256] ov9655 1-0030: ov9655_set_power on=0
[  108.524291] ov9655 1-0030: __ov9655_set_power on=0
v4l2: 1 frames successfully processed, 0 frames dropped.

Exiting... (Quit)
root at letux:~# [  121.346221] Unable to handle kernel paging request at virtual address e0040000
[  121.353790] pgd = 3ef229ca
[  121.356628] [e0040000] *pgd=9d89c811, *pte=00000000, *ppte=00000000
[  121.363189] Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM
[  121.369354] Modules linked in: usb_f_ecm g_ether usb_f_rndis u_ether libcomposite configfs ipv6 omapdrm drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops panel_tpo_td028ttec1 snd_soc_simple_card snd_soc_simple_card_utils snd_soc_omap_twl4030 encoder_opa362 snd_soc_gtm601 connector_analog_tv pwm_omap_dmtimer generic_adc_battery pwm_bl bmp280_spi omap3_isp bq27xxx_battery_hdq bq27xxx_battery videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_common omap_hdq omap2430 bmp280_i2c bmp280 ov9655 v4l2_fwnode v4l2_common at24 itg3200 videodev tsc2007 leds_tca6507 media lis3lv02d_i2c bma180 hmc5843_i2c hmc5843_core industrialio_triggered_buffer kfifo_buf lis3lv02d hci_uart input_polldev btbcm snd_soc_si47xx snd_soc_omap_mcbsp phy_twl4030_usb snd_soc_ti_sdma musb_hdrc snd_soc_twl4030 twl4030_pwrbutton twl4030_vibra bluetooth gnss_w2sg0004 twl4030_madc twl4030_charger industrialio ecdh_generic ehci_omap gnss omapdss drm drm_panel_orientation_quirks omapdss_base cec
[  121.459777] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W         5.0.0-rc1-letux+ #3187
[  121.468566] Hardware name: Generic OMAP36xx (Flattened Device Tree)
[  121.475128] PC is at 0xe0040000
[  121.478424] LR is at omap_sram_idle+0x164/0x220
[  121.483154] pc : [<e0040000>]    lr : [<c01249ec>]    psr: 80080093
[  121.489715] sp : c0c01edc  ip : 0000000f  fp : 00000002
[  121.495147] r10: 00000000  r9 : 00000001  r8 : 00000000
[  121.500610] r7 : 00000001  r6 : 00000000  r5 : e003ff00  r4 : c0cae7f0
[  121.507446] r3 : 00003430  r2 : 00000002  r1 : 00000000  r0 : 74000018
[  121.514282] Flags: Nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[  121.521820] Control: 10c5387d  Table: 9ce34019  DAC: 00000051
[  121.527832] Process swapper/0 (pid: 0, stack limit = 0xe0d68a01)
[  121.534088] Stack: (0xc0c01edc to 0xc0c02000)
[  121.538635] 1ec0:                                                                c0cae7dc
[  121.547180] 1ee0: 00000003 00000000 00000001 00000000 00000001 00000000 00000002 c01249ec
[  121.555755] 1f00: 00000002 c0cae820 00000001 c07fa1fd 00000000 c0125df4 c0c0eb4c c0c0ea9c
[  121.564300] 1f20: 00000000 c0ca45b8 00000002 00000000 df9b06f8 c065c5a0 c0c01f83 00000000
[  121.572845] 1f40: 40cb01c2 0000001c c0ce0700 6804ee82 df9b0a00 df9b06f8 c0c0ea9c c0c07d48
[  121.581390] 1f60: c0c00000 00000001 c0b906f0 c0c01f78 00000002 c015ea68 ffffffff c0c07d74
[  121.589935] 1f80: 00c07d40 6804ee82 dfdff880 000000c8 c0cad900 ffffffff c0c07d48 c0c07d40
[  121.598480] 1fa0: c0b66a40 dfdff880 00000000 c015ed8c 6804ee82 c0b00d94 ffffffff ffffffff
[  121.607055] 1fc0: 00000000 c0b00774 00000000 c0b66a40 6801ee82 00000000 c0b00330 00000051
[  121.615600] 1fe0: 10c0387d 00000bcb 81c00000 413fc082 10c5387d 00000000 00000000 00000000
[  121.624145] [<c01249ec>] (omap_sram_idle) from [<00000001>] (0x1)
[  121.630523] Code: 02810282 03800282 02800382 02800282 bad PC value
[  121.636993] ---[ end trace e1ffe8e8597730b2 ]---
[  121.641815] Kernel panic - not syncing: Attempted to kill the idle task!
[  121.648834] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---



More information about the Letux-kernel mailing list