From: Robert Chiras <robert.chiras@nxp.com>
To: "festevam@gmail.com" <festevam@gmail.com>
Cc: dl-linux-imx <linux-imx@nxp.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"sam@ravnborg.org" <sam@ravnborg.org>,
"daniel@ffwll.ch" <daniel@ffwll.ch>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"thierry.reding@gmail.com" <thierry.reding@gmail.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"airlied@linux.ie" <airlied@linux.ie>
Subject: Re: [EXT] Re: [PATCH v3 2/2] drm/panel: Add support for Raydium RM67191 panel driver
Date: Mon, 24 Jun 2019 07:44:39 +0000 [thread overview]
Message-ID: <1561362278.9328.83.camel@nxp.com> (raw)
In-Reply-To: <CAOMZO5DS2v15h9E=qKg2vKuFkBSQQwdBHA5Th5mZ+ca6DWgQsw@mail.gmail.com>
Hi Fabio,
Thanks for your feedback. I will handle them all, but for the pm_ops I
have some comments. See inline.
On Vi, 2019-06-21 at 10:59 -0300, Fabio Estevam wrote:
> Hi Robert,
>
> On Thu, Jun 20, 2019 at 10:31 AM Robert Chiras <robert.chiras@nxp.com
> > wrote:
>
> >
> > +fail:
> > + if (rad->reset)
> > + gpiod_set_value_cansleep(rad->reset, 1);
> gpiod_set_value_cansleep() can handle NULL, so no need for the if()
> check.
>
> >
> > +static const struct display_timing rad_default_timing = {
> > + .pixelclock = { 132000000, 132000000, 132000000 },
> Having the same information listed three times does not seem useful.
>
> You could use a drm_display_mode structure with a single entry
> instead.
>
> >
> > + videomode_from_timing(&rad_default_timing, &panel->vm);
> > +
> > + of_property_read_u32(np, "width-mm", &panel->width_mm);
> > + of_property_read_u32(np, "height-mm", &panel->height_mm);
> > +
> > + panel->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
> Since this is optional it would be better to use
> devm_gpiod_get_optional() instead.
>
>
> >
> > +
> > + if (IS_ERR(panel->reset))
> > + panel->reset = NULL;
> > + else
> > + gpiod_set_value_cansleep(panel->reset, 1);
> This is not handling defer probing, so it would be better to do like
> this:
>
> panel->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
> if (IS_ERR(panel->reset))
> return PTR_ERR(panel->reset);
>
> >
> > + memset(&bl_props, 0, sizeof(bl_props));
> > + bl_props.type = BACKLIGHT_RAW;
> > + bl_props.brightness = 255;
> > + bl_props.max_brightness = 255;
> > +
> > + panel->backlight = devm_backlight_device_register(dev,
> > dev_name(dev),
> > + dev, dsi,
> > + &rad_bl_o
> > ps,
> > + &bl_props
> > );
> Could you put more parameters into the same line?
>
> Using 4 lines seems excessive.
>
> >
> > + if (IS_ERR(panel->backlight)) {
> > + ret = PTR_ERR(panel->backlight);
> > + dev_err(dev, "Failed to register backlight (%d)\n",
> > ret);
> > + return ret;
> > + }
> > +
> > + drm_panel_init(&panel->panel);
> > + panel->panel.funcs = &rad_panel_funcs;
> > + panel->panel.dev = dev;
> > + dev_set_drvdata(dev, panel);
> > +
> > + ret = drm_panel_add(&panel->panel);
> > +
> Unneeded blank line
>
> >
> > + if (ret < 0)
> > + return ret;
> > +
> > + ret = mipi_dsi_attach(dsi);
> > + if (ret < 0)
> > + drm_panel_remove(&panel->panel);
> > +
> > + return ret;
> You did not handle the "power" regulator.
There is no need for a power regulator.
>
> >
> > +static int __maybe_unused rad_panel_suspend(struct device *dev)
> > +{
> > + struct rad_panel *rad = dev_get_drvdata(dev);
> > +
> > + if (!rad->reset)
> > + return 0;
> > +
> > + devm_gpiod_put(dev, rad->reset);
> > + rad->reset = NULL;
> > +
> > + return 0;
> > +}
> > +
> > +static int __maybe_unused rad_panel_resume(struct device *dev)
> > +{
> > + struct rad_panel *rad = dev_get_drvdata(dev);
> > +
> > + if (rad->reset)
> > + return 0;
> > +
> > + rad->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
> Why do you call devm_gpiod_get() once again?
>
> I am having a hard time to understand the need for this
> suspend/resume hooks.
>
> Can't you simply remove them?
The reset gpio pin is shared between the DSI display controller and
touch controller, both found on the same panel. Since, the touch driver
also acceses this gpio pin, in some cases the display can be put to
sleep, but the touch is still active. This is why, during suspend I
release the gpio resource, and I have to take it back in resume.
Without this release/acquire mechanism during suspend/resume, stress-
tests showed some failures: the resume freezes completly.
next prev parent reply other threads:[~2019-06-24 7:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 13:30 [PATCH v3 0/2] Add DSI panel driver for Raydium RM67191 Robert Chiras
2019-06-20 13:30 ` [PATCH v3 1/2] dt-bindings: display: panel: Add support for Raydium RM67191 panel Robert Chiras
2019-06-21 14:00 ` Fabio Estevam
2019-06-21 14:16 ` [EXT] " Robert Chiras
2019-06-21 15:46 ` Fabio Estevam
2019-06-24 7:48 ` Robert Chiras
2019-06-20 13:30 ` [PATCH v3 2/2] drm/panel: Add support for Raydium RM67191 panel driver Robert Chiras
2019-06-21 13:59 ` Fabio Estevam
2019-06-24 7:44 ` Robert Chiras [this message]
2019-06-24 16:12 ` [EXT] " Fabio Estevam
2019-06-25 6:35 ` Robert Chiras
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=1561362278.9328.83.camel@nxp.com \
--to=robert.chiras@nxp.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=festevam@gmail.com \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=sam@ravnborg.org \
--cc=thierry.reding@gmail.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;
as well as URLs for NNTP newsgroup(s).