From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Peter Rosin <peda@axentia.se>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
David Airlie <airlied@linux.ie>, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Archit Taneja <architt@codeaurora.org>,
Andrzej Hajda <a.hajda@samsung.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v3 5/5] drm/bridge: lvds-encoder: add powerdown-gpios support
Date: Tue, 22 Jan 2019 23:01:59 +0200 [thread overview]
Message-ID: <20190122210159.GI3264@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20181229070649.21308-6-peda@axentia.se>
Hi Peter,
Thank you for the patch.
On Sat, Dec 29, 2018 at 07:07:43AM +0000, Peter Rosin wrote:
> Optionally power down the LVDS-encoder when it is not in use.
>
> Signed-off-by: Peter Rosin <peda@axentia.se>
As the powerdown-gpios property is only defined for two encoders, and
both of them should work well with this code, I think the change is
fine. In the future if different power-up/down sequences need to be
implemented for different devices this will need to be made
device-specific.
> ---
> drivers/gpu/drm/bridge/lvds-encoder.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c b/drivers/gpu/drm/bridge/lvds-encoder.c
> index f6770e83d49d..36d8557bc097 100644
> --- a/drivers/gpu/drm/bridge/lvds-encoder.c
> +++ b/drivers/gpu/drm/bridge/lvds-encoder.c
> @@ -11,11 +11,13 @@
> #include <drm/drm_bridge.h>
> #include <drm/drm_panel.h>
>
> +#include <linux/gpio/consumer.h>
> #include <linux/of_graph.h>
>
> struct lvds_encoder {
> struct drm_bridge bridge;
> struct drm_bridge *panel_bridge;
> + struct gpio_desc *powerdown_gpio;
> };
>
> static int lvds_encoder_attach(struct drm_bridge *bridge)
> @@ -28,8 +30,30 @@ static int lvds_encoder_attach(struct drm_bridge *bridge)
> bridge);
> }
>
> +static void lvds_encoder_enable(struct drm_bridge *bridge)
> +{
> + struct lvds_encoder *lvds_encoder = container_of(bridge,
> + struct lvds_encoder,
> + bridge);
> +
> + if (lvds_encoder->powerdown_gpio)
> + gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 0);
gpiod_set_value_cansleep() already contains a NULL check, so you can
drop it from here.
> +}
> +
> +static void lvds_encoder_disable(struct drm_bridge *bridge)
> +{
> + struct lvds_encoder *lvds_encoder = container_of(bridge,
> + struct lvds_encoder,
> + bridge);
> +
> + if (lvds_encoder->powerdown_gpio)
> + gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 1);
Same here.
> +}
> +
> static struct drm_bridge_funcs funcs = {
While at it, could you make this const ?
With these fixed,
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> .attach = lvds_encoder_attach,
> + .enable = lvds_encoder_enable,
> + .disable = lvds_encoder_disable,
> };
>
> static int lvds_encoder_probe(struct platform_device *pdev)
> @@ -45,6 +69,16 @@ static int lvds_encoder_probe(struct platform_device *pdev)
> if (!lvds_encoder)
> return -ENOMEM;
>
> + lvds_encoder->powerdown_gpio = devm_gpiod_get_optional(dev, "powerdown",
> + GPIOD_OUT_HIGH);
> + if (IS_ERR(lvds_encoder->powerdown_gpio)) {
> + int err = PTR_ERR(lvds_encoder->powerdown_gpio);
> +
> + if (err != -EPROBE_DEFER)
> + dev_err(dev, "powerdown GPIO failure: %d\n", err);
> + return err;
> + }
> +
> /* Locate the panel DT node. */
> port = of_graph_get_port_by_id(dev->of_node, 1);
> if (!port) {
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2019-01-22 21:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-29 7:07 [PATCH v3 0/5] drm/bridge: various small lvds-encoder things Peter Rosin
2018-12-29 7:07 ` [PATCH v3 1/5] dt-bindings: display: bridge: fork out ti,ds90c185 from lvds-transmitter Peter Rosin
2019-01-11 14:49 ` Rob Herring
2019-01-11 14:49 ` Rob Herring
2019-01-22 20:53 ` Laurent Pinchart
2018-12-29 7:07 ` [PATCH v3 2/5] dt-bindings: display: bridge: lvds-transmitter: cleanup example Peter Rosin
2019-01-22 20:45 ` Laurent Pinchart
2018-12-29 7:07 ` [PATCH v3 3/5] dt-bindings: display: bridge: thc63lvdm83d: use standard powerdown-gpios Peter Rosin
2019-01-11 14:49 ` Rob Herring
2019-01-11 14:49 ` Rob Herring
2019-01-22 20:54 ` Laurent Pinchart
2018-12-29 7:07 ` [PATCH v3 4/5] drm/bridge: lvds-encoder: add dev helper variable in .probe() Peter Rosin
2019-01-22 20:55 ` Laurent Pinchart
2018-12-29 7:07 ` [PATCH v3 5/5] drm/bridge: lvds-encoder: add powerdown-gpios support Peter Rosin
2019-01-22 21:01 ` Laurent Pinchart [this message]
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=20190122210159.GI3264@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=a.hajda@samsung.com \
--cc=airlied@linux.ie \
--cc=architt@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=peda@axentia.se \
--cc=robh+dt@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.