OMAP2PLUS: DSS2: Clean up omap_display_init()
Currently, omap_display_init() maintains arrays for hwmod name(oh_name) and the correspnding platform_device name(dev_name) needed by omap_device_build(). A variable oh_count keeps a track of the number of devices to build from oh_name based on what omap revision it is. Clean this up by maintaining an array of omap_dss_hwmod_data struct which is defined for each omap revision as suggested by Tomi Valkeinen. Assign the corresponding omap_dss_hwmod_data array struct to the pointer curr_dss_hwmod in omap_display_init(). Signed-off-by: Archit Taneja <archit@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
parent
ab46d8b2a3
commit
179e045369
|
@ -56,37 +56,58 @@ static bool opt_clock_available(const char *clk_role)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct omap_dss_hwmod_data {
|
||||||
|
const char *oh_name;
|
||||||
|
const char *dev_name;
|
||||||
|
const int id;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct omap_dss_hwmod_data omap2_dss_hwmod_data[] __initdata = {
|
||||||
|
{ "dss_core", "omapdss_dss", -1 },
|
||||||
|
{ "dss_dispc", "omapdss_dispc", -1 },
|
||||||
|
{ "dss_rfbi", "omapdss_rfbi", -1 },
|
||||||
|
{ "dss_venc", "omapdss_venc", -1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initdata = {
|
||||||
|
{ "dss_core", "omapdss_dss", -1 },
|
||||||
|
{ "dss_dispc", "omapdss_dispc", -1 },
|
||||||
|
{ "dss_rfbi", "omapdss_rfbi", -1 },
|
||||||
|
{ "dss_venc", "omapdss_venc", -1 },
|
||||||
|
{ "dss_dsi1", "omapdss_dsi1", -1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initdata = {
|
||||||
|
{ "dss_core", "omapdss_dss", -1 },
|
||||||
|
{ "dss_dispc", "omapdss_dispc", -1 },
|
||||||
|
{ "dss_rfbi", "omapdss_rfbi", -1 },
|
||||||
|
{ "dss_venc", "omapdss_venc", -1 },
|
||||||
|
{ "dss_dsi1", "omapdss_dsi1", -1 },
|
||||||
|
{ "dss_dsi2", "omapdss_dsi2", -1 },
|
||||||
|
{ "dss_hdmi", "omapdss_hdmi", -1 },
|
||||||
|
};
|
||||||
|
|
||||||
int __init omap_display_init(struct omap_dss_board_info *board_data)
|
int __init omap_display_init(struct omap_dss_board_info *board_data)
|
||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
struct omap_hwmod *oh;
|
struct omap_hwmod *oh;
|
||||||
struct omap_device *od;
|
struct omap_device *od;
|
||||||
int i;
|
int i, oh_count;
|
||||||
struct omap_display_platform_data pdata;
|
struct omap_display_platform_data pdata;
|
||||||
|
const struct omap_dss_hwmod_data *curr_dss_hwmod;
|
||||||
/*
|
|
||||||
* omap: valid DSS hwmod names
|
|
||||||
* omap2,3,4: dss_core, dss_dispc, dss_rfbi, dss_venc
|
|
||||||
* omap3,4: dss_dsi1
|
|
||||||
* omap4: dss_dsi2, dss_hdmi
|
|
||||||
*/
|
|
||||||
char *oh_name[] = { "dss_core", "dss_dispc", "dss_rfbi", "dss_venc",
|
|
||||||
"dss_dsi1", "dss_dsi2", "dss_hdmi" };
|
|
||||||
char *dev_name[] = { "omapdss_dss", "omapdss_dispc", "omapdss_rfbi",
|
|
||||||
"omapdss_venc", "omapdss_dsi1", "omapdss_dsi2",
|
|
||||||
"omapdss_hdmi" };
|
|
||||||
int oh_count;
|
|
||||||
|
|
||||||
memset(&pdata, 0, sizeof(pdata));
|
memset(&pdata, 0, sizeof(pdata));
|
||||||
|
|
||||||
if (cpu_is_omap24xx())
|
if (cpu_is_omap24xx()) {
|
||||||
oh_count = ARRAY_SIZE(oh_name) - 3;
|
curr_dss_hwmod = omap2_dss_hwmod_data;
|
||||||
/* last 3 hwmod dev in oh_name are not available for omap2 */
|
oh_count = ARRAY_SIZE(omap2_dss_hwmod_data);
|
||||||
else if (cpu_is_omap44xx())
|
} else if (cpu_is_omap34xx()) {
|
||||||
oh_count = ARRAY_SIZE(oh_name);
|
curr_dss_hwmod = omap3_dss_hwmod_data;
|
||||||
else
|
oh_count = ARRAY_SIZE(omap3_dss_hwmod_data);
|
||||||
oh_count = ARRAY_SIZE(oh_name) - 2;
|
} else {
|
||||||
/* last 2 hwmod dev in oh_name are not available for omap3 */
|
curr_dss_hwmod = omap4_dss_hwmod_data;
|
||||||
|
oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
|
||||||
|
}
|
||||||
|
|
||||||
/* opt_clks are always associated with dss hwmod */
|
/* opt_clks are always associated with dss hwmod */
|
||||||
oh_core = omap_hwmod_lookup("dss_core");
|
oh_core = omap_hwmod_lookup("dss_core");
|
||||||
|
@ -100,19 +121,21 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
|
||||||
pdata.opt_clock_available = opt_clock_available;
|
pdata.opt_clock_available = opt_clock_available;
|
||||||
|
|
||||||
for (i = 0; i < oh_count; i++) {
|
for (i = 0; i < oh_count; i++) {
|
||||||
oh = omap_hwmod_lookup(oh_name[i]);
|
oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
|
||||||
if (!oh) {
|
if (!oh) {
|
||||||
pr_err("Could not look up %s\n", oh_name[i]);
|
pr_err("Could not look up %s\n",
|
||||||
|
curr_dss_hwmod[i].oh_name);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
od = omap_device_build(dev_name[i], -1, oh, &pdata,
|
od = omap_device_build(curr_dss_hwmod[i].dev_name,
|
||||||
|
curr_dss_hwmod[i].id, oh, &pdata,
|
||||||
sizeof(struct omap_display_platform_data),
|
sizeof(struct omap_display_platform_data),
|
||||||
omap_dss_latency,
|
omap_dss_latency,
|
||||||
ARRAY_SIZE(omap_dss_latency), 0);
|
ARRAY_SIZE(omap_dss_latency), 0);
|
||||||
|
|
||||||
if (WARN((IS_ERR(od)), "Could not build omap_device for %s\n",
|
if (WARN((IS_ERR(od)), "Could not build omap_device for %s\n",
|
||||||
oh_name[i]))
|
curr_dss_hwmod[i].oh_name))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
omap_display_device.dev.platform_data = board_data;
|
omap_display_device.dev.platform_data = board_data;
|
||||||
|
|
Loading…
Reference in New Issue