Message ID | 1387205794-32246-4-git-send-email-tomi.valkeinen@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
* Tomi Valkeinen <tomi.valkeinen@ti.com> [131216 07:02]: > omapdss driver uses a omapdss platform device to pass platform specific > function pointers and DSS hardware version from the arch code to the > driver. This device is needed also when booting with DT. > > This patch adds omapdss_init_of() function, called from board-generic at > init time, which creates the omapdss device. ... > --- a/arch/arm/mach-omap2/display.c > +++ b/arch/arm/mach-omap2/display.c > @@ -23,6 +23,8 @@ > #include <linux/clk.h> > #include <linux/err.h> > #include <linux/delay.h> > +#include <linux/of.h> > +#include <linux/of_platform.h> > > #include <video/omapdss.h> > #include "omap_hwmod.h" > @@ -514,3 +516,63 @@ int omap_dss_reset(struct omap_hwmod *oh) > > return r; > } > + > +int __init omapdss_init_of(void) > +{ > + int r; > + enum omapdss_version ver; > + > + static struct omap_dss_board_info board_data = { > + .dsi_enable_pads = omap_dsi_enable_pads, > + .dsi_disable_pads = omap_dsi_disable_pads, > + .get_context_loss_count = omap_pm_get_dev_context_loss_count, > + .set_min_bus_tput = omap_dss_set_min_bus_tput, > + }; > + > + ver = omap_display_get_version(); > + > + if (ver == OMAPDSS_VER_UNKNOWN) { > + pr_err("DSS not supported on this SoC\n"); > + return -ENODEV; > + } > + > + board_data.version = ver; > + > + omap_display_device.dev.platform_data = &board_data; > + > + r = platform_device_register(&omap_display_device); > + if (r < 0) { > + pr_err("Unable to register omapdss device\n"); > + return r; > + } You can populate the callback functions in the pdata using OF_DEV_AUXDATA entries in the pdata-quirks.c. That way you could instantiate the dev entry for omap_display_device using DT and deal with it in drivers/video/omap except for the pdata callbacks. Of course that can be done later too. Regards, Tony -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2013-12-16 20:46, Tony Lindgren wrote: > * Tomi Valkeinen <tomi.valkeinen@ti.com> [131216 07:02]: >> omapdss driver uses a omapdss platform device to pass platform specific >> function pointers and DSS hardware version from the arch code to the >> driver. This device is needed also when booting with DT. >> >> This patch adds omapdss_init_of() function, called from board-generic at >> init time, which creates the omapdss device. > ... > >> --- a/arch/arm/mach-omap2/display.c >> +++ b/arch/arm/mach-omap2/display.c >> @@ -23,6 +23,8 @@ >> #include <linux/clk.h> >> #include <linux/err.h> >> #include <linux/delay.h> >> +#include <linux/of.h> >> +#include <linux/of_platform.h> >> >> #include <video/omapdss.h> >> #include "omap_hwmod.h" >> @@ -514,3 +516,63 @@ int omap_dss_reset(struct omap_hwmod *oh) >> >> return r; >> } >> + >> +int __init omapdss_init_of(void) >> +{ >> + int r; >> + enum omapdss_version ver; >> + >> + static struct omap_dss_board_info board_data = { >> + .dsi_enable_pads = omap_dsi_enable_pads, >> + .dsi_disable_pads = omap_dsi_disable_pads, >> + .get_context_loss_count = omap_pm_get_dev_context_loss_count, >> + .set_min_bus_tput = omap_dss_set_min_bus_tput, >> + }; >> + >> + ver = omap_display_get_version(); >> + >> + if (ver == OMAPDSS_VER_UNKNOWN) { >> + pr_err("DSS not supported on this SoC\n"); >> + return -ENODEV; >> + } >> + >> + board_data.version = ver; >> + >> + omap_display_device.dev.platform_data = &board_data; >> + >> + r = platform_device_register(&omap_display_device); >> + if (r < 0) { >> + pr_err("Unable to register omapdss device\n"); >> + return r; >> + } > > You can populate the callback functions in the pdata using > OF_DEV_AUXDATA entries in the pdata-quirks.c. That way you could > instantiate the dev entry for omap_display_device using DT > and deal with it in drivers/video/omap except for the pdata > callbacks. The device we are creating here is not something to be created via DT. So in addition to the devices that match to the DSS hardware blocks, we have a 'omapdss' platform device. That's a legacy one, and it's "virtual" in the sense that it doesn't match any HW block as such. At some point the device should be removed totally, but for now it's there and it's a convenient way to pass the platform data. > Of course that can be done later too. Yes, at the moment I'm trying to minimize the kind of code changes that can be done later. It'd be great to get this into next merge window, but time is running short if I do any bigger changes. Tomi
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 8d972ff18c56..842e4f21ab09 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c @@ -36,6 +36,8 @@ static struct of_device_id omap_dt_match_table[] __initdata = { static void __init omap_generic_init(void) { pdata_quirks_init(omap_dt_match_table); + + omapdss_init_of(); } #ifdef CONFIG_SOC_OMAP2420 diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index e30ef6797c63..04a4d360dd20 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h @@ -307,5 +307,7 @@ extern int omap_dss_reset(struct omap_hwmod *); /* SoC specific clock initializer */ extern int (*omap_clk_init)(void); +int __init omapdss_init_of(void); + #endif /* __ASSEMBLER__ */ #endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */ diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 58347bb874a0..197f431ae279 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c @@ -23,6 +23,8 @@ #include <linux/clk.h> #include <linux/err.h> #include <linux/delay.h> +#include <linux/of.h> +#include <linux/of_platform.h> #include <video/omapdss.h> #include "omap_hwmod.h" @@ -514,3 +516,63 @@ int omap_dss_reset(struct omap_hwmod *oh) return r; } + +int __init omapdss_init_of(void) +{ + int r; + enum omapdss_version ver; + + static struct omap_dss_board_info board_data = { + .dsi_enable_pads = omap_dsi_enable_pads, + .dsi_disable_pads = omap_dsi_disable_pads, + .get_context_loss_count = omap_pm_get_dev_context_loss_count, + .set_min_bus_tput = omap_dss_set_min_bus_tput, + }; + + ver = omap_display_get_version(); + + if (ver == OMAPDSS_VER_UNKNOWN) { + pr_err("DSS not supported on this SoC\n"); + return -ENODEV; + } + + board_data.version = ver; + + omap_display_device.dev.platform_data = &board_data; + + r = platform_device_register(&omap_display_device); + if (r < 0) { + pr_err("Unable to register omapdss device\n"); + return r; + } + + /* create DRM device */ + r = omap_init_drm(); + if (r < 0) { + pr_err("Unable to register omapdrm device\n"); + return r; + } + + /* create vrfb device */ + r = omap_init_vrfb(); + if (r < 0) { + pr_err("Unable to register omapvrfb device\n"); + return r; + } + + /* create FB device */ + r = omap_init_fb(); + if (r < 0) { + pr_err("Unable to register omapfb device\n"); + return r; + } + + /* create V4L2 display device */ + r = omap_init_vout(); + if (r < 0) { + pr_err("Unable to register omap_vout device\n"); + return r; + } + + return 0; +}
omapdss driver uses a omapdss platform device to pass platform specific function pointers and DSS hardware version from the arch code to the driver. This device is needed also when booting with DT. This patch adds omapdss_init_of() function, called from board-generic at init time, which creates the omapdss device. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- arch/arm/mach-omap2/board-generic.c | 2 ++ arch/arm/mach-omap2/common.h | 2 ++ arch/arm/mach-omap2/display.c | 62 +++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+)