Pinetab2 camera drivers
#1
Video 
I'm trying to figure out missing pieces in the endeavor of making cameras work. I see that the kernel module for OV5648 is present in 6.6.13-danctnix1-1-pinetab2 kernel and it's linked to the v4l2 subsystem, however none of the /dev/video* devices are operational. Maybe some of you, guys, have already investigated it.

Code:
➜  ~ lsmod | grep ov5648
ov5648                32768  0
v4l2_fwnode            28672  1 ov5648
v4l2_async            28672  3 v4l2_fwnode,dw9714,ov5648
videodev              339968  8 v4l2_async,v4l2_fwnode,videobuf2_v4l2,dw9714,hantro_vpu,rockchip_rga,ov5648,v4l2_mem2mem
mc                    77824  8 v4l2_async,videodev,videobuf2_v4l2,dw9714,hantro_vpu,videobuf2_common,ov5648,v4l2_mem2mem

➜  ~ cat /sys/bus/platform/devices/fe5b0000.i2c/i2c-2/2-0036/name
ov5648

➜  ~ sudo dmesg | grep ov5648
[    8.541190] ov5648 2-0036: failed to find 168000000 clk rate in endpoint link-frequencies

The dmesg suggest that the driver expects 168000000 clock rate, but cannot find it in the device-tree.

UPD: I found the DTS used for the device, and indeed, the clock rate is 400000.
   
  Reply
#2
Okay, I've made a device-tree description for the frontal camera, and it's available now.

Code:
➜  ~ cat /sys/bus/platform/devices/fe5b0000.i2c/i2c-2/2-0037/name
gc02m2

The sad part is that the driver exists only in 4.19 necrorepo, and (surprisingly) APIs have changed since then... I'm a real dummy in kernel coding, but will try my best to make it compile and (hopefully) work.
   
  Reply
#3
I've made some progress: the thing compiles against 6.6 kernel at the very least and manages to fetch module information from the device-tree. However, there is a lot of tinkering ahead.

Code:
[  161.593750] gc02m2 2-0037: driver version: 00.01.02
[  161.593808] gc02m2 2-0037: Failed to get reset-gpios
[  161.593829] gc02m2 2-0037: Failed to get pwdn-gpios
[  161.593842] gc02m2 2-0037: lane_num(1)  pixel_rate(67200000)
[  161.593856] gc02m2 2-0037: could not get default pinstate
[  161.594429] gc02m2 2-0037: could not get sleep pinstate
[  161.594944] gc02m2 2-0037: supply dovdd-supply not found, using dummy regulator
[  161.595269] gc02m2 2-0037: supply avdd-supply not found, using dummy regulator
[  161.595365] gc02m2 2-0037: supply dvdd-supply not found, using dummy regulator
[  161.595449] gc02m2 2-0037: Enter gc02m2_initialize_controls(1238) !
[  161.597622] gc02m2 2-0037: gc02m2 read reg:0xf0 failed !
[  161.598174] gc02m2 2-0037: Read chip ID H register error
  Reply
#4
Moving a bit forward: I found the i2c address for the camera module: 0x0c. The DTS description should be complete at this point (I hope).

UPD1: I got bamboozled by dw9714 device, which resides on this bus. It was its address. Investigating further.

UPD2: I have no idea where the frontal camera should reside. According to the schematics, it's on the i2c2 bus, but I can't probe anything other than dw9714 on address 0x0c, and ov5648 on address 0x36. Just for the sake of it, I probed all i2c busses and found nothing.


Attached Files Thumbnail(s)
   
  Reply
#5
Guys on the chat has suggested that the device is not properly powered-on, hence nothing to be seen on i2cdetect. I decided to do my research about power-up sequence and how it's supposed to be implemented in a Linux driver. So, I found the piece of code in the driver responsible for that and added some debug messages to help me see what's going on.

   

The power-up sequence is performed by the driver, and it is successful. I thought to myself: "yeak, ok, let's just brute-force this thing upon sensor ID check within the driver itself".

   

And after that I got the following output:

