dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
Cc: dri-devel@lists.freedesktop.org, edmund.j.dea@intel.com
Subject: Re: [PATCH v3 2/7] drm/kmb: Limit supported mode to 1080p
Date: Thu, 14 Oct 2021 20:36:29 +0200	[thread overview]
Message-ID: <YWh4rfaBc3h/0ROG@ravnborg.org> (raw)
In-Reply-To: <20211013233632.471892-2-anitha.chrisanthus@intel.com>

On Wed, Oct 13, 2021 at 04:36:27PM -0700, Anitha Chrisanthus wrote:
> KMB only supports single resolution(1080p), this commit checks for
> 1920x1080x60 or 1920x1080x59 in crtc_mode_valid.
> Also, modes with vfp < 4 are not supported in KMB display. This change
> prunes display modes with vfp < 4.
> 
> v2: added vfp check
> 
> Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
> Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
> Signed-off-by: Edmund Dea <edmund.j.dea@intel.com>

This looks wrong. I assume it Edmund also did some development work so
you should also add:
Co-developed-by: Edmund Dea <edmund.j.dea@intel.com>

One nit below. With these nits fixed:
Acked-by: Sam Ravnborg <sam@ravnborg.org>

	Sam

> ---
>  drivers/gpu/drm/kmb/kmb_crtc.c | 34 ++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/kmb/kmb_drv.h  | 13 ++++++++++---
>  2 files changed, 44 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/kmb/kmb_crtc.c b/drivers/gpu/drm/kmb/kmb_crtc.c
> index 44327bc629ca..08a45e813db7 100644
> --- a/drivers/gpu/drm/kmb/kmb_crtc.c
> +++ b/drivers/gpu/drm/kmb/kmb_crtc.c
> @@ -185,11 +185,45 @@ 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;
> +	int vfp = mode->vsync_start - mode->vdisplay;
> +
> +	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;
> +	}
> +
> +	if (vfp < KMB_CRTC_MIN_VFP) {
> +		drm_dbg(dev, "vfp = %d less than %d", vfp, KMB_CRTC_MIN_VFP);
> +		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 69a62e2d03ff..d297218869e8 100644
> --- a/drivers/gpu/drm/kmb/kmb_drv.h
> +++ b/drivers/gpu/drm/kmb/kmb_drv.h
> @@ -18,13 +18,20 @@
>  
>  #define DRIVER_DATE			"20210223"
>  #define DRIVER_MAJOR			1
> -#define DRIVER_MINOR			1
> -
> +#define DRIVER_MINOR			2
This change looks un-related.

> +
> +/* Platform definitions */
> +#define KMB_CRTC_MIN_VFP		4
> +#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

  reply	other threads:[~2021-10-14 18:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 23:36 [PATCH v3 1/7] drm/kmb: Work around for higher system clock Anitha Chrisanthus
2021-10-13 23:36 ` [PATCH v3 2/7] drm/kmb: Limit supported mode to 1080p Anitha Chrisanthus
2021-10-14 18:36   ` Sam Ravnborg [this message]
2021-10-13 23:36 ` [PATCH v3 3/7] drm/kmb: Remove clearing DPHY regs Anitha Chrisanthus
2021-10-14 18:37   ` Sam Ravnborg
2021-10-13 23:36 ` [PATCH v3 4/7] drm/kmb: Disable change of plane parameters Anitha Chrisanthus
2021-10-14 18:39   ` Sam Ravnborg
2021-10-13 23:36 ` [PATCH v3 5/7] drm/kmb: Corrected typo in handle_lcd_irq Anitha Chrisanthus
2021-10-14 18:40   ` Sam Ravnborg
2021-10-13 23:36 ` [PATCH v3 6/7] drm/kmb: Enable ADV bridge after modeset Anitha Chrisanthus
2021-10-14 18:44   ` Sam Ravnborg
2021-10-13 23:36 ` [PATCH v3 7/7] drm/kmb: Enable support for framebuffer console Anitha Chrisanthus
2021-10-14 12:50   ` Thomas Zimmermann
2021-10-15 17:17     ` Chrisanthus, Anitha
2021-10-14 13:08   ` Thomas Zimmermann
2021-10-15 17:16     ` Chrisanthus, Anitha
2021-10-14 18:33 ` [PATCH v3 1/7] drm/kmb: Work around for higher system clock 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=YWh4rfaBc3h/0ROG@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=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