[Intel-gfx] [RESEND 3/3] drm/i915/dsi: use VBT backlight and CABC port definitions directly

Lisovskiy, Stanislav stanislav.lisovskiy at intel.com
Wed Aug 17 08:14:19 UTC 2022


On Tue, Aug 16, 2022 at 06:37:22PM +0300, Jani Nikula wrote:
> Drop the intermediate values stored in intel_dsi and use the VBT values
> directly, now that they're conveniently stored in panel->vbt.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy at intel.com>

> ---
>  drivers/gpu/drm/i915/display/icl_dsi.c             |  4 ----
>  drivers/gpu/drm/i915/display/intel_dsi.h           |  3 ---
>  .../gpu/drm/i915/display/intel_dsi_dcs_backlight.c | 14 ++++++++------
>  drivers/gpu/drm/i915/display/vlv_dsi.c             |  4 ----
>  4 files changed, 8 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
> index 885c74f60366..c089e392a041 100644
> --- a/drivers/gpu/drm/i915/display/icl_dsi.c
> +++ b/drivers/gpu/drm/i915/display/icl_dsi.c
> @@ -2073,13 +2073,9 @@ void icl_dsi_init(struct drm_i915_private *dev_priv)
>  	if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports & ~intel_dsi->ports))
>  		intel_connector->panel.vbt.dsi.bl_ports &= intel_dsi->ports;
>  
> -	intel_dsi->dcs_backlight_ports = intel_connector->panel.vbt.dsi.bl_ports;
> -
>  	if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports & ~intel_dsi->ports))
>  		intel_connector->panel.vbt.dsi.cabc_ports &= intel_dsi->ports;
>  
> -	intel_dsi->dcs_cabc_ports = intel_connector->panel.vbt.dsi.cabc_ports;
> -
>  	for_each_dsi_port(port, intel_dsi->ports) {
>  		struct intel_dsi_host *host;
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_dsi.h b/drivers/gpu/drm/i915/display/intel_dsi.h
> index eafef0a87fea..ce80bd8be519 100644
> --- a/drivers/gpu/drm/i915/display/intel_dsi.h
> +++ b/drivers/gpu/drm/i915/display/intel_dsi.h
> @@ -89,9 +89,6 @@ struct intel_dsi {
>  	u8 escape_clk_div;
>  	u8 dual_link;
>  
> -	u16 dcs_backlight_ports;
> -	u16 dcs_cabc_ports;
> -
>  	/* RGB or BGR */
>  	bool bgr_enabled;
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_dsi_dcs_backlight.c b/drivers/gpu/drm/i915/display/intel_dsi_dcs_backlight.c
> index 1bc7118c56a2..20e466d843ce 100644
> --- a/drivers/gpu/drm/i915/display/intel_dsi_dcs_backlight.c
> +++ b/drivers/gpu/drm/i915/display/intel_dsi_dcs_backlight.c
> @@ -53,7 +53,7 @@ static u32 dcs_get_backlight(struct intel_connector *connector, enum pipe unused
>  	enum port port;
>  	size_t len = panel->backlight.max > U8_MAX ? 2 : 1;
>  
> -	for_each_dsi_port(port, intel_dsi->dcs_backlight_ports) {
> +	for_each_dsi_port(port, panel->vbt.dsi.bl_ports) {
>  		dsi_device = intel_dsi->dsi_hosts[port]->device;
>  		mipi_dsi_dcs_read(dsi_device, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
>  				  &data, len);
> @@ -80,7 +80,7 @@ static void dcs_set_backlight(const struct drm_connector_state *conn_state, u32
>  		data[1] = level;
>  	}
>  
> -	for_each_dsi_port(port, intel_dsi->dcs_backlight_ports) {
> +	for_each_dsi_port(port, panel->vbt.dsi.bl_ports) {
>  		dsi_device = intel_dsi->dsi_hosts[port]->device;
>  		mode_flags = dsi_device->mode_flags;
>  		dsi_device->mode_flags &= ~MIPI_DSI_MODE_LPM;
> @@ -93,12 +93,13 @@ static void dcs_set_backlight(const struct drm_connector_state *conn_state, u32
>  static void dcs_disable_backlight(const struct drm_connector_state *conn_state, u32 level)
>  {
>  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(to_intel_encoder(conn_state->best_encoder));
> +	struct intel_panel *panel = &to_intel_connector(conn_state->connector)->panel;
>  	struct mipi_dsi_device *dsi_device;
>  	enum port port;
>  
>  	dcs_set_backlight(conn_state, 0);
>  
> -	for_each_dsi_port(port, intel_dsi->dcs_cabc_ports) {
> +	for_each_dsi_port(port, panel->vbt.dsi.cabc_ports) {
>  		u8 cabc = POWER_SAVE_OFF;
>  
>  		dsi_device = intel_dsi->dsi_hosts[port]->device;
> @@ -106,7 +107,7 @@ static void dcs_disable_backlight(const struct drm_connector_state *conn_state,
>  				   &cabc, sizeof(cabc));
>  	}
>  
> -	for_each_dsi_port(port, intel_dsi->dcs_backlight_ports) {
> +	for_each_dsi_port(port, panel->vbt.dsi.bl_ports) {
>  		u8 ctrl = 0;
>  
>  		dsi_device = intel_dsi->dsi_hosts[port]->device;
> @@ -127,10 +128,11 @@ static void dcs_enable_backlight(const struct intel_crtc_state *crtc_state,
>  				 const struct drm_connector_state *conn_state, u32 level)
>  {
>  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(to_intel_encoder(conn_state->best_encoder));
> +	struct intel_panel *panel = &to_intel_connector(conn_state->connector)->panel;
>  	struct mipi_dsi_device *dsi_device;
>  	enum port port;
>  
> -	for_each_dsi_port(port, intel_dsi->dcs_backlight_ports) {
> +	for_each_dsi_port(port, panel->vbt.dsi.bl_ports) {
>  		u8 ctrl = 0;
>  
>  		dsi_device = intel_dsi->dsi_hosts[port]->device;
> @@ -146,7 +148,7 @@ static void dcs_enable_backlight(const struct intel_crtc_state *crtc_state,
>  				   &ctrl, sizeof(ctrl));
>  	}
>  
> -	for_each_dsi_port(port, intel_dsi->dcs_cabc_ports) {
> +	for_each_dsi_port(port, panel->vbt.dsi.cabc_ports) {
>  		u8 cabc = POWER_SAVE_MEDIUM;
>  
>  		dsi_device = intel_dsi->dsi_hosts[port]->device;
> diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c
> index 35136d26e517..784ae52059d1 100644
> --- a/drivers/gpu/drm/i915/display/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c
> @@ -1936,13 +1936,9 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
>  	if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports & ~intel_dsi->ports))
>  		intel_connector->panel.vbt.dsi.bl_ports &= intel_dsi->ports;
>  
> -	intel_dsi->dcs_backlight_ports = intel_connector->panel.vbt.dsi.bl_ports;
> -
>  	if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports & ~intel_dsi->ports))
>  		intel_connector->panel.vbt.dsi.cabc_ports &= intel_dsi->ports;
>  
> -	intel_dsi->dcs_cabc_ports = intel_connector->panel.vbt.dsi.cabc_ports;
> -
>  	/* Create a DSI host (and a device) for each port. */
>  	for_each_dsi_port(port, intel_dsi->ports) {
>  		struct intel_dsi_host *host;
> -- 
> 2.34.1
> 


More information about the Intel-gfx mailing list