Skip to content

media: qcom: camss: add Qualcomm SC8180X (Titan 175) camera subsystem & MIPI CSI-2 PHY support - #206

Open
robertijtsma wants to merge 5 commits into
linux-surface:spx/v7.3from
robertijtsma:spx-media-qcom-camss-sc8180x
Open

robertijtsma wants to merge 5 commits into
linux-surface:spx/v7.3from
robertijtsma:spx-media-qcom-camss-sc8180x

Conversation

@robertijtsma

Copy link
Copy Markdown

Summary

Bring up the Qualcomm SC8180X / Titan 175 camera subsystem (qcom-camss + phy-qcom-mipi-csi2) for Microsoft Surface Pro X (SQ1 / SQ2) on spx/v7.3, split into five atomic, reviewable commits without disturbing any existing Qualcomm SoC definitions:

  1. phy: qualcomm: add MIPI CSI-2 D-PHY driver for SM8150/SC8180X
    • Standalone phy-qcom-mipi-csi2 generic PHY driver based on Linaro's upstream RFC driver (Bryan O'Donoghue), matching qcom,sc8180x-csi2-phy / qcom,sm8150-csi2-phy / qcom,x1e80100-csi2-phy, with SC8180X fixes for single-domain genpd detachment (-EEXIST), core clock fallback, unpopulated port probing, and warm restart safety.
  2. media: qcom: camss: support external generic PHY subdevices for CSIPHY
    • Adds external generic PHY routing (legacy_phy = false) alongside msm_csiphy_subdev_init_legacy() so all existing built-in CSIPHY SoCs remain completely unchanged.
  3. media: qcom: camss: fix Titan 17x VFE/VFE-Lite IRQ, WM FIFO, and CSID gen2 RDI
    • Fixes STATUS_1_RDI_SOF(i) being checked against status0 instead of status1.
    • Protects VFE-Lite (!vfe_is_lite() guard on VFE_BUS_WM_DEBUG_STATUS_CFG, valid Lite reset bitmask, 4-client WM_ADDR_NO_SYNC_LITE_VAL, numbered vfe_liteN clock matching).
    • Correctly manages the Titan 17x 2-deep VFE_BUS_WM_IMAGE_ADDR FIFO via vfe_buf_done() with a coherent dummy DMA fallback on total underrun and single WM_CLIENT_BUF_DONE IRQ subscription (eliminating double completions and 1-frame shift bugs).
    • Keeps VFE_CORE_CFG = 0 for local SOF latching, implements vfe_halt(), requests VFE IRQs with IRQF_NO_AUTOEN, moves vb2_buffer_done() outside output_lock in vfe_flush_buffers(), and destroys VFE mutexes after entity teardown.
    • Adds unpacked 16-bit plain LSB RAW10 CSID gen2 RDI formats (Y10_2X8_PADHI_LE, SBGGR10_2X8_PADHI_LE), csid_reset_retain_sw_reg(), proper RDI_CFG0_ENABLE clearing on stream stop, and parent_dev_ops error unwind.
  4. media: qcom: camss: add Qualcomm SC8180X / SM8150 (Titan 175) support
    • Adds CAMSS_8150 (qcom,sc8180x-camss, qcom,sm8150-camss) resource tables (CSIPHY0–3, CSID0–1 + CSID_LITE0–1, VFE0–1 + VFE_LITE0–1, CAMNOC interconnects, 400 MHz vfe*_cphy_rx, camnoc_dcd_xo, vfe0/1_dsp) and CAMSS_8150-scoped NoC-safe power/clock retention and warm vfe_reset().
  5. media: qcom: camss: add optional privacy LED GPIOs, pipeline rollback, and RDI format clamping
    • Refcounted optional DT privacy-led-front-gpios / privacy-led-rear-gpios synchronized with CSIPHY streaming.
    • Downstream s_stream(1) rollback in video_start_streaming() + full sink-to-source teardown in video_stop_streaming().
    • Non-line-based RDI format clamping in __video_try_fmt() so generic V4L2 clients (e.g., OpenCV / Howdy on OV7251 Y10) negotiate VIDIOC_S_FMT cleanly.

