Merge tag 'leds-next-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
[linux-2.6-microblaze.git] / drivers / gpu / drm / msm / msm_drv.c
index 50b65ff..97790fa 100644 (file)
@@ -969,6 +969,39 @@ static int add_components_mdp(struct device *master_dev,
        return 0;
 }
 
+#if !IS_REACHABLE(CONFIG_DRM_MSM_MDP5) || !IS_REACHABLE(CONFIG_DRM_MSM_DPU)
+bool msm_disp_drv_should_bind(struct device *dev, bool dpu_driver)
+{
+       /* If just a single driver is enabled, use it no matter what */
+       return true;
+}
+#else
+
+static bool prefer_mdp5 = true;
+MODULE_PARM_DESC(prefer_mdp5, "Select whether MDP5 or DPU driver should be preferred");
+module_param(prefer_mdp5, bool, 0444);
+
+/* list all platforms supported by both mdp5 and dpu drivers */
+static const char *const msm_mdp5_dpu_migration[] = {
+       "qcom,sdm630-mdp5",
+       "qcom,sdm660-mdp5",
+       NULL,
+};
+
+bool msm_disp_drv_should_bind(struct device *dev, bool dpu_driver)
+{
+       /* If it is not an MDP5 device, do not try MDP5 driver */
+       if (!of_device_is_compatible(dev->of_node, "qcom,mdp5"))
+               return dpu_driver;
+
+       /* If it is not in the migration list, use MDP5 */
+       if (!of_device_compatible_match(dev->of_node, msm_mdp5_dpu_migration))
+               return !dpu_driver;
+
+       return prefer_mdp5 ? !dpu_driver : dpu_driver;
+}
+#endif
+
 /*
  * We don't know what's the best binding to link the gpu with the drm device.
  * Fow now, we just hunt for all the possible gpus that we support, and add them