Skip to contentSkip to conversation

HDMI 2.0: Scrambling support in DRM layer

PATCH Superseded Shashank Sharma 6 participants 33 messages Feb 1, 2017 – Feb 3, 2017

Subsystems (4)

v1 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

cover HDMI 2.0: Scrambling support 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.

Shashank Sharma (4):
drm/edid: detect SCDC support in HF-VSDB
drm: scrambling support in drm layer
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            | 158 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_scdc_helper.c     | 111 ++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h       |   2 +
 drivers/gpu/drm/i915/intel_ddi.c      |   5 ++
 drivers/gpu/drm/i915/intel_drv.h      |   2 +
 drivers/gpu/drm/i915/intel_hdmi.c     |  44 ++++++++++
 include/drm/drm_connector.h           |  50 +++++++++++
 include/drm/drm_edid.h                |   6 +-
 include/drm/drm_scdc_helper.h         | 132 ++++++++++++++++++++++++++++
 include/linux/hdmi.h                  |   1 +
 12 files changed, 524 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
#1 lore raw

PATCH 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.

---
 Documentation/gpu/drm-kms-helpers.rst |  12 ++++
 drivers/gpu/drm/Makefile              |   3 +-
 drivers/gpu/drm/drm_scdc_helper.c     | 111 ++++++++++++++++++++++++++++
 include/drm/drm_scdc_helper.h         | 132 ++++++++++++++++++++++++++++++++++
 4 files changed, 257 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
index 03040aa..7592756 100644
@@ -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
index 92de399..ad91cd9 100644
@@ -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 +111 -0

111 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

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

Re: [PATCH 1/6] drm: Add SCDC helpers

Quoted 9 lines · Shashank Sharma

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.

One process note, you need to add your own Signed-off-by under the original author's sign-off, even when you're posting them unchanged.

Signed-off-by means https://developercertificate.org/

BR,
Jani.

Quoted 301 lines
---
 Documentation/gpu/drm-kms-helpers.rst |  12 ++++
 drivers/gpu/drm/Makefile              |   3 +-
 drivers/gpu/drm/drm_scdc_helper.c     | 111 ++++++++++++++++++++++++++++
 include/drm/drm_scdc_helper.h         | 132 ++++++++++++++++++++++++++++++++++
 4 files changed, 257 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
index 03040aa..7592756 100644
@@ -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
index 92de399..ad91cd9 100644
@@ -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 +111 -0
new file mode 100644
index 0000000..fe0e121
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2015 NVIDIA Corporation. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <linux/slab.h>
+
+#include <drm/drm_scdc_helper.h>
+
+/**
+ * DOC: scdc helpers
+ *
+ * Status and Control Data Channel (SCDC) is a mechanism introduced by the
+ * HDMI 2.0 specification. It is a point-to-point protocol that allows the
+ * HDMI source and HDMI sink to exchange data. The same I2C interface that
+ * is used to access EDID serves as the transport mechanism for SCDC.
+ */
+
+#define SCDC_I2C_SLAVE_ADDRESS 0x54
+
+/**
+ * drm_scdc_read - read a block of data from SCDC
+ * @adapter: I2C controller
+ * @offset: start offset of block to read
+ * @buffer: return location for the block to read
+ * @size: size of the block to read
+ *
+ * Reads a block of data from SCDC, starting at a given offset.
+ *
+ * Returns:
+ * The number of bytes read from SCDC or a negative error code on failure.
+ */
+ssize_t drm_scdc_read(struct i2c_adapter *adapter, u8 offset, void *buffer,
+		      size_t size)
+{
+	struct i2c_msg msgs[2] = {
+		{
+			.addr = SCDC_I2C_SLAVE_ADDRESS,
+			.flags = 0,
+			.len = 1,
+			.buf = &offset,
+		}, {
+			.addr = SCDC_I2C_SLAVE_ADDRESS,
+			.flags = I2C_M_RD,
+			.len = size,
+			.buf = buffer,
+		}
+	};
+
+	return i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs));
+}
+EXPORT_SYMBOL(drm_scdc_read);
+
+/**
+ * drm_scdc_write - write a block of data to SCDC
+ * @adapter: I2C controller
+ * @offset: start offset of block to write
+ * @buffer: block of data to write
+ * @size: size of the block to write
+ *
+ * Writes a block of data to SCDC, starting at a given offset.
+ *
+ * Returns:
+ * The number of bytes written to SCDC or a negative error code on failure.
+ */
+ssize_t drm_scdc_write(struct i2c_adapter *adapter, u8 offset,
+		       const void *buffer, size_t size)
+{
+	struct i2c_msg msg = {
+		.addr = SCDC_I2C_SLAVE_ADDRESS,
+		.flags = 0,
+		.len = 1 + size,
+		.buf = NULL,
+	};
+	void *data;
+	int err;
+
+	data = kmalloc(1 + size, GFP_TEMPORARY);
+	if (!data)
+		return -ENOMEM;
+
+	msg.buf = data;
+
+	memcpy(data, &offset, sizeof(offset));
+	memcpy(data + 1, buffer, size);
+
+	err = i2c_transfer(adapter, &msg, 1);
+
+	kfree(data);
+
+	return err;
+}
+EXPORT_SYMBOL(drm_scdc_write);
include/drm/drm_scdc_helper.h new file +132 -0
new file mode 100644
index 0000000..93b07bc
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2015 NVIDIA Corporation. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef DRM_SCDC_HELPER_H
+#define DRM_SCDC_HELPER_H
+
+#include <linux/i2c.h>
+#include <linux/types.h>
+
+#define SCDC_SINK_VERSION 0x01
+
+#define SCDC_SOURCE_VERSION 0x02
+
+#define SCDC_UPDATE_0 0x10
+#define  SCDC_READ_REQUEST_TEST (1 << 2)
+#define  SCDC_CED_UPDATE (1 << 1)
+#define  SCDC_STATUS_UPDATE (1 << 0)
+
+#define SCDC_UPDATE_1 0x11
+
+#define SCDC_TMDS_CONFIG 0x20
+#define  SCDC_TMDS_BIT_CLOCK_RATIO_BY_40 (1 << 1)
+#define  SCDC_TMDS_BIT_CLOCK_RATIO_BY_10 (0 << 1)
+#define  SCDC_SCRAMBLING_ENABLE (1 << 0)
+
+#define SCDC_SCRAMBLER_STATUS 0x21
+#define  SCDC_SCRAMBLING_STATUS (1 << 0)
+
+#define SCDC_CONFIG_0 0x30
+#define  SCDC_READ_REQUEST_ENABLE (1 << 0)
+
+#define SCDC_STATUS_FLAGS_0 0x40
+#define  SCDC_CH2_LOCK (1 < 3)
+#define  SCDC_CH1_LOCK (1 < 2)
+#define  SCDC_CH0_LOCK (1 < 1)
+#define  SCDC_CH_LOCK_MASK (SCDC_CH2_LOCK | SCDC_CH1_LOCK | SCDC_CH0_LOCK)
+#define  SCDC_CLOCK_DETECT (1 << 0)
+
+#define SCDC_STATUS_FLAGS_1 0x41
+
+#define SCDC_ERR_DET_0_L 0x50
+#define SCDC_ERR_DET_0_H 0x51
+#define SCDC_ERR_DET_1_L 0x52
+#define SCDC_ERR_DET_1_H 0x53
+#define SCDC_ERR_DET_2_L 0x54
+#define SCDC_ERR_DET_2_H 0x55
+#define  SCDC_CHANNEL_VALID (1 << 7)
+
+#define SCDC_ERR_DET_CHECKSUM 0x56
+
+#define SCDC_TEST_CONFIG_0 0xc0
+#define  SCDC_TEST_READ_REQUEST (1 << 7)
+#define  SCDC_TEST_READ_REQUEST_DELAY(x) ((x) & 0x7f)
+
+#define SCDC_MANUFACTURER_IEEE_OUI 0xd0
+#define SCDC_MANUFACTURER_IEEE_OUI_SIZE 3
+
+#define SCDC_DEVICE_ID 0xd3
+#define SCDC_DEVICE_ID_SIZE 8
+
+#define SCDC_DEVICE_HARDWARE_REVISION 0xdb
+#define  SCDC_DEVICE_HARDWARE_REVISION_MAJOR(x) (((x) >> 4) & 0xf)
+#define  SCDC_DEVICE_HARDWARE_REVISION_MINOR(x) (((x) >> 0) & 0xf)
+
+#define SCDC_DEVICE_SOFTWARE_MAJOR_REVISION 0xdc
+#define SCDC_DEVICE_SOFTWARE_MINOR_REVISION 0xdd
+
+#define SCDC_MANUFACTURER_SPECIFIC 0xde
+#define SCDC_MANUFACTURER_SPECIFIC_SIZE 34
+
+ssize_t drm_scdc_read(struct i2c_adapter *adapter, u8 offset, void *buffer,
+		      size_t size);
+ssize_t drm_scdc_write(struct i2c_adapter *adapter, u8 offset,
+		       const void *buffer, size_t size);
+
+/**
+ * drm_scdc_readb - read a single byte from SCDC
+ * @adapter: I2C adapter
+ * @offset: offset of register to read
+ * @value: return location for the register value
+ *
+ * Reads a single byte from SCDC. This is a convenience wrapper around the
+ * drm_scdc_read() function.
+ *
+ * Returns:
+ * 0 on success or a negative error code on failure.
+ */
+static inline int drm_scdc_readb(struct i2c_adapter *adapter, u8 offset,
+				 u8 *value)
+{
+	return drm_scdc_read(adapter, offset, value, sizeof(*value));
+}
+
+/**
+ * drm_scdc_writeb - write a single byte to SCDC
+ * @adapter: I2C adapter
+ * @offset: offset of register to read
+ * @value: return location for the register value
+ *
+ * Writes a single byte to SCDC. This is a convenience wrapper around the
+ * drm_scdc_write() function.
+ *
+ * Returns:
+ * 0 on success or a negative error code on failure.
+ */
+static inline int drm_scdc_writeb(struct i2c_adapter *adapter, u8 offset,
+				  u8 value)
+{
+	return drm_scdc_write(adapter, offset, &value, sizeof(value));
+}
+
+#endif
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH 1/6] drm: Add SCDC helpers

Sure, Thanks for the information, will add that in V2.

Regards
Shashank
-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Thursday, February 2, 2017 4:55 PM
To: Sharma, Shashank <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Thierry Reding <[email protected]>; [email protected]
Subject: Re: [Intel-gfx] [PATCH 1/6] drm: Add SCDC helpers

Quoted 9 lines · Shashank Sharma

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.

One process note, you need to add your own Signed-off-by under the original author's sign-off, even when you're posting them unchanged.

Signed-off-by means https://developercertificate.org/

BR,
Jani.

Quoted 319 lines
---
 Documentation/gpu/drm-kms-helpers.rst |  12 ++++
 drivers/gpu/drm/Makefile              |   3 +-
 drivers/gpu/drm/drm_scdc_helper.c     | 111 ++++++++++++++++++++++++++++
 include/drm/drm_scdc_helper.h         | 132 ++++++++++++++++++++++++++++++++++
 4 files changed, 257 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 +0 -0
index 03040aa..7592756 100644
@@ -217,6 +217,18 @@ EDID Helper Functions Reference  .. kernel-doc:: 

drivers/gpu/drm/drm_edid.c
:export:

Documentation/gpu/drm-kms-helpers.rst +12 -0
+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 index renamed from drivers/gpu/drm/Makefile +0 -0

92de399..ad91cd9 100644

drivers/gpu/drm/Makefile +2 -2
@@ -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 diff 
--git a/drivers/gpu/drm/drm_scdc_helper.c 

b/drivers/gpu/drm/drm_scdc_helper.c
new file mode 100644
index 0000000..fe0e121

drivers/gpu/drm/drm_scdc_helper.c new file +125 -0
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2015 NVIDIA Corporation. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person 
+obtaining a
+ * copy of this software and associated documentation files (the 
+"Software"),
+ * to deal in the Software without restriction, including without 
+limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub 
+license,
+ * and/or sell copies of the Software, and to permit persons to whom 
+the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including 
+the
+ * next paragraph) shall be included in all copies or substantial 
+portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT 
+SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES 
+OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <linux/slab.h>
+
+#include <drm/drm_scdc_helper.h>
+
+/**
+ * DOC: scdc helpers
+ *
+ * Status and Control Data Channel (SCDC) is a mechanism introduced 
+by the
+ * HDMI 2.0 specification. It is a point-to-point protocol that 
+allows the
+ * HDMI source and HDMI sink to exchange data. The same I2C interface 
+that
+ * is used to access EDID serves as the transport mechanism for SCDC.
+ */
+
+#define SCDC_I2C_SLAVE_ADDRESS 0x54
+
+/**
+ * drm_scdc_read - read a block of data from SCDC
+ * @adapter: I2C controller
+ * @offset: start offset of block to read
+ * @buffer: return location for the block to read
+ * @size: size of the block to read
+ *
+ * Reads a block of data from SCDC, starting at a given offset.
+ *
+ * Returns:
+ * The number of bytes read from SCDC or a negative error code on failure.
+ */
+ssize_t drm_scdc_read(struct i2c_adapter *adapter, u8 offset, void *buffer,
+		      size_t size)
+{
+	struct i2c_msg msgs[2] = {
+		{
+			.addr = SCDC_I2C_SLAVE_ADDRESS,
+			.flags = 0,
+			.len = 1,
+			.buf = &offset,
+		}, {
+			.addr = SCDC_I2C_SLAVE_ADDRESS,
+			.flags = I2C_M_RD,
+			.len = size,
+			.buf = buffer,
+		}
+	};
+
+	return i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs)); } 
+EXPORT_SYMBOL(drm_scdc_read);
+
+/**
+ * drm_scdc_write - write a block of data to SCDC
+ * @adapter: I2C controller
+ * @offset: start offset of block to write
+ * @buffer: block of data to write
+ * @size: size of the block to write
+ *
+ * Writes a block of data to SCDC, starting at a given offset.
+ *
+ * Returns:
+ * The number of bytes written to SCDC or a negative error code on failure.
+ */
+ssize_t drm_scdc_write(struct i2c_adapter *adapter, u8 offset,
+		       const void *buffer, size_t size) {
+	struct i2c_msg msg = {
+		.addr = SCDC_I2C_SLAVE_ADDRESS,
+		.flags = 0,
+		.len = 1 + size,
+		.buf = NULL,
+	};
+	void *data;
+	int err;
+
+	data = kmalloc(1 + size, GFP_TEMPORARY);
+	if (!data)
+		return -ENOMEM;
+
+	msg.buf = data;
+
+	memcpy(data, &offset, sizeof(offset));
+	memcpy(data + 1, buffer, size);
+
+	err = i2c_transfer(adapter, &msg, 1);
+
+	kfree(data);
+
+	return err;
+}
+EXPORT_SYMBOL(drm_scdc_write);
(quoted diff) +0 -0

b/include/drm/drm_scdc_helper.h new file mode 100644 index 0000000..93b07bc

include/drm/drm_scdc_helper.h new file +134 -0
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2015 NVIDIA Corporation. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person 
+obtaining a
+ * copy of this software and associated documentation files (the 
+"Software"),
+ * to deal in the Software without restriction, including without 
+limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub 
+license,
+ * and/or sell copies of the Software, and to permit persons to whom 
+the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including 
+the
+ * next paragraph) shall be included in all copies or substantial 
+portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT 
+SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES 
+OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef DRM_SCDC_HELPER_H
+#define DRM_SCDC_HELPER_H
+
+#include <linux/i2c.h>
+#include <linux/types.h>
+
+#define SCDC_SINK_VERSION 0x01
+
+#define SCDC_SOURCE_VERSION 0x02
+
+#define SCDC_UPDATE_0 0x10
+#define  SCDC_READ_REQUEST_TEST (1 << 2) #define  SCDC_CED_UPDATE (1 
+<< 1) #define  SCDC_STATUS_UPDATE (1 << 0)
+
+#define SCDC_UPDATE_1 0x11
+
+#define SCDC_TMDS_CONFIG 0x20
+#define  SCDC_TMDS_BIT_CLOCK_RATIO_BY_40 (1 << 1) #define  
+SCDC_TMDS_BIT_CLOCK_RATIO_BY_10 (0 << 1) #define  
+SCDC_SCRAMBLING_ENABLE (1 << 0)
+
+#define SCDC_SCRAMBLER_STATUS 0x21
+#define  SCDC_SCRAMBLING_STATUS (1 << 0)
+
+#define SCDC_CONFIG_0 0x30
+#define  SCDC_READ_REQUEST_ENABLE (1 << 0)
+
+#define SCDC_STATUS_FLAGS_0 0x40
+#define  SCDC_CH2_LOCK (1 < 3)
+#define  SCDC_CH1_LOCK (1 < 2)
+#define  SCDC_CH0_LOCK (1 < 1)
+#define  SCDC_CH_LOCK_MASK (SCDC_CH2_LOCK | SCDC_CH1_LOCK | 
+SCDC_CH0_LOCK) #define  SCDC_CLOCK_DETECT (1 << 0)
+
+#define SCDC_STATUS_FLAGS_1 0x41
+
+#define SCDC_ERR_DET_0_L 0x50
+#define SCDC_ERR_DET_0_H 0x51
+#define SCDC_ERR_DET_1_L 0x52
+#define SCDC_ERR_DET_1_H 0x53
+#define SCDC_ERR_DET_2_L 0x54
+#define SCDC_ERR_DET_2_H 0x55
+#define  SCDC_CHANNEL_VALID (1 << 7)
+
+#define SCDC_ERR_DET_CHECKSUM 0x56
+
+#define SCDC_TEST_CONFIG_0 0xc0
+#define  SCDC_TEST_READ_REQUEST (1 << 7) #define  
+SCDC_TEST_READ_REQUEST_DELAY(x) ((x) & 0x7f)
+
+#define SCDC_MANUFACTURER_IEEE_OUI 0xd0 #define 
+SCDC_MANUFACTURER_IEEE_OUI_SIZE 3
+
+#define SCDC_DEVICE_ID 0xd3
+#define SCDC_DEVICE_ID_SIZE 8
+
+#define SCDC_DEVICE_HARDWARE_REVISION 0xdb #define  
+SCDC_DEVICE_HARDWARE_REVISION_MAJOR(x) (((x) >> 4) & 0xf) #define  
+SCDC_DEVICE_HARDWARE_REVISION_MINOR(x) (((x) >> 0) & 0xf)
+
+#define SCDC_DEVICE_SOFTWARE_MAJOR_REVISION 0xdc #define 
+SCDC_DEVICE_SOFTWARE_MINOR_REVISION 0xdd
+
+#define SCDC_MANUFACTURER_SPECIFIC 0xde #define 
+SCDC_MANUFACTURER_SPECIFIC_SIZE 34
+
+ssize_t drm_scdc_read(struct i2c_adapter *adapter, u8 offset, void *buffer,
+		      size_t size);
+ssize_t drm_scdc_write(struct i2c_adapter *adapter, u8 offset,
+		       const void *buffer, size_t size);
+
+/**
+ * drm_scdc_readb - read a single byte from SCDC
+ * @adapter: I2C adapter
+ * @offset: offset of register to read
+ * @value: return location for the register value
+ *
+ * Reads a single byte from SCDC. This is a convenience wrapper 
+around the
+ * drm_scdc_read() function.
+ *
+ * Returns:
+ * 0 on success or a negative error code on failure.
+ */
+static inline int drm_scdc_readb(struct i2c_adapter *adapter, u8 offset,
+				 u8 *value)
+{
+	return drm_scdc_read(adapter, offset, value, sizeof(*value)); }
+
+/**
+ * drm_scdc_writeb - write a single byte to SCDC
+ * @adapter: I2C adapter
+ * @offset: offset of register to read
+ * @value: return location for the register value
+ *
+ * Writes a single byte to SCDC. This is a convenience wrapper around 
+the
+ * drm_scdc_write() function.

include/drm/drm_scdc_helper.h line 132

Quoted 10 lines
include/drm/drm_scdc_helper.h new file +10 -0
+ *
+ * Returns:
+ * 0 on success or a negative error code on failure.
+ */
+static inline int drm_scdc_writeb(struct i2c_adapter *adapter, u8 offset,
+				  u8 value)
+{
+	return drm_scdc_write(adapter, offset, &value, sizeof(value)); }
+
+#endif

--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

PATCH 2/6 drm/edid: check for HF-VSDB block

In reply to Shashank Sharma

From: 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.

---
 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
index baa6ccb..96d3e47 100644
@@ -3239,6 +3239,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
index edbb4fc..d271ff2 100644
@@ -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
#5 lore raw

PATCH 3/6 drm/edid: detect SCDC support in HF-VSDB

In reply to Shashank Sharma

This 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 advance HDMI 2.0 features
- Checks the HF-VSDB block for presence of SCDC, and marks it in hdmi_info structure.
- If SCDC is present, checks if sink is capable of generating scdc read request, and marks it in hdmi_info structure.

---
 drivers/gpu/drm/drm_edid.c  | 14 ++++++++++++++
 include/drm/drm_connector.h | 26 ++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
drivers/gpu/drm/drm_edid.c +14 -0
index 96d3e47..37902e5 100644
@@ -3802,6 +3802,18 @@ enum hdmi_quantization_range
 }
 EXPORT_SYMBOL(drm_default_rgb_quant_range);
 
+static void drm_detect_hdmi_scdc(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
+{
+	struct drm_hdmi_info *hdmi = &connector->display_info.hdmi_info;
+
+	if (hf_vsdb[6] & 0x80) {
+		hdmi->scdc_supported = true;
+		if (hf_vsdb[6] & 0x40)
+			hdmi->scdc_rr = true;
+	}
+}
+
 static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 					   const u8 *hdmi)
 {
@@ -3916,6 +3928,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_detect_hdmi_scdc(connector, db);
 	}
 }
 
include/drm/drm_connector.h +26 -0
index e5e1edd..2435598 100644
@@ -87,6 +87,27 @@ enum subpixel_order {
 	SubPixelVerticalRGB,
 	SubPixelVerticalBGR,
 	SubPixelNone,
+
+};
+
+/**
+ * struct drm_hdmi_info - runtime data about the connected sink
+ *
+ * Describes if a given hdmi display supports advance HDMI 2.0 featutes.
+ * This information is available in CEA-861-F extension blocks (like
+ * HF-VSDB)
+ * For sinks which provide an EDID this can be filled out by calling
+ * drm_add_edid_modes().
+ */
+struct drm_hdmi_info {
+	/**
+	 * @scdc_supported: status control & data channel present.
+	 */
+	bool scdc_supported;
+	/**
+	 * @scdc_rr: sink is capable of generating scdc read request.
+	 */
+	bool scdc_rr;
 };
 
 /**
@@ -188,6 +209,11 @@ struct drm_display_info {
 	 * @cea_rev: CEA revision of the HDMI sink.
 	 */
 	u8 cea_rev;
+
+	/**
+	 * @hdmi_info: advance features of a HDMI sink.
+	 */
+	struct drm_hdmi_info hdmi_info;
 };
 
 int drm_display_info_set_bus_formats(struct drm_display_info *info,
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 3/6
#6 lore raw

Re: [PATCH 3/6] drm/edid: detect SCDC support in HF-VSDB

Quoted 4 lines · Shashank Sharma

This 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 advance HDMI 2.0 features

"advanced"

Quoted 2 lines

- Checks the HF-VSDB block for presence of SCDC, and marks it in hdmi_info structure.

"drm_hdmi_info structure"?

Quoted 2 lines

- If SCDC is present, checks if sink is capable of generating scdc read request, and marks it in hdmi_info structure.

"SCDC" to be consistent and because it's an abbreviation.

Quoted 44 lines
---
 drivers/gpu/drm/drm_edid.c  | 14 ++++++++++++++
 include/drm/drm_connector.h | 26 ++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
drivers/gpu/drm/drm_edid.c +14 -0
index 96d3e47..37902e5 100644
@@ -3802,6 +3802,18 @@ enum hdmi_quantization_range
 }
 EXPORT_SYMBOL(drm_default_rgb_quant_range);
 
+static void drm_detect_hdmi_scdc(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
+{
+	struct drm_hdmi_info *hdmi = &connector->display_info.hdmi_info;
+
+	if (hf_vsdb[6] & 0x80) {
+		hdmi->scdc_supported = true;
+		if (hf_vsdb[6] & 0x40)
+			hdmi->scdc_rr = true;
+	}
+}
+
 static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 					   const u8 *hdmi)
 {
@@ -3916,6 +3928,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_detect_hdmi_scdc(connector, db);
 	}
 }
 
include/drm/drm_connector.h +0 -0
index e5e1edd..2435598 100644

include/drm/drm_connector.h enum subpixel_order { · line 94

Quoted 8 lines
include/drm/drm_connector.h +5 -0
@@ -87,6 +87,27 @@ enum subpixel_order {
 	SubPixelVerticalRGB,
 	SubPixelVerticalBGR,
 	SubPixelNone,
+
+};
+
+/**
+ * struct drm_hdmi_info - runtime data about the connected sink

Maybe "connected HDMI sink"?

include/drm/drm_connector.h enum subpixel_order { · line 96

Quoted 2 lines
include/drm/drm_connector.h +2 -0
+ *
+ * Describes if a given hdmi display supports advance HDMI 2.0 featutes.

"HDMI", "advanced", "features"

include/drm/drm_connector.h enum subpixel_order { · line 98

Quoted 2 lines
include/drm/drm_connector.h +2 -0
+ * This information is available in CEA-861-F extension blocks (like
+ * HF-VSDB)

This should be terminated by a full-stop.

include/drm/drm_connector.h enum subpixel_order { · line 100

Quoted 2 lines
include/drm/drm_connector.h +2 -0
+ * For sinks which provide an EDID this can be filled out by calling
+ * drm_add_edid_modes().

And maybe make this sentence start right after the one above rather than breaking it to the next line. I'm not sure how useful this line is. Most driver will be calling drm_add_edid_modes() anyway, but the above makes it sound like drm_add_edid_modes() is something you have to explicitly call to get these fields parsed.

Quoted 14 lines
include/drm/drm_connector.h +10 -0
+ */
+struct drm_hdmi_info {
+	/**
+	 * @scdc_supported: status control & data channel present.
+	 */
+	bool scdc_supported;
+	/**
+	 * @scdc_rr: sink is capable of generating scdc read request.
+	 */
+	bool scdc_rr;
 };
 
 /**

include/drm/drm_connector.h struct drm_display_info { · line 216

Quoted 8 lines
include/drm/drm_connector.h +5 -0
@@ -188,6 +209,11 @@ struct drm_display_info {
 	 * @cea_rev: CEA revision of the HDMI sink.
 	 */
 	u8 cea_rev;
+
+	/**
+	 * @hdmi_info: advance features of a HDMI sink.
+	 */
+	struct drm_hdmi_info hdmi_info;

I think we can safely drop the _info suffix on the field name. It's already inside a structure that carries this suffix.

Other than that:

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

Re: [PATCH 3/6] drm/edid: detect SCDC support in HF-VSDB

Thanks for the review Thierry. My comments inline.

Regards
Shashank

Quoted 6 lines · Thierry Reding
Quoted 4 lines · Shashank Sharma

This 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 advance HDMI 2.0 features

"advanced"

got it.

Quoted 4 lines
Quoted 3 lines

- Checks the HF-VSDB block for presence of SCDC, and marks it in hdmi_info structure.

"drm_hdmi_info structure"?

yep, sure.

Quoted 3 lines
Quoted 2 lines

- If SCDC is present, checks if sink is capable of generating scdc read request, and marks it in hdmi_info structure.

"SCDC" to be consistent and because it's an abbreviation.

Agree.

Quoted 38 lines
Quoted 38 lines
---
  drivers/gpu/drm/drm_edid.c  | 14 ++++++++++++++
  include/drm/drm_connector.h | 26 ++++++++++++++++++++++++++
  2 files changed, 40 insertions(+)
drivers/gpu/drm/drm_edid.c +14 -0
index 96d3e47..37902e5 100644
@@ -3802,6 +3802,18 @@ enum hdmi_quantization_range
  }
  EXPORT_SYMBOL(drm_default_rgb_quant_range);
 
+static void drm_detect_hdmi_scdc(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
+{
+	struct drm_hdmi_info *hdmi = &connector->display_info.hdmi_info;
+
+	if (hf_vsdb[6] & 0x80) {
+		hdmi->scdc_supported = true;
+		if (hf_vsdb[6] & 0x40)
+			hdmi->scdc_rr = true;
+	}
+}
+
  static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
  					   const u8 *hdmi)
  {
@@ -3916,6 +3928,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_detect_hdmi_scdc(connector, db);
  	}
  }
 
Quoted 14 lines

include/drm/drm_connector.h enum subpixel_order { · line 94

Quoted 13 lines
include/drm/drm_connector.h +5 -0
index e5e1edd..2435598 100644
@@ -87,6 +87,27 @@ enum subpixel_order {
  	SubPixelVerticalRGB,
  	SubPixelVerticalBGR,
  	SubPixelNone,
+
+};
+
+/**
+ * struct drm_hdmi_info - runtime data about the connected sink

Maybe "connected HDMI sink"?

Agree.

Quoted 3 lines

include/drm/drm_connector.h enum subpixel_order { · line 96

Quoted 2 lines
include/drm/drm_connector.h +2 -0
+ *
+ * Describes if a given hdmi display supports advance HDMI 2.0 featutes.

"HDMI", "advanced", "features"

Oops, got it :-)

Quoted 3 lines

include/drm/drm_connector.h enum subpixel_order { · line 98

Quoted 2 lines
include/drm/drm_connector.h +2 -0
+ * This information is available in CEA-861-F extension blocks (like
+ * HF-VSDB)

This should be terminated by a full-stop.

Ok

Quoted 4 lines

include/drm/drm_connector.h enum subpixel_order { · line 100

Quoted 2 lines
include/drm/drm_connector.h +2 -0
+ * For sinks which provide an EDID this can be filled out by calling
+ * drm_add_edid_modes().

And maybe make this sentence start right after the one above rather than breaking it to the next line.

Ok

Quoted 4 lines

I'm not sure how useful this line is. Most
driver will be calling drm_add_edid_modes() anyway, but the above makes it sound like drm_add_edid_modes() is something you have to explicitly call to get these fields parsed.

Mostly a 'yy' and 'p' from the function above, but makes sense, I can remove this line.

Quoted 12 lines
Quoted 12 lines
include/drm/drm_connector.h +10 -0
+ */
+struct drm_hdmi_info {
+	/**
+	 * @scdc_supported: status control & data channel present.
+	 */
+	bool scdc_supported;
+	/**
+	 * @scdc_rr: sink is capable of generating scdc read request.
+	 */
+	bool scdc_rr;
  };
 
Quoted 12 lines

include/drm/drm_connector.h struct drm_display_info { · line 216

Quoted 10 lines
include/drm/drm_connector.h +5 -0
  /**
@@ -188,6 +209,11 @@ struct drm_display_info {
  	 * @cea_rev: CEA revision of the HDMI sink.
  	 */
  	u8 cea_rev;
+
+	/**
+	 * @hdmi_info: advance features of a HDMI sink.
+	 */
+	struct drm_hdmi_info hdmi_info;

I think we can safely drop the _info suffix on the field name. It's already inside a structure that carries this suffix.

Sure, should I call it hdmi_sink OR connected_hdmi ?
- Shashank

Quoted 4 lines

Other than that:

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

Re: [PATCH 3/6] drm/edid: detect SCDC support in HF-VSDB

Quoted 113 lines · Shashank

Thanks for the review Thierry. My comments inline.

Regards
Shashank

Quoted 6 lines · Thierry Reding
Quoted 4 lines · Shashank Sharma

This 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 advance HDMI 2.0 features

"advanced"

got it.

Quoted 4 lines
Quoted 3 lines

- Checks the HF-VSDB block for presence of SCDC, and marks it in hdmi_info structure.

"drm_hdmi_info structure"?

yep, sure.

Quoted 3 lines
Quoted 2 lines

- If SCDC is present, checks if sink is capable of generating scdc read request, and marks it in hdmi_info structure.

"SCDC" to be consistent and because it's an abbreviation.

Agree.

Quoted 41 lines
Quoted 41 lines
---
  drivers/gpu/drm/drm_edid.c  | 14 ++++++++++++++
  include/drm/drm_connector.h | 26 ++++++++++++++++++++++++++
  2 files changed, 40 insertions(+)
drivers/gpu/drm/drm_edid.c +14 -0
index 96d3e47..37902e5 100644
@@ -3802,6 +3802,18 @@ enum hdmi_quantization_range
  }
  EXPORT_SYMBOL(drm_default_rgb_quant_range);
+static void drm_detect_hdmi_scdc(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
+{
+	struct drm_hdmi_info *hdmi = &connector->display_info.hdmi_info;
+
+	if (hf_vsdb[6] & 0x80) {
+		hdmi->scdc_supported = true;
+		if (hf_vsdb[6] & 0x40)
+			hdmi->scdc_rr = true;
+	}
+}
+
  static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
  					   const u8 *hdmi)
  {
@@ -3916,6 +3928,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_detect_hdmi_scdc(connector, db);
  	}
  }
include/drm/drm_connector.h +0 -0
index e5e1edd..2435598 100644
@@ -87,6 +87,27 @@ enum subpixel_order {
  	SubPixelVerticalRGB,
Quoted 8 lines

include/drm/drm_connector.h enum subpixel_order { · line 94

Quoted 7 lines
include/drm/drm_connector.h +5 -0
  	SubPixelVerticalBGR,
  	SubPixelNone,
+
+};
+
+/**
+ * struct drm_hdmi_info - runtime data about the connected sink

Maybe "connected HDMI sink"?

Agree.

Quoted 3 lines

include/drm/drm_connector.h enum subpixel_order { · line 96

Quoted 2 lines
include/drm/drm_connector.h +2 -0
+ *
+ * Describes if a given hdmi display supports advance HDMI 2.0 featutes.

"HDMI", "advanced", "features"

Oops, got it :-)

Quoted 3 lines

include/drm/drm_connector.h enum subpixel_order { · line 98

Quoted 2 lines
include/drm/drm_connector.h +2 -0
+ * This information is available in CEA-861-F extension blocks (like
+ * HF-VSDB)

This should be terminated by a full-stop.

Ok

Quoted 4 lines

include/drm/drm_connector.h enum subpixel_order { · line 100

Quoted 2 lines
include/drm/drm_connector.h +2 -0
+ * For sinks which provide an EDID this can be filled out by calling
+ * drm_add_edid_modes().

And maybe make this sentence start right after the one above rather than breaking it to the next line.

Ok

Quoted 4 lines

I'm not sure how useful this line is. Most
driver will be calling drm_add_edid_modes() anyway, but the above makes it sound like drm_add_edid_modes() is something you have to explicitly call to get these fields parsed.

Mostly a 'yy' and 'p' from the function above, but makes sense, I can remove this line.

Quoted 15 lines
Quoted 15 lines
include/drm/drm_connector.h +10 -0
+ */
+struct drm_hdmi_info {
+	/**
+	 * @scdc_supported: status control & data channel present.
+	 */
+	bool scdc_supported;
+	/**
+	 * @scdc_rr: sink is capable of generating scdc read request.
+	 */
+	bool scdc_rr;
  };
  /**
@@ -188,6 +209,11 @@ struct drm_display_info {
  	 * @cea_rev: CEA revision of the HDMI sink.
  	 */
Quoted 8 lines

include/drm/drm_connector.h struct drm_display_info { · line 216

Quoted 6 lines
include/drm/drm_connector.h +5 -0
  	u8 cea_rev;
+
+	/**
+	 * @hdmi_info: advance features of a HDMI sink.
+	 */
+	struct drm_hdmi_info hdmi_info;

I think we can safely drop the _info suffix on the field name. It's already inside a structure that carries this suffix.

Quoted 1 line

Sure, should I call it hdmi_sink OR connected_hdmi ?

No, I think just plain "hdmi" would be fine. This is part of drm_display_info, which kind of implies that it's a sink, and I think it's also fair to assume that this isn't valid if nothing's connected.

Thierry

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

#9 lore raw

Re: [PATCH 3/6] drm/edid: detect SCDC support in HF-VSDB

In reply to Shashank Sharma
Quoted 66 lines · Shashank Sharma

This 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 advance HDMI 2.0 features
- Checks the HF-VSDB block for presence of SCDC, and marks it in hdmi_info structure.
- If SCDC is present, checks if sink is capable of generating scdc read request, and marks it in hdmi_info structure.

---
 drivers/gpu/drm/drm_edid.c  | 14 ++++++++++++++
 include/drm/drm_connector.h | 26 ++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
drivers/gpu/drm/drm_edid.c +14 -0
index 96d3e47..37902e5 100644
@@ -3802,6 +3802,18 @@ enum hdmi_quantization_range
 }
 EXPORT_SYMBOL(drm_default_rgb_quant_range);
 
+static void drm_detect_hdmi_scdc(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
+{
+	struct drm_hdmi_info *hdmi = &connector->display_info.hdmi_info;
+
+	if (hf_vsdb[6] & 0x80) {
+		hdmi->scdc_supported = true;
+		if (hf_vsdb[6] & 0x40)
+			hdmi->scdc_rr = true;
+	}
+}
+
 static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 					   const u8 *hdmi)
 {
@@ -3916,6 +3928,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_detect_hdmi_scdc(connector, db);
 	}
 }
 
include/drm/drm_connector.h +11 -0
index e5e1edd..2435598 100644
@@ -87,6 +87,27 @@ enum subpixel_order {
 	SubPixelVerticalRGB,
 	SubPixelVerticalBGR,
 	SubPixelNone,
+
+};
+
+/**
+ * struct drm_hdmi_info - runtime data about the connected sink
+ *
+ * Describes if a given hdmi display supports advance HDMI 2.0 featutes.
+ * This information is available in CEA-861-F extension blocks (like
+ * HF-VSDB)
+ * For sinks which provide an EDID this can be filled out by calling
+ * drm_add_edid_modes().

include/drm/drm_connector.h enum subpixel_order { · line 110

Quoted 10 lines
include/drm/drm_connector.h +10 -0
+ */
+struct drm_hdmi_info {
+	/**
+	 * @scdc_supported: status control & data channel present.
+	 */
+	bool scdc_supported;
+	/**
+	 * @scdc_rr: sink is capable of generating scdc read request.
+	 */
+	bool scdc_rr;

Probably worth spelling the thing out.

Quoted 17 lines
include/drm/drm_connector.h +5 -0
 };
 
 /**
@@ -188,6 +209,11 @@ struct drm_display_info {
 	 * @cea_rev: CEA revision of the HDMI sink.
 	 */
 	u8 cea_rev;
+
+	/**
+	 * @hdmi_info: advance features of a HDMI sink.
+	 */
+	struct drm_hdmi_info hdmi_info;
 };
 
 int drm_display_info_set_bus_formats(struct drm_display_info *info,
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Re: [PATCH 3/6] drm/edid: detect SCDC support in HF-VSDB

Thanks for the review Ville. My comments inline.

Regards
Shashank

Quoted 70 lines · Ville Syrjälä
Quoted 69 lines · Shashank Sharma

This 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 advance HDMI 2.0 features
- Checks the HF-VSDB block for presence of SCDC, and marks it in hdmi_info structure.
- If SCDC is present, checks if sink is capable of generating scdc read request, and marks it in hdmi_info structure.

---
  drivers/gpu/drm/drm_edid.c  | 14 ++++++++++++++
  include/drm/drm_connector.h | 26 ++++++++++++++++++++++++++
  2 files changed, 40 insertions(+)
drivers/gpu/drm/drm_edid.c +14 -0
index 96d3e47..37902e5 100644
@@ -3802,6 +3802,18 @@ enum hdmi_quantization_range
  }
  EXPORT_SYMBOL(drm_default_rgb_quant_range);
 
+static void drm_detect_hdmi_scdc(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
+{
+	struct drm_hdmi_info *hdmi = &connector->display_info.hdmi_info;
+
+	if (hf_vsdb[6] & 0x80) {
+		hdmi->scdc_supported = true;
+		if (hf_vsdb[6] & 0x40)
+			hdmi->scdc_rr = true;
+	}
+}
+
  static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
  					   const u8 *hdmi)
  {
@@ -3916,6 +3928,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_detect_hdmi_scdc(connector, db);
  	}
  }
 
include/drm/drm_connector.h +14 -0
index e5e1edd..2435598 100644
@@ -87,6 +87,27 @@ enum subpixel_order {
  	SubPixelVerticalRGB,
  	SubPixelVerticalBGR,
  	SubPixelNone,
+
+};
+
+/**
+ * struct drm_hdmi_info - runtime data about the connected sink
+ *
+ * Describes if a given hdmi display supports advance HDMI 2.0 featutes.
+ * This information is available in CEA-861-F extension blocks (like
+ * HF-VSDB)
+ * For sinks which provide an EDID this can be filled out by calling
+ * drm_add_edid_modes().
+ */
+struct drm_hdmi_info {
+	/**
Quoted 8 lines

include/drm/drm_connector.h enum subpixel_order { · line 110

Quoted 7 lines
include/drm/drm_connector.h +7 -0
+	 * @scdc_supported: status control & data channel present.
+	 */
+	bool scdc_supported;
+	/**
+	 * @scdc_rr: sink is capable of generating scdc read request.
+	 */
+	bool scdc_rr;

Probably worth spelling the thing out.

Agree. I was afraid it would make it difficult for 80 char stuff, but maybe I can make it scdc->read_req

- Shashank

Quoted 14 lines
Quoted 14 lines
include/drm/drm_connector.h +5 -0
  };
 
  /**
@@ -188,6 +209,11 @@ struct drm_display_info {
  	 * @cea_rev: CEA revision of the HDMI sink.
  	 */
  	u8 cea_rev;
+
+	/**
+	 * @hdmi_info: advance features of a HDMI sink.
+	 */
+	struct drm_hdmi_info hdmi_info;
  };
 
Quoted 3 lines
Quoted 3 lines
include/drm/drm_connector.h +0 -0
  int drm_display_info_set_bus_formats(struct drm_display_info *info,
Signature · 1 line
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw

PATCH 4/6 drm: scrambling support in drm layer

In reply to Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
 drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
 include/drm/drm_connector.h |  24 ++++++++
 include/drm/drm_edid.h      |   6 +-
 3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +130 -1
index 37902e5..f0d940a 100644
@@ -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>
 
 #define version_greater(edid, maj, min) \
 	(((edid)->version > (maj)) || \
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
 	}
 }
 
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
+{
+	struct drm_display_info *display = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &display->hdmi_info;
+
+	/*
+	 * All HDMI 2.0 monitors must support scrambling at rates > 340M.
+	 * 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
+	 * * SCDC support available
+	 * Lets check it out.
+	 */
+
+	if (hf_vsdb[5]) {
+		display->max_tmds_clock = hf_vsdb[5] * 5000;
+		DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n",
+			display->max_tmds_clock);
+
+		if (hdmi->scdc_supported) {
+			hdmi->scr_info.supported = true;
+
+			/* Few sinks support scrambling for cloks < 340M */
+			if ((hf_vsdb[6] & 0x8))
+				hdmi->scr_info.low_clocks = true;
+		}
+	}
+}
+
+/**
+ * drm_check_scrambling_status - what is status of scrambling?
+ * @adapter: i2c adapter for SCDC channel
+ *
+ * Read the scrambler status over SCDC channel, and check the
+ * scrambling status.
+ *
+ * Return: True if the scrambling is enabled, false otherwise.
+ */
+
+bool drm_check_scrambling_status(struct i2c_adapter *adapter)
+{
+	u8 status;
+
+	if (drm_scdc_readb(adapter, SCDC_SCRAMBLER_STATUS, &status) < 0) {
+		DRM_ERROR("Failed to read scrambling status\n");
+		return false;
+	}
+
+	status &= SCDC_SCRAMBLING_STATUS;
+	return status != 0;
+}
+
+/**
+ * drm_enable_scrambling - enable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: enable scrambling, even if its already enabled
+ *
+ * Write the TMDS config over SCDC channel, and enable scrambling
+ * Return: True if scrambling is successfully enabled, false otherwise.
+ */
+
+bool drm_enable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already enabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config |= SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return hdmi_info->scr_info.status;
+}
+
+/**
+ * drm_disable_scrambling - disable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: disable scrambling, even if its already disabled
+ *
+ * Write the TMDS config over SCDC channel, and disable scrambling
+ * Return: True if scrambling is successfully disabled, false otherwise.
+ */
+bool drm_disable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (!hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already disabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config &= ~SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return !hdmi_info->scr_info.status;
+}
+
 static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 					   const u8 *hdmi)
 {
@@ -3928,8 +4055,10 @@ 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))
+		if (cea_db_is_hdmi_forum_vsdb(db)) {
 			drm_detect_hdmi_scdc(connector, db);
+			drm_detect_hdmi_scrambling(connector, db);
+		}
 	}
 }
 
include/drm/drm_connector.h +24 -0
index 2435598..b9735bd 100644
@@ -90,6 +90,26 @@ enum subpixel_order {
 
 };
 
+
+/**
+ * struct scrambling: sink's scrambling support.
+ */
+struct scrambling {
+	/**
+	 * @supported: scrambling supported for rates > 340Mhz.
+	 */
+	bool supported;
+	/**
+	 * @low_clocks: scrambling supported for rates <= 340Mhz.
+	 */
+	bool low_clocks;
+	/**
+	 * @status: scrambling enabled/disabled ?
+	 */
+	bool status;
+};
+
+
 /**
  * struct drm_hdmi_info - runtime data about the connected sink
  *
@@ -108,6 +128,10 @@ struct drm_hdmi_info {
 	 * @scdc_rr: sink is capable of generating scdc read request.
 	 */
 	bool scdc_rr;
+	/**
+	 * scr_info: sink's scrambling support and capabilities.
+	 */
+	struct scrambling scr_info;
 };
 
 /**
include/drm/drm_edid.h +5 -1
index 43fb0ac..d24c974 100644
@@ -462,5 +462,9 @@ 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);
-
+bool drm_enable_scrambling(struct drm_connector *connector,
+				struct i2c_adapter *adapter, bool force);
+bool drm_disable_scrambling(struct drm_connector *connector,
+				struct i2c_adapter *adapter, bool force);
+bool drm_check_scrambling_status(struct i2c_adapter *adapter);
 #endif /* __DRM_EDID_H__ */
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw

Re: [PATCH 4/6] drm: scrambling support in drm layer

Quoted 31 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
 drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
 include/drm/drm_connector.h |  24 ++++++++
 include/drm/drm_edid.h      |   6 +-
 3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +1 -0
index 37902e5..f0d940a 100644
@@ -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>
 
 #define version_greater(edid, maj, min) \
 	(((edid)->version > (maj)) || \
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
 	}

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3825

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +8 -0
 }
 
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
+{
+	struct drm_display_info *display = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &display->hdmi_info;
+
+	/*
+	 * All HDMI 2.0 monitors must support scrambling at rates > 340M.

In comments below you use Mhz as the abbreviations. This should be consistent. Also I think "MHz" is actually the correct spelling.

Quoted 15 lines
drivers/gpu/drm/drm_edid.c +15 -0
+	 * 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
+	 * * SCDC support available
+	 * Lets check it out.
+	 */
+
+	if (hf_vsdb[5]) {
+		display->max_tmds_clock = hf_vsdb[5] * 5000;
+		DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n",
+			display->max_tmds_clock);
+
+		if (hdmi->scdc_supported) {
+			hdmi->scr_info.supported = true;
+

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3850

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+			/* Few sinks support scrambling for cloks < 340M */
+			if ((hf_vsdb[6] & 0x8))
+				hdmi->scr_info.low_clocks = true;
+		}
+	}
+}
+
+/**
+ * drm_check_scrambling_status - what is status of scrambling?
+ * @adapter: i2c adapter for SCDC channel

"I2C", same in other parts of this patch.

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3855

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+ *
+ * Read the scrambler status over SCDC channel, and check the
+ * scrambling status.
+ *
+ * Return: True if the scrambling is enabled, false otherwise.

I think the rest of DRM/KMS kerneldoc tries to use "Returns:\n" as a standard way to document return values.

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3858

Quoted 3 lines
drivers/gpu/drm/drm_edid.c +3 -0
+ */
+
+bool drm_check_scrambling_status(struct i2c_adapter *adapter)

Maybe use a drm_scdc_*() prefix for this to make it more consistent with other SCDC API.

While at it, would this not be better located in drm_scdc.c along with the other helpers? drm_edid.c is more focussed on the parsing aspects of all things EDID.

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3862

Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+{
+	u8 status;
+
+	if (drm_scdc_readb(adapter, SCDC_SCRAMBLER_STATUS, &status) < 0) {

How about storing the error code...

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3863

Quoted 1 line
drivers/gpu/drm/drm_edid.c +1 -0
+		DRM_ERROR("Failed to read scrambling status\n");

... and making it part of the error message? Sometimes its useful to know what exact error triggered this because it helps narrowing down where things went wrong.

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3868

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+		return false;
+	}
+
+	status &= SCDC_SCRAMBLING_STATUS;
+	return status != 0;

Maybe make this a single line:

	return (status & SCDC_SCRAMBLING_STATUS) != 0;

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3873

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+}
+
+/**
+ * drm_enable_scrambling - enable scrambling
+ * @connector: target drm_connector

"target DRM connector"?

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3882

Quoted 9 lines
drivers/gpu/drm/drm_edid.c +9 -0
+ * @adapter: i2c adapter for SCDC channel
+ * @force: enable scrambling, even if its already enabled
+ *
+ * Write the TMDS config over SCDC channel, and enable scrambling
+ * Return: True if scrambling is successfully enabled, false otherwise.
+ */
+
+bool drm_enable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)

I think I'd move this to drm_scdc.c as well because it primarily operates on SCDC. If you do so, might be worth making adapter the first argument for consistency with other SCDC API.

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3893

Quoted 11 lines
drivers/gpu/drm/drm_edid.c +11 -0
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already enabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");

Maybe also print the error code?

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3900

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		return false;
+	}
+
+	config |= SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");

Same here.

Quoted 32 lines
drivers/gpu/drm/drm_edid.c +32 -0
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return hdmi_info->scr_info.status;
+}
+
+/**
+ * drm_disable_scrambling - disable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: disable scrambling, even if its already disabled
+ *
+ * Write the TMDS config over SCDC channel, and disable scrambling
+ * Return: True if scrambling is successfully disabled, false otherwise.
+ */
+bool drm_disable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (!hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already disabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3942

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+	config &= ~SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return !hdmi_info->scr_info.status;
+}

Same comments as for drm_enable_scrambling().

Quoted 17 lines
drivers/gpu/drm/drm_edid.c +3 -1
@@ -3928,8 +4055,10 @@ 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))
+		if (cea_db_is_hdmi_forum_vsdb(db)) {
 			drm_detect_hdmi_scdc(connector, db);
+			drm_detect_hdmi_scrambling(connector, db);
+		}
 	}
 }
 
include/drm/drm_connector.h +0 -0
index 2435598..b9735bd 100644

include/drm/drm_connector.h enum subpixel_order { · line 99

Quoted 10 lines
include/drm/drm_connector.h +7 -0
@@ -90,6 +90,26 @@ enum subpixel_order {
 
 };
 
+
+/**
+ * struct scrambling: sink's scrambling support.
+ */
+struct scrambling {
+	/**
+	 * @supported: scrambling supported for rates > 340Mhz.

I think it's common to separate number and unit by a space, so "340 MHz".

include/drm/drm_connector.h enum subpixel_order { · line 105

Quoted 6 lines
include/drm/drm_connector.h +6 -0
+	 */
+	bool supported;
+	/**
+	 * @low_clocks: scrambling supported for rates <= 340Mhz.
+	 */
+	bool low_clocks;

Maybe "low_rates" because a clock is technically the source of a signal that oscillates at the given rate.

Quoted 11 lines
include/drm/drm_connector.h +7 -0
+	/**
+	 * @status: scrambling enabled/disabled ?
+	 */
+	bool status;
+};
+
+
 /**
  * struct drm_hdmi_info - runtime data about the connected sink
  *

include/drm/drm_connector.h struct drm_hdmi_info { · line 134

Quoted 7 lines
include/drm/drm_connector.h +4 -0
@@ -108,6 +128,10 @@ struct drm_hdmi_info {
 	 * @scdc_rr: sink is capable of generating scdc read request.
 	 */
 	bool scdc_rr;
+	/**
+	 * scr_info: sink's scrambling support and capabilities.
+	 */
+	struct scrambling scr_info;

Again, I think I'd drop _info and instead spell out "scrambling" to make this easier to remember.

Also I'm wondering why scdc_supported and scdc_rr are not in a structure if scrambling info is. Also since scrambling depends on SCDC, would it make sense to embed it in a struct drm_hdmi_scdc_info?

	struct drm_hdmi_scdc_scrambling_info {
		bool supported;
		bool low_rates;
		bool status;
	};

	struct drm_hdmi_scdc_info {
		bool supported;
		bool read_request;

		struct drm_hdmi_scdc_scrambling_info scrambling;
	};

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#13 lore raw

Re: [PATCH 4/6] drm: scrambling support in drm layer

Regards

Shashank

Quoted 34 lines · Thierry Reding
Quoted 33 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
  drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
  include/drm/drm_connector.h |  24 ++++++++
  include/drm/drm_edid.h      |   6 +-
  3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +1 -0
index 37902e5..f0d940a 100644
@@ -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>
 
  #define version_greater(edid, maj, min) \
  	(((edid)->version > (maj)) || \
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
  	}
  }
 
Quoted 10 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3825

