From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D12F8C4BA24 for ; Thu, 27 Feb 2020 08:14:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A00A92467F for ; Thu, 27 Feb 2020 08:14:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gmg/er50" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A00A92467F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 924876EC16; Thu, 27 Feb 2020 08:14:45 +0000 (UTC) Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 24B106E07F for ; Thu, 27 Feb 2020 04:41:39 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id f15so1958052wml.3 for ; Wed, 26 Feb 2020 20:41:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ATY4FirrWSRXwibhVzuS9x+D/nw752P7FZdija4RCNQ=; b=gmg/er50IvxXlWNr0zfc/dvQNv03qhfATae241DtxAZu1+ZtFllYnggWsathlrRgwk Gwr4fHoW4uG/UgbwAVz+KmoNFhvakTFpDutUcS6bXDKvKVH/otHYO8tpOGN15KkXQtLY YeeG2/p6l3dppCPojjwTn/7Iw7D/sdscr9U1APhJYDfue7VlWNHWGyoiK8+vCbByvLHE qe0y6txBxT37ivTfAtRIZHnJN3fuJLOt6wf8R53RyzyCCMV3fYpnAUwr9+cmtOklXWcr HUUYeoD7YtzHZM/wh5OfiSSEhX+SSQolHGHdggA1QQu3zUjmQwQMGZB1TWX7jB6tEDhO V6hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ATY4FirrWSRXwibhVzuS9x+D/nw752P7FZdija4RCNQ=; b=AHAao3SHLvbO5JK+AYQbYZQxPUxjBXpX+/HiBQ5+Gx0btMR69Ql3IYtSD1mqa/eVz4 od4ng3Penwx51+KFn9JDoojEygfIU1w2tMjyl/Z2ILdVm1M+Sck1zRjQVGE6ftR9QTDI OVasEdPZuVnMMNrxmTP258qUB9x0XaagwO9O45+jbwpcZ0RzkuvdURXa0Rd8yv/vwRU0 JjGh0qAvnoyA7uOUyZsDxo5mIv1Al7d/ZUihvNmKRQnAOSGH1813UhZanZrLHLmX4jNO 6BWYIATv6DZ/YfWYHahIM6PmVSC4LHxZFfSLACBSFwYNMFQS3ZgF4tE3B/FjsDmk9VYh v0FA== X-Gm-Message-State: APjAAAWCoGGyDiku7+AFyQGIavXa9XXElzBUiC4+ywu0DKsOZE3erp6g ZntD3hoIlmMA5eweh+gEG0DQmmOJTmcc5WziJvLURUqD06yyww== X-Google-Smtp-Source: APXvYqwvk99BX7pf0oATbtVpr3E2NR/Z3kuUNA6ggqJtAJ2Pyk14N8ZY6F+h7/cWChOK8QJnDND1leHdEDjjGiGWebU= X-Received: by 2002:a1c:6056:: with SMTP id u83mr2763181wmb.53.1582778497854; Wed, 26 Feb 2020 20:41:37 -0800 (PST) MIME-Version: 1.0 References: <1578476501-45807-1-git-send-email-tiantao6@hisilicon.com> In-Reply-To: <1578476501-45807-1-git-send-email-tiantao6@hisilicon.com> From: Xinliang Liu Date: Thu, 27 Feb 2020 12:41:26 +0800 Message-ID: Subject: Re: [PATCH v2] drm/hisilicon: Add the mode_valid function To: Tian Tao X-Mailman-Approved-At: Thu, 27 Feb 2020 08:13:09 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, puck.chen@hisilicon.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linuxarm@huawei.com, kraxel@redhat.com, tzimmermann@suse.de, alexander.deucher@amd.com, tglx@linutronix.de Content-Type: multipart/mixed; boundary="===============1070386407==" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --===============1070386407== Content-Type: multipart/alternative; boundary="0000000000001f8dbb059f875636" --0000000000001f8dbb059f875636 Content-Type: text/plain; charset="UTF-8" Thanks for the patch. Applied to drm-misc-next. On Wed, 8 Jan 2020 at 17:41, Tian Tao wrote: > add mode_valid function, we can make sure the resolution is valid. > > Signed-off-by: Tian Tao > Signed-off-by: Gong junjie > Reviewed-by: Thomas Zimmermann > > --- > v2: declare hibmc_crtc_mode_valid as static. > Modify the return value of hibmc_crtc_mode_valid . > --- > drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c > b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c > index 843d784..675d629 100644 > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c > @@ -242,6 +242,24 @@ static void hibmc_crtc_atomic_disable(struct drm_crtc > *crtc, > hibmc_set_current_gate(priv, reg); > } > > +static enum drm_mode_status hibmc_crtc_mode_valid(struct drm_crtc *crtc, > + const struct drm_display_mode > *mode) > +{ > + int i = 0; > + int vrefresh = drm_mode_vrefresh(mode); > + > + if (vrefresh < 59 || vrefresh > 61) > + return MODE_NOCLOCK; > + > + for (i = 0; i < ARRAY_SIZE(hibmc_pll_table); i++) { > + if (hibmc_pll_table[i].hdisplay == mode->hdisplay && > + hibmc_pll_table[i].vdisplay == mode->vdisplay) > + return MODE_OK; > + } > + > + return MODE_BAD; > +} > + > static unsigned int format_pll_reg(void) > { > unsigned int pllreg = 0; > @@ -510,6 +528,7 @@ static const struct drm_crtc_helper_funcs > hibmc_crtc_helper_funcs = { > .atomic_flush = hibmc_crtc_atomic_flush, > .atomic_enable = hibmc_crtc_atomic_enable, > .atomic_disable = hibmc_crtc_atomic_disable, > + .mode_valid = hibmc_crtc_mode_valid, > }; > > int hibmc_de_init(struct hibmc_drm_private *priv) > -- > 2.7.4 > > --0000000000001f8dbb059f875636 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for the patch.
Applied to drm-misc-next.

On W= ed, 8 Jan 2020 at 17:41, Tian Tao <tiantao6@hisilicon.com> wrote:
add mode_valid function, we can make sure the re= solution is valid.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Gong junjie <gongjunjie2@huawei.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

---
v2:=C2=A0 =C2=A0 =C2=A0declare hibmc_crtc_mode_valid as static.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Modify the return value of hibmc_crtc_mode_vali= d .
---
=C2=A0drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 19 +++++++++++++++++= ++
=C2=A01 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/d= rm/hisilicon/hibmc/hibmc_drm_de.c
index 843d784..675d629 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
@@ -242,6 +242,24 @@ static void hibmc_crtc_atomic_disable(struct drm_crtc = *crtc,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 hibmc_set_current_gate(priv, reg);
=C2=A0}

+static enum drm_mode_status hibmc_crtc_mode_valid(struct drm_crtc *crtc, +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0const str= uct drm_display_mode *mode)
+{
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int i =3D 0;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int vrefresh =3D drm_mode_vrefresh(mode);
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (vrefresh < 59 || vrefresh > 61)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return MODE_NOCLOCK= ;
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0for (i =3D 0; i < ARRAY_SIZE(hibmc_pll_table= ); i++) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (hibmc_pll_table= [i].hdisplay =3D=3D mode->hdisplay &&
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0hibmc_pll_table[i].vdisplay =3D=3D mode->vdisplay)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0return MODE_OK;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return MODE_BAD;
+}
+
=C2=A0static unsigned int format_pll_reg(void)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned int pllreg =3D 0;
@@ -510,6 +528,7 @@ static const struct drm_crtc_helper_funcs hibmc_crtc_he= lper_funcs =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .atomic_flush=C2=A0 =C2=A0=3D hibmc_crtc_atomic= _flush,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .atomic_enable=C2=A0 =3D hibmc_crtc_atomic_enab= le,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .atomic_disable =3D hibmc_crtc_atomic_disable,<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0.mode_valid =3D hibmc_crtc_mode_valid,
=C2=A0};

=C2=A0int hibmc_de_init(struct hibmc_drm_private *priv)
--
2.7.4

--0000000000001f8dbb059f875636-- --===============1070386407== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1070386407==--