NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.48k stars 12.98k forks source link

Tracking Issue: Intel MIPI/IPU6 webcam-support #225743

Open betaboon opened 1 year ago

betaboon commented 1 year ago

Recently a couple of PRs introduced support for Intel MIPI/IPU6 based webcams. (#212799, #225160, #225292)

As the upstream situation for these devices currently is a mess, this does not work on all devices.

This tracking issue should serve two purposes:

reporting success

please provide the following information:

reporting failure

please provide the following information:

Known-good devices

simisimis commented 1 year ago

thank you for putting time to hunt this down.

Dell XPS 13 Plus 9320

I am unable to get camera to show anything. Chromium/firefox detects a camera as Intel MIPI Camera. Then it just shows black screen. Some seconds later it disappears(on chromium) saying it cannot detect camera even though it first detected and was showing black screen.

$ uname -a
Linux hostname 6.1.23 #1-NixOS SMP PREEMPT_DYNAMIC Thu Apr  6 10:10:58 UTC 2023 x86_64 GNU/Linux
$ nixos-version
23.05.20230409.fd531de (Stoat)
$lsmod | grep -Ei "int3472|ipu"
intel_ipu6_isys       139264  0
videobuf2_dma_contig    20480  1 intel_ipu6_isys
videobuf2_v4l2         36864  1 intel_ipu6_isys
videobuf2_common       69632  4 videobuf2_dma_contig,videobuf2_v4l2,intel_ipu6_isys,videobuf2_memops
v4l2_fwnode            32768  3 ov01a10,intel_ipu6_isys,ov2740
v4l2_async             28672  4 v4l2_fwnode,ov01a10,intel_ipu6_isys,ov2740
intel_ipu6_psys        98304  0
videodev              282624  8 v4l2_async,videobuf2_v4l2,ov01a10,v4l2loopback,intel_ipu6_isys,videobuf2_common,ov2740
intel_skl_int3472_tps68470    20480  0
intel_ipu6            102400  2 intel_ipu6_isys,intel_ipu6_psys
mfd_core               20480  5 intel_pmc_bxt,ljca,intel_skl_int3472_tps68470,hid_sensor_hub,intel_lpss
regmap_i2c             16384  2 intel_skl_int3472_tps68470,ov2740
mc                     73728  8 v4l2_async,videodev,snd_usb_audio,videobuf2_v4l2,ov01a10,intel_ipu6_isys,videobuf2_common,ov2740
intel_skl_int3472_discrete    16384  0
i2c_core              114688  21 v4l2_async,i2c_designware_platform,videodev,i2c_hid,i2c_designware_core,drm_kms_helper,intel_hid,intel_ipu6,i2c_algo_bit,intel_skl_int3472_tps68470,ov01a10,drm_display_helper,i2c_smbus,i2c_ljca,i2c_i801,i2c_hid_acpi,i915,psmouse,regmap_i2c,ov2740,drm
$ dmesg | grep -Ei "int3472|ipu"
[    0.007737] ACPI: SSDT 0x000000005D765000 000150 (v02 INTEL  IpuSsdt  00001000 INTL 20200717)
[   22.379609] int3472-discrete INT3472:01: INT3472 seems to have no dependents.
[   22.387809] int3472-discrete INT3472:06: GPIO type 0x02 unknown; the sensor may not work
[   22.471462] intel-ipu6 0000:00:05.0: enabling device (0000 -> 0002)
[   22.471608] intel-ipu6 0000:00:05.0: Device 0x465d (rev: 0x2)
[   22.471626] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   22.471628] intel-ipu6 0000:00:05.0: mapped as: 0x0000000069b56ce2
[   22.471692] intel-ipu6 0000:00:05.0: Unable to set secure mode
[   22.471693] intel-ipu6 0000:00:05.0: IPU in non-secure mode
[   22.471695] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   22.471696] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   22.471882] intel-ipu6 0000:00:05.0: Skip ipc reset for non-secure mode
[   22.471886] intel-ipu6 0000:00:05.0: IPC reset done
[   22.471887] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   22.496663] intel-ipu6 0000:00:05.0: FW version: 20220510
[   22.497853] intel-ipu6 0000:00:05.0: IPU6-v3 driver version 1.0
[   22.575533] intel-ipu6-psys intel-ipu6-psys0: pkg_dir entry count:8
[   22.575654] intel-ipu6-psys intel-ipu6-psys0: psys probe minor:
$ iasl -tc dsdt.dat

Intel ACPI Component Architecture
ASL+ Optimizing Compiler/Disassembler version 20221020
Copyright (c) 2000 - 2022 Intel Corporation

File appears to be binary: found 159917 non-ASCII characters, disassembling
Binary file appears to be a valid ACPI table, disassembling
Input file dsdt.dat, Length 0x71464 (463972) bytes
ACPI: DSDT 0x0000000000000000 071464 (v02 DELL   Dell Inc 00000002      01000013)
Pass 1 parse of [DSDT]
Pass 2 parse of [DSDT]
Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)

Parsing completed
Disassembly completed
ASL Output:    dsdt.dsl - 3301238 bytes

 iASL Warning: There were 243 external control methods found during
 disassembly, but only 499 were resolved (4294967040 unresolved). Additional
 ACPI tables may be required to properly disassemble the code. This
 resulting disassembler output file may not compile because the
 disassembler did not know how many arguments to assign to the
 unresolved methods. Note: SSDTs can be dynamically loaded at
 runtime and may or may not be available via the host OS.

 To specify the tables needed to resolve external control method
 references, the -e option can be used to specify the filenames.
 Example iASL invocations:
     iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml
     iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml
     iasl -e ssdt*.aml -d dsdt.aml

 In addition, the -fe option can be used to specify a file containing
 control method external declarations with the associated method
 argument counts. Each line of the file must be of the form:
     External (<method pathname>, MethodObj, <argument count>)
 Invocation:
     iasl -fe refs.txt -d dsdt.aml
