intel / ipu6-drivers

GNU General Public License v2.0
165 stars 52 forks source link

Ipu6-isys probe improvements #214

Open jwrdegoede opened 7 months ago

jwrdegoede commented 7 months ago

Here is a set of improvements to the ipu6-isys probe() code which I wrote while working on fixing #205

EmilienMottet commented 7 months ago

this works fine for me in kernel 6.7.7 but no in 6.7.9

In 6.7.9 have this. Before your fix I have the same in 6.7.7. I have recompile with 6.7.9 kernel

int3472-discrete INT3472:06: cannot find GPIO chip INTC1096:00, deferring
int3472-discrete INT3472:05: cannot find GPIO chip INTC1096:00, deferring

when I boot on 6.7.7, I have this

i2c i2c-INT3474:01: deferred probe pending

after reload mod with :

sudo rmmod -f intel_ipu6_psys intel_ipu6_isys intel_ipu6 && sudo modprobe -a intel_ipu6 intel_ipu6_isys intel_ipu6_
psys

I can access to my camera :)

intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x0)
intel-ipu6 0000:00:05.0: physical base address 0x603c000000
intel-ipu6 0000:00:05.0: mapped as: 0x000000009cb09c25
intel-ipu6 0000:00:05.0: IPU in secure mode
intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
intel-ipu6 0000:00:05.0: IPC reset done
intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
Loading firmware: intel/ipu6ep_fw.bin
intel-ipu6 0000:00:05.0: FW version: 20230102
intel-ipu6 0000:00:05.0: Found supported sensor INT3474:01
intel-ipu6 0000:00:05.0: Connected 1 cameras
intel-ipu6 0000:00:05.0: Sending BOOT_LOAD to CSE
intel-ipu6 0000:00:05.0: Sending AUTHENTICATE_RUN to CSE
intel-ipu6 0000:00:05.0: CSE authenticate_run done
intel-ipu6 0000:00:05.0: IPU6-v3 driver version 1.0
intel-ipu6-psys intel-ipu6-psys0: pkg_dir entry count:8
intel-ipu6-psys intel-ipu6-psys0: psys probe minor: 0
intel-ipu6-isys intel-ipu6-isys0: bind ov2740 2-0036 nlanes is 2 port is 1
intel-ipu6-isys intel-ipu6-isys0: All sensor registration completed.
kupietz commented 7 months ago

this works fine for me in kernel 6.7.7 but no in 6.7.9

In 6.7.9 have this. Before your fix I have the same in 6.7.7. I have recompile with 6.7.9 kernel

int3472-discrete INT3472:06: cannot find GPIO chip INTC1096:00, deferring
int3472-discrete INT3472:05: cannot find GPIO chip INTC1096:00, deferring

I get exactly this already with kernel 6.7.7-200.fc39.

EmilienMottet commented 6 months ago

@kupietz

I solve this issue with

sudo rm -rf /lib/modules/6.7.10-gentoo-dist/updates/*ljca*.ko.xz
sudo modprobe -r intel_ipu6_psys intel_ipu6_isys intel_ipu6 && sudo modprobe -a intel_ipu6 intel_ipu6_isys intel_ip
u6_psys
sudo depmod -a

after deleting the external module you have to rebuild the dep module graph

kupietz commented 6 months ago

@kupietz

I solve this issue with

sudo rm -rf /lib/modules/6.7.10-gentoo-dist/updates/*ljca*.ko.xz
sudo modprobe -r intel_ipu6_psys intel_ipu6_isys intel_ipu6 && sudo modprobe -a intel_ipu6 intel_ipu6_isys intel_ip
u6_psys
sudo depmod -a

after deleting the external module you have to rebuild the dep module graph

Thanks! This got @jwrdegoede 's COPR/ipu6-softisp kernel working for my X1 Carbon Gen 11, but apparently does not help with kernel-6.7.9-200.fc39.x86_64.

When I delete all duplicate ljca modules on f39:

# find /usr/lib/modules/6.7.9-200.fc39.x86_64/kernel/drivers/ -name "*ljca.ko*" -print -delete
/usr/lib/modules/6.7.9-200.fc39.x86_64/kernel/drivers/gpio/gpio-ljca.ko.xz
/usr/lib/modules/6.7.9-200.fc39.x86_64/kernel/drivers/i2c/busses/i2c-ljca.ko.xz
/usr/lib/modules/6.7.9-200.fc39.x86_64/kernel/drivers/spi/spi-ljca.ko.xz
/usr/lib/modules/6.7.9-200.fc39.x86_64/kernel/drivers/usb/misc/usb-ljca.ko.xz
# depmod -a
# shutdown -r now

I still get:

# dmesg  |grep GPIO
[    7.586806] int3472-discrete INT3472:05: cannot find GPIO chip INTC1096:00, deferring
[    7.593085] int3472-discrete INT3472:06: cannot find GPIO chip INTC1096:00, deferring
[    7.595558] int3472-discrete INT3472:05: cannot find GPIO chip INTC1096:00, deferring
[    7.601181] int3472-discrete INT3472:06: cannot find GPIO chip INTC1096:00, deferring
[    7.604324] int3472-discrete INT3472:05: cannot find GPIO chip INTC1096:00, deferring
[    7.608102] int3472-discrete INT3472:06: cannot find GPIO chip INTC1096:00, deferring

EDIT: but indeed, afterwards, something happens:

$ sudo dmesg | grep -iE '(gpio|ipu6|ov2)'
…
[   10.608570] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   10.609996] intel-ipu6 0000:00:05.0: FW version: 20230102
[   10.613838] intel-ipu6 0000:00:05.0: Found supported sensor INT3474:01
[   10.614016] intel-ipu6 0000:00:05.0: Connected 1 cameras
[   10.614842] intel-ipu6 0000:00:05.0: Sending BOOT_LOAD to CSE
[   10.624400] intel-ipu6 0000:00:05.0: Sending AUTHENTICATE_RUN to CSE
[   10.692881] intel-ipu6 0000:00:05.0: CSE authenticate_run done
[   10.693360] intel-ipu6 0000:00:05.0: IPU6-v3 driver version 1.0
[   10.694380]  isys_unregister_subdevices+0x36/0x80 [intel_ipu6_isys]
[   10.694395]  isys_probe+0x565/0x9b0 [intel_ipu6_isys]
[   10.694415]  ipu_bus_probe+0x5c/0x100 [intel_ipu6]
[   10.694483] Modules linked in: uvcvideo(+) nft_chain_nat uvc nf_nat videobuf2_vmalloc nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set cdc_ether usbnet nf_tables nfnetlink bnep gpio_ljca(OE) spi_ljca(OE) i2c_ljca(OE) btusb btrtl btintel uas btbcm btmtk bluetooth ljca(OE) r8152 mii usb_storage qrtr snd_usb_audio snd_usbmidi_lib snd_ump snd_rawmidi snd_ctl_led snd_soc_skl_hda_dsp snd_soc_hdac_hdmi snd_sof_probes snd_soc_intel_hda_dsp_common snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic sunrpc snd_soc_dmic snd_sof_pci_intel_tgl snd_sof_intel_hda_common soundwire_intel snd_sof_intel_hda_mlink soundwire_cadence snd_sof_intel_hda snd_sof_pci snd_sof_xtensa_dsp iwlmvm snd_sof intel_uncore_frequency intel_uncore_frequency_common intel_tcc_cooling x86_pkg_temp_thermal snd_sof_utils snd_soc_hdac_hda intel_powerclamp binfmt_misc snd_hda_ext_core coretemp iTCO_wdt snd_soc_acpi_intel_match intel_pmc_bxt snd_soc_acpi iTCO_vendor_support spi_nor mei_pxp mei_hdcp kvm_intel mtd mac80211 soundwire_generic_allocation
[   10.694529]  pmt_telemetry pmt_class intel_rapl_msr soundwire_bus kvm snd_soc_core libarc4 snd_compress ac97_bus irqbypass snd_pcm_dmaengine rapl snd_hda_intel intel_cstate snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec intel_uncore snd_hda_core think_lmi(+) iwlwifi snd_hwdep firmware_attributes_class vfat wmi_bmof intel_ipu6_isys(OE) snd_seq fat pcspkr videobuf2_dma_contig snd_seq_device i2c_i801 videobuf2_memops snd_pcm videobuf2_v4l2 i2c_smbus spi_intel_pci cfg80211 iosm spi_intel snd_timer videobuf2_common processor_thermal_device_pci processor_thermal_device thunderbolt(+) mei_me intel_ipu6_psys(OE) processor_thermal_wt_hint idma64 processor_thermal_rfim intel_vsec processor_thermal_rapl intel_rapl_common intel_ipu6(OE) processor_thermal_wt_req processor_thermal_power_floor nxp_nci_i2c processor_thermal_mbox thinkpad_acpi nxp_nci ledtrig_audio mei_vsc(OE) nci platform_profile intel_skl_int3472_tps68470 snd int3403_thermal mei tps68470_regulator nfc soundcore soc_button_array int340x_thermal_zone clk_tps68470
[   10.694572]  rfkill ov2740(OE) v4l2_fwnode int3400_thermal intel_hid intel_skl_int3472_discrete v4l2_async acpi_thermal_rel sparse_keymap acpi_tad acpi_pad joydev loop hid_sensor_hub intel_ishtp_hid i915 crct10dif_pclmul crc32_pclmul i2c_algo_bit crc32c_intel polyval_clmulni drm_buddy polyval_generic ttm nvme ghash_clmulni_intel nvme_core drm_display_helper sha512_ssse3 intel_ish_ipc hid_multitouch sha256_ssse3 ucsi_acpi typec_ucsi sha1_ssse3 intel_ishtp cec typec nvme_auth video i2c_hid_acpi i2c_hid wmi pinctrl_tigerlake serio_raw hid_cmedia v4l2loopback(OE) videodev mc fuse i2c_dev
[   10.699695] ov2740 i2c-INT3474:01: chip id mismatch: 2740!=0
[   10.699701] ov2740 i2c-INT3474:01: failed to find sensor: -6
EmilienMottet commented 6 months ago

Ok looks good : Doyou kernel have config ?

zgrep -i 2740 /proc/config.gz 
CONFIG_VIDEO_OV2740=m
zgrep  CONFIG_INTEL_VSC /proc/config.gz
CONFIG_INTEL_VSC=m
kupietz commented 6 months ago

Fedora kernels don't support /proc/config anymore, but:

$ grep -E '2740|CONFIG_INTEL_VSC' /boot/config-$(uname -r)
# CONFIG_INTEL_VSC is not set
# CONFIG_VIDEO_OV2740 is not set

Should they be selected as modules, or just to avoid clashes with the ipu6-driver modules?

EmilienMottet commented 6 months ago

In my case, yes

kupietz commented 6 months ago

In my case, yes

It does also work for me on fc39 without the module selection after these steps. However, I often have to reboot to get it working.

jwrdegoede commented 5 months ago

These patches are still relevant/useful. I'm pushing a new version rebased on the latest master branch now.