HDMI 2.0: Scrambling in DRM layer
Subsystems (4)
v6 cover HDMI 2.0: Scrambling in DRM layer
HDMI 2.0 spec defines a method to reduce the RF footprint while operating at higher pixel clocks, which is called Scrambling. Scrambling can be controlled over a new set of I2C registers which are accessible over existing DDC I2C lines, called SCDC register set.
This patch series contains 6 patches:
- First two patches add generic drm helper functions to read and write into SCDC registers. These patches are written by Thierry, in a patch series published here:
https://patchwork.kernel.org/patch/9459051/
Minor changes were done to map the patches into this series.
- Next two patches add functions for scrambling detection and scrambling control.
- Next two patches use this infrastructure in DRM layer from I915 driver, to enable scrambling on a GLK deivce which sports a native HDMI 2.0 controller.
V2:
- addressed review comments from Thierry, Ville and Dhinakaran
- added signed-off-by:self in first two patches(Jani N)
V3:
- addressed review comments from Jose and Jani
V4:
- addressed review comments from Maarten on patch 5, rebase all other patches
V5:
- addressed review comments from Ville/Ander on patch 1, 4, 5 rebase all other patches
V6:
- addressed review comments from Ville on patch 4, 5 rebase all other patches
Shashank Sharma (4):
drm/edid: detect SCDC support in HF-VSDB
drm/edid: detect SCDC support in HF-VSDB
drm/i915: enable scrambling
drm/i915: allow HDMI 2.0 clock rates
Thierry Reding (2):
drm: Add SCDC helpers
drm/edid: check for HF-VSDB block
Documentation/gpu/drm-kms-helpers.rst | 12 ++ drivers/gpu/drm/Makefile | 3 +- drivers/gpu/drm/drm_edid.c | 60 +++++++++ drivers/gpu/drm/drm_scdc_helper.c | 244 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_reg.h | 7 + drivers/gpu/drm/i915/intel_ddi.c | 33 +++++ drivers/gpu/drm/i915/intel_display.c | 5 + drivers/gpu/drm/i915/intel_drv.h | 14 ++ drivers/gpu/drm/i915/intel_hdmi.c | 76 +++++++++++ include/drm/drm_connector.h | 52 ++++++++ include/drm/drm_edid.h | 1 - include/drm/drm_scdc_helper.h | 159 ++++++++++++++++++++++ include/linux/hdmi.h | 1 + 13 files changed, 665 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/drm_scdc_helper.c create mode 100644 include/drm/drm_scdc_helper.h
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v6 1/6 drm: Add SCDC helpers
From: Thierry Reding <[email protected]>
SCDC is a mechanism defined in the HDMI 2.0 specification that allows the source and sink devices to communicate.
This commit introduces helpers to access the SCDC and provides the symbolic names for the various registers defined in the specification.
V2: Rebase.
V3: Added R-B from Jose.
V4: Rebase
V5: Addressed review comments from Ville
- Handle the I2c return values in a better way (dp_dual_mode)
- Make the macros for SCDC Major/Minor more readable, by adding a 'GET' in the macro names
V6: Rebase
--- Documentation/gpu/drm-kms-helpers.rst | 12 ++++ drivers/gpu/drm/Makefile | 3 +- drivers/gpu/drm/drm_scdc_helper.c | 123 +++++++++++++++++++++++++++++++ include/drm/drm_scdc_helper.h | 132 ++++++++++++++++++++++++++++++++++ 4 files changed, 269 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_scdc_helper.c create mode 100644 include/drm/drm_scdc_helper.h
Documentation/gpu/drm-kms-helpers.rst +12 -0
@@ -217,6 +217,18 @@ EDID Helper Functions Reference .. kernel-doc:: drivers/gpu/drm/drm_edid.c :export: +SCDC Helper Functions Reference +=============================== + +.. kernel-doc:: drivers/gpu/drm/drm_scdc_helper.c + :doc: scdc helpers + +.. kernel-doc:: include/drm/drm_scdc_helper.h + :internal: + +.. kernel-doc:: drivers/gpu/drm/drm_scdc_helper.c + :export: + Rectangle Utilities Reference =============================
drivers/gpu/drm/Makefile +2 -1
@@ -31,7 +31,8 @@ drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \ drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \ drm_kms_helper_common.o drm_dp_dual_mode_helper.o \ - drm_simple_kms_helper.o drm_modeset_helper.o + drm_simple_kms_helper.o drm_modeset_helper.o \ + drm_scdc_helper.o drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
drivers/gpu/drm/drm_scdc_helper.c new file +123 -0
123 lines not on this page · raw message
include/drm/drm_scdc_helper.h new file +132 -0
132 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v6 2/6 drm/edid: check for HF-VSDB block
In reply to Shashank SharmaFrom: Thierry Reding <[email protected]>
This patch implements a small function that finds if a given CEA db is hdmi-forum vendor specific data block or not.
V2: Rebase.
V3: Added R-B from Jose.
V4: Rebase
V5: Rebase
V6: Rebase
--- drivers/gpu/drm/drm_edid.c | 15 +++++++++++++++ include/linux/hdmi.h | 1 + 2 files changed, 16 insertions(+)
drivers/gpu/drm/drm_edid.c +15 -0
@@ -3251,6 +3251,21 @@ static bool cea_db_is_hdmi_vsdb(const u8 *db)return hdmi_id ==HDMI_IEEE_OUI ; } +static bool cea_db_is_hdmi_forum_vsdb (const u8 *db) +{ +unsigned int oui; + +if (cea_db_tag (db) !=VENDOR_BLOCK ) +return false; + +if (cea_db_payload_len (db) <7 ) +return false; + + oui = db[3 ] <<16 | db[2 ] <<8 | db[1 ]; + +return oui ==HDMI_FORUM_IEEE_OUI ; +} +#define for_each_cea_db (cea, i, start, end) \ for ((i) = (start); (i) < (end) && (i) + cea_db_payload_len(&(cea)[(i)]) < (end); (i) += cea_db_payload_len(&(cea)[(i)]) + 1)
include/linux/hdmi.h +1 -0
@@ -35,6 +35,7 @@ enum hdmi_infoframe_type { };#define HDMI_IEEE_OUI 0x000c03 +#define HDMI_FORUM_IEEE_OUI 0xc45dd8#define HDMI_INFOFRAME_HEADER_SIZE 4#define HDMI_AVI_INFOFRAME_SIZE 13#define HDMI_SPD_INFOFRAME_SIZE 25
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v6 3/6 drm/edid: detect SCDC support in HF-VSDB
In reply to Shashank SharmaThis patch does following:
- Adds a new structure (drm_hdmi_info) in drm_display_info. This structure will be used to save and indicate if sink supports advanced HDMI 2.0 features
- Adds another structure drm_scdc within drm_hdmi_info, to reflect scdc support and capabilities in connected HDMI 2.0 sink.
- Checks the HF-VSDB block for presence of SCDC, and marks it in scdc structure
- If SCDC is present, checks if sink is capable of generating SCDC read request, and marks it in scdc structure.
V2: Addressed review comments
Thierry:
- Fix typos in commit message and make abbreviation consistent across the commit message.
- Change structure object name from hdmi_info -> hdmi
- Fix typos and abbreviations in description of structure drm_hdmi_info end the description with a full stop.
- Create a structure drm_scdc, and keep all information related to SCDC register set (supported, read request supported) etc in it.
Ville:
- Change rr -> read_request
- Call drm_detect_scrambling function drm_parse_hf_vsdb so that all of HF-VSDB parsing can be kept in same function, in incremental patches.
V3: Rebase.
V4: Rebase.
V5: Rebase.
V6: Rebase.
--- drivers/gpu/drm/drm_edid.c | 14 ++++++++++++++ include/drm/drm_connector.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+)
drivers/gpu/drm/drm_edid.c +14 -0
@@ -3817,6 +3817,18 @@ enum hdmi_quantization_range }EXPORT_SYMBOL (drm_default_rgb_quant_range); +static void drm_parse_hdmi_forum_vsdb (struct drm_connector *connector, +const u8 *hf_vsdb) +{ +struct drm_hdmi_info *hdmi = &connector->display_info.hdmi; + +if (hf_vsdb[6 ] &0x80 ) { + hdmi->scdc.supported = true; +if (hf_vsdb[6 ] &0x40 ) + hdmi->scdc.read_request = true; + } +} +static void drm_parse_hdmi_deep_color_info (struct drm_connector *connector,const u8 *hdmi) {
@@ -3931,6 +3943,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,if (cea_db_is_hdmi_vsdb (db))drm_parse_hdmi_vsdb_video (connector, db); +if (cea_db_is_hdmi_forum_vsdb (db)) +drm_parse_hdmi_forum_vsdb (connector, db); } }
include/drm/drm_connector.h +33 -0
@@ -87,6 +87,34 @@ enum subpixel_order { SubPixelVerticalRGB, SubPixelVerticalBGR, SubPixelNone, + +}; + +/* +* struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink +* +* Provides SCDC register support and capabilities related information on a +* HDMI 2.0 sink. In case of a HDMI 1.4 sink, all parameter must be 0. +*/ +struct drm_scdc { +/** +* @supported: status control & data channel present. +*/ +bool supported; +/** +* @read_request: sink is capable of generating scdc read request. +*/ +bool read_request; +}; + +/** +* struct drm_hdmi_info - runtime information about the connected HDMI sink +* +* Describes if a given display supports advanced HDMI 2.0 features. +* This information is available in CEA-861-F extension blocks (like HF-VSDB). +*/ +struct drm_hdmi_info { +struct drm_scdc scdc; };/**
@@ -204,6 +232,11 @@ struct drm_display_info {* @cea_rev: CEA revision of the HDMI sink. */ u8 cea_rev; + +/** +* @hdmi: advance features of a HDMI sink. +*/ +struct drm_hdmi_info hdmi; }; int drm_display_info_set_bus_formats(struct drm_display_info *info,
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v6 3/6] drm/edid: detect SCDC support in HF-VSDB
Hi Shashank,
Quoted 27 lines · Shashank Sharma
This patch does following:
- Adds a new structure (drm_hdmi_info) indrm_display_info. This structure will be used to save and indicate if sink supports advanced HDMI 2.0 features
- Adds another structuredrm_scdcwithindrm_hdmi_info, to reflect scdc support and capabilities in connected HDMI 2.0 sink.
- Checks the HF-VSDB block for presence of SCDC, and marks it in scdc structure
- If SCDC is present, checks if sink is capable of generating SCDC read request, and marks it in scdc structure.V2: Addressed review comments
Thierry:
- Fix typos in commit message and make abbreviation consistent across the commit message.
- Change structure object name fromhdmi_info-> hdmi
- Fix typos and abbreviations in description of structuredrm_hdmi_infoend the description with a full stop.
- Create a structuredrm_scdc, and keep all information related to SCDC register set (supported, read request supported) etc in it.Ville:
- Change rr ->read_request
- Calldrm_detect_scramblingfunctiondrm_parse_hf_vsdbso that all of HF-VSDB parsing can be kept in same function, in incremental patches.
Quoted 7 lines
V3: Rebase.
V4: Rebase.
V5: Rebase.
V6: Rebase.Signed-off-by Shashank Sharma <[email protected]>Reviewed-by Thierry Reding <[email protected]>
Best regards,
Jose Miguel Abreu
Quoted 78 lines
--- drivers/gpu/drm/drm_edid.c | 14 ++++++++++++++ include/drm/drm_connector.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+)drivers/gpu/drm/drm_edid.c +14
-0@@ -3817,6 +3817,18 @@ enum hdmi_quantization_range }EXPORT_SYMBOL (drm_default_rgb_quant_range); +static void drm_parse_hdmi_forum_vsdb (struct drm_connector *connector, +const u8 *hf_vsdb) +{ +struct drm_hdmi_info *hdmi = &connector->display_info.hdmi; + +if (hf_vsdb[6 ] &0x80 ) { + hdmi->scdc.supported = true; +if (hf_vsdb[6 ] &0x40 ) + hdmi->scdc.read_request = true; + } +} +static void drm_parse_hdmi_deep_color_info (struct drm_connector *connector,const u8 *hdmi) {@@ -3931,6 +3943,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,if (cea_db_is_hdmi_vsdb (db))drm_parse_hdmi_vsdb_video (connector, db); +if (cea_db_is_hdmi_forum_vsdb (db)) +drm_parse_hdmi_forum_vsdb (connector, db); } }include/drm/drm_connector.h +28
-0@@ -87,6 +87,34 @@ enum subpixel_order { SubPixelVerticalRGB, SubPixelVerticalBGR, SubPixelNone, + +}; + +/* +* struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink +* +* Provides SCDC register support and capabilities related information on a +* HDMI 2.0 sink. In case of a HDMI 1.4 sink, all parameter must be 0. +*/ +struct drm_scdc { +/** +* @supported: status control & data channel present. +*/ +bool supported; +/** +* @read_request: sink is capable of generating scdc read request. +*/ +bool read_request; +}; + +/** +* struct drm_hdmi_info - runtime information about the connected HDMI sink +* +* Describes if a given display supports advanced HDMI 2.0 features. +* This information is available in CEA-861-F extension blocks (like HF-VSDB). +*/ +struct drm_hdmi_info { +struct drm_scdc scdc; };/** @@ -204,6 +232,11 @@ struct drm_display_info {* @cea_rev: CEA revision of the HDMI sink.
include/drm/drm_connector.h struct drm_display_info { · line 242
Quoted 10 lines
include/drm/drm_connector.h +5
-0*/ u8 cea_rev; + +/** +* @hdmi: advance features of a HDMI sink. +*/ +struct drm_hdmi_info hdmi; }; int drm_display_info_set_bus_formats(struct drm_display_info *info,
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 4/6 drm/edid: detect SCDC support in HF-VSDB
In reply to Shashank SharmaThis patch does following:
- Adds a new structure (drm_hdmi_info) in drm_display_info. This structure will be used to save and indicate if sink supports advanced HDMI 2.0 features
- Adds another structure drm_scdc within drm_hdmi_info, to reflect scdc support and capabilities in connected HDMI 2.0 sink.
- Checks the HF-VSDB block for presence of SCDC, and marks it in scdc structure
- If SCDC is present, checks if sink is capable of generating SCDC read request, and marks it in scdc structure.
V2: Addressed review comments
Thierry:
- Fix typos in commit message and make abbreviation consistent across the commit message.
- Change structure object name from hdmi_info -> hdmi
- Fix typos and abbreviations in description of structure drm_hdmi_info end the description with a full stop.
- Create a structure drm_scdc, and keep all information related to SCDC register set (supported, read request supported) etc in it.
Ville:
- Change rr -> read_request
- Call drm_detect_scrambling function drm_parse_hf_vsdb so that all of HF-VSDB parsing can be kept in same function, in incremental patches.
V3: Rebase.
V4: Rebase.
V5: Rebase.
V6: Addressed review comments from Ville
- Add clock rate calculations for 1/10 and 1/40 ratios
- Remove leftovers from old patchset
--- drivers/gpu/drm/drm_edid.c | 33 ++++++++++- drivers/gpu/drm/drm_scdc_helper.c | 121 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 19 ++++++ include/drm/drm_edid.h | 1 - include/drm/drm_scdc_helper.h | 27 +++++++++ 5 files changed, 199 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +32 -1
@@ -37,6 +37,7 @@#include <drm/drm_edid.h> #include <drm/drm_encoder.h> #include <drm/drm_displayid.h> +#include <drm/drm_scdc_helper.h> #include "drm_crtc_internal.h"
@@ -3820,13 +3821,43 @@ enum hdmi_quantization_rangestatic void drm_parse_hdmi_forum_vsdb (struct drm_connector *connector,const u8 *hf_vsdb) { -struct drm_hdmi_info *hdmi = &connector->display_info.hdmi; +struct drm_display_info *display = &connector->display_info; +struct drm_hdmi_info *hdmi = &display->hdmi;if (hf_vsdb[6 ] &0x80 ) { hdmi->scdc.supported = true;if (hf_vsdb[6 ] &0x40 ) hdmi->scdc.read_request = true; } + +/* +* All HDMI 2.0 monitors must support scrambling at rates > 340 MHz. +* And as per the spec, three factors confirm this: +* * Availability of a HF-VSDB block in EDID (check) +* * Non zero Max_TMDS_Char_Rate filed in HF-VSDB (let's check) +* * SCDC support available (let's check) +* Lets check it out. +*/ + +if (hf_vsdb[5 ]) { +/* max clock is 5000 KHz times block value */ +u32 max_tmds_clock = hf_vsdb[5 ] *5000 ; +struct drm_scdc *scdc = &hdmi->scdc; + +if (max_tmds_clock >340000 ) { + display->max_tmds_clock = max_tmds_clock; +DRM_DEBUG_KMS ("HF-VSDB: max TMDS clock %d kHz\n" , + display->max_tmds_clock); + } + +if (scdc->supported) { + scdc->scrambling.supported = true; + +/* Few sinks support scrambling for cloks < 340M */ +if ((hf_vsdb[6 ] &0x8 )) + scdc->scrambling.low_rates = true; + } + } } static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
drivers/gpu/drm/drm_scdc_helper.c +121 -0
132 lines not on this page · raw message
include/drm/drm_connector.h +19 -0
@@ -90,6 +90,20 @@ enum subpixel_order { }; +/** +* struct drm_scrambling: sink's scrambling support. +*/ +struct drm_scrambling { +/** +* @supported: scrambling supported for rates > 340 Mhz. +*/ +bool supported; +/** +* @low_rates: scrambling supported for rates <= 340 Mhz. +*/ +bool low_rates; +}; +/* * struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink *
@@ -105,8 +119,13 @@ struct drm_scdc {* @read_request: sink is capable of generating scdc read request. */ bool read_request; +/** +* @scrambling: sink's scrambling capabilities +*/ +struct drm_scrambling scrambling; }; +/** * struct drm_hdmi_info - runtime information about the connected HDMI sink *
include/drm/drm_edid.h +0 -1
@@ -476,5 +476,4 @@ void drm_edid_get_monitor_name(struct edid *edid, char *name,struct drm_display_mode *drm_mode_find_dmt (struct drm_device *dev,int hsize,int vsize,int fresh,bool rb); -#endif /* __DRM_EDID_H__ */
include/drm/drm_scdc_helper.h +27 -0
@@ -129,4 +129,31 @@ static inline int drm_scdc_writeb(struct i2c_adapter *adapter, u8 offset, return drm_scdc_write(adapter, offset, &value, sizeof(value)); } +/** +* drm_scdc_set_scrambling - enable scrambling +* @adapter: I2C adapter for DDC channel +* @enable: bool to indicate if scrambling is to be enabled/disabled +* +* Writes the TMDS config register over SCDC channel, and: +* enables scrambling when enable = 1 +* disables scrambling when enable = 0 +* +* Returns: +* True if scrambling is set/reset successfully, false otherwise. +*/ +bool drm_scdc_set_scrambling (struct i2c_adapter *adapter,bool enable); + +/** +* drm_scdc_set_high_tmds_clock_ratio - set TMDS clock ratio +* @adapter: I2C adapter for DDC channel +* @set: ret or reset the high clock ratio +* +* Writes to the TMDS config register over SCDC channel, and: +* sets TMDS clock ratio to 1/40 when set = 1 +* sets TMDS clock ratio to 1/10 when set = 0 +* +* Returns: +* True if write is successful, false otherwise. +*/ +bool drm_scdc_set_high_tmds_clock_ratio (struct i2c_adapter *adapter,bool set);#endif
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v6 4/6] drm/edid: detect SCDC support in HF-VSDB
Hi Shashank,
Quoted 34 lines · Shashank Sharma
This patch does following:
- Adds a new structure (drm_hdmi_info) indrm_display_info. This structure will be used to save and indicate if sink supports advanced HDMI 2.0 features
- Adds another structuredrm_scdcwithindrm_hdmi_info, to reflect scdc support and capabilities in connected HDMI 2.0 sink.
- Checks the HF-VSDB block for presence of SCDC, and marks it in scdc structure
- If SCDC is present, checks if sink is capable of generating SCDC read request, and marks it in scdc structure.V2: Addressed review comments
Thierry:
- Fix typos in commit message and make abbreviation consistent across the commit message.
- Change structure object name fromhdmi_info-> hdmi
- Fix typos and abbreviations in description of structuredrm_hdmi_infoend the description with a full stop.
- Create a structuredrm_scdc, and keep all information related to SCDC register set (supported, read request supported) etc in it.Ville:
- Change rr ->read_request
- Calldrm_detect_scramblingfunctiondrm_parse_hf_vsdbso that all of HF-VSDB parsing can be kept in same function, in incremental patches.V3: Rebase.
V4: Rebase.
V5: Rebase.
V6: Addressed review comments from Ville
- Add clock rate calculations for 1/10 and 1/40 ratios
- Remove leftovers from old patchset
Quoted 2 lines
Signed-off-by Shashank Sharma <[email protected]>Reviewed-by Thierry Reding <[email protected]>
Maybe drm_scdc_set_scrambling() and drm_scdc_set_high_tmds_clock_ratio() should return int error code instead of bool, but anyway:
Best regards,
Jose Miguel Abreu
Quoted 278 lines
--- drivers/gpu/drm/drm_edid.c | 33 ++++++++++- drivers/gpu/drm/drm_scdc_helper.c | 121 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 19 ++++++ include/drm/drm_edid.h | 1 - include/drm/drm_scdc_helper.h | 27 +++++++++ 5 files changed, 199 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_edid.c +32
-1@@ -37,6 +37,7 @@#include <drm/drm_edid.h> #include <drm/drm_encoder.h> #include <drm/drm_displayid.h> +#include <drm/drm_scdc_helper.h> #include "drm_crtc_internal.h" @@ -3820,13 +3821,43 @@ enum hdmi_quantization_rangestatic void drm_parse_hdmi_forum_vsdb (struct drm_connector *connector,const u8 *hf_vsdb) { -struct drm_hdmi_info *hdmi = &connector->display_info.hdmi; +struct drm_display_info *display = &connector->display_info; +struct drm_hdmi_info *hdmi = &display->hdmi;if (hf_vsdb[6 ] &0x80 ) { hdmi->scdc.supported = true;if (hf_vsdb[6 ] &0x40 ) hdmi->scdc.read_request = true; } + +/* +* All HDMI 2.0 monitors must support scrambling at rates > 340 MHz. +* And as per the spec, three factors confirm this: +* * Availability of a HF-VSDB block in EDID (check) +* * Non zero Max_TMDS_Char_Rate filed in HF-VSDB (let's check) +* * SCDC support available (let's check) +* Lets check it out. +*/ + +if (hf_vsdb[5 ]) { +/* max clock is 5000 KHz times block value */ +u32 max_tmds_clock = hf_vsdb[5 ] *5000 ; +struct drm_scdc *scdc = &hdmi->scdc; + +if (max_tmds_clock >340000 ) { + display->max_tmds_clock = max_tmds_clock; +DRM_DEBUG_KMS ("HF-VSDB: max TMDS clock %d kHz\n" , + display->max_tmds_clock); + } + +if (scdc->supported) { + scdc->scrambling.supported = true; + +/* Few sinks support scrambling for cloks < 340M */ +if ((hf_vsdb[6 ] &0x8 )) + scdc->scrambling.low_rates = true; + } + } } static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,drivers/gpu/drm/drm_scdc_helper.c +121
-0@@ -22,8 +22,10 @@*/ #include <linux/slab.h> +#include <linux/delay.h> #include <drm/drm_scdc_helper.h> +#include <drm/drmP.h> /** * DOC: scdc helpers @@ -121,3 +123,122 @@ ssize_t drm_scdc_write(struct i2c_adapter *adapter, u8 offset,return 0 ; }EXPORT_SYMBOL (drm_scdc_write); + +/** +* drm_scdc_check_scrambling_status - what is status of scrambling? +* @adapter: I2C adapter for DDC channel +* +* Reads the scrambler status over SCDC, and checks the +* scrambling status. +* +* Returns: +* True if the scrambling is enabled, false otherwise. +*/ + +bool drm_scdc_get_scrambling_status (struct i2c_adapter *adapter) +{ +u8 status; +int ret; + + ret =drm_scdc_readb (adapter,SCDC_SCRAMBLER_STATUS , &status); +if (ret <0 ) { +DRM_ERROR ("Failed to read scrambling status, error %d\n" , ret); +return false; + } + +return status &SCDC_SCRAMBLING_STATUS ; +} +EXPORT_SYMBOL (drm_scdc_get_scrambling_status); + +/** +* drm_scdc_set_scrambling - enable scrambling +* @adapter: I2C adapter for DDC channel +* @enable: bool to indicate if scrambling is to be enabled/disabled +* +* Writes the TMDS config register over SCDC channel, and: +* enables scrambling when enable = 1 +* disables scrambling when enable = 0 +* +* Returns: +* True if scrambling is set/reset successfully, false otherwise. +*/ + +bool drm_scdc_set_scrambling (struct i2c_adapter *adapter,bool enable) +{ +u8 config; +int ret; + + ret =drm_scdc_readb (adapter,SCDC_TMDS_CONFIG , &config); +if (ret <0 ) { +DRM_ERROR ("Failed to read tmds config, err=%d\n" , ret); +return false; + } + +if (enable) + config |=SCDC_SCRAMBLING_ENABLE ; +else + config &= ~SCDC_SCRAMBLING_ENABLE ; + + ret =drm_scdc_writeb (adapter,SCDC_TMDS_CONFIG , config); +if (ret <0 ) { +DRM_ERROR ("Failed to enable scrambling, error %d\n" , ret); +return false; + } + +return true; +} +EXPORT_SYMBOL (drm_scdc_set_scrambling); + +/** +* drm_scdc_set_high_tmds_clock_ratio - set TMDS clock ratio +* @adapter: I2C adapter for DDC channel +* @set: ret or reset the high clock ratio +* +* TMDS clock ratio calculations go like this: +* TMDS character = 10 bit TMDS encoded value +* TMDS character rate = The rate at which TMDS characters are transmitted(Mcsc) +* TMDS bit rate = 10x TMDS character rate +* As per the spec: +* TMDS clock rate for pixel clock < 340 MHz = 1x the character rate +* = 1/10 pixel clock rate +* TMDS clock rate for pixel clock > 340 MHz = 0.25x the character rate +* = 1/40 pixel clock rate +* +* Writes to the TMDS config register over SCDC channel, and: +* sets TMDS clock ratio to 1/40 when set = 1 +* sets TMDS clock ratio to 1/10 when set = 0 +* +* Returns: +* True if write is successful, false otherwise. +*/ +bool drm_scdc_set_high_tmds_clock_ratio (struct i2c_adapter *adapter,bool set) +{ +u8 config; +int ret; + + ret =drm_scdc_readb (adapter,SCDC_TMDS_CONFIG , &config); +if (ret <0 ) { +DRM_ERROR ("Failed to read tmds config, err=%d\n" , ret); +return false; + } + +if (set) + config |=SCDC_TMDS_BIT_CLOCK_RATIO_BY_40 ; +else + config &= ~SCDC_TMDS_BIT_CLOCK_RATIO_BY_40 ; + + ret =drm_scdc_writeb (adapter,SCDC_TMDS_CONFIG , config); +if (ret <0 ) { +DRM_ERROR ("Failed to set TMDS clock ratio, error %d\n" , ret); +return false; + } + +/* +* The spec says that a source should wait minimum 1ms and maximum +* 100ms after writing the TMDS config for clock ratio. Lets allow a +* wait of upto 2ms here. +*/ +usleep_range (1000 ,2000 ); +return true; +} +EXPORT_SYMBOL (drm_scdc_set_high_tmds_clock_ratio);include/drm/drm_connector.h +19
-0@@ -90,6 +90,20 @@ enum subpixel_order { }; +/** +* struct drm_scrambling: sink's scrambling support. +*/ +struct drm_scrambling { +/** +* @supported: scrambling supported for rates > 340 Mhz. +*/ +bool supported; +/** +* @low_rates: scrambling supported for rates <= 340 Mhz. +*/ +bool low_rates; +}; +/* * struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink * @@ -105,8 +119,13 @@ struct drm_scdc {* @read_request: sink is capable of generating scdc read request. */ bool read_request; +/** +* @scrambling: sink's scrambling capabilities +*/ +struct drm_scrambling scrambling; }; +/** * struct drm_hdmi_info - runtime information about the connected HDMI sink * include/drm/drm_edid.h +0
-1@@ -476,5 +476,4 @@ void drm_edid_get_monitor_name(struct edid *edid, char *name,struct drm_display_mode *drm_mode_find_dmt (struct drm_device *dev,int hsize,int vsize,int fresh,bool rb); -#endif /* __DRM_EDID_H__ */ include/drm/drm_scdc_helper.h +18
-0@@ -129,4 +129,31 @@ static inline int drm_scdc_writeb(struct i2c_adapter *adapter, u8 offset,return drm_scdc_write (adapter, offset, &value,sizeof (value)); } +/** +* drm_scdc_set_scrambling - enable scrambling +* @adapter: I2C adapter for DDC channel +* @enable: bool to indicate if scrambling is to be enabled/disabled +* +* Writes the TMDS config register over SCDC channel, and: +* enables scrambling when enable = 1 +* disables scrambling when enable = 0 +* +* Returns: +* True if scrambling is set/reset successfully, false otherwise. +*/ +bool drm_scdc_set_scrambling (struct i2c_adapter *adapter,bool enable); + +/** +* drm_scdc_set_high_tmds_clock_ratio - set TMDS clock ratio +* @adapter: I2C adapter for DDC channel +* @set: ret or reset the high clock ratio
include/drm/drm_scdc_helper.h static inline int drm_scdc_writeb(struct i2c_adapter *adapter, u8 offset, · line 159
Quoted 10 lines
include/drm/drm_scdc_helper.h +9
-0+* +* Writes to the TMDS config register over SCDC channel, and: +* sets TMDS clock ratio to 1/40 when set = 1 +* sets TMDS clock ratio to 1/10 when set = 0 +* +* Returns: +* True if write is successful, false otherwise. +*/ +bool drm_scdc_set_high_tmds_clock_ratio (struct i2c_adapter *adapter,bool set);#endif
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 5/6 drm/i915: enable scrambling
In reply to Shashank SharmaGeminilake platform sports a native HDMI 2.0 controller, and is capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec mendates scrambling for these higher clocks, for reduced RF footprint.
This patch checks if the monitor supports scrambling, and if required, enables it during the modeset.
V2: Addressed review comments from Ville:
- Do not track scrambling status in DRM layer, track somewhere in driver like in intel_crtc_state.
- Don't talk to monitor at such a low layer, set monitor scrambling in intel_enable_ddi() before enabling the port.
V3: Addressed review comments from Jani
- In comments, function names, use "sink" instead of "monitor", so that the implementation could be close to the language of HDMI spec.
V4: Addressed review comment from Maarten
- scrambling -> hdmi_scrambling high_tmds_clock_ratio -> hdmi_high_tmds_clock_ratio
V5: Addressed review comments from Ville and Ander
- Do not modifiy the crtc_state after compute_config. Move all scrambling and tmds_clock_ratio calcutations to compute_config.
- While setting scrambling for source/sink, do not check the conditions again, just go by the crtc_state flags. This will simplyfy the condition checks.
V6: Addressed review comments from Ville
- Do not add IS_GLK check in disable/enable function, instead add it in compute_config, while setting state flags.
- Remove unnecessary paranthesis.
- Simplyfy handle_sink_scrambling function as suggested.
- Add readout code for scrambling status in get_ddi_config and add a check for the same in pipe_config_compare.
--- drivers/gpu/drm/i915/i915_reg.h | 7 ++++ drivers/gpu/drm/i915/intel_ddi.c | 33 ++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 5 +++ drivers/gpu/drm/i915/intel_drv.h | 14 +++++++ drivers/gpu/drm/i915/intel_hdmi.c | 74 ++++++++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +7 -0
@@ -7824,7 +7824,14 @@ enum {#define TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12)#define TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12)#define TRANS_DDI_DP_VC_PAYLOAD_ALLOC (1<<8) +#define TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7) +#define TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)#define TRANS_DDI_BFI_ENABLE (1<<4) +#define TRANS_DDI_HIGH_TMDS_CHAR_RATE (1<<4) +#define TRANS_DDI_HDMI_SCRAMBLING (1<<0) +#define TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \ + | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \ + | TRANS_DDI_HDMI_SCRAMBLING)/* DisplayPort Transport Control */ #define _DP_TP_CTL_A 0x64040
drivers/gpu/drm/i915/intel_ddi.c +33 -0
@@ -1311,6 +1311,11 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) temp |=TRANS_DDI_MODE_SELECT_HDMI ; else temp |= TRANS_DDI_MODE_SELECT_DVI; + +if (IS_GEMINILAKE (dev_priv)) + temp =intel_hdmi_handle_source_scrambling ( + intel_encoder, + intel_crtc->config, temp); }else if (type ==INTEL_OUTPUT_ANALOG ) { temp |=TRANS_DDI_MODE_SELECT_FDI ; temp |= (intel_crtc->config->fdi_lanes -1 ) <<1 ;
@@ -1885,6 +1890,21 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder,struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder); +if (IS_GEMINILAKE (dev_priv)) { +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc); +/* +* GLK sports a native HDMI 2.0 controller. If required +* clock rate is > 340 Mhz && scrambling is supported +* by sink, enable scrambling before enabling the +* HDMI 2.0 port. The sink can choose to disable the +* scrambling if it doesn't detect a scrambled within +* 100 ms. +*/ +intel_hdmi_handle_sink_scrambling (intel_encoder, + conn_state->connector, + crtc->config, true); + } +/* In HDMI/DVI mode, the port width, and swing/emphasis values * are ignored so nothing special needs to be done besides * enabling the port.
@@ -1917,6 +1937,14 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder,if (old_crtc_state->has_audio)intel_audio_codec_disable (intel_encoder); +if (type ==INTEL_OUTPUT_HDMI ) { +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); + +intel_hdmi_handle_sink_scrambling (intel_encoder, + old_conn_state->connector, + intel_crtc->config, false); + } +if (type ==INTEL_OUTPUT_EDP ) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder);
@@ -2044,6 +2072,11 @@ void intel_ddi_get_config(struct intel_encoder *encoder,if (intel_hdmi->infoframe_enabled (&encoder->base, pipe_config)) pipe_config->has_infoframe = true; + +if (temp &TRANS_DDI_HDMI_SCRAMBLING_MASK ) + pipe_config->hdmi_scrambling = true; +if (temp &TRANS_DDI_HIGH_TMDS_CHAR_RATE ) + pipe_config->hdmi_high_tmds_clock_ratio = true;/* fall through */ case TRANS_DDI_MODE_SELECT_DVI : pipe_config->lane_count =4 ;
drivers/gpu/drm/i915/intel_display.c +5 -0
@@ -11662,6 +11662,11 @@ static void __printf(3, 4)if ((INTEL_GEN (dev_priv) <8 && !IS_HASWELL (dev_priv)) ||IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv))PIPE_CONF_CHECK_I (limited_color_range); +if (IS_GEMINILAKE (dev_priv)) { +PIPE_CONF_CHECK_I (hdmi_scrambling); +PIPE_CONF_CHECK_I (hdmi_high_tmds_clock_ratio); + } +PIPE_CONF_CHECK_I (has_infoframe);PIPE_CONF_CHECK_I (has_audio);
drivers/gpu/drm/i915/intel_drv.h +14 -0
@@ -695,6 +695,12 @@ struct intel_crtc_state {/* Gamma mode programmed on the pipe */ uint32_t gamma_mode; + +/* HDMI scrambling status (sink) */ +bool hdmi_scrambling; + +/* HDMI High TMDS char rate ratio (sink) */ +bool hdmi_high_tmds_clock_ratio; };struct vlv_wm_state {
@@ -1626,6 +1632,14 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,bool intel_hdmi_compute_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config,struct drm_connector_state *conn_state); +uint32_t +intel_hdmi_handle_source_scrambling (struct intel_encoder *intel_encoder, +struct intel_crtc_state *config, +uint32_t hdmi_config); +void intel_hdmi_handle_sink_scrambling (struct intel_encoder *intel_encoder, +struct drm_connector *connector, +struct intel_crtc_state *config, +bool enable);void intel_dp_dual_mode_set_tmds_output (struct intel_hdmi *hdmi,bool enable);
drivers/gpu/drm/i915/intel_hdmi.c +74 -0
98 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v6 5/6] drm/i915: enable scrambling
Quoted 52 lines · Shashank Sharma
Geminilake platform sports a native HDMI 2.0 controller, and is capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec mendates scrambling for these higher clocks, for reduced RF footprint.
This patch checks if the monitor supports scrambling, and if required, enables it during the modeset.
V2: Addressed review comments from Ville:
- Do not track scrambling status in DRM layer, track somewhere in driver like inintel_crtc_state.
- Don't talk to monitor at such a low layer, set monitor scrambling inintel_enable_ddi()before enabling the port.V3: Addressed review comments from Jani
- In comments, function names, use "sink" instead of "monitor", so that the implementation could be close to the language of HDMI spec.V4: Addressed review comment from Maarten
- scrambling ->hdmi_scramblinghigh_tmds_clock_ratio->hdmi_high_tmds_clock_ratioV5: Addressed review comments from Ville and Ander
- Do not modifiy thecrtc_stateaftercompute_config. Move all scrambling andtmds_clock_ratiocalcutations tocompute_config.
- While setting scrambling for source/sink, do not check the conditions again, just go by thecrtc_stateflags. This will simplyfy the condition checks.V6: Addressed review comments from Ville
- Do not addIS_GLKcheck in disable/enable function, instead add it incompute_config, while setting state flags.
- Remove unnecessary paranthesis.
- Simplyfyhandle_sink_scramblingfunction as suggested.
- Add readout code for scrambling status inget_ddi_configand add a check for the same inpipe_config_compare.Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 7 ++++ drivers/gpu/drm/i915/intel_ddi.c | 33 ++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 5 +++ drivers/gpu/drm/i915/intel_drv.h | 14 +++++++ drivers/gpu/drm/i915/intel_hdmi.c | 74 ++++++++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+)drivers/gpu/drm/i915/i915_reg.h +0
-0@@ -7824,7 +7824,14 @@ enum {#define TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12)
drivers/gpu/drm/i915/i915_reg.h enum { · line 7834
Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +7
-0#define TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12)#define TRANS_DDI_DP_VC_PAYLOAD_ALLOC (1<<8) +#define TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7) +#define TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)#define TRANS_DDI_BFI_ENABLE (1<<4) +#define TRANS_DDI_HIGH_TMDS_CHAR_RATE (1<<4) +#define TRANS_DDI_HDMI_SCRAMBLING (1<<0) +#define TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \ + | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \ + | TRANS_DDI_HDMI_SCRAMBLING)
Last line is misaligned.
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +0
-0/* DisplayPort Transport Control */ #define _DP_TP_CTL_A 0x64040drivers/gpu/drm/i915/intel_ddi.c +0
-0
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) · line 1318
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-0@@ -1311,6 +1311,11 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) temp |=TRANS_DDI_MODE_SELECT_HDMI ; else temp |= TRANS_DDI_MODE_SELECT_DVI; + +if (IS_GEMINILAKE (dev_priv)) + temp =intel_hdmi_handle_source_scrambling ( + intel_encoder, + intel_crtc->config, temp);
This whole hunk could just be:
+ if (config->hdmi_scrambling)
+ hdmi_config |= TRANS_DDI_HDMI_SCRAMBLING_MASK;
+
+ if (config->hdmi_high_tmds_clock_ratio)
+ hdmi_config |= TRANS_DDI_HIGH_TMDS_CHAR_RATE;
No need to check for GLK here, since the compute config code already did.
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0}else if (type ==INTEL_OUTPUT_ANALOG ) { temp |=TRANS_DDI_MODE_SELECT_FDI ; temp |= (intel_crtc->config->fdi_lanes -1 ) <<1 ;@@ -1885,6 +1890,21 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder,struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder); +if (IS_GEMINILAKE (dev_priv)) { +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc); +/*
drivers/gpu/drm/i915/intel_ddi.c static void intel_enable_ddi(struct intel_encoder *intel_encoder, · line 1905
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10
-0+* GLK sports a native HDMI 2.0 controller. If required +* clock rate is > 340 Mhz && scrambling is supported +* by sink, enable scrambling before enabling the +* HDMI 2.0 port. The sink can choose to disable the +* scrambling if it doesn't detect a scrambled within +* 100 ms. +*/ +intel_hdmi_handle_sink_scrambling (intel_encoder, + conn_state->connector, + crtc->config, true);
This function receives a pipe_config pointer as argument. Use that instead of crtc->config.
Quoted 21 lines
drivers/gpu/drm/i915/intel_ddi.c +10
-0+ } +/* In HDMI/DVI mode, the port width, and swing/emphasis values * are ignored so nothing special needs to be done besides * enabling the port. @@ -1917,6 +1937,14 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder,if (old_crtc_state->has_audio)intel_audio_codec_disable (intel_encoder); +if (type ==INTEL_OUTPUT_HDMI ) { +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); + +intel_hdmi_handle_sink_scrambling (intel_encoder, + old_conn_state->connector, + intel_crtc->config, false); + } +if (type ==INTEL_OUTPUT_EDP ) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder);
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_get_config(struct intel_encoder *encoder, · line 2079
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-0@@ -2044,6 +2072,11 @@ void intel_ddi_get_config(struct intel_encoder *encoder,if (intel_hdmi->infoframe_enabled (&encoder->base, pipe_config)) pipe_config->has_infoframe = true; + +if (temp &TRANS_DDI_HDMI_SCRAMBLING_MASK ) + pipe_config->hdmi_scrambling = true; +if (temp &TRANS_DDI_HIGH_TMDS_CHAR_RATE ) + pipe_config->hdmi_high_tmds_clock_ratio = true;
Hmm, we might need a IS_GLK here, since these bits only exist in that platform. I believe they should read zero though, since they are listed are reserved. Dunno.
drivers/gpu/drm/i915/intel_display.c static void __printf(3, 4) · line 11665
Quoted 12 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0/* fall through */ case TRANS_DDI_MODE_SELECT_DVI : pipe_config->lane_count =4 ;drivers/gpu/drm/i915/intel_display.c +1
-0@@ -11662,6 +11662,11 @@ static void __printf(3, 4)if ((INTEL_GEN (dev_priv) <8 && !IS_HASWELL (dev_priv)) ||IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv))PIPE_CONF_CHECK_I (limited_color_range); +if (IS_GEMINILAKE (dev_priv)) {
No need to check for GLK here. The configuration should never be set for other platforms. If it is set, that's a bug and we want verify_crtc_state() to tells us about it.
Quoted 119 lines
drivers/gpu/drm/i915/intel_display.c +4
-0+PIPE_CONF_CHECK_I (hdmi_scrambling); +PIPE_CONF_CHECK_I (hdmi_high_tmds_clock_ratio); + } +PIPE_CONF_CHECK_I (has_infoframe);PIPE_CONF_CHECK_I (has_audio);drivers/gpu/drm/i915/intel_drv.h +14
-0@@ -695,6 +695,12 @@ struct intel_crtc_state {/* Gamma mode programmed on the pipe */ uint32_t gamma_mode; + +/* HDMI scrambling status (sink) */ +bool hdmi_scrambling; + +/* HDMI High TMDS char rate ratio (sink) */ +bool hdmi_high_tmds_clock_ratio; };struct vlv_wm_state {@@ -1626,6 +1632,14 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,bool intel_hdmi_compute_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config,struct drm_connector_state *conn_state); +uint32_t +intel_hdmi_handle_source_scrambling (struct intel_encoder *intel_encoder, +struct intel_crtc_state *config, +uint32_t hdmi_config); +void intel_hdmi_handle_sink_scrambling (struct intel_encoder *intel_encoder, +struct drm_connector *connector, +struct intel_crtc_state *config, +bool enable);void intel_dp_dual_mode_set_tmds_output (struct intel_hdmi *hdmi,bool enable);drivers/gpu/drm/i915/intel_hdmi.c +51
-0@@ -34,6 +34,7 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> +#include <drm/drm_scdc_helper.h> #include "intel_drv.h" #include <drm/i915_drm.h> #include <drm/intel_lpe_audio.h> @@ -1316,6 +1317,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&encoder->base);struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; +struct drm_scdc *scdc = &conn_state->connector->display_info.hdmi.scdc;int clock_8bpc = pipe_config->base.adjusted_mode.crtc_clock;int clock_12bpc = clock_8bpc *3 /2 ;int desired_bpp;@@ -1385,6 +1387,16 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, pipe_config->lane_count =4 ; +if (scdc->scrambling.supported &&IS_GEMINILAKE (dev_priv)) { +if (scdc->scrambling.low_rates) + pipe_config->hdmi_scrambling = true; + +if (pipe_config->port_clock >340000 ) { + pipe_config->hdmi_scrambling = true; + pipe_config->hdmi_high_tmds_clock_ratio = true; + } + } +return true; }@@ -1794,6 +1806,68 @@ static void intel_hdmi_destroy(struct drm_connector *connector) intel_hdmi->aspect_ratio =HDMI_PICTURE_ASPECT_NONE ; } +void intel_hdmi_handle_sink_scrambling (struct intel_encoder *intel_encoder, +struct drm_connector *connector, +struct intel_crtc_state *config, +bool enable) +{ +struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&intel_encoder->base); +struct drm_i915_private *dev_priv = connector->dev->dev_private; +struct drm_scrambling *scrambling = + &connector->display_info.hdmi.scdc.scrambling; +struct i2c_adapter *adptr =intel_gmbus_get_adapter (dev_priv, + intel_hdmi->ddc_bus); +bool ret; + +if (!scrambling->supported) +return ; + +DRM_DEBUG_KMS ("Setting sink scrambling for enc:%s connector:%s\n" , + intel_encoder->base.name, connector->name); + +if (config->hdmi_high_tmds_clock_ratio) { +/* Set TMDS bit clock ratio to 1/40 or 1/10 */ + ret =drm_scdc_set_high_tmds_clock_ratio (adptr, enable); +if (!ret) { +DRM_ERROR ("Set TMDS ratio failed\n" ); +return ; + } + } + +if (config->hdmi_scrambling) { +/* Enable/disable sink scrambling */ + ret =drm_scdc_set_scrambling (adptr, enable); +if (!ret) { +DRM_ERROR ("Set sink scrambling failed\n" ); +return ; + } + } + +DRM_DEBUG_KMS ("sink scrambling handled\n" ); +}
drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1857
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +10
-0+ +uint32_t +intel_hdmi_handle_source_scrambling (struct intel_encoder *intel_encoder, +struct intel_crtc_state *config,uint32_t hdmi_config) +{ +struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&intel_encoder->base); +struct drm_connector *connector = &intel_hdmi->attached_connector->base; + +DRM_DEBUG_KMS ("Setting scrambling for enc:%s connector:%s\n" , + intel_encoder->base.name, connector->name);
Instead of debugging here, print the hdmi scrambling values in intel_dump_pipe_config().
drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1860
Quoted 2 lines
drivers/gpu/drm/i915/intel_hdmi.c +2
-0+ hdmi_config &= ~(TRANS_DDI_HDMI_SCRAMBLING_MASK | +TRANS_DDI_HIGH_TMDS_CHAR_RATE );
This is unnecessary. The hunk below belongs in intel_ddi_enable_transcoder_func() and that function does not do read-modify- write. Any bit that is not explicitly set is zero. I think things are just simpler if this function doesn't exist.
Ander
drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1873
Quoted 12 lines
drivers/gpu/drm/i915/intel_hdmi.c +9
-0+if (config->hdmi_scrambling) + hdmi_config |=TRANS_DDI_HDMI_SCRAMBLING_MASK ; + +if (config->hdmi_high_tmds_clock_ratio) + hdmi_config |=TRANS_DDI_HIGH_TMDS_CHAR_RATE ; + +return hdmi_config; +} +static u8 intel_hdmi_ddc_pin (struct drm_i915_private *dev_priv,enum port port) {
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v6 5/6] drm/i915: enable scrambling
Thanks for the review Ander. My comments inline.
Shashank
Quoted 56 lines · Ander Conselvan De Oliveira
Quoted 55 lines · Shashank Sharma
Geminilake platform sports a native HDMI 2.0 controller, and is capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec mendates scrambling for these higher clocks, for reduced RF footprint.
This patch checks if the monitor supports scrambling, and if required, enables it during the modeset.
V2: Addressed review comments from Ville:
- Do not track scrambling status in DRM layer, track somewhere in driver like inintel_crtc_state.
- Don't talk to monitor at such a low layer, set monitor scrambling inintel_enable_ddi()before enabling the port.V3: Addressed review comments from Jani
- In comments, function names, use "sink" instead of "monitor", so that the implementation could be close to the language of HDMI spec.V4: Addressed review comment from Maarten
- scrambling ->hdmi_scramblinghigh_tmds_clock_ratio -> hdmi_high_tmds_clock_ratioV5: Addressed review comments from Ville and Ander
- Do not modifiy thecrtc_stateaftercompute_config. Move all scrambling andtmds_clock_ratiocalcutations tocompute_config.
- While setting scrambling for source/sink, do not check the conditions again, just go by thecrtc_stateflags. This will simplyfy the condition checks.V6: Addressed review comments from Ville
- Do not addIS_GLKcheck in disable/enable function, instead add it incompute_config, while setting state flags.
- Remove unnecessary paranthesis.
- Simplyfyhandle_sink_scramblingfunction as suggested.
- Add readout code for scrambling status inget_ddi_configand add a check for the same inpipe_config_compare.Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 7 ++++ drivers/gpu/drm/i915/intel_ddi.c | 33 ++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 5 +++ drivers/gpu/drm/i915/intel_drv.h | 14 +++++++ drivers/gpu/drm/i915/intel_hdmi.c | 74 ++++++++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+)drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -7824,7 +7824,14 @@ enum {#define TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12)#define TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12)#define TRANS_DDI_DP_VC_PAYLOAD_ALLOC (1<<8) +#define TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7)
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h enum { · line 7834
Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +6
-0+#define TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)#define TRANS_DDI_BFI_ENABLE (1<<4) +#define TRANS_DDI_HIGH_TMDS_CHAR_RATE (1<<4) +#define TRANS_DDI_HDMI_SCRAMBLING (1<<0) +#define TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \ + | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \ + | TRANS_DDI_HDMI_SCRAMBLING)Last line is misaligned.
Ok.
Quoted 24 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +0
-0/* DisplayPort Transport Control */ #define _DP_TP_CTL_A 0x64040drivers/gpu/drm/i915/intel_ddi.c +0
-0drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) · line 1318
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-0@@ -1311,6 +1311,11 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) temp |=TRANS_DDI_MODE_SELECT_HDMI ; else temp |= TRANS_DDI_MODE_SELECT_DVI; + +if (IS_GEMINILAKE (dev_priv)) + temp =intel_hdmi_handle_source_scrambling ( + intel_encoder, + intel_crtc->config, temp);This whole hunk could just be:
drivers/gpu/drm/i915/intel_hdmi.c +5
-0+if (config->hdmi_scrambling) + hdmi_config |=TRANS_DDI_HDMI_SCRAMBLING_MASK ; + +if (config->hdmi_high_tmds_clock_ratio) + hdmi_config |=TRANS_DDI_HIGH_TMDS_CHAR_RATE ;
Quoted 1 line
No need to check for GLK here, since the compute config code already did.
As I was emphasizing in the previous review comments, having two separate functions, one to set source_scrambling and other to set sink_scrambling makes it easy to follow up, due to design symmetry, and in that case you need not to refer to bspec to find out which all registers be dealing with scrambling , just check for scrambling control functions. So I was insisting on keeping them.
But anyways, both you and Ville are insisting on keeping it inline, so lets keep it that way.
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0}else if (type ==INTEL_OUTPUT_ANALOG ) { temp |=TRANS_DDI_MODE_SELECT_FDI ; temp |= (intel_crtc->config->fdi_lanes -1 ) <<1 ;@@ -1885,6 +1890,21 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder,struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);
Quoted 15 lines
drivers/gpu/drm/i915/intel_ddi.c static void intel_enable_ddi(struct intel_encoder *intel_encoder, · line 1905
Quoted 13 lines
drivers/gpu/drm/i915/intel_ddi.c +13
-0+if (IS_GEMINILAKE (dev_priv)) { +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc); +/* +* GLK sports a native HDMI 2.0 controller. If required +* clock rate is > 340 Mhz && scrambling is supported +* by sink, enable scrambling before enabling the +* HDMI 2.0 port. The sink can choose to disable the +* scrambling if it doesn't detect a scrambled within +* 100 ms. +*/ +intel_hdmi_handle_sink_scrambling (intel_encoder, + conn_state->connector, + crtc->config, true);This function receives a
pipe_configpointer as argument. Use that instead ofcrtc->config.
Ok.
Quoted 22 lines
Quoted 22 lines
drivers/gpu/drm/i915/intel_ddi.c +10
-0+ } +/* In HDMI/DVI mode, the port width, and swing/emphasis values * are ignored so nothing special needs to be done besides * enabling the port. @@ -1917,6 +1937,14 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder,if (old_crtc_state->has_audio)intel_audio_codec_disable (intel_encoder); +if (type ==INTEL_OUTPUT_HDMI ) { +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); + +intel_hdmi_handle_sink_scrambling (intel_encoder, + old_conn_state->connector, + intel_crtc->config, false); + } +if (type ==INTEL_OUTPUT_EDP ) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder);@@ -2044,6 +2072,11 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_get_config(struct intel_encoder *encoder, · line 2079
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-0if (intel_hdmi->infoframe_enabled (&encoder->base, pipe_config)) pipe_config->has_infoframe = true; + +if (temp &TRANS_DDI_HDMI_SCRAMBLING_MASK ) + pipe_config->hdmi_scrambling = true; +if (temp &TRANS_DDI_HIGH_TMDS_CHAR_RATE ) + pipe_config->hdmi_high_tmds_clock_ratio = true;Hmm, we might need a
IS_GLKhere, since these bits only exist in that platform. I believe they should read zero though, since they are listed are reserved. Dunno.
Hmm, I dont think there would be a way to set the reserved bits though, so we can keep it. In this way the only place we are checking and setting the platform is compute_config.
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0/* fall through */ case TRANS_DDI_MODE_SELECT_DVI : pipe_config->lane_count =4 ;drivers/gpu/drm/i915/intel_display.c +0
-0
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static void __printf(3, 4) · line 11665
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -11662,6 +11662,11 @@ static void __printf(3, 4)if ((INTEL_GEN (dev_priv) <8 && !IS_HASWELL (dev_priv)) ||IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv))PIPE_CONF_CHECK_I (limited_color_range); +if (IS_GEMINILAKE (dev_priv)) {No need to check for GLK here. The configuration should never be set for other platforms. If it is set, that's a bug and we want
verify_crtc_state()to tells us about it.
Agree, will remove this.
Quoted 124 lines
Quoted 124 lines
drivers/gpu/drm/i915/intel_display.c +4
-0+PIPE_CONF_CHECK_I (hdmi_scrambling); +PIPE_CONF_CHECK_I (hdmi_high_tmds_clock_ratio); + } +PIPE_CONF_CHECK_I (has_infoframe);PIPE_CONF_CHECK_I (has_audio);drivers/gpu/drm/i915/intel_drv.h +14
-0@@ -695,6 +695,12 @@ struct intel_crtc_state {/* Gamma mode programmed on the pipe */ uint32_t gamma_mode; + +/* HDMI scrambling status (sink) */ +bool hdmi_scrambling; + +/* HDMI High TMDS char rate ratio (sink) */ +bool hdmi_high_tmds_clock_ratio; };struct vlv_wm_state {@@ -1626,6 +1632,14 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,bool intel_hdmi_compute_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config,struct drm_connector_state *conn_state); +uint32_t +intel_hdmi_handle_source_scrambling (struct intel_encoder *intel_encoder, +struct intel_crtc_state *config, +uint32_t hdmi_config); +void intel_hdmi_handle_sink_scrambling (struct intel_encoder *intel_encoder, +struct drm_connector *connector, +struct intel_crtc_state *config, +bool enable);void intel_dp_dual_mode_set_tmds_output (struct intel_hdmi *hdmi,bool enable);drivers/gpu/drm/i915/intel_hdmi.c +55
-0@@ -34,6 +34,7 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> +#include <drm/drm_scdc_helper.h> #include "intel_drv.h" #include <drm/i915_drm.h> #include <drm/intel_lpe_audio.h> @@ -1316,6 +1317,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&encoder->base);struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; +struct drm_scdc *scdc = &conn_state->connector->display_info.hdmi.scdc;int clock_8bpc = pipe_config->base.adjusted_mode.crtc_clock;int clock_12bpc = clock_8bpc *3 /2 ;int desired_bpp;@@ -1385,6 +1387,16 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, pipe_config->lane_count =4 ; +if (scdc->scrambling.supported &&IS_GEMINILAKE (dev_priv)) { +if (scdc->scrambling.low_rates) + pipe_config->hdmi_scrambling = true; + +if (pipe_config->port_clock >340000 ) { + pipe_config->hdmi_scrambling = true; + pipe_config->hdmi_high_tmds_clock_ratio = true; + } + } +return true; }@@ -1794,6 +1806,68 @@ static void intel_hdmi_destroy(struct drm_connector *connector) intel_hdmi->aspect_ratio =HDMI_PICTURE_ASPECT_NONE ; } +void intel_hdmi_handle_sink_scrambling (struct intel_encoder *intel_encoder, +struct drm_connector *connector, +struct intel_crtc_state *config, +bool enable) +{ +struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&intel_encoder->base); +struct drm_i915_private *dev_priv = connector->dev->dev_private; +struct drm_scrambling *scrambling = + &connector->display_info.hdmi.scdc.scrambling; +struct i2c_adapter *adptr =intel_gmbus_get_adapter (dev_priv, + intel_hdmi->ddc_bus); +bool ret; + +if (!scrambling->supported) +return ; + +DRM_DEBUG_KMS ("Setting sink scrambling for enc:%s connector:%s\n" , + intel_encoder->base.name, connector->name); + +if (config->hdmi_high_tmds_clock_ratio) { +/* Set TMDS bit clock ratio to 1/40 or 1/10 */ + ret =drm_scdc_set_high_tmds_clock_ratio (adptr, enable); +if (!ret) { +DRM_ERROR ("Set TMDS ratio failed\n" ); +return ; + } + } + +if (config->hdmi_scrambling) { +/* Enable/disable sink scrambling */ + ret =drm_scdc_set_scrambling (adptr, enable); +if (!ret) { +DRM_ERROR ("Set sink scrambling failed\n" ); +return ; + } + } + +DRM_DEBUG_KMS ("sink scrambling handled\n" ); +} + +uint32_t +intel_hdmi_handle_source_scrambling (struct intel_encoder *intel_encoder, +struct intel_crtc_state *config,uint32_t hdmi_config)
Quoted 8 lines
drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1857
Quoted 6 lines
drivers/gpu/drm/i915/intel_hdmi.c +6
-0+{ +struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&intel_encoder->base); +struct drm_connector *connector = &intel_hdmi->attached_connector->base; + +DRM_DEBUG_KMS ("Setting scrambling for enc:%s connector:%s\n" , + intel_encoder->base.name, connector->name);Instead of debugging here, print the hdmi scrambling values in
intel_dump_pipe_config().
I am also interested in which encoder and connector are we setting the values for, is it that bad :) ?
Quoted 7 lines
drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1860
Quoted 3 lines
drivers/gpu/drm/i915/intel_hdmi.c +2
-0+ hdmi_config &= ~(TRANS_DDI_HDMI_SCRAMBLING_MASK | +TRANS_DDI_HIGH_TMDS_CHAR_RATE );This is unnecessary. The hunk below belongs in
intel_ddi_enable_transcoder_func()and that function does not do read-modify- write. Any bit that is not explicitly set is zero. I think things are just simpler if this function doesn't exist.
Yeah, will do that.
Quoted 14 lines
Ander
drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1873
Quoted 12 lines
drivers/gpu/drm/i915/intel_hdmi.c +9
-0+if (config->hdmi_scrambling) + hdmi_config |=TRANS_DDI_HDMI_SCRAMBLING_MASK ; + +if (config->hdmi_high_tmds_clock_ratio) + hdmi_config |=TRANS_DDI_HIGH_TMDS_CHAR_RATE ; + +return hdmi_config; +} +static u8 intel_hdmi_ddc_pin (struct drm_i915_private *dev_priv,enum port port) {
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v6 5/6] drm/i915: enable scrambling
Quoted 97 lines · Shashank
Thanks for the review Ander. My comments inline.
Shashank
Quoted 57 lines · Ander Conselvan De Oliveira
Quoted 56 lines · Shashank Sharma
Geminilake platform sports a native HDMI 2.0 controller, and is capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec mendates scrambling for these higher clocks, for reduced RF footprint.
This patch checks if the monitor supports scrambling, and if required, enables it during the modeset.
V2: Addressed review comments from Ville:
- Do not track scrambling status in DRM layer, track somewhere in driver like inintel_crtc_state.
- Don't talk to monitor at such a low layer, set monitor scrambling inintel_enable_ddi()before enabling the port.V3: Addressed review comments from Jani
- In comments, function names, use "sink" instead of "monitor", so that the implementation could be close to the language of HDMI spec.V4: Addressed review comment from Maarten
- scrambling ->hdmi_scramblinghigh_tmds_clock_ratio -> hdmi_high_tmds_clock_ratioV5: Addressed review comments from Ville and Ander
- Do not modifiy thecrtc_stateaftercompute_config. Move all scrambling andtmds_clock_ratiocalcutations tocompute_config.
- While setting scrambling for source/sink, do not check the conditions again, just go by thecrtc_stateflags. This will simplyfy the condition checks.V6: Addressed review comments from Ville
- Do not addIS_GLKcheck in disable/enable function, instead add it incompute_config, while setting state flags.
- Remove unnecessary paranthesis.
- Simplyfyhandle_sink_scramblingfunction as suggested.
- Add readout code for scrambling status inget_ddi_configand add a check for the same inpipe_config_compare.Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 7 ++++ drivers/gpu/drm/i915/intel_ddi.c | 33 ++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 5 +++ drivers/gpu/drm/i915/intel_drv.h | 14 +++++++ drivers/gpu/drm/i915/intel_hdmi.c | 74 ++++++++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+)drivers/gpu/drm/i915/i915_reg.h +2
-0@@ -7824,7 +7824,14 @@ enum {#define TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12)#define TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12)#define TRANS_DDI_DP_VC_PAYLOAD_ALLOC (1<<8) +#define TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7) +#define TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h enum { · line 7834
Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +5
-0#define TRANS_DDI_BFI_ENABLE (1<<4) +#define TRANS_DDI_HIGH_TMDS_CHAR_RATE (1<<4) +#define TRANS_DDI_HDMI_SCRAMBLING (1<<0) +#define TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \ + | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \ + | TRANS_DDI_HDMI_SCRAMBLING)Last line is misaligned.
Ok.
Quoted 25 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +0
-0/* DisplayPort Transport Control */ #define _DP_TP_CTL_A 0x64040drivers/gpu/drm/i915/intel_ddi.c +0
-0drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) · line 1318
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-0@@ -1311,6 +1311,11 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) temp |=TRANS_DDI_MODE_SELECT_HDMI ; else temp |= TRANS_DDI_MODE_SELECT_DVI; + +if (IS_GEMINILAKE (dev_priv)) + temp =intel_hdmi_handle_source_scrambling ( + intel_encoder, + intel_crtc->config, temp);This whole hunk could just be:
drivers/gpu/drm/i915/intel_hdmi.c +5
-0+if (config->hdmi_scrambling) + hdmi_config |=TRANS_DDI_HDMI_SCRAMBLING_MASK ; + +if (config->hdmi_high_tmds_clock_ratio) + hdmi_config |=TRANS_DDI_HIGH_TMDS_CHAR_RATE ;
Quoted 9 lines
Quoted 1 line
No need to check for GLK here, since the compute config code already did.
As I was emphasizing in the previous review comments, having two separate functions, one to set
source_scramblingand
other to setsink_scramblingmakes it easy to follow up, due to design symmetry, and in that case you need not to refer
to bspec to find out which all registers be dealing with scrambling , just check for scrambling control functions. So I was insisting on keeping them.
But that design creates an asymmetry when it comes to checking all bits that are enabled in TRANS_DDI_FUNC_CTL() that involves function-hopping. Maybe it is just a matter of different taste. But for the more practical problem of finding what bits are involved in enabling scrambling, I think
git grep hdmi_scrambling
will do a good enough job.
Quoted 48 lines
But anyways, both you and Ville are insisting on keeping it inline, so lets keep it that way.
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0}else if (type ==INTEL_OUTPUT_ANALOG ) { temp |=TRANS_DDI_MODE_SELECT_FDI ; temp |= (intel_crtc->config->fdi_lanes -1 ) <<1 ;@@ -1885,6 +1890,21 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder,struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);Quoted 16 lines
drivers/gpu/drm/i915/intel_ddi.c static void intel_enable_ddi(struct intel_encoder *intel_encoder, · line 1905
Quoted 13 lines
drivers/gpu/drm/i915/intel_ddi.c +13
-0+if (IS_GEMINILAKE (dev_priv)) { +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc); +/* +* GLK sports a native HDMI 2.0 controller. If required +* clock rate is > 340 Mhz && scrambling is supported +* by sink, enable scrambling before enabling the +* HDMI 2.0 port. The sink can choose to disable the +* scrambling if it doesn't detect a scrambled within +* 100 ms. +*/ +intel_hdmi_handle_sink_scrambling (intel_encoder, + conn_state->connector, + crtc->config, true);This function receives a
pipe_configpointer as argument. Use that instead ofcrtc->config.Ok.
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/i915/intel_ddi.c +10
-0+ } +/* In HDMI/DVI mode, the port width, and swing/emphasis values * are ignored so nothing special needs to be done besides * enabling the port. @@ -1917,6 +1937,14 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder,if (old_crtc_state->has_audio)intel_audio_codec_disable (intel_encoder); +if (type ==INTEL_OUTPUT_HDMI ) { +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); + +intel_hdmi_handle_sink_scrambling (intel_encoder, + old_conn_state->connector, + intel_crtc->config, false); + } +if (type ==INTEL_OUTPUT_EDP ) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder);
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_get_config(struct intel_encoder *encoder, · line 2076
Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-0@@ -2044,6 +2072,11 @@ void intel_ddi_get_config(struct intel_encoder *encoder,if (intel_hdmi->infoframe_enabled (&encoder->base, pipe_config)) pipe_config->has_infoframe = true; + +if (temp &TRANS_DDI_HDMI_SCRAMBLING_MASK )
I missed this the first time, but we say hdmi_scrambling is enabled if any of those bits in the mask is set. Is that really what we want? Or should this check specifically for the TRANS_DDI_HDMI_SCRAMBLING bit or all the bits set?
Quoted 11 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_get_config(struct intel_encoder *encoder, · line 2079
Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+ pipe_config->hdmi_scrambling = true; +if (temp &TRANS_DDI_HIGH_TMDS_CHAR_RATE ) + pipe_config->hdmi_high_tmds_clock_ratio = true;Hmm, we might need a
IS_GLKhere, since these bits only exist in that platform. I believe they should read zero though, since they are listed are reserved. Dunno.Hmm, I dont think there would be a way to set the reserved bits though, so we can keep it. In this way the
only place we are checking and setting the platform iscompute_config.
Yeah, with the change to check the state for non-GLK too, we get a WARN if this fails, so seems ok.
Quoted 152 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0/* fall through */ case TRANS_DDI_MODE_SELECT_DVI : pipe_config->lane_count =4 ;drivers/gpu/drm/i915/intel_display.c +0
-0@@ -11662,6 +11662,11 @@ static void __printf(3, 4)Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static void __printf(3, 4) · line 11665
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +1
-0if ((INTEL_GEN (dev_priv) <8 && !IS_HASWELL (dev_priv)) ||IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv))PIPE_CONF_CHECK_I (limited_color_range); +if (IS_GEMINILAKE (dev_priv)) {No need to check for GLK here. The configuration should never be set for other platforms. If it is set, that's a bug and we want
verify_crtc_state()to tells us about it.Agree, will remove this.
Quoted 125 lines
Quoted 125 lines
drivers/gpu/drm/i915/intel_display.c +4
-0+PIPE_CONF_CHECK_I (hdmi_scrambling); +PIPE_CONF_CHECK_I (hdmi_high_tmds_clock_ratio); + } +PIPE_CONF_CHECK_I (has_infoframe);PIPE_CONF_CHECK_I (has_audio);drivers/gpu/drm/i915/intel_drv.h +14
-0@@ -695,6 +695,12 @@ struct intel_crtc_state {/* Gamma mode programmed on the pipe */ uint32_t gamma_mode; + +/* HDMI scrambling status (sink) */ +bool hdmi_scrambling; + +/* HDMI High TMDS char rate ratio (sink) */ +bool hdmi_high_tmds_clock_ratio; };struct vlv_wm_state {@@ -1626,6 +1632,14 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,bool intel_hdmi_compute_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config,struct drm_connector_state *conn_state); +uint32_t +intel_hdmi_handle_source_scrambling (struct intel_encoder *intel_encoder, +struct intel_crtc_state *config, +uint32_t hdmi_config); +void intel_hdmi_handle_sink_scrambling (struct intel_encoder *intel_encoder, +struct drm_connector *connector, +struct intel_crtc_state *config, +bool enable);void intel_dp_dual_mode_set_tmds_output (struct intel_hdmi *hdmi,bool enable);drivers/gpu/drm/i915/intel_hdmi.c +56
-0@@ -34,6 +34,7 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> +#include <drm/drm_scdc_helper.h> #include "intel_drv.h" #include <drm/i915_drm.h> #include <drm/intel_lpe_audio.h> @@ -1316,6 +1317,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&encoder->base);struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; +struct drm_scdc *scdc = &conn_state->connector->display_info.hdmi.scdc;int clock_8bpc = pipe_config->base.adjusted_mode.crtc_clock;int clock_12bpc = clock_8bpc *3 /2 ;int desired_bpp;@@ -1385,6 +1387,16 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, pipe_config->lane_count =4 ; +if (scdc->scrambling.supported &&IS_GEMINILAKE (dev_priv)) { +if (scdc->scrambling.low_rates) + pipe_config->hdmi_scrambling = true; + +if (pipe_config->port_clock >340000 ) { + pipe_config->hdmi_scrambling = true; + pipe_config->hdmi_high_tmds_clock_ratio = true; + } + } +return true; }@@ -1794,6 +1806,68 @@ static void intel_hdmi_destroy(struct drm_connector *connector) intel_hdmi->aspect_ratio =HDMI_PICTURE_ASPECT_NONE ; } +void intel_hdmi_handle_sink_scrambling (struct intel_encoder *intel_encoder, +struct drm_connector *connector, +struct intel_crtc_state *config, +bool enable) +{ +struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&intel_encoder->base); +struct drm_i915_private *dev_priv = connector->dev->dev_private; +struct drm_scrambling *scrambling = + &connector->display_info.hdmi.scdc.scrambling; +struct i2c_adapter *adptr =intel_gmbus_get_adapter (dev_priv, + intel_hdmi->ddc_bus); +bool ret; + +if (!scrambling->supported) +return ; + +DRM_DEBUG_KMS ("Setting sink scrambling for enc:%s connector:%s\n" , + intel_encoder->base.name, connector->name); + +if (config->hdmi_high_tmds_clock_ratio) { +/* Set TMDS bit clock ratio to 1/40 or 1/10 */ + ret =drm_scdc_set_high_tmds_clock_ratio (adptr, enable); +if (!ret) { +DRM_ERROR ("Set TMDS ratio failed\n" ); +return ; + } + } + +if (config->hdmi_scrambling) { +/* Enable/disable sink scrambling */ + ret =drm_scdc_set_scrambling (adptr, enable); +if (!ret) { +DRM_ERROR ("Set sink scrambling failed\n" ); +return ; + } + } + +DRM_DEBUG_KMS ("sink scrambling handled\n" ); +} + +uint32_t +intel_hdmi_handle_source_scrambling (struct intel_encoder *intel_encoder, +struct intel_crtc_state *config,uint32_t hdmi_config) +{Quoted 8 lines
drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1857
Quoted 5 lines
drivers/gpu/drm/i915/intel_hdmi.c +5
-0+struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&intel_encoder->base); +struct drm_connector *connector = &intel_hdmi->attached_connector->base; + +DRM_DEBUG_KMS ("Setting scrambling for enc:%s connector:%s\n" , + intel_encoder->base.name, connector->name);Instead of debugging here, print the hdmi scrambling values in
intel_dump_pipe_config().
Quoted 2 lines
I am also interested in which encoder and connector are we setting the values for, is it that bad :) ?
The debug for the modeset should tell you that, but IMO it would be ok to leave this extra debug message if the function would still exist.
Ander
Quoted 12 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1860
Quoted 3 lines
drivers/gpu/drm/i915/intel_hdmi.c +2
-0+ hdmi_config &= ~(TRANS_DDI_HDMI_SCRAMBLING_MASK | +TRANS_DDI_HIGH_TMDS_CHAR_RATE );This is unnecessary. The hunk below belongs in
intel_ddi_enable_transcoder_func()and that function does not do read-modify- write. Any bit that is not explicitly set is zero. I think things are just simpler if this function doesn't exist.Yeah, will do that.
Quoted 2 lines
Ander
Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_hdmi.c +4
-0+if (config->hdmi_scrambling) + hdmi_config |=TRANS_DDI_HDMI_SCRAMBLING_MASK ; + +if (config->hdmi_high_tmds_clock_ratio)Quoted 8 lines
drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1873
Quoted 8 lines
drivers/gpu/drm/i915/intel_hdmi.c +5
-0+ hdmi_config |=TRANS_DDI_HIGH_TMDS_CHAR_RATE ; + +return hdmi_config; +} +static u8 intel_hdmi_ddc_pin (struct drm_i915_private *dev_priv,enum port port) {
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v6 5/6] drm/i915: enable scrambling
Regards
Shashank
Quoted 103 lines · Ander Conselvan De Oliveira
Quoted 94 lines · Shashank
Thanks for the review Ander. My comments inline.
Shashank
Quoted 56 lines · Ander Conselvan De Oliveira
Quoted 55 lines · Shashank Sharma
Geminilake platform sports a native HDMI 2.0 controller, and is capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec mendates scrambling for these higher clocks, for reduced RF footprint.
This patch checks if the monitor supports scrambling, and if required, enables it during the modeset.
V2: Addressed review comments from Ville:
- Do not track scrambling status in DRM layer, track somewhere in driver like inintel_crtc_state.
- Don't talk to monitor at such a low layer, set monitor scrambling inintel_enable_ddi()before enabling the port.V3: Addressed review comments from Jani
- In comments, function names, use "sink" instead of "monitor", so that the implementation could be close to the language of HDMI spec.V4: Addressed review comment from Maarten
- scrambling ->hdmi_scramblinghigh_tmds_clock_ratio -> hdmi_high_tmds_clock_ratioV5: Addressed review comments from Ville and Ander
- Do not modifiy thecrtc_stateaftercompute_config. Move all scrambling andtmds_clock_ratiocalcutations tocompute_config.
- While setting scrambling for source/sink, do not check the conditions again, just go by thecrtc_stateflags. This will simplyfy the condition checks.V6: Addressed review comments from Ville
- Do not addIS_GLKcheck in disable/enable function, instead add it incompute_config, while setting state flags.
- Remove unnecessary paranthesis.
- Simplyfyhandle_sink_scramblingfunction as suggested.
- Add readout code for scrambling status inget_ddi_configand add a check for the same inpipe_config_compare.Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 7 ++++ drivers/gpu/drm/i915/intel_ddi.c | 33 ++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 5 +++ drivers/gpu/drm/i915/intel_drv.h | 14 +++++++ drivers/gpu/drm/i915/intel_hdmi.c | 74 ++++++++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+)drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -7824,7 +7824,14 @@ enum {#define TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12)#define TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12)#define TRANS_DDI_DP_VC_PAYLOAD_ALLOC (1<<8) +#define TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7)Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h enum { · line 7834
Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +6
-0+#define TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)#define TRANS_DDI_BFI_ENABLE (1<<4) +#define TRANS_DDI_HIGH_TMDS_CHAR_RATE (1<<4) +#define TRANS_DDI_HDMI_SCRAMBLING (1<<0) +#define TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \ + | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \ + | TRANS_DDI_HDMI_SCRAMBLING)Last line is misaligned.
Ok.
Quoted 24 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +0
-0/* DisplayPort Transport Control */ #define _DP_TP_CTL_A 0x64040drivers/gpu/drm/i915/intel_ddi.c +0
-0drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) · line 1318
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-0@@ -1311,6 +1311,11 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) temp |=TRANS_DDI_MODE_SELECT_HDMI ; else temp |= TRANS_DDI_MODE_SELECT_DVI; + +if (IS_GEMINILAKE (dev_priv)) + temp =intel_hdmi_handle_source_scrambling ( + intel_encoder, + intel_crtc->config, temp);This whole hunk could just be:
drivers/gpu/drm/i915/intel_hdmi.c +5
-0+if (config->hdmi_scrambling) + hdmi_config |=TRANS_DDI_HDMI_SCRAMBLING_MASK ; + +if (config->hdmi_high_tmds_clock_ratio) + hdmi_config |=TRANS_DDI_HIGH_TMDS_CHAR_RATE ;Quoted 8 lines
Quoted 1 line
No need to check for GLK here, since the compute config code already did.
As I was emphasizing in the previous review comments, having two separate functions, one to set
source_scramblingand
other to setsink_scramblingmakes it easy to follow up, due to design symmetry, and in that case you need not to refer
to bspec to find out which all registers be dealing with scrambling , just check for scrambling control functions. So I was insisting on keeping them.
Quoted 8 lines
But that design creates an asymmetry when it comes to checking all bits that are enabled in
TRANS_DDI_FUNC_CTL()that involves function-hopping. Maybe it is just a matter of different taste. But for the more practical problem of finding what bits are involved in enabling scrambling, I thinkgit grep
hdmi_scramblingwill do a good enough job.
Will do this.
Quoted 47 lines
Quoted 47 lines
But anyways, both you and Ville are insisting on keeping it inline, so lets keep it that way.
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0}else if (type ==INTEL_OUTPUT_ANALOG ) { temp |=TRANS_DDI_MODE_SELECT_FDI ; temp |= (intel_crtc->config->fdi_lanes -1 ) <<1 ;@@ -1885,6 +1890,21 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder,struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);Quoted 15 lines
drivers/gpu/drm/i915/intel_ddi.c static void intel_enable_ddi(struct intel_encoder *intel_encoder, · line 1905
Quoted 13 lines
drivers/gpu/drm/i915/intel_ddi.c +13
-0+if (IS_GEMINILAKE (dev_priv)) { +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc); +/* +* GLK sports a native HDMI 2.0 controller. If required +* clock rate is > 340 Mhz && scrambling is supported +* by sink, enable scrambling before enabling the +* HDMI 2.0 port. The sink can choose to disable the +* scrambling if it doesn't detect a scrambled within +* 100 ms. +*/ +intel_hdmi_handle_sink_scrambling (intel_encoder, + conn_state->connector, + crtc->config, true);This function receives a
pipe_configpointer as argument. Use that instead ofcrtc->config.Ok.
Quoted 22 lines
Quoted 22 lines
drivers/gpu/drm/i915/intel_ddi.c +10
-0+ } +/* In HDMI/DVI mode, the port width, and swing/emphasis values * are ignored so nothing special needs to be done besides * enabling the port. @@ -1917,6 +1937,14 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder,if (old_crtc_state->has_audio)intel_audio_codec_disable (intel_encoder); +if (type ==INTEL_OUTPUT_HDMI ) { +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); + +intel_hdmi_handle_sink_scrambling (intel_encoder, + old_conn_state->connector, + intel_crtc->config, false); + } +if (type ==INTEL_OUTPUT_EDP ) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder);@@ -2044,6 +2072,11 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_get_config(struct intel_encoder *encoder, · line 2076
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-0if (intel_hdmi->infoframe_enabled (&encoder->base, pipe_config)) pipe_config->has_infoframe = true; + +if (temp &TRANS_DDI_HDMI_SCRAMBLING_MASK )I missed this the first time, but we say
hdmi_scramblingis enabled if any of those bits in the mask is set. Is that really what we want? Or should this check specifically for theTRANS_DDI_HDMI_SCRAMBLINGbit or all the bits set?
Initially I thought of any of those bits in the mask, but now I am thinking we are always setting all of those bits togother, and as per the bspec, all of it is required, so I will add it like this:
(temp & TRANS_DDI_HDMI_SCRAMBLING_MASK == TRANS_DDI_HDMI_SCRAMBLING_MASK)
Shashank
Quoted 159 lines
Quoted 9 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_get_config(struct intel_encoder *encoder, · line 2079
Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+ pipe_config->hdmi_scrambling = true; +if (temp &TRANS_DDI_HIGH_TMDS_CHAR_RATE ) + pipe_config->hdmi_high_tmds_clock_ratio = true;Hmm, we might need a
IS_GLKhere, since these bits only exist in that platform. I believe they should read zero though, since they are listed are reserved. Dunno.Hmm, I dont think there would be a way to set the reserved bits though, so we can keep it. In this way the
only place we are checking and setting the platform iscompute_config.Yeah, with the change to check the state for non-GLK too, we get a WARN if this fails, so seems ok.
Quoted 147 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +0
-0/* fall through */ case TRANS_DDI_MODE_SELECT_DVI : pipe_config->lane_count =4 ;drivers/gpu/drm/i915/intel_display.c +0
-0Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static void __printf(3, 4) · line 11665
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -11662,6 +11662,11 @@ static void __printf(3, 4)if ((INTEL_GEN (dev_priv) <8 && !IS_HASWELL (dev_priv)) ||IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv))PIPE_CONF_CHECK_I (limited_color_range); +if (IS_GEMINILAKE (dev_priv)) {No need to check for GLK here. The configuration should never be set for other platforms. If it is set, that's a bug and we want
verify_crtc_state()to tells us about it.Agree, will remove this.
Quoted 131 lines
Quoted 119 lines
drivers/gpu/drm/i915/intel_display.c +4
-0+PIPE_CONF_CHECK_I (hdmi_scrambling); +PIPE_CONF_CHECK_I (hdmi_high_tmds_clock_ratio); + } +PIPE_CONF_CHECK_I (has_infoframe);PIPE_CONF_CHECK_I (has_audio);drivers/gpu/drm/i915/intel_drv.h +14
-0@@ -695,6 +695,12 @@ struct intel_crtc_state {/* Gamma mode programmed on the pipe */ uint32_t gamma_mode; + +/* HDMI scrambling status (sink) */ +bool hdmi_scrambling; + +/* HDMI High TMDS char rate ratio (sink) */ +bool hdmi_high_tmds_clock_ratio; };struct vlv_wm_state {@@ -1626,6 +1632,14 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,bool intel_hdmi_compute_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config,struct drm_connector_state *conn_state); +uint32_t +intel_hdmi_handle_source_scrambling (struct intel_encoder *intel_encoder, +struct intel_crtc_state *config, +uint32_t hdmi_config); +void intel_hdmi_handle_sink_scrambling (struct intel_encoder *intel_encoder, +struct drm_connector *connector, +struct intel_crtc_state *config, +bool enable);void intel_dp_dual_mode_set_tmds_output (struct intel_hdmi *hdmi,bool enable);drivers/gpu/drm/i915/intel_hdmi.c +51
-0@@ -34,6 +34,7 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> +#include <drm/drm_scdc_helper.h> #include "intel_drv.h" #include <drm/i915_drm.h> #include <drm/intel_lpe_audio.h> @@ -1316,6 +1317,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&encoder->base);struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; +struct drm_scdc *scdc = &conn_state->connector->display_info.hdmi.scdc;int clock_8bpc = pipe_config->base.adjusted_mode.crtc_clock;int clock_12bpc = clock_8bpc *3 /2 ;int desired_bpp;@@ -1385,6 +1387,16 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, pipe_config->lane_count =4 ; +if (scdc->scrambling.supported &&IS_GEMINILAKE (dev_priv)) { +if (scdc->scrambling.low_rates) + pipe_config->hdmi_scrambling = true; + +if (pipe_config->port_clock >340000 ) { + pipe_config->hdmi_scrambling = true; + pipe_config->hdmi_high_tmds_clock_ratio = true; + } + } +return true; }@@ -1794,6 +1806,68 @@ static void intel_hdmi_destroy(struct drm_connector *connector) intel_hdmi->aspect_ratio =HDMI_PICTURE_ASPECT_NONE ; } +void intel_hdmi_handle_sink_scrambling (struct intel_encoder *intel_encoder, +struct drm_connector *connector, +struct intel_crtc_state *config, +bool enable) +{ +struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&intel_encoder->base); +struct drm_i915_private *dev_priv = connector->dev->dev_private; +struct drm_scrambling *scrambling = + &connector->display_info.hdmi.scdc.scrambling; +struct i2c_adapter *adptr =intel_gmbus_get_adapter (dev_priv, + intel_hdmi->ddc_bus); +bool ret; + +if (!scrambling->supported) +return ; + +DRM_DEBUG_KMS ("Setting sink scrambling for enc:%s connector:%s\n" , + intel_encoder->base.name, connector->name); + +if (config->hdmi_high_tmds_clock_ratio) { +/* Set TMDS bit clock ratio to 1/40 or 1/10 */ + ret =drm_scdc_set_high_tmds_clock_ratio (adptr, enable); +if (!ret) { +DRM_ERROR ("Set TMDS ratio failed\n" ); +return ; + } + } + +if (config->hdmi_scrambling) { +/* Enable/disable sink scrambling */ + ret =drm_scdc_set_scrambling (adptr, enable); +if (!ret) { +DRM_ERROR ("Set sink scrambling failed\n" ); +return ; + } + } + +DRM_DEBUG_KMS ("sink scrambling handled\n" ); +}drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1857
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +10
-0+ +uint32_t +intel_hdmi_handle_source_scrambling (struct intel_encoder *intel_encoder, +struct intel_crtc_state *config,uint32_t hdmi_config) +{ +struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&intel_encoder->base); +struct drm_connector *connector = &intel_hdmi->attached_connector->base; + +DRM_DEBUG_KMS ("Setting scrambling for enc:%s connector:%s\n" , + intel_encoder->base.name, connector->name);Instead of debugging here, print the hdmi scrambling values in
intel_dump_pipe_config().
Quoted 29 lines
Quoted 2 lines
I am also interested in which encoder and connector are we setting the values for, is it that bad :) ?
The debug for the modeset should tell you that, but IMO it would be ok to leave this extra debug message if the function would still exist.
Ander
Quoted 22 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1860
Quoted 2 lines
drivers/gpu/drm/i915/intel_hdmi.c +2
-0+ hdmi_config &= ~(TRANS_DDI_HDMI_SCRAMBLING_MASK | +TRANS_DDI_HIGH_TMDS_CHAR_RATE );This is unnecessary. The hunk below belongs in
intel_ddi_enable_transcoder_func()and that function does not do read-modify- write. Any bit that is not explicitly set is zero. I think things are just simpler if this function doesn't exist.Yeah, will do that.
Quoted 14 lines
Ander
Quoted 12 lines
drivers/gpu/drm/i915/intel_hdmi.c +9
-0+if (config->hdmi_scrambling) + hdmi_config |=TRANS_DDI_HDMI_SCRAMBLING_MASK ; + +if (config->hdmi_high_tmds_clock_ratio) + hdmi_config |=TRANS_DDI_HIGH_TMDS_CHAR_RATE ; + +return hdmi_config; +} +static u8 intel_hdmi_ddc_pin (struct drm_i915_private *dev_priv,enum port port) {
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 6/6 drm/i915: allow HDMI 2.0 clock rates
In reply to Shashank SharmaGeminilake has a native HDMI 2.0 controller, which is capable of driving clocks upto 594Mhz. This patch updates the max tmds clock limit for the same.
V2: rebase
V3: rebase
V4: added r-b from Ander
V5: rebase
V6: rebase
--- drivers/gpu/drm/i915/intel_hdmi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
@@ -1209,6 +1209,8 @@ static int intel_hdmi_source_max_tmds_clock(struct drm_i915_private *dev_priv) {if (IS_G4X (dev_priv))return 165000 ; +else if (IS_GEMINILAKE (dev_priv)) +return 594000 ;else if (IS_HASWELL (dev_priv) ||INTEL_INFO (dev_priv)->gen >=8 )return 300000 ;else
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI✓ Fi.CI.BAT: success for HDMI 2.0: Scrambling in DRM layer (rev6)
In reply to Shashank Sharma== Series Details ==
== Series Details ==
Series: HDMI 2.0: Scrambling in DRM layer (rev6)
URL : https://patchwork.freedesktop.org/series/19161/
State : success
== Summary ==
Series 19161v6 HDMI 2.0: Scrambling in DRM layer
https://patchwork.freedesktop.org/api/1.0/series/19161/revisions/6/mbox/
Test drv_module_reload:
Subgroup basic-reload:
dmesg-warn -> PASS (fi-ilk-650)fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 fi-bxt-t5700 total:278 pass:258 dwarn:0 dfail:0 fail:0 skip:20 fi-byt-j1900 total:278 pass:251 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:278 pass:247 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 fi-kbl-7500u total:278 pass:259 dwarn:1 dfail:0 fail:0 skip:18 fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 fi-snb-2600 total:278 pass:248 dwarn:0 dfail:0 fail:1 skip:29
7f38bb9ea553c613223b705326c1b8d1a8fc4a90 drm-tip: 2017y-03m-02d-22h-35m-41s UTC integration manifest 3621c19 drm/i915: allow HDMI 2.0 clock rates
df73883 drm/i915: enable scrambling
86f1e39 drm/edid: detect SCDC support in HF-VSDB
ed4f7e3 drm/edid: detect SCDC support in HF-VSDB
6e9ab7c drm/edid: check for HF-VSDB block
8666fe4 drm: Add SCDC helpers
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4048/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx