Skip to contentSkip to conversation

CABC patch list

PATCH In review Deepak M 2 participants 6 messages Nov 16, 2015 – Nov 25, 2015

Subsystems (2)
lore
Share & tools
lore

Deepak M

author
#0 lore raw

cover CABC patch list

CABC stands for the Content Adaptive Backlight Control.
In the normal display the backlight which we see is due to the backlight which is being modulated by the filter, which is inturn dependent on the image. In brief the CABC does the histogram analysis of the image and then controls the filter and backlight. For example in CABC to display the dark image the backlight is dimmed and then controlls the filter to allow more light, because of which is power consuption will be reduced.

Below are the inital set of patches which supports the CABC. A field exits in the mipi configuration of the VBT which when enabled indiactes the CABC is supported. Depending on this filed the backlight control function pointer are initalized in the intel_panel.c file.

In case of dual link panels depending on the panel the DCS commands have to be send to either PORT A, PORT C or both PORT A and PORT C. Again a filed is added in the VBT to get this data from the version 197 onwards. One of the below patches parses these fields from the VBT.

Addressed the review comments of Jani, which were mentioned in the below RFC patch
http://lists.freedesktop.org/archives/intel-gfx/2015-September/075819.html

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Yetunde Adebisi <[email protected]>

Deepak M (2):
drm/i915: Parsing the PWM cntrl and CABC ON/OFF fileds in VBT drm/i915: CABC support for backlight control

 drivers/gpu/drm/i915/intel_bios.c  |  13 ++++
 drivers/gpu/drm/i915/intel_bios.h  |   5 +-
 drivers/gpu/drm/i915/intel_dsi.c   |  14 +++-
 drivers/gpu/drm/i915/intel_dsi.h   |  26 +++++++
 drivers/gpu/drm/i915/intel_panel.c | 145 +++++++++++++++++++++++++++++++++++--
 5 files changed, 196 insertions(+), 7 deletions(-)
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 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.

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Yetunde Adebisi <[email protected]>
---
 drivers/gpu/drm/i915/intel_bios.c | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_bios.h |  5 ++++-
 drivers/gpu/drm/i915/intel_dsi.h  |  2 ++
 3 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_bios.c +13 -0
index ce82f9c..2ef8721 100644
@@ -793,6 +793,19 @@ parse_mipi(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
 		return;
 	}
 