$ grep -A4 '(CAM' dsdt.dsl
        Device (CAM0)
        {
            Name (_HID, "INT3471")  // _HID: Hardware ID
            Name (_DDN, "IMX135-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
--
        Device (CAM1)
        {
            Name (_HID, "INT3474")  // _HID: Hardware ID
            Name (_DDN, "OV2740-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
Garionion commented 1 year ago

Also Dell XPS 13 Plus (9320): Does also not work at all

Linux dellxps13plus 6.2.10 #1-NixOS SMP PREEMPT_DYNAMIC Thu Apr 6 10:12:48 UTC 2023 x86_64 GNU/Linux nixos-version: 23.05pre472020.db24d86dd8a (Stoat)

lsmod | grep -Ei "int3472|ipu":

❯ lsmod | grep -Ei "int3472|ipu"
intel_ipu6_isys       159744  0
videobuf2_dma_contig    24576  1 intel_ipu6_isys
videobuf2_v4l2         36864  2 intel_ipu6_isys,uvcvideo
videobuf2_common       73728  6 videobuf2_vmalloc,videobuf2_dma_contig,videobuf2_v4l2,intel_ipu6_isys,uvcvideo,videobuf2_memops
intel_ipu6_psys       110592  0
intel_skl_int3472_tps68470    20480  0
intel_ipu6            118784  2 intel_ipu6_isys,intel_ipu6_psys
regmap_i2c             16384  1 intel_skl_int3472_tps68470
v4l2_fwnode            32768  2 ov01a10,intel_ipu6_isys
mfd_core               20480  5 intel_pmc_bxt,ljca,intel_skl_int3472_tps68470,hid_sensor_hub,intel_lpss
v4l2_async             32768  3 v4l2_fwnode,ov01a10,intel_ipu6_isys
intel_skl_int3472_discrete    16384  0
videodev              315392  9 v4l2_async,videobuf2_v4l2,ov01a10,v4l2loopback,intel_ipu6_isys,uvcvideo
mc                     81920  10 v4l2_async,videodev,snd_usb_audio,videobuf2_v4l2,ov01a10,intel_ipu6_isys,uvcvideo,videobuf2_common
i2c_core              131072  21 v4l2_async,i2c_designware_platform,videodev,i2c_hid,i2c_designware_core,drm_kms_helper,intel_hid,intel_ipu6,i2c_algo_bit,intel_skl_int3472_tps68470,ov01a10,drm_display_helper,i2c_smbus,i2c_ljca,i2c_i801,i2c_hid_acpi,i915,psmouse,regmap_i2c,i2c_dev,drm

dmesg | grep -Ei "int3472|ipu":

❯ dmesg | grep -Ei "int3472|ipu"
[    0.006630] ACPI: SSDT 0x000000005D765000 000150 (v02 INTEL  IpuSsdt  00001000 INTL 20200717)
[    2.806413] int3472-discrete INT3472:01: INT3472 seems to have no dependents.
[    2.812330] int3472-discrete INT3472:06: GPIO type 0x02 unknown; the sensor may not work
[    2.874326] intel-ipu6 0000:00:05.0: enabling device (0000 -> 0002)
[    2.874426] intel-ipu6 0000:00:05.0: Device 0x465d (rev: 0x2)
[    2.874434] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[    2.874435] intel-ipu6 0000:00:05.0: mapped as: 0x0000000063fe5490
[    2.874498] intel-ipu6 0000:00:05.0: Unable to set secure mode
[    2.874499] intel-ipu6 0000:00:05.0: IPU in non-secure mode
[    2.874499] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[    2.874500] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[    2.874504] intel-ipu6 0000:00:05.0: Skip ipc reset for non-secure mode
[    2.874505] intel-ipu6 0000:00:05.0: IPC reset done
[    2.874506] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[    2.889683] intel-ipu6 0000:00:05.0: FW version: 20220510
[    2.893385] intel-ipu6 0000:00:05.0: IPU6-v3 driver version 1.0
[    3.028981] intel-ipu6-psys intel-ipu6-psys0: pkg_dir entry count:8
[    3.029461] intel-ipu6-psys intel-ipu6-psys0: psys probe minor: 0

output from acpi table:

❯  grep -A4 '(CAM' dsdt.dsl
        Device (CAM0)
        {
            Name (_HID, "INT3471")  // _HID: Hardware ID
            Name (_DDN, "IMX135-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
--
        Device (CAM1)
        {
            Name (_HID, "INT3474")  // _HID: Hardware ID
            Name (_DDN, "OV2740-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
jameswryan commented 1 year ago

My laptop (HP Spectre x360 16-f10323dx) camera is not working. There is a hardware shutter that is (I think) managed by the firmware. I'm not sure if it disconnects the camera or not, but all of the following information was taken with the shutter open.

[ipu6-camera-not-working@hp-spectre-x360-16-f10323dx]$ uname -a

Linux hp-spectre-x360-16-f10323dx 6.2.10 #1-NixOS SMP PREEMPT_DYNAMIC Thu Apr  6 10:12:48 UTC 2023 x86_64 GNU/Linux

[ipu6-camera-not-working@hp-spectre-x360-16-f10323dx]$ nixos-version

23.05.20230412.fe2ecaf (Stoat)

[ipu6-camera-not-working@hp-spectre-x360-16-f10323dx]$ lsmod | grep -Ei "int3472|ipu"

intel_skl_int3472_tps68470    20480  0
regmap_i2c             16384  1 intel_skl_int3472_tps68470
intel_skl_int3472_discrete    16384  0
i2c_core              131072  17 v4l2_async,i2c_designware_platform,videodev,i2c_hid,i2c_
designware_core,drm_kms_helper,intel_hid,i2c_algo_bit,intel_skl_int3472_tps68470,hi556,dr
m_display_helper,i2c_smbus,i2c_i801,i2c_hid_acpi,i915,regmap_i2c,drm
mfd_core               20480  5 intel_pmc_bxt,rtsx_pci,intel_skl_int3472_tps68470,hid_sen
sor_hub,intel_lpss

[ipu6-camera-not-working@hp-spectre-x360-16-f10323dx]$ dmesg | grep -Ei "int3472|ipu"

[65372.547156]  ac97_bus snd_pcm_dmaengine snd_hda_intel snd_intel_dspcfg drm_buddy snd_intel_sdw_acpi ttm snd_hda_codec cmdlinepart btusb drm_display_helper spi_nor btrtl snd_hda_core btbcm iTCO_wdt btintel intel_pmc_bxt msr hid_generic cec btmtk libarc4 bluetooth mei_hdcp mei_pxp snd_hwdep iwlwifi mtd processor_thermal_device_pci drm_kms_helper watchdog x86_pkg_temp_thermal snd_pcm intel_powerclamp nls_iso8859_1 processor_thermal_device nls_cp437 hi556 coretemp processor_thermal_rfim crc32_pclmul snd_timer pmt_telemetry v4l2_fwnode intel_ish_ipc polyval_clmulni pmt_class intel_gtt vfat ucsi_acpi polyval_generic 8250_dw i2c_designware_platform i2c_designware_core intel_rapl_msr wmi_bmof gf128mul ghash_clmulni_intel rapl intel_cstate intel_uncore typec_ucsi intel_lpss_pci intel_skl_int3472_tps68470 cfg80211 agpgart ecdh_generic tps68470_regulator intel_lpss fat intel_ishtp mei_me snd typec processor_thermal_mbox igen6_edac v4l2_async i2c_algo_bit clk_tps68470 i2c_hid_acpi spi_intel_pci ecc
[65372.547263]  i2c_i801 syscopyarea idma64 processor_thermal_rapl video mei spi_intel soundcore sysfillrect i2c_smbus rfkill i2c_hid crc16 regmap_i2c 8250_pci virt_dma edac_core intel_vsec sysimgblt intel_rapl_common roles thermal fan videodev int3403_thermal intel_hid mc battery int3400_thermal int340x_thermal_zone ac wmi intel_skl_int3472_discrete tiny_power_button hid sparse_keymap intel_pmc_core pinctrl_tigerlake acpi_thermal_rel soc_button_array acpi_pad acpi_tad evdev button mac_hid serio_raw ip6_tables xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip6t_rpfilter ipt_rpfilter xt_pkttype xt_LOG nf_log_syslog xt_tcpudp nft_compat nf_tables sch_fq_codel nfnetlink ctr loop cpufreq_powersave tun tap macvlan bridge stp llc kvm_intel kvm irqbypass drm fuse backlight deflate i2c_core efi_pstore configfs efivarfs dmi_sysfs ip_tables x_tables dm_crypt cbc encrypted_keys trusted asn1_encoder tee input_leds led_class btrfs dm_mod dax rtsx_pci_sdmmc atkbd xhci_pci tpm_crb

[ipu6-camera-not-working@hp-spectre-x360-16-f10323dx]$ grep -A4 '(CAM' dsdt.dsl

        Device (CAM0)
        {
            Name (_HID, "INT3471")  // _HID: Hardware ID
            Name (_DDN, "IMX135-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
--
        Device (CAM1)
        {
            Name (_HID, "INT3474")  // _HID: Hardware ID
            Name (_DDN, "OV2740-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
bclement-ocp commented 1 year ago

Reporting (partial) success

Success is only partial in that the webcam doesn't work in Cheese ("There was an error playing video from the webcam") for some reason. It does work in Firefox (which is the only one I care about, really) and Webcamoid.

I have used the following options:

  hardware.ipu6.enable = true;
  hardware.ipu6.platform = "ipu6ep";

Note: using kernel 6.3 fails due to the driver using APIs removed in torvalds/linux@3dbdd92014a410778de8406e9e3253e353f51c2b so I am stuck on 6.2 for now.

Edit: the camera exists but the output is completely black on kernel 6.1 (current default for nixos-unstable).

mweinelt commented 1 year ago

Updated drivers over in #233074. Everyone, feel welcome to give them a try. They add support for Linux 6.3. No new firmwares.

betaboon commented 1 year ago

the above mentioned update is confirmed to work on my Lenovo X1 Carbon Gen 10 21CB00B9GE. good news also: privacy led now works without kernel-patches.

simisimis commented 1 year ago

Updated drivers over in #233074. Everyone, feel welcome to give them a try. They add support for Linux 6.3. No new firmwares.

I get same collision error as it was already reported here https://github.com/NixOS/nixpkgs/pull/212799#issuecomment-1472406566

bclement-ocp commented 1 year ago

Something broke permanently on my Lenovo X1 Carbon Gen 10 21CBCTO1WW. I was in a meeting, my webcam froze, and since then it no longer works, even after rebooting multiple times. Same behavior with the updated drivers and with the old drivers: the hardware LED works but the camera output is black.

avandecreme commented 1 year ago

Not working on my Dell XPS 9315.

Since I am not certain it is the correct thing to do, here is the only thing that I added to my config:

  hardware.ipu6 = {
    enable = true;
    platform = "ipu6ep";
  };

uname -a
Linux hostname 6.3.5 #1-NixOS SMP PREEMPT_DYNAMIC Tue May 30 13:17:29 UTC 2023 x86_64 GNU/Linux

nixos-version
23.05.20230605.70f7275 (Stoat)

lsmod | grep -Ei "int3472|ipu"

intel_ipu6_isys       159744  0
videobuf2_dma_contig    24576  1 intel_ipu6_isys
videobuf2_v4l2         36864  1 intel_ipu6_isys
videobuf2_common       73728  4 videobuf2_dma_contig,videobuf2_v4l2,intel_ipu6_isys,videobuf2_memops
intel_ipu6_psys       110592  0
intel_skl_int3472_tps68470    20480  0
intel_ipu6            118784  2 intel_ipu6_isys,intel_ipu6_psys
regmap_i2c             16384  1 intel_skl_int3472_tps68470
mfd_core               20480  5 intel_pmc_bxt,ljca,intel_skl_int3472_tps68470,hid_sensor_hub,intel_lpss
v4l2_fwnode            32768  2 ov01a10,intel_ipu6_isys
v4l2_async             32768  3 v4l2_fwnode,ov01a10,intel_ipu6_isys
intel_skl_int3472_discrete    28672  0
videodev              344064  7 v4l2_async,v4l2_fwnode,videobuf2_v4l2,ov01a10,v4l2loopback,intel_ipu6_isys
mc                     86016  6 v4l2_async,videodev,videobuf2_v4l2,ov01a10,intel_ipu6_isys,videobuf2_common
i2c_core              135168  20 v4l2_async,i2c_designware_platform,videodev,i2c_hid,i2c_designware_core,drm_kms_helper,intel_hid,intel_ipu6,i2c_algo_bit,intel_skl_int3472_tps68470,ov01a10,drm_display_helper,i2c_smbus,i2c_ljca,i2c_i801,i2c_hid_acpi,i915,psmouse,regmap_i2c,drm
led_class              24576  5 videodev,input_leds,iwlmvm,dell_laptop,intel_skl_int3472_discrete

dmesg | grep -Ei "int3472|ipu"

[    0.004423] ACPI: SSDT 0x000000005D75F000 000150 (v02 INTEL  IpuSsdt  00001000 INTL 20200717)
[   11.311850] int3472-discrete INT3472:01: INT3472 seems to have no dependents.
[   11.348969] int3472-discrete INT3472:06: GPIO type 0x02 unknown; the sensor may not work
[   11.382099] intel-ipu6 0000:00:05.0: enabling device (0000 -> 0002)
[   11.382274] intel-ipu6 0000:00:05.0: Device 0x465d (rev: 0x6)
[   11.382285] intel-ipu6 0000:00:05.0: physical base address 0x6076000000
[   11.382286] intel-ipu6 0000:00:05.0: mapped as: 0x0000000010d4cfe3
[   11.382353] intel-ipu6 0000:00:05.0: Unable to set secure mode
[   11.382355] intel-ipu6 0000:00:05.0: IPU in non-secure mode
[   11.382356] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   11.382358] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   11.382362] intel-ipu6 0000:00:05.0: Skip ipc reset for non-secure mode
[   11.382363] intel-ipu6 0000:00:05.0: IPC reset done
[   11.382363] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   11.399600] intel-ipu6 0000:00:05.0: FW version: 20220510
[   11.400850] intel-ipu6 0000:00:05.0: IPU6-v3 driver version 1.0
[   11.491268] intel-ipu6-psys intel-ipu6-psys0: pkg_dir entry count:8
[   11.491456] intel-ipu6-psys intel-ipu6-psys0: psys probe minor: 0

acpica-tools

        Device (CAM0)
        {
            Name (_HID, "INT3471")  // _HID: Hardware ID
            Name (_DDN, "IMX135-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
--
        Device (CAM1)
        {
            Name (_HID, "INT3474")  // _HID: Hardware ID
            Name (_DDN, "OV2740-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
bclement-ocp commented 1 year ago

Something broke permanently on my Lenovo X1 Carbon Gen 10 21CBCTO1WW. I was in a meeting, my webcam froze, and since then it no longer works, even after rebooting multiple times. Same behavior with the updated drivers and with the old drivers: the hardware LED works but the camera output is black.

The webcam started working again, and then broke again. I have the following in dmesg, but not sure if it is related:

[121079.094793] intel-ipu6-isys intel-ipu6-isys0: PM: dpm_run_callback(): isys_suspend+0x0/0x20 [intel_ipu6_isys] returns -16
[121079.094983] intel-ipu6-isys intel-ipu6-isys0: PM: failed to suspend: error -16
[121079.116093] intel-ipu6-isys intel-ipu6-isys0: csi2-1 error: Transfer FIFO overflow
[121079.116108] intel-ipu6-isys intel-ipu6-isys0: csi2-1 error: Inter-frame long packet discarded
[121079.169995] intel-ipu6-isys intel-ipu6-isys0: csi2-1 error: Inter-frame short packet discarded
[121079.170002] intel-ipu6-isys intel-ipu6-isys0: csi2-1 error: Inter-frame long packet discarded
[121109.149380] intel-ipu6-isys intel-ipu6-isys0: PM: dpm_run_callback(): isys_suspend+0x0/0x20 [intel_ipu6_isys] returns -16
[121109.149430] intel-ipu6-isys intel-ipu6-isys0: PM: failed to suspend: error -16
[121109.333472] intel-ipu6-isys intel-ipu6-isys0: csi2-1 error: Transfer FIFO overflow
[121109.333479] intel-ipu6-isys intel-ipu6-isys0: csi2-1 error: Inter-frame short packet discarded
[121109.333481] intel-ipu6-isys intel-ipu6-isys0: csi2-1 error: Inter-frame long packet discarded
[121109.427162] intel-ipu6-isys intel-ipu6-isys0: stream off ov2740 11-0036
[172173.226775] intel-ipu6 0000:00:05.0: IPU in secure mode
[199744.490931] intel-ipu6-isys intel-ipu6-isys0: no pipe or streaming, adding to incoming
[199744.490934] intel-ipu6-isys intel-ipu6-isys0: no pipe or streaming, adding to incoming
[199744.492442] intel-ipu6-isys intel-ipu6-isys0: stream on ov2740 11-0036
[199755.906247] intel-ipu6-isys intel-ipu6-isys0: stream off ov2740 11-0036
[215775.997825] intel-ipu6 0000:00:05.0: IPU in secure mode
[258579.901323] intel-ipu6 0000:00:05.0: IPU in secure mode
[269288.389716] intel-ipu6 0000:00:05.0: IPU in secure mode
[282344.582686] intel-ipu6 0000:00:05.0: IPU in secure mode
[310841.733375] intel-ipu6 0000:00:05.0: IPU in secure mode
[344153.479298] intel-ipu6 0000:00:05.0: IPU in secure mode
[346776.903361] intel-ipu6 0000:00:05.0: IPU in secure mode
[349140.396123] intel-ipu6-isys intel-ipu6-isys0: no pipe or streaming, adding to incoming
[349140.396127] intel-ipu6-isys intel-ipu6-isys0: no pipe or streaming, adding to incoming
[349140.397397] intel-ipu6-isys intel-ipu6-isys0: stream on ov2740 11-0036
[349152.269755] intel-ipu6-isys intel-ipu6-isys0: stream off ov2740 11-0036
[349152.532724] intel-ipu6-isys intel-ipu6-isys0: no pipe or streaming, adding to incoming
[349152.532728] intel-ipu6-isys intel-ipu6-isys0: no pipe or streaming, adding to incoming
[349152.534157] intel-ipu6-isys intel-ipu6-isys0: stream on ov2740 11-0036
[350789.971392] intel-ipu6-isys intel-ipu6-isys0: stream off ov2740 11-0036

Worth noting that rebooting does not solve the issue, so I suspect there is some firmware/hardware state that gets messed up.

andresilva commented 1 year ago

With https://github.com/NixOS/nixpkgs/pull/237193 I was able to get the camera to "boot" on a ThinkPad X1 Carbon Gen 11 (21HMCTO1WW). It's still very unstable and it stops working randomly.

mindtheegab commented 1 year ago

device XPS9315 not working at all

Linux nixos 6.1.35 #1-NixOS SMP PREEMPT_DYNAMIC Wed Jun 21 14:01:03 UTC 2023 x86_64 GNU/Linux

23.05.1353.35130d4b4f0 (Stoat)
 lsmod | grep -Ei "int3472|ipu"
intel_ipu6_isys       139264  0
videobuf2_dma_contig    20480  1 intel_ipu6_isys
videobuf2_v4l2         36864  1 intel_ipu6_isys
videobuf2_common       69632  4 videobuf2_dma_contig,videobuf2_v4l2,intel_ipu6_isys,videobuf2_memops
intel_ipu6_psys        98304  0
intel_ipu6            102400  2 intel_ipu6_isys,intel_ipu6_psys
intel_skl_int3472_tps68470    20480  0
v4l2_fwnode            32768  2 ov01a10,intel_ipu6_isys
mfd_core               20480  5 intel_pmc_bxt,ljca,intel_skl_int3472_tps68470,hid_sensor_hub,intel_lpss
regmap_i2c             16384  1 intel_skl_int3472_tps68470
v4l2_async             28672  3 v4l2_fwnode,ov01a10,intel_ipu6_isys
intel_skl_int3472_discrete    16384  0
videodev              282624  7 v4l2_async,videobuf2_v4l2,ov01a10,v4l2loopback,intel_ipu6_isys,videobuf2_common
mc                     73728  6 v4l2_async,videodev,videobuf2_v4l2,ov01a10,intel_ipu6_isys,videobuf2_common
i2c_core              114688  20 v4l2_async,i2c_designware_platform,videodev,i2c_hid,i2c_designware_core,drm_kms_helper,intel_hid,intel_ipu6,i2c_algo_bit,intel_skl_int3472_tps68470,ov01a10,drm_display_helper,i2c_smbus,i2c_ljca,i2c_i801,i2c_hid_acpi,i915,psmouse,regmap_i2c,drm
$ dmesg | grep -Ei "int3472|ipu"
[    0.005634] ACPI: SSDT 0x000000005D75F000 000150 (v02 INTEL  IpuSsdt  00001000 INTL 20200717)
[   22.410008] int3472-discrete INT3472:01: INT3472 seems to have no dependents.
[   22.413868] int3472-discrete INT3472:06: GPIO type 0x02 unknown; the sensor may not work
[   22.521780] intel-ipu6 0000:00:05.0: enabling device (0000 -> 0002)
[   22.521914] intel-ipu6 0000:00:05.0: Device 0x465d (rev: 0x6)
[   22.521930] intel-ipu6 0000:00:05.0: physical base address 0x6078000000
[   22.521931] intel-ipu6 0000:00:05.0: mapped as: 0x0000000078583f27
[   22.524027] intel-ipu6 0000:00:05.0: Unable to set secure mode
[   22.524030] intel-ipu6 0000:00:05.0: IPU in non-secure mode
[   22.524032] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   22.524034] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   22.524179] intel-ipu6 0000:00:05.0: Skip ipc reset for non-secure mode
[   22.524181] intel-ipu6 0000:00:05.0: IPC reset done
[   22.524182] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   22.545340] intel-ipu6 0000:00:05.0: FW version: 20220510
[   22.549381] intel-ipu6 0000:00:05.0: IPU6-v3 driver version 1.0
[   22.675842] intel-ipu6-psys intel-ipu6-psys0: pkg_dir entry count:8
[   22.678032] intel-ipu6-psys intel-ipu6-psys0: psys probe minor: 0
$   grep -A4 '(CAM' dsdt.dsl 
        Device (CAM0)
        {
            Name (_HID, "INT3471")  // _HID: Hardware ID
            Name (_DDN, "IMX135-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
--
        Device (CAM1)
        {
            Name (_HID, "INT3474")  // _HID: Hardware ID
            Name (_DDN, "OV2740-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
andresilva commented 11 months ago

Compilation of ipu6 related packages is broken on latest nixos-unstable-small (I suppose due to a stdenv compiler upgrade but didn't check). Fixed in https://github.com/NixOS/nixpkgs/pull/244378.

totoroot commented 11 months ago

I installed the drivers by enabling the module with

hardware.ipu6 = {
    enable = true;
    platform = "ipu6ep";
};

According to the description, ipu6ep should be the right one for my device, as the CPU in this Dell Latitude 7440 is an 13th Gen Intel® Core™ i7-1370P. The video devices show up but I am getting a black static frame in all applications I tested. I also tried ipu6 platform, but that did not help.

Reporting failure

My colleague was able to get his webcam working (at least in the browser) on the same model on Arch Linux by following these instructions .

flokli commented 10 months ago

This seems to have regressed, maybe with the 6.5 Kernel update.

hardware.ipu6 = {
    enable = true;
    platform = "ipu6ep";
};

Now fails to build with:

/build/source/drivers/media/pci/intel/ipu6/../ipu-psys.c: In function 'ipu_psys_get_userpages':
/build/source/drivers/media/pci/intel/ipu6/../ipu-psys.c:214:22: error: too many arguments to function 'get_user_pages'
  214 |                 nr = get_user_pages(start & PAGE_MASK, npages,
      |                      ^~~~~~~~~~~~~~
In file included from /nix/store/wiwjdq2z5r01iw00836j79rama4497vg-linux-6.5-dev/lib/modules/6.5.0/source/include/linux/scatterlist.h:8,
                 from /nix/store/wiwjdq2z5r01iw00836j79rama4497vg-linux-6.5-dev/lib/modules/6.5.0/source/include/linux/dma-buf.h:19,
                 from /build/source/drivers/media/pci/intel/ipu6/../ipu-psys.c:7:
/nix/store/wiwjdq2z5r01iw00836j79rama4497vg-linux-6.5-dev/lib/modules/6.5.0/source/include/linux/mm.h:2430:6: note: declared here
 2430 | long get_user_pages(unsigned long start, unsigned long nr_pages,
      |      ^~~~~~~~~~~~~~
[ 81%] Building CXX object CMakeFiles/camhal_static.dir/src/v4l2/V4l2DeviceFactory.cpp.o
[ 82%] Building CXX object CMakeFiles/camhal_static.dir/src/v4l2/SysCall.cpp.o
[ 83%] Building CXX object CMakeFiles/camhal_static.dir/src/v4l2/NodeInfo.cpp.o
  LD [M]  /build/source/ljca.o
make[5]: *** [/nix/store/wiwjdq2z5r01iw00836j79rama4497vg-linux-6.5-dev/lib/modules/6.5.0/source/scripts/Makefile.build:243: /build/source/drivers/media/pci/intel/ipu6/../ipu-psys.o] Error 1
make[5]: *** Waiting for unfinished jobs....
[ 84%] Building CXX object CMakeFiles/camhal_static.dir/modules/v4l2/v4l2_device.cc.o
  LD [M]  /build/source/mei-vsc.o

Edit: Ah, this might be https://github.com/NixOS/nixpkgs/pull/252221. Taking a look there now.

flokli commented 10 months ago

With https://github.com/NixOS/nixpkgs/pull/252221 applied, I got this far on a 6.5.0 kernel (Thinkpad X1 Carbon Gen 11):

root@x1:~|⇒  uname -a
Linux x1 6.5.0 #1-NixOS SMP PREEMPT_DYNAMIC Sun Aug 27 21:49:51 UTC 2023 x86_64 GNU/Linux
root@x1:~|⇒  lsmod | grep -Ei "int3472|ipu"

intel_ipu6_isys       151552  0
videobuf2_dma_contig    24576  1 intel_ipu6_isys
videobuf2_v4l2         36864  1 intel_ipu6_isys
videobuf2_common       77824  4 videobuf2_dma_contig,videobuf2_v4l2,intel_ipu6_isys,videobuf2_memops
intel_ipu6_psys       110592  0
intel_ipu6            118784  2 intel_ipu6_isys,intel_ipu6_psys
intel_skl_int3472_tps68470    20480  0
v4l2_fwnode            32768  2 intel_ipu6_isys,ov2740
v4l2_async             28672  3 v4l2_fwnode,intel_ipu6_isys,ov2740
intel_skl_int3472_discrete    28672  1
videodev              356352  7 v4l2_async,v4l2_fwnode,videobuf2_v4l2,v4l2loopback,intel_ipu6_isys,ov2740
mc                     90112  6 v4l2_async,videodev,videobuf2_v4l2,intel_ipu6_isys,videobuf2_common,ov2740
led_class              20480  6 snd_hda_codec_generic,videodev,input_leds,iwlmvm,thinkpad_acpi,intel_skl_int3472_discrete
firmware_class         53248  18 btrtl,nxp_nci,snd_hda_intel,intel_ipu6,xhci_pci_renesas,btmtk,snd_sof,drm_display_helper,mei_vsc,intel_ipu6_isys,btintel,btbcm,iwlwifi,btusb,i915,intel_ipu6_psys,cfg80211,drm
root@x1:~|⇒  dmesg | grep -Ei "int3472|ipu"

[    0.010131] ACPI: SSDT 0x000000005C8F4000 000150 (v02 LENOVO IpuSsdt  00001000 INTL 20200717)
[   17.710889] intel-ipu6 0000:00:05.0: enabling device (0000 -> 0002)
[   17.711072] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   17.711086] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   17.711088] intel-ipu6 0000:00:05.0: mapped as: 0x000000005938b216
[   17.711142] intel-ipu6 0000:00:05.0: IPU in secure mode
[   17.711145] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   17.711146] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   17.726862] intel-ipu6 0000:00:05.0: IPC reset done
[   17.726864] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   17.747661] intel-ipu6 0000:00:05.0: FW version: 20220510
[   17.751770] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   17.751786] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   17.751788] intel-ipu6 0000:00:05.0: mapped as: 0x000000009e819bf7
[   17.751833] intel-ipu6 0000:00:05.0: IPU in secure mode
[   17.751835] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   17.751837] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   17.753649] intel-ipu6 0000:00:05.0: IPC reset done
[   17.753650] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   17.773944] intel-ipu6 0000:00:05.0: FW version: 20220510
[   17.775072] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   17.775084] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   17.775085] intel-ipu6 0000:00:05.0: mapped as: 0x0000000091e18f09
[   17.775124] intel-ipu6 0000:00:05.0: IPU in secure mode
[   17.775125] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   17.775125] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   17.777482] intel-ipu6 0000:00:05.0: IPC reset done
[   17.777501] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   17.818685] intel-ipu6 0000:00:05.0: FW version: 20220510
[   17.836064] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   17.836084] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   17.836085] intel-ipu6 0000:00:05.0: mapped as: 0x000000005938b216
[   17.838936] intel-ipu6 0000:00:05.0: IPU in secure mode
[   17.838941] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   17.838943] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   17.840752] intel-ipu6 0000:00:05.0: IPC reset done
[   17.840755] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   17.863402] intel-ipu6 0000:00:05.0: FW version: 20220510
[   17.883434] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   17.883447] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   17.883448] intel-ipu6 0000:00:05.0: mapped as: 0x000000005938b216
[   17.883490] intel-ipu6 0000:00:05.0: IPU in secure mode
[   17.883493] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   17.883494] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   17.885618] intel-ipu6 0000:00:05.0: IPC reset done
[   17.885620] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   17.908546] intel-ipu6 0000:00:05.0: FW version: 20220510
[   17.940267] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   17.940283] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   17.940284] intel-ipu6 0000:00:05.0: mapped as: 0x000000005938b216
[   17.940370] intel-ipu6 0000:00:05.0: IPU in secure mode
[   17.940372] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   17.940373] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   17.943840] intel-ipu6 0000:00:05.0: IPC reset done
[   17.943844] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   17.967126] intel-ipu6 0000:00:05.0: FW version: 20220510
[   17.970583] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   17.970606] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   17.970607] intel-ipu6 0000:00:05.0: mapped as: 0x000000009e819bf7
[   17.970653] intel-ipu6 0000:00:05.0: IPU in secure mode
[   17.970655] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   17.970656] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   17.972479] intel-ipu6 0000:00:05.0: IPC reset done
[   17.972482] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   17.990160] intel-ipu6 0000:00:05.0: FW version: 20220510
[   17.991608] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   17.991624] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   17.991625] intel-ipu6 0000:00:05.0: mapped as: 0x000000005938b216
[   17.991665] intel-ipu6 0000:00:05.0: IPU in secure mode
[   17.991667] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   17.991668] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   17.993490] intel-ipu6 0000:00:05.0: IPC reset done
[   17.993491] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   18.013942] intel-ipu6 0000:00:05.0: FW version: 20220510
[   18.019808] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   18.019822] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   18.019823] intel-ipu6 0000:00:05.0: mapped as: 0x000000005938b216
[   18.019861] intel-ipu6 0000:00:05.0: IPU in secure mode
[   18.019862] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   18.019863] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   18.021694] intel-ipu6 0000:00:05.0: IPC reset done
[   18.021695] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   18.037500] intel-ipu6 0000:00:05.0: FW version: 20220510
[   18.040593] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   18.040614] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   18.040615] intel-ipu6 0000:00:05.0: mapped as: 0x000000005938b216
[   18.040658] intel-ipu6 0000:00:05.0: IPU in secure mode
[   18.040659] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   18.040660] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   18.044490] intel-ipu6 0000:00:05.0: IPC reset done
[   18.044493] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   18.063225] intel-ipu6 0000:00:05.0: FW version: 20220510
[   18.068424] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   18.068446] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   18.068447] intel-ipu6 0000:00:05.0: mapped as: 0x000000005938b216
[   18.068490] intel-ipu6 0000:00:05.0: IPU in secure mode
[   18.068491] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   18.068492] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   18.070598] intel-ipu6 0000:00:05.0: IPC reset done
[   18.070600] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   18.091435] intel-ipu6 0000:00:05.0: FW version: 20220510
[   18.096282] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   18.096301] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   18.096303] intel-ipu6 0000:00:05.0: mapped as: 0x000000009e819bf7
[   18.096337] intel-ipu6 0000:00:05.0: IPU in secure mode
[   18.096339] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   18.096340] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   18.099382] intel-ipu6 0000:00:05.0: IPC reset done
[   18.099384] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   18.121041] intel-ipu6 0000:00:05.0: FW version: 20220510
[   18.128104] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   18.128129] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   18.128130] intel-ipu6 0000:00:05.0: mapped as: 0x000000005938b216
[   18.128181] intel-ipu6 0000:00:05.0: IPU in secure mode
[   18.128182] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   18.128184] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   18.130168] intel-ipu6 0000:00:05.0: IPC reset done
[   18.130170] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   18.150511] intel-ipu6 0000:00:05.0: FW version: 20220510
[   18.160137] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   18.160156] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   18.160157] intel-ipu6 0000:00:05.0: mapped as: 0x000000005938b216
[   18.160195] intel-ipu6 0000:00:05.0: IPU in secure mode
[   18.160196] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   18.160197] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   18.162042] intel-ipu6 0000:00:05.0: IPC reset done
[   18.162044] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   18.176645] intel-ipu6 0000:00:05.0: FW version: 20220510
[   18.178065] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   18.178076] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   18.178077] intel-ipu6 0000:00:05.0: mapped as: 0x000000009e819bf7
[   18.178163] intel-ipu6 0000:00:05.0: IPU in secure mode
[   18.178166] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   18.178168] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   18.179981] intel-ipu6 0000:00:05.0: IPC reset done
[   18.179982] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   18.195902] intel-ipu6 0000:00:05.0: FW version: 20220510
[   18.210880] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x1)
[   18.210895] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   18.210897] intel-ipu6 0000:00:05.0: mapped as: 0x0000000091e18f09
[   18.211031] intel-ipu6 0000:00:05.0: IPU in secure mode
[   18.211032] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   18.211034] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   18.212856] intel-ipu6 0000:00:05.0: IPC reset done
[   18.212857] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   18.229596] intel-ipu6 0000:00:05.0: FW version: 20220510
[   18.230878] intel-ipu6 0000:00:05.0: Found supported sensor INT3474:01
[   18.230958] intel-ipu6 0000:00:05.0: Connected 1 cameras
[   18.232020] intel-ipu6 0000:00:05.0: Sending BOOT_LOAD to CSE
[   18.241158] intel-ipu6 0000:00:05.0: Sending AUTHENTICATE_RUN to CSE
[   18.244586] INT3472:06-clk already disabled
[   18.244687] Modules linked in: snd_soc_acpi_intel_match snd_soc_acpi soundwire_generic_allocation soundwire_bus i915(+) iwlmvm(+) snd_soc_core intel_uncore_frequency intel_uncore_frequency_common intel_tcc_cooling x86_pkg_temp_thermal intel_powerclamp hid_multitouch intel_ipu6_isys(O) coretemp snd_compress ac97_bus crc32_pclmul snd_pcm_dmaengine hid_generic polyval_clmulni mac80211 snd_hda_intel polyval_generic gf128mul drm_buddy snd_intel_dspcfg snd_intel_sdw_acpi iTCO_wdt ttm spi_nor ghash_clmulni_intel intel_pmc_bxt snd_hda_codec btusb drm_display_helper mtd watchdog videobuf2_dma_contig btrtl videobuf2_memops videobuf2_v4l2 think_lmi(+) ptp pmt_telemetry btbcm rapl pps_core mei_pxp mei_hdcp spi_ljca(O) i2c_ljca(O) gpio_ljca(O) pmt_class libarc4 intel_rapl_msr firmware_attributes_class wmi_bmof btintel intel_cstate videobuf2_common cec btmtk thinkpad_acpi intel_uncore intel_ipu6_psys(O) psmouse snd_hda_core drm_kms_helper nvram snd_hwdep bluetooth nxp_nci_i2c snd_pcm nxp_nci intel_gtt ledtrig_audio mei_vsc(O)
[   18.244728]  iwlwifi nci snd_timer platform_profile nls_iso8859_1 agpgart i2c_i801 nfc iosm snd nls_cp437 intel_ish_ipc(+) i2c_algo_bit intel_lpss_pci ecdh_generic intel_ishtp i2c_hid_acpi spi_intel_pci intel_lpss ecc i2c_hid processor_thermal_device_pci vfat video fat cfg80211 mei_me ljca(O) thunderbolt(+) wwan idma64 crc16 intel_ipu6(O) spi_intel i2c_smbus virt_dma soundcore 8250_pci intel_vsec mei thermal rfkill hid processor_thermal_device ov2740(O) ac int3403_thermal soc_button_array battery intel_skl_int3472_tps68470 processor_thermal_rfim v4l2_fwnode tps68470_regulator processor_thermal_mbox tiny_power_button ucsi_acpi v4l2_async clk_tps68470 processor_thermal_rapl typec_ucsi intel_rapl_common typec intel_skl_int3472_discrete int340x_thermal_zone intel_pmc_core acpi_pad fan roles intel_hid int3400_thermal button acpi_thermal_rel wmi pinctrl_tigerlake acpi_tad sparse_keymap evdev mac_hid serio_raw sch_cake ctr v4l2loopback(O) videodev mc loop xt_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 br_netfilter
[   18.244961] INT3472:06-clk already unprepared
[   18.244967] Modules linked in: snd_soc_acpi_intel_match snd_soc_acpi soundwire_generic_allocation soundwire_bus i915(+) iwlmvm(+) snd_soc_core intel_uncore_frequency intel_uncore_frequency_common intel_tcc_cooling x86_pkg_temp_thermal intel_powerclamp hid_multitouch intel_ipu6_isys(O) coretemp snd_compress ac97_bus crc32_pclmul snd_pcm_dmaengine hid_generic polyval_clmulni mac80211 snd_hda_intel polyval_generic gf128mul drm_buddy snd_intel_dspcfg snd_intel_sdw_acpi iTCO_wdt ttm spi_nor ghash_clmulni_intel intel_pmc_bxt snd_hda_codec btusb drm_display_helper mtd watchdog videobuf2_dma_contig btrtl videobuf2_memops videobuf2_v4l2 think_lmi(+) ptp pmt_telemetry btbcm rapl pps_core mei_pxp mei_hdcp spi_ljca(O) i2c_ljca(O) gpio_ljca(O) pmt_class libarc4 intel_rapl_msr firmware_attributes_class wmi_bmof btintel intel_cstate videobuf2_common cec btmtk thinkpad_acpi intel_uncore intel_ipu6_psys(O) psmouse snd_hda_core drm_kms_helper nvram snd_hwdep bluetooth nxp_nci_i2c snd_pcm nxp_nci intel_gtt ledtrig_audio mei_vsc(O)
[   18.244993]  iwlwifi nci snd_timer platform_profile nls_iso8859_1 agpgart i2c_i801 nfc iosm snd nls_cp437 intel_ish_ipc(+) i2c_algo_bit intel_lpss_pci ecdh_generic intel_ishtp i2c_hid_acpi spi_intel_pci intel_lpss ecc i2c_hid processor_thermal_device_pci vfat video fat cfg80211 mei_me ljca(O) thunderbolt(+) wwan idma64 crc16 intel_ipu6(O) spi_intel i2c_smbus virt_dma soundcore 8250_pci intel_vsec mei thermal rfkill hid processor_thermal_device ov2740(O) ac int3403_thermal soc_button_array battery intel_skl_int3472_tps68470 processor_thermal_rfim v4l2_fwnode tps68470_regulator processor_thermal_mbox tiny_power_button ucsi_acpi v4l2_async clk_tps68470 processor_thermal_rapl typec_ucsi intel_rapl_common typec intel_skl_int3472_discrete int340x_thermal_zone intel_pmc_core acpi_pad fan roles intel_hid int3400_thermal button acpi_thermal_rel wmi pinctrl_tigerlake acpi_tad sparse_keymap evdev mac_hid serio_raw sch_cake ctr v4l2loopback(O) videodev mc loop xt_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 br_netfilter
[   18.309425] intel-ipu6 0000:00:05.0: CSE authenticate_run done
[   18.309450] intel-ipu6 0000:00:05.0: IPU6-v3 driver version 1.0
[   18.310477] intel-ipu6-isys intel-ipu6-isys0: bind ov2740 4-0036 nlanes is 2 port is 1
[   18.316160] intel-ipu6-isys intel-ipu6-isys0: All sensor registration completed.
[   18.319179] intel-ipu6-psys intel-ipu6-psys0: pkg_dir entry count:8
[   18.319359] intel-ipu6-psys intel-ipu6-psys0: psys probe minor: 0
[   19.507872] intel-ipu6-isys intel-ipu6-isys0: isys port open ready failed -16
[   19.507893] intel-ipu6-isys intel-ipu6-isys0: Device close failure: -16
[   21.520929] intel-ipu6-isys intel-ipu6-isys0: Device release time out -16
[   21.521048] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521131] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521154] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521208] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521227] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521274] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521293] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521342] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521354] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521401] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521421] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521456] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521486] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521520] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521527] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521565] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521584] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521616] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521623] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521654] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521659] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521689] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521694] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521725] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521732] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521760] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521765] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521795] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521801] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521836] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521841] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521890] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521897] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521929] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521935] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.521969] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.521983] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.522018] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.522056] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[   21.522089] intel-ipu6-isys intel-ipu6-isys0: isys fw com open failed -5
[   21.552915] intel-ipu6-isys intel-ipu6-isys0: Clearing old context
[  125.563362] intel-ipu6-isys intel-ipu6-isys0: Format not found in mapping table.
[  125.590353] intel-ipu6-isys intel-ipu6-isys0: Format not found in mapping table.
[  125.617264] intel-ipu6-isys intel-ipu6-isys0: Format not found in mapping table.
[  125.644247] intel-ipu6-isys intel-ipu6-isys0: Format not found in mapping table.
[  125.671265] intel-ipu6-isys intel-ipu6-isys0: Format not found in mapping table.

The webcam works in Google meet (in Chromium) :tada: , but not Cheese.

andresilva commented 9 months ago

I have updated all ipu6 related packages, the ipu6-camera-bins repo has changed considerably compared to what's currently packaged in nixpkgs. Everything builds but unfortunately my camera doesn't work after these changes. If anyone wants to try it out (and debug) here's all the changes: https://github.com/NixOS/nixpkgs/compare/master...andresilva:nixpkgs:ipu6-updates

I'm using a Thinkpad X1 Carbon Gen 11.

cc @mweinelt

flokli commented 9 months ago

I can confirm this is broken for me as well (X1 Carbon Gen 11 too).

I tried if a reboot helped, but nope. Reverting back to the old nixpkgs checkout (without these patches on top) did bring back the camera though.

struan-robertson commented 8 months ago

Currently broken for me on a Dell XPS 13 Plus (9320). Can select Intel MIPI camera in firefox but has a black screen.

Linux nixlaptop 6.5.6 #1-NixOS SMP PREEMPT_DYNAMIC Fri Oct  6 11:16:31 UTC 2023 x86_64 GNU/Linux
23.05.20231011.bd1cde4 (Stoat)
intel_ipu6_isys       155648  0
videobuf2_dma_contig    24576  1 intel_ipu6_isys
videobuf2_v4l2         36864  1 intel_ipu6_isys
videobuf2_common       77824  4 videobuf2_dma_contig,videobuf2_v4l2,intel_ipu6_isys,videobuf2_memops
intel_ipu6_psys       110592  0
intel_ipu6            118784  2 intel_ipu6_isys,intel_ipu6_psys
intel_skl_int3472_tps68470    20480  0
mfd_core               12288  5 intel_pmc_bxt,ljca,intel_skl_int3472_tps68470,hid_sensor_hub,intel_lpss
regmap_i2c             12288  1 intel_skl_int3472_tps68470
v4l2_fwnode            32768  2 ov01a10,intel_ipu6_isys
v4l2_async             28672  3 v4l2_fwnode,ov01a10,intel_ipu6_isys
intel_skl_int3472_discrete    28672  0
videodev              356352  10 v4l2_async,v4l2_fwnode,videobuf2_v4l2,ov01a10,v4l2loopback,intel_ipu6_isys
mc                     90112  6 v4l2_async,videodev,videobuf2_v4l2,ov01a10,intel_ipu6_isys,videobuf2_common
i2c_core              135168  20 v4l2_async,i2c_designware_platform,videodev,i2c_hid,i2c_designware_core,drm_kms_helper,intel_hid,intel_ipu6,i2c_algo_bit,intel_skl_int3472_tps68470,ov01a10,drm_display_helper,i2c_smbus,i2c_ljca,i2c_i801,i2c_hid_acpi,i915,psmouse,regmap_i2c,drm
led_class              20480  5 videodev,input_leds,iwlmvm,dell_laptop,intel_skl_int3472_discrete
[    0.006253] ACPI: SSDT 0x000000005DB59000 000150 (v02 INTEL  IpuSsdt  00001000 INTL 20200717)
[   13.357695] int3472-discrete INT3472:01: INT3472 seems to have no dependents.
[   13.367961] int3472-discrete INT3472:06: GPIO type 0x02 unknown; the sensor may not work
[   13.412578] intel-ipu6 0000:00:05.0: enabling device (0000 -> 0002)
[   13.412695] intel-ipu6 0000:00:05.0: Device 0xa75d (rev: 0x0)
[   13.412705] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[   13.412706] intel-ipu6 0000:00:05.0: mapped as: 0x00000000e706baa6
[   13.412789] intel-ipu6 0000:00:05.0: Unable to set secure mode
[   13.412791] intel-ipu6 0000:00:05.0: IPU in non-secure mode
[   13.412792] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[   13.412794] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[   13.412804] intel-ipu6 0000:00:05.0: Skip ipc reset for non-secure mode
[   13.412805] intel-ipu6 0000:00:05.0: IPC reset done
[   13.412806] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[   13.413437] intel-ipu6 0000:00:05.0: Direct firmware load for intel/ipu6ep_fw.bin failed with error -2
[   13.413442] intel-ipu6 0000:00:05.0: Requesting signed firmware failed
[   13.414719] intel-ipu6: probe of 0000:00:05.0 failed with error -2
Device (CAM0)
        {
            Name (_HID, "INT3471")  // _HID: Hardware ID
            Name (_DDN, "IMX135-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
--
        Device (CAM1)
        {
            Name (_HID, "INT3474")  // _HID: Hardware ID
            Name (_DDN, "OV2740-CRDG2")  // _DDN: DOS Device Name
            Name (_UID, "0")  // _UID: Unique ID
ChristianHardin commented 8 months ago

Reporting Failure


ChristianHardin commented 8 months ago

Reporting Success


Nothing has changed from my original failure report. Not sure why it has started working.

lennyterra commented 8 months ago

Reporting Failure

imchairmanm commented 8 months ago

Just chiming in to say that this is no longer working for me as of a week or two ago.

Reporting Failure

truatpasteurdotfr commented 7 months ago

Reporting Failure

Intel ACPI Component Architecture ASL+ Optimizing Compiler/Disassembler version 20230628 Copyright (c) 2000 - 2023 Intel Corporation

File appears to be binary: found 192838 non-ASCII characters, disassembling Binary file appears to be a valid ACPI table, disassembling Input file dsdt.dat, Length 0x86E07 (552455) bytes ACPI: DSDT 0x0000000000000000 086E07 (v02 DELL Dell Inc 00000002 01000013) Pass 1 parse of [DSDT] Pass 2 parse of [DSDT] Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)

Parsing completed Disassembly completed ASL Output: dsdt.dsl - 3983142 bytes

iASL Warning: There were 251 external control methods found during disassembly, but only 507 were resolved (4294967040 unresolved). Additional ACPI tables may be required to properly disassemble the code. This resulting disassembler output file may not compile because the disassembler did not know how many arguments to assign to the unresolved methods. Note: SSDTs can be dynamically loaded at runtime and may or may not be available via the host OS.

To specify the tables needed to resolve external control method references, the -e option can be used to specify the filenames. Example iASL invocations: iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml iasl -e ssdt*.aml -d dsdt.aml

In addition, the -fe option can be used to specify a file containing control method external declarations with the associated method argument counts. Each line of the file must be of the form: External (, MethodObj, ) Invocation: iasl -fe refs.txt -d dsdt.aml

- grep -A4 '(CAM' dsdt.dsl
    Device (CAM0) 
    { 
        Name (_HID, "INT3471")  // _HID: Hardware ID 
        Name (_DDN, "IMX135-CRDG2")  // _DDN: DOS Device Name 
        Name (_UID, "0")  // _UID: Unique ID 

-- Device (CAM1) { Name (_HID, "INT3474") // _HID: Hardware ID Name (_DDN, "OV2740-CRDG2") // _DDN: DOS Device Name Name (_UID, "0") // _UID: Unique ID

andresilva commented 7 months ago

For everyone that didn't manage to get their webcam working, you can try with my branch https://github.com/NixOS/nixpkgs/compare/master...andresilva:nixpkgs:ipu6-updates and this script for testing https://gist.github.com/andresilva/b019cedbc1f78f34f3537c9d95869639. The script assumes that you have enabled the nixos ipu6 module. I haven't managed to get v4l2-relayd working, but the script above can work in "webcam mode" which should make it work on Firefox (the only program I tested). Make sure you run the script before start Firefox, otherwise the webcam will not get detected. Also make sure you stop using the webcam in Firefox before stopping the script otherwise it will not be able to remove the virtual device (not that big a problem anyway).

Everything is working now, just test this branch https://github.com/NixOS/nixpkgs/compare/master...andresilva:nixpkgs:ipu6-updates. Will create a PR soon and this should eventually reach the unstable channels.

totoroot commented 6 months ago

@andresilva Thanks for working on this!

If i have a flake-based system with a non-functioning ipu6 configuration

  hardware.ipu6 = {
    enable = false;
    platform = "ipu6ep";
  };

How would I go about using your nixpkgs branch for the module only, so I can test the changes.

I know how to overlay nixpkgs for packages, but how can I do it for a module :thinking:

andresilva commented 6 months ago

@totoroot Unfortunately I don't have any suggestion, I use my own fork of nixpkgs so it's easy to include whatever temporary changes I needed. I expect that PR will be merged soon though, so if you use nixpkgs-unstable you'll probably be able to test it in the not so distant future. 🤞

flokli commented 6 months ago

The PR got merged into staging, you can track its progress here: https://nixpk.gs/pr-tracker.html?pr=268618

nixos-discourse commented 6 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/missing-ivsc-firmware/36724/2

andresilva commented 5 months ago

FWIW nixos-unstable now contains all the latest updates. For people that didn't have a working webcam that might be worth testing.

edit: Seems to be broken for me now after merging into nixos-unstable, not obvious why :((

This is broken for me on linux 6.7, everything works on 6.6. Would be nice if someone can replicate.

samyak-jain commented 5 months ago

I've updated to the latest unstable and still face this issue

Reporting Failure

flokli commented 5 months ago

Same here. The camera gets detected, but no video stream is playing.

I assume there's another regression that sneaked in in the meantime.

~@andresilva does it work for you on current nixos-unstable (612f97239e2cc474c13c9dafa0df378058c5ad8d)?~ ah, I see you mentioned it's regressed with 6.7 kernel, but works with 6.6 on your side.

flokli commented 5 months ago

Alright, I can confirm it's a kernel-side regression (Thinkpad X1 Carbon Gen 11). Works if I manually downgrade to 6.6.13 kernel, but fails on the same system with 6.7.1.

flokli commented 5 months ago

Just stumbled over this, we might not need this stack anymore in the future: https://www.phoronix.com/news/Intel-Webcam-IPU6-2024-State

Seems most of the components are already out, might try to get this running on NixOS over the weekend.

flokli commented 5 months ago

I gave it a try, applied the patches to kernel, libcamera and pipewire.

https://gist.github.com/flokli/4f510cef361c41694b2aa35cc63ac0cd contains the patches to my config repo, which currently uses nixpkgs 612f97239e2cc474c13c9dafa0df378058c5ad8d. Note the pipewire/libcamera override causes a lot of rebuilds.

Unfortunately it doesn't look like it's sufficient yet, as the camera doesn't show up yet. Pointers welcome, otherwise I guess we'll have to wait for the FOSDEM talk ;-)

Edit: I peeked in dmesg and realized I still need to provide firmware. After adding this:

hardware.firmware = [ pkgs.ipu6-camera-bins ];

It looks like the camera gets initialized:

[   18.333767] intel-ipu6 0000:00:05.0: enabling device (0000 -> 0002)
[   18.333952] intel-ipu6 0000:00:05.0: IPU6 in secure mode touch 0x0 mask 0xff
[   18.334459] intel-ipu6 0000:00:05.0: Unexpected CSR 0x0
[   18.334965] intel-ipu6 0000:00:05.0: Unexpected CSR 0x0
[   18.335472] intel-ipu6 0000:00:05.0: Unexpected CSR 0x0
[   18.335984] intel-ipu6 0000:00:05.0: Unexpected CSR 0x0
[   18.336491] intel-ipu6 0000:00:05.0: Unexpected CSR 0x0
[   18.337000] intel-ipu6 0000:00:05.0: Unexpected CSR 0x0
[   18.337746] intel-ipu6 0000:00:05.0: Unexpected CSR 0x0
[   18.338513] intel-ipu6 0000:00:05.0: Unexpected CSR 0x0
[   18.339277] intel-ipu6 0000:00:05.0: Unexpected CSR 0x0
[   18.339858] intel-ipu6 0000:00:05.0: Unexpected CSR 0x0
[   18.370736] intel-ipu6 0000:00:05.0: FW version: 20230102
[   18.376797] intel-ipu6 0000:00:05.0: Found supported sensor INT3474:01
[   18.376845] intel-ipu6 0000:00:05.0: Connected 1 cameras
[   18.379155] intel-ipu6 0000:00:05.0: Sending BOOT_LOAD to CSE
[   18.395226] intel-ipu6 0000:00:05.0: Sending AUTHENTICATE_RUN to CSE
[   18.467525] intel-ipu6 0000:00:05.0: CSE authenticate_run done
[   18.467531] intel-ipu6 0000:00:05.0: IPU6-v3[a75d] hardware version 5

pw-cli list-objects also lists a bunch of nodes:

[snip]

I'm not able to see any video stream though. snapshot complains about a missing portal, and it's not visible in the browser yet.

pw-v4l2 obs-studio shows a bunch of ipu6 capture devices too.

flokli commented 5 months ago

After some debugging, and thanks to some help from Hans de Goede and @puckipedia, I managed to get this working!

I cleaned up my patches and made an easy-to-include NixOS config snippet that people can

git clone https://code.tvl.fyi/depot.git:/users/flokli/ipu6-softisp.git

or

niv add git --repo 'https://code.tvl.fyi/depot.git:/users/flokli/ipu6-softisp.git' -n ipu6-softisp

It also includes a README, which is also accessible at https://code.tvl.fyi/about/users/flokli/ipu6-softisp .

andresilva commented 5 months ago

@flokli I haven't tested this yet, but this is great! Did you manage to get the camera working on Firefox? I think you might need to enable media.webrtc.camera.allow-pipewire in about:config. I'm asking because on my desktop I couldn't get it to work.

flokli commented 5 months ago

Yes, I got this to work with firefox 122, after enabling that option, as described in https://copr.fedorainfracloud.org/coprs/jwrdegoede/ipu6-softisp/.

Chrom{e,ium} still seems to be blocked on https://chromium-review.googlesource.com/c/chromium/src/+/3308882.

Michael Olbrich last years' FOSDEM talk gives some more context on the situation there.

totoroot commented 5 months ago

I tried using the patches @flokli shared (thanks for that! :tada:), but am getting the following error:

       error: The option `services.pipewire.package' is defined multiple times while it's expected to be unique.

       Definition values:
       - In `/nix/store/922mdha01rihw0c3y7wlvd7dc8dblqqb-source/modules/hardware/ipu6-softisp/config.nix': <derivation pipewire-1.0.0>
       - In `/nix/store/922mdha01rihw0c3y7wlvd7dc8dblqqb-source': <derivation pipewire-1.0.0>
       Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.

However, while I did enable services.pipewire in my config, I did not explicitely set a value for services.pipewire.package. The error is not very helpful, since I certainly did not define it on top-level of my config. Forcing the patched package with lib.mkForce does not work either. Any pointers which module might have set it? :thinking:

flokli commented 5 months ago

Forcing the patched package with lib.mkForce does not work either

What does that mean? The changes don't apply, or you're still getting the error?

I don't see anything in nixpkgs setting it that package option directly.

mweinelt commented 5 months ago

Seems like we're finally getting an open source stack.

From https://hansdegoede.livejournal.com/27909.html:

Also, the firmware recently landed in linux-firmware: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/?id=1b24d7d3379b5dde99fcb17e796cdd5fe0a668bd

flokli commented 5 months ago

@mweinelt yes, https://github.com/NixOS/nixpkgs/issues/225743#issuecomment-1916499267 contains the necessary config to test exactly this stack on NixOS today.

thyol commented 4 months ago

Reporting Success

Andreas02-dev commented 4 months ago

Reporting Success

* Device: Lenovo X1 Carbon Gen 11 21HMCTO1WW

* `Linux 6.7.5 #1-NixOS SMP PREEMPT_DYNAMIC Fri Feb 16 18:14:32 UTC 2024 x86_64 GNU/Linux`

* `24.05pre586498.0e74ca98a74b (Uakari)`

  * With [Tracking Issue: Intel MIPI/IPU6 webcam-support #225743 (comment)](https://github.com/NixOS/nixpkgs/issues/225743#issuecomment-1916499267)

Does this still work on 6.7.6 for you? I'm getting the following error when trying to build this for my XPS 13 Plus:

unpacking source archive /nix/store/95fzc7ihq77ppi9hpsxwyqwysw0hm51l-libcamera
source root is libcamera
Running phase: patchPhase
applying patch /nix/store/2v8fxcpim2njaxpxjwbwxgc5ms2yv36w-libcamera-sphinx7.0-compat.patch
patching file Documentation/theme/layout.html
applying patch /nix/store/laa26azykh3w2kf47d2zik89sjyg5y4a-0001-libcamera-pipeline-simple-fix-size-adjustment-in-val.patch
patching file src/libcamera/pipeline/simple/simple.cpp
Hunk #1 succeeded at 995 (offset -2 lines).
applying patch /nix/store/sim113ba9gz78a3j66p0sbjmjm4xgby6-0002-libcamera-internal-Move-dma_heaps.-h-cpp-to-common-d.patch
Cannot rename file without two valid file names
2 out of 2 hunks ignored
patching file include/libcamera/internal/meson.build
Hunk #1 succeeded at 24 (offset -1 lines).
Cannot rename file without two valid file names
8 out of 8 hunks ignored
patching file src/libcamera/meson.build
can't find file to patch at input line 157
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/libcamera/pipeline/rpi/vc4/meson.build b/src/libcamera/pipeline/rpi/vc4/meson.build
|index cdb049c5..386e2296 100644
|--- a/src/libcamera/pipeline/rpi/vc4/meson.build
|+++ b/src/libcamera/pipeline/rpi/vc4/meson.build
--------------------------
File to patch: 
Skip this patch? [y] 
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 169
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
|index 26102ea7..3a42e75e 100644
|--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp
|+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
--------------------------
File to patch: 
Skip this patch? [y] 
Skipping patch.
2 out of 2 hunks ignored
error: builder for '/nix/store/f9bm0922lzqvhwzdrilflrd0g5q6lsd8-libcamera-0.0.5.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/jfavaskk7qbghlkh9pf3r8dq8m4ky6rn-pipewire-1.0.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hsii54znqhkigc16ma40kqsnm7bkriyw-etc.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-linux-config-6.7.6.drv-3/linux-6.7.6/arch': Directory not empty
error: 1 dependencies of derivation '/nix/store/6cpxb2v3dwnx12ngk6j2b81n8wsgcfrm-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/1hsd1wfia1p1l2nr0qilsjmb4k8j8nxq-nixos-system-xps-23.11.4801.b7ee09cf5614.drv' failed to build
haraldh commented 4 months ago

Reporting Success

With https://github.com/NixOS/nixpkgs/issues/225743#issuecomment-1916499267

❯ cat /sys/class/dmi/id/product_sku 
LENOVO_MT_21HM_BU_Think_FM_ThinkPad X1 Carbon Gen 11
❯ cat /sys/class/dmi/id/product_name 
21HMCTO1WW
❯ uname -a
Linux x1 6.7.7 #1-NixOS SMP PREEMPT_DYNAMIC Fri Mar  1 12:42:00 UTC 2024 x86_64 GNU/Linux
❯ nixos-version 
23.11.20240304.617579a (Tapir)

Integrated @flokli 's solution in my flake config. Thanks!

Edit: removed it again after a kernel lockup (also video quality not worth it)

andresilva commented 4 months ago

Does this still work on 6.7.6 for you? I'm getting the following error when trying to build this for my XPS 13 Plus:

No, it's broken on 6.7. There's a PR open to ipu6-drivers that fixes it (https://github.com/intel/ipu6-drivers/pull/213), but I haven't tested yet.

tobiasBora commented 3 months ago

Reporting success with some changes

let ivsc-firmware = with pkgs; stdenv.mkDerivation rec { pname = "ivsc-firmware"; version = "main";

  src = pkgs.fetchFromGitHub {
    owner = "intel";
    repo = "ivsc-firmware";
    rev = "10c214fea5560060d387fbd2fb8a1af329cb6232";
    sha256 = "sha256-kEoA0yeGXuuB+jlMIhNm+SBljH+Ru7zt3PzGb+EPBPw=";

  };

  installPhase = ''
    mkdir -p $out/lib/firmware/vsc/soc_a1_prod

    cp firmware/ivsc_pkg_ovti01a0_0.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_pkg_ovti01a0_0_a1_prod.bin
    cp firmware/ivsc_skucfg_ovti01a0_0_1.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_skucfg_ovti01a0_0_1_a1_prod.bin
    cp firmware/ivsc_fw.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_fw_a1_prod.bin
  '';
};

in {

Load also non-free firmwares in the kernel

hardware.enableRedistributableFirmware = lib.mkDefault true;

for sake of ipu6-camera-bins

nixpkgs.config.allowUnfree = true;

environment.systemPackages = with pkgs; [

https://discourse.nixos.org/t/v4l2loopback-cannot-find-module/26301/5

v4l-utils

];

boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "usbhid" "sd_mod" "i915" ]; boot.initrd.kernelModules = []; boot.kernelModules = [ "kvm-intel" ];

boot.extraModulePackages = [];

https://discourse.nixos.org/t/i915-driver-has-bug-for-iris-xe-graphics/25006/10

resolved: i915 0000:00:02.0: [drm] Selective fetch area calculation failed in pipe A

boot.kernelParams = [ "i915.enable_psr=0" ];

hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

Tracking Issue: Intel MIPI/IPU6 webcam-support

https://github.com/NixOS/nixpkgs/issues/225743#issuecomment-1849613797

Infrastructure Processing Unit

hardware.ipu6 = { enable = true; platform = "ipu6ep"; };

hardware.firmware = [ ivsc-firmware ];

environment.etc.camera.source = "${ipu6-camera-hal}/share/defaults/etc/camera";

}



Works with:
- firefox
- chrome
- zoom-us
- obs_studio

Fails with:
- cheese => This is a cheese bug reported upstream
tobiasBora commented 3 months ago

Just, with the configuration that I just copy/pasted, I get two cameras (and some others, but they only appear in obs, so not so much an issue), the main Intel MIPI, but also a "Dummy video device":

image

Do you know how to get rid of it? The software takes by default the dummy one, which fails.

EDIT: solution here https://discourse.nixos.org/t/how-to-hide-this-dummy-video-device/40985/4, giving now:

{ config, inputs, lib, pkgs, modulesPath, ... }:

let
  ivsc-firmware = with pkgs;
    stdenv.mkDerivation rec {
      pname = "ivsc-firmware";
      version = "main";

      src = pkgs.fetchFromGitHub {
        owner = "intel";
        repo = "ivsc-firmware";
        rev = "10c214fea5560060d387fbd2fb8a1af329cb6232";
        sha256 = "sha256-kEoA0yeGXuuB+jlMIhNm+SBljH+Ru7zt3PzGb+EPBPw=";

      };

      installPhase = ''
        mkdir -p $out/lib/firmware/vsc/soc_a1_prod

        cp firmware/ivsc_pkg_ovti01a0_0.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_pkg_ovti01a0_0_a1_prod.bin
        cp firmware/ivsc_skucfg_ovti01a0_0_1.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_skucfg_ovti01a0_0_1_a1_prod.bin
        cp firmware/ivsc_fw.bin $out/lib/firmware/vsc/soc_a1_prod/ivsc_fw_a1_prod.bin
      '';
    };
in
{
  # Load also non-free firmwares in the kernel
  hardware.enableRedistributableFirmware = lib.mkDefault true;
  sound.enable = true; # This starts alsactl store, this is needed not to run alsactl init everytime we reboot (otherwise we do not have a working microphone)pipewire
  # for sake of ipu6-camera-bins
  nixpkgs.config.allowUnfree = true;

  environment.systemPackages = with pkgs; [
    # https://discourse.nixos.org/t/v4l2loopback-cannot-find-module/26301/5
    v4l-utils
  ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "usbhid" "sd_mod" "i915" ];
  boot.initrd.kernelModules = [];
  boot.kernelModules = [ "kvm-intel" ];

  boot.extraModulePackages = [];

  # https://discourse.nixos.org/t/i915-driver-has-bug-for-iris-xe-graphics/25006/10
  # resolved: i915 0000:00:02.0: [drm] Selective fetch area calculation failed in pipe A
  boot.kernelParams = [
    "i915.enable_psr=0"
  ];

  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
  boot.extraModprobeConfig = "options v4l2loopback nr_devices=0";
  # Tracking Issue: Intel MIPI/IPU6 webcam-support
  # https://github.com/NixOS/nixpkgs/issues/225743#issuecomment-1849613797
  # Infrastructure Processing Unit
  hardware.ipu6 = {
    enable = true;
    platform = "ipu6ep";
  };

  hardware.firmware = [
    ivsc-firmware
  ];

  # These rules must be understood like a script executed sequentially for
  # all devices. Instead of creating conditions, they use the old fashion
  # goto mechanism to skip some rules tu apply using goto and label
  # The first parts of each line is like a conditiong and the second part
  # describes what to run in that case.
  # To see the properties of a device, just run something like
  # udevadm info -q all -a /dev/video9
  services.udev.extraRules = ''
    SUBSYSTEM!="video4linux", GOTO="hide_cam_end"
    #ATTR{name}=="Intel MIPI Camera", GOTO="hide_cam_end"
    ATTR{name}!="Dummy video device (0x0000)", GOTO="hide_cam_end"
    ACTION=="add", RUN+="${pkgs.coreutils}/bin/mkdir -p /dev/not-for-user"
    ACTION=="add", RUN+="${pkgs.coreutils}/bin/mv -f $env{DEVNAME} /dev/not-for-user/"
    # Since we skip these rules for the mipi, we do not need to link it back to /dev
    # ACTION=="add", ATTR{name}!="Intel MIPI Camera", RUN+="${pkgs.coreutils}/bin/ln -fs $name /dev/not-for-user/$env{ID_SERIAL}"

    ACTION=="remove", RUN+="${pkgs.coreutils}/bin/rm -f /dev/not-for-user/$name"
    ACTION=="remove", RUN+="${pkgs.coreutils}/bin/rm -f /dev/not-for-user/$env{ID_SERIAL}"

    LABEL="hide_cam_end"
  '';

  # environment.etc.camera.source = "${ipu6-camera-hal}/share/defaults/etc/camera";

}
nixos-discourse commented 3 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-hide-this-dummy-video-device/40985/1

ChocolateLoverRaj commented 3 months ago

reporting failure

Device: HP Elite Dragonfly Chromebook (code name is Redrix) Linux nixos 6.6.23 #1-NixOS SMP PREEMPT_DYNAMIC Tue Mar 26 22:22:53 UTC 2024 x86_64 GNU/Linux NixOS: 24.05pre604424.d8fe5e6c92d0 (Uakari) lsmod | grep -Ei "int3472|ipu":

intel_ipu6_isys       167936  0
videobuf2_dma_contig    28672  1 intel_ipu6_isys
videobuf2_v4l2         40960  1 intel_ipu6_isys
videobuf2_common       94208  4 videobuf2_dma_contig,videobuf2_v4l2,intel_ipu6_isys,videobuf2_memops
intel_ipu6_psys       126976  0
intel_ipu6            143360  2 intel_ipu6_isys,intel_ipu6_psys
v4l2_fwnode            32768  2 hi556,intel_ipu6_isys
v4l2_async             32768  3 v4l2_fwnode,hi556,intel_ipu6_isys
videodev              393216  7 v4l2_async,v4l2_fwnode,hi556,videobuf2_v4l2,v4l2loopback,intel_ipu6_isys
mc                     90112  6 v4l2_async,videodev,hi556,videobuf2_v4l2,intel_ipu6_isys,videobuf2_common
firmware_class         57344  16 btrtl,snd_hda_intel,intel_ipu6,xhci_pci_renesas,btmtk,snd_sof,drm_display_helper,intel_ipu6_isys,btintel,btbcm,iwlwifi,btusb,snd_soc_max98390,i915,intel_ipu6_psys,cfg80211

dmesg | grep -Ei "int3472|ipu":

[    2.904231] intel-ipu6 0000:00:05.0: Device 0x465d (rev: 0x4)
[    2.904252] intel-ipu6 0000:00:05.0: physical base address 0x82000000
[    2.904253] intel-ipu6 0000:00:05.0: mapped as: 0x000000003f921636
[    2.904366] intel-ipu6 0000:00:05.0: IPU in secure mode
[    2.904369] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[    2.904371] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[    2.921342] intel-ipu6 0000:00:05.0: IPC reset done
[    2.921346] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[    2.942131] intel-ipu6 0000:00:05.0: FW version: 20230102
[    2.948323] intel-ipu6 0000:00:05.0: Sending BOOT_LOAD to CSE
[    2.961038] intel-ipu6 0000:00:05.0: Sending AUTHENTICATE_RUN to CSE
[    3.028683] intel-ipu6 0000:00:05.0: CSE authenticate_run done
[    3.028715] intel-ipu6 0000:00:05.0: IPU6-v3 driver version 1.0
[    3.273904] intel-ipu6-psys intel-ipu6-psys0: pkg_dir entry count:8
[    3.274031] intel-ipu6-psys intel-ipu6-psys0: psys probe minor: 0
[    3.363412] intel-ipu6-isys intel-ipu6-isys0: bind hi556 2-0020 nlanes is 2 port is 2
[    3.363711] intel-ipu6-isys intel-ipu6-isys0: All sensor registration completed.

Notes: Intel MIPI Camera shows up as a camera in /dev/video9. A black rectangle with 0FPS shows up if I try to use it. My camera works when using the open source ipu6 webcam on Fedora.