]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/tilcdc: Remove component framework support
authorKory Maincent (TI.com) <kory.maincent@bootlin.com>
Fri, 23 Jan 2026 16:12:25 +0000 (17:12 +0100)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Wed, 11 Feb 2026 08:16:15 +0000 (09:16 +0100)
The tilcdc driver previously used the component framework to bind
external encoder subdrivers (specifically the TDA998x HDMI encoder).
With the removal of these subdrivers in previous commits, the component
framework is no longer needed.

This commit removes all component framework infrastructure including:
- Component master operations and bind/unbind callbacks
- The is_componentized flag and conditional code paths
- tilcdc_get_external_components() and tilcdc_add_component_encoder()
- TDA998x-specific panel configuration

The driver now uses a simplified initialization path that directly
attaches external devices via the DRM bridge API, eliminating the
complexity of dual code paths for componentized vs non-componentized
configurations.

This cleanup removes approximately 140 lines of code and makes the
driver initialization flow more straightforward.

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
Link: https://patch.msgid.link/20260123-feature_tilcdc-v5-7-5a44d2aa3f6f@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/tilcdc/tilcdc_crtc.c
drivers/gpu/drm/tilcdc/tilcdc_drv.c
drivers/gpu/drm/tilcdc/tilcdc_drv.h
drivers/gpu/drm/tilcdc/tilcdc_external.c
drivers/gpu/drm/tilcdc/tilcdc_external.h

index 2309a9a0c925d8056409c7e48c3c3b8e677efc2f..252e5adaeb6e263e94acc189eb62fdea365fcc0f 100644 (file)
@@ -1021,16 +1021,6 @@ int tilcdc_crtc_create(struct drm_device *dev)
 
        drm_crtc_helper_add(crtc, &tilcdc_crtc_helper_funcs);
 
-       if (priv->is_componentized) {
-               crtc->port = of_graph_get_port_by_id(dev->dev->of_node, 0);
-               if (!crtc->port) { /* This should never happen */
-                       dev_err(dev->dev, "Port node not found in %pOF\n",
-                               dev->dev->of_node);
-                       ret = -EINVAL;
-                       goto fail;
-               }
-       }
-
        priv->crtc = crtc;
        return 0;
 
index f03861ed6349d62c7b2228c71feb02576ef0ce57..f865c131dae663e15cfa793912818b00d8be7f92 100644 (file)
@@ -6,7 +6,6 @@
 
 /* LCDC DRM driver, based on da8xx-fb */
 
-#include <linux/component.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/pinctrl/consumer.h>
@@ -220,9 +219,6 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
        platform_set_drvdata(pdev, ddev);
        drm_mode_config_init(ddev);
 
-       priv->is_componentized =
-               tilcdc_get_external_components(dev, NULL) > 0;
-
        priv->wq = alloc_ordered_workqueue("tilcdc", 0);
        if (!priv->wq) {
                ret = -ENOMEM;
@@ -339,42 +335,32 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
        }
 #endif
 
-       if (priv->is_componentized) {
-               ret = component_bind_all(dev, ddev);
-               if (ret < 0)
-                       goto unregister_cpufreq_notif;
-
-               ret = tilcdc_add_component_encoder(ddev);
-               if (ret < 0)
-                       goto unbind_component;
-       } else {
-               ret = tilcdc_attach_external_device(ddev);
-               if (ret)
-                       goto unregister_cpufreq_notif;
-       }
+       ret = tilcdc_attach_external_device(ddev);
+       if (ret)
+               goto unregister_cpufreq_notif;
 
        if (!priv->external_connector &&
            ((priv->num_encoders == 0) || (priv->num_connectors == 0))) {
                dev_err(dev, "no encoders/connectors found\n");
                ret = -EPROBE_DEFER;
-               goto unbind_component;
+               goto unregister_cpufreq_notif;
        }
 
        ret = drm_vblank_init(ddev, 1);
        if (ret < 0) {
                dev_err(dev, "failed to initialize vblank\n");
-               goto unbind_component;
+               goto unregister_cpufreq_notif;
        }
 
        ret = platform_get_irq(pdev, 0);
        if (ret < 0)
-               goto unbind_component;
+               goto unregister_cpufreq_notif;
        priv->irq = ret;
 
        ret = tilcdc_irq_install(ddev, priv->irq);
        if (ret < 0) {
                dev_err(dev, "failed to install IRQ handler\n");
-               goto unbind_component;
+               goto unregister_cpufreq_notif;
        }
 
        drm_mode_config_reset(ddev);
@@ -392,9 +378,6 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
 stop_poll:
        drm_kms_helper_poll_fini(ddev);
        tilcdc_irq_uninstall(ddev);
