burzumishi / linux-baytrail-flexx10

Install GNU/Linux on NextBook Flexx 10.1
GNU General Public License v2.0
82 stars 18 forks source link

OV2680 and HM2056 built-in camera drivers #19

Open RussianNeuroMancer opened 7 years ago

RussianNeuroMancer commented 7 years ago

Driver for gc2235/gc0310/0v2680/ov2722/ov5693/mt9m114: https://kernel.googlesource.com/pub/scm/linux/kernel/git/gregkh/staging/+/staging-testing/drivers/staging/media/atomisp/

Old post 1: Source code of OV2680 driver is available here: https://android.googlesource.com/kernel/mediatek/+/android-6.0.1_r0.110/arch/arm/mach-mt6582/sprout/imgsensor/

Old post 2: OV2680 driver: https://github.com/android-ia/device_intel_gmin-kernel/raw/master/x86_64/src.tgz https://github.com/01org/ProductionKernelQuilts/tree/master/uefi/cht-m1stable/patches (Ctl+F for "OV2680")

HM2056 driver: https://github.com/ZenfoneArea/android_kernel_asus_zenfone5/blob/master/linux/modules/camera/drivers/media/i2c/hm2056.h https://github.com/ZenfoneArea/android_kernel_asus_zenfone5/blob/master/linux/modules/camera/drivers/media/i2c/hm2056.c

nicman23 commented 7 years ago

thanks! Does it work with mainline (or at least a new android-x86 kernel) ?

RussianNeuroMancer commented 7 years ago

AFAIK it doesn't. Some modifications probably required to get it working on current kernels.

And, by the way, I find that it was available long time ago in gmin-kernel: https://github.com/android-ia/device_intel_gmin-kernel/raw/master/x86_64/src.tgz (and maybe even earlier).

nicman23 commented 7 years ago

oh yes i was aware about that kernel, but had forgotten about it.

sadly, i m no kernel dev to patch them for any kernel.

RussianNeuroMancer commented 7 years ago

GM0310 driver is also available in same patchset.

ghost commented 7 years ago

Which is the front camera and which is the rear?

RussianNeuroMancer commented 7 years ago

I checked https://github.com/burzumishi/linux-baytrail-flexx10/blob/master/acpi/dsdt.dsl.txt and find that Nextbook Flexx 10.1" have different front camera. So most likely OV2680 is front camera of Nextbook Flexx 10.1", like in my tablet (DEXP Ursus 7W, clone of with Ployer MOMO7W / ONE-01) but rear camera is HM2056 by Himax Technologies: http://www.himax.com.tw/products/cmos-image-sensor/image-sensor-soc/hm2056/

Tuxman2 commented 7 years ago

Hello,

I've got the hm2056 and ov5648 hardware. Do you know if it is possible to compile drivers for it ?

RussianNeuroMancer commented 7 years ago

@Tuxman2 Your transformer is Nextbook Flexx 10.1"?

OV5648 driver is also here: https://github.com/01org/ProductionKernelQuilts/tree/master/uefi/cht-m1stable/patches

Tuxman2 commented 7 years ago

@RussianNeuroMancer : No, it is a Medion Akoya E2212T model (hybrid tablet/PC).

RussianNeuroMancer commented 7 years ago

As I see all drivers is available, so it's not secret how to interact with this cameras. But nobody ported this drivers to upstream kernel.

Tuxman2 commented 7 years ago

if I apply the patches for OV5648 (available in the link you give me) I can make my camera work ?

RussianNeuroMancer commented 7 years ago

Most likely no. At first someone need to modify this drivers to make it work with more newer kernel.

Tuxman2 commented 7 years ago

Here is what I found for ov5648 : https://github.com/NoelMacwan/Kernel-C6806-KOT49H.S2.2052/blob/master/drivers/media/platform/msm/camera_v2/sensor/ov5648.c and https://github.com/NoelMacwan/Kernel-C6806-KOT49H.S2.2052/tree/master/drivers/media/platform/msm/camera_v2/sensor

I don't know if we can use it with Linux kernel.

Tuxman2 commented 7 years ago

No news about the support of OV and HM cameras on Linux ?

nicman23 commented 7 years ago

I will likely never be. There are too small of a number of devices and too low of quality for anyone to care about a 1MP camera

Tuxman2 commented 7 years ago

@nicman23: It is not a good news. I don't care for the front camera but I would like to use the rear camera.

dfiloni commented 7 years ago

I have a Lenovo Miix 310, it has a ov2680 front camera and a ov5648 rear camera. I tried to port ov5648 driver from https://android.googlesource.com/kernel/bcm/+/android-bcm-tetra-3.10-lollipop-wear-release/drivers/media/i2c/soc_camera/ov5648.c to mainline however it isn't working (webcam is not recognized at all) I think it doesn't work due to: https://bugzilla.kernel.org/show_bug.cgi?id=110151 , so I don't think the camera driver is enough to get it working.

Tuxman2 commented 7 years ago

Why is it so difficult for kernel developpers to give support for ov2680, ov5648 and hm2056 cameras ? I see support for some omnivision cameras in the kernel.

nicman23 commented 7 years ago

Because it is an open source project and no one cares about these cameras as I said :P

Tuxman2 commented 7 years ago

Well, I've got the source code for the HM2056 driver and the OV5648 driver. I made a makefile for each. You can try to compile them (kernel-headers, build-essential and make command are necessary) and test them.

HM2056 driver: https://snf-738721.vm.okeanos.grnet.gr/index.php/s/UtIkL9IJyxGPOXP OV5648 driver: https://snf-738721.vm.okeanos.grnet.gr/index.php/s/rvBIb7nnfrnzewz

For example, go to HM2056 directory and launch the make command. You have must have a .ko file after compiling. Then, try this:

RussianNeuroMancer commented 7 years ago

Cameras won't work until Intel Atom Image Signal Process driver get ported to current kernel.

sfumato77 commented 7 years ago

Intel Atom Image Signal Process It has started to be implemented in the kernel 4.11.

look here: https://kernel.googlesource.com/pub/scm/linux/kernel/git/gregkh/staging/+/staging-testing/drivers/staging/media/atomisp/

but there is a problem the two sensors (OV5648 and HM2056) are not yet supported read TODO files

who owns a compatible CCD sensor can try to compile a new kernel

and let us know. unfortunately, I can fill out a atomisp.ko. but I do not dirvers of HM2056.c sensor OV5648.c me error during build

P.S.

for those who want to try to fill atomisp for kenrel <411 You can give it a try as well:

copy dir atomisp in /drivers/media/staging

Add in Makefile obj-$(CONFIG_INTEL_ATOMISP) += atomisp/

Add in Kconfig source "drivers/staging/media/atomisp/Kconfig"

and after should be visible make menuconfig.

Tuxman2 commented 7 years ago

Do you think it could be a good idea to post a bug report on the kernel bugzilla website for the ov2680, hm2056 and ov5648 support ?

sfumato77 commented 7 years ago

TODO FILE gc2235/gc0310/0v2680/ov2722/ov5693/mt9m114...

ov2680 says it's supported. before making a signaling perhaps those who see one of these sensors suportati starch could try ...

others think it will be written as 0, it is beyond my capacity :(

Haxk20 commented 7 years ago

Will test it on 4.11 and will see what can I do

Tuxman2 commented 7 years ago

@sfumato77: In my case, I have the Hm2056 and the Ov5648 sensors (front and rear cameras). :-( I found the driver source code for those 2 sensors (see above) but I don't know if it is the right source code for the drivers. :-(

RussianNeuroMancer commented 7 years ago

Some changes in UEFI seems like required to get above driver working: https://4pda.ru/forum/index.php?showtopic=650808&view=findpost&p=59557868

As you can see in log driver can't find right firmware. Where to find it?

sfumato77 commented 7 years ago

in file sh_css_firmware.c

There is talk of firmware "Irci_stable_candrpv_0415_20150521_0458"

read first byte in shisp_2400b0_v21.bin http://vavar60.online.fr/share/tablet/chuwi_hi10/Linux_3.14.37/firmware/

which kernel are you using?

maybe it's the driver CLK for baytrail clk-byt-plt.c but I'm not sure

Tuxman2 commented 7 years ago

Hi,

I made a "bug report" for the support of OV5648 and HM2056 cameras on the kernel bugzilla website. I hope that someone will have a look on it. See it: https://bugzilla.kernel.org/show_bug.cgi?id=195877

Does someone here have tested the ov2680 support available in the kernel now ?

dfiloni commented 7 years ago

ov2680 (4.12rc4) doesn't work on my Lenovo Miix 310 due to atomisp_gmin_platform (same issue posted by @RussianNeuroMancer ). I ported the ov5680 driver from 01org (uploaded in the bug report) however I cannot test it so I don't think I can ask for its inclusion.

"Failed to find gmin variable" errors can be avoided using a workaround, you can extract vars from DSDT and add them in the code, there is already a struct called hard_vars for this purpose. I think the major issue, at least for me, is the lack of axp regulator support in atomisp_gmin_platform.

Tuxman2 commented 7 years ago

@dfiloni: I talked to Hans de Goede of the portage of OV5648 and HM2056 drivers. He told me that he will looking for when he will have hardware with these cameras. He also told me that atomisp driver don't work at all. I think we have to wait a while before the atomisp driver working.

andy-shev commented 6 years ago

Guys, I'm pretty sure Sakari, who is de facto maintaining AtomISP driver in upstream, will not take any new code to it without independent Tested-by tag, which effectivelly means we need to get AtomISP working first on the hardware with supported sensors, then convert AtomISP to use V4L2 Sensor APIs (this what Sakari put in update of TODO file recently).

tidus747 commented 6 years ago

@dfiloni I am trying to find a driver for v4l2 for the OV5680 sensor. As you say you have developed a first version that you have not been able to prove. I'm making a platform based on that sensor. If you were so kind to send me the driver I could test it and help you debug it. Thanks in advance !!

Tuxman2 commented 6 years ago

No news about the OV5648 and HM2056 support ?

RussianNeuroMancer commented 6 years ago

@Tuxman2 Read whole thread: https://www.mail-archive.com/linux-media@vger.kernel.org/msg123382.html https://patchwork.kernel.org/project/linux-media/list/?q=atomisp

dfiloni commented 6 years ago

@tidus747: sorry for the delay, you can find it at https://patchwork.kernel.org/patch/9983661/ . You can also find a patch for HM2056 at https://bugzilla.kernel.org/show_bug.cgi?id=195877 .

tidus747 commented 6 years ago

@dfiloni Thank you very much. As I said, the sensor I'm using is the OV5680. Would I use the OV5648 driver for this sensor? I thought I had read that you had developed the driver for the OV5680.

Tuxman2 commented 6 years ago

@RussianNeuroMancer: Ok. Thanks. @dfiloni: I can try your new Ov5648 patch but for the HM2056 patch it will not work (see my report in your HM2056 link). In the config file from Hans, the atomisp was disabled. So what options must I enable in the kernel to have the atomisp support (atomisp and mipi camera stuff ?) ? I found something interesting here: https://github.com/jfwells/linux-asus-t100ta/tree/master/webcam

dfiloni commented 6 years ago

@tidus747 : I don't think it will work, and 5680 was a typo, I only ported ov5648 and hm2056, sorry for the misunderstanding @Tuxman2 : I don't know what kernel are you talking about, my patch was for mainline, also probably Hans disabled it because is not supported by your hardware, for example I cannot use ov2680 and ov5648 due to a missing AXP PMIC driver for my laptop (I think). Anyway I don't remember so I cannot help you, sorry

Tuxman2 commented 6 years ago

@dfiloni: In the config file given by Hans and RussianneuroMancer for 4.15.x kernel, the atomisp is disabled by default. So we have to set manually the option to try to make atomisp works. As I seen in the links given by RussianNeuroMancer, the kernel community try to find a solution to make the cameras work. But it seems to not be easy.

andy-shev commented 6 years ago

Guys, I don't know which language to use to tell you that the driver is (for now) useless. There is no one in the community who has made it working.

Apparently this is a very high demand on testers, but for now even single configuration doesn't work with the upstreamed code.

I recommend to switch to Windows or Android to make camera works. It's pity, but this is unpalatable truth.

Tuxman2 commented 6 years ago

@andy-shev:

I recommend to switch to Windows or Android to make camera works. It's pity, but this is unpalatable truth.

Or another solution if we want to use a camera under Gnu/Linux is to buy a small portable and compatible Webcam that can be fixed on the tablet. I don't see others solutions until the cameras in the tablets will be supported.

sonvirgo commented 6 years ago

I use DroidCam with my NokiaX2sd feeds to Ubuntu Zesty

Tuxman2 commented 6 years ago

No news about the cameras support ?

andy-shev commented 6 years ago

@Tuxman2 AtomISP v2 driver is gone from upstream. Sorry guys, this must be closed as invalid. Or if any one can get a hard (I mean it!) way by actually extracting all necessary bits from Android...

P.S. Just in case, I'm not a repository owner here, so, whoever they are, it's their decision how to proceed now.

Tuxman2 commented 6 years ago

@andy-shev: So the only solution is to buy an external webcam. :(

mirh commented 5 years ago

OV2680 is now in mainline https://lwn.net/Articles/747810/

(and as for probably ov5648, this may be relevant) EDIT: an ISP dummy is also being added for other reasons

sonvirgo commented 5 years ago

Hello @mirh,

I build module from this patch v7 2/2 module load ok but no video device in /dev/video-* ?

$ lsmod | grep 2680 ov2680 20480 0 v4l2_common 16384 1 ov2680 videodev 184320 3 v4l2_common,v4l2loopback_dc,ov2680 media 40960 2 videodev,ov2680

This is the driver

modinfo ov2680
filename:       /lib/modules/4.15.13-041513-generic/kernel/drivers/media/i2c/ov2680.ko
license:        GPL v2
description:    OV2680 CMOS Image Sensor driver
author:         Rui Miguel Silva <rui.silva@linaro.org>
srcversion:     4C688DA0FB8F7817EFFE22D
alias:          acpi*:OVTI2680:*
alias:          i2c:OVTI2680
alias:          i2c:ov2680
alias:          of:N*T*Covti,ov2680C*
alias:          of:N*T*Covti,ov2680
depends:        videodev,media,v4l2-common
retpoline:      Y
name:           ov2680
vermagic:       4.15.13-041513-generic SMP mod_unload

Also module not seems to bind to the device, probe() function never got fired

I am expecting something like:

/sys/bus/i2c/drivers/ov2680:i2c-OVTI2680:00

But there isn't

$ sudo find /sys | grep 2680
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/subsystem
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/power
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/power/runtime_active_kids
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/power/runtime_suspended_time
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/power/autosuspend_delay_ms
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/power/runtime_enabled
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/power/runtime_active_time
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/power/control
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/power/async
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/power/runtime_usage
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/power/runtime_status
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/modalias
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/uevent
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/firmware_node
/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-7/i2c-OVTI2680:00/name
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/subsystem
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/power
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/power/runtime_active_kids
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/power/runtime_suspended_time
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/power/autosuspend_delay_ms
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/power/runtime_enabled
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/power/runtime_active_time
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/power/control
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/power/async
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/power/runtime_usage
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/power/runtime_status
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/uid
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/status
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/adr
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/hid
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/modalias
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/path
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/physical_node
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/OVTI2680:00/uevent
/sys/bus/acpi/devices/OVTI2680:00
/sys/bus/i2c/devices/i2c-OVTI2680:00
/sys/bus/i2c/drivers/ov2680
/sys/bus/i2c/drivers/ov2680/bind
/sys/bus/i2c/drivers/ov2680/unbind
/sys/bus/i2c/drivers/ov2680/module
/sys/bus/i2c/drivers/ov2680/uevent
/sys/module/v4l2_common/holders/ov2680
/sys/module/videodev/holders/ov2680
/sys/module/media/holders/ov2680
/sys/module/ov2680
/sys/module/ov2680/notes
/sys/module/ov2680/notes/.note.gnu.build-id
/sys/module/ov2680/taint
/sys/module/ov2680/initsize
/sys/module/ov2680/initstate
/sys/module/ov2680/srcversion
/sys/module/ov2680/coresize
/sys/module/ov2680/refcnt
/sys/module/ov2680/sections
/sys/module/ov2680/sections/.note.gnu.build-id
/sys/module/ov2680/sections/.exit.text
/sys/module/ov2680/sections/__mcount_loc
/sys/module/ov2680/sections/.init.text
/sys/module/ov2680/sections/.gnu.linkonce.this_module
/sys/module/ov2680/sections/__jump_table
/sys/module/ov2680/sections/.strtab
/sys/module/ov2680/sections/.rodata.str1.1
/sys/module/ov2680/sections/__bug_table
/sys/module/ov2680/sections/__verbose
/sys/module/ov2680/sections/.rodata.str1.8
/sys/module/ov2680/sections/.text
/sys/module/ov2680/sections/.data
/sys/module/ov2680/sections/.symtab
/sys/module/ov2680/sections/.rodata
/sys/module/ov2680/holders
/sys/module/ov2680/uevent
/sys/module/ov2680/drivers
/sys/module/ov2680/drivers/i2c:ov2680
sonvirgo commented 5 years ago

I adjust matching table And now the probe is called with error


 ~$ dmesg | grep -A3 -B3  OVTI2680
[    6.865235] intel-lpss 0000:00:15.2: enabling device (0000 -> 0002)
[    6.865602] idma64 idma64.2: Found Intel integrated DMA 64-bit
[    6.873799] Enter ov2680_probe()
[    6.873804] ov2680 i2c-OVTI2680:00: xvclk clock missing or invalid
[    6.873868] ov2680: probe of i2c-OVTI2680:00 failed with error -22
[    6.874946] intel-lpss 0000:00:1e.0: enabling device (0000 -> 0002)
[    6.875231] idma64 idma64.3: Found Intel integrated DMA 64-bit
[    6.886305] Intel(R) Wireless WiFi driver for Linux```
andy-shev commented 5 years ago

@sonvirgo Looking at your dmesg output I can tell you that the SoC there provides IPU3. Fortunately there is work in progress to bring it properly to upstream (you may found parts of the driver in vanilla kernel drivers/media/pci/intel/ipu3/). Better to ask about it in linux-media mailing list.