fbdev: omap/lcd: Make callbacks optional
authorLars-Peter Clausen <lars@metafoo.de>
Mon, 30 Jan 2017 16:39:49 +0000 (17:39 +0100)
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Mon, 30 Jan 2017 16:39:49 +0000 (17:39 +0100)
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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
drivers/video/fbdev/omap/lcd_ams_delta.c
drivers/video/fbdev/omap/lcd_h3.c
drivers/video/fbdev/omap/lcd_htcherald.c
drivers/video/fbdev/omap/lcd_inn1510.c
drivers/video/fbdev/omap/lcd_inn1610.c
drivers/video/fbdev/omap/lcd_osk.c
drivers/video/fbdev/omap/lcd_palmte.c
drivers/video/fbdev/omap/lcd_palmtt.c
drivers/video/fbdev/omap/lcd_palmz71.c
drivers/video/fbdev/omap/omapfb_main.c

index ef0ed748eebc64b467d5a883178c4059970bd40c..a4ee947006c77c5178161f52df2938db8a45c4cd 100644 (file)
@@ -136,11 +136,6 @@ static void ams_delta_panel_disable(struct lcd_panel *panel)
        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 = {
        .name           = "ams-delta",
        .config         = 0,
@@ -163,7 +158,6 @@ static struct lcd_panel ams_delta_panel = {
        .cleanup        = ams_delta_panel_cleanup,
        .enable         = ams_delta_panel_enable,
        .disable        = ams_delta_panel_disable,
-       .get_caps       = ams_delta_panel_get_caps,
 };
 
 
index 428190679617d93d91ce862eb6181fbd1fcc1b18..9d2da146813ef0e2c88e8d4121657fa0400a76dd 100644 (file)
 
 #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)
 {
        int r = 0;
@@ -63,11 +54,6 @@ static void h3_panel_disable(struct lcd_panel *panel)
                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 = {
        .name           = "h3",
        .config         = OMAP_LCDC_PANEL_TFT,
@@ -85,11 +71,8 @@ static struct lcd_panel h3_panel = {
        .vbp            = 0,
        .pcd            = 0,
 
-       .init           = h3_panel_init,
-       .cleanup        = h3_panel_cleanup,
        .enable         = h3_panel_enable,
        .disable        = h3_panel_disable,
-       .get_caps       = h3_panel_get_caps,
 };
 
 static int h3_panel_probe(struct platform_device *pdev)
index dd2ce69060b82adab85a6142c03eae7494365cd6..9d692f5b80253c039bc878599f2c082daca5ff54 100644 (file)
 
 #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) */
 static struct lcd_panel htcherald_panel_1 = {
        .name           = "lcd_herald",
@@ -74,12 +50,6 @@ static struct lcd_panel htcherald_panel_1 = {
        .vsw            = 3,
        .vfp            = 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)
index dd1f99af718ab0eb1fc7833d1d3cd2593ae31c54..b284050f54717b132fdb1bd1f67eb44a19f7b0d3 100644 (file)
 
 #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)
 {
        __raw_writeb(0x7, OMAP1510_FPGA_LCD_PANEL_CONTROL);
@@ -48,11 +38,6 @@ static void innovator1510_panel_disable(struct lcd_panel *panel)
        __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 = {
        .name           = "inn1510",
        .config         = OMAP_LCDC_PANEL_TFT,
@@ -70,11 +55,8 @@ static struct lcd_panel innovator1510_panel = {
        .vbp            = 0,
        .pcd            = 12,
 
-       .init           = innovator1510_panel_init,
-       .cleanup        = innovator1510_panel_cleanup,
        .enable         = innovator1510_panel_enable,
        .disable        = innovator1510_panel_disable,
-       .get_caps       = innovator1510_panel_get_caps,
 };
 
 static int innovator1510_panel_probe(struct platform_device *pdev)
index 2f72eca4878d4be7d6a4f45e84ae1c84fbf03751..1841710e796f779453e1fda56fea2a45f78a71df 100644 (file)
@@ -69,11 +69,6 @@ static void innovator1610_panel_disable(struct lcd_panel *panel)
        gpio_set_value(15, 0);
 }
 
-static unsigned long innovator1610_panel_get_caps(struct lcd_panel *panel)
-{
-       return 0;
-}
-
 static struct lcd_panel innovator1610_panel = {
        .name           = "inn1610",
        .config         = OMAP_LCDC_PANEL_TFT,
@@ -95,7 +90,6 @@ static struct lcd_panel innovator1610_panel = {
        .cleanup        = innovator1610_panel_cleanup,
        .enable         = innovator1610_panel_enable,
        .disable        = innovator1610_panel_disable,
-       .get_caps       = innovator1610_panel_get_caps,
 };
 
 static int innovator1610_panel_probe(struct platform_device *pdev)
index 4b01c4e2f3e64c71e8f6a373f31849b7059b4460..b0be5771fe90ee6704fb0ec2882f2cc133162a62 100644 (file)
 
 #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)
 {
        /* configure PWL pin */
@@ -68,11 +58,6 @@ static void osk_panel_disable(struct lcd_panel *panel)
        gpio_set_value(2, 0);
 }
 
-static unsigned long osk_panel_get_caps(struct lcd_panel *panel)
-{
-       return 0;
-}
-
 static struct lcd_panel osk_panel = {
        .name           = "osk",
        .config         = OMAP_LCDC_PANEL_TFT,
@@ -90,11 +75,8 @@ static struct lcd_panel osk_panel = {
        .vbp            = 0,
        .pcd            = 12,
 
-       .init           = osk_panel_init,
-       .cleanup        = osk_panel_cleanup,
        .enable         = osk_panel_enable,
        .disable        = osk_panel_disable,
-       .get_caps       = osk_panel_get_caps,
 };
 
 static int osk_panel_probe(struct platform_device *pdev)
index fef7e45db1fe2dc52ddb20ce11b92bfd81471319..cef96386cf8021e0b16118cb017175e00f3a07ed 100644 (file)
 
 #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 = {
        .name           = "palmte",
        .config         = OMAP_LCDC_PANEL_TFT | OMAP_LCDC_INV_VSYNC |
@@ -67,12 +43,6 @@ static struct lcd_panel palmte_panel = {
        .vfp            = 8,
        .vbp            = 7,
        .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)
index bd063145c2638f06405e1740ff135355ad718aa6..627f13dae5ad69011e5f5c7e0e783459d6b939ea 100644 (file)
@@ -32,25 +32,6 @@ GPIO13 - screen blanking
 
 #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)
 {
        return OMAPFB_CAPS_SET_BACKLIGHT;
@@ -74,10 +55,6 @@ static struct lcd_panel palmtt_panel = {
        .vbp            = 7,
        .pcd            = 0,
 
-       .init           = palmtt_panel_init,
-       .cleanup        = palmtt_panel_cleanup,
-       .enable         = palmtt_panel_enable,
-       .disable        = palmtt_panel_disable,
        .get_caps       = palmtt_panel_get_caps,
 };
 
index bff7425e1bb99c1bd27e8eb6e9cdf67644988e3d..c46d4db1f839ff83b23a5ae6278e60bad418f681 100644 (file)
 
 #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)
 {
        return OMAPFB_CAPS_SET_BACKLIGHT;
@@ -69,10 +49,6 @@ static struct lcd_panel palmz71_panel = {
        .vbp            = 7,
        .pcd            = 0,
 
-       .init           = palmz71_panel_init,
-       .cleanup        = palmz71_panel_cleanup,
-       .enable         = palmz71_panel_enable,
-       .disable        = palmz71_panel_disable,
        .get_caps       = palmz71_panel_get_caps,
 };
 
index 6429f33167f5ef99e00f09e1491d235c00e0fa53..1abba07b84b3efd014b28bfd0ef61f3cad7cbeda 100644 (file)
@@ -337,7 +337,8 @@ static int omapfb_blank(int blank, struct fb_info *fbi)
                if (fbdev->state == OMAPFB_SUSPENDED) {
                        if (fbdev->ctrl->resume)
                                fbdev->ctrl->resume();
-                       fbdev->panel->enable(fbdev->panel);
+                       if (fbdev->panel->enable)
+                               fbdev->panel->enable(fbdev->panel);
                        fbdev->state = OMAPFB_ACTIVE;
                        if (fbdev->ctrl->get_update_mode() ==
                                        OMAPFB_MANUAL_UPDATE)
@@ -346,7 +347,8 @@ static int omapfb_blank(int blank, struct fb_info *fbi)
                break;
        case FB_BLANK_POWERDOWN:
                if (fbdev->state == OMAPFB_ACTIVE) {
-                       fbdev->panel->disable(fbdev->panel);
+                       if (fbdev->panel->disable)
+                               fbdev->panel->disable(fbdev->panel);
                        if (fbdev->ctrl->suspend)
                                fbdev->ctrl->suspend();
                        fbdev->state = OMAPFB_SUSPENDED;
@@ -1030,7 +1032,8 @@ static void omapfb_get_caps(struct omapfb_device *fbdev, int plane,
 {
        memset(caps, 0, sizeof(*caps));
        fbdev->ctrl->get_caps(plane, caps);
-       caps->ctrl |= fbdev->panel->get_caps(fbdev->panel);
+       if (fbdev->panel->get_caps)
+               caps->ctrl |= fbdev->panel->get_caps(fbdev->panel);
 }
 
 /* For lcd testing */
@@ -1549,7 +1552,8 @@ static void omapfb_free_resources(struct omapfb_device *fbdev, int state)
        case 7:
                omapfb_unregister_sysfs(fbdev);
        case 6:
-               fbdev->panel->disable(fbdev->panel);
+               if (fbdev->panel->disable)
+                       fbdev->panel->disable(fbdev->panel);
        case 5:
                omapfb_set_update_mode(fbdev, OMAPFB_UPDATE_DISABLED);
        case 4:
@@ -1557,7 +1561,8 @@ static void omapfb_free_resources(struct omapfb_device *fbdev, int state)
        case 3:
                ctrl_cleanup(fbdev);
        case 2:
-               fbdev->panel->cleanup(fbdev->panel);
+               if (fbdev->panel->cleanup)
+                       fbdev->panel->cleanup(fbdev->panel);
        case 1:
                dev_set_drvdata(fbdev->dev, NULL);
                kfree(fbdev);
@@ -1680,9 +1685,11 @@ static int omapfb_do_probe(struct platform_device *pdev,
                goto cleanup;
        }
 
-       r = fbdev->panel->init(fbdev->panel, fbdev);
-       if (r)
-               goto cleanup;
+       if (fbdev->panel->init) {
+               r = fbdev->panel->init(fbdev->panel, fbdev);
+               if (r)
+                       goto cleanup;
+       }
 
        pr_info("omapfb: configured for panel %s\n", fbdev->panel->name);
 
@@ -1725,9 +1732,11 @@ static int omapfb_do_probe(struct platform_device *pdev,
                                   OMAPFB_MANUAL_UPDATE : OMAPFB_AUTO_UPDATE);
        init_state++;
 
-       r = fbdev->panel->enable(fbdev->panel);
-       if (r)
-               goto cleanup;
+       if (fbdev->panel->enable) {
+               r = fbdev->panel->enable(fbdev->panel);
+               if (r)
+                       goto cleanup;
+       }
        init_state++;
 
        r = omapfb_register_sysfs(fbdev);