Quoted 8 lines
drivers/gpu/drm/drm_edid.c +8 -0
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
+{
+	struct drm_display_info *display = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &display->hdmi_info;
+
+	/*
+	 * All HDMI 2.0 monitors must support scrambling at rates > 340M.

In comments below you use Mhz as the abbreviations. This should be consistent. Also I think "MHz" is actually the correct spelling.

Agree.

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/drm_edid.c +18 -0
+	 * 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
+	 * * SCDC support available
+	 * Lets check it out.
+	 */
+
+	if (hf_vsdb[5]) {
+		display->max_tmds_clock = hf_vsdb[5] * 5000;
+		DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n",
+			display->max_tmds_clock);
+
+		if (hdmi->scdc_supported) {
+			hdmi->scr_info.supported = true;
+
+			/* Few sinks support scrambling for cloks < 340M */
+			if ((hf_vsdb[6] & 0x8))
+				hdmi->scr_info.low_clocks = true;
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3850

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		}
+	}
+}
+
+/**
+ * drm_check_scrambling_status - what is status of scrambling?
+ * @adapter: i2c adapter for SCDC channel

"I2C", same in other parts of this patch.

Got it.

Quoted 7 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3855

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+ *
+ * Read the scrambler status over SCDC channel, and check the
+ * scrambling status.
+ *
+ * Return: True if the scrambling is enabled, false otherwise.

I think the rest of DRM/KMS kerneldoc tries to use "Returns:\n" as a standard way to document return values.

Ok.

Quoted 9 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3858

Quoted 3 lines
drivers/gpu/drm/drm_edid.c +3 -0
+ */
+
+bool drm_check_scrambling_status(struct i2c_adapter *adapter)

Maybe use a drm_scdc_*() prefix for this to make it more consistent with other SCDC API.

While at it, would this not be better located in drm_scdc.c along with the other helpers? drm_edid.c is more focussed on the parsing aspects of all things EDID.

Yeah, the same is mentioned by Ville too, will do that.

Quoted 10 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3862

Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+{
+	u8 status;
+
+	if (drm_scdc_readb(adapter, SCDC_SCRAMBLER_STATUS, &status) < 0) {

How about storing the error code...

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3863

Quoted 1 line
drivers/gpu/drm/drm_edid.c +1 -0
+		DRM_ERROR("Failed to read scrambling status\n");

... and making it part of the error message? Sometimes its useful to know what exact error triggered this because it helps narrowing down where things went wrong.

Agree, in fact while debugging and testing this patch series, I had to print it explicitly.

Quoted 9 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3868

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +5 -0
+		return false;
+	}
+
+	status &= SCDC_SCRAMBLING_STATUS;
+	return status != 0;

Maybe make this a single line:

	return (status & SCDC_SCRAMBLING_STATUS) != 0;

Got it.

Quoted 7 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3873

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +5 -0
+}
+
+/**
+ * drm_enable_scrambling - enable scrambling
+ * @connector: target drm_connector

"target DRM connector"?

Got it.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+ * @adapter: i2c adapter for SCDC channel
+ * @force: enable scrambling, even if its already enabled
+ *
+ * Write the TMDS config over SCDC channel, and enable scrambling
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3882

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+ * Return: True if scrambling is successfully enabled, false otherwise.
+ */
+
+bool drm_enable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)

I think I'd move this to drm_scdc.c as well because it primarily operates on SCDC. If you do so, might be worth making adapter the first argument for consistency with other SCDC API.

Agree, will move it.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3893

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+	if (hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already enabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");

Maybe also print the error code?

Ok.

Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3900

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		return false;
+	}
+
+	config |= SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");

Same here.

Ok

Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/drm_edid.c +35 -0
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return hdmi_info->scr_info.status;
+}
+
+/**
+ * drm_disable_scrambling - disable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: disable scrambling, even if its already disabled
+ *
+ * Write the TMDS config over SCDC channel, and disable scrambling
+ * Return: True if scrambling is successfully disabled, false otherwise.
+ */
+bool drm_disable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (!hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already disabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config &= ~SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3942

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return !hdmi_info->scr_info.status;
+}

Same comments as for drm_enable_scrambling().

Got it.

Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/drm_edid.c +3 -1
@@ -3928,8 +4055,10 @@ 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))
+		if (cea_db_is_hdmi_forum_vsdb(db)) {
  			drm_detect_hdmi_scdc(connector, db);
+			drm_detect_hdmi_scrambling(connector, db);
+		}
  	}
  }
 
include/drm/drm_connector.h +0 -0
index 2435598..b9735bd 100644
@@ -90,6 +90,26 @@ enum subpixel_order {
 
  };
 
Quoted 9 lines

include/drm/drm_connector.h enum subpixel_order { · line 99

Quoted 7 lines
include/drm/drm_connector.h +7 -0
+
+/**
+ * struct scrambling: sink's scrambling support.
+ */
+struct scrambling {
+	/**
+	 * @supported: scrambling supported for rates > 340Mhz.

I think it's common to separate number and unit by a space, so "340 MHz".

Got it.

Quoted 8 lines

include/drm/drm_connector.h enum subpixel_order { · line 105

Quoted 6 lines
include/drm/drm_connector.h +6 -0
+	 */
+	bool supported;
+	/**
+	 * @low_clocks: scrambling supported for rates <= 340Mhz.
+	 */
+	bool low_clocks;

Maybe "low_rates" because a clock is technically the source of a signal that oscillates at the given rate.

Agree, will change it.

Quoted 12 lines
Quoted 12 lines
include/drm/drm_connector.h +7 -0
+	/**
+	 * @status: scrambling enabled/disabled ?
+	 */
+	bool status;
+};
+
+
  /**
   * struct drm_hdmi_info - runtime data about the connected sink
   *
@@ -108,6 +128,10 @@ struct drm_hdmi_info {
  	 * @scdc_rr: sink is capable of generating scdc read request.
Quoted 8 lines

include/drm/drm_connector.h struct drm_hdmi_info { · line 134

Quoted 6 lines
include/drm/drm_connector.h +4 -0
  	 */
  	bool scdc_rr;
+	/**
+	 * scr_info: sink's scrambling support and capabilities.
+	 */
+	struct scrambling scr_info;

Again, I think I'd drop _info and instead spell out "scrambling" to make this easier to remember.

Sure, can be done.

Quoted 4 lines

Also I'm wondering why scdc_supported and scdc_rr are not in a structure if scrambling info is. Also since scrambling depends on SCDC, would it make sense to embed it in a struct drm_hdmi_scdc_info?

My opinion while designing was:
- SCDC rr support is platform specific, and a platform can choose not to support read_req but just allow scrambling using scdc read and write, hence kept that separate
- You need to look into this internal structure, only if scdc is supported.
- Also, SCDC registers can be used beyond scrambling too, like for error detection, and other cases, so I thought it would be better to keep it independent.

Does it make sense ?

-Shashank

Quoted 14 lines
	struct drm_hdmi_scdc_scrambling_info {
		bool supported;
		bool low_rates;
		bool status;
	};

	struct drm_hdmi_scdc_info {
		bool supported;
		bool read_request;

		struct drm_hdmi_scdc_scrambling_info scrambling;
	};
Quoted 1 line

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#14 lore raw

Re: [PATCH 4/6] drm: scrambling support in drm layer

Quoted 272 lines · Shashank

Regards

Shashank

Quoted 34 lines · Thierry Reding
Quoted 33 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
  drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
  include/drm/drm_connector.h |  24 ++++++++
  include/drm/drm_edid.h      |   6 +-
  3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +3 -0
index 37902e5..f0d940a 100644
@@ -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>
  #define version_greater(edid, maj, min) \
  	(((edid)->version > (maj)) || \
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
  	}
  }
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3825

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +6 -0
+{
+	struct drm_display_info *display = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &display->hdmi_info;
+
+	/*
+	 * All HDMI 2.0 monitors must support scrambling at rates > 340M.

In comments below you use Mhz as the abbreviations. This should be consistent. Also I think "MHz" is actually the correct spelling.

Agree.

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/drm_edid.c +18 -0
+	 * 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
+	 * * SCDC support available
+	 * Lets check it out.
+	 */
+
+	if (hf_vsdb[5]) {
+		display->max_tmds_clock = hf_vsdb[5] * 5000;
+		DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n",
+			display->max_tmds_clock);
+
+		if (hdmi->scdc_supported) {
+			hdmi->scr_info.supported = true;
+
+			/* Few sinks support scrambling for cloks < 340M */
+			if ((hf_vsdb[6] & 0x8))
+				hdmi->scr_info.low_clocks = true;
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3850

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		}
+	}
+}
+
+/**
+ * drm_check_scrambling_status - what is status of scrambling?
+ * @adapter: i2c adapter for SCDC channel

"I2C", same in other parts of this patch.

Got it.

Quoted 7 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3855

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+ *
+ * Read the scrambler status over SCDC channel, and check the
+ * scrambling status.
+ *
+ * Return: True if the scrambling is enabled, false otherwise.

I think the rest of DRM/KMS kerneldoc tries to use "Returns:\n" as a standard way to document return values.

Ok.

Quoted 9 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3858

Quoted 3 lines
drivers/gpu/drm/drm_edid.c +3 -0
+ */
+
+bool drm_check_scrambling_status(struct i2c_adapter *adapter)

Maybe use a drm_scdc_*() prefix for this to make it more consistent with other SCDC API.

While at it, would this not be better located in drm_scdc.c along with the other helpers? drm_edid.c is more focussed on the parsing aspects of all things EDID.

Yeah, the same is mentioned by Ville too, will do that.

Quoted 10 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3862

Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+{
+	u8 status;
+
+	if (drm_scdc_readb(adapter, SCDC_SCRAMBLER_STATUS, &status) < 0) {

How about storing the error code...

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3863

Quoted 1 line
drivers/gpu/drm/drm_edid.c +1 -0
+		DRM_ERROR("Failed to read scrambling status\n");

... and making it part of the error message? Sometimes its useful to know what exact error triggered this because it helps narrowing down where things went wrong.

Agree, in fact while debugging and testing this patch series, I had to print it explicitly.

Quoted 9 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3868

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +5 -0
+		return false;
+	}
+
+	status &= SCDC_SCRAMBLING_STATUS;
+	return status != 0;

Maybe make this a single line:

	return (status & SCDC_SCRAMBLING_STATUS) != 0;

Got it.

Quoted 7 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3873

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +5 -0
+}
+
+/**
+ * drm_enable_scrambling - enable scrambling
+ * @connector: target drm_connector

"target DRM connector"?

Got it.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+ * @adapter: i2c adapter for SCDC channel
+ * @force: enable scrambling, even if its already enabled
+ *
+ * Write the TMDS config over SCDC channel, and enable scrambling
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3882

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+ * Return: True if scrambling is successfully enabled, false otherwise.
+ */
+
+bool drm_enable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)

I think I'd move this to drm_scdc.c as well because it primarily operates on SCDC. If you do so, might be worth making adapter the first argument for consistency with other SCDC API.

Agree, will move it.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3893

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+	if (hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already enabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");

Maybe also print the error code?

Ok.

Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3900

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		return false;
+	}
+
+	config |= SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");

Same here.

Ok

Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/drm_edid.c +35 -0
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return hdmi_info->scr_info.status;
+}
+
+/**
+ * drm_disable_scrambling - disable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: disable scrambling, even if its already disabled
+ *
+ * Write the TMDS config over SCDC channel, and disable scrambling
+ * Return: True if scrambling is successfully disabled, false otherwise.
+ */
+bool drm_disable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (!hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already disabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config &= ~SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3942

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return !hdmi_info->scr_info.status;
+}

Same comments as for drm_enable_scrambling().

Got it.

Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/drm_edid.c +3 -1
@@ -3928,8 +4055,10 @@ 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))
+		if (cea_db_is_hdmi_forum_vsdb(db)) {
  			drm_detect_hdmi_scdc(connector, db);
+			drm_detect_hdmi_scrambling(connector, db);
+		}
  	}
  }
include/drm/drm_connector.h +1 -0
index 2435598..b9735bd 100644
@@ -90,6 +90,26 @@ enum subpixel_order {
  };
+
Quoted 8 lines

include/drm/drm_connector.h enum subpixel_order { · line 99

Quoted 6 lines
include/drm/drm_connector.h +6 -0
+/**
+ * struct scrambling: sink's scrambling support.
+ */
+struct scrambling {
+	/**
+	 * @supported: scrambling supported for rates > 340Mhz.

I think it's common to separate number and unit by a space, so "340 MHz".

Got it.

Quoted 8 lines

include/drm/drm_connector.h enum subpixel_order { · line 105

Quoted 6 lines
include/drm/drm_connector.h +6 -0
+	 */
+	bool supported;
+	/**
+	 * @low_clocks: scrambling supported for rates <= 340Mhz.
+	 */
+	bool low_clocks;

Maybe "low_rates" because a clock is technically the source of a signal that oscillates at the given rate.

Agree, will change it.

Quoted 12 lines
Quoted 12 lines
include/drm/drm_connector.h +7 -0
+	/**
+	 * @status: scrambling enabled/disabled ?
+	 */
+	bool status;
+};
+
+
  /**
   * struct drm_hdmi_info - runtime data about the connected sink
   *
@@ -108,6 +128,10 @@ struct drm_hdmi_info {
  	 * @scdc_rr: sink is capable of generating scdc read request.
Quoted 8 lines

include/drm/drm_connector.h struct drm_hdmi_info { · line 134

Quoted 6 lines
include/drm/drm_connector.h +4 -0
  	 */
  	bool scdc_rr;
+	/**
+	 * scr_info: sink's scrambling support and capabilities.
+	 */
+	struct scrambling scr_info;

Again, I think I'd drop _info and instead spell out "scrambling" to make this easier to remember.

Sure, can be done.

Quoted 4 lines

Also I'm wondering why scdc_supported and scdc_rr are not in a structure if scrambling info is. Also since scrambling depends on SCDC, would it make sense to embed it in a struct drm_hdmi_scdc_info?

My opinion while designing was:
- SCDC rr support is platform specific, and a platform can choose not to support read_req but just allow
scrambling using scdc read and write, hence kept that separate
- You need to look into this internal structure, only if scdc is supported.
- Also, SCDC registers can be used beyond scrambling too, like for error detection, and other cases, so I thought
it would be better to keep it independent.

Quoted 1 line

Does it make sense ?

Yes, I think that makes sense, but it's not what I was trying to say. =) What I was trying to say is that read request and scrambling are defined in the SCDC specification, and therefore they require SCDC. That's why I think the below is a natural representation because it captures the dependency in a hierarchy:

Quoted 6 lines
Quoted 6 lines
	struct drm_hdmi_scdc_scrambling_info {
		bool supported;
		bool low_rates;
		bool status;
	};
Quoted 6 lines
Quoted 6 lines
	struct drm_hdmi_scdc_info {
		bool supported;
		bool read_request;

		struct drm_hdmi_scdc_scrambling_info scrambling;
	};

I should have added to the above:

	struct drm_hdmi_info {
		struct drm_hdmi_scdc_info scdc;
	};

So when conditionalizing code this allows for a very natural ordering of the code:

	struct drm_display_info *info = ...;
	struct drm_hdmi_scdc_info *scdc = &info->hdmi.scdc;

	if (scdc->supported) {
		...

		if (scdc->read_request) {
			...
			e.g. set up handler for read requests
			...
		}

		...

		if (scdc->scrambling.supported) {
			if (mode->clock >= 340000 || scdc->scrambling.low_rates) {
				...
				set up scrambling
				...;
			}
		}

		...
	}

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#15 lore raw

Re: [PATCH 4/6] drm: scrambling support in drm layer

Regards

Shashank

Quoted 323 lines · Thierry Reding
Quoted 269 lines · Shashank

Regards

Shashank

Quoted 34 lines · Thierry Reding
Quoted 33 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
   drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
   include/drm/drm_connector.h |  24 ++++++++
   include/drm/drm_edid.h      |   6 +-
   3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +3 -0
index 37902e5..f0d940a 100644
@@ -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>
   #define version_greater(edid, maj, min) \
   	(((edid)->version > (maj)) || \
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
   	}
   }
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3825

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +6 -0
+{
+	struct drm_display_info *display = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &display->hdmi_info;
+
+	/*
+	 * All HDMI 2.0 monitors must support scrambling at rates > 340M.

In comments below you use Mhz as the abbreviations. This should be consistent. Also I think "MHz" is actually the correct spelling.

Agree.

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/drm_edid.c +18 -0
+	 * 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
+	 * * SCDC support available
+	 * Lets check it out.
+	 */
+
+	if (hf_vsdb[5]) {
+		display->max_tmds_clock = hf_vsdb[5] * 5000;
+		DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n",
+			display->max_tmds_clock);
+
+		if (hdmi->scdc_supported) {
+			hdmi->scr_info.supported = true;
+
+			/* Few sinks support scrambling for cloks < 340M */
+			if ((hf_vsdb[6] & 0x8))
+				hdmi->scr_info.low_clocks = true;
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3850

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		}
+	}
+}
+
+/**
+ * drm_check_scrambling_status - what is status of scrambling?
+ * @adapter: i2c adapter for SCDC channel

"I2C", same in other parts of this patch.

Got it.

Quoted 7 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3855

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+ *
+ * Read the scrambler status over SCDC channel, and check the
+ * scrambling status.
+ *
+ * Return: True if the scrambling is enabled, false otherwise.

I think the rest of DRM/KMS kerneldoc tries to use "Returns:\n" as a standard way to document return values.

Ok.

Quoted 9 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3858

Quoted 3 lines
drivers/gpu/drm/drm_edid.c +3 -0
+ */
+
+bool drm_check_scrambling_status(struct i2c_adapter *adapter)

Maybe use a drm_scdc_*() prefix for this to make it more consistent with other SCDC API.

While at it, would this not be better located in drm_scdc.c along with the other helpers? drm_edid.c is more focussed on the parsing aspects of all things EDID.

Yeah, the same is mentioned by Ville too, will do that.

