public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Girish Pathak <girish.pathak@arm.com>
To: edk2-devel@lists.01.org
Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org,
	Matteo.Carlini@arm.com, Stephanie.Hughes-Fitt@arm.com,
	nd@arm.com
Subject: [PATCH v3 11/16] ArmPlatformPkg: PCD to swap red/blue format for HDLCD
Date: Tue, 20 Mar 2018 16:12:07 +0000	[thread overview]
Message-ID: <20180320161212.79120-12-girish.pathak@arm.com> (raw)
In-Reply-To: <20180320161212.79120-1-girish.pathak@arm.com>

From: Girish Pathak <girish.pathak at arm.com>

This change adds a new PCD PcdArmHdlcdSwapBlueRedSelect
to swap values for HDLCD RED_SELECT and BLUE_SELECT registers
on platforms where blue and red hardware lines are swapped.

If set to TRUE in the platform dsc, HDLCD library will swap the values
while setting RED_SELECT and BLUE_SELECT registers. The default
value of the PCD is FALSE.

NOTE: The motive for this is that a discrepancy in the Red/Blue lines
exists between some VersatileExpress platforms.  Rather than have
divergent code, this build switch allows a simple, pragmatic solution.

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>
---

Notes:
    v3:
    - Please don't nest CPP and C conditionals like this.
      It is difficult to follow, and results in poor build
      time coverage (the non-taken branch at the CPP level
      is never seen by the compiler)                       [Ard]
    
      Done                                                 [Girish]

 ArmPlatformPkg/ArmPlatformPkg.dec      |  3 +++
 ArmPlatformPkg/Library/HdLcd/HdLcd.c   | 11 ++++++++++-
 ArmPlatformPkg/Library/HdLcd/HdLcd.inf |  4 +++-
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
index 378bee9cbc9e4bd50c37b38156016424e24cba73..5231ea822f05c2f281a6190d6eae0fc7d0bc0cb3 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -104,6 +104,9 @@ [PcdsFixedAtBuild.common]
   # Default is set to UEFI console font format PixelBlueGreenRedReserved8BitPerColor
   gArmPlatformTokenSpaceGuid.PcdGopPixelFormat|0x00000001|UINT32|0x00000040
 
+  ## If set, this will swap settings for HDLCD RED_SELECT and BLUE_SELECT registers
+  gArmPlatformTokenSpaceGuid.PcdArmHdLcdSwapBlueRedSelect|FALSE|BOOLEAN|0x00000045
+
 [PcdsFixedAtBuild.common,PcdsDynamic.common]
   ## PL031 RealTimeClock
   gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0|UINT32|0x00000024
diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c
index 96f2bf437fbabd2509f860c67c5442def5b5f03d..5396dde3ba6cd147a8333241a9bc71ab05d7fee3 100644
--- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c
+++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c
@@ -73,6 +73,8 @@ LcdSetMode (
   SCAN_TIMINGS      *Horizontal;
   SCAN_TIMINGS      *Vertical;
 
+  EFI_GRAPHICS_PIXEL_FORMAT  PixelFormat;
+
   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  ModeInfo;
 
   // Set the video mode timings and other relevant information
@@ -96,7 +98,14 @@ LcdSetMode (
     return Status;
   }
 
-  if (ModeInfo.PixelFormat == PixelBlueGreenRedReserved8BitPerColor) {
+  // By default PcdArmHdLcdSwapBlueRedSelect is set to false
+  // However on the Juno platform HW lines for BLUE and RED are swapped
+  // Therefore PcdArmHdLcdSwapBlueRedSelect is set to TRUE for the Juno platform
+  PixelFormat = FixedPcdGetBool (PcdArmHdLcdSwapBlueRedSelect)
+                ? PixelRedGreenBlueReserved8BitPerColor
+                : PixelBlueGreenRedReserved8BitPerColor;
+
+  if (ModeInfo.PixelFormat == PixelFormat) {
     MmioWrite32 (HDLCD_REG_RED_SELECT,  (8 << 8) | 16);
     MmioWrite32 (HDLCD_REG_BLUE_SELECT, (8 << 8) | 0);
   } else {
diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.inf b/ArmPlatformPkg/Library/HdLcd/HdLcd.inf
index 67aad05d210b95b2d23b8e52e4392685efcf3795..7f2ba7bf1c602f4c214eacaa6425bf9ec7e6da15 100644
--- a/ArmPlatformPkg/Library/HdLcd/HdLcd.inf
+++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.inf
@@ -2,7 +2,7 @@
 #
 #  Component description file for HDLCD module
 #
-#  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
+#  Copyright (c) 2011-2018, ARM Ltd. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -40,3 +40,5 @@ [LibraryClasses]
 
 [FixedPcd]
   gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase
+  gArmPlatformTokenSpaceGuid.PcdArmHdLcdSwapBlueRedSelect
+
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'




  parent reply	other threads:[~2018-03-20 16:05 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 16:11 [PATCH v3 00/16] Update GOP Girish Pathak
2018-03-20 16:11 ` [PATCH v3 01/16] ArmPlatformPkg: Rectify line endings of LcdHwNullLib Girish Pathak
2018-03-21 12:53   ` Evan Lloyd
2018-03-20 16:11 ` [PATCH v3 02/16] ArmPlatformPkg: Rectify line endings of LcdPlatformNullLib Girish Pathak
2018-03-21 12:53   ` Evan Lloyd
2018-03-20 16:11 ` [PATCH v3 03/16] ArmPlatformPkg: Tidy Lcd code: Coding standard Girish Pathak
2018-03-21 12:53   ` Evan Lloyd
2018-03-20 16:12 ` [PATCH v3 04/16] ArmPlatformPkg: Tidy Lcd code: Updated comments Girish Pathak
2018-03-21 12:53   ` Evan Lloyd
2018-03-20 16:12 ` [PATCH v3 05/16] ArmPlatformPkg: HDLCD and PL111: Update debug ASSERTS Girish Pathak
2018-03-21 12:53   ` Evan Lloyd
2018-03-20 16:12 ` [PATCH v3 06/16] ArmPlatformPkg: PL111Lcd: Replace magic number with macro Girish Pathak
2018-03-21 12:26   ` Evan Lloyd
2018-03-20 16:12 ` [PATCH v3 07/16] ArmPlatformPkg: PL111Lcd: Combine two writes to LCDControl Girish Pathak
2018-03-21 12:26   ` Evan Lloyd
2018-03-20 16:12 ` [PATCH v3 08/16] ArmPlatformPkg: Implement LcdIdentify function for HDLCD GOP Girish Pathak
2018-03-21 12:26   ` Evan Lloyd
2018-03-20 16:12 ` [PATCH v3 09/16] ArmPlatformPkg: Redefine LcdPlatformGetTimings function Girish Pathak
2018-03-21 12:53   ` Evan Lloyd
2018-03-20 16:12 ` [PATCH v3 10/16] ArmPlatformPkg: Add PCD to select pixel format Girish Pathak
2018-03-21 12:53   ` Evan Lloyd
2018-03-20 16:12 ` Girish Pathak [this message]
2018-03-21 12:53   ` [PATCH v3 11/16] ArmPlatformPkg: PCD to swap red/blue format for HDLCD Evan Lloyd
2018-03-20 16:12 ` [PATCH v3 12/16] ArmPlatformPkg: Additional display modes Girish Pathak
2018-03-21 12:54   ` Evan Lloyd
2018-03-20 16:12 ` [PATCH v3 13/16] ArmPlatformPkg: Reserving framebuffer at build Girish Pathak
2018-03-21 12:54   ` Evan Lloyd
2018-03-20 16:12 ` [PATCH v3 14/16] ArmPlatformPkg: New DP500/DP550/DP650 GOP driver Girish Pathak
2018-03-21 12:54   ` Evan Lloyd
2018-04-23 11:07   ` Leif Lindholm
2018-03-20 16:12 ` [PATCH v3 15/16] ArmPkg: MTL Library interface and Null library implementation Girish Pathak
2018-03-21 12:54   ` Evan Lloyd
2018-04-23 11:11   ` Leif Lindholm
2018-03-20 16:12 ` [PATCH v3 16/16] ArmPkg: Introduce SCMI protocol Girish Pathak
2018-03-21 12:54   ` Evan Lloyd
2018-04-23 11:31   ` Leif Lindholm
2018-04-23 16:06     ` Girish Pathak
2018-04-23 16:22       ` Leif Lindholm
2018-04-23 16:49         ` Girish Pathak
2018-04-23 17:11 ` [PATCH v3 00/16] Update GOP Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180320161212.79120-12-girish.pathak@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox