Skip to content

[SP9] I MADE THE CAMERA WORK #1865

Open

Description

@toorajtaraz

Hey!

I hope everyone's having a good day. After hours of tinkering I got the camera on my surface pro 9 working!

Image
| lsmod | grep ipu
intel_ipu6_psys       131072  0
intel_ipu6_isys       155648  0
videobuf2_dma_sg       24576  1 intel_ipu6_isys
videobuf2_v4l2         40960  1 intel_ipu6_isys
videobuf2_common      102400  4 videobuf2_v4l2,intel_ipu6_isys,videobuf2_dma_sg,videobuf2_memops
intel_ipu6             94208  2 intel_ipu6_isys,intel_ipu6_psys
v4l2_fwnode            40960  4 ov5693,intel_ipu6_isys,ov13858
ipu_bridge             24576  2 intel_ipu6,intel_ipu6_isys
v4l2_async             32768  4 v4l2_fwnode,ov5693,intel_ipu6_isys,ov13858
videodev              421888  8 v4l2_async,v4l2_fwnode,videobuf2_v4l2,ov5693,v4l2loopback,intel_ipu6_isys,ov13858
mc                     94208  7 v4l2_async,videodev,videobuf2_v4l2,ov5693,intel_ipu6_isys,ov13858,videobuf2_common
| uname -r
6.16.9-1.surface.fc42.x86_64

Modified files:

  1. ipu-bridge.c - Added OVTI5693 and OVTID858 sensor configs
  2. discrete.c - Added GPIO type 0x08 and 0x10 mappings
  3. ov5693.c - Added OVTI5693 ACPI ID

I'm not too familiar with the process of contributing it to this project as patches. I would appreciate any help in that regard!

@qzed please let me know whatever information you might need and I will provide them in the first chance I get!

Activity

  1. Ferenc- commented on Oct 10, 2025

    @Ferenc-

    Wow, hats off!

    I'm not too familiar with the process of contributing it to this project as patches. I would appreciate any help in that regard!

    I think the best way to start would be to open a PR, and even if you can only post a patch here, then many would gladly take a look.

  2. toorajtaraz commented on Oct 10, 2025

    @toorajtaraz
    ContributorAuthor

    Now the rear camera is also working. I might look into the IR later if I have the time!

    Image
  3. qzed commented on Oct 10, 2025

    @qzed
    Member

    @toorajtaraz Nice work!

    I'm not too familiar with the process of contributing it to this project as patches. I would appreciate any help in that regard!

    Can you open a PR with those changes at https://github.com/linux-surface/kernel? Ideally you should also submit them upstream to the kernel mailing lists (if you do that I can also pull the patches in from there if you send me the lkml link or CC me).

  4. qzed commented on Oct 10, 2025

    @qzed
    Member

    @djrscally maybe this is interesting for you as well.

  5. petm5 commented on Oct 10, 2025

    @petm5

    @toorajtaraz May I ask how you figured out handling the GPIO mappings? The only public documentation I can find is the kernel sourve itself.

  6. toorajtaraz commented on Oct 10, 2025

    @toorajtaraz
    ContributorAuthor

    @toorajtaraz Nice work!

    I'm not too familiar with the process of contributing it to this project as patches. I would appreciate any help in that regard!

    Can you open a PR with those changes at https://github.com/linux-surface/kernel? Ideally you should also submit them upstream to the kernel mailing lists (if you do that I can also pull the patches in from there if you send me the lkml link or CC me).

    Thanks!

    Will open a PR soon. I need to clean up the code I have and write up a documentation about its quirks!

  7. toorajtaraz commented on Oct 10, 2025

    @toorajtaraz
    ContributorAuthor

    @toorajtaraz May I ask how you figured out handling the GPIO mappings? The only public documentation I can find is the kernel sourve itself.

    I went with educated guesses. Looking at all OV drivers I won't believe any of them are written by hand. The ov5693.c and ov13858.c that I looked at were mostly boilerplate code.

    I assumed that regulators need to be turned on, reset and the clock set. I played around with them and added random delays here and there until it worked. As for ov5693, it was mostly complete. Very minor changes were required.

    Finally the intel_skl_int3472_discrete would just fail upon seeing GPIO types it didn't recognize. This just seemed super weird to me. The essential pins were already recognized, avdd, vdd, clock and more. So I figured maybe I should just skip over them. The front camera had all of its pins properly assigned and recognized but 0x10 for what I'm guessing is the IR and 0x08 for the rear camera was unknown. Currently I'm treating 0x08 as an extra regulator pin. Seems to be working but I'm not 100 percent sure. I will experiment more with it.

    Also it's worth mentioning that I dumped and decompiled the acpi tables. That was very helpful!

    I'll try to document exactly what I did so that others can improve upon it and complete what is left!

  8. toorajtaraz commented on Oct 11, 2025

    @toorajtaraz
    ContributorAuthor

    Here is my PR with the patch if anyone is interested!

    @petm5 I hope you can successfully get it working! It's good enough for zoom meetings, which is all I need it for. :D

  9. petm5 commented on Oct 14, 2025

    @petm5

    @toorajtaraz Thank you for your PR! It really helped me create my own patchset, which you can find here: petm5/linux@6.16.9...petm5:linux:sp9-camera-enablement

    The front and back cameras initialize reliably in qcam, but there are still a few issues:

    • Both cameras are flipped upside down
    • The image is super noisy and washed out
    • The back camera appears to be stuck focused at infinity (probably needs a lens driver)

    As for the IR camera: Its model is listed as VD55G0 in the wiki, and the DSDT lists its hardware ID as SMO55F0. This sensor is not supported by the kernel, so it looks like we'll have to write a driver from scratch.

  10. djrscally commented on Oct 14, 2025

    @djrscally

    Oh good job @toorajtaraz! I missed this a few days ago, but I'll take a look at the PR tomorrow. Congratulations :)

  11. toorajtaraz commented on Oct 14, 2025

    @toorajtaraz
    ContributorAuthor

    @toorajtaraz Thank you for your PR! It really helped me create my own patchset, which you can find here: petm5/[email protected]:linux:sp9-camera-enablement

    The front and back cameras initialize reliably in qcam, but there are still a few issues:

    * Both cameras are flipped upside down
    
    * The image is super noisy and washed out
    
    * The back camera appears to be stuck focused at infinity (probably needs a lens driver)
    

    As for the IR camera: Its model is listed as VD55G0 in the wiki, and the DSDT lists its hardware ID as SMO55F0. This sensor is not supported by the kernel, so it looks like we'll have to write a driver from scratch.

    @petm5 I'm glad you got it working!

    Regarding the IR camera I came to the same conclusion!

  12. toorajtaraz commented on Oct 14, 2025

    @toorajtaraz
    ContributorAuthor

    Oh good job @toorajtaraz! I missed this a few days ago, but I'll take a look at the PR tomorrow. Congratulations :)

    @djrscally Perfect! I look forward to hearing your thoughts!

  13. derkrasseleo commented on Oct 15, 2025

    @derkrasseleo

    Is there a way to test this on fedora?

  14. petm5 commented on Oct 15, 2025

    @petm5

    I just got the lens driver to work, but libcamera doesn't seem to have an autofocus algorithm for ipu6 yet. Raw lens focus values can be set via v4l2-ctl.

    The ACPI tables on my SP9 report that the cameras are mounted normally, not upside down. A driver quirk is probably needed to fix the camera orientation for specific hardware IDs.

  15. djrscally commented on Oct 16, 2025

    @djrscally

    I just got the lens driver to work, but libcamera doesn't seem to have an autofocus algorithm for ipu6 yet. Raw lens focus values can be set via v4l2-ctl.

    The ACPI tables on my SP9 report that the cameras are mounted normally, not upside down. A driver quirk is probably needed to fix the camera orientation for specific hardware IDs.

    The rotation is annoying, as the ipu-bridge.c code should solve it by checking the SSDB buffer in ACPI for a field describing the camera's orientation and then building the necessary firmware properties for v4l2 to automatically detect and correct it. That that's not happening suggests that the SSDB buffer is different -_-

  16. pythonpoet commented on Nov 1, 2025

    @pythonpoet

    I got it working for a short moment on a Surface Pro 8. but now ov5693 (camera sensor) has no power anymore!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions