From: Javier Martinez Canillas <javierm@redhat.com>
Date: Fri, 17 Dec 2021 00:37:48 +0000 (+0100)
Subject: drm/sprd: Add support for the nomodeset kernel parameter
X-Git-Tag: howlett/maple/20220722_2~936^2~14^2~122
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5e66e818e0358fe42704404580b70e1ffc7afb6a;p=users%2Fjedix%2Flinux-maple.git

drm/sprd: Add support for the nomodeset kernel parameter

According to disable Documentation/admin-guide/kernel-parameters.txt, this
parameter can be used to disable kernel modesetting.

DRM drivers will not perform display-mode changes or accelerated rendering
and only the system framebuffer will be available if it was set-up.

But only a few DRM drivers currently check for nomodeset, make this driver
to also support the command line parameter.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211217003752.3946210-34-javierm@redhat.com
---

diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sprd_drm.c
index a077e2d4d721..dd7e3de780f3 100644
--- a/drivers/gpu/drm/sprd/sprd_drm.c
+++ b/drivers/gpu/drm/sprd/sprd_drm.c
@@ -186,6 +186,9 @@ static struct platform_driver *sprd_drm_drivers[]  = {
 
 static int __init sprd_drm_init(void)
 {
+	if (drm_firmware_drivers_only())
+		return -ENODEV;
+
 	return platform_register_drivers(sprd_drm_drivers,
 					ARRAY_SIZE(sprd_drm_drivers));
 }