OMAP2PLUS:DSS2: add opt_clock_available in pdata
authorSemwal, Sumit <sumit.semwal@ti.com>
Tue, 1 Mar 2011 08:42:13 +0000 (02:42 -0600)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 11 Mar 2011 13:46:26 +0000 (15:46 +0200)
Provide a function in pdata to allow dss submodules to check if a given
clock is available on a platform as an optional clock.

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
(based on implementation from Senthil)

Signed-off-by: Sumit Semwal <sumit.semwal@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
arch/arm/mach-omap2/display.c
arch/arm/plat-omap/include/plat/display.h

index 16d0db6718aeeee916bb716eb9e998c588622bc9..256d23fb79abad7a3c40f15ea7905972e780ea7b 100644 (file)
@@ -42,6 +42,20 @@ static struct omap_device_pm_latency omap_dss_latency[] = {
        },
 };
 
+/* oh_core is used for getting opt-clocks */
+static struct omap_hwmod       *oh_core;
+
+static bool opt_clock_available(const char *clk_role)
+{
+       int i;
+
+       for (i = 0; i < oh_core->opt_clks_cnt; i++) {
+               if (!strcmp(oh_core->opt_clks[i].role, clk_role))
+                       return true;
+       }
+       return false;
+}
+
 int __init omap_display_init(struct omap_dss_board_info *board_data)
 {
        int r = 0;
@@ -74,9 +88,16 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
                oh_count = ARRAY_SIZE(oh_name) - 2;
                /* last 2 hwmod dev in oh_name are not available for omap3 */
 
+       /* opt_clks are always associated with dss hwmod */
+       oh_core = omap_hwmod_lookup("dss_core");
+       if (!oh_core) {
+               pr_err("Could not look up dss_core.\n");
+               return -ENODEV;
+       }
 
        pdata.board_data = board_data;
        pdata.board_data->get_last_off_on_transaction_id = NULL;
+       pdata.opt_clock_available = opt_clock_available;
 
        for (i = 0; i < oh_count; i++) {
                oh = omap_hwmod_lookup(oh_name[i]);
@@ -84,6 +105,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
                        pr_err("Could not look up %s\n", oh_name[i]);
                        return -ENODEV;
                }
+
                od = omap_device_build(dev_name[i], -1, oh, &pdata,
                                sizeof(struct omap_display_platform_data),
                                omap_dss_latency,
index 2fb057e1cb98b791f2cfae382cb91d651c15206d..4101bcd2133e824790229abdb6c063de8932a7b9 100644 (file)
@@ -240,6 +240,8 @@ static inline int omap_display_init(struct omap_dss_board_info *board_data)
 struct omap_display_platform_data {
        struct omap_dss_board_info *board_data;
        /* TODO: Additional members to be added when PM is considered */
+
+       bool (*opt_clock_available)(const char *clk_role);
 };
 
 struct omap_video_timings {