Skip to contentSkip to conversation

OMAPDSS: Misc cleanups

PATCH New Archit Taneja 1 participant 12 messages Feb 13, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover OMAPDSS: Misc cleanups

These patches perform cleanups which will help the omapdss driver to migrate to DT more easily:

- omapdss panel drivers call platform specific backlight functions defined in board files. These callbacks are removed. Setting of max backlight level in the board file is also removed.
- other misc changes which thin down the omap_dss_device struct by removing some unnecessary fields.
- usage of devm_kzalloc in panel drivers.

Reference branch:

git://gitorious.org/~boddob/linux-omap-dss2/archit-dss2-clone.git for-3.9/misc_cleanups

Archit Taneja (7):
OMAPDSS: ZOOM/NEC-nl8048hl11: remove platform backlight support
OMAPDSS: Generic DPI Panel: use devm_kzalloc for allocating driver
data
OMAPDSS: lb035q02: use devm_kzalloc for allocating driver data
OMAPDSS: picodlp: use devm_kzalloc for allocating driver data
OMAPDSS: remove unnecessary DSI external TE pin platform info from
omap_dss_device
OMAPDSS: panel acx565akm: remove omap_dss_device maximum backlight
level usage
OMAPDSS: Remove max_backlight_level form omap_dss_device

Tomi Valkeinen (4):
OMAPDSS: acx565akm: remove platform backlight calls
OMAPDSS: ls037v7dw01: remove platform backlight calls
OMAPDSS: n8x0: remove platform backlight calls
OMAPDSS: remove set_backlight/get_backlight function ptrs

 arch/arm/mach-omap2/board-zoom-display.c           |    2 -
 drivers/video/omap2/displays/panel-acx565akm.c     |   11 +--
 drivers/video/omap2/displays/panel-generic-dpi.c   |    6 +-
 .../omap2/displays/panel-lgphilips-lb035q02.c      |   16 ++---
 drivers/video/omap2/displays/panel-n8x0.c          |   74 --------------------
 .../omap2/displays/panel-nec-nl8048hl11-01b.c      |   74 --------------------
 drivers/video/omap2/displays/panel-picodlp.c       |   16 ++---
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |   62 ----------------
 include/video/omap-panel-n8x0.h                    |    2 -
 include/video/omapdss.h                            |    7 --
 10 files changed, 14 insertions(+), 256 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/11 OMAPDSS: acx565akm: remove platform backlight calls

From: Tomi Valkeinen <[email protected]>

acx565akm has support to call set_backlight/get_backlight in platform code. They are not used by any board, and thus can be removed from the driver.

---
 drivers/video/omap2/displays/panel-acx565akm.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/video/omap2/displays/panel-acx565akm.c +1 -5
index 72699f8..a980a11 100644
@@ -336,8 +336,6 @@ static int acx565akm_bl_update_status(struct backlight_device *dev)
 	r = 0;
 	if (md->has_bc)
 		acx565akm_set_brightness(md, level);
-	else if (md->dssdev->set_backlight)
-		r = md->dssdev->set_backlight(md->dssdev, level);
 	else
 		r = -ENODEV;
 
@@ -352,7 +350,7 @@ static int acx565akm_bl_get_intensity(struct backlight_device *dev)
 
 	dev_dbg(&dev->dev, "%s\n", __func__);
 
-	if (!md->has_bc && md->dssdev->set_backlight == NULL)
+	if (!md->has_bc)
 		return -ENODEV;
 
 	if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
@@ -564,8 +562,6 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
 
 	if (md->has_bc)
 		brightness = acx565akm_get_actual_brightness(md);
-	else if (dssdev->get_backlight)
-		brightness = dssdev->get_backlight(dssdev);
 	else
 		brightness = 0;
 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/11 OMAPDSS: ls037v7dw01: remove platform backlight calls

In reply to Archit Taneja

From: Tomi Valkeinen <[email protected]>

Sharp ls037v7dw01 driver contains support to call platform backlight functions. These are not used by any board, and can be removed.

---
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |   62 --------------------
 1 file changed, 62 deletions(-)
drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c +0 -62
index cada8c6..eb6bd81 100644
@@ -20,7 +20,6 @@
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/device.h>
-#include <linux/backlight.h>
 #include <linux/fb.h>
 #include <linux/err.h>
 #include <linux/slab.h>
@@ -28,7 +27,6 @@
 #include <video/omapdss.h>
 
 struct sharp_data {
-	struct backlight_device *bl;
 };
 
 static struct omap_video_timings sharp_ls_timings = {
@@ -52,45 +50,10 @@ static struct omap_video_timings sharp_ls_timings = {
 	.sync_pclk_edge	= OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
 };
 
-static int sharp_ls_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;
-	else
-		level = 0;
-
-	return dssdev->set_backlight(dssdev, level);
-}
-
-static int sharp_ls_bl_get_brightness(struct backlight_device *bl)
-{
-	if (bl->props.fb_blank == FB_BLANK_UNBLANK &&
-			bl->props.power == FB_BLANK_UNBLANK)
-		return bl->props.brightness;
-
-	return 0;
-}
-
-static const struct backlight_ops sharp_ls_bl_ops = {
-	.get_brightness = sharp_ls_bl_get_brightness,
-	.update_status  = sharp_ls_bl_update_status,
-};
-
-
 
 static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
 {
-	struct backlight_properties props;
-	struct backlight_device *bl;
 	struct sharp_data *sd;
-	int r;
 
 	dssdev->panel.timings = sharp_ls_timings;
 
@@ -100,37 +63,12 @@ static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
 
 	dev_set_drvdata(&dssdev->dev, sd);
 
-	memset(&props, 0, sizeof(struct backlight_properties));
-	props.max_brightness = dssdev->max_backlight_level;
-	props.type = BACKLIGHT_RAW;
-
-	bl = backlight_device_register("sharp-ls", &dssdev->dev, dssdev,
-			&sharp_ls_bl_ops, &props);
-	if (IS_ERR(bl)) {
-		r = PTR_ERR(bl);
-		kfree(sd);
-		return r;
-	}
-	sd->bl = bl;
-
-	bl->props.fb_blank = FB_BLANK_UNBLANK;
-	bl->props.power = FB_BLANK_UNBLANK;
-	bl->props.brightness = dssdev->max_backlight_level;
-	r = sharp_ls_bl_update_status(bl);
-	if (r < 0)
-		dev_err(&dssdev->dev, "failed to set lcd brightness\n");
-
 	return 0;
 }
 
 static void __exit sharp_ls_panel_remove(struct omap_dss_device *dssdev)
 {
 	struct sharp_data *sd = dev_get_drvdata(&dssdev->dev);
-	struct backlight_device *bl = sd->bl;
-
-	bl->props.power = FB_BLANK_POWERDOWN;
-	sharp_ls_bl_update_status(bl);
-	backlight_device_unregister(bl);
 
 	kfree(sd);
 }
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/11 OMAPDSS: ZOOM/NEC-nl8048hl11: remove platform backlight support

In reply to Archit Taneja

omap_dss_device provides a callback function to set backlight. Panel backlight on Zoom board is implemented by the function zoom_set_bl_intensity() in the board file. This needs to be removed. The PWM backlight should be implemented with the pwm_bl driver.

For now, function zoom_set_bl_intensity() is left as is, but omap_dss_device's set_backlight func pointer and max_brightness_level are removed. NEC-nl8048hl11 panel driver contains support to call platform backlight functions. These are not used any more in zoom and are now removed.

---
 arch/arm/mach-omap2/board-zoom-display.c           |    2 -
 .../omap2/displays/panel-nec-nl8048hl11-01b.c      |   74 --------------------
 2 files changed, 76 deletions(-)
