[PATCH] fix green/pink color distortion from HDR set during vendor Uboot

Mathias Steiger mathias.steiger at googlemail.com
Mon Apr 19 15:33:39 BST 2021


I also wrote a program to set this via /dev/mem from user space: 
https://github.com/ballerburg9005/android-tvbox-2-linux-pc-and-server/blob/main/fix_greenpink.c 
.



diff --git a/drivers/gpu/drm/meson/meson_drv.c 
b/drivers/gpu/drm/meson/meson_drv.c
index 453d8b4c5..7d929b5b2 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -308,6 +308,10 @@ static int meson_drv_bind_master(struct device 
*dev, bool has_components)
         drm->mode_config.funcs = &meson_mode_config_funcs;
         drm->mode_config.helper_private = &meson_mode_config_helpers;

+       /* undo settings made in vendor Uboot */
+
+       writel_bits_relaxed(15 << 13, 0, priv->io_base + 
_REG(OSD1_HDR2_CTRL)); // fixes green/pink color distortion - 
reg_only_mat must be 0
+
         /* Hardware Initialization */

         meson_vpu_init(priv);
diff --git a/drivers/gpu/drm/meson/meson_registers.h 
b/drivers/gpu/drm/meson/meson_registers.h
index 446e7961d..91351f9a3 100644
--- a/drivers/gpu/drm/meson/meson_registers.h
+++ b/drivers/gpu/drm/meson/meson_registers.h
@@ -634,6 +634,9 @@
  #define VPP_WRAP_OSD3_MATRIX_PRE_OFFSET2 0x3dbc
  #define VPP_WRAP_OSD3_MATRIX_EN_CTRL 0x3dbd

+/* osd1 HDR */
+#define OSD1_HDR2_CTRL 0x38a0
+
  /* osd2 scaler */
  #define OSD2_VSC_PHASE_STEP 0x3d00
  #define OSD2_VSC_INI_PHASE 0x3d01




More information about the linux-amlogic mailing list