Commit 561eb9d0 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Bartlomiej Zolnierkiewicz

fbdev: omap/lcd: Make callbacks optional

Most OMAP FB LCD drivers don't have anything to do in their panel
callbacks. This leads to a large set of empty boilerplate functions in the
panel drivers. Make those callbacks optional by checking if they are set
before calling them. This allows those boilerplate functions to be removed.

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
parent b2c1e8a7
...@@ -136,11 +136,6 @@ static void ams_delta_panel_disable(struct lcd_panel *panel) ...@@ -136,11 +136,6 @@ static void ams_delta_panel_disable(struct lcd_panel *panel)
gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 0); gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 0);
} }
static unsigned long ams_delta_panel_get_caps(struct lcd_panel *panel)
{
return 0;
}
static struct lcd_panel ams_delta_panel = { static struct lcd_panel ams_delta_panel = {
.name = "ams-delta", .name = "ams-delta",
.config = 0, .config = 0,
...@@ -163,7 +158,6 @@ static struct lcd_panel ams_delta_panel = { ...@@ -163,7 +158,6 @@ static struct lcd_panel ams_delta_panel = {
.cleanup = ams_delta_panel_cleanup, .cleanup = ams_delta_panel_cleanup,
.enable = ams_delta_panel_enable, .enable = ams_delta_panel_enable,
.disable = ams_delta_panel_disable, .disable = ams_delta_panel_disable,
.get_caps = ams_delta_panel_get_caps,
}; };
......
...@@ -28,15 +28,6 @@ ...@@ -28,15 +28,6 @@
#define MODULE_NAME "omapfb-lcd_h3" #define MODULE_NAME "omapfb-lcd_h3"
static int h3_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
{
return 0;
}
static void h3_panel_cleanup(struct lcd_panel *panel)
{
}
static int h3_panel_enable(struct lcd_panel *panel) static int h3_panel_enable(struct lcd_panel *panel)
{ {
int r = 0; int r = 0;
...@@ -63,11 +54,6 @@ static void h3_panel_disable(struct lcd_panel *panel) ...@@ -63,11 +54,6 @@ static void h3_panel_disable(struct lcd_panel *panel)
pr_err(MODULE_NAME ": Unable to turn off LCD panel\n"); pr_err(MODULE_NAME ": Unable to turn off LCD panel\n");
} }
static unsigned long h3_panel_get_caps(struct lcd_panel *panel)
{
return 0;
}
static struct lcd_panel h3_panel = { static struct lcd_panel h3_panel = {
.name = "h3", .name = "h3",
.config = OMAP_LCDC_PANEL_TFT, .config = OMAP_LCDC_PANEL_TFT,
...@@ -85,11 +71,8 @@ static struct lcd_panel h3_panel = { ...@@ -85,11 +71,8 @@ static struct lcd_panel h3_panel = {
.vbp = 0, .vbp = 0,
.pcd = 0, .pcd = 0,
.init = h3_panel_init,
.cleanup = h3_panel_cleanup,
.enable = h3_panel_enable, .enable = h3_panel_enable,
.disable = h3_panel_disable, .disable = h3_panel_disable,
.get_caps = h3_panel_get_caps,
}; };
static int h3_panel_probe(struct platform_device *pdev) static int h3_panel_probe(struct platform_device *pdev)
......
...@@ -31,30 +31,6 @@ ...@@ -31,30 +31,6 @@
#include "omapfb.h" #include "omapfb.h"
static int htcherald_panel_init(struct lcd_panel *panel,
struct omapfb_device *fbdev)
{
return 0;
}
static void htcherald_panel_cleanup(struct lcd_panel *panel)
{
}
static int htcherald_panel_enable(struct lcd_panel *panel)
{
return 0;
}
static void htcherald_panel_disable(struct lcd_panel *panel)
{
}
static unsigned long htcherald_panel_get_caps(struct lcd_panel *panel)
{
return 0;
}
/* Found on WIZ200 (miknix) and some HERA110 models (darkstar62) */ /* Found on WIZ200 (miknix) and some HERA110 models (darkstar62) */
static struct lcd_panel htcherald_panel_1 = { static struct lcd_panel htcherald_panel_1 = {
.name = "lcd_herald", .name = "lcd_herald",
...@@ -74,12 +50,6 @@ static struct lcd_panel htcherald_panel_1 = { ...@@ -74,12 +50,6 @@ static struct lcd_panel htcherald_panel_1 = {
.vsw = 3, .vsw = 3,
.vfp = 2, .vfp = 2,
.vbp = 2, .vbp = 2,
.init = htcherald_panel_init,
.cleanup = htcherald_panel_cleanup,
.enable = htcherald_panel_enable,
.disable = htcherald_panel_disable,
.get_caps = htcherald_panel_get_caps,
}; };
static int htcherald_panel_probe(struct platform_device *pdev) static int htcherald_panel_probe(struct platform_device *pdev)
......
...@@ -27,16 +27,6 @@ ...@@ -27,16 +27,6 @@
#include "omapfb.h" #include "omapfb.h"
static int innovator1510_panel_init(struct lcd_panel *panel,
struct omapfb_device *fbdev)
{
return 0;
}
static void innovator1510_panel_cleanup(struct lcd_panel *panel)
{
}
static int innovator1510_panel_enable(struct lcd_panel *panel) static int innovator1510_panel_enable(struct lcd_panel *panel)
{ {
__raw_writeb(0x7, OMAP1510_FPGA_LCD_PANEL_CONTROL); __raw_writeb(0x7, OMAP1510_FPGA_LCD_PANEL_CONTROL);
...@@ -48,11 +38,6 @@ static void innovator1510_panel_disable(struct lcd_panel *panel) ...@@ -48,11 +38,6 @@ static void innovator1510_panel_disable(struct lcd_panel *panel)
__raw_writeb(0x0, OMAP1510_FPGA_LCD_PANEL_CONTROL); __raw_writeb(0x0, OMAP1510_FPGA_LCD_PANEL_CONTROL);
} }
static unsigned long innovator1510_panel_get_caps(struct lcd_panel *panel)
{
return 0;
}
static struct lcd_panel innovator1510_panel = { static struct lcd_panel innovator1510_panel = {
.name = "inn1510", .name = "inn1510",
.config = OMAP_LCDC_PANEL_TFT, .config = OMAP_LCDC_PANEL_TFT,
...@@ -70,11 +55,8 @@ static struct lcd_panel innovator1510_panel = { ...@@ -70,11 +55,8 @@ static struct lcd_panel innovator1510_panel = {
.vbp = 0, .vbp = 0,
.pcd = 12, .pcd = 12,
.init = innovator1510_panel_init,
.cleanup = innovator1510_panel_cleanup,
.enable = innovator1510_panel_enable, .enable = innovator1510_panel_enable,
.disable = innovator1510_panel_disable, .disable = innovator1510_panel_disable,
.get_caps = innovator1510_panel_get_caps,
}; };
static int innovator1510_panel_probe(struct platform_device *pdev) static int innovator1510_panel_probe(struct platform_device *pdev)
......
...@@ -69,11 +69,6 @@ static void innovator1610_panel_disable(struct lcd_panel *panel) ...@@ -69,11 +69,6 @@ static void innovator1610_panel_disable(struct lcd_panel *panel)
gpio_set_value(15, 0); gpio_set_value(15, 0);
} }
static unsigned long innovator1610_panel_get_caps(struct lcd_panel *panel)
{
return 0;
}
static struct lcd_panel innovator1610_panel = { static struct lcd_panel innovator1610_panel = {
.name = "inn1610", .name = "inn1610",
.config = OMAP_LCDC_PANEL_TFT, .config = OMAP_LCDC_PANEL_TFT,
...@@ -95,7 +90,6 @@ static struct lcd_panel innovator1610_panel = { ...@@ -95,7 +90,6 @@ static struct lcd_panel innovator1610_panel = {
.cleanup = innovator1610_panel_cleanup, .cleanup = innovator1610_panel_cleanup,
.enable = innovator1610_panel_enable, .enable = innovator1610_panel_enable,
.disable = innovator1610_panel_disable, .disable = innovator1610_panel_disable,
.get_caps = innovator1610_panel_get_caps,
}; };
static int innovator1610_panel_probe(struct platform_device *pdev) static int innovator1610_panel_probe(struct platform_device *pdev)
......
...@@ -29,16 +29,6 @@ ...@@ -29,16 +29,6 @@
#include "omapfb.h" #include "omapfb.h"
static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
{
/* gpio2 was allocated in board init */
return 0;
}
static void osk_panel_cleanup(struct lcd_panel *panel)
{
}
static int osk_panel_enable(struct lcd_panel *panel) static int osk_panel_enable(struct lcd_panel *panel)
{ {
/* configure PWL pin */ /* configure PWL pin */
...@@ -68,11 +58,6 @@ static void osk_panel_disable(struct lcd_panel *panel) ...@@ -68,11 +58,6 @@ static void osk_panel_disable(struct lcd_panel *panel)
gpio_set_value(2, 0); gpio_set_value(2, 0);
} }
static unsigned long osk_panel_get_caps(struct lcd_panel *panel)
{
return 0;
}
static struct lcd_panel osk_panel = { static struct lcd_panel osk_panel = {
.name = "osk", .name = "osk",
.config = OMAP_LCDC_PANEL_TFT, .config = OMAP_LCDC_PANEL_TFT,
...@@ -90,11 +75,8 @@ static struct lcd_panel osk_panel = { ...@@ -90,11 +75,8 @@ static struct lcd_panel osk_panel = {
.vbp = 0, .vbp = 0,
.pcd = 12, .pcd = 12,
.init = osk_panel_init,
.cleanup = osk_panel_cleanup,
.enable = osk_panel_enable, .enable = osk_panel_enable,
.disable = osk_panel_disable, .disable = osk_panel_disable,
.get_caps = osk_panel_get_caps,
}; };
static int osk_panel_probe(struct platform_device *pdev) static int osk_panel_probe(struct platform_device *pdev)
......
...@@ -25,30 +25,6 @@ ...@@ -25,30 +25,6 @@
#include "omapfb.h" #include "omapfb.h"
static int palmte_panel_init(struct lcd_panel *panel,
struct omapfb_device *fbdev)
{
return 0;
}
static void palmte_panel_cleanup(struct lcd_panel *panel)
{
}
static int palmte_panel_enable(struct lcd_panel *panel)
{
return 0;
}
static void palmte_panel_disable(struct lcd_panel *panel)
{
}
static unsigned long palmte_panel_get_caps(struct lcd_panel *panel)
{
return 0;
}
static struct lcd_panel palmte_panel = { static struct lcd_panel palmte_panel = {
.name = "palmte", .name = "palmte",
.config = OMAP_LCDC_PANEL_TFT | OMAP_LCDC_INV_VSYNC | .config = OMAP_LCDC_PANEL_TFT | OMAP_LCDC_INV_VSYNC |
...@@ -67,12 +43,6 @@ static struct lcd_panel palmte_panel = { ...@@ -67,12 +43,6 @@ static struct lcd_panel palmte_panel = {
.vfp = 8, .vfp = 8,
.vbp = 7, .vbp = 7,
.pcd = 0, .pcd = 0,
.init = palmte_panel_init,
.cleanup = palmte_panel_cleanup,
.enable = palmte_panel_enable,
.disable = palmte_panel_disable,
.get_caps = palmte_panel_get_caps,
}; };
static int palmte_panel_probe(struct platform_device *pdev) static int palmte_panel_probe(struct platform_device *pdev)
......
...@@ -32,25 +32,6 @@ GPIO13 - screen blanking ...@@ -32,25 +32,6 @@ GPIO13 - screen blanking
#include "omapfb.h" #include "omapfb.h"
static int palmtt_panel_init(struct lcd_panel *panel,
struct omapfb_device *fbdev)
{
return 0;
}
static void palmtt_panel_cleanup(struct lcd_panel *panel)
{
}
static int palmtt_panel_enable(struct lcd_panel *panel)
{
return 0;
}
static void palmtt_panel_disable(struct lcd_panel *panel)
{
}
static unsigned long palmtt_panel_get_caps(struct lcd_panel *panel) static unsigned long palmtt_panel_get_caps(struct lcd_panel *panel)
{ {
return OMAPFB_CAPS_SET_BACKLIGHT; return OMAPFB_CAPS_SET_BACKLIGHT;
...@@ -74,10 +55,6 @@ static struct lcd_panel palmtt_panel = { ...@@ -74,10 +55,6 @@ static struct lcd_panel palmtt_panel = {
.vbp = 7, .vbp = 7,
.pcd = 0, .pcd = 0,
.init = palmtt_panel_init,
.cleanup = palmtt_panel_cleanup,
.enable = palmtt_panel_enable,
.disable = palmtt_panel_disable,
.get_caps = palmtt_panel_get_caps, .get_caps = palmtt_panel_get_caps,
}; };
......
...@@ -26,26 +26,6 @@ ...@@ -26,26 +26,6 @@
#include "omapfb.h" #include "omapfb.h"
static int palmz71_panel_init(struct lcd_panel *panel,
struct omapfb_device *fbdev)
{
return 0;
}
static void palmz71_panel_cleanup(struct lcd_panel *panel)
{
}
static int palmz71_panel_enable(struct lcd_panel *panel)
{
return 0;
}
static void palmz71_panel_disable(struct lcd_panel *panel)
{
}
static unsigned long palmz71_panel_get_caps(struct lcd_panel *panel) static unsigned long palmz71_panel_get_caps(struct lcd_panel *panel)
{ {
return OMAPFB_CAPS_SET_BACKLIGHT; return OMAPFB_CAPS_SET_BACKLIGHT;
...@@ -69,10 +49,6 @@ static struct lcd_panel palmz71_panel = { ...@@ -69,10 +49,6 @@ static struct lcd_panel palmz71_panel = {
.vbp = 7, .vbp = 7,
.pcd = 0, .pcd = 0,
.init = palmz71_panel_init,
.cleanup = palmz71_panel_cleanup,
.enable = palmz71_panel_enable,
.disable = palmz71_panel_disable,
.get_caps = palmz71_panel_get_caps, .get_caps = palmz71_panel_get_caps,
}; };
......
...@@ -337,6 +337,7 @@ static int omapfb_blank(int blank, struct fb_info *fbi) ...@@ -337,6 +337,7 @@ static int omapfb_blank(int blank, struct fb_info *fbi)
if (fbdev->state == OMAPFB_SUSPENDED) { if (fbdev->state == OMAPFB_SUSPENDED) {
if (fbdev->ctrl->resume) if (fbdev->ctrl->resume)
fbdev->ctrl->resume(); fbdev->ctrl->resume();
if (fbdev->panel->enable)
fbdev->panel->enable(fbdev->panel); fbdev->panel->enable(fbdev->panel);
fbdev->state = OMAPFB_ACTIVE; fbdev->state = OMAPFB_ACTIVE;
if (fbdev->ctrl->get_update_mode() == if (fbdev->ctrl->get_update_mode() ==
...@@ -346,6 +347,7 @@ static int omapfb_blank(int blank, struct fb_info *fbi) ...@@ -346,6 +347,7 @@ static int omapfb_blank(int blank, struct fb_info *fbi)
break; break;
case FB_BLANK_POWERDOWN: case FB_BLANK_POWERDOWN:
if (fbdev->state == OMAPFB_ACTIVE) { if (fbdev->state == OMAPFB_ACTIVE) {
if (fbdev->panel->disable)
fbdev->panel->disable(fbdev->panel); fbdev->panel->disable(fbdev->panel);
if (fbdev->ctrl->suspend) if (fbdev->ctrl->suspend)
fbdev->ctrl->suspend(); fbdev->ctrl->suspend();
...@@ -1030,6 +1032,7 @@ static void omapfb_get_caps(struct omapfb_device *fbdev, int plane, ...@@ -1030,6 +1032,7 @@ static void omapfb_get_caps(struct omapfb_device *fbdev, int plane,
{ {
memset(caps, 0, sizeof(*caps)); memset(caps, 0, sizeof(*caps));
fbdev->ctrl->get_caps(plane, caps); fbdev->ctrl->get_caps(plane, caps);
if (fbdev->panel->get_caps)
caps->ctrl |= fbdev->panel->get_caps(fbdev->panel); caps->ctrl |= fbdev->panel->get_caps(fbdev->panel);
} }
...@@ -1549,6 +1552,7 @@ static void omapfb_free_resources(struct omapfb_device *fbdev, int state) ...@@ -1549,6 +1552,7 @@ static void omapfb_free_resources(struct omapfb_device *fbdev, int state)
case 7: case 7:
omapfb_unregister_sysfs(fbdev); omapfb_unregister_sysfs(fbdev);
case 6: case 6:
if (fbdev->panel->disable)
fbdev->panel->disable(fbdev->panel); fbdev->panel->disable(fbdev->panel);
case 5: case 5:
omapfb_set_update_mode(fbdev, OMAPFB_UPDATE_DISABLED); omapfb_set_update_mode(fbdev, OMAPFB_UPDATE_DISABLED);
...@@ -1557,6 +1561,7 @@ static void omapfb_free_resources(struct omapfb_device *fbdev, int state) ...@@ -1557,6 +1561,7 @@ static void omapfb_free_resources(struct omapfb_device *fbdev, int state)
case 3: case 3:
ctrl_cleanup(fbdev); ctrl_cleanup(fbdev);
case 2: case 2:
if (fbdev->panel->cleanup)
fbdev->panel->cleanup(fbdev->panel); fbdev->panel->cleanup(fbdev->panel);
case 1: case 1:
dev_set_drvdata(fbdev->dev, NULL); dev_set_drvdata(fbdev->dev, NULL);
...@@ -1680,9 +1685,11 @@ static int omapfb_do_probe(struct platform_device *pdev, ...@@ -1680,9 +1685,11 @@ static int omapfb_do_probe(struct platform_device *pdev,
goto cleanup; goto cleanup;
} }
if (fbdev->panel->init) {
r = fbdev->panel->init(fbdev->panel, fbdev); r = fbdev->panel->init(fbdev->panel, fbdev);
if (r) if (r)
goto cleanup; goto cleanup;
}
pr_info("omapfb: configured for panel %s\n", fbdev->panel->name); pr_info("omapfb: configured for panel %s\n", fbdev->panel->name);
...@@ -1725,9 +1732,11 @@ static int omapfb_do_probe(struct platform_device *pdev, ...@@ -1725,9 +1732,11 @@ static int omapfb_do_probe(struct platform_device *pdev,
OMAPFB_MANUAL_UPDATE : OMAPFB_AUTO_UPDATE); OMAPFB_MANUAL_UPDATE : OMAPFB_AUTO_UPDATE);
init_state++; init_state++;
if (fbdev->panel->enable) {
r = fbdev->panel->enable(fbdev->panel); r = fbdev->panel->enable(fbdev->panel);
if (r) if (r)
goto cleanup; goto cleanup;
}
init_state++; init_state++;
r = omapfb_register_sysfs(fbdev); r = omapfb_register_sysfs(fbdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment