Skip to contentSkip to conversation

drm/i915: Parsing the PWM cntrl and CABC ON/OFF fileds in VBT

PATCH New Deepak M 1 participant 2 messages Nov 26, 2015

Subsystems (2)
lore
Share & tools
lore

Deepak M

author
#0 lore raw

PATCH 1/2 drm/i915: Parsing the PWM cntrl and CABC ON/OFF fileds in VBT

For dual link panel scenarios there are new fileds added in the VBT which indicate on which port the PWM cntrl and CABC ON/OFF commands needs to be sent.

v2: Moving the comment to intel_dsi.h(Jani)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Yetunde Adebisi <[email protected]>
---
 drivers/gpu/drm/i915/intel_bios.c | 10 ++++++++++
 drivers/gpu/drm/i915/intel_bios.h |  5 ++++-
 drivers/gpu/drm/i915/intel_dsi.h  |  9 +++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_bios.c +10 -0
index ce82f9c..2d4d7a0 100644
@@ -793,6 +793,16 @@ parse_mipi(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
 		return;
 	}
 
+	/*
+	 * These fileds are introduced from the VBT version 197 onwards,
+	 * so making sure that these bits are set zero in the pervious
+	 * versions.
+	 */
+	if (dev_priv->vbt.dsi.config->dual_link && bdb->version < 197) {
+		dev_priv->vbt.dsi.config->dl_cabc_port = 0;
+		dev_priv->vbt.dsi.config->pwm_bkl_ctrl = 0;
+	}
+
 	/* We have mandatory mipi config blocks. Initialize as generic panel */
 	dev_priv->vbt.dsi.panel_id = MIPI_DSI_GENERIC_PANEL_ID;
 
drivers/gpu/drm/i915/intel_bios.h +4 -1
index 7ec8c9a..9283969 100644
@@ -832,7 +832,10 @@ struct mipi_config {
 	u16 dual_link:2;
 	u16 lane_cnt:2;
 	u16 pixel_overlap:3;
-	u16 rsvd3:9;
+	u16 rgb_flip:1;
+	u16 dl_cabc_port:2;
+	u16 pwm_bkl_ctrl:2;
+	u16 rsvd3:4;
 
 	u16 rsvd4;
 
drivers/gpu/drm/i915/intel_dsi.h +9 -0
index e6cb252..40fd75a 100644
@@ -74,6 +74,15 @@ struct intel_dsi {
 
 	u8 escape_clk_div;
 	u8 dual_link;
+
+	/*
+	 * Below field will inform us on which port the panel blk_cntrl
+	 * and CABC ON/OFF commands needs to be sent in case of dual link
+	 * panels
+	 */
+	u8 bkl_dcs_ports;
+	u8 pwm_blk_ctrl;
+
 	u8 pixel_overlap;
 	u32 port_bits;
 	u32 bw_timer;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#1 lore raw

PATCH 2/2 drm/i915: CABC support for backlight control

In CABC (Content Adaptive Brightness Control) content grey level scale can be increased while simultaneously decreasing brightness of the backlight to achieve same perceived brightness.

The CABC is not standardized and panel vendors are free to follow their implementation. The CABC implementaion here assumes that the panels use standard SW register for control.

In this design there will be no PWM signal from the SoC and DCS commands are sent to enable and control the backlight brightness.

v2: Moving the CABC bkl functions to new file.(Jani)

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Yetunde Adebisi <[email protected]>
---
 drivers/gpu/drm/i915/Makefile         |   1 +
 drivers/gpu/drm/i915/i915_drv.h       |   2 +-
 drivers/gpu/drm/i915/intel_dsi.c      |  17 +++-
 drivers/gpu/drm/i915/intel_dsi.h      |   4 +
 drivers/gpu/drm/i915/intel_dsi_cabc.c | 179 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_panel.c    |   4 +
 6 files changed, 205 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_dsi_cabc.c
drivers/gpu/drm/i915/Makefile +1 -0
index 0851de07..2c69ed4 100644
@@ -82,6 +82,7 @@ i915-y += dvo_ch7017.o \
 	  intel_dp.o \
 	  intel_dsi.o \
 	  intel_dsi_panel_vbt.o \
+	  intel_dsi_cabc.o \
 	  intel_dsi_pll.o \
 	  intel_dvo.o \
 	  intel_hdmi.o \
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 71bd1dc..5febde4 100644
@@ -3392,7 +3392,7 @@ void intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value,
 		     enum intel_sbi_destination destination);
 u32 vlv_flisdsi_read(struct drm_i915_private *dev_priv, u32 reg);
 void vlv_flisdsi_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
-
+int intel_dsi_cabc_init_backlight_funcs(struct intel_connector *intel_connector);
 int intel_gpu_freq(struct drm_i915_private *dev_priv, int val);
 int intel_freq_opcode(struct drm_i915_private *dev_priv, int val);
 
drivers/gpu/drm/i915/intel_dsi.c +16 -1
index 170ae6f..f40b08f 100644
@@ -1175,8 +1175,23 @@ void intel_dsi_init(struct drm_device *dev)
 		intel_dsi->ports = (1 << PORT_C);
 	}
 
-	if (dev_priv->vbt.dsi.config->dual_link)
+	if (dev_priv->vbt.dsi.config->dual_link) {
 		intel_dsi->ports = ((1 << PORT_A) | (1 << PORT_C));
+		switch (dev_priv->vbt.dsi.config->dl_cabc_port) {
+		case CABC_PORT_A:
+			intel_dsi->bkl_dcs_ports = (1 << PORT_A);
+			break;
+		case CABC_PORT_C:
+			intel_dsi->bkl_dcs_ports = (1 << PORT_C);
+			break;
+		case CABC_PORT_A_AND_C:
+			intel_dsi->bkl_dcs_ports = intel_dsi->ports;
+			break;
+		default:
+			DRM_ERROR("Unknown MIPI ports for sending DCS\n");
+		}
+	} else
+		intel_dsi->bkl_dcs_ports = intel_dsi->ports;
 
 	/* Create a DSI host (and a device) for each port. */
 	for_each_dsi_port(port, intel_dsi->ports) {
drivers/gpu/drm/i915/intel_dsi.h +4 -0
index 40fd75a..0de2b4a 100644
@@ -34,6 +34,10 @@
 #define DSI_DUAL_LINK_FRONT_BACK	1
 #define DSI_DUAL_LINK_PIXEL_ALT		2
 
+#define CABC_PORT_A                     0x00
+#define CABC_PORT_C                     0x01
+#define CABC_PORT_A_AND_C               0x02
+
 struct intel_dsi_host;
 
 struct intel_dsi {
drivers/gpu/drm/i915/intel_dsi_cabc.c new file +179 -0

179 lines not on this page · raw message

drivers/gpu/drm/i915/intel_panel.c +4 -0
index a24df35..a056970 100644
@@ -1744,6 +1744,10 @@ intel_panel_init_backlight_funcs(struct intel_panel *panel)
 	struct drm_device *dev = intel_connector->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
+	if (intel_connector->base.connector_type == DRM_MODE_CONNECTOR_DSI &&
+		intel_dsi_cabc_init_backlight_funcs(intel_connector) == 0)
+		return;
+
 	if (IS_BROXTON(dev)) {
 		panel->backlight.setup = bxt_setup_backlight;
 		panel->backlight.enable = bxt_enable_backlight;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx