From 1543e317f1da31b75942316931e8f491a8920811 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Thu, 04 Jan 2024 10:08:02 +0000
Subject: [PATCH] disable FB
---
kernel/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 1509 ++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 1,102 insertions(+), 407 deletions(-)
diff --git a/kernel/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/kernel/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index ed20d49..53264c7 100644
--- a/kernel/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/kernel/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1,53 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Analogix DP (Display Port) core interface driver.
*
* Copyright (C) 2012 Samsung Electronics Co., Ltd.
* Author: Jingoo Han <jg1.han@samsung.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License as published by the
-* Free Software Foundation; either version 2 of the License, or (at your
-* option) any later version.
*/
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/err.h>
#include <linux/clk.h>
+#include <linux/component.h>
+#include <linux/extcon-provider.h>
+#include <linux/err.h>
+#include <linux/gpio/consumer.h>
+#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/iopoll.h>
-#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/module.h>
#include <linux/of.h>
-#include <linux/of_gpio.h>
-#include <linux/gpio/consumer.h>
-#include <linux/component.h>
#include <linux/phy/phy.h>
-
-#include <drm/drmP.h>
-#include <drm/drm_atomic_helper.h>
-#include <drm/drm_crtc.h>
-#include <drm/drm_crtc_helper.h>
-#include <drm/drm_panel.h>
+#include <linux/platform_device.h>
#include <drm/bridge/analogix_dp.h>
+#include <drm/drm_atomic.h>
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_bridge.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_device.h>
+#include <drm/drm_panel.h>
+#include <drm/drm_print.h>
+#include <drm/drm_probe_helper.h>
#include "analogix_dp_core.h"
#include "analogix_dp_reg.h"
+#include "../../rockchip/rockchip_drm_drv.h"
#define to_dp(nm) container_of(nm, struct analogix_dp_device, nm)
static const bool verify_fast_training;
+
+#ifdef CONFIG_NO_GKI
+#undef EXTCON_DISP_DP
+#define EXTCON_DISP_DP EXTCON_DISP_EDP
+#endif
+
+static const unsigned int analogix_dp_cable[] = {
+ EXTCON_DISP_DP,
+ EXTCON_NONE,
+};
struct bridge_init {
struct i2c_client *client;
struct device_node *node;
};
+static void analogix_dp_bridge_mode_set(struct drm_bridge *bridge,
+ const struct drm_display_mode *adj_mode);
+
static bool analogix_dp_bandwidth_ok(struct analogix_dp_device *dp,
const struct drm_display_mode *mode,
unsigned int rate, unsigned int lanes)
{
+ const struct drm_display_info *info;
u32 max_bw, req_bw, bpp = 24;
+
+ if (dp->plat_data->skip_connector)
+ return true;
+
+ info = &dp->connector.display_info;
+ if (info->bpc)
+ bpp = 3 * info->bpc;
req_bw = mode->clock * bpp / 8;
max_bw = lanes * rate;
@@ -81,143 +102,75 @@
return 0;
}
-static int analogix_dp_prepare_panel(struct analogix_dp_device *dp,
- bool prepare)
+static int analogix_dp_panel_prepare(struct analogix_dp_device *dp)
{
- int ret = 0;
+ int ret;
mutex_lock(&dp->panel_lock);
- if (prepare == dp->panel_is_prepared)
+ if (dp->panel_is_prepared)
goto out;
- if (prepare)
- ret = drm_panel_prepare(dp->plat_data->panel);
- else
- ret = drm_panel_unprepare(dp->plat_data->panel);
+ ret = drm_panel_prepare(dp->plat_data->panel);
if (ret)
goto out;
- dp->panel_is_prepared = prepare;
+ dp->panel_is_prepared = true;
+
out:
mutex_unlock(&dp->panel_lock);
- return ret;
+ return 0;
+}
+
+static int analogix_dp_panel_unprepare(struct analogix_dp_device *dp)
+{
+ int ret;
+
+ mutex_lock(&dp->panel_lock);
+
+ if (!dp->panel_is_prepared)
+ goto out;
+
+ ret = drm_panel_unprepare(dp->plat_data->panel);
+ if (ret)
+ goto out;
+
+ dp->panel_is_prepared = false;
+
+out:
+ mutex_unlock(&dp->panel_lock);
+ return 0;
}
static int analogix_dp_detect_hpd(struct analogix_dp_device *dp)
{
- int timeout_loop = 0;
-
- while (timeout_loop < DP_TIMEOUT_LOOP_COUNT) {
- if (analogix_dp_get_plug_in_status(dp) == 0)
- return 0;
-
- timeout_loop++;
- usleep_range(1000, 1100);
- }
-
- /*
- * Some edp screen do not have hpd signal, so we can't just
- * return failed when hpd plug in detect failed, DT property
- * "force-hpd" would indicate whether driver need this.
- */
- if (!dp->force_hpd)
- return -ETIMEDOUT;
-
- /*
- * The eDP TRM indicate that if HPD_STATUS(RO) is 0, AUX CH
- * will not work, so we need to give a force hpd action to
- * set HPD_STATUS manually.
- */
- dev_dbg(dp->dev, "failed to get hpd plug status, try to force hpd\n");
-
- analogix_dp_force_hpd(dp);
+ if (dp->force_hpd)
+ analogix_dp_force_hpd(dp);
if (analogix_dp_get_plug_in_status(dp) != 0) {
dev_err(dp->dev, "failed to get hpd plug in status\n");
return -EINVAL;
}
- dev_dbg(dp->dev, "success to get plug in status after force hpd\n");
-
return 0;
}
-int analogix_dp_psr_enabled(struct analogix_dp_device *dp)
-{
-
- return dp->psr_enable;
-}
-EXPORT_SYMBOL_GPL(analogix_dp_psr_enabled);
-
-int analogix_dp_enable_psr(struct analogix_dp_device *dp)
-{
- struct edp_vsc_psr psr_vsc;
-
- if (!dp->psr_enable)
- return 0;
-
- /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */
- memset(&psr_vsc, 0, sizeof(psr_vsc));
- psr_vsc.sdp_header.HB0 = 0;
- psr_vsc.sdp_header.HB1 = 0x7;
- psr_vsc.sdp_header.HB2 = 0x2;
- psr_vsc.sdp_header.HB3 = 0x8;
-
- psr_vsc.DB0 = 0;
- psr_vsc.DB1 = EDP_VSC_PSR_STATE_ACTIVE | EDP_VSC_PSR_CRC_VALUES_VALID;
-
- return analogix_dp_send_psr_spd(dp, &psr_vsc, true);
-}
-EXPORT_SYMBOL_GPL(analogix_dp_enable_psr);
-
-int analogix_dp_disable_psr(struct analogix_dp_device *dp)
-{
- struct edp_vsc_psr psr_vsc;
- int ret;
-
- if (!dp->psr_enable)
- return 0;
-
- /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */
- memset(&psr_vsc, 0, sizeof(psr_vsc));
- psr_vsc.sdp_header.HB0 = 0;
- psr_vsc.sdp_header.HB1 = 0x7;
- psr_vsc.sdp_header.HB2 = 0x2;
- psr_vsc.sdp_header.HB3 = 0x8;
-
- psr_vsc.DB0 = 0;
- psr_vsc.DB1 = 0;
-
- ret = drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, DP_SET_POWER_D0);
- if (ret != 1) {
- dev_err(dp->dev, "Failed to set DP Power0 %d\n", ret);
- return ret;
- }
-
- return analogix_dp_send_psr_spd(dp, &psr_vsc, false);
-}
-EXPORT_SYMBOL_GPL(analogix_dp_disable_psr);
-
-static int analogix_dp_detect_sink_psr(struct analogix_dp_device *dp)
+static bool analogix_dp_detect_sink_psr(struct analogix_dp_device *dp)
{
unsigned char psr_version;
int ret;
- if (!of_property_read_bool(dp->dev->of_node, "support-psr"))
+ if (!device_property_read_bool(dp->dev, "support-psr"))
return 0;
ret = drm_dp_dpcd_readb(&dp->aux, DP_PSR_SUPPORT, &psr_version);
if (ret != 1) {
dev_err(dp->dev, "failed to get PSR version, disable it\n");
- return ret;
+ return false;
}
dev_dbg(dp->dev, "Panel PSR version : %x\n", psr_version);
-
- dp->psr_enable = (psr_version & DP_PSR_IS_SUPPORTED) ? true : false;
-
- return 0;
+ return psr_version & DP_PSR_IS_SUPPORTED;
}
static int analogix_dp_enable_sink_psr(struct analogix_dp_device *dp)
@@ -240,7 +193,7 @@
}
/* Main-Link transmitter remains active during PSR active states */
- psr_en = DP_PSR_MAIN_LINK_ACTIVE | DP_PSR_CRC_VERIFICATION;
+ psr_en = DP_PSR_CRC_VERIFICATION;
ret = drm_dp_dpcd_writeb(&dp->aux, DP_PSR_EN_CFG, psr_en);
if (ret != 1) {
dev_err(dp->dev, "failed to set panel psr\n");
@@ -248,8 +201,7 @@
}
/* Enable psr function */
- psr_en = DP_PSR_ENABLE | DP_PSR_MAIN_LINK_ACTIVE |
- DP_PSR_CRC_VERIFICATION;
+ psr_en = DP_PSR_ENABLE | DP_PSR_CRC_VERIFICATION;
ret = drm_dp_dpcd_writeb(&dp->aux, DP_PSR_EN_CFG, psr_en);
if (ret != 1) {
dev_err(dp->dev, "failed to set panel psr\n");
@@ -258,10 +210,11 @@
analogix_dp_enable_psr_crc(dp);
+ dp->psr_supported = true;
+
return 0;
end:
dev_err(dp->dev, "enable psr fail, force to disable psr\n");
- dp->psr_enable = false;
return ret;
}
@@ -351,6 +304,23 @@
return ret < 0 ? ret : 0;
}
+static bool analogix_dp_get_vrr_capable(struct analogix_dp_device *dp)
+{
+ struct drm_connector *connector = &dp->connector;
+ struct drm_display_info *info = &connector->display_info;
+
+ if (!info->monitor_range.max_vfreq)
+ return false;
+ if (!info->monitor_range.min_vfreq)
+ return false;
+ if (info->monitor_range.max_vfreq < info->monitor_range.min_vfreq)
+ return false;
+ if (!drm_dp_sink_can_do_video_without_timing_msa(dp->dpcd))
+ return false;
+
+ return true;
+}
+
static int analogix_dp_link_start(struct analogix_dp_device *dp)
{
u8 buf[4];
@@ -377,6 +347,8 @@
/* Spread AMP if required, enable 8b/10b coding */
buf[0] = analogix_dp_ssc_supported(dp) ? DP_SPREAD_AMP_0_5 : 0;
+ if (analogix_dp_get_vrr_capable(dp))
+ buf[0] |= DP_MSA_TIMING_PAR_IGNORE_EN;
buf[1] = DP_SET_ANSI_8B10B;
retval = drm_dp_dpcd_write(&dp->aux, DP_DOWNSPREAD_CTRL, buf, 2);
if (retval < 0)
@@ -529,16 +501,11 @@
u8 link_status[2], adjust_request[2];
u8 training_pattern = TRAINING_PTN2;
- usleep_range(100, 101);
+ drm_dp_link_train_clock_recovery_delay(dp->dpcd);
lane_count = dp->link_train.lane_count;
retval = drm_dp_dpcd_read(&dp->aux, DP_LANE0_1_STATUS, link_status, 2);
- if (retval < 0)
- return retval;
-
- retval = drm_dp_dpcd_read(&dp->aux, DP_ADJUST_REQUEST_LANE0_1,
- adjust_request, 2);
if (retval < 0)
return retval;
@@ -556,9 +523,16 @@
if (retval < 0)
return retval;
- dev_info(dp->dev, "Link Training Clock Recovery success\n");
+ dev_dbg(dp->dev, "Link Training Clock Recovery success\n");
dp->link_train.lt_state = EQUALIZER_TRAINING;
+
+ return 0;
} else {
+ retval = drm_dp_dpcd_read(&dp->aux, DP_ADJUST_REQUEST_LANE0_1,
+ adjust_request, 2);
+ if (retval < 0)
+ return retval;
+
for (lane = 0; lane < lane_count; lane++) {
training_lane = analogix_dp_get_lane_link_training(
dp, lane);
@@ -583,16 +557,15 @@
return -EIO;
}
}
-
- analogix_dp_get_adjust_training_lane(dp, adjust_request);
- analogix_dp_set_lane_link_training(dp);
-
- retval = drm_dp_dpcd_write(&dp->aux, DP_TRAINING_LANE0_SET,
- dp->link_train.training_lane,
- lane_count);
- if (retval < 0)
- return retval;
}
+
+ analogix_dp_get_adjust_training_lane(dp, adjust_request);
+ analogix_dp_set_lane_link_training(dp);
+
+ retval = drm_dp_dpcd_write(&dp->aux, DP_TRAINING_LANE0_SET,
+ dp->link_train.training_lane, lane_count);
+ if (retval < 0)
+ return retval;
return 0;
}
@@ -603,7 +576,7 @@
u32 reg;
u8 link_align, link_status[2], adjust_request[2];
- usleep_range(400, 401);
+ drm_dp_link_train_channel_eq_delay(dp->dpcd);
lane_count = dp->link_train.lane_count;
@@ -616,17 +589,10 @@
return -EIO;
}
- retval = drm_dp_dpcd_read(&dp->aux, DP_ADJUST_REQUEST_LANE0_1,
- adjust_request, 2);
- if (retval < 0)
- return retval;
-
retval = drm_dp_dpcd_readb(&dp->aux, DP_LANE_ALIGN_STATUS_UPDATED,
&link_align);
if (retval < 0)
return retval;
-
- analogix_dp_get_adjust_training_lane(dp, adjust_request);
if (!analogix_dp_channel_eq_ok(link_status, link_align, lane_count)) {
/* traing pattern Set to Normal */
@@ -634,7 +600,7 @@
if (retval < 0)
return retval;
- dev_info(dp->dev, "Link Training success!\n");
+ dev_dbg(dp->dev, "Link Training success!\n");
analogix_dp_get_link_bandwidth(dp, ®);
dp->link_train.link_rate = reg;
dev_dbg(dp->dev, "final bandwidth = %.2x\n",
@@ -659,6 +625,12 @@
return -EIO;
}
+ retval = drm_dp_dpcd_read(&dp->aux, DP_ADJUST_REQUEST_LANE0_1,
+ adjust_request, 2);
+ if (retval < 0)
+ return retval;
+
+ analogix_dp_get_adjust_training_lane(dp, adjust_request);
analogix_dp_set_lane_link_training(dp);
retval = drm_dp_dpcd_write(&dp->aux, DP_TRAINING_LANE0_SET,
@@ -669,10 +641,11 @@
return 0;
}
-static void analogix_dp_get_max_rx_bandwidth(struct analogix_dp_device *dp,
- u8 *bandwidth)
+static int analogix_dp_get_max_rx_bandwidth(struct analogix_dp_device *dp,
+ u8 *bandwidth)
{
u8 data;
+ int ret;
/*
* For DP rev.1.1, Maximum link rate of Main Link lanes
@@ -680,26 +653,38 @@
* For DP rev.1.2, Maximum link rate of Main Link lanes
* 0x06 = 1.62 Gbps, 0x0a = 2.7 Gbps, 0x14 = 5.4Gbps
*/
- drm_dp_dpcd_readb(&dp->aux, DP_MAX_LINK_RATE, &data);
+ ret = drm_dp_dpcd_readb(&dp->aux, DP_MAX_LINK_RATE, &data);
+ if (ret < 0)
+ return ret;
+
*bandwidth = data;
+
+ return 0;
}
-static void analogix_dp_get_max_rx_lane_count(struct analogix_dp_device *dp,
- u8 *lane_count)
+static int analogix_dp_get_max_rx_lane_count(struct analogix_dp_device *dp,
+ u8 *lane_count)
{
u8 data;
+ int ret;
/*
* For DP rev.1.1, Maximum number of Main Link lanes
* 0x01 = 1 lane, 0x02 = 2 lanes, 0x04 = 4 lanes
*/
- drm_dp_dpcd_readb(&dp->aux, DP_MAX_LANE_COUNT, &data);
+ ret = drm_dp_dpcd_readb(&dp->aux, DP_MAX_LANE_COUNT, &data);
+ if (ret < 0)
+ return ret;
+
*lane_count = DPCD_MAX_LANE_COUNT(data);
+
+ return 0;
}
static int analogix_dp_full_link_train(struct analogix_dp_device *dp,
u32 max_lanes, u32 max_rate)
{
+ struct video_info *video = &dp->video_info;
int retval = 0;
bool training_finished = false;
u8 dpcd;
@@ -714,28 +699,19 @@
analogix_dp_get_max_rx_bandwidth(dp, &dp->link_train.link_rate);
analogix_dp_get_max_rx_lane_count(dp, &dp->link_train.lane_count);
- if ((dp->link_train.link_rate != DP_LINK_BW_1_62) &&
- (dp->link_train.link_rate != DP_LINK_BW_2_7) &&
- (dp->link_train.link_rate != DP_LINK_BW_5_4)) {
- dev_err(dp->dev, "Rx Max Link Rate is abnormal :%x !\n",
- dp->link_train.link_rate);
- dp->link_train.link_rate = DP_LINK_BW_1_62;
- }
+ /* Setup TX lane count & rate */
+ dp->link_train.lane_count = min_t(u32, dp->link_train.lane_count, max_lanes);
+ dp->link_train.link_rate = min_t(u32, dp->link_train.link_rate, max_rate);
- if (dp->link_train.lane_count == 0) {
- dev_err(dp->dev, "Rx Max Lane count is abnormal :%x !\n",
- dp->link_train.lane_count);
- dp->link_train.lane_count = (u8)LANE_COUNT1;
+ if (!analogix_dp_bandwidth_ok(dp, &video->mode,
+ drm_dp_bw_code_to_link_rate(dp->link_train.link_rate),
+ dp->link_train.lane_count)) {
+ dev_err(dp->dev, "bandwidth overflow\n");
+ return -EINVAL;
}
drm_dp_dpcd_readb(&dp->aux, DP_MAX_DOWNSPREAD, &dpcd);
dp->link_train.ssc = !!(dpcd & DP_MAX_DOWNSPREAD_0_5);
-
- /* Setup TX lane count & rate */
- if (dp->link_train.lane_count > max_lanes)
- dp->link_train.lane_count = max_lanes;
- if (dp->link_train.link_rate > max_rate)
- dp->link_train.link_rate = max_rate;
/* All DP analog module power up */
analogix_dp_set_analog_power_down(dp, POWER_ALL, 0);
@@ -873,7 +849,7 @@
analogix_dp_set_video_cr_mn(dp, CALCULATED_M, 0, 0);
/* For video bist, Video timing must be generated by register */
- analogix_dp_set_video_timing_mode(dp, VIDEO_TIMING_FROM_CAPTURE);
+ analogix_dp_set_video_timing_mode(dp, VIDEO_TIMING_FROM_REGISTER);
/* Disable video mute */
analogix_dp_enable_video_mute(dp, 0);
@@ -935,6 +911,156 @@
return ret < 0 ? ret : 0;
}
+static u8 analogix_dp_autotest_phy_pattern(struct analogix_dp_device *dp)
+{
+ struct drm_dp_phy_test_params *data = &dp->compliance.phytest;
+
+ if (drm_dp_get_phy_test_pattern(&dp->aux, data)) {
+ dev_err(dp->dev, "DP Phy Test pattern AUX read failure\n");
+ return DP_TEST_NAK;
+ }
+
+ if (data->link_rate > drm_dp_bw_code_to_link_rate(dp->video_info.max_link_rate)) {
+ dev_err(dp->dev, "invalid link rate = 0x%x\n", data->link_rate);
+ return DP_TEST_NAK;
+ }
+
+ /* Set test active flag here so userspace doesn't interrupt things */
+ dp->compliance.test_active = true;
+
+ return DP_TEST_ACK;
+}
+
+static void analogix_dp_handle_test_request(struct analogix_dp_device *dp)
+{
+ u8 response = DP_TEST_NAK;
+ u8 request = 0;
+ int ret;
+
+ ret = drm_dp_dpcd_readb(&dp->aux, DP_TEST_REQUEST, &request);
+ if (ret < 0) {
+ dev_err(dp->dev, "Could not read test request from sink\n");
+ goto update_status;
+ }
+
+ switch (request) {
+ case DP_TEST_LINK_PHY_TEST_PATTERN:
+ dev_info(dp->dev, "PHY_PATTERN test requested\n");
+ response = analogix_dp_autotest_phy_pattern(dp);
+ break;
+ default:
+ dev_err(dp->dev, "Invalid test request '%02x'\n", request);
+ break;
+ }
+
+ if (response & DP_TEST_ACK)
+ dp->compliance.test_type = request;
+
+update_status:
+ ret = drm_dp_dpcd_writeb(&dp->aux, DP_TEST_RESPONSE, response);
+ if (ret < 0)
+ dev_err(dp->dev, "Could not write test response to sink\n");
+}
+
+void analogix_dp_check_device_service_irq(struct analogix_dp_device *dp)
+{
+ u8 val;
+ int ret;
+
+ ret = drm_dp_dpcd_readb(&dp->aux, DP_DEVICE_SERVICE_IRQ_VECTOR, &val);
+ if (ret < 0 || !val)
+ return;
+
+ ret = drm_dp_dpcd_writeb(&dp->aux, DP_DEVICE_SERVICE_IRQ_VECTOR, val);
+ if (ret < 0)
+ return;
+
+ if (val & DP_AUTOMATED_TEST_REQUEST)
+ analogix_dp_handle_test_request(dp);
+}
+EXPORT_SYMBOL_GPL(analogix_dp_check_device_service_irq);
+
+static void analogix_dp_process_phy_request(struct analogix_dp_device *dp)
+{
+ struct drm_dp_phy_test_params *data = &dp->compliance.phytest;
+ u8 spread, adjust_request[2];
+ int ret;
+
+ dp->link_train.link_rate = drm_dp_link_rate_to_bw_code(data->link_rate);
+ dp->link_train.lane_count = data->num_lanes;
+
+ ret = drm_dp_dpcd_readb(&dp->aux, DP_MAX_DOWNSPREAD, &spread);
+ if (ret < 0) {
+ dev_err(dp->dev, "Could not read ssc from sink\n");
+ return;
+ }
+
+ dp->link_train.ssc = !!(spread & DP_MAX_DOWNSPREAD_0_5);
+
+ ret = drm_dp_dpcd_read(&dp->aux, DP_ADJUST_REQUEST_LANE0_1,
+ adjust_request, 2);
+ if (ret < 0) {
+ dev_err(dp->dev, "Could not read swing/pre-emphasis\n");
+ return;
+ }
+
+ analogix_dp_set_link_bandwidth(dp, dp->link_train.link_rate);
+ analogix_dp_set_lane_count(dp, dp->link_train.lane_count);
+ analogix_dp_get_adjust_training_lane(dp, adjust_request);
+ analogix_dp_set_lane_link_training(dp);
+
+ switch (data->phy_pattern) {
+ case DP_PHY_TEST_PATTERN_NONE:
+ dev_info(dp->dev, "Disable Phy Test Pattern\n");
+ analogix_dp_set_training_pattern(dp, DP_NONE);
+ break;
+ case DP_PHY_TEST_PATTERN_D10_2:
+ dev_info(dp->dev, "Set D10.2 Phy Test Pattern\n");
+ analogix_dp_set_training_pattern(dp, D10_2);
+ break;
+ case DP_PHY_TEST_PATTERN_PRBS7:
+ dev_info(dp->dev, "Set PRBS7 Phy Test Pattern\n");
+ analogix_dp_set_training_pattern(dp, PRBS7);
+ break;
+ case DP_PHY_TEST_PATTERN_80BIT_CUSTOM:
+ dev_info(dp->dev, "Set 80Bit Custom Phy Test Pattern\n");
+ analogix_dp_set_training_pattern(dp, TEST_PATTERN_80BIT);
+ break;
+ case DP_PHY_TEST_PATTERN_CP2520:
+ dev_info(dp->dev, "Set HBR2 compliance Phy Test Pattern\n");
+ analogix_dp_set_training_pattern(dp, TEST_PATTERN_HBR2);
+ break;
+ default:
+ dev_err(dp->dev, "Invalid Phy Test Pattern: %d\n", data->phy_pattern);
+ return;
+ }
+
+ drm_dp_set_phy_test_pattern(&dp->aux, data, 0x11);
+}
+
+void analogix_dp_phy_test(struct analogix_dp_device *dp)
+{
+ struct drm_device *dev = dp->drm_dev;
+ struct drm_modeset_acquire_ctx ctx;
+ int ret;
+
+ DRM_DEV_INFO(dp->dev, "PHY test\n");
+
+ drm_modeset_acquire_init(&ctx, 0);
+ for (;;) {
+ ret = drm_modeset_lock(&dev->mode_config.connection_mutex, &ctx);
+ if (ret != -EDEADLK)
+ break;
+
+ drm_modeset_backoff(&ctx);
+ }
+
+ analogix_dp_process_phy_request(dp);
+ drm_modeset_drop_locks(&ctx);
+ drm_modeset_acquire_fini(&ctx);
+}
+EXPORT_SYMBOL_GPL(analogix_dp_phy_test);
+
static irqreturn_t analogix_dp_hpd_irq_handler(int irq, void *arg)
{
struct analogix_dp_device *dp = arg;
@@ -945,38 +1071,11 @@
return IRQ_HANDLED;
}
-static irqreturn_t analogix_dp_hardirq(int irq, void *arg)
-{
- struct analogix_dp_device *dp = arg;
- irqreturn_t ret = IRQ_NONE;
- enum dp_irq_type irq_type;
-
- irq_type = analogix_dp_get_irq_type(dp);
- if (irq_type != DP_IRQ_TYPE_UNKNOWN) {
- analogix_dp_mute_hpd_interrupt(dp);
- ret = IRQ_WAKE_THREAD;
- }
-
- return ret;
-}
-
static irqreturn_t analogix_dp_irq_thread(int irq, void *arg)
{
struct analogix_dp_device *dp = arg;
- enum dp_irq_type irq_type;
- irq_type = analogix_dp_get_irq_type(dp);
- if (irq_type & DP_IRQ_TYPE_HP_CABLE_IN ||
- irq_type & DP_IRQ_TYPE_HP_CABLE_OUT) {
- dev_dbg(dp->dev, "Detected cable status changed!\n");
- if (dp->drm_dev)
- drm_helper_hpd_irq_event(dp->drm_dev);
- }
-
- if (irq_type != DP_IRQ_TYPE_UNKNOWN) {
- analogix_dp_clear_hotplug_interrupts(dp);
- analogix_dp_unmute_hpd_interrupt(dp);
- }
+ analogix_dp_irq_handler(dp);
return IRQ_HANDLED;
}
@@ -997,10 +1096,68 @@
return 0;
}
+static int analogix_dp_link_power_up(struct analogix_dp_device *dp)
+{
+ u8 value;
+ int ret;
+
+ if (dp->dpcd[DP_DPCD_REV] < 0x11)
+ return 0;
+
+ ret = drm_dp_dpcd_readb(&dp->aux, DP_SET_POWER, &value);
+ if (ret < 0)
+ return ret;
+
+ value &= ~DP_SET_POWER_MASK;
+ value |= DP_SET_POWER_D0;
+
+ ret = drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, value);
+ if (ret < 0)
+ return ret;
+
+ usleep_range(1000, 2000);
+
+ return 0;
+}
+
+static int analogix_dp_link_power_down(struct analogix_dp_device *dp)
+{
+ u8 value;
+ int ret;
+
+ if (dp->dpcd[DP_DPCD_REV] < 0x11)
+ return 0;
+
+ ret = drm_dp_dpcd_readb(&dp->aux, DP_SET_POWER, &value);
+ if (ret < 0)
+ return ret;
+
+ value &= ~DP_SET_POWER_MASK;
+ value |= DP_SET_POWER_D3;
+
+ ret = drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, value);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
static int analogix_dp_commit(struct analogix_dp_device *dp)
{
struct video_info *video = &dp->video_info;
int ret;
+
+ ret = drm_dp_read_dpcd_caps(&dp->aux, dp->dpcd);
+ if (ret < 0) {
+ dev_err(dp->dev, "failed to read dpcd caps: %d\n", ret);
+ return ret;
+ }
+
+ ret = analogix_dp_link_power_up(dp);
+ if (ret) {
+ dev_err(dp->dev, "failed to power up link: %d\n", ret);
+ return ret;
+ }
if (device_property_read_bool(dp->dev, "panel-self-test"))
return drm_dp_dpcd_writeb(&dp->aux, DP_EDP_CONFIGURATION_SET,
@@ -1010,13 +1167,6 @@
if (ret) {
dev_err(dp->dev, "unable to do link train, ret=%d\n", ret);
return ret;
- }
-
- if (!analogix_dp_bandwidth_ok(dp, &video->mode,
- drm_dp_bw_code_to_link_rate(dp->link_train.link_rate),
- dp->link_train.lane_count)) {
- dev_err(dp->dev, "bandwidth overflow\n");
- return -EINVAL;
}
ret = analogix_dp_enable_scramble(dp, 1);
@@ -1037,23 +1187,99 @@
return ret;
}
- ret = analogix_dp_detect_sink_psr(dp);
- if (ret)
- return ret;
-
/* Check whether panel supports fast training */
ret = analogix_dp_fast_link_train_detection(dp);
if (ret)
- dp->psr_enable = false;
+ return ret;
- if (dp->psr_enable) {
+ if (analogix_dp_detect_sink_psr(dp)) {
ret = analogix_dp_enable_sink_psr(dp);
if (ret)
return ret;
}
+ return ret;
+}
+
+static int analogix_dp_enable_psr(struct analogix_dp_device *dp)
+{
+ struct dp_sdp psr_vsc;
+ int ret;
+ u8 sink;
+
+ ret = drm_dp_dpcd_readb(&dp->aux, DP_PSR_STATUS, &sink);
+ if (ret != 1)
+ DRM_DEV_ERROR(dp->dev, "Failed to read psr status %d\n", ret);
+ else if (sink == DP_PSR_SINK_ACTIVE_RFB)
+ return 0;
+
+ /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */
+ memset(&psr_vsc, 0, sizeof(psr_vsc));
+ psr_vsc.sdp_header.HB0 = 0;
+ psr_vsc.sdp_header.HB1 = 0x7;
+ psr_vsc.sdp_header.HB2 = 0x2;
+ psr_vsc.sdp_header.HB3 = 0x8;
+ psr_vsc.db[0] = 0;
+ psr_vsc.db[1] = EDP_VSC_PSR_STATE_ACTIVE | EDP_VSC_PSR_CRC_VALUES_VALID;
+
+ ret = analogix_dp_send_psr_spd(dp, &psr_vsc, true);
+ if (!ret) {
+ analogix_dp_set_analog_power_down(dp, POWER_ALL, true);
+
+ if (dp->phy) {
+ union phy_configure_opts phy_cfg = {0};
+
+ phy_cfg.dp.lanes = 0;
+ phy_cfg.dp.set_lanes = true;
+ ret = phy_configure(dp->phy, &phy_cfg);
+ if (ret)
+ return ret;
+ }
+ }
return ret;
+}
+
+static int analogix_dp_disable_psr(struct analogix_dp_device *dp)
+{
+ struct dp_sdp psr_vsc;
+ int ret;
+ u8 sink;
+
+ analogix_dp_set_analog_power_down(dp, POWER_ALL, false);
+
+ ret = drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, DP_SET_POWER_D0);
+ if (ret != 1) {
+ DRM_DEV_ERROR(dp->dev, "Failed to set DP Power0 %d\n", ret);
+ return ret;
+ }
+
+ ret = drm_dp_dpcd_readb(&dp->aux, DP_PSR_STATUS, &sink);
+ if (ret != 1) {
+ DRM_DEV_ERROR(dp->dev, "Failed to read psr status %d\n", ret);
+ return ret;
+ } else if (sink == DP_PSR_SINK_INACTIVE) {
+ DRM_DEV_ERROR(dp->dev, "sink inactive, skip disable psr");
+ return 0;
+ }
+
+ ret = analogix_dp_train_link(dp);
+ if (ret) {
+ DRM_DEV_ERROR(dp->dev, "Failed to train the link %d\n", ret);
+ return ret;
+ }
+
+ /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */
+ memset(&psr_vsc, 0, sizeof(psr_vsc));
+ psr_vsc.sdp_header.HB0 = 0;
+ psr_vsc.sdp_header.HB1 = 0x7;
+ psr_vsc.sdp_header.HB2 = 0x2;
+ psr_vsc.sdp_header.HB3 = 0x8;
+
+ psr_vsc.db[0] = 0;
+ psr_vsc.db[1] = 0;
+
+ return analogix_dp_send_psr_spd(dp, &psr_vsc, true);
}
static int analogix_dp_get_modes(struct drm_connector *connector)
@@ -1062,31 +1288,49 @@
struct edid *edid;
int ret, num_modes = 0;
+ if (dp->plat_data->right && dp->plat_data->right->plat_data->bridge) {
+ struct drm_bridge *bridge = dp->plat_data->right->plat_data->bridge;
+
+ if (bridge->ops & DRM_BRIDGE_OP_MODES) {
+ if (!drm_bridge_get_modes(bridge, connector))
+ return 0;
+ }
+ }
+
if (dp->plat_data->panel)
- num_modes += drm_panel_get_modes(dp->plat_data->panel);
+ num_modes += drm_panel_get_modes(dp->plat_data->panel, connector);
+
+ if (dp->plat_data->bridge)
+ num_modes += drm_bridge_get_modes(dp->plat_data->bridge, connector);
if (!num_modes) {
- if (dp->plat_data->panel) {
- ret = analogix_dp_prepare_panel(dp, true);
- if (ret) {
- DRM_ERROR("Failed to prepare panel (%d)\n", ret);
- return 0;
- }
- }
+ ret = analogix_dp_phy_power_on(dp);
+ if (ret)
+ return 0;
- pm_runtime_get_sync(dp->dev);
+ if (dp->plat_data->panel)
+ analogix_dp_panel_prepare(dp);
+
edid = drm_get_edid(connector, &dp->aux.ddc);
- pm_runtime_put(dp->dev);
if (edid) {
drm_connector_update_edid_property(&dp->connector,
edid);
num_modes += drm_add_edid_modes(&dp->connector, edid);
kfree(edid);
}
+
+ analogix_dp_phy_power_off(dp);
}
if (dp->plat_data->get_modes)
num_modes += dp->plat_data->get_modes(dp->plat_data, connector);
+
+ if (num_modes > 0 && dp->plat_data->split_mode) {
+ struct drm_display_mode *mode;
+
+ list_for_each_entry(mode, &connector->probed_modes, head)
+ dp->plat_data->convert_to_split_mode(mode);
+ }
return num_modes;
}
@@ -1099,91 +1343,148 @@
return dp->encoder;
}
-static int analogix_dp_loader_protect(struct drm_connector *connector, bool on)
+
+static int analogix_dp_atomic_check(struct drm_connector *connector,
+ struct drm_atomic_state *state)
{
struct analogix_dp_device *dp = to_dp(connector);
+ struct drm_connector_state *conn_state;
+ struct drm_crtc_state *crtc_state;
+
+ conn_state = drm_atomic_get_new_connector_state(state, connector);
+ if (WARN_ON(!conn_state))
+ return -ENODEV;
+
+ conn_state->self_refresh_aware = true;
+
+ if (!conn_state->crtc)
+ return 0;
+
+ crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
+ if (!crtc_state)
+ return 0;
+
+ if (crtc_state->self_refresh_active && !dp->psr_supported)
+ return -EINVAL;
+
+ return 0;
+}
+
+static const struct drm_connector_helper_funcs analogix_dp_connector_helper_funcs = {
+ .get_modes = analogix_dp_get_modes,
+ .best_encoder = analogix_dp_best_encoder,
+ .atomic_check = analogix_dp_atomic_check,
+};
+
+static enum drm_connector_status
+analogix_dp_detect(struct analogix_dp_device *dp)
+{
+ enum drm_connector_status status = connector_status_disconnected;
int ret;
+ ret = analogix_dp_phy_power_on(dp);
+ if (ret) {
+ extcon_set_state_sync(dp->extcon, EXTCON_DISP_DP, false);
+ return connector_status_disconnected;
+ }
+
if (dp->plat_data->panel)
- drm_panel_loader_protect(dp->plat_data->panel, on);
+ analogix_dp_panel_prepare(dp);
- if (on) {
- dp->dpms_mode = DRM_MODE_DPMS_ON;
+ if (!analogix_dp_detect_hpd(dp)) {
+ ret = analogix_dp_get_max_rx_bandwidth(dp, &dp->link_train.link_rate);
+ if (ret) {
+ dev_err(dp->dev, "failed to read max link rate\n");
+ goto out;
+ }
- pm_runtime_get_sync(dp->dev);
+ ret = analogix_dp_get_max_rx_lane_count(dp, &dp->link_train.lane_count);
+ if (ret) {
+ dev_err(dp->dev, "failed to read max lane count\n");
+ goto out;
+ }
- analogix_dp_phy_power_on(dp);
+ status = connector_status_connected;
+ }
- ret = analogix_dp_detect_sink_psr(dp);
- if (ret)
- return ret;
+ if (dp->plat_data->bridge) {
+ struct drm_bridge *next_bridge = dp->plat_data->bridge;
- if (dp->psr_enable) {
- ret = analogix_dp_enable_sink_psr(dp);
- if (ret)
- return ret;
+ if (next_bridge->ops & DRM_BRIDGE_OP_DETECT)
+ status = drm_bridge_detect(next_bridge);
+ }
+
+out:
+ analogix_dp_phy_power_off(dp);
+
+ if (status == connector_status_connected)
+ extcon_set_state_sync(dp->extcon, EXTCON_DISP_DP, true);
+ else
+ extcon_set_state_sync(dp->extcon, EXTCON_DISP_DP, false);
+
+ return status;
+}
+
+static enum drm_connector_status
+analogix_dp_connector_detect(struct drm_connector *connector, bool force)
+{
+ struct analogix_dp_device *dp = to_dp(connector);
+
+ if (dp->plat_data->right && analogix_dp_detect(dp->plat_data->right) != connector_status_connected)
+ return connector_status_disconnected;
+
+ return analogix_dp_detect(dp);
+}
+
+static void analogix_dp_connector_force(struct drm_connector *connector)
+{
+ struct analogix_dp_device *dp = to_dp(connector);
+
+ if (connector->status == connector_status_connected)
+ extcon_set_state_sync(dp->extcon, EXTCON_DISP_DP, true);
+ else
+ extcon_set_state_sync(dp->extcon, EXTCON_DISP_DP, false);
+}
+
+static int
+analogix_dp_atomic_connector_get_property(struct drm_connector *connector,
+ const struct drm_connector_state *state,
+ struct drm_property *property,
+ uint64_t *val)
+{
+ struct rockchip_drm_private *private = connector->dev->dev_private;
+ struct analogix_dp_device *dp = to_dp(connector);
+
+ if (property == private->split_area_prop) {
+ switch (dp->split_area) {
+ case 1:
+ *val = ROCKCHIP_DRM_SPLIT_LEFT_SIDE;
+ break;
+ case 2:
+ *val = ROCKCHIP_DRM_SPLIT_RIGHT_SIDE;
+ break;
+ default:
+ *val = ROCKCHIP_DRM_SPLIT_UNSET;
+ break;
}
}
return 0;
}
-static const struct drm_connector_helper_funcs analogix_dp_connector_helper_funcs = {
- .loader_protect = analogix_dp_loader_protect,
- .get_modes = analogix_dp_get_modes,
- .best_encoder = analogix_dp_best_encoder,
-};
-
-static enum drm_connector_status
-analogix_dp_detect(struct drm_connector *connector, bool force)
-{
- struct analogix_dp_device *dp = to_dp(connector);
- enum drm_connector_status status = connector_status_disconnected;
- int ret;
-
- if (dp->plat_data->panel) {
- ret = analogix_dp_prepare_panel(dp, true);
- if (ret) {
- DRM_ERROR("Failed to prepare panel (%d)\n", ret);
- return ret;
- }
- }
-
- pm_runtime_get_sync(dp->dev);
- if (!analogix_dp_detect_hpd(dp))
- status = connector_status_connected;
- pm_runtime_put(dp->dev);
-
- return status;
-}
-
-static int
-analogix_dp_atomic_connector_get_property(struct drm_connector *connector,
- const struct drm_connector_state *state,
- struct drm_property *property,
- uint64_t *val)
-{
- struct analogix_dp_device *dp = to_dp(connector);
- const struct analogix_dp_property_ops *ops = dp->plat_data->property_ops;
-
- if (ops && ops->get_property)
- return ops->get_property(connector, state, property,
- val, dp->plat_data);
- else
- return -EINVAL;
-}
-
static const struct drm_connector_funcs analogix_dp_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
- .detect = analogix_dp_detect,
+ .detect = analogix_dp_connector_detect,
.destroy = drm_connector_cleanup,
.reset = drm_atomic_helper_connector_reset,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
+ .force = analogix_dp_connector_force,
.atomic_get_property = analogix_dp_atomic_connector_get_property,
};
-static int analogix_dp_bridge_attach(struct drm_bridge *bridge)
+static int analogix_dp_bridge_attach(struct drm_bridge *bridge,
+ enum drm_bridge_attach_flags flags)
{
struct analogix_dp_device *dp = bridge->driver_private;
struct drm_encoder *encoder = dp->encoder;
@@ -1195,26 +1496,51 @@
return -ENODEV;
}
+ if (dp->plat_data->bridge) {
+ ret = drm_bridge_attach(bridge->encoder, dp->plat_data->bridge, bridge,
+ dp->plat_data->skip_connector ?
+ 0 : DRM_BRIDGE_ATTACH_NO_CONNECTOR);
+ if (ret) {
+ DRM_ERROR("Failed to attach external bridge: %d\n", ret);
+ return ret;
+ }
+ }
+
+ if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
+ return 0;
+
if (!dp->plat_data->skip_connector) {
- const struct analogix_dp_property_ops *ops = dp->plat_data->property_ops;
+ int connector_type = DRM_MODE_CONNECTOR_eDP;
+ struct rockchip_drm_private *private;
+
+ if (dp->plat_data->bridge &&
+ dp->plat_data->bridge->type != DRM_MODE_CONNECTOR_Unknown)
+ connector_type = dp->plat_data->bridge->type;
connector = &dp->connector;
connector->polled = DRM_CONNECTOR_POLL_HPD;
+ if (dp->plat_data->bridge && dp->plat_data->bridge->ops & DRM_BRIDGE_OP_DETECT)
+ connector->polled = DRM_CONNECTOR_POLL_CONNECT |
+ DRM_CONNECTOR_POLL_DISCONNECT;
ret = drm_connector_init(dp->drm_dev, connector,
&analogix_dp_connector_funcs,
- DRM_MODE_CONNECTOR_eDP);
+ connector_type);
if (ret) {
DRM_ERROR("Failed to initialize connector with drm\n");
return ret;
}
+ private = connector->dev->dev_private;
+
+ if (dp->split_area)
+ drm_object_attach_property(&connector->base,
+ private->split_area_prop,
+ dp->split_area);
+
drm_connector_helper_add(connector,
&analogix_dp_connector_helper_funcs);
drm_connector_attach_encoder(connector, encoder);
-
- if (ops && ops->attach_properties)
- ops->attach_properties(connector);
}
/*
@@ -1223,18 +1549,10 @@
* plat_data->attch return, that's why we record the connector
* point after plat attached.
*/
- if (dp->plat_data->attach) {
- ret = dp->plat_data->attach(dp->plat_data, bridge, connector);
- if (ret) {
- DRM_ERROR("Failed at platform attch func\n");
- return ret;
- }
- }
-
- if (dp->plat_data->panel) {
- ret = drm_panel_attach(dp->plat_data->panel, &dp->connector);
+ if (dp->plat_data->attach) {
+ ret = dp->plat_data->attach(dp->plat_data, bridge, connector);
if (ret) {
- DRM_ERROR("Failed to attach panel\n");
+ DRM_ERROR("Failed at platform attach func\n");
return ret;
}
}
@@ -1242,28 +1560,89 @@
return 0;
}
-static void analogix_dp_bridge_pre_enable(struct drm_bridge *bridge)
+static void analogix_dp_bridge_detach(struct drm_bridge *bridge)
{
struct analogix_dp_device *dp = bridge->driver_private;
- int ret;
- if (dp->plat_data->panel) {
- ret = analogix_dp_prepare_panel(dp, true);
- if (ret)
- DRM_ERROR("failed to setup the panel ret = %d\n", ret);
- }
+ if (dp->plat_data->detach)
+ dp->plat_data->detach(dp->plat_data, bridge);
+}
+
+static
+struct drm_crtc *analogix_dp_get_old_crtc(struct analogix_dp_device *dp,
+ struct drm_atomic_state *state)
+{
+ struct drm_encoder *encoder = dp->encoder;
+ struct drm_connector *connector;
+ struct drm_connector_state *conn_state;
+
+ connector = drm_atomic_get_old_connector_for_encoder(state, encoder);
+ if (!connector)
+ return NULL;
+
+ conn_state = drm_atomic_get_old_connector_state(state, connector);
+ if (!conn_state)
+ return NULL;
+
+ return conn_state->crtc;
+}
+
+static
+struct drm_crtc *analogix_dp_get_new_crtc(struct analogix_dp_device *dp,
+ struct drm_atomic_state *state)
+{
+ struct drm_bridge *bridge = &dp->bridge;
+ struct drm_encoder *encoder = bridge->encoder;
+ struct drm_connector *connector;
+ struct drm_connector_state *conn_state;
+
+ connector = drm_atomic_get_new_connector_for_encoder(state, encoder);
+ if (!connector)
+ return NULL;
+
+ conn_state = drm_atomic_get_new_connector_state(state, connector);
+ if (!conn_state)
+ return NULL;
+
+ return conn_state->crtc;
+}
+
+static void
+analogix_dp_bridge_atomic_pre_enable(struct drm_bridge *bridge,
+ struct drm_bridge_state *old_bridge_state)
+{
+ struct drm_atomic_state *old_state = old_bridge_state->base.state;
+ struct analogix_dp_device *dp = bridge->driver_private;
+ struct drm_crtc *crtc;
+ struct drm_crtc_state *old_crtc_state, *new_crtc_state;
+
+ crtc = analogix_dp_get_new_crtc(dp, old_state);
+ if (!crtc)
+ return;
+
+ old_crtc_state = drm_atomic_get_old_crtc_state(old_state, crtc);
+
+ new_crtc_state = drm_atomic_get_new_crtc_state(old_state, crtc);
+ analogix_dp_bridge_mode_set(bridge, &new_crtc_state->adjusted_mode);
+
+ /* Don't touch the panel if we're coming back from PSR */
+ if (old_crtc_state && old_crtc_state->self_refresh_active)
+ return;
+
+ if (dp->plat_data->panel)
+ analogix_dp_panel_prepare(dp);
}
static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
{
int ret;
- pm_runtime_get_sync(dp->dev);
-
if (dp->plat_data->power_on_start)
dp->plat_data->power_on_start(dp->plat_data);
- analogix_dp_phy_power_on(dp);
+ ret = analogix_dp_phy_power_on(dp);
+ if (ret)
+ return ret;
ret = analogix_dp_init_dp(dp);
if (ret)
@@ -1292,22 +1671,47 @@
if (dp->plat_data->power_on_end)
dp->plat_data->power_on_end(dp->plat_data);
- enable_irq(dp->irq);
return 0;
out_dp_init:
analogix_dp_phy_power_off(dp);
if (dp->plat_data->power_off)
dp->plat_data->power_off(dp->plat_data);
- pm_runtime_put_sync(dp->dev);
-
return ret;
}
-static void analogix_dp_bridge_enable(struct drm_bridge *bridge)
+static void analogix_dp_modeset_retry_work_fn(struct work_struct *work)
{
+ struct analogix_dp_device *dp =
+ container_of(work, typeof(*dp), modeset_retry_work);
+
+ /* Send Hotplug uevent so userspace can reprobe */
+ drm_kms_helper_hotplug_event(dp->bridge.dev);
+}
+
+static void
+analogix_dp_bridge_atomic_enable(struct drm_bridge *bridge,
+ struct drm_bridge_state *old_bridge_state)
+{
+ struct drm_atomic_state *old_state = old_bridge_state->base.state;
struct analogix_dp_device *dp = bridge->driver_private;
+ struct drm_crtc *crtc;
+ struct drm_crtc_state *old_crtc_state;
int timeout_loop = 0;
+ int ret;
+
+ crtc = analogix_dp_get_new_crtc(dp, old_state);
+ if (!crtc)
+ return;
+
+ old_crtc_state = drm_atomic_get_old_crtc_state(old_state, crtc);
+ /* Not a full enable, just disable PSR and continue */
+ if (old_crtc_state && old_crtc_state->self_refresh_active) {
+ ret = analogix_dp_disable_psr(dp);
+ if (ret)
+ DRM_ERROR("Failed to disable psr %d\n", ret);
+ return;
+ }
if (dp->dpms_mode == DRM_MODE_DPMS_ON)
return;
@@ -1323,12 +1727,14 @@
usleep_range(10, 11);
}
dev_err(dp->dev, "too many times retry set bridge, give it up\n");
+
+ /* Schedule a Hotplug Uevent to userspace to start modeset */
+ schedule_work(&dp->modeset_retry_work);
}
static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
{
struct analogix_dp_device *dp = bridge->driver_private;
- int ret;
if (dp->dpms_mode != DRM_MODE_DPMS_ON)
return;
@@ -1340,44 +1746,115 @@
}
}
- disable_irq(dp->irq);
+ if (!analogix_dp_get_plug_in_status(dp))
+ analogix_dp_link_power_down(dp);
if (dp->plat_data->power_off)
dp->plat_data->power_off(dp->plat_data);
- analogix_dp_reset_aux(dp);
analogix_dp_set_analog_power_down(dp, POWER_ALL, 1);
analogix_dp_phy_power_off(dp);
- pm_runtime_put_sync(dp->dev);
+ if (dp->plat_data->panel)
+ analogix_dp_panel_unprepare(dp);
- if (dp->plat_data->panel) {
- ret = analogix_dp_prepare_panel(dp, false);
- if (ret)
- DRM_ERROR("failed to setup the panel ret = %d\n", ret);
- }
-
- dp->psr_enable = false;
dp->fast_train_enable = false;
+ dp->psr_supported = false;
dp->dpms_mode = DRM_MODE_DPMS_OFF;
}
+void analogix_dp_disable(struct analogix_dp_device *dp)
+{
+ analogix_dp_bridge_disable(&dp->bridge);
+}
+EXPORT_SYMBOL_GPL(analogix_dp_disable);
+
+static void
+analogix_dp_bridge_atomic_disable(struct drm_bridge *bridge,
+ struct drm_bridge_state *old_bridge_state)
+{
+ struct drm_atomic_state *old_state = old_bridge_state->base.state;
+ struct analogix_dp_device *dp = bridge->driver_private;
+ struct drm_crtc *old_crtc, *new_crtc;
+ struct drm_crtc_state *old_crtc_state = NULL;
+ struct drm_crtc_state *new_crtc_state = NULL;
+ int ret;
+
+ new_crtc = analogix_dp_get_new_crtc(dp, old_state);
+ if (!new_crtc)
+ goto out;
+
+ new_crtc_state = drm_atomic_get_new_crtc_state(old_state, new_crtc);
+ if (!new_crtc_state)
+ goto out;
+
+ /* Don't do a full disable on PSR transitions */
+ if (new_crtc_state->self_refresh_active)
+ return;
+
+out:
+ old_crtc = analogix_dp_get_old_crtc(dp, old_state);
+ if (old_crtc) {
+ old_crtc_state = drm_atomic_get_old_crtc_state(old_state,
+ old_crtc);
+
+ /* When moving from PSR to fully disabled, exit PSR first. */
+ if (old_crtc_state && old_crtc_state->self_refresh_active) {
+ ret = analogix_dp_disable_psr(dp);
+ if (ret)
+ DRM_ERROR("Failed to disable psr (%d)\n", ret);
+ }
+ }
+
+ analogix_dp_bridge_disable(bridge);
+}
+
+static void
+analogix_dp_bridge_atomic_post_disable(struct drm_bridge *bridge,
+ struct drm_bridge_state *old_bridge_state)
+{
+ struct drm_atomic_state *old_state = old_bridge_state->base.state;
+ struct analogix_dp_device *dp = bridge->driver_private;
+ struct drm_crtc *crtc;
+ struct drm_crtc_state *new_crtc_state;
+ int ret;
+
+ crtc = analogix_dp_get_new_crtc(dp, old_state);
+ if (!crtc)
+ return;
+
+ new_crtc_state = drm_atomic_get_new_crtc_state(old_state, crtc);
+ if (!new_crtc_state || !new_crtc_state->self_refresh_active)
+ return;
+
+ ret = analogix_dp_enable_psr(dp);
+ if (ret)
+ DRM_ERROR("Failed to enable psr (%d)\n", ret);
+}
+
static void analogix_dp_bridge_mode_set(struct drm_bridge *bridge,
- struct drm_display_mode *orig_mode,
- struct drm_display_mode *mode)
+ const struct drm_display_mode *adj_mode)
{
struct analogix_dp_device *dp = bridge->driver_private;
struct drm_display_info *display_info = &dp->connector.display_info;
struct video_info *video = &dp->video_info;
+ struct drm_display_mode *mode = &video->mode;
struct device_node *dp_node = dp->dev->of_node;
int vic;
- drm_mode_copy(&video->mode, mode);
+ drm_mode_copy(mode, adj_mode);
+ if (dp->plat_data->split_mode)
+ dp->plat_data->convert_to_origin_mode(mode);
/* Input video interlaces & hsync pol & vsync pol */
video->interlaced = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
- video->v_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NVSYNC);
- video->h_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NHSYNC);
+ if (dp->plat_data->dev_type == RK3588_EDP) {
+ video->v_sync_polarity = true;
+ video->h_sync_polarity = true;
+ } else {
+ video->v_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NVSYNC);
+ video->h_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NHSYNC);
+ }
/* Input video dynamic_range & colorimetry */
vic = drm_match_cea_mode(mode);
@@ -1441,74 +1918,152 @@
video->interlaced = true;
}
+static bool analogix_dp_link_config_validate(u8 link_rate, u8 lane_count)
+{
+ switch (link_rate) {
+ case DP_LINK_BW_1_62:
+ case DP_LINK_BW_2_7:
+ case DP_LINK_BW_5_4:
+ break;
+ default:
+ return false;
+ }
+
+ switch (lane_count) {
+ case 1:
+ case 2:
+ case 4:
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
static enum drm_mode_status
analogix_dp_bridge_mode_valid(struct drm_bridge *bridge,
+ const struct drm_display_info *info,
const struct drm_display_mode *mode)
{
struct analogix_dp_device *dp = bridge->driver_private;
+ struct drm_display_mode m;
+ u32 max_link_rate, max_lane_count;
- if (!analogix_dp_bandwidth_ok(dp, mode,
- drm_dp_bw_code_to_link_rate(dp->video_info.max_link_rate),
- dp->video_info.max_lane_count))
+ drm_mode_copy(&m, mode);
+
+ if (dp->plat_data->split_mode || dp->plat_data->dual_connector_split)
+ dp->plat_data->convert_to_origin_mode(&m);
+
+ max_link_rate = min_t(u32, dp->video_info.max_link_rate,
+ dp->link_train.link_rate);
+ max_lane_count = min_t(u32, dp->video_info.max_lane_count,
+ dp->link_train.lane_count);
+ if (analogix_dp_link_config_validate(max_link_rate, max_lane_count) &&
+ !analogix_dp_bandwidth_ok(dp, &m,
+ drm_dp_bw_code_to_link_rate(max_link_rate),
+ max_lane_count))
return MODE_BAD;
return MODE_OK;
}
-static void analogix_dp_bridge_nop(struct drm_bridge *bridge)
-{
- /* do nothing */
-}
-
static const struct drm_bridge_funcs analogix_dp_bridge_funcs = {
- .pre_enable = analogix_dp_bridge_pre_enable,
- .enable = analogix_dp_bridge_enable,
- .disable = analogix_dp_bridge_disable,
- .post_disable = analogix_dp_bridge_nop,
- .mode_set = analogix_dp_bridge_mode_set,
+ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
+ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
+ .atomic_reset = drm_atomic_helper_bridge_reset,
+ .atomic_pre_enable = analogix_dp_bridge_atomic_pre_enable,
+ .atomic_enable = analogix_dp_bridge_atomic_enable,
+ .atomic_disable = analogix_dp_bridge_atomic_disable,
+ .atomic_post_disable = analogix_dp_bridge_atomic_post_disable,
.attach = analogix_dp_bridge_attach,
+ .detach = analogix_dp_bridge_detach,
.mode_valid = analogix_dp_bridge_mode_valid,
};
-static int analogix_dp_create_bridge(struct drm_device *drm_dev,
- struct analogix_dp_device *dp)
+static int analogix_dp_bridge_init(struct analogix_dp_device *dp)
{
- struct drm_bridge *bridge;
+ struct drm_bridge *bridge = &dp->bridge;
int ret;
- bridge = devm_kzalloc(drm_dev->dev, sizeof(*bridge), GFP_KERNEL);
- if (!bridge) {
- DRM_ERROR("failed to allocate for drm bridge\n");
- return -ENOMEM;
+ if (!dp->plat_data->left) {
+ ret = drm_bridge_attach(dp->encoder, bridge, NULL, 0);
+ if (ret) {
+ DRM_ERROR("failed to attach drm bridge\n");
+ return ret;
+ }
}
- dp->bridge = bridge;
+ if (dp->plat_data->right) {
+ struct analogix_dp_device *secondary = dp->plat_data->right;
+ struct drm_bridge *last_bridge =
+ list_last_entry(&bridge->encoder->bridge_chain,
+ struct drm_bridge, chain_node);
- bridge->driver_private = dp;
- bridge->funcs = &analogix_dp_bridge_funcs;
-
- ret = drm_bridge_attach(dp->encoder, bridge, NULL);
- if (ret) {
- DRM_ERROR("failed to attach drm bridge\n");
- return -EINVAL;
+ ret = drm_bridge_attach(dp->encoder, &secondary->bridge, last_bridge,
+ DRM_BRIDGE_ATTACH_NO_CONNECTOR);
+ if (ret)
+ return ret;
}
return 0;
+}
+
+static u32 analogix_dp_parse_link_frequencies(struct analogix_dp_device *dp)
+{
+ struct device_node *node = dp->dev->of_node;
+ struct device_node *endpoint;
+ u64 frequency = 0;
+ int cnt;
+
+ endpoint = of_graph_get_endpoint_by_regs(node, 1, 0);
+ if (!endpoint)
+ return 0;
+
+ cnt = of_property_count_u64_elems(endpoint, "link-frequencies");
+ if (cnt > 0)
+ of_property_read_u64_index(endpoint, "link-frequencies",
+ cnt - 1, &frequency);
+ of_node_put(endpoint);
+
+ if (!frequency)
+ return 0;
+
+ do_div(frequency, 10 * 1000); /* symbol rate kbytes */
+
+ switch (frequency) {
+ case 162000:
+ case 270000:
+ case 540000:
+ break;
+ default:
+ dev_err(dp->dev, "invalid link frequency value: %lld\n", frequency);
+ return 0;
+ }
+
+ return frequency;
}
static int analogix_dp_dt_parse_pdata(struct analogix_dp_device *dp)
{
struct device_node *dp_node = dp->dev->of_node;
struct video_info *video_info = &dp->video_info;
+ struct property *prop;
+ int ret, len, num_lanes;
+ u32 max_link_rate;
switch (dp->plat_data->dev_type) {
case RK3288_DP:
- case RK3368_EDP:
case RK3568_EDP:
+ /*
+ * Like Rk3288 DisplayPort TRM indicate that "Main link
+ * containing 4 physical lanes of 2.7/1.62 Gbps/lane".
+ */
video_info->max_link_rate = 0x0A;
video_info->max_lane_count = 0x04;
break;
case RK3399_EDP:
+ case RK3588_EDP:
video_info->max_link_rate = 0x14;
video_info->max_lane_count = 0x04;
break;
@@ -1524,8 +2079,43 @@
break;
}
+ max_link_rate = analogix_dp_parse_link_frequencies(dp);
+ if (max_link_rate && max_link_rate < drm_dp_bw_code_to_link_rate(video_info->max_link_rate))
+ video_info->max_link_rate = drm_dp_link_rate_to_bw_code(max_link_rate);
+
video_info->video_bist_enable =
of_property_read_bool(dp_node, "analogix,video-bist-enable");
+ video_info->force_stream_valid =
+ of_property_read_bool(dp_node, "analogix,force-stream-valid");
+
+ prop = of_find_property(dp_node, "data-lanes", &len);
+ if (!prop) {
+ video_info->lane_map[0] = 0;
+ video_info->lane_map[1] = 1;
+ video_info->lane_map[2] = 2;
+ video_info->lane_map[3] = 3;
+ DRM_DEV_DEBUG(dp->dev, "failed to find data lane mapping, using default\n");
+ return 0;
+ }
+
+ num_lanes = len / sizeof(u32);
+
+ if (num_lanes < 1 || num_lanes > 4 || num_lanes == 3) {
+ DRM_DEV_ERROR(dp->dev, "bad number of data lanes\n");
+ return -EINVAL;
+ }
+
+ video_info->max_lane_count = num_lanes;
+
+ ret = of_property_read_u32_array(dp_node, "data-lanes",
+ video_info->lane_map, num_lanes);
+ if (ret) {
+ DRM_DEV_ERROR(dp->dev, "failed to read lane data\n");
+ return ret;
+ }
+
+ if (device_property_read_u32(dp->dev, "split-area", &dp->split_area))
+ dp->split_area = 0;
return 0;
}
@@ -1534,8 +2124,19 @@
struct drm_dp_aux_msg *msg)
{
struct analogix_dp_device *dp = to_dp(aux);
+ int ret;
- return analogix_dp_transfer(dp, msg);
+ pm_runtime_get_sync(dp->dev);
+
+ ret = analogix_dp_detect_hpd(dp);
+ if (ret)
+ goto out;
+
+ ret = analogix_dp_transfer(dp, msg);
+out:
+ pm_runtime_put(dp->dev);
+
+ return ret;
}
int analogix_dp_audio_hw_params(struct analogix_dp_device *dp,
@@ -1580,9 +2181,70 @@
}
EXPORT_SYMBOL_GPL(analogix_dp_audio_get_eld);
+static void analogix_dp_link_train_restore(struct analogix_dp_device *dp)
+{
+ u32 link_rate, lane_count;
+ u8 lane, spread;
+
+ analogix_dp_get_link_bandwidth(dp, &link_rate);
+ analogix_dp_get_lane_count(dp, &lane_count);
+ drm_dp_dpcd_readb(&dp->aux, DP_MAX_DOWNSPREAD, &spread);
+
+ dp->link_train.link_rate = link_rate;
+ dp->link_train.lane_count = lane_count;
+ dp->link_train.enhanced_framing = analogix_dp_get_enhanced_mode(dp);
+ dp->link_train.ssc = !!(spread & DP_MAX_DOWNSPREAD_0_5);
+
+ for (lane = 0; lane < 4; lane++)
+ dp->link_train.training_lane[lane] =
+ analogix_dp_get_lane_link_training(dp, lane);
+}
+
+int analogix_dp_loader_protect(struct analogix_dp_device *dp)
+{
+ u8 link_status[DP_LINK_STATUS_SIZE];
+ int ret;
+
+ ret = analogix_dp_phy_power_on(dp);
+ if (ret)
+ return ret;
+
+ dp->dpms_mode = DRM_MODE_DPMS_ON;
+
+ analogix_dp_link_train_restore(dp);
+
+ ret = analogix_dp_fast_link_train_detection(dp);
+ if (ret)
+ goto err_disable;
+
+ if (analogix_dp_detect_sink_psr(dp)) {
+ ret = analogix_dp_enable_sink_psr(dp);
+ if (ret)
+ goto err_disable;
+ }
+
+ ret = drm_dp_dpcd_read_link_status(&dp->aux, link_status);
+ if (ret < 0) {
+ dev_err(dp->dev, "Failed to read link status\n");
+ goto err_disable;
+ }
+
+ if (!drm_dp_channel_eq_ok(link_status, dp->link_train.lane_count)) {
+ dev_err(dp->dev, "Channel EQ or CR not ok\n");
+ ret = -EINVAL;
+ goto err_disable;
+ }
+
+ return 0;
+
+err_disable:
+ analogix_dp_disable(dp);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(analogix_dp_loader_protect);
+
struct analogix_dp_device *
-analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,
- struct analogix_dp_plat_data *plat_data)
+analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
{
struct platform_device *pdev = to_platform_device(dev);
struct analogix_dp_device *dp;
@@ -1600,6 +2262,7 @@
dp->dev = &pdev->dev;
dp->dpms_mode = DRM_MODE_DPMS_OFF;
+ INIT_WORK(&dp->modeset_retry_work, analogix_dp_modeset_retry_work_fn);
mutex_init(&dp->panel_lock);
dp->panel_is_prepared = false;
@@ -1631,6 +2294,14 @@
}
}
+ ret = devm_clk_bulk_get_all(dev, &dp->clks);
+ if (ret < 0) {
+ dev_err(dev, "failed to get clocks %d\n", ret);
+ return ERR_PTR(ret);
+ }
+
+ dp->nr_clks = ret;
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
dp->reg_base = devm_ioremap_resource(&pdev->dev, res);
@@ -1651,11 +2322,9 @@
}
if (dp->hpd_gpiod) {
- dp->hpd_irq = gpiod_to_irq(dp->hpd_gpiod);
- if (dp->hpd_irq < 0)
- return ERR_PTR(-EINVAL);
-
- ret = devm_request_threaded_irq(dev, dp->hpd_irq, NULL,
+ ret = devm_request_threaded_irq(dev,
+ gpiod_to_irq(dp->hpd_gpiod),
+ NULL,
analogix_dp_hpd_irq_handler,
IRQF_TRIGGER_RISING |
IRQF_TRIGGER_FALLING |
@@ -1674,71 +2343,91 @@
}
irq_set_status_flags(dp->irq, IRQ_NOAUTOEN);
- ret = devm_request_threaded_irq(&pdev->dev, dp->irq,
- analogix_dp_hardirq,
+ ret = devm_request_threaded_irq(dev, dp->irq, NULL,
analogix_dp_irq_thread,
- 0, "analogix-dp", dp);
+ IRQF_ONESHOT, dev_name(dev), dp);
if (ret) {
dev_err(&pdev->dev, "failed to request irq\n");
- goto err_disable_pm_runtime;
+ return ERR_PTR(ret);
}
+
+ dp->extcon = devm_extcon_dev_allocate(dev, analogix_dp_cable);
+ if (IS_ERR(dp->extcon)) {
+ dev_err(dev, "failed to allocate extcon device\n");
+ return ERR_CAST(dp->extcon);
+ }
+
+ ret = devm_extcon_dev_register(dev, dp->extcon);
+ if (ret) {
+ dev_err(dev, "failed to register extcon device\n");
+ return ERR_PTR(ret);
+ }
+
+ dp->bridge.driver_private = dp;
+ dp->bridge.funcs = &analogix_dp_bridge_funcs;
+
+ return dp;
+}
+EXPORT_SYMBOL_GPL(analogix_dp_probe);
+
+int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev)
+{
+ int ret;
dp->drm_dev = drm_dev;
dp->encoder = dp->plat_data->encoder;
dp->aux.name = "DP-AUX";
dp->aux.transfer = analogix_dpaux_transfer;
- dp->aux.dev = &pdev->dev;
+ dp->aux.dev = dp->dev;
ret = drm_dp_aux_register(&dp->aux);
if (ret)
- return ERR_PTR(ret);
+ return ret;
- pm_runtime_enable(dev);
+ pm_runtime_enable(dp->dev);
+ pm_runtime_get_sync(dp->dev);
+ analogix_dp_init(dp);
- ret = analogix_dp_create_bridge(drm_dev, dp);
+ ret = analogix_dp_bridge_init(dp);
if (ret) {
- DRM_ERROR("failed to create bridge (%d)\n", ret);
+ DRM_ERROR("failed to init bridge (%d)\n", ret);
goto err_disable_pm_runtime;
}
- return dp;
+ enable_irq(dp->irq);
+
+ return 0;
err_disable_pm_runtime:
+ pm_runtime_put(dp->dev);
+ pm_runtime_disable(dp->dev);
+ drm_dp_aux_unregister(&dp->aux);
- pm_runtime_disable(dev);
-
- return ERR_PTR(ret);
+ return ret;
}
EXPORT_SYMBOL_GPL(analogix_dp_bind);
void analogix_dp_unbind(struct analogix_dp_device *dp)
{
- analogix_dp_bridge_disable(dp->bridge);
- dp->connector.funcs->destroy(&dp->connector);
-
- if (dp->plat_data->panel) {
- if (drm_panel_unprepare(dp->plat_data->panel))
- DRM_ERROR("failed to turnoff the panel\n");
- if (drm_panel_detach(dp->plat_data->panel))
- DRM_ERROR("failed to detach the panel\n");
- }
-
+ disable_irq(dp->irq);
+ if (dp->connector.funcs->destroy)
+ dp->connector.funcs->destroy(&dp->connector);
drm_dp_aux_unregister(&dp->aux);
+ pm_runtime_put(dp->dev);
pm_runtime_disable(dp->dev);
}
EXPORT_SYMBOL_GPL(analogix_dp_unbind);
-#ifdef CONFIG_PM
+void analogix_dp_remove(struct analogix_dp_device *dp)
+{
+ cancel_work_sync(&dp->modeset_retry_work);
+}
+EXPORT_SYMBOL_GPL(analogix_dp_remove);
+
int analogix_dp_suspend(struct analogix_dp_device *dp)
{
- if (dp->hpd_gpiod)
- disable_irq(dp->hpd_irq);
-
- if (dp->plat_data->panel) {
- if (drm_panel_unprepare(dp->plat_data->panel))
- DRM_ERROR("failed to turnoff the panel\n");
- }
+ pm_runtime_force_suspend(dp->dev);
return 0;
}
@@ -1746,20 +2435,26 @@
int analogix_dp_resume(struct analogix_dp_device *dp)
{
- if (dp->plat_data->panel) {
- if (drm_panel_prepare(dp->plat_data->panel)) {
- DRM_ERROR("failed to setup the panel\n");
- return -EBUSY;
- }
- }
-
- if (dp->hpd_gpiod)
- enable_irq(dp->hpd_irq);
+ pm_runtime_force_resume(dp->dev);
+ analogix_dp_init(dp);
return 0;
}
EXPORT_SYMBOL_GPL(analogix_dp_resume);
-#endif
+
+int analogix_dp_runtime_suspend(struct analogix_dp_device *dp)
+{
+ clk_bulk_disable_unprepare(dp->nr_clks, dp->clks);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(analogix_dp_runtime_suspend);
+
+int analogix_dp_runtime_resume(struct analogix_dp_device *dp)
+{
+ return clk_bulk_prepare_enable(dp->nr_clks, dp->clks);
+}
+EXPORT_SYMBOL_GPL(analogix_dp_runtime_resume);
int analogix_dp_start_crc(struct drm_connector *connector)
{
--
Gitblit v1.6.2