Verification

  • phy-qcom-mipi-csi2.ko compiled cleanly with W=1 against Linux 7.3.1-1-surface (0 errors, 0 warnings).
  • qcom-camss.ko compiled cleanly at every intermediate commit and final HEAD against Linux 7.3.1-1-surface (0 errors, 0 warnings).
  • ./scripts/checkpatch.pl --no-tree run on all 5 commits: 0 errors, 0 code style warnings (only the expected MAINTAINERS advisory for the new PHY driver files).
  • Live-tested on Microsoft Surface Pro X SQ2 (SC8180X) streaming all 3 onboard cameras:
    • Front 5 MP RGB (OV5693, CSIPHY0 → CSID0 → VFE0 RDI0) via libcamera + PipeWire
    • Rear 13 MP RGB (OV13858, CSIPHY2 → CSID1 → VFE1 RDI0) via libcamera + PipeWire
    • Front VGA IR (OV7251, CSIPHY3 → CSID_LITE1 → VFE_LITE1 RDI0) via OpenCV / Howdy
    • Front & rear hardware privacy LEDs verified synchronized with stream start/stop.

Add the standalone Qualcomm MIPI CSI-2 D-PHY generic PHY driver based on
Linaro's upstream RFC driver (Bryan O'Donoghue <bod@kernel.org>), with
SC8180X / SM8150 bring-up fixes verified on Microsoft Surface Pro X SQ2:

- Match qcom,sc8180x-csi2-phy alongside qcom,sm8150-csi2-phy and
  qcom,x1e80100-csi2-phy.
- Detach the auto-attached single power domain before calling
  devm_pm_domain_attach_list() to avoid -EEXIST on single-domain SoCs.
- Fall back to direct core clock rate setting when an OPP table ceiling
  is unavailable, and allow unpopulated CSIPHY ports to probe passively.
- Keep the PHY powered across stream restarts and reconfigure/reset
  lanes cleanly without disturbing TITAN_TOP_GDSC.

Tested on Microsoft Surface Pro X SQ2 (SC8180X) with OV5693 (CSIPHY0),
OV13858 (CSIPHY2), and OV7251 IR (CSIPHY3).

Signed-off-by: robertijtsma <37256770+robertijtsma@users.noreply.github.com>
Allow CAMSS platforms whose DT port endpoints connect to standalone
generic PHY nodes (such as phy-qcom-mipi-csi2) to configure and power
CSIPHY through the Linux generic PHY API while preserving the existing
built-in CSIPHY implementation unchanged for all legacy platforms.

Based on Linaro's upstream RFC CAMSS external-PHY architecture, adapted
cleanly onto v7.3 without modifying any existing SoC definitions.

Signed-off-by: robertijtsma <37256770+robertijtsma@users.noreply.github.com>
… gen2 RDI

Fix several hardware bring-up and stability bugs in the Titan 17x VFE
and CSID gen2 paths:

- VFE-17x / VFE-Lite:
  * Check STATUS_1_RDI_SOF(i) against status1 instead of status0.
  * Guard VFE_BUS_WM_DEBUG_STATUS_CFG (0x226c) behind !vfe_is_lite(),
    restrict VFE-Lite global reset bits to valid blocks, and use the
    4-client WM_ADDR_NO_SYNC_LITE_VAL mask on VFE-Lite.
  * Manage the 2-deep VFE_BUS_WM_IMAGE_ADDR hardware FIFO cleanly via
    vfe_buf_done(), with a coherent dummy DMA buffer fallback on total
    underrun and single WM_CLIENT_BUF_DONE IRQ subscription (avoiding
    double completions and 1-frame shifts).
  * Keep VFE_CORE_CFG = 0 for local SOF latching, implement vfe_halt()
    IRQ masking/clearing, request VFE IRQs with IRQF_NO_AUTOEN, and
    match numbered vfe_liteN clocks in vfe_match_clock_names().
  * Invoke vb2_buffer_done() outside output_lock in vfe_flush_buffers()
    and destroy VFE mutexes after unregistering subdev/video entities.
- CSID gen2:
  * Support unpacked 16-bit plain LSB RAW10 formats
    (MEDIA_BUS_FMT_Y10_2X8_PADHI_LE and
    MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE).
  * Clear BIT(RDI_CFG0_ENABLE) when stopping a stream, add
    csid_reset_retain_sw_reg() before resuming RDI, and invoke
    configure_stream(csid, 0) on stream stop.
  * Release parent_dev_ops on csid_set_power() failure paths.

Tested on Microsoft Surface Pro X SQ2 (SC8180X, Titan 175) with live
OV5693 (5 MP), OV13858 (13 MP), and OV7251 (IR) streams.

Signed-off-by: robertijtsma <37256770+robertijtsma@users.noreply.github.com>
Add Qualcomm SC8180X / SM8150 (Titan 175) CAMSS resource tables and
compatible strings (qcom,sc8180x-camss, qcom,sm8150-camss) covering
CSIPHY0-3 (via external phy-qcom-mipi-csi2), CSID0-1 + CSID_LITE0-1,
VFE0-1 + VFE_LITE0-1, and CAMNOC interconnects:

- Explicit 400 MHz vfe*_cphy_rx rates, camnoc_dcd_xo, and vfe0/1_dsp
  clocks on SC8180X/SM8150.
- Keep CAMSS/VFE/CSID bus clocks, IRQs, and interconnects active while
  loaded on CAMSS_8150 and perform frame-boundary stop + warm vfe_reset()
  on stream reuse instead of post-stream GLOBAL_RESET_CMD_BUS, preventing
  the SC8180X NoC bus deadlock without altering behavior on any other SoC.

Tested on Microsoft Surface Pro X SQ2 (SC8180X, Linux 7.3.1-1-surface).

Signed-off-by: robertijtsma <37256770+robertijtsma@users.noreply.github.com>
…, and RDI format clamping

Add three portable improvements to Qualcomm CAMSS:

1. Optional DT privacy LED GPIOs (privacy-led-front-gpios and
   privacy-led-rear-gpios) refcounted per CSIPHY stream start/stop so
   hardware camera privacy indicators stay strictly synchronized with
   active streams.
2. Pipeline start rollback in video_start_streaming() (stopping already
   started subdevices if a downstream s_stream(1) fails) and complete
   sink-to-source teardown in video_stop_streaming() without aborting
   on non-fatal warnings, plus refreshing DMA addresses in
   video_buf_prepare().
3. Clamp non-line-based RDI video nodes to the active upstream subdev
   format in __video_try_fmt(), allowing generic V4L2 clients (such as
   OpenCV/Howdy on OV7251 Y10) to negotiate VIDIOC_S_FMT cleanly.

Tested on Microsoft Surface Pro X SQ2 (SC8180X, Linux 7.3.1-1-surface).

Signed-off-by: robertijtsma <37256770+robertijtsma@users.noreply.github.com>
robertijtsma added a commit to robertijtsma/surface-pro-x-sq2-linux that referenced this pull request Nov 22, 2026
… in patch 0004

Regenerate patches/0004-media-qcom-camss-sc8180x-titan175-full.patch from
the verified upstream-ready linux-surface/kernel#206 series:

- Include the missing drivers/media/platform/qcom/camss/camss-csiphy.h
  header hunk so the patch compiles standalone against Linux v7.3.
- Remove unintended v7.3 regressions to qcm2290, qcs8300, and sa8775p
  and scope all SC8180X NoC keep-alive logic strictly to CAMSS_8150.

Signed-off-by: robertijtsma <37256770+robertijtsma@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant