[PATCH v4 2/2] phy: amlogic: Add G12A Analog MIPI D-PHY driver

Martin Blumenstingl martin.blumenstingl at googlemail.com
Sun Jun 26 15:21:52 PDT 2022


Hi Neil,

On Thu, Jun 16, 2022 at 3:39 PM Neil Armstrong <narmstrong at baylibre.com> wrote:
>
> The Amlogic G12A SoCs embeds an Analog MIPI D-PHY used to communicate with DSI
> panels.
>
> Signed-off-by: Neil Armstrong <narmstrong at baylibre.com>
> ---
>  drivers/phy/amlogic/Kconfig                   |  12 ++
>  drivers/phy/amlogic/Makefile                  |   1 +
>  .../amlogic/phy-meson-g12a-mipi-dphy-analog.c | 177 ++++++++++++++++++
>  3 files changed, 190 insertions(+)
>  create mode 100644 drivers/phy/amlogic/phy-meson-g12a-mipi-dphy-analog.c
>
> diff --git a/drivers/phy/amlogic/Kconfig b/drivers/phy/amlogic/Kconfig
> index 486ca23aba32..e4d1170efd54 100644
> --- a/drivers/phy/amlogic/Kconfig
> +++ b/drivers/phy/amlogic/Kconfig
> @@ -59,6 +59,18 @@ config PHY_MESON_G12A_USB3_PCIE
>           in Meson G12A SoCs.
>           If unsure, say N.
>
> +config PHY_MESON_G12A_MIPI_DPHY_ANALOG
> +       tristate "Meson G12A MIPI Analog DPHY driver"
> +       default ARCH_MESON
> +       depends on OF && (ARCH_MESON || COMPILE_TEST)
> +       select GENERIC_PHY
> +       select REGMAP_MMIO
I think this should be "select MFD_SYSCON" as we're not using
REGMAP_MMIO directly

[...]
> +       /* Get the hhi system controller node */
> +       map = syscon_node_to_regmap(of_get_parent(dev->of_node));
I just reviewed a patch that adds of_node_put() for the node returned
by of_get_parent() (after (syscon_node_to_regmap() has been used).
I think we need the same here

> +       if (IS_ERR(map)) {
> +               dev_err(dev,
> +                       "failed to get HHI regmap\n");
> +               return PTR_ERR(map);
to simplify we can use:
    return dev_err_probe(dev, PTR_ERR(map), "failed to get HHI regmap\n");
doesn't make much difference for this one though, but...

[...]
> +       priv->phy = devm_phy_create(dev, np, &phy_g12a_mipi_dphy_analog_ops);
> +       if (IS_ERR(priv->phy)) {
> +               ret = PTR_ERR(priv->phy);
> +               if (ret != -EPROBE_DEFER)
> +                       dev_err(dev, "failed to create PHY\n");
> +               return ret;
here dev_err_probe() would simplify the code a lot

[...]
> +static const struct of_device_id phy_g12a_mipi_dphy_analog_of_match[] = {
> +       {
> +               .compatible = "amlogic,g12a-mipi-dphy-analog",
> +       },
> +       { /* sentinel */ },
super nit-pick: no comma here


Best regards,
Martin



More information about the linux-arm-kernel mailing list