From: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
To: dri-devel@lists.freedesktop.org, anitha.chrisanthus@intel.com,
edmund.j.dea@intel.com
Subject: [PATCH 05/14] drm/kmb: Limit supported mode to 1080p
Date: Tue, 27 Jul 2021 17:31:17 -0700 [thread overview]
Message-ID: <20210728003126.1425028-5-anitha.chrisanthus@intel.com> (raw)
In-Reply-To: <20210728003126.1425028-1-anitha.chrisanthus@intel.com>
KMB only supports single resolution(1080p), this commit checks for
1920x1080x60 or 1920x1080x59 in crtc_mode_valid.
Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
---
drivers/gpu/drm/kmb/kmb_crtc.c | 28 ++++++++++++++++++++++++++++
drivers/gpu/drm/kmb/kmb_drv.h | 15 +++++++++++++--
2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/kmb/kmb_crtc.c b/drivers/gpu/drm/kmb/kmb_crtc.c
index 44327bc629ca..44626044c85e 100644
--- a/drivers/gpu/drm/kmb/kmb_crtc.c
+++ b/drivers/gpu/drm/kmb/kmb_crtc.c
@@ -185,11 +185,39 @@ static void kmb_crtc_atomic_flush(struct drm_crtc *crtc,
spin_unlock_irq(&crtc->dev->event_lock);
}
+static enum drm_mode_status
+ kmb_crtc_mode_valid(struct drm_crtc *crtc,
+ const struct drm_display_mode *mode)
+{
+ int refresh;
+ struct drm_device *dev = crtc->dev;
+
+ if (mode->vdisplay < KMB_CRTC_MAX_HEIGHT) {
+ drm_dbg(dev, "height = %d less than %d",
+ mode->vdisplay, KMB_CRTC_MAX_HEIGHT);
+ return MODE_BAD_VVALUE;
+ }
+ if (mode->hdisplay < KMB_CRTC_MAX_WIDTH) {
+ drm_dbg(dev, "width = %d less than %d",
+ mode->hdisplay, KMB_CRTC_MAX_WIDTH);
+ return MODE_BAD_HVALUE;
+ }
+ refresh = drm_mode_vrefresh(mode);
+ if (refresh < KMB_MIN_VREFRESH || refresh > KMB_MAX_VREFRESH) {
+ drm_dbg(dev, "refresh = %d less than %d or greater than %d",
+ refresh, KMB_MIN_VREFRESH, KMB_MAX_VREFRESH);
+ return MODE_BAD;
+ }
+
+ return MODE_OK;
+}
+
static const struct drm_crtc_helper_funcs kmb_crtc_helper_funcs = {
.atomic_begin = kmb_crtc_atomic_begin,
.atomic_enable = kmb_crtc_atomic_enable,
.atomic_disable = kmb_crtc_atomic_disable,
.atomic_flush = kmb_crtc_atomic_flush,
+ .mode_valid = kmb_crtc_mode_valid,
};
int kmb_setup_crtc(struct drm_device *drm)
diff --git a/drivers/gpu/drm/kmb/kmb_drv.h b/drivers/gpu/drm/kmb/kmb_drv.h
index 0904e6eb2a09..fefb1052058c 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.h
+++ b/drivers/gpu/drm/kmb/kmb_drv.h
@@ -18,8 +18,19 @@
#define DRIVER_DATE "20210223"
#define DRIVER_MAJOR 1
-#define DRIVER_MINOR 1
-
+#define DRIVER_MINOR 2
+
+/* Platform definitions */
+#define KMB_CRTC_MAX_WIDTH 1920 /* max width in pixels */
+#define KMB_CRTC_MAX_HEIGHT 1080 /* max height in pixels */
+#define KMB_CRTC_MIN_WIDTH 1920
+#define KMB_CRTC_MIN_HEIGHT 1080
+#define KMB_FB_MAX_WIDTH 1920
+#define KMB_FB_MAX_HEIGHT 1080
+#define KMB_FB_MIN_WIDTH 1
+#define KMB_FB_MIN_HEIGHT 1
+#define KMB_MIN_VREFRESH 59 /*vertical refresh in Hz */
+#define KMB_MAX_VREFRESH 60 /*vertical refresh in Hz */
#define KMB_LCD_DEFAULT_CLK 200000000
#define KMB_SYS_CLK_MHZ 500
--
2.25.1
next prev parent reply other threads:[~2021-07-28 0:32 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-28 0:31 [PATCH 01/14] drm/kmb: Enable LCD DMA for low TVDDCV Anitha Chrisanthus
2021-07-28 0:31 ` [PATCH 02/14] drm/kmb: Define driver date and major/minor version Anitha Chrisanthus
2021-07-28 7:06 ` Sam Ravnborg
2021-08-04 18:13 ` Thomas Zimmermann
2021-08-05 23:53 ` Chrisanthus, Anitha
2021-07-28 0:31 ` [PATCH 03/14] drm/kmb: Work around for higher system clock Anitha Chrisanthus
2021-07-28 0:31 ` [PATCH 04/14] drm/kmb : W/A for 256B cache alignment for video Anitha Chrisanthus
2021-07-28 7:16 ` Sam Ravnborg
2021-07-28 22:54 ` Chrisanthus, Anitha
2021-07-28 0:31 ` Anitha Chrisanthus [this message]
2021-07-28 0:31 ` [PATCH 06/14] drm/kmb: Remove clearing DPHY regs Anitha Chrisanthus
2021-07-28 0:31 ` [PATCH 07/14] drm/kmb: Disable change of plane parameters Anitha Chrisanthus
2021-07-28 0:31 ` [PATCH 08/14] drm/kmb: Corrected typo in handle_lcd_irq Anitha Chrisanthus
2021-07-28 0:31 ` [PATCH 09/14] drm/kmb : W/A for planar formats Anitha Chrisanthus
2021-07-28 22:48 ` Chrisanthus, Anitha
2021-07-28 0:31 ` [PATCH 10/14] drm/kmb: Enable ADV bridge after modeset Anitha Chrisanthus
2021-07-28 7:22 ` Sam Ravnborg
2021-07-28 0:31 ` [PATCH 11/14] drm/kmb: Prune display modes with CRTC vfp < 4 Anitha Chrisanthus
2021-07-28 0:31 ` [PATCH 12/14] drm/kmb: Fix possible oops in error handling Anitha Chrisanthus
2021-07-28 7:27 ` Sam Ravnborg
2021-07-28 23:23 ` Chrisanthus, Anitha
2021-07-28 7:46 ` Dan Carpenter
2021-07-28 0:31 ` [PATCH 13/14] drm/kmb: Enable alpha blended second plane Anitha Chrisanthus
2021-07-28 7:29 ` Sam Ravnborg
2021-08-02 20:44 ` Chrisanthus, Anitha
2021-08-03 5:10 ` Sam Ravnborg
2021-09-08 17:50 ` Thomas Zimmermann
2021-09-08 19:31 ` Sam Ravnborg
2021-09-09 17:46 ` Thomas Zimmermann
2021-07-28 0:31 ` [PATCH 14/14] drm/kmb: Enable support for fbcon (framebuffer console) Anitha Chrisanthus
2021-07-28 7:31 ` Sam Ravnborg
2021-07-28 23:03 ` Chrisanthus, Anitha
2021-07-28 7:04 ` [PATCH 01/14] drm/kmb: Enable LCD DMA for low TVDDCV Sam Ravnborg
2021-07-29 18:48 ` Chrisanthus, Anitha
2021-07-29 19:00 ` Sam Ravnborg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210728003126.1425028-5-anitha.chrisanthus@intel.com \
--to=anitha.chrisanthus@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=edmund.j.dea@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).