[PATCH v2 2/2] phy: mtk-mipi-csi: add driver for CSI phy
Julien Stephan
jstephan at baylibre.com
Mon May 15 06:36:57 PDT 2023
On Mon, May 15, 2023 at 02:22:52PM +0200, AngeloGioacchino Del Regno wrote:
> Il 15/05/23 11:05, Julien Stephan ha scritto:
..snip..
> > + port->is_cdphy = of_property_read_bool(dev->of_node, "mediatek,is_cdphy");
>
> This driver doesn't support C-PHY mode, so you either add support for that, or in
> my opinion you should simply refuse to probe it, as it is *dysfunctional* for the
> unsupported case (and might even introduce unstabilities).
>
> /* At the moment, only D-PHY mode is supported */
> if (!port->is_cdphy)
> return -EINVAL;
>
> Also, please don't use underscores for devicetree properties: "mediatek,is-cdphy"
> is fine.
>
Hi Angelo,
You are right this driver does not support C-PHY mode, but some of the
PHYs themselves support BOTH C-PHY AND D-PHY. The idea of `is_cdphy` variable
is to know if the CSI port supports BOTH C-PHY AND D-PHY or only DPHY.
For example mt8365 has 2 PHYs: CSI0 and CSI1. CSI1 support only D-PHY,
while CSI0 can be configured in C-PHY or D-PHY. Registers for CD-PHY and
D-PHY are almost identical, except that CD-PHY compatible has some extra
bitfields to configure properly the mode and the lanes (because supporting
trios for CD-PHY).
If C-PHY support is eventually added into the driver, I think we will need
another variable such as `mode` to know the mode. I was also thinking
of adding a phy argument to determine if the mode is C-PHY or D-PHY.
So here, I don't want to stop the probe if `is_cdphy` variable is set to
true. Does it make sense ?
Regards
Julien
.. snip..
> > +
> > + phy = devm_phy_create(dev, NULL, &mtk_dphy_ops);
> > + if (IS_ERR(phy)) {
> > + dev_err(dev, "Failed to create PHY: %ld\n", PTR_ERR(phy));
> > + return PTR_ERR(phy);
> > + }
>
> Regards,
> Angelo
>
More information about the linux-phy
mailing list