From fcd70cd36b9bf697122538c9e38e8cf954b2342b Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Thu, 17 Jan 2019 22:03:34 +0100 Subject: drm: Split out drm_probe_helper.h Having the probe helper stuff (which pretty much everyone needs) in the drm_crtc_helper.h file (which atomic drivers should never need) is confusing. Split them out. To make sure I actually achieved the goal here I went through all drivers. And indeed, all atomic drivers are now free of drm_crtc_helper.h includes. v2: Make it compile. There was so much compile fail on arm drivers that I figured I'll better not include any of the acks on v1. v3: Massive rebase because i915 has lost a lot of drmP.h includes, but not all: Through drm_crtc_helper.h > drm_modeset_helper.h -> drmP.h there was still one, which this patch largely removes. Which means rolling out lots more includes all over. This will also conflict with ongoing drmP.h cleanup by others I expect. v3: Rebase on top of atomic bochs. v4: Review from Laurent for bridge/rcar/omap/shmob/core bits: - (re)move some of the added includes, use the better include files in other places (all suggested from Laurent adopted unchanged). - sort alphabetically v5: Actually try to sort them, and while at it, sort all the ones I touch. v6: Rebase onto i915 changes. v7: Rebase once more. Acked-by: Harry Wentland Acked-by: Sam Ravnborg Cc: Sam Ravnborg Cc: Jani Nikula Cc: Laurent Pinchart Acked-by: Rodrigo Vivi Acked-by: Benjamin Gaignard Acked-by: Jani Nikula Acked-by: Neil Armstrong Acked-by: Oleksandr Andrushchenko Acked-by: CK Hu Acked-by: Alex Deucher Acked-by: Sam Ravnborg Reviewed-by: Laurent Pinchart Acked-by: Liviu Dudau Signed-off-by: Daniel Vetter Cc: linux-arm-kernel@lists.infradead.org Cc: virtualization@lists.linux-foundation.org Cc: etnaviv@lists.freedesktop.org Cc: linux-samsung-soc@vger.kernel.org Cc: intel-gfx@lists.freedesktop.org Cc: linux-mediatek@lists.infradead.org Cc: linux-amlogic@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org Cc: spice-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org Cc: linux-rockchip@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-tegra@vger.kernel.org Cc: xen-devel@lists.xen.org Link: https://patchwork.freedesktop.org/patch/msgid/20190117210334.13234-1-daniel.vetter@ffwll.ch --- include/drm/drm_crtc_helper.h | 16 ---------------- include/drm/drm_probe_helper.h | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 include/drm/drm_probe_helper.h (limited to 'include/drm') diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index 0ee9a96b70da..a6d520d5b6ca 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h @@ -58,20 +58,4 @@ int drm_helper_connector_dpms(struct drm_connector *connector, int mode); void drm_helper_resume_force_mode(struct drm_device *dev); int drm_helper_force_disable_all(struct drm_device *dev); -/* drm_probe_helper.c */ -int drm_helper_probe_single_connector_modes(struct drm_connector - *connector, uint32_t maxX, - uint32_t maxY); -int drm_helper_probe_detect(struct drm_connector *connector, - struct drm_modeset_acquire_ctx *ctx, - bool force); -void drm_kms_helper_poll_init(struct drm_device *dev); -void drm_kms_helper_poll_fini(struct drm_device *dev); -bool drm_helper_hpd_irq_event(struct drm_device *dev); -void drm_kms_helper_hotplug_event(struct drm_device *dev); - -void drm_kms_helper_poll_disable(struct drm_device *dev); -void drm_kms_helper_poll_enable(struct drm_device *dev); -bool drm_kms_helper_is_poll_worker(void); - #endif diff --git a/include/drm/drm_probe_helper.h b/include/drm/drm_probe_helper.h new file mode 100644 index 000000000000..8d3ed2834d34 --- /dev/null +++ b/include/drm/drm_probe_helper.h @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT + +#ifndef __DRM_PROBE_HELPER_H__ +#define __DRM_PROBE_HELPER_H__ + +#include + +struct drm_connector; +struct drm_device; +struct drm_modeset_acquire_ctx; + +int drm_helper_probe_single_connector_modes(struct drm_connector + *connector, uint32_t maxX, + uint32_t maxY); +int drm_helper_probe_detect(struct drm_connector *connector, + struct drm_modeset_acquire_ctx *ctx, + bool force); +void drm_kms_helper_poll_init(struct drm_device *dev); +void drm_kms_helper_poll_fini(struct drm_device *dev); +bool drm_helper_hpd_irq_event(struct drm_device *dev); +void drm_kms_helper_hotplug_event(struct drm_device *dev); + +void drm_kms_helper_poll_disable(struct drm_device *dev); +void drm_kms_helper_poll_enable(struct drm_device *dev); +bool drm_kms_helper_is_poll_worker(void); + +#endif -- cgit From 168982d243d7f8dc368e508a61a8516a23b0bbec Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 29 Jan 2019 09:56:43 +0100 Subject: drm/doc: Add a warning to drm_dev_is_unplugged MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's probably not what you want, definitely not after Noralf's work to add drm_dev_enter/exit. Cc: Noralf Trønnes Reviewed-by: Noralf Trønnes Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20190129085643.16357-1-daniel.vetter@ffwll.ch --- include/drm/drm_drv.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/drm') diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 35af23f5fa0d..e32c12877bc5 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -643,6 +643,10 @@ void drm_dev_unplug(struct drm_device *dev); * Unplugging itself is singalled through drm_dev_unplug(). If a device is * unplugged, these two functions guarantee that any store before calling * drm_dev_unplug() is visible to callers of this function after it completes + * + * WARNING: This function fundamentally races against drm_dev_unplug(). It is + * recommended that drivers instead use the underlying drm_dev_enter() and + * drm_dev_exit() function pairs. */ static inline bool drm_dev_is_unplugged(struct drm_device *dev) { -- cgit From 0e2a933b02c972919f7478364177eb76cd4ae00d Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 29 Jan 2019 11:42:47 +0100 Subject: drm: Switch DRIVER_ flags to an enum And move the documenation we alreay have into kerneldoc, plus a bit of polish while at it. v2: - Ditch FIXME from commit message, I've resolved that already before sending out the first version. - Put the legacy DRIVER_ flags at the end (Sam). Cc: Sam Ravnborg Reviewed-by: Emil Velikov Reviewed-by: Sam Ravnborg Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20190129104248.26607-2-daniel.vetter@ffwll.ch --- include/drm/drm_drv.h | 141 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 124 insertions(+), 17 deletions(-) (limited to 'include/drm') diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index e32c12877bc5..0760a1d7b6c2 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -41,21 +41,123 @@ struct drm_display_mode; struct drm_mode_create_dumb; struct drm_printer; -/* driver capabilities and requirements mask */ -#define DRIVER_USE_AGP 0x1 -#define DRIVER_LEGACY 0x2 -#define DRIVER_PCI_DMA 0x8 -#define DRIVER_SG 0x10 -#define DRIVER_HAVE_DMA 0x20 -#define DRIVER_HAVE_IRQ 0x40 -#define DRIVER_IRQ_SHARED 0x80 -#define DRIVER_GEM 0x1000 -#define DRIVER_MODESET 0x2000 -#define DRIVER_PRIME 0x4000 -#define DRIVER_RENDER 0x8000 -#define DRIVER_ATOMIC 0x10000 -#define DRIVER_KMS_LEGACY_CONTEXT 0x20000 -#define DRIVER_SYNCOBJ 0x40000 +/** + * enum drm_driver_feature - feature flags + * + * See &drm_driver.driver_features, drm_device.driver_features and + * drm_core_check_feature(). + */ +enum drm_driver_feature { + /** + * @DRIVER_GEM: + * + * Driver use the GEM memory manager. This should be set for all modern + * drivers. + */ + DRIVER_GEM = BIT(0), + /** + * @DRIVER_MODESET: + * + * Driver supports mode setting interfaces (KMS). + */ + DRIVER_MODESET = BIT(1), + /** + * @DRIVER_PRIME: + * + * Driver implements DRM PRIME buffer sharing. + */ + DRIVER_PRIME = BIT(2), + /** + * @DRIVER_RENDER: + * + * Driver supports dedicated render nodes. See also the :ref:`section on + * render nodes ` for details. + */ + DRIVER_RENDER = BIT(3), + /** + * @DRIVER_ATOMIC: + * + * Driver supports the full atomic modesetting userspace API. Drivers + * which only use atomic internally, but do not the support the full + * userspace API (e.g. not all properties converted to atomic, or + * multi-plane updates are not guaranteed to be tear-free) should not + * set this flag. + */ + DRIVER_ATOMIC = BIT(4), + /** + * @DRIVER_SYNCOBJ: + * + * Driver supports &drm_syncobj for explicit synchronization of command + * submission. + */ + DRIVER_SYNCOBJ = BIT(5), + + /* IMPORTANT: Below are all the legacy flags, add new ones above. */ + + /** + * @DRIVER_USE_AGP: + * + * Set up DRM AGP support, see drm_agp_init(), the DRM core will manage + * AGP resources. New drivers don't need this. + */ + DRIVER_USE_AGP = BIT(24), + /** + * @DRIVER_LEGACY: + * + * Denote a legacy driver using shadow attach. Do not use. + */ + DRIVER_LEGACY = BIT(25), + /** + * @DRIVER_PCI_DMA: + * + * Driver is capable of PCI DMA, mapping of PCI DMA buffers to userspace + * will be enabled. Only for legacy drivers. Do not use. + */ + DRIVER_PCI_DMA = BIT(26), + /** + * @DRIVER_SG: + * + * Driver can perform scatter/gather DMA, allocation and mapping of + * scatter/gather buffers will be enabled. Only for legacy drivers. Do + * not use. + */ + DRIVER_SG = BIT(27), + + /** + * @DRIVER_HAVE_DMA: + * + * Driver supports DMA, the userspace DMA API will be supported. Only + * for legacy drivers. Do not use. + */ + DRIVER_HAVE_DMA = BIT(28), + /** + * @DRIVER_HAVE_IRQ: + * + * Legacy irq support. Only for legacy drivers. Do not use. + * + * New drivers can either use the drm_irq_install() and + * drm_irq_uninstall() helper functions, or roll their own irq support + * code by calling request_irq() directly. + */ + DRIVER_HAVE_IRQ = BIT(29), + /** + * @DRIVER_IRQ_SHARED: + * + * Indicates to drm_irq_install() that a shared irq should be requested. + * + * FIXME: This should be an explicit argument for non-legacy drivers, or + * at least the default for PCI devices (which would cover all current + * users). + */ + DRIVER_IRQ_SHARED = BIT(30), + /** + * @DRIVER_KMS_LEGACY_CONTEXT: + * + * Used only by nouveau for backwards compatibility with existing + * userspace. Do not use. + */ + DRIVER_KMS_LEGACY_CONTEXT = BIT(31), +}; /** * struct drm_driver - DRM driver structure @@ -579,7 +681,12 @@ struct drm_driver { /** @date: driver date */ char *date; - /** @driver_features: driver features */ + /** + * @driver_features: + * Driver features, see &enum drm_driver_feature. Drivers can disable + * some features on a per-instance basis using + * &drm_device.driver_features. + */ u32 driver_features; /** @@ -666,7 +773,7 @@ static inline bool drm_dev_is_unplugged(struct drm_device *dev) * @feature: feature flag * * This checks @dev for driver features, see &drm_driver.driver_features, - * &drm_device.driver_features, and the various DRIVER_\* flags. + * &drm_device.driver_features, and the various &enum drm_driver_feature flags. * * Returns true if the @feature is supported, false otherwise. */ -- cgit From 1ff494813bafa127ecba1160262ba39b2fdde7ba Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 29 Jan 2019 11:42:48 +0100 Subject: drm/irq: Ditch DRIVER_IRQ_SHARED This is only used by drm_irq_install(), which is an optional helper. For legacy pci devices this is required (due to interrupt sharing without msi/msi-x), and just making this the default exactly matches the behaviour of all existing drivers using the drm_irq_install() helpers. In case that ever becomes wrong drivers can roll their own irq handling, as many drivers already do (for other reasons like needing a threaded interrupt handler, or having an entire pile of different interrupt sources). v2: Rebase v3: Improve commit message (Emil) Cc: Sam Ravnborg Reviewed-by: Emil Velikov Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20190129104248.26607-3-daniel.vetter@ffwll.ch --- include/drm/drm_drv.h | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'include/drm') diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 0760a1d7b6c2..ca46a45a9cce 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -100,20 +100,20 @@ enum drm_driver_feature { * Set up DRM AGP support, see drm_agp_init(), the DRM core will manage * AGP resources. New drivers don't need this. */ - DRIVER_USE_AGP = BIT(24), + DRIVER_USE_AGP = BIT(25), /** * @DRIVER_LEGACY: * * Denote a legacy driver using shadow attach. Do not use. */ - DRIVER_LEGACY = BIT(25), + DRIVER_LEGACY = BIT(26), /** * @DRIVER_PCI_DMA: * * Driver is capable of PCI DMA, mapping of PCI DMA buffers to userspace * will be enabled. Only for legacy drivers. Do not use. */ - DRIVER_PCI_DMA = BIT(26), + DRIVER_PCI_DMA = BIT(27), /** * @DRIVER_SG: * @@ -121,7 +121,7 @@ enum drm_driver_feature { * scatter/gather buffers will be enabled. Only for legacy drivers. Do * not use. */ - DRIVER_SG = BIT(27), + DRIVER_SG = BIT(28), /** * @DRIVER_HAVE_DMA: @@ -129,7 +129,7 @@ enum drm_driver_feature { * Driver supports DMA, the userspace DMA API will be supported. Only * for legacy drivers. Do not use. */ - DRIVER_HAVE_DMA = BIT(28), + DRIVER_HAVE_DMA = BIT(29), /** * @DRIVER_HAVE_IRQ: * @@ -139,17 +139,7 @@ enum drm_driver_feature { * drm_irq_uninstall() helper functions, or roll their own irq support * code by calling request_irq() directly. */ - DRIVER_HAVE_IRQ = BIT(29), - /** - * @DRIVER_IRQ_SHARED: - * - * Indicates to drm_irq_install() that a shared irq should be requested. - * - * FIXME: This should be an explicit argument for non-legacy drivers, or - * at least the default for PCI devices (which would cover all current - * users). - */ - DRIVER_IRQ_SHARED = BIT(30), + DRIVER_HAVE_IRQ = BIT(30), /** * @DRIVER_KMS_LEGACY_CONTEXT: * -- cgit From 45bbda1e35f4943fec6522ef0cdb63cb9ab5780b Mon Sep 17 00:00:00 2001 From: Ville Syrjälä Date: Tue, 22 Jan 2019 22:03:00 +0200 Subject: drm/dp/mst: Provide defines for ACK vs. NAK reply type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the code a bit easier to read by providing symbolic names for the reply_type (ACK vs. NAK). Also clean up some brace stuff while at it. v2: s/DP_REPLY/DP_SIDEBAND_REPLY/ (DK) Fix some checkpatch issues Signed-off-by: Ville Syrjälä Reviewed-by: Dhinakaran Pandiyan Link: https://patchwork.freedesktop.org/patch/msgid/20190122200301.18633-1-ville.syrjala@linux.intel.com --- include/drm/drm_dp_helper.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/drm') diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index c223c87ef119..a62d3750663a 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -992,6 +992,10 @@ #define DP_SINK_EVENT_NOTIFY 0x30 #define DP_QUERY_STREAM_ENC_STATUS 0x38 +/* DP 1.2 MST sideband reply types */ +#define DP_SIDEBAND_REPLY_ACK 0x00 +#define DP_SIDEBAND_REPLY_NAK 0x01 + /* DP 1.2 MST sideband nak reasons - table 2.84 */ #define DP_NAK_WRITE_FAILURE 0x01 #define DP_NAK_INVALID_READ 0x02 -- cgit From 3dadbd2957eb8dad8e9ca0c639307a732e564bf7 Mon Sep 17 00:00:00 2001 From: Ville Syrjälä Date: Tue, 22 Jan 2019 22:03:01 +0200 Subject: drm/dp/mst: Provide better debugs for NAK replies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Decode the NAK reply fields to make it easier to parse the logs. v2: s/STR/DP_STR/ to avoid conflict with some header stuff (0day) Use drm_dp_mst_req_type_str() more (DK) Signed-off-by: Ville Syrjälä Reviewed-by: Dhinakaran Pandiyan Link: https://patchwork.freedesktop.org/patch/msgid/20190122200301.18633-2-ville.syrjala@linux.intel.com --- include/drm/drm_dp_helper.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/drm') diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index a62d3750663a..5db7fb8c8b50 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -976,6 +976,7 @@ #define DP_PEER_DEVICE_DP_LEGACY_CONV 0x4 /* DP 1.2 MST sideband request names DP 1.2a Table 2-80 */ +#define DP_GET_MSG_TRANSACTION_VERSION 0x00 /* DP 1.3 */ #define DP_LINK_ADDRESS 0x01 #define DP_CONNECTION_STATUS_NOTIFY 0x02 #define DP_ENUM_PATH_RESOURCES 0x10 -- cgit From 264fce6cc2c1b06d14c345b0b31b281087feb99b Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Fri, 1 Feb 2019 12:07:46 +0000 Subject: drm/bridge: dw-hdmi: Add SCDC and TMDS Scrambling support Add support for SCDC Setup for TMDS Clock > 3.4GHz and enable TMDS Scrambling when supported or mandatory. This patch also adds an helper to setup the control bit to support the high TMDS Bit Period/TMDS Clock-Period Ratio as required with TMDS Clock > 3.4GHz for HDMI2.0 3840x2160@60/50 modes. These changes were based on work done by Huicong Xu and Nickey Yang to support HDMI2.0 modes on the Rockchip 4.4 BSP kernel at [1] [1] https://github.com/rockchip-linux/kernel/tree/release-4.4 Cc: Nickey Yang Cc: Huicong Xu Signed-off-by: Neil Armstrong Tested-by: Heiko Stuebner Reviewed-by: Andrzej Hajda Signed-off-by: Andrzej Hajda Link: https://patchwork.freedesktop.org/patch/msgid/1549022873-40549-2-git-send-email-narmstrong@baylibre.com --- include/drm/bridge/dw_hdmi.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/drm') diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index 9f93895dde88..66e70770cce5 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -159,6 +159,7 @@ void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate); void dw_hdmi_audio_enable(struct dw_hdmi *hdmi); void dw_hdmi_audio_disable(struct dw_hdmi *hdmi); +void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi); /* PHY configuration */ void dw_hdmi_phy_i2c_set_addr(struct dw_hdmi *hdmi, u8 address); -- cgit