Code:
[ 1857.429560] gc02m2 2-0037: driver version: 00.01.02
[ 1857.429693] gc02m2 2-0037: cannot get sleep pinstate, code -19
[ 1857.429711] gc02m2 2-0037: lane_num(1)  pixel_rate(67200000)
[ 1857.430907] gc02m2 2-0037: enabling regulators
[ 1857.430951] gc02m2 2-0037: performing power-up sequence
[ 1857.432660] gc02m2 2-0037: power-up okay
[ 1857.432682] gc02m2 2-0037: probing address 8
[ 1857.433819] gc02m2 2-0037: probing address 9
[ 1857.434999] gc02m2 2-0037: probing address a
[ 1857.436131] gc02m2 2-0037: probing address b
[ 1857.437260] gc02m2 2-0037: probing address c
[ 1857.437388] rk3x-i2c fe5b0000.i2c: unexpected irq in STOP: 0x10
[ 1858.468666] rk3x-i2c fe5b0000.i2c: timeout, ipd: 0x00, state: 4
[ 1858.470355] gc02m2 2-0037: probing address d
[ 1858.471600] gc02m2 2-0037: probing address e
[ 1858.472615] gc02m2 2-0037: probing address f
[ 1858.473863] gc02m2 2-0037: probing address 10
[ 1858.475096] gc02m2 2-0037: probing address 11
[ 1858.476332] gc02m2 2-0037: probing address 12
[ 1858.477578] gc02m2 2-0037: probing address 13
[ 1858.478815] gc02m2 2-0037: probing address 14
[ 1858.480046] gc02m2 2-0037: probing address 15
[ 1858.481280] gc02m2 2-0037: probing address 16
[ 1858.482575] gc02m2 2-0037: probing address 17
[ 1858.483832] gc02m2 2-0037: probing address 18
[ 1858.484649] gc02m2 2-0037: probing address 19
[ 1858.485880] gc02m2 2-0037: probing address 1a
[ 1858.487112] gc02m2 2-0037: probing address 1b
[ 1858.488338] gc02m2 2-0037: probing address 1c
[ 1858.489581] gc02m2 2-0037: probing address 1d
[ 1858.490820] gc02m2 2-0037: probing address 1e
[ 1858.492052] gc02m2 2-0037: probing address 1f
[ 1858.493293] gc02m2 2-0037: probing address 20
[ 1858.494613] gc02m2 2-0037: probing address 21
[ 1858.495849] gc02m2 2-0037: probing address 22
[ 1858.497088] gc02m2 2-0037: probing address 23
[ 1858.498325] gc02m2 2-0037: probing address 24
[ 1858.499561] gc02m2 2-0037: probing address 25
[ 1858.500638] gc02m2 2-0037: probing address 26
[ 1858.501871] gc02m2 2-0037: probing address 27
[ 1858.503104] gc02m2 2-0037: probing address 28
[ 1858.504332] gc02m2 2-0037: probing address 29
[ 1858.505643] gc02m2 2-0037: probing address 2a
[ 1858.506823] gc02m2 2-0037: probing address 2b
[ 1858.507997] gc02m2 2-0037: probing address 2c
[ 1858.509181] gc02m2 2-0037: probing address 2d
[ 1858.510359] gc02m2 2-0037: probing address 2e
[ 1858.511529] gc02m2 2-0037: probing address 2f
[ 1858.512573] gc02m2 2-0037: probing address 30
[ 1858.513762] gc02m2 2-0037: probing address 31
[ 1858.514971] gc02m2 2-0037: probing address 32
[ 1858.516199] gc02m2 2-0037: probing address 33
[ 1858.517394] gc02m2 2-0037: probing address 34
[ 1858.518578] gc02m2 2-0037: probing address 35
[ 1858.519753] gc02m2 2-0037: probing address 36
[ 1858.520577] gc02m2 2-0037: probing address 37
[ 1858.521762] gc02m2 2-0037: probing address 38
[ 1858.522936] gc02m2 2-0037: probing address 39
[ 1858.524107] gc02m2 2-0037: probing address 3a
[ 1858.525456] gc02m2 2-0037: probing address 3b
[ 1858.526632] gc02m2 2-0037: probing address 3c
[ 1858.527783] gc02m2 2-0037: probing address 3d
[ 1858.528565] gc02m2 2-0037: probing address 3e
[ 1858.529712] gc02m2 2-0037: probing address 3f
[ 1858.530889] gc02m2 2-0037: probing address 40
[ 1858.532045] gc02m2 2-0037: probing address 41
[ 1858.533199] gc02m2 2-0037: probing address 42
[ 1858.534348] gc02m2 2-0037: probing address 43
[ 1858.535540] gc02m2 2-0037: probing address 44
[ 1858.536563] gc02m2 2-0037: probing address 45
[ 1858.537724] gc02m2 2-0037: probing address 46
[ 1858.538873] gc02m2 2-0037: probing address 47
[ 1858.540015] gc02m2 2-0037: probing address 48
[ 1858.541167] gc02m2 2-0037: probing address 49
[ 1858.542317] gc02m2 2-0037: probing address 4a
[ 1858.543460] gc02m2 2-0037: probing address 4b
[ 1858.544558] gc02m2 2-0037: probing address 4c
[ 1858.545729] gc02m2 2-0037: probing address 4d
[ 1858.546929] gc02m2 2-0037: probing address 4e
[ 1858.548102] gc02m2 2-0037: probing address 4f
[ 1858.549271] gc02m2 2-0037: probing address 50
[ 1858.550421] gc02m2 2-0037: probing address 51
[ 1858.551567] gc02m2 2-0037: probing address 52
[ 1858.552562] gc02m2 2-0037: probing address 53
[ 1858.553708] gc02m2 2-0037: probing address 54
[ 1858.554855] gc02m2 2-0037: probing address 55
[ 1858.556142] gc02m2 2-0037: probing address 56
[ 1858.557276] gc02m2 2-0037: probing address 57
[ 1858.558400] gc02m2 2-0037: probing address 58
[ 1858.559519] gc02m2 2-0037: probing address 59
[ 1858.560547] gc02m2 2-0037: probing address 5a
[ 1858.561670] gc02m2 2-0037: probing address 5b
[ 1858.562501] gc02m2 2-0037: probing address 5c
[ 1858.563630] gc02m2 2-0037: probing address 5d
[ 1858.564605] gc02m2 2-0037: probing address 5e
[ 1858.565735] gc02m2 2-0037: probing address 5f
[ 1858.566879] gc02m2 2-0037: probing address 60
[ 1858.568006] gc02m2 2-0037: probing address 61
[ 1858.569150] gc02m2 2-0037: probing address 62
[ 1858.570287] gc02m2 2-0037: probing address 63
[ 1858.571409] gc02m2 2-0037: probing address 64
[ 1858.572568] gc02m2 2-0037: probing address 65
[ 1858.573692] gc02m2 2-0037: probing address 66
[ 1858.574811] gc02m2 2-0037: probing address 67
[ 1858.575931] gc02m2 2-0037: probing address 68
[ 1858.577069] gc02m2 2-0037: probing address 69
[ 1858.578199] gc02m2 2-0037: probing address 6a
[ 1858.579339] gc02m2 2-0037: probing address 6b
[ 1858.580465] gc02m2 2-0037: probing address 6c
[ 1858.581633] gc02m2 2-0037: probing address 6d
[ 1858.582760] gc02m2 2-0037: probing address 6e
[ 1858.583878] gc02m2 2-0037: probing address 6f
[ 1858.584539] gc02m2 2-0037: probing address 70
[ 1858.585664] gc02m2 2-0037: probing address 71
[ 1858.586785] gc02m2 2-0037: probing address 72
[ 1858.587944] gc02m2 2-0037: probing address 73
[ 1858.589077] gc02m2 2-0037: probing address 74
[ 1858.590206] gc02m2 2-0037: probing address 75
[ 1858.591332] gc02m2 2-0037: probing address 76
[ 1858.592452] gc02m2 2-0037: probing address 77
[ 1858.593608] gc02m2 2-0037: probing address 78
[ 1858.594735] gc02m2 2-0037: probing address 79
[ 1858.595858] gc02m2 2-0037: probing address 7a
[ 1858.596560] gc02m2 2-0037: probing address 7b
[ 1858.597691] gc02m2 2-0037: probing address 7c
[ 1858.598830] gc02m2 2-0037: probing address 7d
[ 1858.599997] gc02m2 2-0037: probing address 7e
[ 1858.601198] gc02m2 2-0037: chip ID H register error

