[U-Boot] [PATCH V3 3/4] video: add access to GraphicDevice struct
Che-Liang Chiou
clchiou at chromium.org
Tue Oct 18 11:15:37 CEST 2011
video_hw_init() returns this struct, which is quite useful, but it is
probably not okay to call this function multiple times. So this patch
adds video_devinfo() that does nothing but return this struct.
video_devinfo() does not guarantee that this struct is initialized. It
is user's responsibility to make sure that the video device is properly
initialized.
Signed-off-by: Che-Liang Chiou <clchiou at chromium.org>
---
Changes in V3
Add to the patch set
board/eltec/mhpc/mhpc.c | 7 +++++++
drivers/video/ati_radeon_fb.c | 5 +++++
drivers/video/ct69000.c | 5 +++++
drivers/video/fsl_diu_fb.c | 8 +++++++-
drivers/video/mb862xx.c | 5 +++++
drivers/video/mb86r0xgdc.c | 5 +++++
drivers/video/mx3fb.c | 5 +++++
drivers/video/mxc_ipuv3_fb.c | 5 +++++
drivers/video/sed13806.c | 6 ++++++
drivers/video/sm501.c | 5 +++++
drivers/video/smiLynxEM.c | 5 +++++
include/video_fb.h | 6 +++++-
12 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/board/eltec/mhpc/mhpc.c b/board/eltec/mhpc/mhpc.c
index 7cca6b2..0d2c8c9 100644
--- a/board/eltec/mhpc/mhpc.c
+++ b/board/eltec/mhpc/mhpc.c
@@ -466,6 +466,13 @@ void *video_hw_init (void)
/* ------------------------------------------------------------------------- */
+void *video_devinfo(void)
+{
+ return (void *)&gdev;
+}
+
+/* ------------------------------------------------------------------------- */
+
void video_set_lut (unsigned int index,
unsigned char r, unsigned char g, unsigned char b)
{
diff --git a/drivers/video/ati_radeon_fb.c b/drivers/video/ati_radeon_fb.c
index 4a9bd07..77509e1 100644
--- a/drivers/video/ati_radeon_fb.c
+++ b/drivers/video/ati_radeon_fb.c
@@ -770,6 +770,11 @@ void *video_hw_init(void)
return ((void *) pGD);
}
+void *video_devinfo(void)
+{
+ return (void *)&ctfb;
+}
+
void video_set_lut (unsigned int index, /* color number */
unsigned char r, /* red */
unsigned char g, /* green */
diff --git a/drivers/video/ct69000.c b/drivers/video/ct69000.c
index 3db614d..660a64c 100644
--- a/drivers/video/ct69000.c
+++ b/drivers/video/ct69000.c
@@ -1176,6 +1176,11 @@ video_hw_init (void)
return ((void *) &ctfb);
}
+void *video_devinfo(void)
+{
+ return (void *)&ctfb;
+}
+
/*******************************************************************************
*
* Set a RGB color in the LUT (8 bit index)
diff --git a/drivers/video/fsl_diu_fb.c b/drivers/video/fsl_diu_fb.c
index cb43904..6ed6c32 100644
--- a/drivers/video/fsl_diu_fb.c
+++ b/drivers/video/fsl_diu_fb.c
@@ -367,9 +367,10 @@ int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix)
return 0;
}
+static GraphicDevice ctfb;
+
void *video_hw_init(void)
{
- static GraphicDevice ctfb;
const char *options;
unsigned int depth = 0, freq = 0;
@@ -408,3 +409,8 @@ void *video_hw_init(void)
return &ctfb;
}
+
+void *video_devinfo(void)
+{
+ return (void *)&ctfb;
+}
diff --git a/drivers/video/mb862xx.c b/drivers/video/mb862xx.c
index 1a4ba82..36dbdc1 100644
--- a/drivers/video/mb862xx.c
+++ b/drivers/video/mb862xx.c
@@ -444,6 +444,11 @@ void *video_hw_init (void)
return dev;
}
+void *video_devinfo(void)
+{
+ return (void *)&mb862xx;
+}
+
/*
* Set a RGB color in the LUT
*/
diff --git a/drivers/video/mb86r0xgdc.c b/drivers/video/mb86r0xgdc.c
index 345a73b..455aea3 100644
--- a/drivers/video/mb86r0xgdc.c
+++ b/drivers/video/mb86r0xgdc.c
@@ -182,3 +182,8 @@ void *video_hw_init(void)
return pGD;
}
+
+void *video_devinfo(void)
+{
+ return (void *)&mb86r0x;
+}
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index f30deb3..4ff84c8 100644
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
@@ -922,6 +922,11 @@ void *video_hw_init(void)
return (void *) &panel;
}
+void *video_devinfo(void)
+{
+ return (void *)&panel;
+}
+
void video_set_lut(unsigned int index, /* color number */
unsigned char r, /* red */
unsigned char g, /* green */
diff --git a/drivers/video/mxc_ipuv3_fb.c b/drivers/video/mxc_ipuv3_fb.c
index 1bee54c..fd27828 100644
--- a/drivers/video/mxc_ipuv3_fb.c
+++ b/drivers/video/mxc_ipuv3_fb.c
@@ -590,6 +590,11 @@ void *video_hw_init(void)
return (void *)&panel;
}
+void *video_devinfo(void)
+{
+ return (void *)&panel;
+}
+
void video_set_lut(unsigned int index, /* color number */
unsigned char r, /* red */
unsigned char g, /* green */
diff --git a/drivers/video/sed13806.c b/drivers/video/sed13806.c
index 0bf9ba6..ee7b9b9 100644
--- a/drivers/video/sed13806.c
+++ b/drivers/video/sed13806.c
@@ -108,6 +108,12 @@ void *video_hw_init (void)
return (&sed13806);
}
+
+void *video_devinfo(void)
+{
+ return (void *)&sed13806;
+}
+
/*-----------------------------------------------------------------------------
* Epson_wait_idle -- Wait for hardware to become idle
*-----------------------------------------------------------------------------
diff --git a/drivers/video/sm501.c b/drivers/video/sm501.c
index 42ac680..dd2a438 100644
--- a/drivers/video/sm501.c
+++ b/drivers/video/sm501.c
@@ -238,3 +238,8 @@ not_pci:
return (&sm501);
}
+
+void *video_devinfo(void)
+{
+ return (void *)&sm501;
+}
diff --git a/drivers/video/smiLynxEM.c b/drivers/video/smiLynxEM.c
index 2001e9c..87855eb 100644
--- a/drivers/video/smiLynxEM.c
+++ b/drivers/video/smiLynxEM.c
@@ -752,6 +752,11 @@ void *video_hw_init (void)
return ((void*)&smi);
}
+void *video_devinfo(void)
+{
+ return (void *)&smi;
+}
+
/*******************************************************************************
*
* Drawing engine fill on screen region
diff --git a/include/video_fb.h b/include/video_fb.h
index f649c54..239bf37 100644
--- a/include/video_fb.h
+++ b/include/video_fb.h
@@ -76,7 +76,11 @@ typedef struct {
/* Export Graphic Functions */
/******************************************************************************/
-void *video_hw_init (void); /* returns GraphicDevice struct or NULL */
+void *video_hw_init(void); /* initializes the device and
+ returns GraphicDevice struct or NULL */
+
+void *video_devinfo(void); /* returns GraphicDevice struct;
+ _no_ guarantee it is initialized! */
#ifdef VIDEO_HW_BITBLT
void video_hw_bitblt (
--
1.7.3.1
More information about the U-Boot
mailing list