On Tue, 2026-07-14 at 13:43 +0200, AngeloGioacchino Del Regno wrote:
> As a final preparation step for adding support for the MediaTek
> Digital Video Out (DVO) hardware found in newer SoCs, create a
> new mtk_dpi_common library and move common code between the DPI
> and the upcoming DVO in there.
> 
> This change brings no functional differences, as the new file is
> built-in on the mediatek-drm object anyway.
> 
> Signed-off-by: AngeloGioacchino Del Regno 
> <[email protected]>
> ---

[snip]

> +void mtk_dpi_power_off(struct mtk_dpi *dpi)
> +{
> +     if (WARN_ON(dpi->refcount == 0))
> +             return;
> +
> +     if (--dpi->refcount != 0)
> +             return;
> +
> +     clk_disable_unprepare(dpi->pixel_clk);
> +     clk_disable_unprepare(dpi->tvd_clk);
> +     clk_disable_unprepare(dpi->engine_clk);
> +}
> +EXPORT_SYMBOL_NS_GPL(mtk_dpi_power_off, "DRM_MTK_DPI");

I think all the caller is in the same module, so it's not necessary to export 
these symbols.
So drop these EXPORTs.

> +
> 

[snip]

> +struct mtk_dpi *mtk_dpi_common_probe(struct platform_device *pdev,
> +                                  const struct drm_bridge_funcs 
> *bridge_funcs)
> +{
> +     struct device *dev = &pdev->dev;
> +     struct mtk_dpi *dpi;
> +     int ret;
> +
> +     dpi = devm_drm_bridge_alloc(dev, struct mtk_dpi, bridge, bridge_funcs);
> +     if (IS_ERR(dpi))
> +             return dpi;
> +
> +     dpi->dev = dev;
> +     dpi->conf = (struct mtk_dpi_conf *)of_device_get_match_data(dev);
> +     dpi->output_fmt = MEDIA_BUS_FMT_RGB888_1X24;
> +
> +     dpi->pinctrl = devm_pinctrl_get(dev);
> +     if (IS_ERR_OR_NULL(dpi->pinctrl)) {

You change IS_ERR() to IS_ERR_OR_NULL() here, but commit message does not 
mention this.
Keep IS_ERR() or say something in commit message.

> +             dev_dbg(dev, "Cannot find pinctrl!\n");
> +             dpi->pinctrl = NULL;
> +     } else {
> +             dpi->pins_gpio = pinctrl_lookup_state(dpi->pinctrl, "sleep");
> +             if (IS_ERR(dpi->pins_gpio)) {
> +                     dpi->pins_gpio = NULL;
> +                     dev_dbg(dev, "Cannot find pinctrl idle!\n");
> +             }
> +             if (dpi->pins_gpio)
> +                     pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
> +
> +             dpi->pins_dpi = pinctrl_lookup_state(dpi->pinctrl, "default");
> +             if (IS_ERR(dpi->pins_dpi)) {
> +                     dpi->pins_dpi = NULL;
> +                     dev_dbg(dev, "Cannot find pinctrl active!\n");
> +             }
> +     }
> +
> +     dpi->regs = devm_platform_ioremap_resource(pdev, 0);
> +     if (IS_ERR(dpi->regs))
> +             return dev_err_ptr_probe(dev, PTR_ERR(dpi->regs),
> +                                      "Failed to ioremap mem resource\n");
> +
> +     dpi->engine_clk = devm_clk_get(dev, "engine");
> +     if (IS_ERR(dpi->engine_clk))
> +             return dev_err_ptr_probe(dev, PTR_ERR(dpi->engine_clk),
> +                                      "Failed to get engine clock\n");
> +
> +     dpi->pixel_clk = devm_clk_get(dev, "pixel");
> +     if (IS_ERR(dpi->pixel_clk))
> +             return dev_err_ptr_probe(dev, PTR_ERR(dpi->pixel_clk),
> +                                      "Failed to get pixel clock\n");
> +
> +     dpi->tvd_clk = devm_clk_get(dev, "pll");
> +     if (IS_ERR(dpi->tvd_clk))
> +             return dev_err_ptr_probe(dev, PTR_ERR(dpi->tvd_clk),
> +                                      "Failed to get tvdpll clock\n");
> +
> +     dpi->irq = platform_get_irq(pdev, 0);
> +     if (dpi->irq < 0)
> +             return ERR_PTR(dpi->irq);
> +
> +     dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, dpi->dev->of_node, 
> 1, -1);
> +     if (IS_ERR(dpi->next_bridge) && PTR_ERR(dpi->next_bridge) == -ENODEV) {
> +             /* Old devicetree has only one endpoint */
> +             dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, 
> dpi->dev->of_node, 0, 0);
> +     }
> +     if (IS_ERR(dpi->next_bridge))
> +             return dev_err_ptr_probe(dpi->dev, PTR_ERR(dpi->next_bridge),
> +                                      "Failed to get bridge\n");
> +
> +     platform_set_drvdata(pdev, dpi);
> +
> +     dpi->bridge.of_node = dev->of_node;
> +     dpi->bridge.type = DRM_MODE_CONNECTOR_DPI;
> +
> +     ret = devm_drm_bridge_add(dev, &dpi->bridge);
> +     if (ret)
> +             return ERR_PTR(ret);
> +
> +     return dpi;
> +}
> +EXPORT_SYMBOL_NS_GPL(mtk_dpi_common_probe, "DRM_MTK_DPI");

Drop this.

> +
> +MODULE_AUTHOR("AngeloGioacchino Del Regno 
> <[email protected]>");
> +MODULE_DESCRIPTION("MediaTek DPI/DVO Common Library");
> +MODULE_LICENSE("GPL");
> 

[snip]

> +
> +struct mtk_dpi {
> +     struct drm_encoder encoder;
> +     struct drm_bridge bridge;
> +     struct drm_bridge *next_bridge;
> +     struct drm_connector *connector;
> +     void __iomem *regs;
> +     struct device *dev;
> +     struct device *mmsys_dev;
> +     struct clk *engine_clk;
> +     struct clk *pixel_clk;
> +     struct clk *tvd_clk;
> +     int irq;
> +     struct drm_display_mode mode;
> +     const struct mtk_dpi_conf *conf;
> +     enum mtk_dpi_out_color_format color_format;
> +     enum mtk_dpi_out_yc_map yc_map;
> +     enum mtk_dpi_out_bit_num bit_num;
> +     enum mtk_dpi_out_channel_swap channel_swap;
> +     struct pinctrl *pinctrl;
> +     struct pinctrl_state *pins_gpio;
> +     struct pinctrl_state *pins_dpi;
> +     u32 output_fmt;
> +     s8 refcount;

You change the type of refcount here, but commit message does not mention this.
Keep the original type or say something in commit message.

Regards,
CK

> +};
> +

Reply via email to