arch/arm/mach-omap2/board-zoom-display.c +0 -2
index 1c7c834..4717ed5 100644
@@ -109,8 +109,6 @@ static struct omap_dss_device zoom_lcd_device = {
 	.phy.dpi.data_lines	= 24,
 	.platform_enable	= zoom_panel_enable_lcd,
 	.platform_disable	= zoom_panel_disable_lcd,
-	.max_backlight_level	= 100,
-	.set_backlight		= zoom_set_bl_intensity,
 };
 
 static struct omap_dss_device *zoom_dss_devices[] = {
drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c +0 -74

128 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/11 OMAPDSS: n8x0: remove platform backlight calls

In reply to Archit Taneja

From: Tomi Valkeinen <[email protected]>

The n8x0 panel contains support to call platform backlight functions. These are not used by any board, and can be removed.

---
 drivers/video/omap2/displays/panel-n8x0.c |   74 -----------------------------
 include/video/omap-panel-n8x0.h           |    2 -
 2 files changed, 76 deletions(-)
drivers/video/omap2/displays/panel-n8x0.c +0 -74
index dd12947..b750480 100644
@@ -5,7 +5,6 @@
 #include <linux/slab.h>
 #include <linux/gpio.h>
 #include <linux/spi/spi.h>
-#include <linux/backlight.h>
 #include <linux/fb.h>
 
 #include <video/omapdss.h>
@@ -69,7 +68,6 @@ static struct panel_drv_data {
 
 	struct omap_dss_device *dssdev;
 	struct spi_device *spidev;
-	struct backlight_device *bldev;
 
 	int blizzard_ver;
 } s_drv_data;
@@ -424,55 +422,10 @@ static const struct rfbi_timings n8x0_panel_timings = {
 	.cs_pulse_width = 0,
 };
 
-static int n8x0_bl_update_status(struct backlight_device *dev)
-{
-	struct omap_dss_device *dssdev = dev_get_drvdata(&dev->dev);
-	struct panel_n8x0_data *bdata = get_board_data(dssdev);
-	struct panel_drv_data *ddata = get_drv_data(dssdev);
-	int r;
-	int level;
-
-	mutex_lock(&ddata->lock);
-
-	if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
-			dev->props.power == FB_BLANK_UNBLANK)
-		level = dev->props.brightness;
-	else
-		level = 0;
-
-	dev_dbg(&dssdev->dev, "update brightness to %d\n", level);
-
-	if (!bdata->set_backlight)
-		r = -EINVAL;
-	else
-		r = bdata->set_backlight(dssdev, level);
-
-	mutex_unlock(&ddata->lock);
-
-	return r;
-}
-
-static int n8x0_bl_get_intensity(struct backlight_device *dev)
-{
-	if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
-			dev->props.power == FB_BLANK_UNBLANK)
-		return dev->props.brightness;
-
-	return 0;
-}
-
-static const struct backlight_ops n8x0_bl_ops = {
-	.get_brightness = n8x0_bl_get_intensity,
-	.update_status  = n8x0_bl_update_status,
-};
-
 static int n8x0_panel_probe(struct omap_dss_device *dssdev)
 {
 	struct panel_n8x0_data *bdata = get_board_data(dssdev);
 	struct panel_drv_data *ddata;
-	struct backlight_device *bldev;
-	struct backlight_properties props;
-	int r;
 
 	dev_dbg(&dssdev->dev, "probe\n");
 
@@ -491,40 +444,13 @@ static int n8x0_panel_probe(struct omap_dss_device *dssdev)
 	dssdev->ctrl.rfbi_timings = n8x0_panel_timings;
 	dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
 
-	memset(&props, 0, sizeof(props));
-	props.max_brightness = 127;
-	props.type = BACKLIGHT_PLATFORM;
-	bldev = backlight_device_register(dev_name(&dssdev->dev), &dssdev->dev,
-			dssdev, &n8x0_bl_ops, &props);
-	if (IS_ERR(bldev)) {
-		r = PTR_ERR(bldev);
-		dev_err(&dssdev->dev, "register backlight failed\n");
-		return r;
-	}
-
-	ddata->bldev = bldev;
-
-	bldev->props.fb_blank = FB_BLANK_UNBLANK;
-	bldev->props.power = FB_BLANK_UNBLANK;
-	bldev->props.brightness = 127;
-
-	n8x0_bl_update_status(bldev);
-
 	return 0;
 }
 
 static void n8x0_panel_remove(struct omap_dss_device *dssdev)
 {
-	struct panel_drv_data *ddata = get_drv_data(dssdev);
-	struct backlight_device *bldev;
-
 	dev_dbg(&dssdev->dev, "remove\n");
 
-	bldev = ddata->bldev;
-	bldev->props.power = FB_BLANK_POWERDOWN;
-	n8x0_bl_update_status(bldev);
-	backlight_device_unregister(bldev);
-
 	dev_set_drvdata(&dssdev->dev, NULL);
 }
 
include/video/omap-panel-n8x0.h +0 -2
index 50a1302..9cc69c8 100644
@@ -8,8 +8,6 @@ struct panel_n8x0_data {
 	void (*platform_disable)(struct omap_dss_device *dssdev);
 	int panel_reset;
 	int ctrl_pwrdown;
-
-	int (*set_backlight)(struct omap_dss_device *dssdev, int level);
 };
 
 #endif
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 5/11 OMAPDSS: remove set_backlight/get_backlight function ptrs

In reply to Archit Taneja

From: Tomi Valkeinen <[email protected]>

Now that no board nor panel is using set_backlight and get_backlight functions, we can remove them from omapdss.h.

---
 include/video/omapdss.h |    2 --
 1 file changed, 2 deletions(-)
include/video/omapdss.h +0 -2
index caefa09..d5dcd50 100644
@@ -659,8 +659,6 @@ struct omap_dss_device {
 	/* platform specific  */
 	int (*platform_enable)(struct omap_dss_device *dssdev);
 	void (*platform_disable)(struct omap_dss_device *dssdev);
-	int (*set_backlight)(struct omap_dss_device *dssdev, int level);
-	int (*get_backlight)(struct omap_dss_device *dssdev);
 };
 
 struct omap_dss_hdmi_data
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 6/11 OMAPDSS: Generic DPI Panel: use devm_kzalloc for allocating driver data

In reply to Archit Taneja

Use devm_kzalloc instead of kzalloc to allocate driver data for the generic dpi panel driver. This simplifies the driver's probe and remove functions.

---
 drivers/video/omap2/displays/panel-generic-dpi.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/video/omap2/displays/panel-generic-dpi.c +1 -5
index 54ca8ae..6cb2fe0 100644
@@ -632,7 +632,7 @@ static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)
 
 	dssdev->panel.timings = panel_config->timings;
 
-	drv_data = kzalloc(sizeof(*drv_data), GFP_KERNEL);
+	drv_data = devm_kzalloc(&dssdev->dev, sizeof(*drv_data), GFP_KERNEL);
 	if (!drv_data)
 		return -ENOMEM;
 
@@ -648,12 +648,8 @@ static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)
 
 static void __exit generic_dpi_panel_remove(struct omap_dss_device *dssdev)
 {
-	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
-
 	dev_dbg(&dssdev->dev, "remove\n");
 
-	kfree(drv_data);
-
 	dev_set_drvdata(&dssdev->dev, NULL);
 }
 
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 7/11 OMAPDSS: lb035q02: use devm_kzalloc for allocating driver data

In reply to Archit Taneja

Use devm_kzalloc instead of kzalloc to allocate driver data for the lg phillips panel driver. This simplifies the driver's probe and remove functions.

---
 .../omap2/displays/panel-lgphilips-lb035q02.c      |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/video/omap2/displays/panel-lgphilips-lb035q02.c +5 -11
index 6e5abe8..8effea8 100644
@@ -89,27 +89,21 @@ static void lb035q02_panel_power_off(struct omap_dss_device *dssdev)
 static int lb035q02_panel_probe(struct omap_dss_device *dssdev)
 {
 	struct lb035q02_data *ld;
-	int r;
 
 	dssdev->panel.timings = lb035q02_timings;
 
-	ld = kzalloc(sizeof(*ld), GFP_KERNEL);
-	if (!ld) {
-		r = -ENOMEM;
-		goto err;
-	}
+	ld = devm_kzalloc(&dssdev->dev, sizeof(*ld), GFP_KERNEL);
+	if (!ld)
+		return -ENOMEM;
+
 	mutex_init(&ld->lock);
 	dev_set_drvdata(&dssdev->dev, ld);
+
 	return 0;
-err:
-	return r;
 }
 
 static void lb035q02_panel_remove(struct omap_dss_device *dssdev)
 {
-	struct lb035q02_data *ld = dev_get_drvdata(&dssdev->dev);
-
-	kfree(ld);
 }
 
 static int lb035q02_panel_enable(struct omap_dss_device *dssdev)
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 8/11 OMAPDSS: picodlp: use devm_kzalloc for allocating driver data

In reply to Archit Taneja

Use devm_kzalloc instead of kzalloc to allocate driver data for the picodlp panel driver. This simplifies the driver's probe and remove functions.

---
 drivers/video/omap2/displays/panel-picodlp.c |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/video/omap2/displays/panel-picodlp.c +6 -10
index 1b94018..3864299 100644
@@ -423,11 +423,11 @@ static int picodlp_panel_probe(struct omap_dss_device *dssdev)
 	struct picodlp_panel_data *picodlp_pdata = get_panel_data(dssdev);
 	struct i2c_adapter *adapter;
 	struct i2c_client *picodlp_i2c_client;
-	int r = 0, picodlp_adapter_id;
+	int picodlp_adapter_id;
 
 	dssdev->panel.timings = pico_ls_timings;
 
-	picod =  kzalloc(sizeof(struct picodlp_data), GFP_KERNEL);
+	picod = devm_kzalloc(&dssdev->dev, sizeof(*picod), GFP_KERNEL);
 	if (!picod)
 		return -ENOMEM;
 
@@ -438,25 +438,21 @@ static int picodlp_panel_probe(struct omap_dss_device *dssdev)
 	adapter = i2c_get_adapter(picodlp_adapter_id);
 	if (!adapter) {
 		dev_err(&dssdev->dev, "can't get i2c adapter\n");
-		r = -ENODEV;
-		goto err;
+		return -ENODEV;
 	}
 
 	picodlp_i2c_client = i2c_new_device(adapter, &picodlp_i2c_board_info);
 	if (!picodlp_i2c_client) {
 		dev_err(&dssdev->dev, "can't add i2c device::"
 					 " picodlp_i2c_client is NULL\n");
-		r = -ENODEV;
-		goto err;
+		return -ENODEV;
 	}
 
 	picod->picodlp_i2c_client = picodlp_i2c_client;
 
 	dev_set_drvdata(&dssdev->dev, picod);
-	return r;
-err:
-	kfree(picod);
-	return r;
+
+	return 0;
 }
 
 static void picodlp_panel_remove(struct omap_dss_device *dssdev)
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH 9/11 OMAPDSS: remove unnecessary DSI external TE pin platform info from omap_dss_device

In reply to Archit Taneja

The omap_dss_device provides platform related parameters ext_te and ext_te_gpio for DSI command mode panels. These parameters are now owned by a panel driver's platform_data instead.

Remove these fields as they aren't used anymore.

---
 include/video/omapdss.h |    3 ---
 1 file changed, 3 deletions(-)
include/video/omapdss.h +0 -3
index d5dcd50..ec68769 100644
@@ -579,9 +579,6 @@ struct omap_dss_device {
 
 		struct {
 			int module;
-
-			bool ext_te;
-			u8 ext_te_gpio;
 		} dsi;
 
 		struct {
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH 10/11 OMAPDSS: panel acx565akm: remove omap_dss_device maximum backlight level usage

In reply to Archit Taneja

The omap_dss_device structs's max_backlight_level is used to pass maximum backlight level for the platform. However, no board file using this panel populates this field. Therefore, we remove it's usage from the panel driver.

---
 drivers/video/omap2/displays/panel-acx565akm.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/video/omap2/displays/panel-acx565akm.c +1 -4
index a980a11..a8fb26b 100644
@@ -555,10 +555,7 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
 		md->cabc_mode = get_hw_cabc_mode(md);
 	}
 
-	if (md->has_bc)
-		max_brightness = 255;
-	else
-		max_brightness = dssdev->max_backlight_level;
+	max_brightness = 255;
 
 	if (md->has_bc)
 		brightness = acx565akm_get_actual_brightness(md);
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH 11/11 OMAPDSS: Remove max_backlight_level form omap_dss_device

In reply to Archit Taneja

The maximum backlight level supported is a parameter which should come from the panel's platform data. Usage of max_backlight_level in omap_dss_device has been removed from all panel drivers. Remove it from the omap_dss_device struct.

---
 include/video/omapdss.h |    2 --
 1 file changed, 2 deletions(-)
include/video/omapdss.h +0 -2
index ec68769..f0b65a5 100644
@@ -631,8 +631,6 @@ struct omap_dss_device {
 
 	int reset_gpio;
 
-	int max_backlight_level;
-
 	const char *name;
 
 	/* used to match device to driver */
Signature · 1 line
1.7.9.5