Quoted 10 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3862

Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+{
+	u8 status;
+
+	if (drm_scdc_readb(adapter, SCDC_SCRAMBLER_STATUS, &status) < 0) {

How about storing the error code...

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3863

Quoted 1 line
drivers/gpu/drm/drm_edid.c +1 -0
+		DRM_ERROR("Failed to read scrambling status\n");

... and making it part of the error message? Sometimes its useful to know what exact error triggered this because it helps narrowing down where things went wrong.

Agree, in fact while debugging and testing this patch series, I had to print it explicitly.

Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3868

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+		return false;
+	}
+
+	status &= SCDC_SCRAMBLING_STATUS;
+	return status != 0;

Maybe make this a single line:

	return (status & SCDC_SCRAMBLING_STATUS) != 0;

Got it.

Quoted 6 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3873

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+}
+
+/**
+ * drm_enable_scrambling - enable scrambling
+ * @connector: target drm_connector

"target DRM connector"?

Got it.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+ * @adapter: i2c adapter for SCDC channel
+ * @force: enable scrambling, even if its already enabled
+ *
+ * Write the TMDS config over SCDC channel, and enable scrambling
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3882

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +5 -0
+ * Return: True if scrambling is successfully enabled, false otherwise.
+ */
+
+bool drm_enable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)

I think I'd move this to drm_scdc.c as well because it primarily operates on SCDC. If you do so, might be worth making adapter the first argument for consistency with other SCDC API.

Agree, will move it.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3893

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+	if (hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already enabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");

Maybe also print the error code?

Ok.

Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3900

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		return false;
+	}
+
+	config |= SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");

Same here.

Ok

Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/drm_edid.c +35 -0
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return hdmi_info->scr_info.status;
+}
+
+/**
+ * drm_disable_scrambling - disable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: disable scrambling, even if its already disabled
+ *
+ * Write the TMDS config over SCDC channel, and disable scrambling
+ * Return: True if scrambling is successfully disabled, false otherwise.
+ */
+bool drm_disable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (!hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already disabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config &= ~SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3942

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return !hdmi_info->scr_info.status;
+}

Same comments as for drm_enable_scrambling().

Got it.

Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/drm_edid.c +3 -1
@@ -3928,8 +4055,10 @@ 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))
+		if (cea_db_is_hdmi_forum_vsdb(db)) {
   			drm_detect_hdmi_scdc(connector, db);
+			drm_detect_hdmi_scrambling(connector, db);
+		}
   	}
   }
include/drm/drm_connector.h +1 -0
index 2435598..b9735bd 100644
@@ -90,6 +90,26 @@ enum subpixel_order {
   };
+
Quoted 8 lines

include/drm/drm_connector.h enum subpixel_order { · line 99

Quoted 6 lines
include/drm/drm_connector.h +6 -0
+/**
+ * struct scrambling: sink's scrambling support.
+ */
+struct scrambling {
+	/**
+	 * @supported: scrambling supported for rates > 340Mhz.

I think it's common to separate number and unit by a space, so "340 MHz".

Got it.

Quoted 8 lines

include/drm/drm_connector.h enum subpixel_order { · line 105

Quoted 6 lines
include/drm/drm_connector.h +6 -0
+	 */
+	bool supported;
+	/**
+	 * @low_clocks: scrambling supported for rates <= 340Mhz.
+	 */
+	bool low_clocks;

Maybe "low_rates" because a clock is technically the source of a signal that oscillates at the given rate.

Agree, will change it.

Quoted 12 lines
Quoted 12 lines
include/drm/drm_connector.h +7 -0
+	/**
+	 * @status: scrambling enabled/disabled ?
+	 */
+	bool status;
+};
+
+
   /**
    * struct drm_hdmi_info - runtime data about the connected sink
    *
@@ -108,6 +128,10 @@ struct drm_hdmi_info {
   	 * @scdc_rr: sink is capable of generating scdc read request.
Quoted 8 lines

include/drm/drm_connector.h struct drm_hdmi_info { · line 134

Quoted 6 lines
include/drm/drm_connector.h +4 -0
   	 */
   	bool scdc_rr;
+	/**
+	 * scr_info: sink's scrambling support and capabilities.
+	 */
+	struct scrambling scr_info;

Again, I think I'd drop _info and instead spell out "scrambling" to make this easier to remember.

Sure, can be done.

Quoted 3 lines

Also I'm wondering why scdc_supported and scdc_rr are not in a structure if scrambling info is. Also since scrambling depends on SCDC, would it make sense to embed it in a struct drm_hdmi_scdc_info?

My opinion while designing was:
- SCDC rr support is platform specific, and a platform can choose not to support read_req but just allow
scrambling using scdc read and write, hence kept that separate
- You need to look into this internal structure, only if scdc is supported.
- Also, SCDC registers can be used beyond scrambling too, like for error detection, and other cases, so I thought
it would be better to keep it independent.

Quoted 1 line

Does it make sense ?

Yes, I think that makes sense, but it's not what I was trying to say. =) What I was trying to say is that read request and scrambling are defined in the SCDC specification, and therefore they require SCDC. That's why I think the below is a natural representation because it captures the dependency in a hierarchy:

Quoted 6 lines
Quoted 6 lines
	struct drm_hdmi_scdc_scrambling_info {
		bool supported;
		bool low_rates;
		bool status;
	};
Quoted 6 lines
Quoted 6 lines
	struct drm_hdmi_scdc_info {
		bool supported;
		bool read_request;

		struct drm_hdmi_scdc_scrambling_info scrambling;
	};

I should have added to the above:

	struct drm_hdmi_info {
		struct drm_hdmi_scdc_info scdc;
	};

So when conditionalizing code this allows for a very natural ordering of the code:

	struct drm_display_info *info = ...;
	struct drm_hdmi_scdc_info *scdc = &info->hdmi.scdc;

	if (scdc->supported) {
		...

		if (scdc->read_request) {
			...
			e.g. set up handler for read requests
			...
		}

		...

		if (scdc->scrambling.supported) {
			if (mode->clock >= 340000 || scdc->scrambling.low_rates) {
				...
				set up scrambling
				...;
			}
		}

		...
	}
Quoted 1 line

Thierry

Well, makes perfect sense, will change the code as suggested :=)

- Shashank

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#16 lore raw

Re: [PATCH 4/6] drm: scrambling support in drm layer

In reply to Shashank Sharma
Quoted 30 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
 drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
 include/drm/drm_connector.h |  24 ++++++++
 include/drm/drm_edid.h      |   6 +-
 3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +1 -0
index 37902e5..f0d940a 100644
@@ -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>
 
 #define version_greater(edid, maj, min) \
 	(((edid)->version > (maj)) || \

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3819

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +2 -0
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
 	}
 }
 
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)

That names seems off. Should probably be drm_parse_hdmi_forum_vsdb() or something.

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+{
+	struct drm_display_info *display = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &display->hdmi_info;
+
+	/*
+	 * All HDMI 2.0 monitors must support scrambling at rates > 340M.
+	 * And as per the spec, three factors confirm this:

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3836

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+	 * * Availability of a HF-VSDB block in EDID (check)
+	 * * Non zero Max_TMDS_Char_Rate filed in HF-VSDB
+	 * * SCDC support available
+	 * Lets check it out.
+	 */
+
+	if (hf_vsdb[5]) {
+		display->max_tmds_clock = hf_vsdb[5] * 5000;
+		DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n",
+			display->max_tmds_clock);

I wonder if we should be a little paranoid and ignore this if it's <=340?

Quoted 12 lines
drivers/gpu/drm/drm_edid.c +12 -0
+
+		if (hdmi->scdc_supported) {
+			hdmi->scr_info.supported = true;
+
+			/* Few sinks support scrambling for cloks < 340M */
+			if ((hf_vsdb[6] & 0x8))
+				hdmi->scr_info.low_clocks = true;
+		}
+	}
+}
+
+/**

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3858

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+ * drm_check_scrambling_status - what is status of scrambling?
+ * @adapter: i2c adapter for SCDC channel
+ *
+ * Read the scrambler status over SCDC channel, and check the
+ * scrambling status.
+ *
+ * Return: True if the scrambling is enabled, false otherwise.
+ */
+
+bool drm_check_scrambling_status(struct i2c_adapter *adapter)

The name is again a little wonky. And it looks like something that should live alognside the SCDC helper stuff.

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3868

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+{
+	u8 status;
+
+	if (drm_scdc_readb(adapter, SCDC_SCRAMBLER_STATUS, &status) < 0) {
+		DRM_ERROR("Failed to read scrambling status\n");
+		return false;
+	}
+
+	status &= SCDC_SCRAMBLING_STATUS;
+	return status != 0;

return status & SCDC_SCRAMBLING_STATUS

Quoted 12 lines
drivers/gpu/drm/drm_edid.c +12 -0
+}
+
+/**
+ * drm_enable_scrambling - enable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: enable scrambling, even if its already enabled
+ *
+ * Write the TMDS config over SCDC channel, and enable scrambling
+ * Return: True if scrambling is successfully enabled, false otherwise.
+ */
+

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3890

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+bool drm_enable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already enabled\n");
+		return true;
+	}

I don't think we want to track any dynamic state in the display info. That belongs to the atomic state stuff.

And the function again looks like something that belongs in the SCDC helper.

Since the two pieces of infromaton in this registrer are the scramble control and the clock ratio, I think we might want to just have one function to configure both.

Quoted 127 lines
drivers/gpu/drm/drm_edid.c +56 -1
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config |= SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return hdmi_info->scr_info.status;
+}
+
+/**
+ * drm_disable_scrambling - disable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: disable scrambling, even if its already disabled
+ *
+ * Write the TMDS config over SCDC channel, and disable scrambling
+ * Return: True if scrambling is successfully disabled, false otherwise.
+ */
+bool drm_disable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (!hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already disabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config &= ~SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return !hdmi_info->scr_info.status;
+}
+
 static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 					   const u8 *hdmi)
 {
@@ -3928,8 +4055,10 @@ 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))
+		if (cea_db_is_hdmi_forum_vsdb(db)) {
 			drm_detect_hdmi_scdc(connector, db);
+			drm_detect_hdmi_scrambling(connector, db);
+		}
 	}
 }
 
include/drm/drm_connector.h +24 -0
index 2435598..b9735bd 100644
@@ -90,6 +90,26 @@ enum subpixel_order {
 
 };
 
+
+/**
+ * struct scrambling: sink's scrambling support.
+ */
+struct scrambling {
+	/**
+	 * @supported: scrambling supported for rates > 340Mhz.
+	 */
+	bool supported;
+	/**
+	 * @low_clocks: scrambling supported for rates <= 340Mhz.
+	 */
+	bool low_clocks;
+	/**
+	 * @status: scrambling enabled/disabled ?
+	 */
+	bool status;
+};
+
+
 /**
  * struct drm_hdmi_info - runtime data about the connected sink
  *
@@ -108,6 +128,10 @@ struct drm_hdmi_info {
 	 * @scdc_rr: sink is capable of generating scdc read request.
 	 */
 	bool scdc_rr;
+	/**
+	 * scr_info: sink's scrambling support and capabilities.
+	 */
+	struct scrambling scr_info;
 };
 
 /**
include/drm/drm_edid.h +5 -1
index 43fb0ac..d24c974 100644
@@ -462,5 +462,9 @@ 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);
-
+bool drm_enable_scrambling(struct drm_connector *connector,
+				struct i2c_adapter *adapter, bool force);
+bool drm_disable_scrambling(struct drm_connector *connector,
+				struct i2c_adapter *adapter, bool force);
+bool drm_check_scrambling_status(struct i2c_adapter *adapter);
 #endif /* __DRM_EDID_H__ */
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

Re: [PATCH 4/6] drm: scrambling support in drm layer

Regards

Shashank

Quoted 34 lines · Ville Syrjälä
Quoted 33 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
  drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
  include/drm/drm_connector.h |  24 ++++++++
  include/drm/drm_edid.h      |   6 +-
  3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +1 -0
index 37902e5..f0d940a 100644
@@ -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>
 
  #define version_greater(edid, maj, min) \
  	(((edid)->version > (maj)) || \
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
  	}
  }
 
Quoted 4 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3819

Quoted 2 lines
drivers/gpu/drm/drm_edid.c +2 -0
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)

That names seems off. Should probably be drm_parse_hdmi_forum_vsdb() or something.

Actually, unlike the last patch set, we are not parsing the whole hf_vsdb, but parsing it only for scrambling status byte (hf_vsdb[5]). But may be I can make it drm_detect_scrambling_from_hfvsdb ot something similar. We will have more hf_vsdb parsing for 3d flags, yuv420_deep_color etc.

Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/drm_edid.c +11 -0
+{
+	struct drm_display_info *display = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &display->hdmi_info;
+
+	/*
+	 * All HDMI 2.0 monitors must support scrambling at rates > 340M.
+	 * 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
+	 * * SCDC support available
+	 * Lets check it out.
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3836

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +6 -0
+	 */
+
+	if (hf_vsdb[5]) {
+		display->max_tmds_clock = hf_vsdb[5] * 5000;
+		DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n",
+			display->max_tmds_clock);

I wonder if we should be a little paranoid and ignore this if it's <=340?

Sure, will do it.

Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/drm_edid.c +16 -0
+
+		if (hdmi->scdc_supported) {
+			hdmi->scr_info.supported = true;
+
+			/* Few sinks support scrambling for cloks < 340M */
+			if ((hf_vsdb[6] & 0x8))
+				hdmi->scr_info.low_clocks = true;
+		}
+	}
+}
+
+/**
+ * drm_check_scrambling_status - what is status of scrambling?
+ * @adapter: i2c adapter for SCDC channel
+ *
+ * Read the scrambler status over SCDC channel, and check the
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3858

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +6 -0
+ * scrambling status.
+ *
+ * Return: True if the scrambling is enabled, false otherwise.
+ */
+
+bool drm_check_scrambling_status(struct i2c_adapter *adapter)

The name is again a little wonky. And it looks like something that should live alognside the SCDC helper stuff.

Yep, Thierry also suggested the same, to move it along with SCDC. Will do it.

Quoted 11 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3868

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+{
+	u8 status;
+
+	if (drm_scdc_readb(adapter, SCDC_SCRAMBLER_STATUS, &status) < 0) {
+		DRM_ERROR("Failed to read scrambling status\n");
+		return false;
+	}
+
+	status &= SCDC_SCRAMBLING_STATUS;
+	return status != 0;

return status & SCDC_SCRAMBLING_STATUS

Sure.

Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/drm_edid.c +16 -0
+}
+
+/**
+ * drm_enable_scrambling - enable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: enable scrambling, even if its already enabled
+ *
+ * Write the TMDS config over SCDC channel, and enable scrambling
+ * Return: True if scrambling is successfully enabled, false otherwise.
+ */
+
+bool drm_enable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3890

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +6 -0
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already enabled\n");
+		return true;
+	}

I don't think we want to track any dynamic state in the display info. That belongs to the atomic state stuff.

Hummm, ok.

Quoted 3 lines

And the function again looks like something that belongs in the SCDC helper.

Agree.

Quoted 4 lines

Since the two pieces of infromaton in this registrer are the scramble control and the clock ratio, I think we might want to just have one function to configure both.

That's a good suggestion, thanks.

- Shashank

Quoted 120 lines
Quoted 120 lines
drivers/gpu/drm/drm_edid.c +56 -1
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config |= SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return hdmi_info->scr_info.status;
+}
+
+/**
+ * drm_disable_scrambling - disable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: disable scrambling, even if its already disabled
+ *
+ * Write the TMDS config over SCDC channel, and disable scrambling
+ * Return: True if scrambling is successfully disabled, false otherwise.
+ */
+bool drm_disable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (!hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already disabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config &= ~SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return !hdmi_info->scr_info.status;
+}
+
  static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
  					   const u8 *hdmi)
  {
@@ -3928,8 +4055,10 @@ 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))
+		if (cea_db_is_hdmi_forum_vsdb(db)) {
  			drm_detect_hdmi_scdc(connector, db);
+			drm_detect_hdmi_scrambling(connector, db);
+		}
  	}
  }
 
include/drm/drm_connector.h +24 -0
index 2435598..b9735bd 100644
@@ -90,6 +90,26 @@ enum subpixel_order {
 
  };
 
+
+/**
+ * struct scrambling: sink's scrambling support.
+ */
+struct scrambling {
+	/**
+	 * @supported: scrambling supported for rates > 340Mhz.
+	 */
+	bool supported;
+	/**
+	 * @low_clocks: scrambling supported for rates <= 340Mhz.
+	 */
+	bool low_clocks;
+	/**
+	 * @status: scrambling enabled/disabled ?
+	 */
+	bool status;
+};
+
+
  /**
   * struct drm_hdmi_info - runtime data about the connected sink
   *
@@ -108,6 +128,10 @@ struct drm_hdmi_info {
  	 * @scdc_rr: sink is capable of generating scdc read request.
  	 */
  	bool scdc_rr;
+	/**
+	 * scr_info: sink's scrambling support and capabilities.
+	 */
+	struct scrambling scr_info;
  };
 
  /**
include/drm/drm_edid.h +0 -1
index 43fb0ac..d24c974 100644
@@ -462,5 +462,9 @@ 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);
-
Quoted 8 lines
Quoted 8 lines
include/drm/drm_edid.h +5 -0
+bool drm_enable_scrambling(struct drm_connector *connector,
+				struct i2c_adapter *adapter, bool force);
+bool drm_disable_scrambling(struct drm_connector *connector,
+				struct i2c_adapter *adapter, bool force);
+bool drm_check_scrambling_status(struct i2c_adapter *adapter);
  #endif /* __DRM_EDID_H__ */
Signature · 1 line
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#18 lore raw

Re: [PATCH 4/6] drm: scrambling support in drm layer

Quoted 44 lines · Shashank

Regards

Shashank

Quoted 34 lines · Ville Syrjälä
Quoted 33 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
  drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
  include/drm/drm_connector.h |  24 ++++++++
  include/drm/drm_edid.h      |   6 +-
  3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +1 -0
index 37902e5..f0d940a 100644
@@ -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>
 
  #define version_greater(edid, maj, min) \
  	(((edid)->version > (maj)) || \
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
  	}
  }
 
Quoted 4 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3819

Quoted 2 lines
drivers/gpu/drm/drm_edid.c +2 -0
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)