-unbind_component:
-       if (priv->is_componentized)
-               component_unbind_all(dev, ddev);
 unregister_cpufreq_notif:
 #ifdef CONFIG_CPU_FREQ
        cpufreq_unregister_notifier(&priv->freq_transition,
@@ -543,65 +526,20 @@ static int tilcdc_pm_resume(struct device *dev)
 static DEFINE_SIMPLE_DEV_PM_OPS(tilcdc_pm_ops,
                                tilcdc_pm_suspend, tilcdc_pm_resume);
 
-/*
- * Platform driver:
- */
-static int tilcdc_bind(struct device *dev)
-{
-       return tilcdc_init(&tilcdc_driver, dev);
-}
-
-static void tilcdc_unbind(struct device *dev)
-{
-       struct drm_device *ddev = dev_get_drvdata(dev);
-
-       /* Check if a subcomponent has already triggered the unloading. */
-       if (!ddev->dev_private)
-               return;
-
-       tilcdc_fini(ddev);
-       dev_set_drvdata(dev, NULL);
-}
-
-static const struct component_master_ops tilcdc_comp_ops = {
-       .bind = tilcdc_bind,
-       .unbind = tilcdc_unbind,
-};
-
 static int tilcdc_pdev_probe(struct platform_device *pdev)
 {
-       struct component_match *match = NULL;
-       int ret;
-
        /* bail out early if no DT data: */
        if (!pdev->dev.of_node) {
                dev_err(&pdev->dev, "device-tree data is missing\n");
                return -ENXIO;
        }
 
-       ret = tilcdc_get_external_components(&pdev->dev, &match);
-       if (ret < 0)
-               return ret;
-       else if (ret == 0)
-               return tilcdc_init(&tilcdc_driver, &pdev->dev);
-       else
-               return component_master_add_with_match(&pdev->dev,
-                                                      &tilcdc_comp_ops,
-                                                      match);
+       return tilcdc_init(&tilcdc_driver, &pdev->dev);
 }
 
 static void tilcdc_pdev_remove(struct platform_device *pdev)
 {
-       int ret;
-
-       ret = tilcdc_get_external_components(&pdev->dev, NULL);
-       if (ret < 0)
-               dev_err(&pdev->dev, "tilcdc_get_external_components() failed (%pe)\n",
-                       ERR_PTR(ret));
-       else if (ret == 0)
-               tilcdc_fini(platform_get_drvdata(pdev));
-       else
-               component_master_del(&pdev->dev, &tilcdc_comp_ops);
+       tilcdc_fini(platform_get_drvdata(pdev));
 }
 
 static void tilcdc_pdev_shutdown(struct platform_device *pdev)
index 79078b4ae73935682c4f91c74d909bfcbd2255d6..c23b593dc61f622dd7615c910a2b37f459d85f4d 100644 (file)
@@ -84,7 +84,6 @@ struct tilcdc_drm_private {
        struct drm_encoder *external_encoder;
        struct drm_connector *external_connector;
 
-       bool is_componentized;
        bool irq_enabled;
 };
 
index da755a411d9ff7fdc8fbd8402c05e7bdf2340a16..2970c41d9c3eb61f160352a8997de6be9a260556 100644 (file)
@@ -4,7 +4,6 @@
  * Author: Jyri Sarha <jsarha@ti.com>
  */
 
-#include <linux/component.h>
 #include <linux/of_graph.h>
 
 #include <drm/drm_atomic_helper.h>
 #include "tilcdc_drv.h"
 #include "tilcdc_external.h"
 
-static const struct tilcdc_panel_info panel_info_tda998x = {
-               .ac_bias                = 255,
-               .ac_bias_intrpt         = 0,
-               .dma_burst_sz           = 16,
-               .bpp                    = 16,
-               .fdd                    = 0x80,
-               .tft_alt_mode           = 0,
-               .invert_pxl_clk         = 1,
-               .sync_edge              = 1,
-               .sync_ctrl              = 1,
-               .raster_order           = 0,
-};
-
 static const struct tilcdc_panel_info panel_info_default = {
                .ac_bias                = 255,
                .ac_bias_intrpt         = 0,
@@ -57,34 +43,6 @@ struct drm_connector *tilcdc_encoder_find_connector(struct drm_device *ddev,
        return NULL;
 }
 
-int tilcdc_add_component_encoder(struct drm_device *ddev)
-{
-       struct tilcdc_drm_private *priv = ddev->dev_private;
-       struct drm_encoder *encoder = NULL, *iter;
-
-       list_for_each_entry(iter, &ddev->mode_config.encoder_list, head)
-               if (iter->possible_crtcs & (1 << priv->crtc->index)) {
-                       encoder = iter;
-                       break;
-               }
-
-       if (!encoder) {
-               dev_err(ddev->dev, "%s: No suitable encoder found\n", __func__);
-               return -ENODEV;
-       }
-
-       priv->external_connector =
-               tilcdc_encoder_find_connector(ddev, encoder);
-
-       if (!priv->external_connector)
-               return -ENODEV;
-
-       /* Only tda998x is supported at the moment. */
-       tilcdc_crtc_set_panel_info(priv->crtc, &panel_info_tda998x);
-
-       return 0;
-}
-
 static
 int tilcdc_attach_bridge(struct drm_device *ddev, struct drm_bridge *bridge)
 {
@@ -153,26 +111,3 @@ err_encoder_cleanup:
        drm_encoder_cleanup(priv->external_encoder);
        return ret;
 }
-
-static int dev_match_of(struct device *dev, void *data)
-{
-       return dev->of_node == data;
-}
-
-int tilcdc_get_external_components(struct device *dev,
-                                  struct component_match **match)
-{
-       struct device_node *node;
-
-       node = of_graph_get_remote_node(dev->of_node, 0, 0);
-
-       if (!of_device_is_compatible(node, "nxp,tda998x")) {
-               of_node_put(node);
-               return 0;
-       }
-
-       if (match)
-               drm_of_component_match_add(dev, match, dev_match_of, node);
-       of_node_put(node);
-       return 1;
-}
index fb4476694cd8939db83a53608f4daaa53057d0c5..285a132f3035dab5dcb35b2579eb9492168b5669 100644 (file)
@@ -7,8 +7,5 @@
 #ifndef __TILCDC_EXTERNAL_H__
 #define __TILCDC_EXTERNAL_H__
 
-int tilcdc_add_component_encoder(struct drm_device *dev);
-int tilcdc_get_external_components(struct device *dev,
-                                  struct component_match **match);
 int tilcdc_attach_external_device(struct drm_device *ddev);
 #endif /* __TILCDC_SLAVE_H__ */