+	/*
+	 * These below bits 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
+	 *	u16 dl_cabc_port:2;
+	 *	u16 pwm_bkl_ctrl:2;
+	 * But these are introduced from the VBT version 197 onwards, so making
+	 * sure that these bits are 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 +2 -0
index e6cb252..4fde83b 100644
@@ -74,6 +74,8 @@ struct intel_dsi {
 
 	u8 escape_clk_div;
 	u8 dual_link;
+	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
#2 lore raw

Re: [MIPI CABC 1/2] drm/i915: Parsing the PWM cntrl and CABC ON/OFF fileds in VBT

Quoted 25 lines · Deepak M

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.

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Yetunde Adebisi <[email protected]>
---
 drivers/gpu/drm/i915/intel_bios.c | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_bios.h |  5 ++++-
 drivers/gpu/drm/i915/intel_dsi.h  |  2 ++
 3 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_bios.c +3 -0
index ce82f9c..2ef8721 100644
@@ -793,6 +793,19 @@ parse_mipi(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
 		return;
 	}
 
+	/*
+	 * These below bits 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

drivers/gpu/drm/i915/intel_bios.c parse_mipi(struct drm_i915_private *dev_priv, const struct bdb_header *bdb) · line 808

Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +10 -0
+	 *	u16 dl_cabc_port:2;
+	 *	u16 pwm_bkl_ctrl:2;
+	 * But these are introduced from the VBT version 197 onwards, so making
+	 * sure that these bits are 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;
+	}
+

dev_priv->vbt is zero by default, so none of the above is needed.

Quoted 24 lines
drivers/gpu/drm/i915/intel_bios.c +0 -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 +0 -0
index e6cb252..4fde83b 100644

drivers/gpu/drm/i915/intel_dsi.h struct intel_dsi { · line 78

Quoted 5 lines
drivers/gpu/drm/i915/intel_dsi.h +2 -0
@@ -74,6 +74,8 @@ struct intel_dsi {
 
 	u8 escape_clk_div;
 	u8 dual_link;
+	u8 bkl_dcs_ports;
+	u8 pwm_blk_ctrl;

This is a much more natural place to explain what these things do.

Quoted 3 lines
drivers/gpu/drm/i915/intel_dsi.h +0 -0
 	u8 pixel_overlap;
 	u32 port_bits;
 	u32 bw_timer;
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [MIPI CABC 1/2] drm/i915: Parsing the PWM cntrl and CABC ON/OFF fileds in VBT

Quoted 23 lines · Jani Nikula
Quoted 22 lines · Deepak M

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.

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Yetunde Adebisi <[email protected]>
---
 drivers/gpu/drm/i915/intel_bios.c | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_bios.h |  5 ++++-
 drivers/gpu/drm/i915/intel_dsi.h  |  2 ++
 3 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_bios.c +0 -0
index ce82f9c..2ef8721 100644
@@ -793,6 +793,19 @@ parse_mipi(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
 		return;
 	}
 
Quoted 15 lines

drivers/gpu/drm/i915/intel_bios.c parse_mipi(struct drm_i915_private *dev_priv, const struct bdb_header *bdb) · line 808

Quoted 13 lines
drivers/gpu/drm/i915/intel_bios.c +13 -0
+	/*
+	 * These below bits 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
+	 *	u16 dl_cabc_port:2;
+	 *	u16 pwm_bkl_ctrl:2;
+	 * But these are introduced from the VBT version 197 onwards, so making
+	 * sure that these bits are 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;
+	}
+

dev_priv->vbt is zero by default, so none of the above is needed.

Ugh, I didn't realize we just copy the dsi.config verbatim from VBT. Maybe we do want this after all.

Quoted 36 lines
Quoted 25 lines
drivers/gpu/drm/i915/intel_bios.c +0 -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 +0 -0
index e6cb252..4fde83b 100644

drivers/gpu/drm/i915/intel_dsi.h struct intel_dsi { · line 78

Quoted 5 lines
drivers/gpu/drm/i915/intel_dsi.h +2 -0
@@ -74,6 +74,8 @@ struct intel_dsi {
 
 	u8 escape_clk_div;
 	u8 dual_link;
+	u8 bkl_dcs_ports;
+	u8 pwm_blk_ctrl;

This is a much more natural place to explain what these things do.

Quoted 3 lines
drivers/gpu/drm/i915/intel_dsi.h +0 -0
 	u8 pixel_overlap;
 	u32 port_bits;
 	u32 bw_timer;
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#4 lore raw

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

In reply to Deepak M

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.

Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Yetunde Adebisi <[email protected]>

---
Addressed the review comments from Jani which were mentioned in the below patch
http://lists.freedesktop.org/archives/intel-gfx/2015-September/075819.html

Went with the name CABC because the commands which are used here are mainly for CABC and many of the panels have the same commands for the CABC operation. For the cases where PWM is directly from panel PWM, DCS commands may be different and may have to add new functions to support it.

 drivers/gpu/drm/i915/intel_dsi.c   |  14 +++-
 drivers/gpu/drm/i915/intel_dsi.h   |  24 ++++++
 drivers/gpu/drm/i915/intel_panel.c | 145 +++++++++++++++++++++++++++++++++++--
 3 files changed, 177 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +13 -1
index 170ae6f..5d1ba35 100644
@@ -1175,8 +1175,20 @@ 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);
+		case CABC_PORT_C:
+			intel_dsi->bkl_dcs_ports = (1 << PORT_C);
+		case CABC_PORT_A_AND_C:
+			intel_dsi->bkl_dcs_ports = intel_dsi->ports;
+		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 +24 -0
index 4fde83b..4bcee40 100644
@@ -34,6 +34,30 @@
 #define DSI_DUAL_LINK_FRONT_BACK	1
 #define DSI_DUAL_LINK_PIXEL_ALT		2
 
+#define CABC_OFF			(0 << 0)
+#define CABC_USER_INTERFACE_IMAGE	(1 << 0)
+#define CABC_STILL_PICTURE		(2 << 0)
+#define CABC_VIDEO_MODE			(3 << 0)
+
+#define CABC_BACKLIGHT			(1 << 2)
+#define CABC_DIMMING_DISPLAY		(1 << 3)
+#define CABC_BCTRL			(1 << 5)
+
+#define CABC_PORT_A			0x00
+#define CABC_PORT_C			0x01
+#define CABC_PORT_A_AND_C		0x02
+
+#define CABC_MAX_VALUE			0xFF
+
+#define MIPI_DCS_CABC_LEVEL_RD		0x52
+#define MIPI_DCS_CABC_MIN_BRIGHTNESS_RD	0x5F
+#define MIPI_DCS_CABC_CONTROL_RD	0x56
+#define MIPI_DCS_CABC_CONTROL_BRIGHT_RD	0x54
+#define MIPI_DCS_CABC_LEVEL_WR		0x51
+#define MIPI_DCS_CABC_MIN_BRIGHTNESS_WR	0x5E
+#define MIPI_DCS_CABC_CONTROL_WR	0x55
+#define MIPI_DCS_CABC_CONTROL_BRIGHT_WR	0x53
+
 struct intel_dsi_host;
 
 struct intel_dsi {
drivers/gpu/drm/i915/intel_panel.c +140 -5

187 lines not on this page · raw message

Signature · 6 lines
1.9.1

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

Re: [MIPI CABC 2/2] drm/i915: CABC support for backlight control

Quoted 10 lines · Deepak M

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.

I'd like you to move the DSI DCS backlight stuff from intel_panel.c to a new file, say, intel_dsi_dcs_backlight.c, similar to what I told Yetunde to do with DP DPCD backlight [1].

[1] http://patchwork.freedesktop.org/patch/msgid/[email protected]

Quoted 30 lines
Cc Jani Nikula <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Yetunde Adebisi <[email protected]>

---
Addressed the review comments from Jani which were mentioned in the below patch
http://lists.freedesktop.org/archives/intel-gfx/2015-September/075819.html

Went with the name CABC because the commands which are used here are mainly for CABC and many of the panels have the same commands for the CABC operation. For the cases where PWM is directly from panel PWM, DCS commands may be different and may have to add new functions to support it.

 drivers/gpu/drm/i915/intel_dsi.c   |  14 +++-
 drivers/gpu/drm/i915/intel_dsi.h   |  24 ++++++
 drivers/gpu/drm/i915/intel_panel.c | 145 +++++++++++++++++++++++++++++++++++--
 3 files changed, 177 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +1 -1
index 170ae6f..5d1ba35 100644
@@ -1175,8 +1175,20 @@ 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) {

drivers/gpu/drm/i915/intel_dsi.c void intel_dsi_init(struct drm_device *dev) · line 1188

Quoted 10 lines
drivers/gpu/drm/i915/intel_dsi.c +9 -0
 		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);
+		case CABC_PORT_C:
+			intel_dsi->bkl_dcs_ports = (1 << PORT_C);
+		case CABC_PORT_A_AND_C:
+			intel_dsi->bkl_dcs_ports = intel_dsi->ports;
+		default:
+			DRM_ERROR("Unknown MIPI ports for sending DCS\n");

"break;" is useful in making the switch case do what you want.

Quoted 28 lines
drivers/gpu/drm/i915/intel_dsi.c +3 -0
+		}
+	} 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 +14 -0
index 4fde83b..4bcee40 100644
@@ -34,6 +34,30 @@
 #define DSI_DUAL_LINK_FRONT_BACK	1
 #define DSI_DUAL_LINK_PIXEL_ALT		2
 
+#define CABC_OFF			(0 << 0)
+#define CABC_USER_INTERFACE_IMAGE	(1 << 0)
+#define CABC_STILL_PICTURE		(2 << 0)
+#define CABC_VIDEO_MODE			(3 << 0)
+
+#define CABC_BACKLIGHT			(1 << 2)
+#define CABC_DIMMING_DISPLAY		(1 << 3)
+#define CABC_BCTRL			(1 << 5)
+
+#define CABC_PORT_A			0x00
+#define CABC_PORT_C			0x01
+#define CABC_PORT_A_AND_C		0x02
+
+#define CABC_MAX_VALUE			0xFF

drivers/gpu/drm/i915/intel_dsi.h line 60

Quoted 10 lines
drivers/gpu/drm/i915/intel_dsi.h +10 -0
+
+#define MIPI_DCS_CABC_LEVEL_RD		0x52
+#define MIPI_DCS_CABC_MIN_BRIGHTNESS_RD	0x5F
+#define MIPI_DCS_CABC_CONTROL_RD	0x56
+#define MIPI_DCS_CABC_CONTROL_BRIGHT_RD	0x54
+#define MIPI_DCS_CABC_LEVEL_WR		0x51
+#define MIPI_DCS_CABC_MIN_BRIGHTNESS_WR	0x5E
+#define MIPI_DCS_CABC_CONTROL_WR	0x55
+#define MIPI_DCS_CABC_CONTROL_BRIGHT_WR	0x53
+

Put these in the new .c file. The rest of the code shouldn't need to know.

Quoted 24 lines
drivers/gpu/drm/i915/intel_dsi.h +0 -0
 struct intel_dsi_host;
 
 struct intel_dsi {
drivers/gpu/drm/i915/intel_panel.c +6 -0
index a24df35..085d9a6 100644
@@ -34,6 +34,7 @@
 #include <linux/moduleparam.h>
 #include <linux/pwm.h>
 #include "intel_drv.h"
+#include "intel_dsi.h"
 
 #define CRC_PMIC_PWM_PERIOD_NS	21333
 
@@ -533,6 +534,30 @@ static u32 vlv_get_backlight(struct intel_connector *connector)
 	return _vlv_get_backlight(dev, pipe);
 }
 
+static u32 cabc_get_backlight(struct intel_connector *connector)
+{
+	struct intel_dsi *intel_dsi = NULL;
+	struct intel_encoder *encoder = NULL;
+	struct mipi_dsi_device *dsi_device;

drivers/gpu/drm/i915/intel_panel.c static u32 vlv_get_backlight(struct intel_connector *connector) · line 551

Quoted 10 lines
drivers/gpu/drm/i915/intel_panel.c +10 -0
+	u8 data[2] = {0};
+	enum port port;
+
+	encoder = connector->encoder;
+	if (encoder->type == INTEL_OUTPUT_DSI)
+		intel_dsi = enc_to_intel_dsi(&encoder->base);
+	else {
+		DRM_ERROR("Use DSI encoder for CABC\n");
+		return -EINVAL;
+	}

You need to check this once when you setup the CABC backlight, and not afterwards. In the function that sets up the CABC backlight hooks, not the setup hook itself.

Quoted 21 lines
drivers/gpu/drm/i915/intel_panel.c +14 -0
+
+	for_each_dsi_port(port, intel_dsi->bkl_dcs_ports) {
+		dsi_device = intel_dsi->dsi_hosts[port]->device;
+		mipi_dsi_dcs_read(dsi_device, MIPI_DCS_CABC_LEVEL_RD, data, 2);
+	}
+
+	return data[1];
+}
+
 static u32 bxt_get_backlight(struct intel_connector *connector)
 {
 	struct drm_device *dev = connector->base.dev;
@@ -631,6 +656,30 @@ static void vlv_set_backlight(struct intel_connector *connector, u32 level)
 	I915_WRITE(VLV_BLC_PWM_CTL(pipe), tmp | level);
 }
 
+static void cabc_set_backlight(struct intel_connector *connector, u32 level)
+{
+	struct intel_dsi *intel_dsi = NULL;
+	struct intel_encoder *encoder = NULL;
+	struct mipi_dsi_device *dsi_device;

drivers/gpu/drm/i915/intel_panel.c static void vlv_set_backlight(struct intel_connector *connector, u32 level) · line 673

Quoted 10 lines
drivers/gpu/drm/i915/intel_panel.c +10 -0
+	u8 data[2] = {0};
+	enum port port;
+
+	encoder = connector->encoder;
+	if (encoder->type == INTEL_OUTPUT_DSI)
+		intel_dsi = enc_to_intel_dsi(&encoder->base);
+	else {
+		DRM_ERROR("Use DSI encoder for CABC\n");
+		return;
+	}

Same as above.

Quoted 21 lines
drivers/gpu/drm/i915/intel_panel.c +14 -0
+
+	for_each_dsi_port(port, intel_dsi->bkl_dcs_ports) {
+		dsi_device = intel_dsi->dsi_hosts[port]->device;
+		data[1] = level;
+		data[0] = MIPI_DCS_CABC_LEVEL_WR;
+		mipi_dsi_dcs_write_buffer(dsi_device, data, 2);
+	}
+}
+
 static void bxt_set_backlight(struct intel_connector *connector, u32 level)
 {
 	struct drm_device *dev = connector->base.dev;
@@ -798,6 +847,34 @@ static void vlv_disable_backlight(struct intel_connector *connector)
 	I915_WRITE(VLV_BLC_PWM_CTL2(pipe), tmp & ~BLM_PWM_ENABLE);
 }
 
+static void cabc_disable_backlight(struct intel_connector *connector)
+{
+	struct intel_dsi *intel_dsi = NULL;
+	struct intel_encoder *encoder = NULL;
+	struct mipi_dsi_device *dsi_device;

drivers/gpu/drm/i915/intel_panel.c static void vlv_disable_backlight(struct intel_connector *connector) · line 864

Quoted 10 lines
drivers/gpu/drm/i915/intel_panel.c +10 -0
+	enum port port;
+	u8 data[2] = {0};
+
+	encoder = connector->encoder;
+	if (encoder->type == INTEL_OUTPUT_DSI)
+		intel_dsi = enc_to_intel_dsi(&encoder->base);
+	else {
+		DRM_ERROR("Use DSI encoder for CABC\n");
+		return;
+	}

Same as above.

Quoted 26 lines
drivers/gpu/drm/i915/intel_panel.c +19 -0
+
+	intel_panel_actually_set_backlight(connector, 0);
+
+	for_each_dsi_port(port, intel_dsi->bkl_dcs_ports) {
+		dsi_device = intel_dsi->dsi_hosts[port]->device;
+		data[1] = CABC_OFF;
+		data[0] = MIPI_DCS_CABC_CONTROL_WR;
+		mipi_dsi_dcs_write_buffer(dsi_device, data, 2);
+		data[0] = MIPI_DCS_CABC_CONTROL_BRIGHT_WR;
+		mipi_dsi_dcs_write_buffer(dsi_device, data, 2);
+	}
+}
+
 static void bxt_disable_backlight(struct intel_connector *connector)
 {
 	struct drm_device *dev = connector->base.dev;
@@ -1133,6 +1210,36 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
 	mutex_unlock(&dev_priv->backlight_lock);
 }
 
+static void cabc_enable_backlight(struct intel_connector *connector)
+{
+	struct intel_dsi *intel_dsi = NULL;
+	struct intel_encoder *encoder = NULL;
+	struct intel_panel *panel = &connector->panel;
+	struct mipi_dsi_device *dsi_device;

drivers/gpu/drm/i915/intel_panel.c void intel_panel_enable_backlight(struct intel_connector *connector) · line 1228

Quoted 10 lines
drivers/gpu/drm/i915/intel_panel.c +10 -0
+	enum port port;
+	u8 data[2] = {0};
+
+	encoder = connector->encoder;
+	if (encoder->type == INTEL_OUTPUT_DSI)
+		intel_dsi = enc_to_intel_dsi(&encoder->base);
+	else {
+		DRM_ERROR("Use DSI encoder for the CABC\n");
+		return;
+	}

Same as above.

Quoted 24 lines
drivers/gpu/drm/i915/intel_panel.c +17 -0
+
+	for_each_dsi_port(port, intel_dsi->bkl_dcs_ports) {
+		dsi_device = intel_dsi->dsi_hosts[port]->device;
+		data[0] = MIPI_DCS_CABC_CONTROL_BRIGHT_WR;
+		data[1] = CABC_BACKLIGHT | CABC_DIMMING_DISPLAY | CABC_BCTRL;
+		mipi_dsi_dcs_write_buffer(dsi_device, data, 2);
+		data[0] = MIPI_DCS_CABC_CONTROL_WR;
+		data[1] = CABC_STILL_PICTURE;
+		mipi_dsi_dcs_write_buffer(dsi_device, data, 2);
+	}
+
+	intel_panel_actually_set_backlight(connector, panel->backlight.level);
+}
+
 #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
 static int intel_backlight_device_update_status(struct backlight_device *bd)
 {
@@ -1601,6 +1708,26 @@ static int vlv_setup_backlight(struct intel_connector *connector, enum pipe pipe
 	return 0;
 }
 
+static int cabc_setup_backlight(struct intel_connector *connector,
+		enum pipe unused)
+{

drivers/gpu/drm/i915/intel_panel.c static int vlv_setup_backlight(struct intel_connector *connector, enum pipe pipe · line 1723

Quoted 10 lines
drivers/gpu/drm/i915/intel_panel.c +10 -0
+	struct drm_device *dev = connector->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_panel *panel = &connector->panel;
+
+	if (dev_priv->vbt.backlight.present)
+		panel->backlight.present = true;
+	else {
+		DRM_ERROR("no backlight present per VBT\n");
+		return 0;
+	}

Same as above.

Quoted 22 lines
drivers/gpu/drm/i915/intel_panel.c +10 -5
+
+	panel->backlight.max = CABC_MAX_VALUE;
+	panel->backlight.level = CABC_MAX_VALUE;
+
+	return 0;
+}
+
 static int
 bxt_setup_backlight(struct intel_connector *connector, enum pipe unused)
 {
@@ -1745,11 +1872,19 @@ intel_panel_init_backlight_funcs(struct intel_panel *panel)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
 	if (IS_BROXTON(dev)) {
-		panel->backlight.setup = bxt_setup_backlight;
-		panel->backlight.enable = bxt_enable_backlight;
-		panel->backlight.disable = bxt_disable_backlight;
-		panel->backlight.set = bxt_set_backlight;
-		panel->backlight.get = bxt_get_backlight;
+		if (dev_priv->vbt.dsi.config->cabc_supported) {
+			panel->backlight.setup = cabc_setup_backlight;
+			panel->backlight.enable = cabc_enable_backlight;

drivers/gpu/drm/i915/intel_panel.c intel_panel_init_backlight_funcs(struct intel_panel *panel) · line 1887

Quoted 10 lines
drivers/gpu/drm/i915/intel_panel.c +10 -0
+			panel->backlight.disable = cabc_disable_backlight;
+			panel->backlight.set = cabc_set_backlight;
+			panel->backlight.get = cabc_get_backlight;
+		} else {
+			panel->backlight.setup = bxt_setup_backlight;
+			panel->backlight.enable = bxt_enable_backlight;
+			panel->backlight.disable = bxt_disable_backlight;
+			panel->backlight.set = bxt_set_backlight;
+			panel->backlight.get = bxt_get_backlight;
+		}

Why is this Broxton specific? It's DSI specific, so please do this similar to what I told Yetunde to do with DP AUX backlight.

Quoted 3 lines
drivers/gpu/drm/i915/intel_panel.c +0 -0
 	} else if (HAS_PCH_LPT(dev) || HAS_PCH_SPT(dev)) {
 		panel->backlight.setup = lpt_setup_backlight;
 		panel->backlight.enable = lpt_enable_backlight;
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx