From: Laurent Pinchart <laurent.pinchart@ideasonboard•com>
To: Sam Ravnborg <sam@ravnborg•org>
Cc: Neil Armstrong <narmstrong@baylibre•com>,
David Airlie <airlied@linux•ie>,
Linus Walleij <linus.walleij@linaro•org>,
dri-devel@lists•freedesktop.org,
Andrzej Hajda <a.hajda@samsung•com>,
Thierry Reding <thierry.reding@gmail•com>,
Benjamin Gaignard <benjamin.gaignard@linaro•org>,
Fabio Estevam <festevam@gmail•com>, Marek Vasut <marex@denx•de>,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard•com>,
Joonyoung Shim <jy0922.shim@samsung•com>,
Vincent Abriou <vincent.abriou@st•com>,
Krzysztof Kozlowski <krzk@kernel•org>,
Jonathan Hunter <jonathanh@nvidia•com>,
Maxime Ripard <maxime.ripard@bootlin•com>,
Kukjin Kim <kgene@kernel•org>,
linux-arm-kernel@lists•infradead.org,
Philipp Zabel <p.zabel@pengutronix•de>,
NXP Linux Team <linux-imx@nxp•com>,
Pengutronix Kernel Team <kernel@pengutronix•de>,
Jonas Karlman <jonas@kwiboo•se>,
Sascha Hauer <s.hauer@pengutronix•de>,
Alison Wang <alison.wang@nxp•com>,
Maarten Lankhorst <maarten.lankhorst@linux•intel.com>,
Gwan-gyeong Mun <gwan-gyeong.mun@intel•com>,
Inki Dae <inki.dae@samsung•com>,
Alexios Zavras <alexios.zavras@intel•com>,
linux-samsung-soc@vger•kernel.org, Stefan Agner <stefan@agner•ch>,
linux-tegra@vger•kernel.org, Thomas Gleixner <tglx@linutronix•de>,
Sean Paul <sean@poorly•run>, Allison Randal <allison@lohutok•net>,
Jernej Skrabec <jernej.skrabec@siol•net>,
Shawn Guo <shawnguo@kernel•org>,
Seung-Woo Kim <sw0312.kim@samsung•com>,
Kyungmin Park <kyungmin.park@samsung•com>,
Daniel Vetter <daniel@ffwll•ch>, Enrico Weigelt <info@metux•net>
Subject: Re: [PATCH v1 16/16] drm/panel: simple: use drm_panel infrastructure
Date: Mon, 5 Aug 2019 14:12:08 +0300 [thread overview]
Message-ID: <20190805111208.GK29747@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20190804201637.1240-17-sam@ravnborg.org>
Hi Sam,
Thank you for the patch.
On Sun, Aug 04, 2019 at 10:16:37PM +0200, Sam Ravnborg wrote:
> Use drm_panel infrastrucute:
> - drm_panel has guards for calling disable/enable twice
As stated in the review of the corresponding patch, I think those checks
should be dropped, but not moved to the panel core.
> - drm_panel has backlight support
This answers my first question in the review of 15/16 :-)
> To use the drm_panel infrastructure use the drm_panel_*
> variants for prepare/enable/disable/unprepare.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg•org>
> Cc: Thierry Reding <thierry.reding@gmail•com>
> Cc: Sam Ravnborg <sam@ravnborg•org>
The change looks good overall,
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard•com>
but this is pending an agreement on what to do with the multiple
prepare/enable guards.
> ---
> drivers/gpu/drm/panel/panel-simple.c | 73 +++++-----------------------
> 1 file changed, 11 insertions(+), 62 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index bff7578f84dd..c7eed34f2c9c 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -21,7 +21,6 @@
> * DEALINGS IN THE SOFTWARE.
> */
>
> -#include <linux/backlight.h>
> #include <linux/delay.h>
> #include <linux/gpio/consumer.h>
> #include <linux/module.h>
> @@ -98,13 +97,10 @@ struct panel_desc {
>
> struct panel_simple {
> struct drm_panel base;
> - bool prepared;
> - bool enabled;
> bool no_hpd;
>
> const struct panel_desc *desc;
>
> - struct backlight_device *backlight;
> struct regulator *supply;
> struct i2c_adapter *ddc;
>
> @@ -232,20 +228,9 @@ static int panel_simple_disable(struct drm_panel *panel)
> {
> struct panel_simple *p = to_panel_simple(panel);
>
> - if (!p->enabled)
> - return 0;
> -
> - if (p->backlight) {
> - p->backlight->props.power = FB_BLANK_POWERDOWN;
> - p->backlight->props.state |= BL_CORE_FBBLANK;
> - backlight_update_status(p->backlight);
> - }
> -
> if (p->desc->delay.disable)
> msleep(p->desc->delay.disable);
>
> - p->enabled = false;
> -
> return 0;
> }
>
> @@ -253,9 +238,6 @@ static int panel_simple_unprepare(struct drm_panel *panel)
> {
> struct panel_simple *p = to_panel_simple(panel);
>
> - if (!p->prepared)
> - return 0;
> -
> gpiod_set_value_cansleep(p->enable_gpio, 0);
>
> regulator_disable(p->supply);
> @@ -263,8 +245,6 @@ static int panel_simple_unprepare(struct drm_panel *panel)
> if (p->desc->delay.unprepare)
> msleep(p->desc->delay.unprepare);
>
> - p->prepared = false;
> -
> return 0;
> }
>
> @@ -274,9 +254,6 @@ static int panel_simple_prepare(struct drm_panel *panel)
> unsigned int delay;
> int err;
>
> - if (p->prepared)
> - return 0;
> -
> err = regulator_enable(p->supply);
> if (err < 0) {
> dev_err(panel->dev, "failed to enable supply: %d\n", err);
> @@ -291,8 +268,6 @@ static int panel_simple_prepare(struct drm_panel *panel)
> if (delay)
> msleep(delay);
>
> - p->prepared = true;
> -
> return 0;
> }
>
> @@ -300,20 +275,9 @@ static int panel_simple_enable(struct drm_panel *panel)
> {
> struct panel_simple *p = to_panel_simple(panel);
>
> - if (p->enabled)
> - return 0;
> -
> if (p->desc->delay.enable)
> msleep(p->desc->delay.enable);
>
> - if (p->backlight) {
> - p->backlight->props.state &= ~BL_CORE_FBBLANK;
> - p->backlight->props.power = FB_BLANK_UNBLANK;
> - backlight_update_status(p->backlight);
> - }
> -
> - p->enabled = true;
> -
> return 0;
> }
>
> @@ -413,7 +377,7 @@ static void panel_simple_parse_panel_timing_node(struct device *dev,
>
> static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
> {
> - struct device_node *backlight, *ddc;
> + struct device_node *ddc;
> struct panel_simple *panel;
> struct display_timing dt;
> int err;
> @@ -422,8 +386,6 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
> if (!panel)
> return -ENOMEM;
>
> - panel->enabled = false;
> - panel->prepared = false;
> panel->desc = desc;
>
> panel->no_hpd = of_property_read_bool(dev->of_node, "no-hpd");
> @@ -441,24 +403,13 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
> return err;
> }
>
> - backlight = of_parse_phandle(dev->of_node, "backlight", 0);
> - if (backlight) {
> - panel->backlight = of_find_backlight_by_node(backlight);
> - of_node_put(backlight);
> -
> - if (!panel->backlight)
> - return -EPROBE_DEFER;
> - }
> -
> ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
> if (ddc) {
> panel->ddc = of_find_i2c_adapter_by_node(ddc);
> of_node_put(ddc);
>
> - if (!panel->ddc) {
> - err = -EPROBE_DEFER;
> - goto free_backlight;
> - }
> + if (!panel->ddc)
> + return -EPROBE_DEFER;
> }
>
> if (!of_get_display_timing(dev->of_node, "panel-timing", &dt))
> @@ -468,6 +419,10 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
> panel->base.dev = dev;
> panel->base.funcs = &panel_simple_funcs;
>
> + err = drm_panel_of_backlight(&panel->base);
> + if (err)
> + goto free_ddc;
> +
> err = drm_panel_add(&panel->base);
> if (err < 0)
> goto free_ddc;
> @@ -479,9 +434,6 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
> free_ddc:
> if (panel->ddc)
> put_device(&panel->ddc->dev);
> -free_backlight:
> - if (panel->backlight)
> - put_device(&panel->backlight->dev);
This looks weird, where
>
> return err;
> }
> @@ -492,15 +444,12 @@ static int panel_simple_remove(struct device *dev)
>
> drm_panel_remove(&panel->base);
>
> - panel_simple_disable(&panel->base);
> - panel_simple_unprepare(&panel->base);
> + drm_panel_disable(&panel->base);
> + drm_panel_unprepare(&panel->base);
>
> if (panel->ddc)
> put_device(&panel->ddc->dev);
>
> - if (panel->backlight)
> - put_device(&panel->backlight->dev);
> -
> return 0;
> }
>
> @@ -508,8 +457,8 @@ static void panel_simple_shutdown(struct device *dev)
> {
> struct panel_simple *panel = dev_get_drvdata(dev);
>
> - panel_simple_disable(&panel->base);
> - panel_simple_unprepare(&panel->base);
> + drm_panel_disable(&panel->base);
> + drm_panel_unprepare(&panel->base);
> }
>
> static const struct drm_display_mode ampire_am_480272h3tmqw_t01h_mode = {
--
Regards,
Laurent Pinchart
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-08-05 11:12 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-04 20:16 [PATCH v1 0/16] drm: panel related updates Sam Ravnborg
2019-08-04 20:16 ` [PATCH v1 01/16] drm/bridge: tc358767: fix opencoded use of drm_panel_* Sam Ravnborg
2019-08-05 9:35 ` Philipp Zabel
2019-08-05 11:53 ` Sam Ravnborg
2019-08-04 20:16 ` [PATCH v1 02/16] drm/exynos: " Sam Ravnborg
2019-12-01 11:32 ` Sam Ravnborg
2019-08-04 20:16 ` [PATCH v1 03/16] " Sam Ravnborg
2019-12-01 11:32 ` Sam Ravnborg
2019-08-04 20:16 ` [PATCH v1 04/16] drm/imx: " Sam Ravnborg
2019-08-05 9:34 ` Philipp Zabel
2019-08-04 20:16 ` [PATCH v1 05/16] drm/fsl-dcu: " Sam Ravnborg
2019-08-05 9:16 ` Stefan Agner
2019-08-05 11:54 ` Sam Ravnborg
2019-08-04 20:16 ` [PATCH v1 06/16] drm/msm: " Sam Ravnborg
2019-12-01 11:33 ` Sam Ravnborg
2019-08-04 20:16 ` [PATCH v1 07/16] drm/mxsfb: " Sam Ravnborg
2019-08-05 9:20 ` Stefan Agner
2019-08-04 20:16 ` [PATCH v1 08/16] drm/sti: " Sam Ravnborg
2019-08-07 11:55 ` Benjamin Gaignard
2019-08-04 20:16 ` [PATCH v1 09/16] drm/tegra: " Sam Ravnborg
2019-12-01 11:33 ` Sam Ravnborg
2019-08-04 20:16 ` [PATCH v1 10/16] drm/panel: ili9322: move bus_flags to get_modes() Sam Ravnborg
2019-08-06 12:56 ` Linus Walleij
2019-08-04 20:16 ` [PATCH v1 11/16] drm/panel: move drm_panel functions to .c file Sam Ravnborg
2019-08-05 10:45 ` Laurent Pinchart
2019-08-04 20:16 ` [PATCH v1 12/16] drm/panel: use inline comments in drm_panel.h Sam Ravnborg
2019-08-05 10:54 ` Laurent Pinchart
2019-08-04 20:16 ` [PATCH v1 13/16] drm/panel: drop return code from drm_panel_detach() Sam Ravnborg
2019-08-05 10:56 ` Laurent Pinchart
2019-08-04 20:16 ` [PATCH v1 14/16] drm/panel: call prepare/enable only once Sam Ravnborg
2019-08-05 10:59 ` Laurent Pinchart
2019-08-05 13:15 ` Emil Velikov
2019-08-05 16:51 ` Sam Ravnborg
2019-12-02 15:22 ` Laurent Pinchart
2019-08-05 17:01 ` Sean Paul
2019-12-02 15:15 ` Laurent Pinchart
2019-08-04 20:16 ` [PATCH v1 15/16] drm/panel: add backlight support Sam Ravnborg
2019-08-05 11:04 ` Laurent Pinchart
2019-08-04 20:16 ` [PATCH v1 16/16] drm/panel: simple: use drm_panel infrastructure Sam Ravnborg
2019-08-05 11:12 ` Laurent Pinchart [this message]
2019-08-05 13:18 ` [PATCH v1 0/16] drm: panel related updates Emil Velikov
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=20190805111208.GK29747@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard$(echo .)com \
--cc=a.hajda@samsung$(echo .)com \
--cc=airlied@linux$(echo .)ie \
--cc=alexios.zavras@intel$(echo .)com \
--cc=alison.wang@nxp$(echo .)com \
--cc=allison@lohutok$(echo .)net \
--cc=benjamin.gaignard@linaro$(echo .)org \
--cc=daniel@ffwll$(echo .)ch \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=festevam@gmail$(echo .)com \
--cc=gwan-gyeong.mun@intel$(echo .)com \
--cc=info@metux$(echo .)net \
--cc=inki.dae@samsung$(echo .)com \
--cc=jernej.skrabec@siol$(echo .)net \
--cc=jonas@kwiboo$(echo .)se \
--cc=jonathanh@nvidia$(echo .)com \
--cc=jy0922.shim@samsung$(echo .)com \
--cc=kernel@pengutronix$(echo .)de \
--cc=kgene@kernel$(echo .)org \
--cc=krzk@kernel$(echo .)org \
--cc=kyungmin.park@samsung$(echo .)com \
--cc=laurent.pinchart+renesas@ideasonboard$(echo .)com \
--cc=linus.walleij@linaro$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-imx@nxp$(echo .)com \
--cc=linux-samsung-soc@vger$(echo .)kernel.org \
--cc=linux-tegra@vger$(echo .)kernel.org \
--cc=maarten.lankhorst@linux$(echo .)intel.com \
--cc=marex@denx$(echo .)de \
--cc=maxime.ripard@bootlin$(echo .)com \
--cc=narmstrong@baylibre$(echo .)com \
--cc=p.zabel@pengutronix$(echo .)de \
--cc=s.hauer@pengutronix$(echo .)de \
--cc=sam@ravnborg$(echo .)org \
--cc=sean@poorly$(echo .)run \
--cc=shawnguo@kernel$(echo .)org \
--cc=stefan@agner$(echo .)ch \
--cc=sw0312.kim@samsung$(echo .)com \
--cc=tglx@linutronix$(echo .)de \
--cc=thierry.reding@gmail$(echo .)com \
--cc=vincent.abriou@st$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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