[PATCH 03/10] drm: crc: Introduce get_crc_sources callback

Mahesh Kumar mahesh1.kumar at intel.com
Tue Jun 26 06:22:52 UTC 2018


This patch implements a callback function "get_crc_sources" which
will be called during read of control node. It is an optional
callback function and if driver implements this callback, driver
should print list of available CRC sources in seq_file privided
as an input to the callback.

Signed-off-by: Mahesh Kumar <mahesh1.kumar at intel.com>
Cc: dri-devel at lists.freedesktop.org
---
 drivers/gpu/drm/drm_debugfs_crc.c |  3 +++
 include/drm/drm_crtc.h            | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
index 2b4a737c5aeb..2751d124387d 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -68,6 +68,9 @@ static int crc_control_show(struct seq_file *m, void *data)
 {
 	struct drm_crtc *crtc = m->private;
 
+	if (crtc->funcs->get_crc_sources)
+		crtc->funcs->get_crc_sources(m, crtc);
+
 	seq_printf(m, "%s\n", crtc->crc.source);
 
 	return 0;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index bae432469616..b3824f92c190 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -690,6 +690,16 @@ struct drm_crtc_funcs {
 	 * 0 on success or a negative error code on failure.
 	 */
 	int (*pre_crc_read)(struct drm_crtc *crtc);
+	/**
+	 * @get_crc_sources:
+	 *
+	 * prints a list of available valid sources for CRC generation on
+	 * seq_file
+	 *
+	 * This callback is optional if the driver does not support exporting of
+	 * possible CRC sources list
+	 */
+	void (*get_crc_sources)(struct seq_file *m, struct drm_crtc *crtc);
 
 	/**
 	 * @atomic_print_state:
-- 
2.16.2



More information about the dri-devel mailing list