From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>,
Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Archit Taneja <archit@ti.com>,
linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 3/3] OMAPDSS: Panel NEC: Only register backlight when we have valid callback
Date: Wed, 16 Jan 2013 12:45:09 +0000 [thread overview]
Message-ID: <1358340309-8774-4-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1358340309-8774-1-git-send-email-peter.ujfalusi@ti.com>
Do not register a backlight device when the dssdev->set_backlight callback
is not set by the board.
In this case either we do not have means to control the backlight or the
board is using other means to control it, like bl-pwm.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
.../omap2/displays/panel-nec-nl8048hl11-01b.c | 60 ++++++++++++----------
1 file changed, 33 insertions(+), 27 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
index e6589fe..11302b2 100644
--- a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
+++ b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
@@ -85,9 +85,6 @@ static int nec_8048_bl_update_status(struct backlight_device *bl)
struct omap_dss_device *dssdev = dev_get_drvdata(&bl->dev);
int level;
- if (!dssdev->set_backlight)
- return -EINVAL;
-
if (bl->props.fb_blank = FB_BLANK_UNBLANK &&
bl->props.power = FB_BLANK_UNBLANK)
level = bl->props.brightness;
@@ -114,30 +111,33 @@ static const struct backlight_ops nec_8048_bl_ops = {
static int nec_8048_panel_probe(struct omap_dss_device *dssdev)
{
struct backlight_device *bl;
- struct backlight_properties props;
int r;
dssdev->panel.timings = nec_8048_panel_timings;
- memset(&props, 0, sizeof(struct backlight_properties));
- props.max_brightness = 255;
- props.type = BACKLIGHT_RAW;
+ if (dssdev->set_backlight) {
+ struct backlight_properties props;
+
+ memset(&props, 0, sizeof(struct backlight_properties));
+ props.max_brightness = 255;
+ props.type = BACKLIGHT_RAW;
- bl = backlight_device_register("nec-8048", &dssdev->dev, dssdev,
- &nec_8048_bl_ops, &props);
- if (IS_ERR(bl))
- return PTR_ERR(bl);
+ bl = backlight_device_register("nec-8048", &dssdev->dev, dssdev,
+ &nec_8048_bl_ops, &props);
+ if (IS_ERR(bl))
+ return PTR_ERR(bl);
- dev_set_drvdata(&dssdev->dev, bl);
+ dev_set_drvdata(&dssdev->dev, bl);
- bl->props.fb_blank = FB_BLANK_UNBLANK;
- bl->props.power = FB_BLANK_UNBLANK;
- bl->props.max_brightness = dssdev->max_backlight_level;
- bl->props.brightness = dssdev->max_backlight_level;
+ bl->props.fb_blank = FB_BLANK_UNBLANK;
+ bl->props.power = FB_BLANK_UNBLANK;
+ bl->props.max_brightness = dssdev->max_backlight_level;
+ bl->props.brightness = dssdev->max_backlight_level;
- r = nec_8048_bl_update_status(bl);
- if (r < 0)
- dev_err(&dssdev->dev, "failed to set lcd brightness\n");
+ r = nec_8048_bl_update_status(bl);
+ if (r < 0)
+ dev_err(&dssdev->dev, "failed to set lcd brightness\n");
+ }
return 0;
}
@@ -146,9 +146,11 @@ static void nec_8048_panel_remove(struct omap_dss_device *dssdev)
{
struct backlight_device *bl = dev_get_drvdata(&dssdev->dev);
- bl->props.power = FB_BLANK_POWERDOWN;
- nec_8048_bl_update_status(bl);
- backlight_device_unregister(bl);
+ if (bl) {
+ bl->props.power = FB_BLANK_POWERDOWN;
+ nec_8048_bl_update_status(bl);
+ backlight_device_unregister(bl);
+ }
}
static int nec_8048_panel_power_on(struct omap_dss_device *dssdev)
@@ -172,9 +174,11 @@ static int nec_8048_panel_power_on(struct omap_dss_device *dssdev)
goto err1;
}
- r = nec_8048_bl_update_status(bl);
- if (r < 0)
- dev_err(&dssdev->dev, "failed to set lcd brightness\n");
+ if (bl) {
+ r = nec_8048_bl_update_status(bl);
+ if (r < 0)
+ dev_err(&dssdev->dev, "failed to set lcd brightness\n");
+ }
return 0;
err1:
@@ -190,8 +194,10 @@ static void nec_8048_panel_power_off(struct omap_dss_device *dssdev)
if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
return;
- bl->props.brightness = 0;
- nec_8048_bl_update_status(bl);
+ if (bl) {
+ bl->props.brightness = 0;
+ nec_8048_bl_update_status(bl);
+ }
if (dssdev->platform_disable)
dssdev->platform_disable(dssdev);
--
1.8.1
prev parent reply other threads:[~2013-01-16 12:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 12:45 [PATCH 0/3] OMAPDSS: Panel NEC: backlight handling changes Peter Ujfalusi
2013-01-16 12:45 ` [PATCH 1/3] OMAPDSS: Panel NEC: Set backlight type to remove boot time warning Peter Ujfalusi
2013-01-16 12:45 ` [PATCH 2/3] OMAPDSS: Panel NEC: Get rid of nec_80848_data structure Peter Ujfalusi
2013-01-16 12:45 ` Peter Ujfalusi [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=1358340309-8774-4-git-send-email-peter.ujfalusi@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=FlorianSchandinat@gmx.de \
--cc=akpm@linux-foundation.org \
--cc=archit@ti.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=tomi.valkeinen@ti.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).