···5656MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU");5757module_param(vram, charp, 0);58585959+/*6060+ * Util/helpers:6161+ */6262+5963void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,6064 const char *dbgname)6165{···147143 priv->vram.paddr, &attrs);148144 }149145146146+ component_unbind_all(dev->dev, dev);147147+150148 dev->dev_private = NULL;151149152150 kfree(priv);···180174 struct msm_drm_private *priv;181175 struct msm_kms *kms;182176 int ret;177177+183178184179 priv = kzalloc(sizeof(*priv), GFP_KERNEL);185180 if (!priv) {···232225 (uint32_t)priv->vram.paddr,233226 (uint32_t)(priv->vram.paddr + size));234227 }228228+229229+ platform_set_drvdata(pdev, dev);230230+231231+ /* Bind all our sub-components: */232232+ ret = component_bind_all(dev->dev, dev);233233+ if (ret)234234+ return ret;235235236236 switch (get_mdp_ver(pdev)) {237237 case 4:···294280 dev_err(dev->dev, "failed to install IRQ handler\n");295281 goto fail;296282 }297297-298298- platform_set_drvdata(pdev, dev);299283300284#ifdef CONFIG_DRM_MSM_FBDEV301285 priv->fbdev = msm_fbdev_init(dev);···836824};837825838826/*827827+ * Componentized driver support:828828+ */829829+830830+#ifdef CONFIG_OF831831+/* NOTE: the CONFIG_OF case duplicates the same code as exynos or imx832832+ * (or probably any other).. so probably some room for some helpers833833+ */834834+static int compare_of(struct device *dev, void *data)835835+{836836+ return dev->of_node == data;837837+}838838+839839+static int msm_drm_add_components(struct device *master, struct master *m)840840+{841841+ struct device_node *np = master->of_node;842842+ unsigned i;843843+ int ret;844844+845845+ for (i = 0; ; i++) {846846+ struct device_node *node;847847+848848+ node = of_parse_phandle(np, "connectors", i);849849+ if (!node)850850+ break;851851+852852+ ret = component_master_add_child(m, compare_of, node);853853+ of_node_put(node);854854+855855+ if (ret)856856+ return ret;857857+ }858858+ return 0;859859+}860860+#else861861+static int compare_dev(struct device *dev, void *data)862862+{863863+ return dev == data;864864+}865865+866866+static int msm_drm_add_components(struct device *master, struct master *m)867867+{868868+ /* For non-DT case, it kinda sucks. We don't actually have a way869869+ * to know whether or not we are waiting for certain devices (or if870870+ * they are simply not present). But for non-DT we only need to871871+ * care about apq8064/apq8060/etc (all mdp4/a3xx):872872+ */873873+ static const char *devnames[] = {874874+ "hdmi_msm.0", "kgsl-3d0.0",875875+ };876876+ int i;877877+878878+ DBG("Adding components..");879879+880880+ for (i = 0; i < ARRAY_SIZE(devnames); i++) {881881+ struct device *dev;882882+ int ret;883883+884884+ dev = bus_find_device_by_name(&platform_bus_type,885885+ NULL, devnames[i]);886886+ if (!dev) {887887+ dev_info(master, "still waiting for %s\n", devnames[i]);888888+ return -EPROBE_DEFER;889889+ }890890+891891+ ret = component_master_add_child(m, compare_dev, dev);892892+ if (ret) {893893+ DBG("could not add child: %d", ret);894894+ return ret;895895+ }896896+ }897897+898898+ return 0;899899+}900900+#endif901901+902902+static int msm_drm_bind(struct device *dev)903903+{904904+ return drm_platform_init(&msm_driver, to_platform_device(dev));905905+}906906+907907+static void msm_drm_unbind(struct device *dev)908908+{909909+ drm_put_dev(platform_get_drvdata(to_platform_device(dev)));910910+}911911+912912+static const struct component_master_ops msm_drm_ops = {913913+ .add_components = msm_drm_add_components,914914+ .bind = msm_drm_bind,915915+ .unbind = msm_drm_unbind,916916+};917917+918918+/*839919 * Platform driver:840920 */841921842922static int msm_pdev_probe(struct platform_device *pdev)843923{844924 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);845845- return drm_platform_init(&msm_driver, pdev);925925+ return component_master_add(&pdev->dev, &msm_drm_ops);846926}847927848928static int msm_pdev_remove(struct platform_device *pdev)849929{850850- drm_put_dev(platform_get_drvdata(pdev));930930+ component_master_del(&pdev->dev, &msm_drm_ops);851931852932 return 0;853933}
+4
drivers/gpu/drm/msm/msm_drv.h
···2222#include <linux/clk.h>2323#include <linux/cpufreq.h>2424#include <linux/module.h>2525+#include <linux/component.h>2526#include <linux/platform_device.h>2627#include <linux/pm.h>2728#include <linux/pm_runtime.h>···6968struct msm_drm_private {70697170 struct msm_kms *kms;7171+7272+ /* subordinate devices, if present: */7373+ struct platform_device *hdmi_pdev, *gpu_pdev;72747375 /* when we have more than one 'msm_gpu' these need to be an array: */7476 struct msm_gpu *gpu;