The LcdPlatformGetTimings interface function takes similar sets of
multiple parameters for horizontal and vertical timings which can be
aggregated in a common data type. This change defines a structure
SCAN_TIMINGS for this which can be used to describe both horizontal and
vertical scan timings, and accordingly redefines the
LcdPlatformGetTiming interface, greatly reducing the amount of data
passed about.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
LCD_BITS_PER_PIXEL_12_444\r
} LCD_BPP;\r
\r
LCD_BITS_PER_PIXEL_12_444\r
} LCD_BPP;\r
\r
+// Display timing settings.\r
+typedef struct {\r
+ UINT32 Resolution;\r
+ UINT32 Sync;\r
+ UINT32 BackPorch;\r
+ UINT32 FrontPorch;\r
+} SCAN_TIMINGS;\r
+\r
/** Platform related initialization function.\r
\r
@param[in] Handle Handle to the LCD device instance.\r
/** Platform related initialization function.\r
\r
@param[in] Handle Handle to the LCD device instance.\r
\r
@param[in] ModeNumber Mode Number.\r
\r
\r
@param[in] ModeNumber Mode Number.\r
\r
- @param[out] HRes Pointer to horizontal resolution.\r
- @param[out] HSync Pointer to horizontal sync width.\r
- @param[out] HBackPorch Pointer to horizontal back porch.\r
- @param[out] HFrontPorch Pointer to horizontal front porch.\r
- @param[out] VRes Pointer to vertical resolution.\r
- @param[out] VSync Pointer to vertical sync width.\r
- @param[out] VBackPorch Pointer to vertical back porch.\r
- @param[out] VFrontPorch Pointer to vertical front porch.\r
+ @param[out] Horizontal Pointer to horizontal timing parameters.\r
+ (Resolution, Sync, Back porch, Front porch)\r
+ @param[out] Vertical Pointer to vertical timing parameters.\r
+ (Resolution, Sync, Back porch, Front porch)\r
+\r
\r
@retval EFI_SUCCESS Display timing information for the requested\r
mode returned successfully.\r
\r
@retval EFI_SUCCESS Display timing information for the requested\r
mode returned successfully.\r
EFI_STATUS\r
LcdPlatformGetTimings (\r
IN UINT32 ModeNumber,\r
EFI_STATUS\r
LcdPlatformGetTimings (\r
IN UINT32 ModeNumber,\r
- OUT UINT32* HRes,\r
- OUT UINT32* HSync,\r
- OUT UINT32* HBackPorch,\r
- OUT UINT32* HFrontPorch,\r
- OUT UINT32* VRes,\r
- OUT UINT32* VSync,\r
- OUT UINT32* VBackPorch,\r
- OUT UINT32* VFrontPorch\r
+ OUT SCAN_TIMINGS **Horizontal,\r
+ OUT SCAN_TIMINGS **Vertical\r
);\r
\r
/** Return bits per pixel information for a mode number.\r
);\r
\r
/** Return bits per pixel information for a mode number.\r
)\r
{\r
EFI_STATUS Status;\r
)\r
{\r
EFI_STATUS Status;\r
- UINT32 HRes;\r
- UINT32 HSync;\r
- UINT32 HBackPorch;\r
- UINT32 HFrontPorch;\r
- UINT32 VRes;\r
- UINT32 VSync;\r
- UINT32 VBackPorch;\r
- UINT32 VFrontPorch;\r
+ SCAN_TIMINGS *Horizontal;\r
+ SCAN_TIMINGS *Vertical;\r
UINT32 BytesPerPixel;\r
LCD_BPP LcdBpp;\r
\r
// Set the video mode timings and other relevant information\r
Status = LcdPlatformGetTimings (\r
ModeNumber,\r
UINT32 BytesPerPixel;\r
LCD_BPP LcdBpp;\r
\r
// Set the video mode timings and other relevant information\r
Status = LcdPlatformGetTimings (\r
ModeNumber,\r
- &HRes,\r
- &HSync,\r
- &HBackPorch,\r
- &HFrontPorch,\r
- &VRes,\r
- &VSync,\r
- &VBackPorch,\r
- &VFrontPorch\r
+ &Horizontal,\r
+ &Vertical\r
);\r
if (EFI_ERROR (Status)) {\r
ASSERT_EFI_ERROR (Status);\r
return Status;\r
}\r
\r
);\r
if (EFI_ERROR (Status)) {\r
ASSERT_EFI_ERROR (Status);\r
return Status;\r
}\r
\r
+ ASSERT (Horizontal != NULL);\r
+ ASSERT (Vertical != NULL);\r
+\r
Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
if (EFI_ERROR (Status)) {\r
ASSERT_EFI_ERROR (Status);\r
Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
if (EFI_ERROR (Status)) {\r
ASSERT_EFI_ERROR (Status);\r
MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE);\r
\r
// Update the frame buffer information with the new settings\r
MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE);\r
\r
// Update the frame buffer information with the new settings\r
- MmioWrite32 (HDLCD_REG_FB_LINE_LENGTH, HRes * BytesPerPixel);\r
- MmioWrite32 (HDLCD_REG_FB_LINE_PITCH, HRes * BytesPerPixel);\r
- MmioWrite32 (HDLCD_REG_FB_LINE_COUNT, VRes - 1);\r
+ MmioWrite32 (\r
+ HDLCD_REG_FB_LINE_LENGTH,\r
+ Horizontal->Resolution * BytesPerPixel\r
+ );\r
+\r
+ MmioWrite32 (HDLCD_REG_FB_LINE_PITCH, Horizontal->Resolution * BytesPerPixel);\r
+\r
+ MmioWrite32 (HDLCD_REG_FB_LINE_COUNT, Vertical->Resolution - 1);\r
\r
// Set the vertical timing information\r
\r
// Set the vertical timing information\r
- MmioWrite32 (HDLCD_REG_V_SYNC, VSync);\r
- MmioWrite32 (HDLCD_REG_V_BACK_PORCH, VBackPorch);\r
- MmioWrite32 (HDLCD_REG_V_DATA, VRes - 1);\r
- MmioWrite32 (HDLCD_REG_V_FRONT_PORCH, VFrontPorch);\r
+ MmioWrite32 (HDLCD_REG_V_SYNC, Vertical->Sync);\r
+ MmioWrite32 (HDLCD_REG_V_BACK_PORCH, Vertical->BackPorch);\r
+ MmioWrite32 (HDLCD_REG_V_DATA, Vertical->Resolution - 1);\r
+ MmioWrite32 (HDLCD_REG_V_FRONT_PORCH, Vertical->FrontPorch);\r
\r
// Set the horizontal timing information\r
\r
// Set the horizontal timing information\r
- MmioWrite32 (HDLCD_REG_H_SYNC, HSync);\r
- MmioWrite32 (HDLCD_REG_H_BACK_PORCH, HBackPorch);\r
- MmioWrite32 (HDLCD_REG_H_DATA, HRes - 1);\r
- MmioWrite32 (HDLCD_REG_H_FRONT_PORCH, HFrontPorch);\r
+ MmioWrite32 (HDLCD_REG_H_SYNC, Horizontal->Sync);\r
+ MmioWrite32 (HDLCD_REG_H_BACK_PORCH, Horizontal->BackPorch);\r
+ MmioWrite32 (HDLCD_REG_H_DATA, Horizontal->Resolution - 1);\r
+ MmioWrite32 (HDLCD_REG_H_FRONT_PORCH, Horizontal->FrontPorch);\r
\r
// Enable the controller\r
MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_ENABLE);\r
\r
// Enable the controller\r
MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_ENABLE);\r
EFI_STATUS\r
LcdPlatformGetTimings (\r
IN UINT32 ModeNumber,\r
EFI_STATUS\r
LcdPlatformGetTimings (\r
IN UINT32 ModeNumber,\r
- OUT UINT32* HRes,\r
- OUT UINT32* HSync,\r
- OUT UINT32* HBackPorch,\r
- OUT UINT32* HFrontPorch,\r
- OUT UINT32* VRes,\r
- OUT UINT32* VSync,\r
- OUT UINT32* VBackPorch,\r
- OUT UINT32* VFrontPorch\r
+ OUT SCAN_TIMINGS **Horizontal,\r
+ OUT SCAN_TIMINGS **Vertical\r
)\r
{\r
ASSERT (FALSE);\r
)\r
{\r
ASSERT (FALSE);\r
)\r
{\r
EFI_STATUS Status;\r
)\r
{\r
EFI_STATUS Status;\r
- UINT32 HRes;\r
- UINT32 HSync;\r
- UINT32 HBackPorch;\r
- UINT32 HFrontPorch;\r
- UINT32 VRes;\r
- UINT32 VSync;\r
- UINT32 VBackPorch;\r
- UINT32 VFrontPorch;\r
+ SCAN_TIMINGS *Horizontal;\r
+ SCAN_TIMINGS *Vertical;\r
UINT32 LcdControl;\r
LCD_BPP LcdBpp;\r
\r
// Set the video mode timings and other relevant information\r
Status = LcdPlatformGetTimings (\r
ModeNumber,\r
UINT32 LcdControl;\r
LCD_BPP LcdBpp;\r
\r
// Set the video mode timings and other relevant information\r
Status = LcdPlatformGetTimings (\r
ModeNumber,\r
- &HRes,\r
- &HSync,\r
- &HBackPorch,\r
- &HFrontPorch,\r
- &VRes,\r
- &VSync,\r
- &VBackPorch,\r
- &VFrontPorch\r
+ &Horizontal,\r
+ &Vertical\r
);\r
if (EFI_ERROR (Status)) {\r
ASSERT_EFI_ERROR (Status);\r
return Status;\r
}\r
\r
);\r
if (EFI_ERROR (Status)) {\r
ASSERT_EFI_ERROR (Status);\r
return Status;\r
}\r
\r
+ ASSERT (Horizontal != NULL);\r
+ ASSERT (Vertical != NULL);\r
+\r
Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
if (EFI_ERROR (Status)) {\r
ASSERT_EFI_ERROR (Status);\r
Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
if (EFI_ERROR (Status)) {\r
ASSERT_EFI_ERROR (Status);\r
// Set Timings\r
MmioWrite32 (\r
PL111_REG_LCD_TIMING_0,\r
// Set Timings\r
MmioWrite32 (\r
PL111_REG_LCD_TIMING_0,\r
- HOR_AXIS_PANEL (HBackPorch, HFrontPorch, HSync, HRes)\r
+ HOR_AXIS_PANEL (\r
+ Horizontal->BackPorch,\r
+ Horizontal->FrontPorch,\r
+ Horizontal->Sync,\r
+ Horizontal->Resolution\r
+ )\r
);\r
\r
MmioWrite32 (\r
PL111_REG_LCD_TIMING_1,\r
);\r
\r
MmioWrite32 (\r
PL111_REG_LCD_TIMING_1,\r
- VER_AXIS_PANEL (VBackPorch, VFrontPorch, VSync, VRes)\r
+ VER_AXIS_PANEL (\r
+ Vertical->BackPorch,\r
+ Vertical->FrontPorch,\r
+ Vertical->Sync,\r
+ Vertical->Resolution\r
+ )\r
+ );\r
+\r
+ MmioWrite32 (\r
+ PL111_REG_LCD_TIMING_2,\r
+ CLK_SIG_POLARITY (Horizontal->Resolution)\r
- MmioWrite32 (PL111_REG_LCD_TIMING_2, CLK_SIG_POLARITY (HRes));\r
MmioWrite32 (PL111_REG_LCD_TIMING_3, 0);\r
\r
// PL111_REG_LCD_CONTROL\r
MmioWrite32 (PL111_REG_LCD_TIMING_3, 0);\r
\r
// PL111_REG_LCD_CONTROL\r