That names seems off. Should probably be drm_parse_hdmi_forum_vsdb() or something.

Quoted 6 lines

Actually, unlike the last patch set, we are not parsing the whole hf_vsdb, but parsing it only for
scrambling status byte (hf_vsdb[5]). But may be I can make it drm_detect_scrambling_from_hfvsdb
ot something similar. We will have more hf_vsdb parsing for 3d flags, yuv420_deep_color etc.

Well, so far I'm not seeing much point in splitting it up. So I'd stuff it all into one place, for now at least.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

Re: [PATCH 4/6] drm: scrambling support in drm layer

Regards

Shashank

Quoted 45 lines · Ville Syrjälä
Quoted 44 lines · Shashank

Regards

Shashank

Quoted 38 lines · Ville Syrjälä
Quoted 30 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
   drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
   include/drm/drm_connector.h |  24 ++++++++
   include/drm/drm_edid.h      |   6 +-
   3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +1 -0
index 37902e5..f0d940a 100644
@@ -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>
 
   #define version_greater(edid, maj, min) \
   	(((edid)->version > (maj)) || \

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3819

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +2 -0
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
   	}
   }
 
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)

That names seems off. Should probably be drm_parse_hdmi_forum_vsdb() or something.

Quoted 8 lines
Quoted 6 lines

Actually, unlike the last patch set, we are not parsing the whole hf_vsdb, but parsing it only for
scrambling status byte (hf_vsdb[5]). But may be I can make it drm_detect_scrambling_from_hfvsdb
ot something similar. We will have more hf_vsdb parsing for 3d flags, yuv420_deep_color etc.

Well, so far I'm not seeing much point in splitting it up. So I'd stuff it all into one place, for now at least.

I had published a patch just doing as you suggested which was parsing complete hf-vsdb in one shot, and adding info in hdmi_info structure, to accommodate it.
(Patch https://patchwork.freedesktop.org/patch/128963/ and https://patchwork.freedesktop.org/patch/128962/)

But you gave a review comment not to add anything which is not being used in the patch series:
https://patchwork.freedesktop.org/patch/128962/

That was the only reason I have split hf-vsdb parsing patch into 3 parts
- parse SCDC and scrambling info (here)
- with YUV420 deep color ( upcoming )
- with 3d handling (upcoming)

So I am confused, split or no split :-) ?

- Shashank

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

#20 lore raw

Re: [PATCH 4/6] drm: scrambling support in drm layer

Quoted 65 lines · Shashank

Regards

Shashank

Quoted 45 lines · Ville Syrjälä
Quoted 44 lines · Shashank

Regards

Shashank

Quoted 38 lines · Ville Syrjälä
Quoted 30 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
   drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
   include/drm/drm_connector.h |  24 ++++++++
   include/drm/drm_edid.h      |   6 +-
   3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +1 -0
index 37902e5..f0d940a 100644
@@ -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>
 
   #define version_greater(edid, maj, min) \
   	(((edid)->version > (maj)) || \

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3819

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +2 -0
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
   	}
   }
 
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)

That names seems off. Should probably be drm_parse_hdmi_forum_vsdb() or something.

Quoted 8 lines
Quoted 6 lines

Actually, unlike the last patch set, we are not parsing the whole hf_vsdb, but parsing it only for
scrambling status byte (hf_vsdb[5]). But may be I can make it drm_detect_scrambling_from_hfvsdb
ot something similar. We will have more hf_vsdb parsing for 3d flags, yuv420_deep_color etc.

Well, so far I'm not seeing much point in splitting it up. So I'd stuff it all into one place, for now at least.

I had published a patch just doing as you suggested which was parsing complete hf-vsdb in one shot, and adding info in
hdmi_info structure, to accommodate it.
(Patch https://patchwork.freedesktop.org/patch/128963/ and
https://patchwork.freedesktop.org/patch/128962/)

Quoted 3 lines

But you gave a review comment not to add anything which is not being used in the patch series:
https://patchwork.freedesktop.org/patch/128962/

That's doesn't require the things that are left to be split into separate functions.

Quoted 9 lines

That was the only reason I have split hf-vsdb parsing patch into 3 parts
- parse SCDC and scrambling info (here)
- with YUV420 deep color ( upcoming )
- with 3d handling (upcoming)

So I am confused, split or no split :-) ?

- Shashank

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

Re: [PATCH 4/6] drm: scrambling support in drm layer

Regards

Shashank

Quoted 66 lines · Ville Syrjälä
Quoted 65 lines · Shashank

Regards

Shashank

Quoted 45 lines · Ville Syrjälä
Quoted 44 lines · Shashank

Regards

Shashank

Quoted 38 lines · Ville Syrjälä
Quoted 30 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
    drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
    include/drm/drm_connector.h |  24 ++++++++
    include/drm/drm_edid.h      |   6 +-
    3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +1 -0
index 37902e5..f0d940a 100644
@@ -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>
 
    #define version_greater(edid, maj, min) \
    	(((edid)->version > (maj)) || \

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3819

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +2 -0
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
    	}
    }
 
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)

That names seems off. Should probably be drm_parse_hdmi_forum_vsdb() or something.

Quoted 8 lines
Quoted 6 lines

Actually, unlike the last patch set, we are not parsing the whole hf_vsdb, but parsing it only for
scrambling status byte (hf_vsdb[5]). But may be I can make it drm_detect_scrambling_from_hfvsdb
ot something similar. We will have more hf_vsdb parsing for 3d flags, yuv420_deep_color etc.

Well, so far I'm not seeing much point in splitting it up. So I'd stuff it all into one place, for now at least.

I had published a patch just doing as you suggested which was parsing complete hf-vsdb in one shot, and adding info in
hdmi_info structure, to accommodate it.
(Patch https://patchwork.freedesktop.org/patch/128963/ and
https://patchwork.freedesktop.org/patch/128962/)

Quoted 5 lines
Quoted 3 lines

But you gave a review comment not to add anything which is not being used in the patch series:
https://patchwork.freedesktop.org/patch/128962/

That's doesn't require the things that are left to be split into separate functions.

So please let me know if my understanding is correct.
- Name the function as *_parse_hfvsdb only
- Call it while parsing the EDID extension blocks (the same place)
- Keep on adding parsing of the HF-VSDB blocks, in the same function, in an incremental way, as we add patches for them. In this way the function won't be split into multiple small functions, but all the parsing will be done in one function.

- Shashank

Quoted 8 lines
Quoted 8 lines

That was the only reason I have split hf-vsdb parsing patch into 3 parts
- parse SCDC and scrambling info (here)
- with YUV420 deep color ( upcoming )
- with 3d handling (upcoming)

So I am confused, split or no split :-) ?

- Shashank

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#22 lore raw

Re: [PATCH 4/6] drm: scrambling support in drm layer

In reply to Shashank Sharma
Quoted 40 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
 drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
 include/drm/drm_connector.h |  24 ++++++++
 include/drm/drm_edid.h      |   6 +-
 3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +8 -0
index 37902e5..f0d940a 100644
@@ -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>
 
 #define version_greater(edid, maj, min) \
 	(((edid)->version > (maj)) || \
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
 	}
 }
 
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
+{
+	struct drm_display_info *display = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &display->hdmi_info;
+
+	/*

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3834

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+	 * All HDMI 2.0 monitors must support scrambling at rates > 340M.
+	 * 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
+	 * * SCDC support available
+	 * Lets check it out.
+	 */
+
+	if (hf_vsdb[5]) {
+		display->max_tmds_clock = hf_vsdb[5] * 5000;

Comment explaining or quoting where the 5000 comes from?

Quoted 135 lines
drivers/gpu/drm/drm_edid.c +112 -1
+		DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n",
+			display->max_tmds_clock);
+
+		if (hdmi->scdc_supported) {
+			hdmi->scr_info.supported = true;
+
+			/* Few sinks support scrambling for cloks < 340M */
+			if ((hf_vsdb[6] & 0x8))
+				hdmi->scr_info.low_clocks = true;
+		}
+	}
+}
+
+/**
+ * drm_check_scrambling_status - what is status of scrambling?
+ * @adapter: i2c adapter for SCDC channel
+ *
+ * Read the scrambler status over SCDC channel, and check the
+ * scrambling status.
+ *
+ * Return: True if the scrambling is enabled, false otherwise.
+ */
+
+bool drm_check_scrambling_status(struct i2c_adapter *adapter)
+{
+	u8 status;
+
+	if (drm_scdc_readb(adapter, SCDC_SCRAMBLER_STATUS, &status) < 0) {
+		DRM_ERROR("Failed to read scrambling status\n");
+		return false;
+	}
+
+	status &= SCDC_SCRAMBLING_STATUS;
+	return status != 0;
+}
+
+/**
+ * drm_enable_scrambling - enable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: enable scrambling, even if its already enabled
+ *
+ * Write the TMDS config over SCDC channel, and enable scrambling
+ * Return: True if scrambling is successfully enabled, false otherwise.
+ */
+
+bool drm_enable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already enabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config |= SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return hdmi_info->scr_info.status;
+}
+
+/**
+ * drm_disable_scrambling - disable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: disable scrambling, even if its already disabled
+ *
+ * Write the TMDS config over SCDC channel, and disable scrambling
+ * Return: True if scrambling is successfully disabled, false otherwise.
+ */
+bool drm_disable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (!hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already disabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config &= ~SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return !hdmi_info->scr_info.status;
+}
+
 static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 					   const u8 *hdmi)
 {
@@ -3928,8 +4055,10 @@ 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))
+		if (cea_db_is_hdmi_forum_vsdb(db)) {
 			drm_detect_hdmi_scdc(connector, db);
+			drm_detect_hdmi_scrambling(connector, db);
+		}
 	}
 }
 
include/drm/drm_connector.h +3 -0
index 2435598..b9735bd 100644
@@ -90,6 +90,26 @@ enum subpixel_order {
 
 };
 
+
+/**
+ * struct scrambling: sink's scrambling support.

include/drm/drm_connector.h enum subpixel_order { · line 105

Quoted 10 lines
include/drm/drm_connector.h +10 -0
+ */
+struct scrambling {
+	/**
+	 * @supported: scrambling supported for rates > 340Mhz.
+	 */
+	bool supported;
+	/**
+	 * @low_clocks: scrambling supported for rates <= 340Mhz.
+	 */
+	bool low_clocks;

The naming for low and high clock rates looks asymmetric.

Quoted 26 lines
include/drm/drm_connector.h +11 -0
+	/**
+	 * @status: scrambling enabled/disabled ?
+	 */
+	bool status;
+};
+
+
 /**
  * struct drm_hdmi_info - runtime data about the connected sink
  *
@@ -108,6 +128,10 @@ struct drm_hdmi_info {
 	 * @scdc_rr: sink is capable of generating scdc read request.
 	 */
 	bool scdc_rr;
+	/**
+	 * scr_info: sink's scrambling support and capabilities.
+	 */
+	struct scrambling scr_info;
 };
 
 /**
include/drm/drm_edid.h +0 -0
index 43fb0ac..d24c974 100644

include/drm/drm_edid.h void drm_edid_get_monitor_name(struct edid *edid, char *name, · line 470

Quoted 10 lines
include/drm/drm_edid.h +5 -1
@@ -462,5 +462,9 @@ 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);
-
+bool drm_enable_scrambling(struct drm_connector *connector,
+				struct i2c_adapter *adapter, bool force);
+bool drm_disable_scrambling(struct drm_connector *connector,
+				struct i2c_adapter *adapter, bool force);
+bool drm_check_scrambling_status(struct i2c_adapter *adapter);
 #endif /* __DRM_EDID_H__ */

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

#23 lore raw

Re: [Intel-gfx] [PATCH 4/6] drm: scrambling support in drm layer

Thanks for the review, Dhinakaran.

Regards

Shashank

Quoted 44 lines · Dhinakaran
Quoted 43 lines · Shashank Sharma

HDMI 2.0 spec mandates scrambling for modes with pixel clock higher than 340Mhz. This patch adds few new functions in drm layer for core drivers to enable/disable scrambling.

This patch adds:
- A function to detect scrambling support parsing HF-VSDB
- A function to check scrambling status runtime using SCDC read.
- Two functions to enable/disable scrambling using SCDC read/write.
- Few new bools to reflect scrambling support and status.

---
  drivers/gpu/drm/drm_edid.c  | 131 +++++++++++++++++++++++++++++++++++++++++++-
  include/drm/drm_connector.h |  24 ++++++++
  include/drm/drm_edid.h      |   6 +-
  3 files changed, 159 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +11 -0
index 37902e5..f0d940a 100644
@@ -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>
 
  #define version_greater(edid, maj, min) \
  	(((edid)->version > (maj)) || \
@@ -3814,6 +3815,132 @@ static void drm_detect_hdmi_scdc(struct drm_connector *connector,
  	}
  }
 
+static void drm_detect_hdmi_scrambling(struct drm_connector *connector,
+				 const u8 *hf_vsdb)
+{
+	struct drm_display_info *display = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &display->hdmi_info;
+
+	/*
+	 * All HDMI 2.0 monitors must support scrambling at rates > 340M.
+	 * And as per the spec, three factors confirm this:
+	 * * Availability of a HF-VSDB block in EDID (check)
Quoted 8 lines

drivers/gpu/drm/drm_edid.c static void drm_detect_hdmi_scdc(struct drm_connector *connector, · line 3834

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+	 * * Non zero Max_TMDS_Char_Rate filed in HF-VSDB
+	 * * SCDC support available
+	 * Lets check it out.
+	 */
+
+	if (hf_vsdb[5]) {
+		display->max_tmds_clock = hf_vsdb[5] * 5000;

Comment explaining or quoting where the 5000 comes from?

Sure, can be done.

Quoted 133 lines
Quoted 133 lines
drivers/gpu/drm/drm_edid.c +112 -1
+		DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n",
+			display->max_tmds_clock);
+
+		if (hdmi->scdc_supported) {
+			hdmi->scr_info.supported = true;
+
+			/* Few sinks support scrambling for cloks < 340M */
+			if ((hf_vsdb[6] & 0x8))
+				hdmi->scr_info.low_clocks = true;
+		}
+	}
+}
+
+/**
+ * drm_check_scrambling_status - what is status of scrambling?
+ * @adapter: i2c adapter for SCDC channel
+ *
+ * Read the scrambler status over SCDC channel, and check the
+ * scrambling status.
+ *
+ * Return: True if the scrambling is enabled, false otherwise.
+ */
+
+bool drm_check_scrambling_status(struct i2c_adapter *adapter)
+{
+	u8 status;
+
+	if (drm_scdc_readb(adapter, SCDC_SCRAMBLER_STATUS, &status) < 0) {
+		DRM_ERROR("Failed to read scrambling status\n");
+		return false;
+	}
+
+	status &= SCDC_SCRAMBLING_STATUS;
+	return status != 0;
+}
+
+/**
+ * drm_enable_scrambling - enable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: enable scrambling, even if its already enabled
+ *
+ * Write the TMDS config over SCDC channel, and enable scrambling
+ * Return: True if scrambling is successfully enabled, false otherwise.
+ */
+
+bool drm_enable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already enabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config |= SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return hdmi_info->scr_info.status;
+}
+
+/**
+ * drm_disable_scrambling - disable scrambling
+ * @connector: target drm_connector
+ * @adapter: i2c adapter for SCDC channel
+ * @force: disable scrambling, even if its already disabled
+ *
+ * Write the TMDS config over SCDC channel, and disable scrambling
+ * Return: True if scrambling is successfully disabled, false otherwise.
+ */
+bool drm_disable_scrambling(struct drm_connector *connector,
+					struct i2c_adapter *adapter, bool force)
+{
+	u8 config;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+
+	if (!hdmi_info->scr_info.status && !force) {
+		DRM_DEBUG_KMS("Scrambling already disabled\n");
+		return true;
+	}
+
+	if (drm_scdc_readb(adapter, SCDC_TMDS_CONFIG, &config) < 0) {
+		DRM_ERROR("Failed to read tmds config\n");
+		return false;
+	}
+
+	config &= ~SCDC_SCRAMBLING_ENABLE;
+
+	if (drm_scdc_writeb(adapter, SCDC_TMDS_CONFIG, config) < 0) {
+		DRM_ERROR("Failed to enable scrambling, write error\n");
+		return false;
+	}
+
+	hdmi_info->scr_info.status = drm_check_scrambling_status(adapter);
+	return !hdmi_info->scr_info.status;
+}
+
  static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
  					   const u8 *hdmi)
  {
@@ -3928,8 +4055,10 @@ 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))
+		if (cea_db_is_hdmi_forum_vsdb(db)) {
  			drm_detect_hdmi_scdc(connector, db);
+			drm_detect_hdmi_scrambling(connector, db);
+		}
  	}
  }
 
include/drm/drm_connector.h +0 -0
index 2435598..b9735bd 100644
@@ -90,6 +90,26 @@ enum subpixel_order {
 
  };
 
Quoted 14 lines

include/drm/drm_connector.h enum subpixel_order { · line 105

Quoted 13 lines
include/drm/drm_connector.h +13 -0
+
+/**
+ * struct scrambling: sink's scrambling support.
+ */
+struct scrambling {
+	/**
+	 * @supported: scrambling supported for rates > 340Mhz.
+	 */
+	bool supported;
+	/**
+	 * @low_clocks: scrambling supported for rates <= 340Mhz.
+	 */
+	bool low_clocks;

The naming for low and high clock rates looks asymmetric.

I dont get it, I dont have a high clock here, can you please elaborate ?

- Shashank

Quoted 20 lines
Quoted 20 lines
include/drm/drm_connector.h +11 -0
+	/**
+	 * @status: scrambling enabled/disabled ?
+	 */
+	bool status;
+};
+
+
  /**
   * struct drm_hdmi_info - runtime data about the connected sink
   *
@@ -108,6 +128,10 @@ struct drm_hdmi_info {
  	 * @scdc_rr: sink is capable of generating scdc read request.
  	 */
  	bool scdc_rr;
+	/**
+	 * scr_info: sink's scrambling support and capabilities.
+	 */
+	struct scrambling scr_info;
  };
 
Quoted 16 lines
Quoted 6 lines
include/drm/drm_connector.h +0 -0
  /**
include/drm/drm_edid.h +0 -0
index 43fb0ac..d24c974 100644

include/drm/drm_edid.h void drm_edid_get_monitor_name(struct edid *edid, char *name, · line 470

Quoted 10 lines
include/drm/drm_edid.h +5 -1
@@ -462,5 +462,9 @@ 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);
-
+bool drm_enable_scrambling(struct drm_connector *connector,
+				struct i2c_adapter *adapter, bool force);
+bool drm_disable_scrambling(struct drm_connector *connector,
+				struct i2c_adapter *adapter, bool force);
+bool drm_check_scrambling_status(struct i2c_adapter *adapter);
  #endif /* __DRM_EDID_H__ */

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#24 lore raw

PATCH 5/6 drm/i915: enable scrambling

In reply to Shashank Sharma

Geminilake platform has 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.

---
 drivers/gpu/drm/i915/i915_reg.h   |  2 ++
 drivers/gpu/drm/i915/intel_ddi.c  |  5 +++++
 drivers/gpu/drm/i915/intel_drv.h  |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c | 42 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 51 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 495b789..cc85892 100644
@@ -7807,6 +7807,8 @@ enum {
 #define  TRANS_DDI_EDP_INPUT_C_ONOFF	(6<<12)
 #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC	(1<<8)
 #define  TRANS_DDI_BFI_ENABLE		(1<<4)
+#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE	(1<<4)
+#define  TRANS_DDI_HDMI_SCRAMBLING	(1<<0)
 
 /* DisplayPort Transport Control */
 #define _DP_TP_CTL_A			0x64040
drivers/gpu/drm/i915/intel_ddi.c +5 -0
index 9a9a670..aea81ce 100644
@@ -1278,6 +1278,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_check_scrambling(intel_encoder,
+				&intel_crtc->config->base.adjusted_mode);
+		}
 	} else if (type == INTEL_OUTPUT_ANALOG) {
 		temp |= TRANS_DDI_MODE_SELECT_FDI;
 		temp |= (intel_crtc->config->fdi_lanes - 1) << 1;
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 393f243..aafce7f 100644
@@ -1588,6 +1588,8 @@ 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_check_scrambling(struct intel_encoder *intel_encoder,
+				struct drm_display_mode *mode);
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 
 
drivers/gpu/drm/i915/intel_hdmi.c +42 -0

48 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
#25 lore raw

Re: [PATCH 5/6] drm/i915: enable scrambling

Quoted 66 lines · Shashank Sharma

Geminilake platform has 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.

---
 drivers/gpu/drm/i915/i915_reg.h   |  2 ++
 drivers/gpu/drm/i915/intel_ddi.c  |  5 +++++
 drivers/gpu/drm/i915/intel_drv.h  |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c | 42 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 51 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 495b789..cc85892 100644
@@ -7807,6 +7807,8 @@ enum {
 #define  TRANS_DDI_EDP_INPUT_C_ONOFF	(6<<12)
 #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC	(1<<8)
 #define  TRANS_DDI_BFI_ENABLE		(1<<4)
+#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE	(1<<4)
+#define  TRANS_DDI_HDMI_SCRAMBLING	(1<<0)
 
 /* DisplayPort Transport Control */
 #define _DP_TP_CTL_A			0x64040
drivers/gpu/drm/i915/intel_ddi.c +5 -0
index 9a9a670..aea81ce 100644
@@ -1278,6 +1278,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_check_scrambling(intel_encoder,
+				&intel_crtc->config->base.adjusted_mode);
+		}
 	} else if (type == INTEL_OUTPUT_ANALOG) {
 		temp |= TRANS_DDI_MODE_SELECT_FDI;
 		temp |= (intel_crtc->config->fdi_lanes - 1) << 1;
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 393f243..aafce7f 100644
@@ -1588,6 +1588,8 @@ 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_check_scrambling(struct intel_encoder *intel_encoder,
+				struct drm_display_mode *mode);
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 
 
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
index ebae2bd..92dd9bc 100644
@@ -1795,6 +1795,48 @@ static void intel_hdmi_destroy(struct drm_connector *connector)
 	intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
+static void

drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1808

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +10 -0
+intel_hdmi_enable_scrambling(struct drm_connector *connector)
+{
+	struct drm_i915_private *dev_priv = connector->dev->dev_private;
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct i2c_adapter *adapter =
+			intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
+
+	if (!drm_enable_scrambling(connector, adapter, true))
+		DRM_ERROR("Request to enable scrambling failed\n");
+}

I don't like hiding this somewhere deep like this. It should be somewhere much higher up.

And I'm thinkign we might want to track the scrambler state in the crtc state.

Quoted 36 lines
drivers/gpu/drm/i915/intel_hdmi.c +31 -0
+
+uint32_t intel_hdmi_check_scrambling(struct intel_encoder *intel_encoder,
+				struct drm_display_mode *mode)
+{
+	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&intel_encoder->base);
+	struct drm_connector *connector = &intel_hdmi->attached_connector->base;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+	uint32_t hdmi_config = 0;
+
+	DRM_DEBUG_KMS("Checking scrambling for enc:%s connector:%s\n",
+			intel_encoder->base.name, connector->name);
+
+	if (mode->clock < 340000) {
+		if (hdmi_info->scr_info.low_clocks) {
+			intel_hdmi_enable_scrambling(connector);
+			hdmi_config |= TRANS_DDI_HDMI_SCRAMBLING;
+		}
+		return hdmi_config;
+	}
+
+	/* Enable scrambling for clocks > 340M */
+	if (hdmi_info->scr_info.supported) {
+		intel_hdmi_enable_scrambling(connector);
+		hdmi_config |= TRANS_DDI_HDMI_SCRAMBLING;
+	}
+
+	/* Scrambling or not, if clock > 340M, set high char rate */
+	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)
 {
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#26 lore raw

Re: [PATCH 5/6] drm/i915: enable scrambling

Regards

Shashank

Quoted 66 lines · Ville Syrjälä
Quoted 65 lines · Shashank Sharma

Geminilake platform has 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.

---
  drivers/gpu/drm/i915/i915_reg.h   |  2 ++
  drivers/gpu/drm/i915/intel_ddi.c  |  5 +++++
  drivers/gpu/drm/i915/intel_drv.h  |  2 ++
  drivers/gpu/drm/i915/intel_hdmi.c | 42 +++++++++++++++++++++++++++++++++++++++
  4 files changed, 51 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 495b789..cc85892 100644
@@ -7807,6 +7807,8 @@ enum {
  #define  TRANS_DDI_EDP_INPUT_C_ONOFF	(6<<12)
  #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC	(1<<8)
  #define  TRANS_DDI_BFI_ENABLE		(1<<4)
+#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE	(1<<4)
+#define  TRANS_DDI_HDMI_SCRAMBLING	(1<<0)
 
  /* DisplayPort Transport Control */
  #define _DP_TP_CTL_A			0x64040
drivers/gpu/drm/i915/intel_ddi.c +5 -0
index 9a9a670..aea81ce 100644
@@ -1278,6 +1278,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_check_scrambling(intel_encoder,
+				&intel_crtc->config->base.adjusted_mode);
+		}
  	} else if (type == INTEL_OUTPUT_ANALOG) {
  		temp |= TRANS_DDI_MODE_SELECT_FDI;
  		temp |= (intel_crtc->config->fdi_lanes - 1) << 1;
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 393f243..aafce7f 100644
@@ -1588,6 +1588,8 @@ 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_check_scrambling(struct intel_encoder *intel_encoder,
+				struct drm_display_mode *mode);
  void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 
 
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index ebae2bd..92dd9bc 100644
@@ -1795,6 +1795,48 @@ static void intel_hdmi_destroy(struct drm_connector *connector)
  	intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
  }
 
Quoted 13 lines

drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1808

Quoted 11 lines
drivers/gpu/drm/i915/intel_hdmi.c +11 -0
+static void
+intel_hdmi_enable_scrambling(struct drm_connector *connector)
+{
+	struct drm_i915_private *dev_priv = connector->dev->dev_private;
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct i2c_adapter *adapter =
+			intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
+
+	if (!drm_enable_scrambling(connector, adapter, true))
+		DRM_ERROR("Request to enable scrambling failed\n");
+}

I don't like hiding this somewhere deep like this. It should be somewhere much higher up.

Why ? All we need to do here is enable two bits in transcoder control register, which is already being programmed in a calling function, so I dont see the use case, but I might be missing some bigger picture. Can you please elaborate on this ?

Quoted 3 lines

And I'm thinkign we might want to track the scrambler state in the crtc state.

Yes, that's a pretty good way to track dynamic status of scrambler, do you think we should add this in drm_crtc_state itself ?

- Shashank

Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/i915/intel_hdmi.c +28 -0
+
+uint32_t intel_hdmi_check_scrambling(struct intel_encoder *intel_encoder,
+				struct drm_display_mode *mode)
+{
+	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&intel_encoder->base);
+	struct drm_connector *connector = &intel_hdmi->attached_connector->base;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+	uint32_t hdmi_config = 0;
+
+	DRM_DEBUG_KMS("Checking scrambling for enc:%s connector:%s\n",
+			intel_encoder->base.name, connector->name);
+
+	if (mode->clock < 340000) {
+		if (hdmi_info->scr_info.low_clocks) {
+			intel_hdmi_enable_scrambling(connector);
+			hdmi_config |= TRANS_DDI_HDMI_SCRAMBLING;
+		}
+		return hdmi_config;
+	}
+
+	/* Enable scrambling for clocks > 340M */
+	if (hdmi_info->scr_info.supported) {
+		intel_hdmi_enable_scrambling(connector);
+		hdmi_config |= TRANS_DDI_HDMI_SCRAMBLING;
+	}
+
+	/* Scrambling or not, if clock > 340M, set high char rate */
+	hdmi_config |= TRANS_DDI_HIGH_TMDS_CHAR_RATE;
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_hdmi.c +3 -0
+	return hdmi_config;
+}
+
  static u8 intel_hdmi_ddc_pin(struct drm_i915_private *dev_priv,
  			     enum port port)
  {
Signature · 1 line
1.9.1

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

#27 lore raw

Re: [PATCH 5/6] drm/i915: enable scrambling

Quoted 85 lines · Shashank

Regards

Shashank

Quoted 66 lines · Ville Syrjälä
Quoted 65 lines · Shashank Sharma

Geminilake platform has 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.

---
  drivers/gpu/drm/i915/i915_reg.h   |  2 ++
  drivers/gpu/drm/i915/intel_ddi.c  |  5 +++++
  drivers/gpu/drm/i915/intel_drv.h  |  2 ++
  drivers/gpu/drm/i915/intel_hdmi.c | 42 +++++++++++++++++++++++++++++++++++++++
  4 files changed, 51 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 495b789..cc85892 100644
@@ -7807,6 +7807,8 @@ enum {
  #define  TRANS_DDI_EDP_INPUT_C_ONOFF	(6<<12)
  #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC	(1<<8)
  #define  TRANS_DDI_BFI_ENABLE		(1<<4)
+#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE	(1<<4)
+#define  TRANS_DDI_HDMI_SCRAMBLING	(1<<0)
 
  /* DisplayPort Transport Control */
  #define _DP_TP_CTL_A			0x64040
drivers/gpu/drm/i915/intel_ddi.c +5 -0
index 9a9a670..aea81ce 100644
@@ -1278,6 +1278,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_check_scrambling(intel_encoder,
+				&intel_crtc->config->base.adjusted_mode);
+		}
  	} else if (type == INTEL_OUTPUT_ANALOG) {
  		temp |= TRANS_DDI_MODE_SELECT_FDI;
  		temp |= (intel_crtc->config->fdi_lanes - 1) << 1;
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 393f243..aafce7f 100644
@@ -1588,6 +1588,8 @@ 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_check_scrambling(struct intel_encoder *intel_encoder,
+				struct drm_display_mode *mode);
  void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 
 
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index ebae2bd..92dd9bc 100644
@@ -1795,6 +1795,48 @@ static void intel_hdmi_destroy(struct drm_connector *connector)
  	intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
  }
 
Quoted 13 lines

drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1808

Quoted 11 lines
drivers/gpu/drm/i915/intel_hdmi.c +11 -0
+static void
+intel_hdmi_enable_scrambling(struct drm_connector *connector)
+{
+	struct drm_i915_private *dev_priv = connector->dev->dev_private;
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct i2c_adapter *adapter =
+			intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
+
+	if (!drm_enable_scrambling(connector, adapter, true))
+		DRM_ERROR("Request to enable scrambling failed\n");
+}

I don't like hiding this somewhere deep like this. It should be somewhere much higher up.

Quoted 5 lines

Why ? All we need to do here is enable two bits in transcoder control register, which is already being
programmed in a calling function, so I dont see the use case, but I might be missing some bigger picture.
Can you please elaborate on this ?

We're talking to the display here, which is rather surprising to happen from a function thing that on the first glance doesn't even seem to touch the hardware.

Quoted 6 lines
Quoted 3 lines

And I'm thinkign we might want to track the scrambler state in the crtc state.

Yes, that's a pretty good way to track dynamic status of scrambler, do you think we should add this in
drm_crtc_state itself ?

I'd just start with intel specific state and later we can see what everyone else wants to do and potentially unify a bit.

Quoted 38 lines

- Shashank

Quoted 36 lines
Quoted 36 lines
drivers/gpu/drm/i915/intel_hdmi.c +31 -0
+
+uint32_t intel_hdmi_check_scrambling(struct intel_encoder *intel_encoder,
+				struct drm_display_mode *mode)
+{
+	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&intel_encoder->base);
+	struct drm_connector *connector = &intel_hdmi->attached_connector->base;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+	uint32_t hdmi_config = 0;
+
+	DRM_DEBUG_KMS("Checking scrambling for enc:%s connector:%s\n",
+			intel_encoder->base.name, connector->name);
+
+	if (mode->clock < 340000) {
+		if (hdmi_info->scr_info.low_clocks) {
+			intel_hdmi_enable_scrambling(connector);
+			hdmi_config |= TRANS_DDI_HDMI_SCRAMBLING;
+		}
+		return hdmi_config;
+	}
+
+	/* Enable scrambling for clocks > 340M */
+	if (hdmi_info->scr_info.supported) {
+		intel_hdmi_enable_scrambling(connector);
+		hdmi_config |= TRANS_DDI_HDMI_SCRAMBLING;
+	}
+
+	/* Scrambling or not, if clock > 340M, set high char rate */
+	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)
  {
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#28 lore raw

Re: [PATCH 5/6] drm/i915: enable scrambling

Regards

Shashank

Quoted 86 lines · Ville Syrjälä
Quoted 85 lines · Shashank

Regards

Shashank

Quoted 79 lines · Ville Syrjälä
Quoted 66 lines · Shashank Sharma

Geminilake platform has 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.

---
   drivers/gpu/drm/i915/i915_reg.h   |  2 ++
   drivers/gpu/drm/i915/intel_ddi.c  |  5 +++++
   drivers/gpu/drm/i915/intel_drv.h  |  2 ++
   drivers/gpu/drm/i915/intel_hdmi.c | 42 +++++++++++++++++++++++++++++++++++++++
   4 files changed, 51 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 495b789..cc85892 100644
@@ -7807,6 +7807,8 @@ enum {
   #define  TRANS_DDI_EDP_INPUT_C_ONOFF	(6<<12)
   #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC	(1<<8)
   #define  TRANS_DDI_BFI_ENABLE		(1<<4)
+#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE	(1<<4)
+#define  TRANS_DDI_HDMI_SCRAMBLING	(1<<0)
 
   /* DisplayPort Transport Control */
   #define _DP_TP_CTL_A			0x64040
drivers/gpu/drm/i915/intel_ddi.c +5 -0
index 9a9a670..aea81ce 100644
@@ -1278,6 +1278,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_check_scrambling(intel_encoder,
+				&intel_crtc->config->base.adjusted_mode);
+		}
   	} else if (type == INTEL_OUTPUT_ANALOG) {
   		temp |= TRANS_DDI_MODE_SELECT_FDI;
   		temp |= (intel_crtc->config->fdi_lanes - 1) << 1;
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 393f243..aafce7f 100644
@@ -1588,6 +1588,8 @@ 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_check_scrambling(struct intel_encoder *intel_encoder,
+				struct drm_display_mode *mode);
   void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 
 
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
index ebae2bd..92dd9bc 100644
@@ -1795,6 +1795,48 @@ static void intel_hdmi_destroy(struct drm_connector *connector)
   	intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
   }
 
+static void

drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1808

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +10 -0
+intel_hdmi_enable_scrambling(struct drm_connector *connector)
+{
+	struct drm_i915_private *dev_priv = connector->dev->dev_private;
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct i2c_adapter *adapter =
+			intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
+
+	if (!drm_enable_scrambling(connector, adapter, true))
+		DRM_ERROR("Request to enable scrambling failed\n");
+}

I don't like hiding this somewhere deep like this. It should be somewhere much higher up.

Quoted 8 lines
Quoted 5 lines

Why ? All we need to do here is enable two bits in transcoder control register, which is already being
programmed in a calling function, so I dont see the use case, but I might be missing some bigger picture.
Can you please elaborate on this ?

We're talking to the display here, which is rather surprising to happen from a function thing that on the first glance doesn't even seem to touch the hardware.

I kind of agree with this, and I am also tempted now to shift this call upwards, but I want to keep this close to port enabling as well, as the HDMI 2.0 spec says:
"Max time period between a source enables scrambling on monitor, and starts sending scrambled
video should be 100ms" else the sink might choose to disable scrambling.

Considering this, where do you think would be right place to enabled scrambling on monitor ?

- Shashank

Quoted 37 lines
Quoted 5 lines
Quoted 2 lines

And I'm thinkign we might want to track the scrambler state in the crtc state.

Yes, that's a pretty good way to track dynamic status of scrambler, do you think we should add this in
drm_crtc_state itself ?

I'd just start with intel specific state and later we can see what everyone else wants to do and potentially unify a bit.

Quoted 29 lines

