drm: add support for Cadence MHDP DPI/DP bridge.
Subsystems (6)
v3 cover drm: add support for Cadence MHDP DPI/DP bridge.
Hello!
This is the series of patches that will add support for the Cadence's DPI/DP bridge. Please note that this is a preliminary version of the driver and there will be more patches in the future with updates, fixes and improvements. Please keep that in mind when looking at FIXME/TODO/XXX comments.
Initially, MHDP driver was developed as a DRM bridge driver and was planed to be placed in drivers/gpu/drm/bridge/mhdp.c. However, there was already a driver for Cadence's DP controller developed by RockChip, but that driver uses the different DRM framework and looks like a part of a bigger system. Both controllers (including firmware) are quite different internally (MST/FEC/DSC support, link training done by driver, additional commands, IRQ's etc.) but they have similar register map, except for Framer/Streamer (which is noticeably different), so they appear similar.
The following patches contain:
- Moving common code to drivers/gpu/drm/bridge/cdns-mhdp-common.* and modifying it a bit (mostly new prefixes for functions and data types) so it can be used by two, higher level, drivers.
- Modifying existing RockChip's DP driver to use the common code after changes made to it (use the new cdns_mhdp_device structure and new function names).
- Modifying DRM helpers a bit. Some are required for new driver, some are updates from DP 1.2 to 1.3 or 1.4.
- Adding documentation for device tree bindings.
- Adding preliminary Cadence DPI/DP bridge driver.
Some of the things that will be added later on include (but are not limited to):
- Support for Cadence SD0801 PHY (PHY's driver should be on the way by now)
- MST support
- DSC support
- FEC support
- HDCP support
Changes in v2:
- Added actual description of what the patch contains, what is it for and what's going on here in general.
- New structure. Now we have one common low level driver + two high level drivers - one for RockChip with minimum changes and one, more general, for Cadence.
- Dropped some changes made to DRM helpers.
- Updated the device tree bindings document.
Changes in v3:
- Corrected dt-bindings document
- Enabled some clocks at startup (since FW doesn't do that anymore).
- Changed Firmware file name to match the file on Linux Firmware repo.
- Added SST audio support
- Made common functions (in cdns-mhdp-common.*) public.
Damian Kos (1):
drm/rockchip: prepare common code for cdns and rk dpi/dp driver
Quentin Schulz (4):
drm/dp: fix link probing for devices supporting DP 1.4+ drm/dp: make dp_link_status and dp_get_lane_status usable from outside
of the core
dt-bindings: drm/bridge Document Cadence MHDP DPI/DP bridge bindings drm/bridge: add preliminary driver for cadence dpi/dp bridge
.../bindings/display/bridge/cdns,mhdp.txt | 43 +
drivers/gpu/drm/bridge/Kconfig | 9 +
drivers/gpu/drm/bridge/Makefile | 3 +
drivers/gpu/drm/bridge/cdns-mhdp-common.c | 1108 ++++++++++++++
.../cdns-mhdp-common.h} | 135 +-
drivers/gpu/drm/bridge/cdns-mhdp.c | 1308 +++++++++++++++++
drivers/gpu/drm/drm_dp_helper.c | 50 +-
drivers/gpu/drm/rockchip/Kconfig | 1 +
drivers/gpu/drm/rockchip/Makefile | 4 +-
drivers/gpu/drm/rockchip/cdn-dp-core.c | 234 +--
drivers/gpu/drm/rockchip/cdn-dp-core.h | 42 +-
drivers/gpu/drm/rockchip/cdn-dp-reg.c | 969 ------------
include/drm/drm_dp_helper.h | 5 +-
13 files changed, 2756 insertions(+), 1155 deletions(-)
create mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,mhdp.txt
create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-common.c
rename drivers/gpu/drm/{rockchip/cdn-dp-reg.h => bridge/cdns-mhdp-common.h} (81%)
create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp.c
delete mode 100644 drivers/gpu/drm/rockchip/cdn-dp-reg.cSignature · 1 line
2.17.1
PATCH v3 1/5 drm/rockchip: prepare common code for cdns and rk dpi/dp driver
- Extracted common fields from cdn_dp_device to a new cdns_mhdp_device structure which will be used by two separate drivers later on.
- Moved some datatypes (audio_format, audio_info, vic_pxl_encoding_format, video_info) from cdn-dp-core.c to cdn-dp-reg.h.
- Changed prefixes from cdn_dp to cdns_mhdp
cdn -> cdns to match the other Cadence's drivers
dp -> mhdp to distinguish it from a "just a DP" as the IP underneath
this registers map can be a HDMI (which is internally different, but the interface for commands, events is pretty much the same).
- Modified cdn-dp-core.c to use the new driver structure and new function names.
--- drivers/gpu/drm/rockchip/cdn-dp-core.c | 220 +++++++------ drivers/gpu/drm/rockchip/cdn-dp-core.h | 40 +-- drivers/gpu/drm/rockchip/cdn-dp-reg.c | 428 +++++++++++++------------ drivers/gpu/drm/rockchip/cdn-dp-reg.h | 114 +++++-- 4 files changed, 431 insertions(+), 371 deletions(-)
drivers/gpu/drm/rockchip/cdn-dp-core.c +117 -103
@@ -31,11 +31,10 @@#include <sound/hdmi-codec.h> #include "cdn-dp-core.h" -#include "cdn-dp-reg.h" #include "rockchip_drm_vop.h" #define connector_to_dp (c) \ - container_of(c, struct cdn_dp_device, connector) + container_of(c, struct cdn_dp_device, mhdp.connector)#define encoder_to_dp (c) \ container_of(c, struct cdn_dp_device, encoder)
@@ -70,17 +69,18 @@ MODULE_DEVICE_TABLE(of, cdn_dp_dt_ids);static int cdn_dp_grf_write (struct cdn_dp_device *dp,unsigned int reg,unsigned int val) { +struct device *dev = dp->mhdp.dev;int ret; ret =clk_prepare_enable (dp->grf_clk);if (ret) { -DRM_DEV_ERROR (dp->dev,"Failed to prepare_enable grf clock\n" ); +DRM_DEV_ERROR (dev,"Failed to prepare_enable grf clock\n" );return ret; } ret =regmap_write (dp->grf, reg, val);if (ret) { -DRM_DEV_ERROR (dp->dev,"Could not write to GRF: %d\n" , ret); +DRM_DEV_ERROR (dev,"Could not write to GRF: %d\n" , ret);return ret; }
@@ -91,24 +91,25 @@ static int cdn_dp_grf_write(struct cdn_dp_device *dp,static int cdn_dp_clk_enable (struct cdn_dp_device *dp) { +struct device *dev = dp->mhdp.dev;int ret;unsigned long rate; ret =clk_prepare_enable (dp->pclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"cannot enable dp pclk %d\n" , ret); +DRM_DEV_ERROR (dev,"cannot enable dp pclk %d\n" , ret); goto err_pclk; } ret =clk_prepare_enable (dp->core_clk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"cannot enable core_clk %d\n" , ret); +DRM_DEV_ERROR (dev,"cannot enable core_clk %d\n" , ret); goto err_core_clk; } - ret =pm_runtime_get_sync (dp->dev); + ret =pm_runtime_get_sync (dev);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"cannot get pm runtime %d\n" , ret); +DRM_DEV_ERROR (dev,"cannot get pm runtime %d\n" , ret); goto err_pm_runtime_get; }
@@ -121,18 +122,18 @@ static int cdn_dp_clk_enable(struct cdn_dp_device *dp) rate =clk_get_rate (dp->core_clk);if (!rate) { -DRM_DEV_ERROR (dp->dev,"get clk rate failed\n" ); +DRM_DEV_ERROR (dev,"get clk rate failed\n" ); ret = -EINVAL ; goto err_set_rate; } -cdn_dp_set_fw_clk (dp, rate); -cdn_dp_clock_reset (dp); +cdns_mhdp_set_fw_clk (&dp->mhdp, rate); +cdns_mhdp_clock_reset (&dp->mhdp);return 0 ; err_set_rate: -pm_runtime_put (dp->dev); +pm_runtime_put (dev); err_pm_runtime_get:clk_disable_unprepare (dp->core_clk); err_core_clk:
@@ -143,7 +144,7 @@ static int cdn_dp_clk_enable(struct cdn_dp_device *dp)static void cdn_dp_clk_disable (struct cdn_dp_device *dp) { -pm_runtime_put_sync (dp->dev); +pm_runtime_put_sync (dp->mhdp.dev);clk_disable_unprepare (dp->pclk);clk_disable_unprepare (dp->core_clk); }
@@ -176,7 +177,7 @@ static int cdn_dp_get_sink_count(struct cdn_dp_device *dp, u8 *sink_count)u8 value; *sink_count =0 ; - ret =cdn_dp_dpcd_read (dp,DP_SINK_COUNT , &value,1 ); + ret =cdns_mhdp_dpcd_read (&dp->mhdp,DP_SINK_COUNT , &value,1 );if (ret)return ret;
@@ -200,12 +201,13 @@ static struct cdn_dp_port *cdn_dp_connected_port(struct cdn_dp_device *dp)static bool cdn_dp_check_sink_connection (struct cdn_dp_device *dp) { +struct device *dev = dp->mhdp.dev;unsigned long timeout = jiffies +msecs_to_jiffies (CDN_DPCD_TIMEOUT_MS );struct cdn_dp_port *port;u8 sink_count =0 ;if (dp->active_port <0 || dp->active_port >= dp->ports) { -DRM_DEV_ERROR (dp->dev,"active_port is wrong!\n" ); +DRM_DEV_ERROR (dev,"active_port is wrong!\n" );return false; }
@@ -227,7 +229,7 @@ static bool cdn_dp_check_sink_connection(struct cdn_dp_device *dp)usleep_range (5000 ,10000 ); } -DRM_DEV_ERROR (dp->dev,"Get sink capability timed out\n" ); +DRM_DEV_ERROR (dev,"Get sink capability timed out\n" );return false; }
@@ -269,7 +271,8 @@ static int cdn_dp_connector_get_modes(struct drm_connector *connector)mutex_lock (&dp->lock); edid = dp->edid;if (edid) { -DRM_DEV_DEBUG_KMS (dp->dev,"got edid: width[%d] x height[%d]\n" , +DRM_DEV_DEBUG_KMS (dp->mhdp.dev, +"got edid: width[%d] x height[%d]\n" , edid->width_cm, edid->height_cm); dp->sink_has_audio =drm_detect_monitor_audio (edid);
@@ -287,7 +290,8 @@ static int cdn_dp_connector_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) {struct cdn_dp_device *dp =connector_to_dp (connector); -struct drm_display_info *display_info = &dp->connector.display_info; +struct drm_display_info *display_info = + &dp->mhdp.connector.display_info;u32 requested, actual, rate, sink_max, source_max =0 ;u8 lanes, bpc;
@@ -313,7 +317,7 @@ static int cdn_dp_connector_mode_valid(struct drm_connector *connector, sink_max =drm_dp_max_lane_count (dp->dpcd); lanes =min (source_max, sink_max); - source_max =drm_dp_bw_code_to_link_rate (CDN_DP_MAX_LINK_RATE ); + source_max =drm_dp_bw_code_to_link_rate (CDNS_DP_MAX_LINK_RATE ); sink_max =drm_dp_max_link_rate (dp->dpcd); rate =min (source_max, sink_max);
@@ -323,7 +327,7 @@ static int cdn_dp_connector_mode_valid(struct drm_connector *connector, actual = actual *8 /10 ;if (requested > actual) { -DRM_DEV_DEBUG_KMS (dp->dev, +DRM_DEV_DEBUG_KMS (dp->mhdp.dev,"requested=%d, actual=%d, clock=%d\n" , requested, actual, mode->clock);return MODE_CLOCK_HIGH ;
@@ -343,28 +347,29 @@ static int cdn_dp_firmware_init(struct cdn_dp_device *dp)const u32 *iram_data, *dram_data;const struct firmware *fw = dp->fw;const struct cdn_firmware_header *hdr; +struct device *dev = dp->mhdp.dev; hdr = (struct cdn_firmware_header *)fw->data;if (fw->size !=le32_to_cpu (hdr->size_bytes)) { -DRM_DEV_ERROR (dp->dev,"firmware is invalid\n" ); +DRM_DEV_ERROR (dev,"firmware is invalid\n" );return -EINVAL ; } iram_data = (const u32 *)(fw->data + hdr->header_size); dram_data = (const u32 *)(fw->data + hdr->header_size + hdr->iram_size); - ret =cdn_dp_load_firmware (dp, iram_data, hdr->iram_size, - dram_data, hdr->dram_size); + ret =cdns_mhdp_load_firmware (&dp->mhdp, iram_data, hdr->iram_size, + dram_data, hdr->dram_size);if (ret)return ret; - ret =cdn_dp_set_firmware_active (dp, true); + ret =cdns_mhdp_set_firmware_active (&dp->mhdp, true);if (ret) { -DRM_DEV_ERROR (dp->dev,"active ucpu failed: %d\n" , ret); +DRM_DEV_ERROR (dev,"active ucpu failed: %d\n" , ret);return ret; } -return cdn_dp_event_config (dp); +return cdns_mhdp_event_config (&dp->mhdp); }static int cdn_dp_get_sink_capability (struct cdn_dp_device *dp)
@@ -374,28 +379,29 @@ static int cdn_dp_get_sink_capability(struct cdn_dp_device *dp)if (!cdn_dp_check_sink_connection (dp))return -ENODEV ; - ret =cdn_dp_dpcd_read (dp,DP_DPCD_REV , dp->dpcd, -DP_RECEIVER_CAP_SIZE ); + ret =cdns_mhdp_dpcd_read (&dp->mhdp,DP_DPCD_REV , dp->dpcd, +DP_RECEIVER_CAP_SIZE );if (ret) { -DRM_DEV_ERROR (dp->dev,"Failed to get caps %d\n" , ret); +DRM_DEV_ERROR (dp->mhdp.dev,"Failed to get caps %d\n" , ret);return ret; }kfree (dp->edid); - dp->edid =drm_do_get_edid (&dp->connector, - cdn_dp_get_edid_block, dp); + dp->edid =drm_do_get_edid (&dp->mhdp.connector, + cdns_mhdp_get_edid_block, &dp->mhdp);return 0 ; }static int cdn_dp_enable_phy (struct cdn_dp_device *dp,struct cdn_dp_port *port) { +struct device *dev = dp->mhdp.dev;union extcon_property_value property;int ret;if (!port->phy_enabled) { ret =phy_power_on (port->phy);if (ret) { -DRM_DEV_ERROR (dp->dev,"phy power on failed: %d\n" , +DRM_DEV_ERROR (dev,"phy power on failed: %d\n" , ret); goto err_phy; }
@@ -405,28 +411,28 @@ static int cdn_dp_enable_phy(struct cdn_dp_device *dp, struct cdn_dp_port *port) ret =cdn_dp_grf_write (dp,GRF_SOC_CON26 ,DPTX_HPD_SEL_MASK |DPTX_HPD_SEL );if (ret) { -DRM_DEV_ERROR (dp->dev,"Failed to write HPD_SEL %d\n" , ret); +DRM_DEV_ERROR (dev,"Failed to write HPD_SEL %d\n" , ret); goto err_power_on; } - ret =cdn_dp_get_hpd_status (dp); + ret =cdns_mhdp_get_hpd_status (&dp->mhdp);if (ret <=0 ) {if (!ret) -DRM_DEV_ERROR (dp->dev,"hpd does not exist\n" ); +DRM_DEV_ERROR (dev,"hpd does not exist\n" ); goto err_power_on; } ret =extcon_get_property (port->extcon,EXTCON_DISP_DP ,EXTCON_PROP_USB_TYPEC_POLARITY , &property);if (ret) { -DRM_DEV_ERROR (dp->dev,"get property failed\n" ); +DRM_DEV_ERROR (dev,"get property failed\n" ); goto err_power_on; } port->lanes =cdn_dp_get_port_lanes (port); - ret =cdn_dp_set_host_cap (dp, port->lanes, property.intval); + ret =cdns_mhdp_set_host_cap (&dp->mhdp, port->lanes, property.intval);if (ret) { -DRM_DEV_ERROR (dp->dev,"set host capabilities failed: %d\n" , +DRM_DEV_ERROR (dev,"set host capabilities failed: %d\n" , ret); goto err_power_on; }
@@ -436,7 +442,7 @@ static int cdn_dp_enable_phy(struct cdn_dp_device *dp, struct cdn_dp_port *port) err_power_on:if (phy_power_off (port->phy)) -DRM_DEV_ERROR (dp->dev,"phy power off failed: %d" , ret); +DRM_DEV_ERROR (dev,"phy power off failed: %d" , ret);else port->phy_enabled = false;
@@ -454,7 +460,8 @@ static int cdn_dp_disable_phy(struct cdn_dp_device *dp,if (port->phy_enabled) { ret =phy_power_off (port->phy);if (ret) { -DRM_DEV_ERROR (dp->dev,"phy power off failed: %d" , ret); +DRM_DEV_ERROR (dp->mhdp.dev, +"phy power off failed: %d" , ret);return ret; } }
@@ -478,16 +485,16 @@ static int cdn_dp_disable(struct cdn_dp_device *dp) ret =cdn_dp_grf_write (dp,GRF_SOC_CON26 ,DPTX_HPD_SEL_MASK |DPTX_HPD_DEL );if (ret) { -DRM_DEV_ERROR (dp->dev,"Failed to clear hpd sel %d\n" , +DRM_DEV_ERROR (dp->mhdp.dev,"Failed to clear hpd sel %d\n" , ret);return ret; } -cdn_dp_set_firmware_active (dp, false); +cdns_mhdp_set_firmware_active (&dp->mhdp, false);cdn_dp_clk_disable (dp); dp->active = false; - dp->link.rate =0 ; - dp->link.num_lanes =0 ; + dp->mhdp.link.rate =0 ; + dp->mhdp.link.num_lanes =0 ;if (!dp->connected) {kfree (dp->edid); dp->edid =NULL ;
@@ -500,11 +507,11 @@ static int cdn_dp_enable(struct cdn_dp_device *dp) {int ret, i, lanes;struct cdn_dp_port *port; +struct device *dev = dp->mhdp.dev; port =cdn_dp_connected_port (dp);if (!port) { -DRM_DEV_ERROR (dp->dev, -"Can't enable without connection\n" ); +DRM_DEV_ERROR (dev,"Can't enable without connection\n" );return -ENODEV ; }
@@ -517,7 +524,7 @@ static int cdn_dp_enable(struct cdn_dp_device *dp) ret =cdn_dp_firmware_init (dp);if (ret) { -DRM_DEV_ERROR (dp->dev,"firmware init failed: %d" , ret); +DRM_DEV_ERROR (dp->mhdp.dev,"firmware init failed: %d" , ret); goto err_clk_disable; }
@@ -551,8 +558,9 @@ static void cdn_dp_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *adjusted) {struct cdn_dp_device *dp =encoder_to_dp (encoder); -struct drm_display_info *display_info = &dp->connector.display_info; -struct video_info *video = &dp->video_info; +struct drm_display_info *display_info = + &dp->mhdp.connector.display_info; +struct video_info *video = &dp->mhdp.video_info;switch (display_info->bpc) {case 10 :
@@ -570,7 +578,7 @@ static void cdn_dp_encoder_mode_set(struct drm_encoder *encoder, video->v_sync_polarity = !!(mode->flags &DRM_MODE_FLAG_NVSYNC ); video->h_sync_polarity = !!(mode->flags &DRM_MODE_FLAG_NHSYNC ); -memcpy (&dp->mode, adjusted,sizeof (*mode)); +memcpy (&dp->mhdp.mode, adjusted,sizeof (*mode)); }static bool cdn_dp_check_link_status (struct cdn_dp_device *dp)
@@ -579,11 +587,11 @@ static bool cdn_dp_check_link_status(struct cdn_dp_device *dp)struct cdn_dp_port *port =cdn_dp_connected_port (dp);u8 sink_lanes =drm_dp_max_lane_count (dp->dpcd); -if (!port || !dp->link.rate || !dp->link.num_lanes) +if (!port || !dp->mhdp.link.rate || !dp->mhdp.link.num_lanes)return false; -if (cdn_dp_dpcd_read (dp,DP_LANE0_1_STATUS , link_status, -DP_LINK_STATUS_SIZE )) { +if (cdns_mhdp_dpcd_read (&dp->mhdp,DP_LANE0_1_STATUS , link_status, +DP_LINK_STATUS_SIZE )) {DRM_ERROR ("Failed to get link status\n" );return false; }
@@ -595,15 +603,16 @@ static bool cdn_dp_check_link_status(struct cdn_dp_device *dp)static void cdn_dp_encoder_enable (struct drm_encoder *encoder) {struct cdn_dp_device *dp =encoder_to_dp (encoder); +struct device *dev = dp->mhdp.dev;int ret, val; - ret =drm_of_encoder_active_endpoint_id (dp->dev->of_node, encoder); + ret =drm_of_encoder_active_endpoint_id (dev->of_node, encoder);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"Could not get vop id, %d" , ret); +DRM_DEV_ERROR (dev,"Could not get vop id, %d" , ret);return ; } -DRM_DEV_DEBUG_KMS (dp->dev,"vop %s output to cdn-dp\n" , +DRM_DEV_DEBUG_KMS (dev,"vop %s output to cdn-dp\n" , (ret) ?"LIT" :"BIG" );if (ret) val =DP_SEL_VOP_LIT | (DP_SEL_VOP_LIT <<16 );
@@ -618,33 +627,33 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder) ret =cdn_dp_enable (dp);if (ret) { -DRM_DEV_ERROR (dp->dev,"Failed to enable encoder %d\n" , +DRM_DEV_ERROR (dev,"Failed to enable encoder %d\n" , ret); goto out; }if (!cdn_dp_check_link_status (dp)) { - ret =cdn_dp_train_link (dp); + ret =cdns_mhdp_train_link (&dp->mhdp);if (ret) { -DRM_DEV_ERROR (dp->dev,"Failed link train %d\n" , ret); +DRM_DEV_ERROR (dev,"Failed link train %d\n" , ret); goto out; } } - ret =cdn_dp_set_video_status (dp,CONTROL_VIDEO_IDLE ); + ret =cdns_mhdp_set_video_status (&dp->mhdp,CONTROL_VIDEO_IDLE );if (ret) { -DRM_DEV_ERROR (dp->dev,"Failed to idle video %d\n" , ret); +DRM_DEV_ERROR (dev,"Failed to idle video %d\n" , ret); goto out; } - ret =cdn_dp_config_video (dp); + ret =cdns_mhdp_config_video (&dp->mhdp);if (ret) { -DRM_DEV_ERROR (dp->dev,"Failed to config video %d\n" , ret); +DRM_DEV_ERROR (dev,"Failed to config video %d\n" , ret); goto out; } - ret =cdn_dp_set_video_status (dp,CONTROL_VIDEO_VALID ); + ret =cdns_mhdp_set_video_status (&dp->mhdp,CONTROL_VIDEO_VALID );if (ret) { -DRM_DEV_ERROR (dp->dev,"Failed to valid video %d\n" , ret); +DRM_DEV_ERROR (dev,"Failed to valid video %d\n" , ret); goto out; } out:
@@ -660,7 +669,8 @@ static void cdn_dp_encoder_disable(struct drm_encoder *encoder)if (dp->active) { ret =cdn_dp_disable (dp);if (ret) { -DRM_DEV_ERROR (dp->dev,"Failed to disable encoder %d\n" , +DRM_DEV_ERROR (dp->mhdp.dev, +"Failed to disable encoder %d\n" , ret); } }
@@ -704,7 +714,7 @@ static const struct drm_encoder_funcs cdn_dp_encoder_funcs = {static int cdn_dp_parse_dt (struct cdn_dp_device *dp) { -struct device *dev = dp->dev; +struct device *dev = dp->mhdp.dev;struct device_node *np = dev->of_node;struct platform_device *pdev =to_platform_device (dev);struct resource *res;
@@ -716,10 +726,10 @@ static int cdn_dp_parse_dt(struct cdn_dp_device *dp) } res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - dp->regs =devm_ioremap_resource (dev, res); -if (IS_ERR (dp->regs)) { + dp->mhdp.regs =devm_ioremap_resource (dev, res); +if (IS_ERR (dp->mhdp.regs)) {DRM_DEV_ERROR (dev,"ioremap reg failed\n" ); -return PTR_ERR (dp->regs); +return PTR_ERR (dp->mhdp.regs); } dp->core_clk =devm_clk_get (dev,"core-clk" );
@@ -734,10 +744,10 @@ static int cdn_dp_parse_dt(struct cdn_dp_device *dp)return PTR_ERR (dp->pclk); } - dp->spdif_clk =devm_clk_get (dev,"spdif" ); -if (IS_ERR (dp->spdif_clk)) { + dp->mhdp.spdif_clk =devm_clk_get (dev,"spdif" ); +if (IS_ERR (dp->mhdp.spdif_clk)) {DRM_DEV_ERROR (dev,"cannot get spdif_clk\n" ); -return PTR_ERR (dp->spdif_clk); +return PTR_ERR (dp->mhdp.spdif_clk); } dp->grf_clk =devm_clk_get (dev,"grf" );
@@ -746,10 +756,10 @@ static int cdn_dp_parse_dt(struct cdn_dp_device *dp)return PTR_ERR (dp->grf_clk); } - dp->spdif_rst =devm_reset_control_get (dev,"spdif" ); -if (IS_ERR (dp->spdif_rst)) { + dp->mhdp.spdif_rst =devm_reset_control_get (dev,"spdif" ); +if (IS_ERR (dp->mhdp.spdif_rst)) {DRM_DEV_ERROR (dev,"no spdif reset control found\n" ); -return PTR_ERR (dp->spdif_rst); +return PTR_ERR (dp->mhdp.spdif_rst); } dp->dptx_rst =devm_reset_control_get (dev,"dptx" );
@@ -804,7 +814,7 @@ static int cdn_dp_audio_hw_params(struct device *dev, void *data, goto out; } - ret =cdn_dp_audio_config (dp, &audio); + ret =cdns_mhdp_audio_config (&dp->mhdp, &audio);if (!ret) dp->audio_info = audio;
@@ -822,7 +832,7 @@ static void cdn_dp_audio_shutdown(struct device *dev, void *data)if (!dp->active) goto out; - ret =cdn_dp_audio_stop (dp, &dp->audio_info); + ret =cdns_mhdp_audio_stop (&dp->mhdp, &dp->audio_info);if (!ret) dp->audio_info.format =AFMT_UNUSED ; out:
@@ -841,7 +851,7 @@ static int cdn_dp_audio_digital_mute(struct device *dev, void *data, goto out; } - ret =cdn_dp_audio_mute (dp, enable); + ret =cdns_mhdp_audio_mute (&dp->mhdp, enable); out:mutex_unlock (&dp->lock);
@@ -853,7 +863,8 @@ static int cdn_dp_audio_get_eld(struct device *dev, void *data, {struct cdn_dp_device *dp =dev_get_drvdata (dev); -memcpy (buf, dp->connector.eld,min (sizeof (dp->connector.eld), len)); +memcpy (buf, dp->mhdp.connector.eld, +min (sizeof (dp->mhdp.connector.eld), len));return 0 ; }
@@ -887,6 +898,7 @@ static int cdn_dp_request_firmware(struct cdn_dp_device *dp)int ret;unsigned long timeout = jiffies +msecs_to_jiffies (CDN_FW_TIMEOUT_MS );unsigned long sleep =1000 ; +struct device *dev = dp->mhdp.dev;WARN_ON (!mutex_is_locked (&dp->lock));
@@ -897,13 +909,13 @@ static int cdn_dp_request_firmware(struct cdn_dp_device *dp)mutex_unlock (&dp->lock);while (time_before (jiffies, timeout)) { - ret =request_firmware (&dp->fw,CDN_DP_FIRMWARE , dp->dev); + ret =request_firmware (&dp->fw,CDN_DP_FIRMWARE , dev);if (ret == -ENOENT ) {msleep (sleep); sleep *=2 ;continue ; }else if (ret) { -DRM_DEV_ERROR (dp->dev, +DRM_DEV_ERROR (dev,"failed to request firmware: %d\n" , ret); goto out; }
@@ -913,7 +925,7 @@ static int cdn_dp_request_firmware(struct cdn_dp_device *dp) goto out; } -DRM_DEV_ERROR (dp->dev,"Timed out trying to load firmware\n" ); +DRM_DEV_ERROR (dev,"Timed out trying to load firmware\n" ); ret = -ETIMEDOUT ; out:mutex_lock (&dp->lock);
@@ -924,8 +936,9 @@ static void cdn_dp_pd_event_work(struct work_struct *work) { struct cdn_dp_device *dp = container_of(work, struct cdn_dp_device, event_work); -struct drm_connector *connector = &dp->connector; +struct drm_connector *connector = &dp->mhdp.connector;enum drm_connector_status old_status; +struct device *dev = dp->mhdp.dev;int ret;
@@ -942,44 +955,45 @@ static void cdn_dp_pd_event_work(struct work_struct *work)/* Not connected, notify userspace to disable the block */ if (!cdn_dp_connected_port (dp)) { -DRM_DEV_INFO (dp->dev,"Not connected. Disabling cdn\n" ); +DRM_DEV_INFO (dev,"Not connected. Disabling cdn\n" ); dp->connected = false;/* Connected but not enabled, enable the block */ }else if (!dp->active) { -DRM_DEV_INFO (dp->dev,"Connected, not enabled. Enabling cdn\n" ); +DRM_DEV_INFO (dev,"Connected, not enabled. Enabling cdn\n" ); ret =cdn_dp_enable (dp);if (ret) { -DRM_DEV_ERROR (dp->dev,"Enable dp failed %d\n" , ret); +DRM_DEV_ERROR (dev,"Enable dp failed %d\n" , ret); dp->connected = false; }/* Enabled and connected to a dongle without a sink, notify userspace */ }else if (!cdn_dp_check_sink_connection (dp)) { -DRM_DEV_INFO (dp->dev,"Connected without sink. Assert hpd\n" ); +DRM_DEV_INFO (dev,"Connected without sink. Assert hpd\n" ); dp->connected = false;/* Enabled and connected with a sink, re-train if requested */ }else if (!cdn_dp_check_link_status (dp)) { -unsigned int rate = dp->link.rate; -unsigned int lanes = dp->link.num_lanes; -struct drm_display_mode *mode = &dp->mode; +unsigned int rate = dp->mhdp.link.rate; +unsigned int lanes = dp->mhdp.link.num_lanes; +struct drm_display_mode *mode = &dp->mhdp.mode; -DRM_DEV_INFO (dp->dev,"Connected with sink. Re-train link\n" ); - ret =cdn_dp_train_link (dp); +DRM_DEV_INFO (dev,"Connected with sink. Re-train link\n" ); + ret =cdns_mhdp_train_link (&dp->mhdp);if (ret) { dp->connected = false; -DRM_DEV_ERROR (dp->dev,"Train link failed %d\n" , ret); +DRM_DEV_ERROR (dev,"Train link failed %d\n" , ret); goto out; }/* If training result is changed, update the video config */ if (mode->clock && - (rate != dp->link.rate || lanes != dp->link.num_lanes)) { - ret =cdn_dp_config_video (dp); + (rate != dp->mhdp.link.rate || + lanes != dp->mhdp.link.num_lanes)) { + ret =cdns_mhdp_config_video (&dp->mhdp);if (ret) { dp->connected = false; -DRM_DEV_ERROR (dp->dev, +DRM_DEV_ERROR (dev,"Failed to config video %d\n" , ret); }
@@ -1048,7 +1062,7 @@ static int cdn_dp_bind(struct device *dev, struct device *master, void *data)drm_encoder_helper_add (encoder, &cdn_dp_encoder_helper_funcs); - connector = &dp->connector; + connector = &dp->mhdp.connector; connector->polled =DRM_CONNECTOR_POLL_HPD ; connector->dpms =DRM_MODE_DPMS_OFF ;
@@ -1072,7 +1086,7 @@ static int cdn_dp_bind(struct device *dev, struct device *master, void *data) port = dp->port[i]; port->event_nb.notifier_call = cdn_dp_pd_event; - ret =devm_extcon_register_notifier (dp->dev, port->extcon, + ret =devm_extcon_register_notifier (dp->mhdp.dev, port->extcon,EXTCON_DISP_DP , &port->event_nb);if (ret) {
@@ -1099,7 +1113,7 @@ static void cdn_dp_unbind(struct device *dev, struct device *master, void *data) {struct cdn_dp_device *dp =dev_get_drvdata (dev);struct drm_encoder *encoder = &dp->encoder; -struct drm_connector *connector = &dp->connector; +struct drm_connector *connector = &dp->mhdp.connector;cancel_work_sync (&dp->event_work);cdn_dp_encoder_disable (encoder);
@@ -1159,7 +1173,7 @@ static int cdn_dp_probe(struct platform_device *pdev) dp =devm_kzalloc (dev,sizeof (*dp),GFP_KERNEL );if (!dp)return -ENOMEM ; - dp->dev = dev; + dp->mhdp.dev = dev; match =of_match_node (cdn_dp_dt_ids, pdev->dev.of_node); dp_data = (struct cdn_dp_data *)match->data;
@@ -1204,7 +1218,7 @@ static int cdn_dp_remove(struct platform_device *pdev)struct cdn_dp_device *dp =platform_get_drvdata (pdev);platform_device_unregister (dp->audio_pdev); -cdn_dp_suspend (dp->dev); +cdn_dp_suspend (dp->mhdp.dev);component_del (&pdev->dev, &cdn_dp_component_ops);return 0 ;
@@ -1214,7 +1228,7 @@ static void cdn_dp_shutdown(struct platform_device *pdev) {struct cdn_dp_device *dp =platform_get_drvdata (pdev); -cdn_dp_suspend (dp->dev); +cdn_dp_suspend (dp->mhdp.dev); }static const struct dev_pm_ops cdn_dp_pm_ops = {
drivers/gpu/drm/rockchip/cdn-dp-core.h +2 -38
@@ -20,38 +20,10 @@#include <drm/drm_dp_helper.h> #include <drm/drm_panel.h> #include "rockchip_drm_drv.h" +#include "cdn-dp-reg.h" #define MAX_PHY 2 -enum audio_format { -AFMT_I2S =0 , -AFMT_SPDIF =1 , -AFMT_UNUSED , -}; - -struct audio_info { -enum audio_format format; -int sample_rate; -int channels; -int sample_width; -}; - -enum vic_pxl_encoding_format { -PXL_RGB =0x1 , -YCBCR_4_4_4 =0x2 , -YCBCR_4_2_2 =0x4 , -YCBCR_4_2_0 =0x8 , -Y_ONLY =0x10 , -}; - -struct video_info { -bool h_sync_polarity; -bool v_sync_polarity; -bool interlaced; -int color_depth; -enum vic_pxl_encoding_format color_fmt; -}; -struct cdn_firmware_header {u32 size_bytes;/* size of the entire header+image(s) in bytes */ u32 header_size;/* size of just the header in bytes */
@@ -70,11 +42,9 @@ struct cdn_dp_port { };struct cdn_dp_device { -struct device *dev; +struct cdns_mhdp_device mhdp;struct drm_device *drm_dev; -struct drm_connector connector;struct drm_encoder encoder; -struct drm_display_mode mode;struct platform_device *audio_pdev;struct work_struct event_work;struct edid *edid;
@@ -85,22 +55,16 @@ struct cdn_dp_device {bool suspended;const struct firmware *fw;/* cdn dp firmware */ -unsigned int fw_version;/* cdn fw version */ bool fw_loaded; -void __iomem *regs;struct regmap *grf;struct clk *core_clk;struct clk *pclk; -struct clk *spdif_clk;struct clk *grf_clk; -struct reset_control *spdif_rst;struct reset_control *dptx_rst;struct reset_control *apb_rst;struct reset_control *core_rst;struct audio_info audio_info; -struct video_info video_info; -struct drm_dp_link link;struct cdn_dp_port *port[MAX_PHY ];u8 ports;u8 lanes;
drivers/gpu/drm/rockchip/cdn-dp-reg.c +219 -209
996 lines not on this page · raw message
drivers/gpu/drm/rockchip/cdn-dp-reg.h +93 -21
124 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v3 1/5] drm/rockchip: prepare common code for cdns and rk dpi/dp driver
Hi Damian,
Quite late but.
Quoted 12 lines · Damian Kos
- Extracted common fields from
cdn_dp_deviceto a newcdns_mhdp_devicestructure which will be used by two separate drivers later on.
- Moved some datatypes (audio_format,audio_info,vic_pxl_encoding_format,video_info) fromcdn-dp-core.ctocdn-dp-reg.h.
- Changed prefixes fromcdn_dptocdns_mhdp
cdn -> cdns to match the other Cadence's drivers
dp -> mhdp to distinguish it from a "just a DP" as the IP underneath
this registers map can be a HDMI (which is internally different, but the interface for commands, events is pretty much the same).
- Modifiedcdn-dp-core.cto use the new driver structure and new function names.
Quoted 1 line
Signed-off-by Damian Kos <[email protected]>
Many changes, hard to review. Anyway:
--
Regards
Andrzej
Damian Kos
Reviewed-by Andrzej HajdaRE: [PATCH v3 1/5] drm/rockchip: prepare common code for cdns and rk dpi/dp driver
Thank you, Andrzej! I was a bit afraid that our patches are a bit too messy and thus ignored 😊 Anyway, this patch (1/5) should be the last one that will cause such chaos in the DRM area.
Regards,
Damian
-----Original Message-----
From: Andrzej Hajda <[email protected]>
Sent: Thursday, September 13, 2018 12:01
To: Damian Kos <[email protected]>; David Airlie <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>; Archit Taneja <[email protected]>; Laurent Pinchart <[email protected]>; Gustavo Padovan <[email protected]>; Maarten Lankhorst <[email protected]>; Sean Paul <[email protected]>; Sandy Huang <[email protected]>; Heiko Stübner <[email protected]>; Quentin Schulz <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: Przemyslaw Gaj <[email protected]>; Lukasz Tyrala <[email protected]>; Scott Telford <[email protected]>; Artur Jedrysek <[email protected]>; Piotr Sroka <[email protected]>
Subject: Re: [PATCH v3 1/5] drm/rockchip: prepare common code for cdns and rk dpi/dp driver
EXTERNAL MAIL
Hi Damian,
Quite late but.
Quoted 12 lines · Damian Kos
- Extracted common fields from
cdn_dp_deviceto a newcdns_mhdp_devicestructure which will be used by two separate drivers later on.
- Moved some datatypes (audio_format,audio_info,vic_pxl_encoding_format,video_info) fromcdn-dp-core.ctocdn-dp-reg.h.
- Changed prefixes fromcdn_dptocdns_mhdp
cdn -> cdns to match the other Cadence's drivers
dp -> mhdp to distinguish it from a "just a DP" as the IP underneath
this registers map can be a HDMI (which is internally different, but the interface for commands, events is pretty much the same).
- Modifiedcdn-dp-core.cto use the new driver structure and new function names.
Quoted 1 line
Signed-off-by Damian Kos <[email protected]>
Many changes, hard to review. Anyway:
--
Regards
Andrzej
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v3 2/5 drm/dp: fix link probing for devices supporting DP 1.4+
In reply to Damian KosFrom: Quentin Schulz <[email protected]>
DP 1.4 introduced a DP_EXTENDED_RCVR_CAPA_FIELD_PRESENT bit in DP_TRAINING_AUX_RD_INTERVAL register. If set, DPCD registers from DP_DPCD_REV to DP_ADAPTER_CAP should be retrieved starting from DP_DPCD_REV_EXTENDED. All registers are copied except DP_DPCD_REV, DP_MAX_LINK_RATE and DP_DOWNSTREAMPORT_PRESENT which represent the "true capabilities" of DPRX device.
Original DP_DPCD_REV, DP_MAX_LINK_RATE and DP_DOWNSTREAMPORT_PRESENT might falsely return lower capabilities to "avoid interoperability issues with some of the existing DP Source devices that malfunction when they discover the higher capabilities within those three registers.".
Before DP 1.4, DP_EXTENDED_RCVR_CAPA_FIELD_PRESENT bit was reserved and read 0 so it's safe to check against it even if DP revision is <1.4
--- drivers/gpu/drm/drm_dp_helper.c | 30 +++++++++++++++++++++++++++++- include/drm/drm_dp_helper.h | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_helper.c +29 -1
@@ -370,10 +370,38 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) {u8 values[3 ];int err; +unsigned int addr;memset (link,0 ,sizeof (*link)); - err =drm_dp_dpcd_read (aux,DP_DPCD_REV , values,sizeof (values)); +/* +* DP 1.4 introduced a DP_EXTENDED_RCVR_CAPA_FIELD_PRESENT bit in +* DP_TRAINING_AUX_RD_INTERVAL register. If set, DPCD registers from +* DP_DPCD_REV to DP_ADAPTER_CAP should be retrieved starting from +* DP_DPCD_REV_EXTENDED. All registers are copied except DP_DPCD_REV, +* DP_MAX_LINK_RATE and DP_DOWNSTREAMPORT_PRESENT which represent the +* "true capabilities" of DPRX device. +* +* Original DP_DPCD_REV, DP_MAX_LINK_RATE and DP_DOWNSTREAMPORT_PRESENT +* might falsely return lower capabilities to "avoid interoperability +* issues with some of the existing DP Source devices that malfunction +* when they discover the higher capabilities within those three +* registers.". +* +* Before DP 1.4, DP_EXTENDED_RCVR_CAPA_FIELD_PRESENT bit was reserved +* and read 0 so it's safe to check against it even if DP revision is +* <1.4 +*/ + err =drm_dp_dpcd_readb (aux,DP_TRAINING_AUX_RD_INTERVAL , values); +if (err <0 ) +return err; + +if (values[0 ] &DP_EXTENDED_RCVR_CAPA_FIELD_PRESENT ) + addr =DP_DP13_DPCD_REV ; +else + addr =DP_DPCD_REV ; + + err =drm_dp_dpcd_read (aux, addr, values,sizeof (values));if (err <0 )return err;
include/drm/drm_dp_helper.h +1 -1
@@ -125,7 +125,7 @@#define DP_TRAINING_AUX_RD_INTERVAL 0x00e/* XXX 1.2? */ # define DP_TRAINING_AUX_RD_MASK 0x7F/* DP 1.3 */ -# define DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT (1 << 7)/* DP 1.3 */ +# define DP_EXTENDED_RCVR_CAPA_FIELD_PRESENT BIT(7)/* 1.3 */ #define DP_ADAPTER_CAP 0x00f/* 1.2 */ # define DP_FORCE_LOAD_SENSE_CAP (1 << 0)
Signature · 1 line
2.17.1
Re: [PATCH v3 2/5] drm/dp: fix link probing for devices supporting DP 1.4+
Quoted 14 lines · Damian Kos
From: Quentin Schulz <[email protected]>
DP 1.4 introduced a
DP_EXTENDED_RCVR_CAPA_FIELD_PRESENTbit inDP_TRAINING_AUX_RD_INTERVALregister. If set, DPCD registers fromDP_DPCD_REVtoDP_ADAPTER_CAPshould be retrieved starting fromDP_DPCD_REV_EXTENDED. All registers are copied exceptDP_DPCD_REV,DP_MAX_LINK_RATEandDP_DOWNSTREAMPORT_PRESENTwhich represent the "true capabilities" of DPRX device.Original
DP_DPCD_REV,DP_MAX_LINK_RATEandDP_DOWNSTREAMPORT_PRESENTmight falsely return lower capabilities to "avoid interoperability issues with some of the existing DP Source devices that malfunction when they discover the higher capabilities within those three registers.".
Quoted 4 lines
Before DP 1.4,
DP_EXTENDED_RCVR_CAPA_FIELD_PRESENTbit was reserved and read 0 so it's safe to check against it even if DP revision is <1.4Signed-off-by Damian Kos <[email protected]>
Here and in next patches signed-off-by of the author is missing.
With that fixed:
--
Regards
Andrzej
PATCH v3 3/5 drm/dp: make dp_link_status and dp_get_lane_status usable from outside of the core
In reply to Damian KosFrom: Quentin Schulz <[email protected]>
dp_link_status and dp_get_lane_status are pretty generic and can be used for other means, so let's make it "public".
This adds drm_dp_link_status and drm_dp_get_lane_status to the header file and add the appropriate EXPORT_SYMBOL for it so that it can be used by other drivers, be they compiled built-in or as modules.
--- drivers/gpu/drm/drm_dp_helper.c | 20 +++++++++++--------- include/drm/drm_dp_helper.h | 3 +++ 2 files changed, 14 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_dp_helper.c +11 -9
@@ -43,19 +43,21 @@*/ /* Helpers for DP link training */ -static u8 dp_link_status (const u8 link_status[DP_LINK_STATUS_SIZE ],int r) +u8 drm_dp_link_status (const u8 link_status[DP_LINK_STATUS_SIZE ],int r) {return link_status[r -DP_LANE0_1_STATUS ]; } +EXPORT_SYMBOL (drm_dp_link_status); -static u8 dp_get_lane_status (const u8 link_status[DP_LINK_STATUS_SIZE ], +u8 drm_dp_get_lane_status (const u8 link_status[DP_LINK_STATUS_SIZE ],int lane) {int i =DP_LANE0_1_STATUS + (lane >>1 );int s = (lane &1 ) *4 ; -u8 l =dp_link_status (link_status, i); +u8 l =drm_dp_link_status (link_status, i);return (l >> s) &0xf ; } +EXPORT_SYMBOL (drm_dp_get_lane_status);bool drm_dp_channel_eq_ok (const u8 link_status[DP_LINK_STATUS_SIZE ],int lane_count)
@@ -64,12 +66,12 @@ bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],u8 lane_status;int lane; - lane_align =dp_link_status (link_status, -DP_LANE_ALIGN_STATUS_UPDATED ); + lane_align =drm_dp_link_status (link_status, +DP_LANE_ALIGN_STATUS_UPDATED );if ((lane_align &DP_INTERLANE_ALIGN_DONE ) ==0 )return false;for (lane =0 ; lane < lane_count; lane++) { - lane_status =dp_get_lane_status (link_status, lane); + lane_status =drm_dp_get_lane_status (link_status, lane);if ((lane_status &DP_CHANNEL_EQ_BITS ) !=DP_CHANNEL_EQ_BITS )return false; }
@@ -84,7 +86,7 @@ bool drm_dp_clock_recovery_ok(const u8 link_status[DP_LINK_STATUS_SIZE],u8 lane_status;for (lane =0 ; lane < lane_count; lane++) { - lane_status =dp_get_lane_status (link_status, lane); + lane_status =drm_dp_get_lane_status (link_status, lane);if ((lane_status &DP_LANE_CR_DONE ) ==0 )return false; }
@@ -99,7 +101,7 @@ u8 drm_dp_get_adjust_request_voltage(const u8 link_status[DP_LINK_STATUS_SIZE],int s = ((lane &1 ) ?DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT :DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT ); -u8 l =dp_link_status (link_status, i); +u8 l =drm_dp_link_status (link_status, i);return ((l >> s) &0x3 ) <<DP_TRAIN_VOLTAGE_SWING_SHIFT ; }
@@ -112,7 +114,7 @@ u8 drm_dp_get_adjust_request_pre_emphasis(const u8 link_status[DP_LINK_STATUS_SIint s = ((lane &1 ) ?DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT :DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT ); -u8 l =dp_link_status (link_status, i); +u8 l =drm_dp_link_status (link_status, i);return ((l >> s) &0x3 ) <<DP_TRAIN_PRE_EMPHASIS_SHIFT ; }
include/drm/drm_dp_helper.h +3 -0
@@ -952,6 +952,9 @@#define DP_MST_LOGICAL_PORT_0 8#define DP_LINK_STATUS_SIZE 6 + +u8 drm_dp_link_status (const u8 link_status[DP_LINK_STATUS_SIZE ],int r); +u8 drm_dp_get_lane_status (const u8 link_status[DP_LINK_STATUS_SIZE ],int lane);bool drm_dp_channel_eq_ok (const u8 link_status[DP_LINK_STATUS_SIZE ],int lane_count); bool drm_dp_clock_recovery_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
Signature · 1 line
2.17.1
Re: [PATCH v3 3/5] drm/dp: make dp_link_status and dp_get_lane_status usable from outside of the core
Quoted 8 lines · Damian Kos
From: Quentin Schulz <[email protected]>
dp_link_statusanddp_get_lane_statusare pretty generic and can be used for other means, so let's make it "public".This adds
drm_dp_link_statusanddrm_dp_get_lane_statusto the header file and add the appropriateEXPORT_SYMBOLfor it so that it can be used by other drivers, be they compiled built-in or as modules.
If you want to export them please document functions and their arguments. Moreover, these functions are so tiny, so they can be defined as inline.
Quoted 2 lines
Signed-off-by Damian Kos <[email protected]>
No author sign-off.
Regards
Andrzej
Quoted 91 lines
--- drivers/gpu/drm/drm_dp_helper.c | 20 +++++++++++--------- include/drm/drm_dp_helper.h | 3 +++ 2 files changed, 14 insertions(+), 9 deletions(-)drivers/gpu/drm/drm_dp_helper.c +11
-9@@ -43,19 +43,21 @@*/ /* Helpers for DP link training */ -static u8 dp_link_status (const u8 link_status[DP_LINK_STATUS_SIZE ],int r) +u8 drm_dp_link_status (const u8 link_status[DP_LINK_STATUS_SIZE ],int r) {return link_status[r -DP_LANE0_1_STATUS ]; } +EXPORT_SYMBOL (drm_dp_link_status); -static u8 dp_get_lane_status (const u8 link_status[DP_LINK_STATUS_SIZE ], +u8 drm_dp_get_lane_status (const u8 link_status[DP_LINK_STATUS_SIZE ],int lane) {int i =DP_LANE0_1_STATUS + (lane >>1 );int s = (lane &1 ) *4 ; -u8 l =dp_link_status (link_status, i); +u8 l =drm_dp_link_status (link_status, i);return (l >> s) &0xf ; } +EXPORT_SYMBOL (drm_dp_get_lane_status);bool drm_dp_channel_eq_ok (const u8 link_status[DP_LINK_STATUS_SIZE ],int lane_count)@@ -64,12 +66,12 @@ bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],u8 lane_status;int lane; - lane_align =dp_link_status (link_status, -DP_LANE_ALIGN_STATUS_UPDATED ); + lane_align =drm_dp_link_status (link_status, +DP_LANE_ALIGN_STATUS_UPDATED );if ((lane_align &DP_INTERLANE_ALIGN_DONE ) ==0 )return false;for (lane =0 ; lane < lane_count; lane++) { - lane_status =dp_get_lane_status (link_status, lane); + lane_status =drm_dp_get_lane_status (link_status, lane);if ((lane_status &DP_CHANNEL_EQ_BITS ) !=DP_CHANNEL_EQ_BITS )return false; }@@ -84,7 +86,7 @@ bool drm_dp_clock_recovery_ok(const u8 link_status[DP_LINK_STATUS_SIZE],u8 lane_status;for (lane =0 ; lane < lane_count; lane++) { - lane_status =dp_get_lane_status (link_status, lane); + lane_status =drm_dp_get_lane_status (link_status, lane);if ((lane_status &DP_LANE_CR_DONE ) ==0 )return false; }@@ -99,7 +101,7 @@ u8 drm_dp_get_adjust_request_voltage(const u8 link_status[DP_LINK_STATUS_SIZE],int s = ((lane &1 ) ?DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT :DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT ); -u8 l =dp_link_status (link_status, i); +u8 l =drm_dp_link_status (link_status, i);return ((l >> s) &0x3 ) <<DP_TRAIN_VOLTAGE_SWING_SHIFT ; }@@ -112,7 +114,7 @@ u8 drm_dp_get_adjust_request_pre_emphasis(const u8 link_status[DP_LINK_STATUS_SIint s = ((lane &1 ) ?DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT :DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT ); -u8 l =dp_link_status (link_status, i); +u8 l =drm_dp_link_status (link_status, i);return ((l >> s) &0x3 ) <<DP_TRAIN_PRE_EMPHASIS_SHIFT ; }include/drm/drm_dp_helper.h +3
-0@@ -952,6 +952,9 @@#define DP_MST_LOGICAL_PORT_0 8#define DP_LINK_STATUS_SIZE 6 + +u8 drm_dp_link_status (const u8 link_status[DP_LINK_STATUS_SIZE ],int r); +u8 drm_dp_get_lane_status (const u8 link_status[DP_LINK_STATUS_SIZE ],int lane);bool drm_dp_channel_eq_ok (const u8 link_status[DP_LINK_STATUS_SIZE ],int lane_count); bool drm_dp_clock_recovery_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
PATCH v3 4/5 dt-bindings: drm/bridge Document Cadence MHDP DPI/DP bridge bindings
In reply to Damian KosFrom: Quentin Schulz <[email protected]>
--- .../bindings/display/bridge/cdns,mhdp.txt | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,mhdp.txt
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.txt new file +43 -0
@@ -0,0 +1,43 @@ +Cadence MHDP bridge +========================== + +The Cadence MHDP bridge is a DPI to DP bridge. + +Required properties: +- compatible: should be "cdns,mhdp8546", +- reg: physical base address and length of the controller's registers, +- clocks: DP bridge clock, it's used by the IP to know how to translate + a number of clock cycles into a time (which is used to comply + with DP standard timings and delays), + +Required subnodes: +- ports: Ports as described in Documentation/devictree/bindings/graph.txt + Port 0 - input port representing the DP bridge input + Port 1 - output port representing the DP bridge output + +Example: + + mhdp: dp-bridge@f0fb000000 { + compatible = "cdns,mhdp8546"; + reg = <0xf0 0xfb000000 0x0 0x1000000>; + clocks = <&mhdp_clock>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dp_bridge_input: endpoint { + remote-endpoint = <&xxx_dpi_output>; + }; + }; + + port@1 { + reg = <1>; + dp_bridge_output: endpoint { + remote-endpoint = <&xxx_dp_connector_input>; + }; + }; + }; + };
Signature · 1 line
2.17.1
Re: [PATCH v3 4/5] dt-bindings: drm/bridge Document Cadence MHDP DPI/DP bridge bindings
Quoted 8 lines · Damian Kos
From: Quentin Schulz <[email protected]>
Signed-off-by Damian Kos <[email protected]>--- .../bindings/display/bridge/cdns,mhdp.txt | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,mhdp.txt
Re: [PATCH v3 4/5] dt-bindings: drm/bridge Document Cadence MHDP DPI/DP bridge bindings
In reply to Damian KosQuoted 3 lines · Damian Kos
From: Quentin Schulz <[email protected]>
Signed-off-by Damian Kos <[email protected]>
No commit message, no author's signoff.
--
Regards
Andrzej
Quoted 54 lines
--- .../bindings/display/bridge/cdns,mhdp.txt | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,mhdp.txtDocumentation/devicetree/bindings/display/bridge/cdns,mhdp.txt new file +43
-0@@ -0,0 +1,43 @@ +Cadence MHDP bridge +========================== + +The Cadence MHDP bridge is a DPI to DP bridge. + +Required properties: +- compatible: should be "cdns,mhdp8546", +- reg: physical base address and length of the controller's registers, +- clocks: DP bridge clock, it's used by the IP to know how to translate + a number of clock cycles into a time (which is used to comply + with DP standard timings and delays), + +Required subnodes: +- ports: Ports as described in Documentation/devictree/bindings/graph.txt + Port 0 - input port representing the DP bridge input + Port 1 - output port representing the DP bridge output + +Example: + + mhdp: dp-bridge@f0fb000000 { + compatible = "cdns,mhdp8546"; + reg = <0xf0 0xfb000000 0x0 0x1000000>; + clocks = <&mhdp_clock>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dp_bridge_input: endpoint { + remote-endpoint = <&xxx_dpi_output>; + }; + }; + + port@1 { + reg = <1>; + dp_bridge_output: endpoint { + remote-endpoint = <&xxx_dp_connector_input>; + }; + }; + }; + };
PATCH v3 5/5 drm/bridge: add preliminary driver for cadence dpi/dp bridge
In reply to Damian KosFrom: Quentin Schulz <[email protected]>
This patch finally adds the preliminary driver for Cadence MHDP DPI/DP bridge.
Changes made in the low level driver (cdn-dp-reg.*):
- moved it to from drivers/gpu/drm/rockchip to drivers/gpu/drm/bridge/cdns-mhdp-common.*
- functions for sending/receiving commands are now public
- added functions for reading registers and link training adjustment
Changes made in RK's driver (cdn-dp-core.*):
- Moved audio_info and audio_pdev fields from cdn_dp_device to cdns_mhdp_device structure.
---
drivers/gpu/drm/bridge/Kconfig | 9 +
drivers/gpu/drm/bridge/Makefile | 3 +
.../cdns-mhdp-common.c} | 137 +-
.../cdns-mhdp-common.h} | 21 +-
drivers/gpu/drm/bridge/cdns-mhdp.c | 1308 +++++++++++++++++
drivers/gpu/drm/rockchip/Kconfig | 1 +
drivers/gpu/drm/rockchip/Makefile | 4 +-
drivers/gpu/drm/rockchip/cdn-dp-core.c | 16 +-
drivers/gpu/drm/rockchip/cdn-dp-core.h | 4 +-
9 files changed, 1484 insertions(+), 19 deletions(-)
rename drivers/gpu/drm/{rockchip/cdn-dp-reg.c => bridge/cdns-mhdp-common.c} (87%)
rename drivers/gpu/drm/{rockchip/cdn-dp-reg.h => bridge/cdns-mhdp-common.h} (95%)
create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp.cdrivers/gpu/drm/bridge/Kconfig +9 -0
@@ -35,6 +35,15 @@ config DRM_CDNS_DSI Support Cadence DPI to DSI bridge. This is an internal bridge and is meant to be directly embedded in a SoC. +config DRM_CDNS_MHDP + tristate "Cadence DPI/DP bridge" + select DRM_KMS_HELPER + select DRM_PANEL_BRIDGE + depends on OF + help + Support Cadence DPI to DP bridge. This is an internal + bridge and is meant to be directly embedded in a SoC. + config DRM_DUMB_VGA_DAC tristate "Dumb VGA DAC Bridge support" depends on OF
drivers/gpu/drm/bridge/Makefile +3 -0
@@ -16,4 +16,7 @@ obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/ obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/ obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o +obj-$(CONFIG_DRM_CDNS_MHDP) += mhdp8546.o obj-y += synopsys/ + +mhdp8546-objs := cdns-mhdp-common.o cdns-mhdp.o
drivers/gpu/drm/bridge/cdns-mhdp-common.c renamed from drivers/gpu/drm/rockchip/cdn-dp-reg.c +133 -4
260 lines not on this page · raw message
drivers/gpu/drm/bridge/cdns-mhdp-common.h renamed from drivers/gpu/drm/rockchip/cdn-dp-reg.h +18 -3
@@ -12,10 +12,13 @@* GNU General Public License for more details. */ -#ifndef _CDN_DP_REG_H -#define _CDN_DP_REG_H +#ifndef CDNS_MHDP_COMMON_H_ +#define CDNS_MHDP_COMMON_H_ #include <linux/bitops.h> +#include <drm/drm_dp_helper.h> +#include <drm/drm_connector.h> +#include <drm/drm_bridge.h> #define ADDR_IMEM 0x10000#define ADDR_DMEM 0x20000
@@ -327,6 +330,7 @@#define GENERAL_TEST_ECHO 0x02#define GENERAL_BUS_SETTINGS 0x03#define GENERAL_TEST_ACCESS 0x04 +#define GENERAL_REGISTER_READ 0x07#define DPTX_SET_POWER_MNG 0x00#define DPTX_SET_HOST_CAPABILITIES 0x01
@@ -346,6 +350,7 @@#define DPTX_SET_LINK_BREAK_POINT 0x0f#define DPTX_FORCE_LANES 0x10#define DPTX_HPD_STATE 0x11 +#define DPTX_ADJUST_LT 0x12#define FW_STANDBY 0#define FW_ACTIVE 1
@@ -517,6 +522,9 @@ struct cdns_mhdp_device {struct clk *spdif_clk;struct reset_control *spdif_rst; +struct platform_device *audio_pdev; +struct audio_info audio_info; +struct drm_dp_aux aux;struct cdns_mhdp_host host;struct cdns_mhdp_sink sink;
@@ -551,4 +559,11 @@ int cdns_mhdp_audio_stop(struct cdns_mhdp_device *mhdp,int cdns_mhdp_audio_mute (struct cdns_mhdp_device *mhdp,bool enable);int cdns_mhdp_audio_config (struct cdns_mhdp_device *mhdp,struct audio_info *audio); -#endif /* _CDN_DP_REG_H */ +int cdns_mhdp_reg_read (struct cdns_mhdp_device *mhdp,u32 addr,u32 *value); +int cdns_mhdp_reg_write (struct cdns_mhdp_device *mhdp,u16 addr,u32 val); +int cdns_mhdp_reg_write_bit (struct cdns_mhdp_device *mhdp,u16 addr, +u8 start_bit,u8 bits_no,u32 val); +int cdns_mhdp_adjust_lt (struct cdns_mhdp_device *mhdp,u8 nlanes, +u16 udelay,u8 *lanes_data, +u8 *dpcd); +#endif /* CDNS_MHDP_COMMON_H_ */
drivers/gpu/drm/bridge/cdns-mhdp.c new file +1308 -0
1,308 lines not on this page · raw message
drivers/gpu/drm/rockchip/Kconfig +1 -0
@@ -28,6 +28,7 @@ config ROCKCHIP_ANALOGIX_DP config ROCKCHIP_CDN_DP bool "Rockchip cdn DP" depends on EXTCON=y || (EXTCON=m && DRM_ROCKCHIP=m) + select DRM_CDNS_MHDP help This selects support for Rockchip SoC specific extensions for the cdn DP driver. If you want to enable Dp on
drivers/gpu/drm/rockchip/Makefile +3 -1
@@ -3,13 +3,15 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. +EXTRA_CFLAGS += -I$(src)/../bridge + rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \ rockchip_drm_gem.o rockchip_drm_psr.o \ rockchip_drm_vop.o rockchip_vop_reg.o rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o rockchipdrm-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o -rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o +rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
drivers/gpu/drm/rockchip/cdn-dp-core.c +8 -8
@@ -816,7 +816,7 @@ static int cdn_dp_audio_hw_params(struct device *dev, void *data, ret =cdns_mhdp_audio_config (&dp->mhdp, &audio);if (!ret) - dp->audio_info = audio; + dp->mhdp.audio_info = audio; out:mutex_unlock (&dp->lock);
@@ -832,9 +832,9 @@ static void cdn_dp_audio_shutdown(struct device *dev, void *data)if (!dp->active) goto out; - ret =cdns_mhdp_audio_stop (&dp->mhdp, &dp->audio_info); + ret =cdns_mhdp_audio_stop (&dp->mhdp, &dp->mhdp.audio_info);if (!ret) - dp->audio_info.format =AFMT_UNUSED ; + dp->mhdp.audio_info.format =AFMT_UNUSED ; out:mutex_unlock (&dp->lock); }
@@ -886,11 +886,11 @@ static int cdn_dp_audio_codec_init(struct cdn_dp_device *dp, .max_i2s_channels = 8, }; - dp->audio_pdev =platform_device_register_data ( - dev,HDMI_CODEC_DRV_NAME ,PLATFORM_DEVID_AUTO , - &codec_data,sizeof (codec_data)); + dp->mhdp.audio_pdev =platform_device_register_data ( + dev,HDMI_CODEC_DRV_NAME ,PLATFORM_DEVID_AUTO , + &codec_data,sizeof (codec_data)); -return PTR_ERR_OR_ZERO (dp->audio_pdev); +return PTR_ERR_OR_ZERO (dp->mhdp.audio_pdev); }static int cdn_dp_request_firmware (struct cdn_dp_device *dp)
@@ -1217,7 +1217,7 @@ static int cdn_dp_remove(struct platform_device *pdev) {struct cdn_dp_device *dp =platform_get_drvdata (pdev); -platform_device_unregister (dp->audio_pdev); +platform_device_unregister (dp->mhdp.audio_pdev);cdn_dp_suspend (dp->mhdp.dev);component_del (&pdev->dev, &cdn_dp_component_ops);
drivers/gpu/drm/rockchip/cdn-dp-core.h +1 -3
@@ -20,7 +20,7 @@#include <drm/drm_dp_helper.h> #include <drm/drm_panel.h> #include "rockchip_drm_drv.h" -#include "cdn-dp-reg.h" +#include "cdns-mhdp-common.h" #define MAX_PHY 2
@@ -45,7 +45,6 @@ struct cdn_dp_device {struct cdns_mhdp_device mhdp;struct drm_device *drm_dev;struct drm_encoder encoder; -struct platform_device *audio_pdev;struct work_struct event_work;struct edid *edid;
@@ -64,7 +63,6 @@ struct cdn_dp_device {struct reset_control *dptx_rst;struct reset_control *apb_rst;struct reset_control *core_rst; -struct audio_info audio_info;struct cdn_dp_port *port[MAX_PHY ];u8 ports;u8 lanes;
Signature · 1 line
2.17.1
Heiko Stuebner
maintainerRe: [PATCH v3 5/5] drm/bridge: add preliminary driver for cadence dpi/dp bridge
Am Dienstag, 28. August 2018, 12:24:48 CEST schrieb Damian Kos:
Quoted 38 lines
From: Quentin Schulz <[email protected]>
This patch finally adds the preliminary driver for Cadence MHDP DPI/DP bridge.
Changes made in the low level driver (cdn-dp-reg.*):
- moved it to fromdrivers/gpu/drm/rockchiptodrivers/gpu/drm/bridge/cdns-mhdp-common.*
- functions for sending/receiving commands are now public
- added functions for reading registers and link training adjustmentChanges made in RK's driver (cdn-dp-core.*):
- Movedaudio_infoandaudio_pdevfields fromcdn_dp_devicetocdns_mhdp_devicestructure.Signed-off-by Damian Kos <[email protected]>--- drivers/gpu/drm/bridge/Kconfig | 9 + drivers/gpu/drm/bridge/Makefile | 3 + .../cdns-mhdp-common.c} | 137 +- .../cdns-mhdp-common.h} | 21 +- drivers/gpu/drm/bridge/cdns-mhdp.c | 1308 +++++++++++++++++ drivers/gpu/drm/rockchip/Kconfig | 1 + drivers/gpu/drm/rockchip/Makefile | 4 +- drivers/gpu/drm/rockchip/cdn-dp-core.c | 16 +- drivers/gpu/drm/rockchip/cdn-dp-core.h | 4 +- 9 files changed, 1484 insertions(+), 19 deletions(-) rename drivers/gpu/drm/{rockchip/cdn-dp-reg.c => bridge/cdns-mhdp-common.c} (87%) rename drivers/gpu/drm/{rockchip/cdn-dp-reg.h => bridge/cdns-mhdp-common.h} (95%) create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp.cdrivers/gpu/drm/bridge/Kconfig +0
-0@@ -35,6 +35,15 @@ config DRM_CDNS_DSI Support Cadence DPI to DSI bridge. This is an internal bridge and is meant to be directly embedded in a SoC.
drivers/gpu/drm/bridge/Kconfig config DRM_CDNS_DSI · line 46
Quoted 10 lines
drivers/gpu/drm/bridge/Kconfig +9
-0+config DRM_CDNS_MHDP + tristate "Cadence DPI/DP bridge" + select DRM_KMS_HELPER + select DRM_PANEL_BRIDGE + depends on OF + help + Support Cadence DPI to DP bridge. This is an internal + bridge and is meant to be directly embedded in a SoC. +
This ends up with a Kconfig error on my kernel, with:
scripts/kconfig/conf --oldconfig Kconfig drivers/i2c/Kconfig:7:error: recursive dependency detected! drivers/i2c/Kconfig:7: symbol I2C is selected by FB_DDC drivers/video/fbdev/Kconfig:63: symbol FB_DDC depends on FB
drivers/video/fbdev/Kconfig:5: symbol FB is selected by DRM_KMS_FB_HELPER drivers/gpu/drm/Kconfig:74: symbol DRM_KMS_FB_HELPER depends on DRM_KMS_HELPER drivers/gpu/drm/Kconfig:68: symbol DRM_KMS_HELPER is selected by DRM_CDNS_MHDP
drivers/gpu/drm/bridge/Kconfig:38: symbol DRM_CDNS_MHDP is selected by ROCKCHIP_CDN_DPdrivers/gpu/drm/rockchip/Kconfig:29: symbol ROCKCHIP_CDN_DP depends on EXTCONdrivers/extcon/Kconfig:1: symbol EXTCON is selected by CHARGER_MANAGERdrivers/power/supply/Kconfig:467: symbol CHARGER_MANAGER depends on POWER_SUPPLYdrivers/power/supply/Kconfig:1: symbol POWER_SUPPLY is selected by HID_BATTERY_STRENGTH drivers/hid/Kconfig:28: symbol HID_BATTERY_STRENGTH depends on HID drivers/hid/Kconfig:7: symbol HID is selected by I2C_HID drivers/hid/i2c-hid/Kconfig:4: symbol I2C_HID depends on I2C
For a resolution refer to Documentation/kbuild/kconfig-language.txt subsection "Kconfig recursive dependency limitations"
The culprit being the dependency on EXTCON in the Rockchip cdn-dp driver. Moving to "select EXTCON" seems to fix the issue, but I'm not sure yet if that is the correct solution.
Heiko
Am Dienstag, 28. August 2018, 12:24:43 CEST schrieb Damian Kos:
Quoted 27 lines
Hello!
This is the series of patches that will add support for the Cadence's DPI/DP bridge. Please note that this is a preliminary version of the driver and there will be more patches in the future with updates, fixes and improvements. Please keep that in mind when looking at FIXME/TODO/XXX comments.
Initially, MHDP driver was developed as a DRM bridge driver and was planed to be placed in
drivers/gpu/drm/bridge/mhdp.c. However, there was already a driver for Cadence's DP controller developed by RockChip, but that driver uses the different DRM framework and looks like a part of a bigger system. Both controllers (including firmware) are quite different internally (MST/FEC/DSC support, link training done by driver, additional commands, IRQ's etc.) but they have similar register map, except for Framer/Streamer (which is noticeably different), so they appear similar.The following patches contain:
- Moving common code todrivers/gpu/drm/bridge/cdns-mhdp-common.*and modifying it a bit (mostly new prefixes for functions and data types) so it can be used by two, higher level, drivers.
- Modifying existing RockChip's DP driver to use the common code after changes made to it (use the newcdns_mhdp_devicestructure and new function names).
- Modifying DRM helpers a bit. Some are required for new driver, some are updates from DP 1.2 to 1.3 or 1.4.
- Adding documentation for device tree bindings.
- Adding preliminary Cadence DPI/DP bridge driver.
Quoted 7 lines
Some of the things that will be added later on include (but are not limited to):
- Support for Cadence SD0801 PHY (PHY's driver should be on the way by now)
- MST support
- DSC support
- FEC support
- HDCP support
with te Kconfig issue in patch5 fixed, this series tested on rk3288 (analogix-dp) and rk3399 (analogix-dp + cadence-dp) Everything seems to work that worked before.
Damian Kos
Tested-by Heiko StuebnerGot it.
-depends on EXTCON=y || (EXTCON=m && DRM_ROCKCHIP=m) +depends on DRM_ROCKCHIP=m
+select EXTCON
Damian
-----Original Message-----
From: Heiko Stuebner <[email protected]>
Sent: Thursday, September 13, 2018 14:32
To: Damian Kos <[email protected]>
Cc: David Airlie <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>; Archit Taneja <[email protected]>; Andrzej Hajda <[email protected]>; Laurent Pinchart <Laurent.pinchart-ryLnwIuWjnjg/[email protected]>; Gustavo Padovan <[email protected]>; Maarten Lankhorst <maarten.lankhorst-VuQAYsv1563Yd54FQh9/[email protected]>; Sean Paul <[email protected]>; Sandy Huang <[email protected]>; Quentin Schulz <[email protected]>; [email protected]; [email protected]; [email protected]; linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org; [email protected]; Przemyslaw Gaj <[email protected]>; Lukasz Tyrala <[email protected]>; Scott Telford <[email protected]>; Artur Jedrysek <[email protected]>; Piotr Sroka <[email protected]>
Subject: Re: [PATCH v3 0/5] drm: add support for Cadence MHDP DPI/DP bridge.
EXTERNAL MAIL
Am Dienstag, 28. August 2018, 12:24:43 CEST schrieb Damian Kos:
Quoted 28 lines
Hello!
This is the series of patches that will add support for the Cadence's DPI/DP bridge. Please note that this is a preliminary version of the
driver and there will be more patches in the future with updates, fixes and improvements. Please keep that in mind when looking at FIXME/TODO/XXX comments.Initially, MHDP driver was developed as a DRM bridge driver and was
planed to be placed indrivers/gpu/drm/bridge/mhdp.c. However, there
was already a driver for Cadence's DP controller developed by
RockChip, but that driver uses the different DRM framework and looks like a part of a bigger system. Both controllers (including firmware) are quite different internally
(MST/FEC/DSC support, link training done by driver, additional
commands, IRQ's
etc.) but they have similar register map, except for Framer/Streamer
(which is noticeably different), so they appear similar.The following patches contain:
- Moving common code todrivers/gpu/drm/bridge/cdns-mhdp-common.*and modifying it a bit (mostly new prefixes for functions and data types) so it can be used by two, higher level, drivers.
- Modifying existing RockChip's DP driver to use the common code after changes made to it (use the newcdns_mhdp_devicestructure and new function names).
- Modifying DRM helpers a bit. Some are required for new driver, some are updates from DP 1.2 to 1.3 or 1.4.
- Adding documentation for device tree bindings.
- Adding preliminary Cadence DPI/DP bridge driver.
Quoted 9 lines
Some of the things that will be added later on include (but are not limited
to):
- Support for Cadence SD0801 PHY (PHY's driver should be on the way by now)
- MST support
- DSC support
- FEC support
- HDCP support
with te Kconfig issue in patch5 fixed, this series tested on
rk3288 (analogix-dp) and rk3399 (analogix-dp + cadence-dp) Everything seems to work that worked before.