@@ -359,8 +359,8 @@ static const struct drm_mode_config_funcs kmb_mode_config_funcs = {
static void kmb_setup_mode_config(struct drm_device *drm)
{
drm_mode_config_init(drm);
- drm->mode_config.min_width = 0;
- drm->mode_config.min_height = 0;
+ drm->mode_config.min_width = KMB_MIN_WIDTH;
+ drm->mode_config.min_height = KMB_MIN_HEIGHT;
drm->mode_config.max_width = KMB_MAX_WIDTH;
drm->mode_config.max_height = KMB_MAX_HEIGHT;
drm->mode_config.funcs = &kmb_mode_config_funcs;
@@ -28,10 +28,12 @@
#include "kmb_regs.h"
-#define FCCTEST
+//#define FCCTEST
#define LCD_TEST
-#define KMB_MAX_WIDTH 1920 /*max width in pixels */
-#define KMB_MAX_HEIGHT 1080 /*max height in pixels */
+#define KMB_MAX_WIDTH 1920 /*max width in pixels */
+#define KMB_MAX_HEIGHT 1080 /*max height in pixels */
+#define KMB_MIN_WIDTH 1920 /*max width in pixels */
+#define KMB_MIN_HEIGHT 1080 /*max height in pixels */
#define KMB_LCD_DEFAULT_CLK 250000000
#define KMB_MIPI_DEFAULT_CLK 24000000
#define KMB_MIPI_DEFAULT_CFG_CLK 24000000
@@ -216,6 +216,17 @@ static enum drm_mode_status
kmb_dsi_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
+ struct drm_device *dev = connector->dev;
+ struct drm_mode_config *mode_config = &dev->mode_config;
+
+ if (mode->hdisplay < mode_config->min_width ||
+ mode->hdisplay > mode_config->max_width)
+ return MODE_BAD_HVALUE;
+
+ if (mode->vdisplay < mode_config->min_height ||
+ mode->vdisplay > mode_config->max_height)
+ return MODE_BAD_VVALUE;
+
return MODE_OK;
}
@@ -77,6 +77,8 @@ static int kmb_plane_atomic_check(struct drm_plane *plane,
if (state->crtc_w > KMB_MAX_WIDTH || state->crtc_h > KMB_MAX_HEIGHT)
return -EINVAL;
+ if (state->crtc_w < KMB_MIN_WIDTH || state->crtc_h < KMB_MIN_HEIGHT)
+ return -EINVAL;
return 0;
}