drm/hdcp: gathering hdcp related code into drm_hdcp.c
[sfrench/cifs-2.6.git] / include / drm / drm_connector.h
index 8fe22abb1e10604151e268914ce373d84550db78..da9e1f087fe4e81dc1f36ebe5fdb8e27e04b91fd 100644 (file)
@@ -253,6 +253,96 @@ enum drm_panel_orientation {
        DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
 };
 
+/*
+ * This is a consolidated colorimetry list supported by HDMI and
+ * DP protocol standard. The respective connectors will register
+ * a property with the subset of this list (supported by that
+ * respective protocol). Userspace will set the colorspace through
+ * a colorspace property which will be created and exposed to
+ * userspace.
+ */
+
+/* For Default case, driver will set the colorspace */
+#define DRM_MODE_COLORIMETRY_DEFAULT                   0
+/* CEA 861 Normal Colorimetry options */
+#define DRM_MODE_COLORIMETRY_NO_DATA                   0
+#define DRM_MODE_COLORIMETRY_SMPTE_170M_YCC            1
+#define DRM_MODE_COLORIMETRY_BT709_YCC                 2
+/* CEA 861 Extended Colorimetry Options */
+#define DRM_MODE_COLORIMETRY_XVYCC_601                 3
+#define DRM_MODE_COLORIMETRY_XVYCC_709                 4
+#define DRM_MODE_COLORIMETRY_SYCC_601                  5
+#define DRM_MODE_COLORIMETRY_OPYCC_601                 6
+#define DRM_MODE_COLORIMETRY_OPRGB                     7
+#define DRM_MODE_COLORIMETRY_BT2020_CYCC               8
+#define DRM_MODE_COLORIMETRY_BT2020_RGB                        9
+#define DRM_MODE_COLORIMETRY_BT2020_YCC                        10
+/* Additional Colorimetry extension added as part of CTA 861.G */
+#define DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65            11
+#define DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER                12
+
+/**
+ * enum drm_bus_flags - bus_flags info for &drm_display_info
+ *
+ * This enum defines signal polarities and clock edge information for signals on
+ * a bus as bitmask flags.
+ *
+ * The clock edge information is conveyed by two sets of symbols,
+ * DRM_BUS_FLAGS_*_DRIVE_\* and DRM_BUS_FLAGS_*_SAMPLE_\*. When this enum is
+ * used to describe a bus from the point of view of the transmitter, the
+ * \*_DRIVE_\* flags should be used. When used from the point of view of the
+ * receiver, the \*_SAMPLE_\* flags should be used. The \*_DRIVE_\* and
+ * \*_SAMPLE_\* flags alias each other, with the \*_SAMPLE_POSEDGE and
+ * \*_SAMPLE_NEGEDGE flags being equal to \*_DRIVE_NEGEDGE and \*_DRIVE_POSEDGE
+ * respectively. This simplifies code as signals are usually sampled on the
+ * opposite edge of the driving edge. Transmitters and receivers may however
+ * need to take other signal timings into account to convert between driving
+ * and sample edges.
+ *
+ * @DRM_BUS_FLAG_DE_LOW:               The Data Enable signal is active low
+ * @DRM_BUS_FLAG_DE_HIGH:              The Data Enable signal is active high
+ * @DRM_BUS_FLAG_PIXDATA_POSEDGE:      Legacy value, do not use
+ * @DRM_BUS_FLAG_PIXDATA_NEGEDGE:      Legacy value, do not use
+ * @DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE:        Data is driven on the rising edge of
+ *                                     the pixel clock
+ * @DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE:        Data is driven on the falling edge of
+ *                                     the pixel clock
+ * @DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE: Data is sampled on the rising edge of
+ *                                     the pixel clock
+ * @DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE: Data is sampled on the falling edge of
+ *                                     the pixel clock
+ * @DRM_BUS_FLAG_DATA_MSB_TO_LSB:      Data is transmitted MSB to LSB on the bus
+ * @DRM_BUS_FLAG_DATA_LSB_TO_MSB:      Data is transmitted LSB to MSB on the bus
+ * @DRM_BUS_FLAG_SYNC_POSEDGE:         Legacy value, do not use
+ * @DRM_BUS_FLAG_SYNC_NEGEDGE:         Legacy value, do not use
+ * @DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE:   Sync signals are driven on the rising
+ *                                     edge of the pixel clock
+ * @DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE:   Sync signals are driven on the falling
+ *                                     edge of the pixel clock
+ * @DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE:  Sync signals are sampled on the rising
+ *                                     edge of the pixel clock
+ * @DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE:  Sync signals are sampled on the falling
+ *                                     edge of the pixel clock
+ */
+enum drm_bus_flags {
+       DRM_BUS_FLAG_DE_LOW = BIT(0),
+       DRM_BUS_FLAG_DE_HIGH = BIT(1),
+       DRM_BUS_FLAG_PIXDATA_POSEDGE = BIT(2),
+       DRM_BUS_FLAG_PIXDATA_NEGEDGE = BIT(3),
+       DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+       DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE = DRM_BUS_FLAG_PIXDATA_NEGEDGE,
+       DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE = DRM_BUS_FLAG_PIXDATA_NEGEDGE,
+       DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+       DRM_BUS_FLAG_DATA_MSB_TO_LSB = BIT(4),
+       DRM_BUS_FLAG_DATA_LSB_TO_MSB = BIT(5),
+       DRM_BUS_FLAG_SYNC_POSEDGE = BIT(6),
+       DRM_BUS_FLAG_SYNC_NEGEDGE = BIT(7),
+       DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE = DRM_BUS_FLAG_SYNC_POSEDGE,
+       DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE = DRM_BUS_FLAG_SYNC_NEGEDGE,
+       DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE = DRM_BUS_FLAG_SYNC_NEGEDGE,
+       DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE = DRM_BUS_FLAG_SYNC_POSEDGE,
+};
+
 /**
  * struct drm_display_info - runtime data about the connected sink
  *
@@ -265,26 +355,16 @@ enum drm_panel_orientation {
  * drm_add_edid_modes().
  */
 struct drm_display_info {
-       /**
-        * @name: Name of the display.
-        */
-       char name[DRM_DISPLAY_INFO_LEN];
-
        /**
         * @width_mm: Physical width in mm.
         */
-        unsigned int width_mm;
+       unsigned int width_mm;
+
        /**
         * @height_mm: Physical height in mm.
         */
        unsigned int height_mm;
 
-       /**
-        * @pixel_clock: Maximum pixel clock supported by the sink, in units of
-        * 100Hz. This mismatches the clock in &drm_display_mode (which is in
-        * kHZ), because that's what the EDID uses as base unit.
-        */
-       unsigned int pixel_clock;
        /**
         * @bpc: Maximum bits per color channel. Used by HDMI and DP outputs.
         */
@@ -328,24 +408,10 @@ struct drm_display_info {
         */
        unsigned int num_bus_formats;
 
-#define DRM_BUS_FLAG_DE_LOW            (1<<0)
-#define DRM_BUS_FLAG_DE_HIGH           (1<<1)
-/* drive data on pos. edge */
-#define DRM_BUS_FLAG_PIXDATA_POSEDGE   (1<<2)
-/* drive data on neg. edge */
-#define DRM_BUS_FLAG_PIXDATA_NEGEDGE   (1<<3)
-/* data is transmitted MSB to LSB on the bus */
-#define DRM_BUS_FLAG_DATA_MSB_TO_LSB   (1<<4)
-/* data is transmitted LSB to MSB on the bus */
-#define DRM_BUS_FLAG_DATA_LSB_TO_MSB   (1<<5)
-/* drive sync on pos. edge */
-#define DRM_BUS_FLAG_SYNC_POSEDGE      (1<<6)
-/* drive sync on neg. edge */
-#define DRM_BUS_FLAG_SYNC_NEGEDGE      (1<<7)
-
        /**
         * @bus_flags: Additional information (like pixel signal polarity) for
-        * the pixel data on the bus, using DRM_BUS_FLAGS\_ defines.
+        * the pixel data on the bus, using &enum drm_bus_flags values
+        * DRM_BUS_FLAGS\_.
         */
        u32 bus_flags;
 
@@ -502,6 +568,13 @@ struct drm_connector_state {
         */
        unsigned int content_protection;
 
+       /**
+        * @colorspace: State variable for Connector property to request
+        * colorspace change on Sink. This is most commonly used to switch
+        * to wider color gamuts like BT2020.
+        */
+       u32 colorspace;
+
        /**
         * @writeback_job: Writeback job for writeback connectors
         *
@@ -989,10 +1062,10 @@ struct drm_connector {
        struct drm_property *vrr_capable_property;
 
        /**
-        * @content_protection_property: DRM ENUM property for content
-        * protection. See drm_connector_attach_content_protection_property().
+        * @colorspace_property: Connector property to set the suitable
+        * colorspace supported by the sink.
         */
-       struct drm_property *content_protection_property;
+       struct drm_property *colorspace_property;
 
        /**
         * @path_blob_ptr:
@@ -1266,9 +1339,8 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
                                               u32 scaling_mode_mask);
 int drm_connector_attach_vrr_capable_property(
                struct drm_connector *connector);
-int drm_connector_attach_content_protection_property(
-               struct drm_connector *connector);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
+int drm_mode_create_colorspace_property(struct drm_connector *connector);
 int drm_mode_create_content_type_property(struct drm_device *dev);
 void drm_hdmi_avi_infoframe_content_type(struct hdmi_avi_infoframe *frame,
                                         const struct drm_connector_state *conn_state);