drm: Add new DCS commands in the enum list
Subsystems (3)
PATCH 1/5 drm: Add new DCS commands in the enum list
From: Deepak M <[email protected]>
Adding new DCS commands which are specified in the DCS 1.3 spec related to CABC.
v2: Sorted the Macro`s by value (Andrzej)
v3 by Jani: sort all of enum, refer to MIPI DCS 1.3
--- include/video/mipi_display.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/video/mipi_display.h +8 -0
@@ -115,6 +115,14 @@ enum {MIPI_DCS_READ_MEMORY_CONTINUE =0x3E ,MIPI_DCS_SET_TEAR_SCANLINE =0x44 ,MIPI_DCS_GET_SCANLINE =0x45 , +MIPI_DCS_SET_DISPLAY_BRIGHTNESS =0x51 ,/* MIPI DCS 1.3 */ +MIPI_DCS_GET_DISPLAY_BRIGHTNESS =0x52 ,/* MIPI DCS 1.3 */ +MIPI_DCS_WRITE_CONTROL_DISPLAY =0x53 ,/* MIPI DCS 1.3 */ +MIPI_DCS_GET_CONTROL_DISPLAY =0x54 ,/* MIPI DCS 1.3 */ +MIPI_DCS_WRITE_POWER_SAVE =0x55 ,/* MIPI DCS 1.3 */ +MIPI_DCS_GET_POWER_SAVE =0x56 ,/* MIPI DCS 1.3 */ +MIPI_DCS_SET_CABC_MIN_BRIGHTNESS =0x5E ,/* MIPI DCS 1.3 */ +MIPI_DCS_GET_CABC_MIN_BRIGHTNESS =0x5F ,/* MIPI DCS 1.3 */ MIPI_DCS_READ_DDB_START =0xA1 , MIPI_DCS_READ_DDB_CONTINUE = 0xA8, };
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 drm/i915: Parsing the PWM cntrl and CABC ON/OFF fields in VBT
From: Deepak M <[email protected]>
For dual link panel scenarios there are new fields 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)
v3: Renaming the field names (Jani)
v4 by Jani: make this patch only about VBT
--- drivers/gpu/drm/i915/intel_bios.c | 10 ++++++++++ drivers/gpu/drm/i915/intel_bios.h | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_bios.c +10 -0
@@ -746,6 +746,16 @@ parse_mipi_config(struct drm_i915_private *dev_priv,return ; } +/* +* These fields are introduced from the VBT version 197 onwards, +* so making sure that these bits are set zero in the previous +* versions. +*/ +if (dev_priv->vbt.dsi.config->dual_link && bdb->version <197 ) { + dev_priv->vbt.dsi.config->dl_dcs_cabc_ports =0 ; + dev_priv->vbt.dsi.config->dl_dcs_backlight_ports =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 +7 -1
@@ -113,7 +113,13 @@ struct mipi_config { u16 dual_link:2; u16 lane_cnt:2; u16 pixel_overlap:3; - u16 rsvd3:9; + u16 rgb_flip:1; +#define DL_DCS_PORT_A 0x00 +#define DL_DCS_PORT_C 0x01 +#define DL_DCS_PORT_A_AND_C 0x02 + u16 dl_dcs_cabc_ports:2; + u16 dl_dcs_backlight_ports:2; + u16 rsvd3:4;u16 rsvd4;
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
AppliedRe: [PATCH 2/5] drm/i915: Parsing the PWM cntrl and CABC ON/OFF fields in VBT
Quoted 10 lines · Jani Nikula
From: Deepak M <[email protected]>
For dual link panel scenarios there are new fields 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)v3: Renaming the field names (Jani)
Quoted 7 lines
v4 by Jani: make this patch only about VBT
Cc Jani Nikula <[email protected]>Cc Daniel Vetter <[email protected]>Cc Yetunde Adebisi <[email protected]>Signed-off-by Deepak M <[email protected]>Signed-off-by Jani Nikula <[email protected]>
Pushed to drm-intel-next-queued.
BR,
Jani.
Quoted 44 lines
--- drivers/gpu/drm/i915/intel_bios.c | 10 ++++++++++ drivers/gpu/drm/i915/intel_bios.h | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_bios.c +10
-0@@ -746,6 +746,16 @@ parse_mipi_config(struct drm_i915_private *dev_priv,return ; } +/* +* These fields are introduced from the VBT version 197 onwards, +* so making sure that these bits are set zero in the previous +* versions. +*/ +if (dev_priv->vbt.dsi.config->dual_link && bdb->version <197 ) { + dev_priv->vbt.dsi.config->dl_dcs_cabc_ports =0 ; + dev_priv->vbt.dsi.config->dl_dcs_backlight_ports =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 +7
-1@@ -113,7 +113,13 @@ struct mipi_config { u16 dual_link:2; u16 lane_cnt:2; u16 pixel_overlap:3; - u16 rsvd3:9; + u16 rgb_flip:1; +#define DL_DCS_PORT_A 0x00 +#define DL_DCS_PORT_C 0x01 +#define DL_DCS_PORT_A_AND_C 0x02 + u16 dl_dcs_cabc_ports:2; + u16 dl_dcs_backlight_ports:2; + u16 rsvd3:4;u16 rsvd4;
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 drm/i915: Parse LFP brightness control field in VBT
In reply to Jani NikulaFrom: Deepak M <[email protected]>
These fields in VBT indicates the PWM source which is used and also the controller number.
v2 by Jani: check for out of bounds access, some renames, change default type, etc.
v3 by Jani: s/INTEL_BACKLIGHT_CABC/INTEL_BACKLIGHT_DSI_DCS/
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_bios.c | 9 +++++++++ drivers/gpu/drm/i915/intel_bios.h | 8 ++++++++ drivers/gpu/drm/i915/intel_vbt_defs.h | 6 ++++++ 4 files changed, 24 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1472,6 +1472,7 @@ struct intel_vbt_data {bool present;bool active_low_pwm;u8 min_brightness;/* min_brightness/255 of max */ +enum intel_backlight_type type; } backlight;/* MIPI DSI */
drivers/gpu/drm/i915/intel_bios.c +9 -0
@@ -304,6 +304,15 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,return ; } + dev_priv->vbt.backlight.type =INTEL_BACKLIGHT_DISPLAY_DDI ; +if (bdb->version >=191 && +get_blocksize (backlight_data) >=sizeof (*backlight_data)) { +const struct bdb_lfp_backlight_control_method *method; + + method = &backlight_data->backlight_control[panel_type]; + dev_priv->vbt.backlight.type = method->type; + } + dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz; dev_priv->vbt.backlight.active_low_pwm = entry->active_low_pwm; dev_priv->vbt.backlight.min_brightness = entry->min_brightness;
drivers/gpu/drm/i915/intel_bios.h +8 -0
@@ -30,6 +30,14 @@ #ifndef _INTEL_BIOS_H_ #define _INTEL_BIOS_H_ +enum intel_backlight_type { + INTEL_BACKLIGHT_PMIC, + INTEL_BACKLIGHT_LPSS, + INTEL_BACKLIGHT_DISPLAY_DDI, + INTEL_BACKLIGHT_DSI_DCS, + INTEL_BACKLIGHT_PANEL_DRIVER_INTERFACE, +}; + struct edp_power_seq { u16 t1_t3; u16 t8;
drivers/gpu/drm/i915/intel_vbt_defs.h +6 -0
@@ -440,10 +440,16 @@ struct bdb_lfp_backlight_data_entry {u8 obsolete3; } __packed; +struct bdb_lfp_backlight_control_method { +u8 type:4 ; +u8 controller:4 ; +} __packed; +struct bdb_lfp_backlight_data {u8 entry_size;struct bdb_lfp_backlight_data_entry data[16 ];u8 level[16 ]; +struct bdb_lfp_backlight_control_method backlight_control[16 ]; } __packed;struct aimdb_header {
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 drm/i915: Add DCS control for Panel PWM
In reply to Jani NikulaFrom: Deepak M <[email protected]>
If the source of the backlight PWM is from the
panel then the PWM can be controlled by DCS
command, this patch adds the support to
enable/disbale panel PWM, control backlight level
etc...
v2: Moving the CABC bkl functions to new file.(Jani)
v3: Rebase
v4: Rebase
v5: Use mipi_dsi_dcs_write() instead of mipi_dsi_dcs_write_buffer() (Jani)
Move DCS macro`s to include/video/mipi_display.h (Jani)
v6: Rename the file to intel_dsi_panel_pwm.c
Removing the CABC operations
v7 by Jani: renames, rebases, etc.
v8 by Jani: s/INTEL_BACKLIGHT_CABC/INTEL_BACKLIGHT_DSI_DCS/
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_dsi.c | 19 ++- drivers/gpu/drm/i915/intel_dsi.h | 3 + drivers/gpu/drm/i915/intel_dsi_dcs_backlight.c | 157 +++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_panel.c | 4 + 6 files changed, 184 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_dsi_dcs_backlight.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -83,6 +83,7 @@ i915-y += dvo_ch7017.o \ intel_dp_mst.o \ intel_dp.o \ intel_dsi.o \ + intel_dsi_dcs_backlight.o \ intel_dsi_panel_vbt.o \ intel_dsi_pll.o \ intel_dvo.o \
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1325,6 +1325,8 @@ void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port);/* intel_dsi.c */ void intel_dsi_init (struct drm_device *dev); +/* intel_dsi_dcs_backlight.c */ +int intel_dsi_dcs_backlight_init_funcs (struct intel_connector *intel_connector);/* intel_dvo.c */ void intel_dvo_init (struct drm_device *dev);
drivers/gpu/drm/i915/intel_dsi.c +17 -2
@@ -1220,10 +1220,25 @@ void intel_dsi_init(struct drm_device *dev)else intel_encoder->crtc_mask =BIT (PIPE_B ); -if (dev_priv->vbt.dsi.config->dual_link) +if (dev_priv->vbt.dsi.config->dual_link) { intel_dsi->ports =BIT (PORT_A ) |BIT (PORT_C ); -else + +switch (dev_priv->vbt.dsi.config->dl_dcs_backlight_ports) { +case DL_DCS_PORT_A : + intel_dsi->dcs_backlight_ports =BIT (PORT_A ); +break ; +case DL_DCS_PORT_C : + intel_dsi->dcs_backlight_ports =BIT (PORT_C ); +break ; +default : +case DL_DCS_PORT_A_AND_C : + intel_dsi->dcs_backlight_ports =BIT (PORT_A ) |BIT (PORT_C ); +break ; + } + }else { intel_dsi->ports =BIT (port); + intel_dsi->dcs_backlight_ports =BIT (port); + }/* 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 +3 -0
@@ -78,6 +78,9 @@ struct intel_dsi {u8 escape_clk_div;u8 dual_link; + +u16 dcs_backlight_ports; +u8 pixel_overlap;u32 port_bits;u32 bw_timer;
drivers/gpu/drm/i915/intel_dsi_dcs_backlight.c new file +157 -0
157 lines not on this page · raw message
drivers/gpu/drm/i915/intel_panel.c +4 -0
@@ -1718,6 +1718,10 @@ intel_panel_init_backlight_funcs(struct intel_panel *panel) container_of(panel, struct intel_connector, panel);struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +if (connector->base.connector_type ==DRM_MODE_CONNECTOR_DSI && +intel_dsi_dcs_backlight_init_funcs (connector) ==0 ) +return ; +if (IS_BROXTON (dev_priv)) { panel->backlight.setup = bxt_setup_backlight; panel->backlight.enable = bxt_enable_backlight;
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/5 CABC support for Panel PWM backlight control
In reply to Jani NikulaFrom: Deepak M <[email protected]>
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.
CABC is supported only when the PWM source for backlight is from the panel.
v2 by Jani: rebase, renames, check cabc support earlier, etc.
--- drivers/gpu/drm/i915/intel_dsi.c | 17 +++++++++++++++++ drivers/gpu/drm/i915/intel_dsi.h | 1 + drivers/gpu/drm/i915/intel_dsi_dcs_backlight.c | 22 ++++++++++++++++++++++ 3 files changed, 40 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +17 -0
@@ -1235,11 +1235,28 @@ void intel_dsi_init(struct drm_device *dev) intel_dsi->dcs_backlight_ports =BIT (PORT_A ) |BIT (PORT_C );break ; } + +switch (dev_priv->vbt.dsi.config->dl_dcs_cabc_ports) { +case DL_DCS_PORT_A : + intel_dsi->dcs_cabc_ports =BIT (PORT_A ); +break ; +case DL_DCS_PORT_C : + intel_dsi->dcs_cabc_ports =BIT (PORT_C ); +break ; +default : +case DL_DCS_PORT_A_AND_C : + intel_dsi->dcs_cabc_ports =BIT (PORT_A ) |BIT (PORT_C ); +break ; + } }else { intel_dsi->ports =BIT (port); intel_dsi->dcs_backlight_ports =BIT (port); + intel_dsi->dcs_cabc_ports =BIT (port); } +if (!dev_priv->vbt.dsi.config->cabc_supported) + intel_dsi->dcs_cabc_ports =0 ; +/* Create a DSI host (and a device) for each port. */ for_each_dsi_port (port, intel_dsi->ports) {struct intel_dsi_host *host;
drivers/gpu/drm/i915/intel_dsi.h +1 -0
@@ -80,6 +80,7 @@ struct intel_dsi {u8 dual_link;u16 dcs_backlight_ports; +u16 dcs_cabc_ports;u8 pixel_overlap;u32 port_bits;
drivers/gpu/drm/i915/intel_dsi_dcs_backlight.c +22 -0
@@ -33,6 +33,12 @@#define CONTROL_DISPLAY_DD (1 << 3)#define CONTROL_DISPLAY_BL (1 << 2) +#define POWER_SAVE_OFF (0 << 0) +#define POWER_SAVE_LOW (1 << 0) +#define POWER_SAVE_MEDIUM (2 << 0) +#define POWER_SAVE_HIGH (3 << 0) +#define POWER_SAVE_OUTDOOR_MODE (4 << 0) +#define PANEL_PWM_MAX_VALUE 0xFFstatic u32 dcs_get_backlight (struct intel_connector *connector)
@@ -79,6 +85,14 @@ static void dcs_disable_backlight(struct intel_connector *connector)dcs_set_backlight (connector,0 ); +for_each_dsi_port (port, intel_dsi->dcs_cabc_ports) { +u8 cabc =POWER_SAVE_OFF ; + + dsi_device = intel_dsi->dsi_hosts[port]->device; +mipi_dsi_dcs_write (dsi_device,MIPI_DCS_WRITE_POWER_SAVE , + &cabc,sizeof (cabc)); + } +for_each_dsi_port (port, intel_dsi->dcs_backlight_ports) {u8 ctrl =0 ;
@@ -120,6 +134,14 @@ static void dcs_enable_backlight(struct intel_connector *connector) &ctrl, sizeof(ctrl)); } +for_each_dsi_port (port, intel_dsi->dcs_cabc_ports) { +u8 cabc =POWER_SAVE_MEDIUM ; + + dsi_device = intel_dsi->dsi_hosts[port]->device; +mipi_dsi_dcs_write (dsi_device,MIPI_DCS_WRITE_POWER_SAVE , + &cabc,sizeof (cabc)); + } +dcs_set_backlight (connector, panel->backlight.level); }
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Jani Nikula
From: Deepak M <[email protected]>
Adding new DCS commands which are specified in the DCS 1.3 spec related to CABC.
v2: Sorted the Macro`s by value (Andrzej)
v3 by Jani: sort all of enum, refer to MIPI DCS 1.3
Quoted 9 lines
Cc Andrzej Hajda <[email protected]>Cc Thierry Reding <[email protected]>Cc David Airlie <[email protected]>Cc Ville Syrjälä <[email protected]>Cc Daniel Vetter <[email protected]>Cc <[email protected]>Suggested-by Jani Nikula <[email protected]>Signed-off-by Deepak M <[email protected]>Signed-off-by Jani Nikula <[email protected]>
DCS 1.3 introduces also:get_error_count_on_DSI 05hget_image_checksum_ct 15hget_image_checksum_rgb 14hread_PPS_continue a9hread_PPS_start A2h
It would be good to add them, but as the patch says it adds only CABC related commands so no big deal.
Regards
Andrzej
Quoted 13 lines
--- include/video/mipi_display.h | 8 ++++++++ 1 file changed, 8 insertions(+)include/video/mipi_display.h +1
-0@@ -115,6 +115,14 @@ enum {MIPI_DCS_READ_MEMORY_CONTINUE =0x3E ,MIPI_DCS_SET_TEAR_SCANLINE =0x44 ,MIPI_DCS_GET_SCANLINE =0x45 , + MIPI_DCS_SET_DISPLAY_BRIGHTNESS = 0x51, /* MIPI DCS 1.3 */
include/video/mipi_display.h enum { · line 128
Quoted 10 lines
include/video/mipi_display.h +7
-0+MIPI_DCS_GET_DISPLAY_BRIGHTNESS =0x52 ,/* MIPI DCS 1.3 */ +MIPI_DCS_WRITE_CONTROL_DISPLAY =0x53 ,/* MIPI DCS 1.3 */ +MIPI_DCS_GET_CONTROL_DISPLAY =0x54 ,/* MIPI DCS 1.3 */ +MIPI_DCS_WRITE_POWER_SAVE =0x55 ,/* MIPI DCS 1.3 */ +MIPI_DCS_GET_POWER_SAVE =0x56 ,/* MIPI DCS 1.3 */ +MIPI_DCS_SET_CABC_MIN_BRIGHTNESS =0x5E ,/* MIPI DCS 1.3 */ +MIPI_DCS_GET_CABC_MIN_BRIGHTNESS =0x5F ,/* MIPI DCS 1.3 */ MIPI_DCS_READ_DDB_START =0xA1 , MIPI_DCS_READ_DDB_CONTINUE = 0xA8, };
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter
AppliedQuoted 27 lines · Andrzej Hajda
Quoted 9 lines · Jani Nikula
From: Deepak M <[email protected]>
Adding new DCS commands which are specified in the DCS 1.3 spec related to CABC.
v2: Sorted the Macro`s by value (Andrzej)
v3 by Jani: sort all of enum, refer to MIPI DCS 1.3
Quoted 9 lines
Cc Andrzej Hajda <[email protected]>Cc Thierry Reding <[email protected]>Cc David Airlie <[email protected]>Cc Ville Syrjälä <[email protected]>Cc Daniel Vetter <[email protected]>Cc <[email protected]>Suggested-by Jani Nikula <[email protected]>Signed-off-by Deepak M <[email protected]>Signed-off-by Jani Nikula <[email protected]>DCS 1.3 introduces also:
get_error_count_on_DSI05hget_image_checksum_ct15hget_image_checksum_rgb14hread_PPS_continuea9hread_PPS_startA2h
Quoted 4 lines
It would be good to add them, but as the patch says it adds only CABC related commands so no big deal.
Reviewed-by Andrzej Hajda <[email protected]>
Applied to drm-misc, thanks.
-Daniel
Quoted 32 lines
Regards
AndrzejQuoted 13 lines
--- include/video/mipi_display.h | 8 ++++++++ 1 file changed, 8 insertions(+)include/video/mipi_display.h +1
-0@@ -115,6 +115,14 @@ enum {MIPI_DCS_READ_MEMORY_CONTINUE =0x3E ,MIPI_DCS_SET_TEAR_SCANLINE =0x44 ,MIPI_DCS_GET_SCANLINE =0x45 , + MIPI_DCS_SET_DISPLAY_BRIGHTNESS = 0x51, /* MIPI DCS 1.3 */include/video/mipi_display.h enum { · line 128
Quoted 10 lines
include/video/mipi_display.h +7
-0+MIPI_DCS_GET_DISPLAY_BRIGHTNESS =0x52 ,/* MIPI DCS 1.3 */ +MIPI_DCS_WRITE_CONTROL_DISPLAY =0x53 ,/* MIPI DCS 1.3 */ +MIPI_DCS_GET_CONTROL_DISPLAY =0x54 ,/* MIPI DCS 1.3 */ +MIPI_DCS_WRITE_POWER_SAVE =0x55 ,/* MIPI DCS 1.3 */ +MIPI_DCS_GET_POWER_SAVE =0x56 ,/* MIPI DCS 1.3 */ +MIPI_DCS_SET_CABC_MIN_BRIGHTNESS =0x5E ,/* MIPI DCS 1.3 */ +MIPI_DCS_GET_CABC_MIN_BRIGHTNESS =0x5F ,/* MIPI DCS 1.3 */ MIPI_DCS_READ_DDB_START =0xA1 , MIPI_DCS_READ_DDB_CONTINUE = 0xA8, };_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel