Re: [BUG] atomisp_ov2680 not initializing correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/28/2017 05:03 PM, Andy Shevchenko wrote:
> On Sat, 2017-12-23 at 01:31 +0100, Kristian Beilke wrote:
>> On 12/21/2017 03:23 PM, Andy Shevchenko wrote:
>>> On Thu, 2017-12-21 at 13:54 +0100, Kristian Beilke wrote:
>>>> On Tue, Dec 19, 2017 at 10:37:01PM +0200, Andy Shevchenko wrote:
>>>>> On Tue, 2017-12-19 at 14:00 +0200, Sakari Ailus wrote:
>>>>>> Cc Alan and Andy.
>>>>>>
>>>>>> On Sat, Dec 16, 2017 at 04:50:04PM +0100, Kristian Beilke
>>>>>> wrote:
>>>>>>> Dear all,
>>>>>>>
>>>>>>> I am trying to get the cameras in a Lenovo IdeaPad Miix 320
>>>>>>> (Atom
>>>>>>> x5-Z8350 BayTrail) to work. The front camera is an ov2680.
>>>>>>> With
>>
>> CherryTrail

>>>>> WRT to the messages below it seems we have no platform data for
>>>>> that
>>>>> device. It needs to be added.
>>>>>
>>
>> I tried to do exactly this. Extracted some values from
>> acpidump/acpixtract and dmidecode, but unsure I nailed it.
> 
> Can you share somewhere it (pastebin.com, gist.github.com, etc)?
> 

https://gist.github.com/jdkbx/dabe0d000330dd2a04acf8d870e0e06f

dmidecode gives me

Handle 0x0002, DMI type 2, 17 bytes
Base Board Information
        Manufacturer: LENOVO
        Product Name: LNVNB161216
        Version: SDK0J91196WIN

what I assume works as identifier in:
DMI_MATCH(DMI_BOARD_NAME, "LNVNB161216")

diff --git
a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
index 87216bc35648..716be4ace60e 100644
---
a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
+++
b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
@@ -503,6 +503,18 @@ static struct gmin_cfg_var cht_cr_vars[] = {
        {},
 };

+static struct gmin_cfg_var miix320_vars[] = {
+        {"OVTI2680:00_CamType", "1"},
+        {"OVTI2680:00_CsiPort", "0"},
+        {"OVTI2680:00_CsiLanes", "1"},
+        {"OVTI2680:00_CsiFmt", "15"},
+        {"OVTI2680:00_CsiBayer", "0"},
+        {"OVTI2680:00_CamClk", "1"},
+        {"OVTI2680:00_Regulator1p8v", "0"},
+        {"OVTI2680:00_Regulator2p8v", "0"},
+        {},
+};
+
 static struct gmin_cfg_var mrd7_vars[] = {
 	{"INT33F8:00_CamType", "1"},
 	{"INT33F8:00_CsiPort", "1"},
@@ -566,6 +578,13 @@ static const struct dmi_system_id gmin_vars[] = {
 		},
 		.driver_data = cht_cr_vars,
        	},
+	{
+                .ident = "MIIX320",
+                .matches = {
+                        DMI_MATCH(DMI_BOARD_NAME, "LNVNB161216"),
+                },
+                .driver_data = miix320_vars,
+        },
 	{
 		.ident = "MRD7",
 		.matches = {

>> After your set of patches I applied the CherryTrail support I found
>> here
>> https://github.com/croutor/atomisp2401
>>
> 
> I have few hacks on top of this.
> 
> First of all, take a base as atomisp branch of sakari's media_tree
> repository:
> 
> https://git.linuxtv.org/sailus/media_tree.git/
> 

I updated the mentioned patches by Vincent Hervieux to apply cleanly on
the media_tree atomisp branch.

https://github.com/jdkbx/atomisp2401

> Second, apply
> 
> --- a/drivers/staging/media/atomisp/platform/intel-
> mid/atomisp_gmin_platform.c
> +++ b/drivers/staging/media/atomisp/platform/intel-
> mid/atomisp_gmin_platform.c
> @@ -499,6 +499,7 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev
> *subdev, int on)
>                         return regulator_disable(gs->v1p8_reg);
>         }
>  
> +return 0;
>         return -EINVAL;
>  }
>  
> @@ -535,6 +536,7 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev
> *subdev, int on)
>                         return regulator_disable(gs->v2p8_reg);
>         }
>  
> +return 0;
>         return -EINVAL;
>  }
> 
> ---
> a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
> +++
> b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
> @@ -184,6 +184,7 @@ sh_css_check_firmware_version(const char *fw_data)
>         firmware_header = (struct firmware_header *)fw_data;
>         file_header = &firmware_header->file_header;
>  
> +return true;
>         if (strcmp(file_header->version, release_version) != 0) {
>                 return false;
> 
> --- a/drivers/staging/media/atomisp/pci/atomisp2/Makefile
> +++ b/drivers/staging/media/atomisp/pci/atomisp2/Makefile
> @@ -348,6 +348,8 @@ DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST
> -DHRT_USE_VIR_ADDRS -D__HOST__
>  #DEFINES += -DPUNIT_CAMERA_BUSY
>  #DEFINES += -DUSE_KMEM_CACHE
>  
> +DEFINES += -DDEBUG
> +
>  DEFINES += -DATOMISP_POSTFIX=\"css2400b0_v21\" -DISP2400B0
> 
> For CHT you have to change define in this file to 2401 here and line
> below AFAIU (never did this).
> 
> Third, you need to change pmic_id to be PMIC_AXP (I have longer patch
> for this, that's why don't post here). Just hard code it for now in gmin
> file.
> 

I assume the given patch set does already what you suggest here, apart
from the DDEBUG DEFINE.

> Fourth, you have to be sure the clock rate is chosen correctly
> (currently there is a bug in clk_set_rate() where parameter is clock
> source index instead of frequency!). I think you need to hardcode
> 19200000 there instead of gs->clock_src.

I found nothing about this in the patch set, so I will do this manually.

>> I am still not sure the FW gets loaded, and there is still no
>> /dev/camera, but it looks promising.
> 
> You may add a debug print in necessary function inside ->probe (in
> atomisp_v4l2.c). I dont't remember if -DDEBUG will enable something like
> that. Perhaps.

Thats what I will do next.

> You are expecting /dev/video<N> nodes. /dev/camera is usually a udev's
> alias against one of /dev/video<N> nodes.

As described by Alan in a later mail, this actually gives me 10
/dev/video[0-10] nodes, but none producing any images. video4 and
video10 cause a kernel oops when opened.

[  425.667704] BUG: unable to handle kernel NULL pointer dereference at
00000000000000b8
[  425.667761] IP: atomisp_g_parm+0x4a/0x80 [atomisp]
[  425.667765] PGD 0 P4D 0
[  425.667771] Oops: 0000 [#1] SMP
[  425.667776] Modules linked in: rfcomm bnep snd_soc_sst_cht_bsw_rt5645
wmi_bmof cmdlinepart intel_spi_platform intel_spi spi_nor mtd
snd_intel_sst_acpi snd_intel_sst_core snd_soc_sst_atom_hifi2_platform
snd_soc_acpi snd_soc_rt5645 snd_soc_acpi_intel_match gpio_keys
snd_soc_rl6231 nls_iso8859_1 intel_rapl intel_powerclamp coretemp
punit_atom_debug intel_cstate iwlmvm mac80211 axp288_fuel_gauge
extcon_axp288 axp288_charger axp288_adc axp20x_pek cdc_mbim cdc_wdm
cdc_ncm usbnet joydev mii hid_multitouch iwlwifi input_leds btusb btrtl
btbcm btintel atomisp(C) bluetooth cfg80211 mei_txe mei lpc_ich
videobuf_vmalloc processor_thermal_device shpchp videobuf_core
intel_soc_dts_iosf snd_seq_midi snd_seq_midi_event snd_rawmidi
snd_soc_core snd_seq snd_compress ac97_bus snd_pcm_dmaengine
bmc150_accel_i2c dw_dmac
[  425.667850]  bmc150_accel_core dw_dmac_core
industrialio_triggered_buffer snd_pcm kfifo_buf industrialio
atomisp_ov2680(C) snd_seq_device v4l2_common snd_timer videodev snd
media soundcore pwm_lpss_platform 8250_dw tpm_crb spi_pxa2xx_platform
pwm_lpss wmi acpi_pad int3403_thermal int3400_thermal
int340x_thermal_zone acpi_thermal_rel soc_button_array
intel_int0002_vgpio parport_pc ppdev lp parport ip_tables x_tables
hid_generic usbhid dm_crypt mmc_block i915 intel_gtt i2c_algo_bit
drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm video
i2c_hid hid sdhci_acpi sdhci
[  425.667909] CPU: 1 PID: 2385 Comm: mplayer Tainted: G         C
4.15.0-rc3 #5
[  425.667912] Hardware name: LENOVO 80XF/LNVNB161216, BIOS 5HCN31WW
09/11/2017
[  425.667949] RIP: 0010:atomisp_g_parm+0x4a/0x80 [atomisp]
[  425.667952] RSP: 0018:ffffaca6c2917c90 EFLAGS: 00010246
[  425.667957] RAX: 0000000000000000 RBX: ffff9b50343aeea0 RCX:
ffffffffc0a872c0
[  425.667960] RDX: ffff9b4ff816c140 RSI: 0000000000000000 RDI:
ffff9b50343aeea0
[  425.667963] RBP: ffff9b5036075200 R08: ffffffffc0a87200 R09:
ffff9b5038843300
[  425.667965] R10: 0000000000000000 R11: 0000000000000000 R12:
ffff9b5038843c80
[  425.667968] R13: 0000000000000000 R14: 00000000000000cc R15:
ffff9b50332d5e00
[  425.667972] FS:  00007fbc6ba72440(0000) GS:ffff9b503fc80000(0000)
knlGS:0000000000000000
[  425.667976] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  425.667979] CR2: 00000000000000b8 CR3: 0000000175f4b000 CR4:
00000000001006e0
[  425.667982] Call Trace:
[  425.668001]  ? v4l_g_parm+0x54/0xd0 [videodev]
[  425.668014]  ? __video_do_ioctl+0x34d/0x360 [videodev]
[  425.668022]  ? path_openat+0x5bb/0x1620
[  425.668028]  ? _cond_resched+0x15/0x40
[  425.668034]  ? __kmalloc_node+0x1ea/0x2a0
[  425.668046]  ? video_ioctl2+0x20/0x20 [videodev]
[  425.668058]  ? video_usercopy+0x97/0x5b0 [videodev]
[  425.668071]  ? v4l2_ioctl+0xbb/0xe0 [videodev]
[  425.668076]  ? do_vfs_ioctl+0xa4/0x630
[  425.668081]  ? SyS_ioctl+0x7c/0x90
[  425.668087]  ? entry_SYSCALL_64_fastpath+0x1e/0x81
[  425.668091] Code: 01 4c 8b a0 78 09 00 00 48 8b 9b 50 02 00 00 75 2f
48 81 c3 88 0e 00 00 48 89 df e8 f1 51 d6 ec 49 8b 84 24 c0 44 00 00 48
8d 3b <8b> 80 b8 00 00 00 89 45 08 e8 78 4d d6 ec 31 c0 5b 5d 41 5c c3
[  425.668185] RIP: atomisp_g_parm+0x4a/0x80 [atomisp] RSP: ffffaca6c2917c90
[  425.668188] CR2: 00000000000000b8
[  425.668237] ---[ end trace fb76f36afd55319e ]---
[  425.672735] ------------[ cut here ]------------
[  425.672748] rtmutex deadlock detected
[  425.672767] WARNING: CPU: 1 PID: 2385 at kernel/locking/rtmutex.h:28
rt_mutex_slowlock+0x176/0x1e0
[  425.672771] Modules linked in: rfcomm bnep snd_soc_sst_cht_bsw_rt5645
wmi_bmof cmdlinepart intel_spi_platform intel_spi spi_nor mtd
snd_intel_sst_acpi snd_intel_sst_core snd_soc_sst_atom_hifi2_platform
snd_soc_acpi snd_soc_rt5645 snd_soc_acpi_intel_match gpio_keys
snd_soc_rl6231 nls_iso8859_1 intel_rapl intel_powerclamp coretemp
punit_atom_debug intel_cstate iwlmvm mac80211 axp288_fuel_gauge
extcon_axp288 axp288_charger axp288_adc axp20x_pek cdc_mbim cdc_wdm
cdc_ncm usbnet joydev mii hid_multitouch iwlwifi input_leds btusb btrtl
btbcm btintel atomisp(C) bluetooth cfg80211 mei_txe mei lpc_ich
videobuf_vmalloc processor_thermal_device shpchp videobuf_core
intel_soc_dts_iosf snd_seq_midi snd_seq_midi_event snd_rawmidi
snd_soc_core snd_seq snd_compress ac97_bus snd_pcm_dmaengine
bmc150_accel_i2c dw_dmac
[  425.672845]  bmc150_accel_core dw_dmac_core
industrialio_triggered_buffer snd_pcm kfifo_buf industrialio
atomisp_ov2680(C) snd_seq_device v4l2_common snd_timer videodev snd
media soundcore pwm_lpss_platform 8250_dw tpm_crb spi_pxa2xx_platform
pwm_lpss wmi acpi_pad int3403_thermal int3400_thermal
int340x_thermal_zone acpi_thermal_rel soc_button_array
intel_int0002_vgpio parport_pc ppdev lp parport ip_tables x_tables
hid_generic usbhid dm_crypt mmc_block i915 intel_gtt i2c_algo_bit
drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm video
i2c_hid hid sdhci_acpi sdhci
[  425.672906] CPU: 1 PID: 2385 Comm: mplayer Tainted: G      D  C
4.15.0-rc3 #5
[  425.672909] Hardware name: LENOVO 80XF/LNVNB161216, BIOS 5HCN31WW
09/11/2017
[  425.672913] RIP: 0010:rt_mutex_slowlock+0x176/0x1e0
[  425.672916] RSP: 0018:ffffaca6c2917c88 EFLAGS: 00010046
[  425.672921] RAX: 0000000000000000 RBX: ffff9b50343aeea0 RCX:
0000000000000006
[  425.672924] RDX: 0000000000000007 RSI: 0000000000000002 RDI:
ffff9b503fc8cdd0
[  425.672927] RBP: ffffaca6c2917ca0 R08: 0000000000000382 R09:
000000000000000f
[  425.672930] R10: 0000000000000000 R11: ffffffffae3e0e0d R12:
0000000000000000
[  425.672933] R13: 0000000000000002 R14: 00000000ffffffdd R15:
0000000000000000
[  425.672937] FS:  0000000000000000(0000) GS:ffff9b503fc80000(0000)
knlGS:0000000000000000
[  425.672945] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  425.672948] CR2: 00000000000000b8 CR3: 0000000167808000 CR4:
00000000001006e0
[  425.672951] Call Trace:
[  425.673008]  ? atomisp_release+0x8f/0x520 [atomisp]
[  425.673016]  ? kmem_cache_free+0x195/0x1c0
[  425.673033]  ? v4l2_release+0x30/0x80 [videodev]
[  425.673038]  ? __fput+0xd8/0x210
[  425.673046]  ? task_work_run+0x89/0xb0
[  425.673052]  ? do_exit+0x2ed/0xb30
[  425.673058]  ? rewind_stack_do_exit+0x17/0x20
[  425.673062] Code: 48 8d 75 00 48 8d 3b e8 f9 09 3f ff 41 83 fe dd 0f
85 70 ff ff ff 45 85 ff 0f 85 67 ff ff ff 48 c7 c7 99 04 bb ad e8 9a f5
39 ff <0f> ff 48 c7 44 24 10 01 00 00 00 65 48 8b 14 25 40 c4 00 00 48
[  425.673123] ---[ end trace fb76f36afd55319f ]---

>>  Am I on the right track here, or am
>> I wasting my (and your) time?
> 
> It's both: track is right and it's waste of time.
> 

I see your point, Still it feels, as if this could go somewhere. Anyway,
thanks for your explanations and the time you invested into this.

Happy New Year to everyone.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux