linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] OMAPDSS: Panel NEC: backlight handling changes
@ 2013-01-16 12:45 Peter Ujfalusi
  2013-01-16 12:45 ` [PATCH 1/3] OMAPDSS: Panel NEC: Set backlight type to remove boot time warning Peter Ujfalusi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Ujfalusi @ 2013-01-16 12:45 UTC (permalink / raw)
  To: Tomi Valkeinen, Florian Tobias Schandinat
  Cc: Archit Taneja, linux-omap, linux-fbdev, linux-kernel,
	Andrew Morton

Hi Tomi,

While working with Zoom2 which is using the NEC panel I noticed few issues with
the panel driver.
The first patch fixes one irritating warning print every time I boot the board.
With the third patch we can cleanly move to bl-pwm driver to handle the
backlight on Zoom2. In this case we should not register another backlight device
in the NEC panel driver.

Regards,
Peter
---
Peter Ujfalusi (3):
  OMAPDSS: Panel NEC: Set backlight type to remove boot time warning
  OMAPDSS: Panel NEC: Get rid of nec_80848_data structure
  OMAPDSS: Panel NEC: Only register backlight when we have valid
    callback

 .../omap2/displays/panel-nec-nl8048hl11-01b.c      | 81 ++++++++++------------
 1 file changed, 35 insertions(+), 46 deletions(-)

-- 
1.8.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] OMAPDSS: Panel NEC: Set backlight type to remove boot time warning
  2013-01-16 12:45 [PATCH 0/3] OMAPDSS: Panel NEC: backlight handling changes Peter Ujfalusi
@ 2013-01-16 12:45 ` 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 ` [PATCH 3/3] OMAPDSS: Panel NEC: Only register backlight when we have valid callback Peter Ujfalusi
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Ujfalusi @ 2013-01-16 12:45 UTC (permalink / raw)
  To: Tomi Valkeinen, Florian Tobias Schandinat
  Cc: Archit Taneja, linux-omap, linux-fbdev, linux-kernel,
	Andrew Morton

Fixes the following boot time warning:
[    2.230865] WARNING: at drivers/video/backlight/backlight.c:315 backlight_device_register+0x184/0x1f4()
[    2.240386] nec-8048: invalid backlight type

We need to pass valid backlight type when the device is registered.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
index c4e9c2b..f43a343 100644
--- a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
+++ b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
@@ -132,6 +132,7 @@ static int nec_8048_panel_probe(struct omap_dss_device *dssdev)
 
 	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);
-- 
1.8.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] OMAPDSS: Panel NEC: Get rid of nec_80848_data structure
  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 ` Peter Ujfalusi
  2013-01-16 12:45 ` [PATCH 3/3] OMAPDSS: Panel NEC: Only register backlight when we have valid callback Peter Ujfalusi
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Ujfalusi @ 2013-01-16 12:45 UTC (permalink / raw)
  To: Tomi Valkeinen, Florian Tobias Schandinat
  Cc: Archit Taneja, linux-omap, linux-fbdev, linux-kernel,
	Andrew Morton

It has only a pointer to the backlight_device in it. We can just add the
pointer to the backlight_device as driver data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 .../omap2/displays/panel-nec-nl8048hl11-01b.c      | 32 +++++-----------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
index f43a343..e6589fe 100644
--- a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
+++ b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
@@ -32,10 +32,6 @@
  */
 #define LCD_PIXEL_CLOCK		23800
 
-struct nec_8048_data {
-	struct backlight_device *bl;
-};
-
 static const struct {
 	unsigned char addr;
 	unsigned char dat;
@@ -118,30 +114,21 @@ 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 nec_8048_data *necd;
 	struct backlight_properties props;
 	int r;
 
 	dssdev->panel.timings = nec_8048_panel_timings;
 
-	necd = kzalloc(sizeof(*necd), GFP_KERNEL);
-	if (!necd)
-		return -ENOMEM;
-
-	dev_set_drvdata(&dssdev->dev, necd);
-
 	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)) {
-		r = PTR_ERR(bl);
-		kfree(necd);
-		return r;
-	}
-	necd->bl = bl;
+	if (IS_ERR(bl))
+		return PTR_ERR(bl);
+
+	dev_set_drvdata(&dssdev->dev, bl);
 
 	bl->props.fb_blank = FB_BLANK_UNBLANK;
 	bl->props.power = FB_BLANK_UNBLANK;
@@ -157,21 +144,17 @@ static int nec_8048_panel_probe(struct omap_dss_device *dssdev)
 
 static void nec_8048_panel_remove(struct omap_dss_device *dssdev)
 {
-	struct nec_8048_data *necd = dev_get_drvdata(&dssdev->dev);
-	struct backlight_device *bl = necd->bl;
+	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);
-
-	kfree(necd);
 }
 
 static int nec_8048_panel_power_on(struct omap_dss_device *dssdev)
 {
+	struct backlight_device *bl = dev_get_drvdata(&dssdev->dev);
 	int r;
-	struct nec_8048_data *necd = dev_get_drvdata(&dssdev->dev);
-	struct backlight_device *bl = necd->bl;
 
 	if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE)
 		return 0;
@@ -202,8 +185,7 @@ err0:
 
 static void nec_8048_panel_power_off(struct omap_dss_device *dssdev)
 {
-	struct nec_8048_data *necd = dev_get_drvdata(&dssdev->dev);
-	struct backlight_device *bl = necd->bl;
+	struct backlight_device *bl = dev_get_drvdata(&dssdev->dev);
 
 	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
 		return;
-- 
1.8.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] OMAPDSS: Panel NEC: Only register backlight when we have valid callback
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Ujfalusi @ 2013-01-16 12:45 UTC (permalink / raw)
  To: Tomi Valkeinen, Florian Tobias Schandinat
  Cc: Archit Taneja, linux-omap, linux-fbdev, linux-kernel,
	Andrew Morton

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-16 12:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/3] OMAPDSS: Panel NEC: Only register backlight when we have valid callback Peter Ujfalusi

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).