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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0753C433F5 for ; Wed, 2 Mar 2022 11:22:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241313AbiCBLXJ convert rfc822-to-8bit (ORCPT ); Wed, 2 Mar 2022 06:23:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241411AbiCBLWy (ORCPT ); Wed, 2 Mar 2022 06:22:54 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB3487657; Wed, 2 Mar 2022 03:22:11 -0800 (PST) Date: Wed, 02 Mar 2022 10:40:07 +0000 From: Paul Cercueil Subject: Re: [PATCH v1 3/3] drm/panel : innolux-ej030na and abt-y030xx067a : add .enable and .disable To: Christophe Branchereau Cc: David Airlie , Daniel Vetter , Thierry Reding , Sam Ravnborg , linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, dri-devel@lists.freedesktop.org Message-Id: In-Reply-To: <20220301153122.20660-4-cbranchereau@gmail.com> References: <20220301153122.20660-1-cbranchereau@gmail.com> <20220301153122.20660-4-cbranchereau@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christophe, Le mar., mars 1 2022 at 16:31:22 +0100, Christophe Branchereau a écrit : > Following the introduction of bridge_atomic_enable in the ingenic > drm driver, the crtc is enabled between .prepare and .enable, if > it exists. > > Add it so the backlight is only enabled after the crtc is, to avoid > graphical issues. > > Signed-off-by: Christophe Branchereau > --- > drivers/gpu/drm/panel/panel-abt-y030xx067a.c | 23 ++++++++++++-- > drivers/gpu/drm/panel/panel-innolux-ej030na.c | 31 > ++++++++++++++++--- > 2 files changed, 48 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-abt-y030xx067a.c > b/drivers/gpu/drm/panel/panel-abt-y030xx067a.c > index f043b484055b..b5736344e3ec 100644 > --- a/drivers/gpu/drm/panel/panel-abt-y030xx067a.c > +++ b/drivers/gpu/drm/panel/panel-abt-y030xx067a.c > @@ -183,8 +183,6 @@ static int y030xx067a_prepare(struct drm_panel > *panel) > goto err_disable_regulator; > } > > - msleep(120); > - > return 0; > > err_disable_regulator: > @@ -202,6 +200,25 @@ static int y030xx067a_unprepare(struct drm_panel > *panel) > return 0; > } > > +static int y030xx067a_enable(struct drm_panel *panel) > +{ > + if (panel->backlight) { > + /* Wait for the picture to be ready before enabling backlight */ > + msleep(120); > + } > + > + return 0; > +} > + > +static int y030xx067a_disable(struct drm_panel *panel) > +{ > + struct y030xx067a *priv = to_y030xx067a(panel); > + > + regmap_clear_bits(priv->map, 0x06, REG06_XPSAVE); Shouldn't that be balanced by a regmap_set_bits() in the .enable() function? Cheers, -Paul > + > + return 0; > +} > + > static int y030xx067a_get_modes(struct drm_panel *panel, > struct drm_connector *connector) > { > @@ -239,6 +256,8 @@ static int y030xx067a_get_modes(struct drm_panel > *panel, > static const struct drm_panel_funcs y030xx067a_funcs = { > .prepare = y030xx067a_prepare, > .unprepare = y030xx067a_unprepare, > + .enable = y030xx067a_enable, > + .disable = y030xx067a_disable, > .get_modes = y030xx067a_get_modes, > }; > > diff --git a/drivers/gpu/drm/panel/panel-innolux-ej030na.c > b/drivers/gpu/drm/panel/panel-innolux-ej030na.c > index c558de3f99be..6de7370185cd 100644 > --- a/drivers/gpu/drm/panel/panel-innolux-ej030na.c > +++ b/drivers/gpu/drm/panel/panel-innolux-ej030na.c > @@ -80,8 +80,6 @@ static const struct reg_sequence > ej030na_init_sequence[] = { > { 0x47, 0x08 }, > { 0x48, 0x0f }, > { 0x49, 0x0f }, > - > - { 0x2b, 0x01 }, > }; > > static int ej030na_prepare(struct drm_panel *panel) > @@ -109,8 +107,6 @@ static int ej030na_prepare(struct drm_panel > *panel) > goto err_disable_regulator; > } > > - msleep(120); > - > return 0; > > err_disable_regulator: > @@ -128,6 +124,31 @@ static int ej030na_unprepare(struct drm_panel > *panel) > return 0; > } > > +static int ej030na_enable(struct drm_panel *panel) > +{ > + struct ej030na *priv = to_ej030na(panel); > + > + /* standby off */ > + regmap_write(priv->map, 0x2b, 0x01); > + > + if (panel->backlight) { > + /* Wait for the picture to be ready before enabling backlight */ > + msleep(120); > + } > + > + return 0; > +} > + > +static int ej030na_disable(struct drm_panel *panel) > +{ > + struct ej030na *priv = to_ej030na(panel); > + > + /* standby on */ > + regmap_write(priv->map, 0x2b, 0x00); > + > + return 0; > +} > + > static int ej030na_get_modes(struct drm_panel *panel, > struct drm_connector *connector) > { > @@ -165,6 +186,8 @@ static int ej030na_get_modes(struct drm_panel > *panel, > static const struct drm_panel_funcs ej030na_funcs = { > .prepare = ej030na_prepare, > .unprepare = ej030na_unprepare, > + .enable = ej030na_enable, > + .disable = ej030na_disable, > .get_modes = ej030na_get_modes, > }; > > -- > 2.34.1 > 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B91D0C433EF for ; Wed, 2 Mar 2022 11:22:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F01F610E904; Wed, 2 Mar 2022 11:22:13 +0000 (UTC) Received: from aposti.net (aposti.net [89.234.176.197]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BAE110E904 for ; Wed, 2 Mar 2022 11:22:12 +0000 (UTC) Date: Wed, 02 Mar 2022 10:40:07 +0000 From: Paul Cercueil Subject: Re: [PATCH v1 3/3] drm/panel : innolux-ej030na and abt-y030xx067a : add .enable and .disable To: Christophe Branchereau Message-Id: In-Reply-To: <20220301153122.20660-4-cbranchereau@gmail.com> References: <20220301153122.20660-1-cbranchereau@gmail.com> <20220301153122.20660-4-cbranchereau@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable 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: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, Thierry Reding , Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Christophe, Le mar., mars 1 2022 at 16:31:22 +0100, Christophe Branchereau=20 a =E9crit : > Following the introduction of bridge_atomic_enable in the ingenic > drm driver, the crtc is enabled between .prepare and .enable, if > it exists. >=20 > Add it so the backlight is only enabled after the crtc is, to avoid > graphical issues. >=20 > Signed-off-by: Christophe Branchereau > --- > drivers/gpu/drm/panel/panel-abt-y030xx067a.c | 23 ++++++++++++-- > drivers/gpu/drm/panel/panel-innolux-ej030na.c | 31=20 > ++++++++++++++++--- > 2 files changed, 48 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/gpu/drm/panel/panel-abt-y030xx067a.c=20 > b/drivers/gpu/drm/panel/panel-abt-y030xx067a.c > index f043b484055b..b5736344e3ec 100644 > --- a/drivers/gpu/drm/panel/panel-abt-y030xx067a.c > +++ b/drivers/gpu/drm/panel/panel-abt-y030xx067a.c > @@ -183,8 +183,6 @@ static int y030xx067a_prepare(struct drm_panel=20 > *panel) > goto err_disable_regulator; > } >=20 > - msleep(120); > - > return 0; >=20 > err_disable_regulator: > @@ -202,6 +200,25 @@ static int y030xx067a_unprepare(struct drm_panel=20 > *panel) > return 0; > } >=20 > +static int y030xx067a_enable(struct drm_panel *panel) > +{ > + if (panel->backlight) { > + /* Wait for the picture to be ready before enabling backlight */ > + msleep(120); > + } > + > + return 0; > +} > + > +static int y030xx067a_disable(struct drm_panel *panel) > +{ > + struct y030xx067a *priv =3D to_y030xx067a(panel); > + > + regmap_clear_bits(priv->map, 0x06, REG06_XPSAVE); Shouldn't that be balanced by a regmap_set_bits() in the .enable()=20 function? Cheers, -Paul > + > + return 0; > +} > + > static int y030xx067a_get_modes(struct drm_panel *panel, > struct drm_connector *connector) > { > @@ -239,6 +256,8 @@ static int y030xx067a_get_modes(struct drm_panel=20 > *panel, > static const struct drm_panel_funcs y030xx067a_funcs =3D { > .prepare =3D y030xx067a_prepare, > .unprepare =3D y030xx067a_unprepare, > + .enable =3D y030xx067a_enable, > + .disable =3D y030xx067a_disable, > .get_modes =3D y030xx067a_get_modes, > }; >=20 > diff --git a/drivers/gpu/drm/panel/panel-innolux-ej030na.c=20 > b/drivers/gpu/drm/panel/panel-innolux-ej030na.c > index c558de3f99be..6de7370185cd 100644 > --- a/drivers/gpu/drm/panel/panel-innolux-ej030na.c > +++ b/drivers/gpu/drm/panel/panel-innolux-ej030na.c > @@ -80,8 +80,6 @@ static const struct reg_sequence=20 > ej030na_init_sequence[] =3D { > { 0x47, 0x08 }, > { 0x48, 0x0f }, > { 0x49, 0x0f }, > - > - { 0x2b, 0x01 }, > }; >=20 > static int ej030na_prepare(struct drm_panel *panel) > @@ -109,8 +107,6 @@ static int ej030na_prepare(struct drm_panel=20 > *panel) > goto err_disable_regulator; > } >=20 > - msleep(120); > - > return 0; >=20 > err_disable_regulator: > @@ -128,6 +124,31 @@ static int ej030na_unprepare(struct drm_panel=20 > *panel) > return 0; > } >=20 > +static int ej030na_enable(struct drm_panel *panel) > +{ > + struct ej030na *priv =3D to_ej030na(panel); > + > + /* standby off */ > + regmap_write(priv->map, 0x2b, 0x01); > + > + if (panel->backlight) { > + /* Wait for the picture to be ready before enabling backlight */ > + msleep(120); > + } > + > + return 0; > +} > + > +static int ej030na_disable(struct drm_panel *panel) > +{ > + struct ej030na *priv =3D to_ej030na(panel); > + > + /* standby on */ > + regmap_write(priv->map, 0x2b, 0x00); > + > + return 0; > +} > + > static int ej030na_get_modes(struct drm_panel *panel, > struct drm_connector *connector) > { > @@ -165,6 +186,8 @@ static int ej030na_get_modes(struct drm_panel=20 > *panel, > static const struct drm_panel_funcs ej030na_funcs =3D { > .prepare =3D ej030na_prepare, > .unprepare =3D ej030na_unprepare, > + .enable =3D ej030na_enable, > + .disable =3D ej030na_disable, > .get_modes =3D ej030na_get_modes, > }; >=20 > -- > 2.34.1 >=20