- Shashank

Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/i915/intel_hdmi.c +28 -0
+
+uint32_t intel_hdmi_check_scrambling(struct intel_encoder *intel_encoder,
+				struct drm_display_mode *mode)
+{
+	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&intel_encoder->base);
+	struct drm_connector *connector = &intel_hdmi->attached_connector->base;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+	uint32_t hdmi_config = 0;
+
+	DRM_DEBUG_KMS("Checking scrambling for enc:%s connector:%s\n",
+			intel_encoder->base.name, connector->name);
+
+	if (mode->clock < 340000) {
+		if (hdmi_info->scr_info.low_clocks) {
+			intel_hdmi_enable_scrambling(connector);
+			hdmi_config |= TRANS_DDI_HDMI_SCRAMBLING;
+		}
+		return hdmi_config;
+	}
+
+	/* Enable scrambling for clocks > 340M */
+	if (hdmi_info->scr_info.supported) {
+		intel_hdmi_enable_scrambling(connector);
+		hdmi_config |= TRANS_DDI_HDMI_SCRAMBLING;
+	}
+
+	/* Scrambling or not, if clock > 340M, set high char rate */
+	hdmi_config |= TRANS_DDI_HIGH_TMDS_CHAR_RATE;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_hdmi.c +3 -0
+	return hdmi_config;
+}
+
   static u8 intel_hdmi_ddc_pin(struct drm_i915_private *dev_priv,
   			     enum port port)
   {
Signature · 1 line
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#29 lore raw

Re: [PATCH 5/6] drm/i915: enable scrambling

Quoted 107 lines · Shashank

Regards

Shashank

Quoted 86 lines · Ville Syrjälä
Quoted 85 lines · Shashank

Regards

Shashank

Quoted 79 lines · Ville Syrjälä
Quoted 66 lines · Shashank Sharma

Geminilake platform has 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.

---
   drivers/gpu/drm/i915/i915_reg.h   |  2 ++
   drivers/gpu/drm/i915/intel_ddi.c  |  5 +++++
   drivers/gpu/drm/i915/intel_drv.h  |  2 ++
   drivers/gpu/drm/i915/intel_hdmi.c | 42 +++++++++++++++++++++++++++++++++++++++
   4 files changed, 51 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 495b789..cc85892 100644
@@ -7807,6 +7807,8 @@ enum {
   #define  TRANS_DDI_EDP_INPUT_C_ONOFF	(6<<12)
   #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC	(1<<8)
   #define  TRANS_DDI_BFI_ENABLE		(1<<4)
+#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE	(1<<4)
+#define  TRANS_DDI_HDMI_SCRAMBLING	(1<<0)
 
   /* DisplayPort Transport Control */
   #define _DP_TP_CTL_A			0x64040
drivers/gpu/drm/i915/intel_ddi.c +5 -0
index 9a9a670..aea81ce 100644
@@ -1278,6 +1278,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_check_scrambling(intel_encoder,
+				&intel_crtc->config->base.adjusted_mode);
+		}
   	} else if (type == INTEL_OUTPUT_ANALOG) {
   		temp |= TRANS_DDI_MODE_SELECT_FDI;
   		temp |= (intel_crtc->config->fdi_lanes - 1) << 1;
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 393f243..aafce7f 100644
@@ -1588,6 +1588,8 @@ 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_check_scrambling(struct intel_encoder *intel_encoder,
+				struct drm_display_mode *mode);
   void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 
 
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
index ebae2bd..92dd9bc 100644
@@ -1795,6 +1795,48 @@ static void intel_hdmi_destroy(struct drm_connector *connector)
   	intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
   }
 
+static void

drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_destroy(struct drm_connector *connector) · line 1808

Quoted 10 lines
drivers/gpu/drm/i915/intel_hdmi.c +10 -0
+intel_hdmi_enable_scrambling(struct drm_connector *connector)
+{
+	struct drm_i915_private *dev_priv = connector->dev->dev_private;
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct i2c_adapter *adapter =
+			intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
+
+	if (!drm_enable_scrambling(connector, adapter, true))
+		DRM_ERROR("Request to enable scrambling failed\n");
+}

I don't like hiding this somewhere deep like this. It should be somewhere much higher up.

Quoted 8 lines
Quoted 5 lines

Why ? All we need to do here is enable two bits in transcoder control register, which is already being
programmed in a calling function, so I dont see the use case, but I might be missing some bigger picture.
Can you please elaborate on this ?

We're talking to the display here, which is rather surprising to happen from a function thing that on the first glance doesn't even seem to touch the hardware.

I kind of agree with this, and I am also tempted now to shift this call upwards, but I want to
keep this close to port enabling as well, as the HDMI 2.0 spec says:
"Max time period between a source enables scrambling on monitor, and starts sending scrambled
video should be 100ms" else the sink might choose to disable scrambling.

Quoted 2 lines

Considering this, where do you think would be right place to enabled scrambling on monitor ?

intel_enable_ddi() is where we presumbly enable the port, so maybe there.

Quoted 47 lines

- Shashank

Quoted 45 lines
Quoted 5 lines
Quoted 2 lines

And I'm thinkign we might want to track the scrambler state in the crtc state.

Yes, that's a pretty good way to track dynamic status of scrambler, do you think we should add this in
drm_crtc_state itself ?

I'd just start with intel specific state and later we can see what everyone else wants to do and potentially unify a bit.

Quoted 37 lines

- Shashank

Quoted 36 lines
Quoted 36 lines
drivers/gpu/drm/i915/intel_hdmi.c +31 -0
+
+uint32_t intel_hdmi_check_scrambling(struct intel_encoder *intel_encoder,
+				struct drm_display_mode *mode)
+{
+	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&intel_encoder->base);
+	struct drm_connector *connector = &intel_hdmi->attached_connector->base;
+	struct drm_hdmi_info *hdmi_info = &connector->display_info.hdmi_info;
+	uint32_t hdmi_config = 0;
+
+	DRM_DEBUG_KMS("Checking scrambling for enc:%s connector:%s\n",
+			intel_encoder->base.name, connector->name);
+
+	if (mode->clock < 340000) {
+		if (hdmi_info->scr_info.low_clocks) {
+			intel_hdmi_enable_scrambling(connector);
+			hdmi_config |= TRANS_DDI_HDMI_SCRAMBLING;
+		}
+		return hdmi_config;
+	}
+
+	/* Enable scrambling for clocks > 340M */
+	if (hdmi_info->scr_info.supported) {
+		intel_hdmi_enable_scrambling(connector);
+		hdmi_config |= TRANS_DDI_HDMI_SCRAMBLING;
+	}
+
+	/* Scrambling or not, if clock > 340M, set high char rate */
+	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)
   {
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#30 lore raw

PATCH 6/6 drm/i915: allow HDMI 2.0 clock rates

In reply to Shashank Sharma

Geminilake 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.

---
 drivers/gpu/drm/i915/intel_hdmi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
index 92dd9bc..2f9e840 100644
@@ -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

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

✗ Fi.CI.BAT: failure for HDMI 2.0: Scrambling support in DRM layer

In reply to Shashank Sharma
== Series Details ==

== Series Details ==

Series: HDMI 2.0: Scrambling support in DRM layer
URL : https://patchwork.freedesktop.org/series/18915/
State : failure

== Summary ==

  CHECK   usr/include/linux/byteorder/ (2 files)
  CHECK   usr/include/linux/android/ (1 files)
  CHECK   usr/include/linux/caif/ (2 files)
  CHECK   usr/include/linux/iio/ (2 files)
  CHECK   usr/include/linux/netfilter_ipv4/ (9 files)
  CHECK   usr/include/linux/netfilter_bridge/ (17 files)
  CHECK   usr/include/linux/can/ (5 files)
  CHECK   usr/include/linux/raid/ (2 files)
  CHECK   usr/include/linux/nfsd/ (5 files)
  CHECK   usr/include/linux/hdlc/ (1 files)
  CHECK   usr/include/linux/isdn/ (1 files)
  CHECK   usr/include/linux/netfilter/ (87 files)
  CHECK   usr/include/linux/tc_act/ (14 files)
  CHECK   usr/include/linux/netfilter_arp/ (2 files)
  CHECK   usr/include/linux/hsi/ (2 files)
  CHECK   usr/include/linux/tc_ematch/ (4 files)
  CHECK   usr/include/linux/mmc/ (1 files)
  CHECK   usr/include/linux/dvb/ (8 files)
  CHECK   usr/include/linux/sunrpc/ (1 files)
  CHECK   usr/include/linux/wimax/ (1 files)
  CHECK   usr/include/linux/spi/ (1 files)
  CHECK   usr/include/linux/netfilter/ipset/ (4 files)
  CHECK   usr/include/linux/usb/ (11 files)
  CHECK   usr/include/linux/ (443 files)
  CHECK   usr/include/linux/netfilter_ipv6/ (12 files)
  CHECK   usr/include/asm/ (62 files)
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      vmlinux.o
  MODPOST vmlinux.o
  KSYM    .tmp_kallsyms1.o
  KSYM    .tmp_kallsyms2.o
  LD      vmlinux
  SORTEX  vmlinux
  SYSMAP  System.map
  CC      arch/x86/boot/a20.o
  AS      arch/x86/boot/bioscall.o
  CC      arch/x86/boot/cmdline.o
  HOSTCC  arch/x86/boot/mkcpustr
  CC      arch/x86/boot/early_serial_console.o
  CC      arch/x86/boot/cpuflags.o
  CC      arch/x86/boot/cpucheck.o
  AS      arch/x86/boot/copy.o
  CC      arch/x86/boot/edd.o
  CC      arch/x86/boot/main.o
  AS      arch/x86/boot/pmjump.o
  CC      arch/x86/boot/printf.o
  CC      arch/x86/boot/memory.o
  CC      arch/x86/boot/regs.o
  CC      arch/x86/boot/string.o
  CC      arch/x86/boot/pm.o
  CC      arch/x86/boot/video.o
  CC      arch/x86/boot/version.o
  CC      arch/x86/boot/video-vesa.o
  CC      arch/x86/boot/video-vga.o
  CC      arch/x86/boot/video-mode.o
  CC      arch/x86/boot/video-bios.o
  CC      arch/x86/boot/tty.o
  HOSTCC  arch/x86/boot/tools/build
  Building modules, stage 2.
  LDS     arch/x86/boot/compressed/vmlinux.lds
  AS      arch/x86/boot/compressed/head_64.o
  VOFFSET arch/x86/boot/compressed/../voffset.h
  CPUSTR  arch/x86/boot/cpustr.h
  CC      arch/x86/boot/compressed/string.o
  MODPOST 97 modules
  CC      arch/x86/boot/compressed/cmdline.o
  CC      arch/x86/boot/compressed/error.o
  OBJCOPY arch/x86/boot/compressed/vmlinux.bin
  HOSTCC  arch/x86/boot/compressed/mkpiggy
  CC      arch/x86/boot/compressed/early_serial_console.o
  CC      arch/x86/boot/compressed/eboot.o
  AS      arch/x86/boot/compressed/efi_stub_64.o
  CC      arch/x86/boot/cpu.o
  CC      arch/x86/boot/compressed/cpuflags.o
  XZKERN  arch/x86/boot/compressed/vmlinux.bin.xz

ERROR: "drm_enable_scrambling" [drivers/gpu/drm/i915/i915.ko] undefined! scripts/Makefile.modpost:91: recipe for target '__modpost' failed make[1]: *** [__modpost] Error 1
Makefile:1196: recipe for target 'modules' failed
make: *** [modules] Error 2
make: *** Waiting for unfinished jobs....
CC arch/x86/boot/compressed/misc.o
MKPIGGY arch/x86/boot/compressed/piggy.S
AS arch/x86/boot/compressed/piggy.o
DATAREL arch/x86/boot/compressed/vmlinux
LD arch/x86/boot/compressed/vmlinux
ZOFFSET arch/x86/boot/zoffset.h
OBJCOPY arch/x86/boot/vmlinux.bin
AS arch/x86/boot/header.o
LD arch/x86/boot/setup.elf
OBJCOPY arch/x86/boot/setup.bin
BUILD arch/x86/boot/bzImage
Setup is 16412 bytes (padded to 16896 bytes).
System is 4853 kB
CRC e574db06
Kernel: arch/x86/boot/bzImage is ready (#1)

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

#32 lore raw

Re: ✗ Fi.CI.BAT: failure for HDMI 2.0: Scrambling support in DRM layer

I build bzImage, keeping I915 as part of kernel (not as a module) Looks like I need to add EXPORT_SYMBOL(drm_enable_scrambling) Will cover this in V2.

Regards
Shashank
-----Original Message-----
From: Patchwork [mailto:[email protected]]
Sent: Wednesday, February 1, 2017 6:33 PM
To: Sharma, Shashank <[email protected]>
Cc: [email protected]
Subject: ✗ Fi.CI.BAT: failure for HDMI 2.0: Scrambling support in DRM layer

== Series Details ==

Series: HDMI 2.0: Scrambling support in DRM layer
URL : https://patchwork.freedesktop.org/series/18915/
State : failure

== Summary ==

  CHECK   usr/include/linux/byteorder/ (2 files)
  CHECK   usr/include/linux/android/ (1 files)
  CHECK   usr/include/linux/caif/ (2 files)
  CHECK   usr/include/linux/iio/ (2 files)
  CHECK   usr/include/linux/netfilter_ipv4/ (9 files)
  CHECK   usr/include/linux/netfilter_bridge/ (17 files)
  CHECK   usr/include/linux/can/ (5 files)
  CHECK   usr/include/linux/raid/ (2 files)
  CHECK   usr/include/linux/nfsd/ (5 files)
  CHECK   usr/include/linux/hdlc/ (1 files)
  CHECK   usr/include/linux/isdn/ (1 files)
  CHECK   usr/include/linux/netfilter/ (87 files)
  CHECK   usr/include/linux/tc_act/ (14 files)
  CHECK   usr/include/linux/netfilter_arp/ (2 files)
  CHECK   usr/include/linux/hsi/ (2 files)
  CHECK   usr/include/linux/tc_ematch/ (4 files)
  CHECK   usr/include/linux/mmc/ (1 files)
  CHECK   usr/include/linux/dvb/ (8 files)
  CHECK   usr/include/linux/sunrpc/ (1 files)
  CHECK   usr/include/linux/wimax/ (1 files)
  CHECK   usr/include/linux/spi/ (1 files)
  CHECK   usr/include/linux/netfilter/ipset/ (4 files)
  CHECK   usr/include/linux/usb/ (11 files)
  CHECK   usr/include/linux/ (443 files)
  CHECK   usr/include/linux/netfilter_ipv6/ (12 files)
  CHECK   usr/include/asm/ (62 files)
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      vmlinux.o
  MODPOST vmlinux.o
  KSYM    .tmp_kallsyms1.o
  KSYM    .tmp_kallsyms2.o
  LD      vmlinux
  SORTEX  vmlinux
  SYSMAP  System.map
  CC      arch/x86/boot/a20.o
  AS      arch/x86/boot/bioscall.o
  CC      arch/x86/boot/cmdline.o
  HOSTCC  arch/x86/boot/mkcpustr
  CC      arch/x86/boot/early_serial_console.o
  CC      arch/x86/boot/cpuflags.o
  CC      arch/x86/boot/cpucheck.o
  AS      arch/x86/boot/copy.o
  CC      arch/x86/boot/edd.o
  CC      arch/x86/boot/main.o
  AS      arch/x86/boot/pmjump.o
  CC      arch/x86/boot/printf.o
  CC      arch/x86/boot/memory.o
  CC      arch/x86/boot/regs.o
  CC      arch/x86/boot/string.o
  CC      arch/x86/boot/pm.o
  CC      arch/x86/boot/video.o
  CC      arch/x86/boot/version.o
  CC      arch/x86/boot/video-vesa.o
  CC      arch/x86/boot/video-vga.o
  CC      arch/x86/boot/video-mode.o
  CC      arch/x86/boot/video-bios.o
  CC      arch/x86/boot/tty.o
  HOSTCC  arch/x86/boot/tools/build
  Building modules, stage 2.
  LDS     arch/x86/boot/compressed/vmlinux.lds
  AS      arch/x86/boot/compressed/head_64.o
  VOFFSET arch/x86/boot/compressed/../voffset.h
  CPUSTR  arch/x86/boot/cpustr.h
  CC      arch/x86/boot/compressed/string.o
  MODPOST 97 modules
  CC      arch/x86/boot/compressed/cmdline.o
  CC      arch/x86/boot/compressed/error.o
  OBJCOPY arch/x86/boot/compressed/vmlinux.bin
  HOSTCC  arch/x86/boot/compressed/mkpiggy
  CC      arch/x86/boot/compressed/early_serial_console.o
  CC      arch/x86/boot/compressed/eboot.o
  AS      arch/x86/boot/compressed/efi_stub_64.o
  CC      arch/x86/boot/cpu.o
  CC      arch/x86/boot/compressed/cpuflags.o
  XZKERN  arch/x86/boot/compressed/vmlinux.bin.xz

ERROR: "drm_enable_scrambling" [drivers/gpu/drm/i915/i915.ko] undefined! scripts/Makefile.modpost:91: recipe for target '__modpost' failed make[1]: *** [__modpost] Error 1
Makefile:1196: recipe for target 'modules' failed
make: *** [modules] Error 2
make: *** Waiting for unfinished jobs....
CC arch/x86/boot/compressed/misc.o
MKPIGGY arch/x86/boot/compressed/piggy.S
AS arch/x86/boot/compressed/piggy.o
DATAREL arch/x86/boot/compressed/vmlinux
LD arch/x86/boot/compressed/vmlinux
ZOFFSET arch/x86/boot/zoffset.h
OBJCOPY arch/x86/boot/vmlinux.bin
AS arch/x86/boot/header.o
LD arch/x86/boot/setup.elf
OBJCOPY arch/x86/boot/setup.bin
BUILD arch/x86/boot/bzImage
Setup is 16412 bytes (padded to 16896 bytes).
System is 4853 kB
CRC e574db06
Kernel: arch/x86/boot/bzImage is ready (#1)

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