Re: Reg: Re: [PATCH RFC 0/6] phy/media: Add generic MIPI C-PHY support to CSI-2 stack

From: Jigarkumar Zala

Date: Thu Nov 19 2026 - 17:33:48 EST


Hi Bryan,

Thanks for the feedback.

The original proposal was a little different from what was shown in the diagram. The intent was for phy-qocom-mipi-csi2-core.c to act as the interface with phy-core.c,
while the functionality which is currently in phy-mipi-csi2-3ph-dphy.c would be generalized and renamed to something like phy-mipi-csi2-core-utils.c, and extended to support additional PHY modes beyond the current  D-PHY implementation.

However, based on your comment, we're now considering a simpler approach. Rather to maintain Mode specific operation in core-utils.c file,
we could merge the common functionality from phy-qcom-mipi-csi2-3ph-dphy.c directly into the existing phy-qcom-mipi-csi2-core.c and evolve that file to support the different PHY modes.

The PHY-specific pieces such as register definitions, mode-specific constants, and related definitions could then be maintained in separate headers, for example:
-- phy-qcom-mipi-csi2-dphy_regs.h
-- phy-qcom-mipi-csi2-cphy_regs.h
-- Additional mode-specific headers as needed

With this structure, phy-qcom-mipi-csi2-core.c would contain the common implementation and dispatch the appropriate operations based on the selected PHY mode (D-PHY, C-PHY, split modes, etc.),
avoiding the need for an additional intermediate source file while still allowing us to extend support for future PHY configurations.

We'll put together the proposed patches and share them, which should make the intended separation between common and mode-specific functionality clearer.

Top Level architecture will look like below:

                 camss.c
                    |
                    v
               phy-core.c
                    |
                    v
         phy-qcom-mipi-csi2-core.c
                    ^
                    | (#include)
     +--------------+--------------+
     |                   |                   |
   D-PHY.h         C-PHY.h     Future Modes
     |                   |                   |
     +--------------+--------------+
      Mode-specific register headers
        phy-mipi-csi2-dphy_regs.h
        phy-mipi-csi2-cphy_regs.h


Best Regards,

Jigar

On 11/19/2026 1:12 AM, Bryan O'Donoghue wrote:
On 19/11/2026 06:37, Jigarkumar Zala wrote:
Hi Bryan,

As part of the C-PHY enablement work, we are thinking to organize the PHY driver such that the common functionality is consolidated into a shared implementation file, *phy-mipi-csi2-core-utils.c*, while keeping the PHY-specific register definitions separated:

  * *phy-mipi-csi2-dphy_regs.h* – D-PHY register definitions
  * *phy-mipi-csi2-cphy_regs.h* – C-PHY register definitions
  * *phy-mipi-csi2-core-utils.c* – Shared core implementation and
    utilities used by different PHY modes

Conceptually:

Plain Text

|dphy_regs.h          cphy_regs.h       \                  /         \                /         \              /    phy-mipi-csi2- core-utils.c |

We already have a phy-mipi-csi2-core.c file so why does it need to be renamed ?

[141] % ls drivers/phy/qualcomm/phy-qcom-mipi-csi2*.c
drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c

I think anything that needs consolidation should go into the existing core.c file - I also suspect there is still a use-case for phy-qcom-mipi-csi2-3ph-dphy.c and phy-qcom-mipi-csi2-3ph-cphy.c

But its hard to comment more without seeing what you guys are proposing.

---
bod