From: Philippe Cornu <philippe.cornu@st.com>
To: Thierry Reding <thierry.reding@gmail.com>,
David Airlie <airlied@linux.ie>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Cc: Andrzej Hajda <a.hajda@samsung.com>,
Yannick Fertre <yannick.fertre@st.com>,
Philippe Cornu <philippe.cornu@st.com>,
"Benjamin Gaignard" <benjamin.gaignard@linaro.org>,
Vincent Abriou <vincent.abriou@st.com>,
Alexandre Torgue <alexandre.torgue@st.com>
Subject: [PATCH 4/4] drm/panel: otm8009a: use new backlight api
Date: Mon, 23 Apr 2018 16:10:53 +0200 [thread overview]
Message-ID: <20180423141054.13128-5-philippe.cornu@st.com> (raw)
In-Reply-To: <20180423141054.13128-1-philippe.cornu@st.com>
Use the new backlight api.
Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
---
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 26 ++++++++----------------
1 file changed, 9 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index 4c638b7b9943..c2a71bd17e08 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -260,11 +260,7 @@ static int otm8009a_disable(struct drm_panel *panel)
if (!ctx->enabled)
return 0; /* This is not an issue so we return 0 here */
- /* Power off the backlight. Note: end-user still controls brightness */
- ctx->bl_dev->props.power = FB_BLANK_POWERDOWN;
- ret = backlight_update_status(ctx->bl_dev);
- if (ret)
- return ret;
+ backlight_disable(ctx->bl_dev);
ret = mipi_dsi_dcs_set_display_off(dsi);
if (ret)
@@ -338,12 +334,7 @@ static int otm8009a_enable(struct drm_panel *panel)
if (ctx->enabled)
return 0;
- /*
- * Power on the backlight. Note: end-user still controls brightness
- * Note: ctx->prepared must be true before updating the backlight.
- */
- ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
- backlight_update_status(ctx->bl_dev);
+ backlight_enable(ctx->bl_dev);
ctx->enabled = true;
@@ -459,11 +450,14 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
ctx->panel.dev = dev;
ctx->panel.funcs = &otm8009a_drm_funcs;
- ctx->bl_dev = backlight_device_register(dev_name(dev), dev, ctx,
- &otm8009a_backlight_ops, NULL);
+ ctx->bl_dev = devm_backlight_device_register(dev, dev_name(dev),
+ dsi->host->dev, ctx,
+ &otm8009a_backlight_ops,
+ NULL);
if (IS_ERR(ctx->bl_dev)) {
- dev_err(dev, "failed to register backlight device\n");
- return PTR_ERR(ctx->bl_dev);
+ ret = PTR_ERR(ctx->bl_dev);
+ dev_err(dev, "failed to register backlight %d\n", ret);
+ return ret;
}
ctx->bl_dev->props.max_brightness = OTM8009A_BACKLIGHT_MAX;
@@ -491,8 +485,6 @@ static int otm8009a_remove(struct mipi_dsi_device *dsi)
mipi_dsi_detach(dsi);
drm_panel_remove(&ctx->panel);
- backlight_device_unregister(ctx->bl_dev);
-
return 0;
}
--
2.15.1
next prev parent reply other threads:[~2018-04-23 14:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-23 14:10 [PATCH 0/4] drm/panel: otm8009a: backlight fixes & improvements Philippe Cornu
2018-04-23 14:10 ` [PATCH 1/4] drm/panel: otm8009a: fix backlight updates Philippe Cornu
2018-05-14 8:36 ` Vincent ABRIOU
2018-04-23 14:10 ` [PATCH 2/4] drm/panel: otm8009a: fix glitches by moving backlight enable to otm8009a_enable() Philippe Cornu
2018-05-14 8:37 ` Vincent ABRIOU
2018-04-23 14:10 ` [PATCH 3/4] drm/panel: otm8009a: no message if probe success Philippe Cornu
2018-05-14 8:38 ` Vincent ABRIOU
2018-04-23 14:10 ` Philippe Cornu [this message]
2018-05-14 8:39 ` [PATCH 4/4] drm/panel: otm8009a: use new backlight api Vincent ABRIOU
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=20180423141054.13128-5-philippe.cornu@st.com \
--to=philippe.cornu@st.com \
--cc=a.hajda@samsung.com \
--cc=airlied@linux.ie \
--cc=alexandre.torgue@st.com \
--cc=benjamin.gaignard@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=vincent.abriou@st.com \
--cc=yannick.fertre@st.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
all inboxes | Powered by JetHome®