0x0c is occupied with dw9714, so that's the reason we got an interrupt. 0x36 (back camera) has not responded because it's powered-off, I presume. But the gc02m2 must be powered, because the power-up was done by the probe function of the driver, and yet there is nothing.

Powerdown and reset pins are correct (if the schematics are). I'm at the end of my wits here.
  Reply
#6
I've summed up all of my efforts into a single out-of-tree repo for everyone interested to help with the driver.
  Reply
#7
I've contacted GalaxyCore and they were kind enough to give me access to their customers' FTP server. There is a ton of gc02m2 drivers for various platforms (mostly MTK), but what matters is that now I know the sensor slave address for sure: 0x6e >> 1, which is 0x37.
  Reply
#8
i wish i had something constructive to offer to your development efforts for the cameras, but i do want give you huge props and kudos for deciding to tackle this! people like you are what make this community awesome!
  Reply
#9
(03-08-2024, 09:10 AM)cringeops Wrote: I've contacted GalaxyCore and they were kind enough to give me access to their customers' FTP server. There is a ton of gc02m2 drivers for various platforms (mostly MTK), but what matters is that now I know the sensor slave address for sure: 0x6e >> 1, which is 0x37.

awesome, glad to know GalaxyCore open up their FTP server. Thumbs up.

looking forward on your implementation,
  Reply
#10
A little heads-up: GC has provided a datasheet, so I have it now!
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PineTab2 corrupted EMMC explit 5 1,003 03-27-2024, 04:56 PM
Last Post: oiyounutter
  eMMC backup - pinetab2 pinetar.gz 0 384 01-07-2024, 09:08 PM
Last Post: pinetar.gz
  [PineTab2] Issues with Mobian Networking Cornelia Xaos 7 2,521 12-30-2023, 10:02 PM
Last Post: Cornelia Xaos
  drivers present, module missing [mt7921u] Ome Ko 0 783 08-26-2023, 12:30 PM
Last Post: Ome Ko
  Touch doesnt rotate on Sway in PineTab2 cgbarros 4 1,849 08-03-2023, 05:49 PM
Last Post: cgbarros
  Disabling PineTab2 physical keyboard and touchpad? johns 7 1,696 08-03-2023, 11:55 AM
Last Post: cgbarros
  Will sudo pacman -Syu brick the PineTab2? cgbarros 10 2,491 07-24-2023, 01:15 PM
Last Post: rqkeating
  Udemy not working on pinetab2 (danctnix) jbreese 3 1,101 06-13-2023, 11:34 AM
Last Post: jbreese

Forum Jump:


Users browsing this thread: 1 Guest(s)