* [PATCH RESEND v3 0/5] drm/bridge: it6505: fix DP link traning and improve compatibility
@ 2025-09-16 4:47 Hermes Wu via B4 Relay
2025-09-16 4:47 ` [PATCH RESEND v3 1/5] drm/bridge: it6505: fix link training state HW register reset Hermes Wu via B4 Relay
` (4 more replies)
0 siblings, 5 replies; 14+ messages in thread
From: Hermes Wu via B4 Relay @ 2025-09-16 4:47 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Pet.Weng, Kenneth.Hung, treapking, dri-devel, linux-kernel,
Hermes Wu
IT6505 supports HW auto link training which will write DPCD and check
training status automatically. Some DP device can not pass
HW auto link training and must set link training step by step.
when HW auto link training fail, it may trigger video FIFO error,
and link training process will reset to beginning, and never try
step training method.
Modify training method improve compatibility to these DP devices.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
Changes in v3:
- Patch 1/5 : add commit message for detial about changes
- Patch 2/5 : fix lost variable struct device *dev;
- Patch 3/5 : keep changes and remove refactoring
- Patch 5/5 : merge condition "it6505->step_train_only" check form if condiction into for loop.
- Link to v2: https://lore.kernel.org/r/20250326-fix-link-training-v2-0-756c8306f500@ite.com.tw
Changes in v2:
- 1. Split [PATCH 1/3] into 3 commits
- 2. Drop non necessary variable auto_ttrain_retry
- Link to v1: https://lore.kernel.org/all/20250318-fix-link-training-v1-0-19266711142c@ite.com.tw/
---
Hermes Wu (5):
drm/bridge: it6505: fix link training state HW register reset
drm/bridge: it6505: check INT_LINK_TRAIN_FAIL while link auto training
drm/bridge: it6505: modify DP link auto training
drm/bridge: it6505: modify DP link training work
drm/bridge: it6505: skip auto training when previous try fail
drivers/gpu/drm/bridge/ite-it6505.c | 88 +++++++++++++++++++++----------------
1 file changed, 50 insertions(+), 38 deletions(-)
---
base-commit: 938fbb16aba8f7b88e0fdcf56f315a5bbad41aad
change-id: 20250121-fix-link-training-461495494655
Best regards,
--
Hermes Wu <Hermes.wu@ite.com.tw>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RESEND v3 1/5] drm/bridge: it6505: fix link training state HW register reset
2025-09-16 4:47 [PATCH RESEND v3 0/5] drm/bridge: it6505: fix DP link traning and improve compatibility Hermes Wu via B4 Relay
@ 2025-09-16 4:47 ` Hermes Wu via B4 Relay
2025-09-16 10:40 ` Dmitry Baryshkov
2025-09-16 4:47 ` [PATCH RESEND v3 2/5] drm/bridge: it6505: check INT_LINK_TRAIN_FAIL while link auto training Hermes Wu via B4 Relay
` (3 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Hermes Wu via B4 Relay @ 2025-09-16 4:47 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Pet.Weng, Kenneth.Hung, treapking, dri-devel, linux-kernel,
Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
When connect to a DP-to-HDMI device which does not connect
to HDMI sink, it will report DPCD 00200h with SINK_COUNT = "0",
and issue HPD_IRQ when SINK_COUNT change to "1".
IT6505 can not recive HPD_IRQ before training done and driver will
force HW enter training done state when connect to such devices.
When HW is force to training done state and restart link training,
bits FORCE_RETRAIN and MANUAL_TRAIN at REG_TRAIN_CTRL1 must be set
at the same time to reset HW state.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 88ef76a37fe6accacdd343839ff2569b31b18ceb..b47042dc06bb1e1dfd92bc0dc6d69dc918a140ba 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -1806,7 +1806,9 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
mutex_lock(&it6505->aux_lock);
it6505_set_bits(it6505, REG_TRAIN_CTRL0,
FORCE_CR_DONE | FORCE_EQ_DONE, 0x00);
- it6505_write(it6505, REG_TRAIN_CTRL1, FORCE_RETRAIN);
+ /* reset link state machine and re start training*/
+ it6505_write(it6505, REG_TRAIN_CTRL1,
+ FORCE_RETRAIN | MANUAL_TRAIN);
it6505_write(it6505, REG_TRAIN_CTRL1, AUTO_TRAIN);
while (timeout > 0) {
@@ -2377,7 +2379,7 @@ static void it6505_stop_link_train(struct it6505 *it6505)
{
it6505->link_state = LINK_IDLE;
cancel_work_sync(&it6505->link_works);
- it6505_write(it6505, REG_TRAIN_CTRL1, FORCE_RETRAIN);
+ it6505_write(it6505, REG_TRAIN_CTRL1, FORCE_RETRAIN | MANUAL_TRAIN);
}
static void it6505_link_train_ok(struct it6505 *it6505)
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH RESEND v3 2/5] drm/bridge: it6505: check INT_LINK_TRAIN_FAIL while link auto training
2025-09-16 4:47 [PATCH RESEND v3 0/5] drm/bridge: it6505: fix DP link traning and improve compatibility Hermes Wu via B4 Relay
2025-09-16 4:47 ` [PATCH RESEND v3 1/5] drm/bridge: it6505: fix link training state HW register reset Hermes Wu via B4 Relay
@ 2025-09-16 4:47 ` Hermes Wu via B4 Relay
2025-09-16 10:41 ` Dmitry Baryshkov
2025-09-16 4:47 ` [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP " Hermes Wu via B4 Relay
` (2 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Hermes Wu via B4 Relay @ 2025-09-16 4:47 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Pet.Weng, Kenneth.Hung, treapking, dri-devel, linux-kernel,
Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
When start link training, interrupt status INT_LINK_TRAIN_FAIL can
use to check link training fail and no need to wait until timeout.
it6505_irq_link_train_fail() remove from interrupt and no longer used.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index b47042dc06bb1e1dfd92bc0dc6d69dc918a140ba..7f6227c278a51358c70a3de93454aafeef64f2bb 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -821,8 +821,8 @@ static void it6505_int_mask_enable(struct it6505 *it6505)
it6505_write(it6505, INT_MASK_02, BIT(INT_AUX_CMD_FAIL) |
BIT(INT_HDCP_KSV_CHECK) | BIT(INT_AUDIO_FIFO_ERROR));
- it6505_write(it6505, INT_MASK_03, BIT(INT_LINK_TRAIN_FAIL) |
- BIT(INT_VID_FIFO_ERROR) | BIT(INT_IO_LATCH_FIFO_OVERFLOW));
+ it6505_write(it6505, INT_MASK_03, BIT(INT_VID_FIFO_ERROR) |
+ BIT(INT_IO_LATCH_FIFO_OVERFLOW));
}
static void it6505_int_mask_disable(struct it6505 *it6505)
@@ -1802,6 +1802,8 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
{
int timeout = 500, link_training_state;
bool state = false;
+ int int03;
+ struct device *dev = it6505->dev;
mutex_lock(&it6505->aux_lock);
it6505_set_bits(it6505, REG_TRAIN_CTRL0,
@@ -1814,6 +1816,17 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
while (timeout > 0) {
usleep_range(1000, 2000);
link_training_state = it6505_read(it6505, REG_LINK_TRAIN_STS);
+ int03 = it6505_read(it6505, INT_STATUS_03);
+ if (int03 & BIT(INT_LINK_TRAIN_FAIL)) {
+ it6505_write(it6505, INT_STATUS_03,
+ BIT(INT_LINK_TRAIN_FAIL));
+
+ DRM_DEV_DEBUG_DRIVER(dev,
+ "INT_LINK_TRAIN_FAIL(%x)!",
+ int03);
+
+ break;
+ }
if (link_training_state > 0 &&
(link_training_state & LINK_STATE_NORP)) {
@@ -2693,14 +2706,6 @@ static void it6505_irq_audio_fifo_error(struct it6505 *it6505)
it6505_enable_audio(it6505);
}
-static void it6505_irq_link_train_fail(struct it6505 *it6505)
-{
- struct device *dev = it6505->dev;
-
- DRM_DEV_DEBUG_DRIVER(dev, "link training fail interrupt");
- schedule_work(&it6505->link_works);
-}
-
static bool it6505_test_bit(unsigned int bit, const unsigned int *addr)
{
return 1 & (addr[bit / BITS_PER_BYTE] >> (bit % BITS_PER_BYTE));
@@ -2765,7 +2770,6 @@ static irqreturn_t it6505_int_threaded_handler(int unused, void *data)
{ BIT_INT_AUX_CMD_FAIL, it6505_irq_aux_cmd_fail },
{ BIT_INT_HDCP_KSV_CHECK, it6505_irq_hdcp_ksv_check },
{ BIT_INT_AUDIO_FIFO_ERROR, it6505_irq_audio_fifo_error },
- { BIT_INT_LINK_TRAIN_FAIL, it6505_irq_link_train_fail },
};
int int_status[3], i;
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP link auto training
2025-09-16 4:47 [PATCH RESEND v3 0/5] drm/bridge: it6505: fix DP link traning and improve compatibility Hermes Wu via B4 Relay
2025-09-16 4:47 ` [PATCH RESEND v3 1/5] drm/bridge: it6505: fix link training state HW register reset Hermes Wu via B4 Relay
2025-09-16 4:47 ` [PATCH RESEND v3 2/5] drm/bridge: it6505: check INT_LINK_TRAIN_FAIL while link auto training Hermes Wu via B4 Relay
@ 2025-09-16 4:47 ` Hermes Wu via B4 Relay
2025-09-16 10:48 ` Dmitry Baryshkov
2025-09-16 4:47 ` [PATCH RESEND v3 4/5] drm/bridge: it6505: modify DP link training work Hermes Wu via B4 Relay
2025-09-16 4:47 ` [PATCH RESEND v3 5/5] drm/bridge: it6505: skip auto training when previous try fail Hermes Wu via B4 Relay
4 siblings, 1 reply; 14+ messages in thread
From: Hermes Wu via B4 Relay @ 2025-09-16 4:47 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Pet.Weng, Kenneth.Hung, treapking, dri-devel, linux-kernel,
Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
IT6505 supports HW link training which will write DPCD and check
training status automatically.
In the case that driver set link rate at 2.7G and HW fail to training,
it will change link configuration and try 1.65G. And this will cause
INT_VID_FIFO_ERROR triggered when link clock is changed.
When video error occurs, video logic is reset and link training restart,
this will cause endless auto link training.
Modify link auto training with disable INT_VID_FIFO_ERROR to avoid loop
and check INT_LINK_TRAIN_FAIL event to abort wait training done.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 7f6227c278a51358c70a3de93454aafeef64f2bb..f9b99c70789eea6beb3c6513155c9a4ca103d219 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -1806,6 +1806,13 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
struct device *dev = it6505->dev;
mutex_lock(&it6505->aux_lock);
+
+ /* Disable FIFO error interrupt trigger */
+ /* to prevent training fail loop issue */
+ it6505_set_bits(it6505, INT_MASK_03, BIT(INT_VID_FIFO_ERROR), 0);
+
+ it6505_write(it6505, INT_STATUS_03,
+ BIT(INT_LINK_TRAIN_FAIL) | BIT(INT_VID_FIFO_ERROR));
it6505_set_bits(it6505, REG_TRAIN_CTRL0,
FORCE_CR_DONE | FORCE_EQ_DONE, 0x00);
/* reset link state machine and re start training*/
@@ -1818,8 +1825,10 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
link_training_state = it6505_read(it6505, REG_LINK_TRAIN_STS);
int03 = it6505_read(it6505, INT_STATUS_03);
if (int03 & BIT(INT_LINK_TRAIN_FAIL)) {
+ /* Ignore INT_VID_FIFO_ERROR when auto training fail*/
it6505_write(it6505, INT_STATUS_03,
- BIT(INT_LINK_TRAIN_FAIL));
+ BIT(INT_LINK_TRAIN_FAIL) |
+ BIT(INT_VID_FIFO_ERROR));
DRM_DEV_DEBUG_DRIVER(dev,
"INT_LINK_TRAIN_FAIL(%x)!",
@@ -1837,6 +1846,9 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
timeout--;
}
unlock:
+ /* recover interrupt trigger*/
+ it6505_set_bits(it6505, INT_MASK_03,
+ BIT(INT_VID_FIFO_ERROR), BIT(INT_VID_FIFO_ERROR));
mutex_unlock(&it6505->aux_lock);
return state;
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH RESEND v3 4/5] drm/bridge: it6505: modify DP link training work
2025-09-16 4:47 [PATCH RESEND v3 0/5] drm/bridge: it6505: fix DP link traning and improve compatibility Hermes Wu via B4 Relay
` (2 preceding siblings ...)
2025-09-16 4:47 ` [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP " Hermes Wu via B4 Relay
@ 2025-09-16 4:47 ` Hermes Wu via B4 Relay
2025-09-16 10:44 ` Dmitry Baryshkov
2025-09-16 4:47 ` [PATCH RESEND v3 5/5] drm/bridge: it6505: skip auto training when previous try fail Hermes Wu via B4 Relay
4 siblings, 1 reply; 14+ messages in thread
From: Hermes Wu via B4 Relay @ 2025-09-16 4:47 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Pet.Weng, Kenneth.Hung, treapking, dri-devel, linux-kernel,
Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
The DP link training work include auto training and after
auto training failed "AUTO_TRAIN_RETRY" times, it switch to
step training mode.
It will more efficiency that finish link auto training,
include retry, and step training in a work, rather than
re-schedule train work when each training fail.
Drop auto_train_retry from it6505 structure,
and it6505_dump() is remove from link trainig work,
it takes too much time to read all register area,
and is not necessary.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 40 ++++++++++++++-----------------------
1 file changed, 15 insertions(+), 25 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index f9b99c70789eea6beb3c6513155c9a4ca103d219..bff5f18fb5ae7192242308f034b60af9807c192c 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -467,7 +467,6 @@ struct it6505 {
struct delayed_work hdcp_work;
struct work_struct hdcp_wait_ksv_list;
struct completion extcon_completion;
- u8 auto_train_retry;
bool hdcp_desired;
bool is_repeater;
u8 hdcp_down_stream_count;
@@ -666,7 +665,7 @@ static int it6505_get_dpcd(struct it6505 *it6505, int offset, u8 *dpcd, int num)
return 0;
}
-static void it6505_dump(struct it6505 *it6505)
+static void __maybe_unused it6505_dump(struct it6505 *it6505)
{
unsigned int i, j;
u8 regs[16];
@@ -1399,7 +1398,6 @@ static void it6505_variable_config(struct it6505 *it6505)
it6505->lane_count = MAX_LANE_COUNT;
it6505->link_state = LINK_IDLE;
it6505->hdcp_desired = HDCP_DESIRED;
- it6505->auto_train_retry = AUTO_TRAIN_RETRY;
it6505->audio.select = AUDIO_SELECT;
it6505->audio.sample_rate = AUDIO_SAMPLE_RATE;
it6505->audio.channel_count = AUDIO_CHANNEL_COUNT;
@@ -2467,7 +2465,7 @@ static void it6505_link_training_work(struct work_struct *work)
{
struct it6505 *it6505 = container_of(work, struct it6505, link_works);
struct device *dev = it6505->dev;
- int ret;
+ int ret, retry;
DRM_DEV_DEBUG_DRIVER(dev, "it6505->sink_count: %d",
it6505->sink_count);
@@ -2475,27 +2473,22 @@ static void it6505_link_training_work(struct work_struct *work)
if (!it6505_get_sink_hpd_status(it6505))
return;
- it6505_link_training_setup(it6505);
- it6505_reset_hdcp(it6505);
- it6505_aux_reset(it6505);
-
- if (it6505->auto_train_retry < 1) {
- it6505_link_step_train_process(it6505);
- return;
- }
-
- ret = it6505_link_start_auto_train(it6505);
- DRM_DEV_DEBUG_DRIVER(dev, "auto train %s, auto_train_retry: %d",
- ret ? "pass" : "failed", it6505->auto_train_retry);
+ for (retry = AUTO_TRAIN_RETRY; retry > 0; retry--) {
+ it6505_link_training_setup(it6505);
+ it6505_reset_hdcp(it6505);
+ it6505_aux_reset(it6505);
- if (ret) {
- it6505->auto_train_retry = AUTO_TRAIN_RETRY;
- it6505_link_train_ok(it6505);
- } else {
- it6505->auto_train_retry--;
- it6505_dump(it6505);
+ ret = it6505_link_start_auto_train(it6505);
+ DRM_DEV_DEBUG_DRIVER(dev, "auto train %s,",
+ ret ? "pass" : "failed");
+ if (ret) {
+ it6505_link_train_ok(it6505);
+ return;
+ }
}
+ /*After HW auto training fail, try link training step by step*/
+ it6505_link_step_train_process(it6505);
}
static void it6505_plugged_status_to_codec(struct it6505 *it6505)
@@ -2576,7 +2569,6 @@ static int it6505_process_hpd_irq(struct it6505 *it6505)
(int)ARRAY_SIZE(link_status), link_status);
if (!drm_dp_channel_eq_ok(link_status, it6505->lane_count)) {
- it6505->auto_train_retry = AUTO_TRAIN_RETRY;
it6505_video_reset(it6505);
}
@@ -2602,7 +2594,6 @@ static void it6505_irq_hpd(struct it6505 *it6505)
it6505_variable_config(it6505);
it6505_parse_link_capabilities(it6505);
}
- it6505->auto_train_retry = AUTO_TRAIN_RETRY;
it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link,
DP_SET_POWER_D0);
@@ -2739,7 +2730,6 @@ static void it6505_irq_video_handler(struct it6505 *it6505, const int *int_statu
(unsigned int *)int_status)) ||
(it6505_test_bit(BIT_INT_VID_FIFO_ERROR,
(unsigned int *)int_status))) {
- it6505->auto_train_retry = AUTO_TRAIN_RETRY;
flush_work(&it6505->link_works);
it6505_stop_hdcp(it6505);
it6505_video_reset(it6505);
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH RESEND v3 5/5] drm/bridge: it6505: skip auto training when previous try fail
2025-09-16 4:47 [PATCH RESEND v3 0/5] drm/bridge: it6505: fix DP link traning and improve compatibility Hermes Wu via B4 Relay
` (3 preceding siblings ...)
2025-09-16 4:47 ` [PATCH RESEND v3 4/5] drm/bridge: it6505: modify DP link training work Hermes Wu via B4 Relay
@ 2025-09-16 4:47 ` Hermes Wu via B4 Relay
2025-09-16 10:47 ` Dmitry Baryshkov
4 siblings, 1 reply; 14+ messages in thread
From: Hermes Wu via B4 Relay @ 2025-09-16 4:47 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter
Cc: Pet.Weng, Kenneth.Hung, treapking, dri-devel, linux-kernel,
Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
When connect to device which can only training done by
step training, skip auto training when link training restart,
usually happen when display resolution is changed.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index bff5f18fb5ae7192242308f034b60af9807c192c..20eae23cb46a4cb3fc18dd2ed3b764f2265262ca 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -467,6 +467,7 @@ struct it6505 {
struct delayed_work hdcp_work;
struct work_struct hdcp_wait_ksv_list;
struct completion extcon_completion;
+ u8 step_train_only;
bool hdcp_desired;
bool is_repeater;
u8 hdcp_down_stream_count;
@@ -2452,11 +2453,13 @@ static void it6505_link_step_train_process(struct it6505 *it6505)
ret ? "pass" : "failed", i + 1);
if (ret) {
it6505_link_train_ok(it6505);
+ it6505->step_train_only = true;
return;
}
}
DRM_DEV_DEBUG_DRIVER(dev, "training fail");
+ it6505->step_train_only = false;
it6505->link_state = LINK_IDLE;
it6505_video_reset(it6505);
}
@@ -2473,14 +2476,14 @@ static void it6505_link_training_work(struct work_struct *work)
if (!it6505_get_sink_hpd_status(it6505))
return;
- for (retry = AUTO_TRAIN_RETRY; retry > 0; retry--) {
+ for (retry = AUTO_TRAIN_RETRY; retry > 0 && !it6505->step_train_only; retry--) {
it6505_link_training_setup(it6505);
it6505_reset_hdcp(it6505);
it6505_aux_reset(it6505);
ret = it6505_link_start_auto_train(it6505);
DRM_DEV_DEBUG_DRIVER(dev, "auto train %s,",
- ret ? "pass" : "failed");
+ ret ? "pass" : "failed");
if (ret) {
it6505_link_train_ok(it6505);
return;
@@ -2594,6 +2597,7 @@ static void it6505_irq_hpd(struct it6505 *it6505)
it6505_variable_config(it6505);
it6505_parse_link_capabilities(it6505);
}
+ it6505->step_train_only = false;
it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link,
DP_SET_POWER_D0);
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH RESEND v3 1/5] drm/bridge: it6505: fix link training state HW register reset
2025-09-16 4:47 ` [PATCH RESEND v3 1/5] drm/bridge: it6505: fix link training state HW register reset Hermes Wu via B4 Relay
@ 2025-09-16 10:40 ` Dmitry Baryshkov
0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Baryshkov @ 2025-09-16 10:40 UTC (permalink / raw)
To: Hermes.wu
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Pet.Weng,
Kenneth.Hung, treapking, dri-devel, linux-kernel
On Tue, Sep 16, 2025 at 12:47:41PM +0800, Hermes Wu via B4 Relay wrote:
> From: Hermes Wu <Hermes.wu@ite.com.tw>
>
> When connect to a DP-to-HDMI device which does not connect
> to HDMI sink, it will report DPCD 00200h with SINK_COUNT = "0",
> and issue HPD_IRQ when SINK_COUNT change to "1".
>
> IT6505 can not recive HPD_IRQ before training done and driver will
> force HW enter training done state when connect to such devices.
>
> When HW is force to training done state and restart link training,
> bits FORCE_RETRAIN and MANUAL_TRAIN at REG_TRAIN_CTRL1 must be set
> at the same time to reset HW state.
>
> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> ---
> drivers/gpu/drm/bridge/ite-it6505.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH RESEND v3 2/5] drm/bridge: it6505: check INT_LINK_TRAIN_FAIL while link auto training
2025-09-16 4:47 ` [PATCH RESEND v3 2/5] drm/bridge: it6505: check INT_LINK_TRAIN_FAIL while link auto training Hermes Wu via B4 Relay
@ 2025-09-16 10:41 ` Dmitry Baryshkov
0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Baryshkov @ 2025-09-16 10:41 UTC (permalink / raw)
To: Hermes.wu
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Pet.Weng,
Kenneth.Hung, treapking, dri-devel, linux-kernel
On Tue, Sep 16, 2025 at 12:47:42PM +0800, Hermes Wu via B4 Relay wrote:
> From: Hermes Wu <Hermes.wu@ite.com.tw>
>
> When start link training, interrupt status INT_LINK_TRAIN_FAIL can
> use to check link training fail and no need to wait until timeout.
>
> it6505_irq_link_train_fail() remove from interrupt and no longer used.
>
> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> ---
> drivers/gpu/drm/bridge/ite-it6505.c | 26 +++++++++++++++-----------
> 1 file changed, 15 insertions(+), 11 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH RESEND v3 4/5] drm/bridge: it6505: modify DP link training work
2025-09-16 4:47 ` [PATCH RESEND v3 4/5] drm/bridge: it6505: modify DP link training work Hermes Wu via B4 Relay
@ 2025-09-16 10:44 ` Dmitry Baryshkov
0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Baryshkov @ 2025-09-16 10:44 UTC (permalink / raw)
To: Hermes.wu
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Pet.Weng,
Kenneth.Hung, treapking, dri-devel, linux-kernel
On Tue, Sep 16, 2025 at 12:47:44PM +0800, Hermes Wu via B4 Relay wrote:
> From: Hermes Wu <Hermes.wu@ite.com.tw>
>
> The DP link training work include auto training and after
> auto training failed "AUTO_TRAIN_RETRY" times, it switch to
> step training mode.
>
> It will more efficiency that finish link auto training,
> include retry, and step training in a work, rather than
> re-schedule train work when each training fail.
>
> Drop auto_train_retry from it6505 structure,
> and it6505_dump() is remove from link trainig work,
> it takes too much time to read all register area,
> and is not necessary.
Nit: please fix your editor to wrap commit messages on a more typical
boundary (72-75-77 chars).
Otherwise:
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>
> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> ---
> drivers/gpu/drm/bridge/ite-it6505.c | 40 ++++++++++++++-----------------------
> 1 file changed, 15 insertions(+), 25 deletions(-)
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH RESEND v3 5/5] drm/bridge: it6505: skip auto training when previous try fail
2025-09-16 4:47 ` [PATCH RESEND v3 5/5] drm/bridge: it6505: skip auto training when previous try fail Hermes Wu via B4 Relay
@ 2025-09-16 10:47 ` Dmitry Baryshkov
0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Baryshkov @ 2025-09-16 10:47 UTC (permalink / raw)
To: Hermes.wu
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Pet.Weng,
Kenneth.Hung, treapking, dri-devel, linux-kernel
On Tue, Sep 16, 2025 at 12:47:45PM +0800, Hermes Wu via B4 Relay wrote:
> From: Hermes Wu <Hermes.wu@ite.com.tw>
>
> When connect to device which can only training done by
> step training,
> skip auto training when link training restart,
> usually happen when display resolution is changed.
Please expand your commit message for it to make sense to somebody who
doesn't know the issue. If I understood it correctly, it should be
something like 'The driver performs a full cycle of attempting auto link
training and then manual link training on each modeset. Save time by
skipping the auto training if it failed previously for this monitor'.
>
> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> ---
> drivers/gpu/drm/bridge/ite-it6505.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP link auto training
2025-09-16 4:47 ` [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP " Hermes Wu via B4 Relay
@ 2025-09-16 10:48 ` Dmitry Baryshkov
2025-09-17 8:37 ` Hermes.Wu
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Baryshkov @ 2025-09-16 10:48 UTC (permalink / raw)
To: Hermes.wu
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Pet.Weng,
Kenneth.Hung, treapking, dri-devel, linux-kernel
On Tue, Sep 16, 2025 at 12:47:43PM +0800, Hermes Wu via B4 Relay wrote:
> From: Hermes Wu <Hermes.wu@ite.com.tw>
>
> IT6505 supports HW link training which will write DPCD and check
> training status automatically.
>
> In the case that driver set link rate at 2.7G and HW fail to training,
> it will change link configuration and try 1.65G. And this will cause
> INT_VID_FIFO_ERROR triggered when link clock is changed.
>
> When video error occurs, video logic is reset and link training restart,
> this will cause endless auto link training.
>
> Modify link auto training with disable INT_VID_FIFO_ERROR to avoid loop
> and check INT_LINK_TRAIN_FAIL event to abort wait training done.
>
> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> ---
> drivers/gpu/drm/bridge/ite-it6505.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 7f6227c278a51358c70a3de93454aafeef64f2bb..f9b99c70789eea6beb3c6513155c9a4ca103d219 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -1806,6 +1806,13 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
> struct device *dev = it6505->dev;
>
> mutex_lock(&it6505->aux_lock);
> +
> + /* Disable FIFO error interrupt trigger */
> + /* to prevent training fail loop issue */
> + it6505_set_bits(it6505, INT_MASK_03, BIT(INT_VID_FIFO_ERROR), 0);
> +
> + it6505_write(it6505, INT_STATUS_03,
> + BIT(INT_LINK_TRAIN_FAIL) | BIT(INT_VID_FIFO_ERROR));
> it6505_set_bits(it6505, REG_TRAIN_CTRL0,
> FORCE_CR_DONE | FORCE_EQ_DONE, 0x00);
> /* reset link state machine and re start training*/
> @@ -1818,8 +1825,10 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
> link_training_state = it6505_read(it6505, REG_LINK_TRAIN_STS);
> int03 = it6505_read(it6505, INT_STATUS_03);
> if (int03 & BIT(INT_LINK_TRAIN_FAIL)) {
> + /* Ignore INT_VID_FIFO_ERROR when auto training fail*/
> it6505_write(it6505, INT_STATUS_03,
> - BIT(INT_LINK_TRAIN_FAIL));
> + BIT(INT_LINK_TRAIN_FAIL) |
> + BIT(INT_VID_FIFO_ERROR));
I'm really unusure about this change. Judging by the description of the
problem, it's fix for the issue, but the issue gets introduced in the
previous patch.
>
> DRM_DEV_DEBUG_DRIVER(dev,
> "INT_LINK_TRAIN_FAIL(%x)!",
> @@ -1837,6 +1846,9 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
> timeout--;
> }
> unlock:
> + /* recover interrupt trigger*/
> + it6505_set_bits(it6505, INT_MASK_03,
> + BIT(INT_VID_FIFO_ERROR), BIT(INT_VID_FIFO_ERROR));
> mutex_unlock(&it6505->aux_lock);
>
> return state;
>
> --
> 2.34.1
>
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP link auto training
2025-09-16 10:48 ` Dmitry Baryshkov
@ 2025-09-17 8:37 ` Hermes.Wu
2025-09-17 13:47 ` Dmitry Baryshkov
0 siblings, 1 reply; 14+ messages in thread
From: Hermes.Wu @ 2025-09-17 8:37 UTC (permalink / raw)
To: dmitry.baryshkov
Cc: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, Pet.Weng, Kenneth.Hung, treapking, dri-devel,
linux-kernel
>-----Original Message-----
>From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>Sent: Tuesday, September 16, 2025 6:49 PM
>To: Hermes Wu (吳佳宏) <Hermes.Wu@ite.com.tw>
>Cc: Andrzej Hajda <andrzej.hajda@intel.com>; Neil Armstrong <neil.armstrong@linaro.org>; Robert Foss <rfoss@kernel.org>; Laurent Pinchart <Laurent.pinchart@ideasonboard.com>; Jonas Karlman <jonas@kwiboo.se>; Jernej Skrabec <jernej.skrabec@gmail.com>; Maarten Lankhorst <maarten.lankhorst@linux.intel.com>; Maxime Ripard <mripard@kernel.org>; Thomas Zimmermann <tzimmermann@suse.de>; David Airlie <airlied@gmail.com>; Simona Vetter <simona@ffwll.ch>; Pet Weng (翁玉芬) <Pet.Weng@ite.com.tw>; Kenneth Hung (洪家倫) <Kenneth.Hung@ite.com.tw>; treapking@chromium.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org
>Subject: Re: [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP link auto training
>
>On Tue, Sep 16, 2025 at 12:47:43PM +0800, Hermes Wu via B4 Relay wrote:
>> From: Hermes Wu <Hermes.wu@ite.com.tw>
>>
>> IT6505 supports HW link training which will write DPCD and check
>> training status automatically.
>>
>> In the case that driver set link rate at 2.7G and HW fail to training,
>> it will change link configuration and try 1.65G. And this will cause
>> INT_VID_FIFO_ERROR triggered when link clock is changed.
>>
>> When video error occurs, video logic is reset and link training restart,
>> this will cause endless auto link training.
>>
>> Modify link auto training with disable INT_VID_FIFO_ERROR to avoid loop
>> and check INT_LINK_TRAIN_FAIL event to abort wait training done.
>>
>> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
>> ---
>> drivers/gpu/drm/bridge/ite-it6505.c | 14 +++++++++++++-
>> 1 file changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
>> index 7f6227c278a51358c70a3de93454aafeef64f2bb..f9b99c70789eea6beb3c6513155c9a4ca103d219 100644
>> --- a/drivers/gpu/drm/bridge/ite-it6505.c
>> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
>> @@ -1806,6 +1806,13 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
>> struct device *dev = it6505->dev;
>>
>> mutex_lock(&it6505->aux_lock);
>> +
>> + /* Disable FIFO error interrupt trigger */
>> + /* to prevent training fail loop issue */
>> + it6505_set_bits(it6505, INT_MASK_03, BIT(INT_VID_FIFO_ERROR), 0);
>> +
>> + it6505_write(it6505, INT_STATUS_03,
>> + BIT(INT_LINK_TRAIN_FAIL) | BIT(INT_VID_FIFO_ERROR));
>> it6505_set_bits(it6505, REG_TRAIN_CTRL0,
>> FORCE_CR_DONE | FORCE_EQ_DONE, 0x00);
>> /* reset link state machine and re start training*/
>> @@ -1818,8 +1825,10 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
>> link_training_state = it6505_read(it6505, REG_LINK_TRAIN_STS);
>> int03 = it6505_read(it6505, INT_STATUS_03);
>> if (int03 & BIT(INT_LINK_TRAIN_FAIL)) {
>> + /* Ignore INT_VID_FIFO_ERROR when auto training fail*/
>> it6505_write(it6505, INT_STATUS_03,
>> - BIT(INT_LINK_TRAIN_FAIL));
>> + BIT(INT_LINK_TRAIN_FAIL) |
>> + BIT(INT_VID_FIFO_ERROR));
>
>I'm really unusure about this change. Judging by the description of the
>problem, it's fix for the issue, but the issue gets introduced in the
>previous patch.
In this patch serious?
This patch serious fix this FIFO error issue, it change link training algorithm first then fix wrong FIFO error status.
The link training process start after video status is stable, and when video FIFO error occurs,
video stable status will also lost, link training will reset to idle and wait until video stable again.
IT6505 HW auto training will process link training automatically, which include CR/EQ DPCD setting, link status check,
and try lower link rate is the 2.7G cannot pass training.
In some case, DP connect to a DP sink device which cannot pass IT6505 HW auto training.
when link auto training fail on 2.7G and IT6505 HW change link rate to 1.65G and retry training automatically,
at this time video FIFO error will occur because of the link rate change(chip issue), the video signal from SOC is not lost actually.
>>
>> DRM_DEV_DEBUG_DRIVER(dev,
>> "INT_LINK_TRAIN_FAIL(%x)!",
>> @@ -1837,6 +1846,9 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
>> timeout--;
>> }
>> unlock:
>> + /* recover interrupt trigger*/
>> + it6505_set_bits(it6505, INT_MASK_03,
>> + BIT(INT_VID_FIFO_ERROR), BIT(INT_VID_FIFO_ERROR));
>> mutex_unlock(&it6505->aux_lock);
>>
>> return state;
>>
>> --
>> 2.34.1
>>
>>
>
>--
>With best wishes
>Dmitry
>
BR.
Hermes Wu
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP link auto training
2025-09-17 8:37 ` Hermes.Wu
@ 2025-09-17 13:47 ` Dmitry Baryshkov
2025-09-18 2:23 ` Hermes.Wu
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Baryshkov @ 2025-09-17 13:47 UTC (permalink / raw)
To: Hermes.Wu
Cc: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, Pet.Weng, Kenneth.Hung, treapking, dri-devel,
linux-kernel
On Wed, Sep 17, 2025 at 08:37:10AM +0000, Hermes.Wu@ite.com.tw wrote:
>
> >-----Original Message-----
> >From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> >Sent: Tuesday, September 16, 2025 6:49 PM
> >To: Hermes Wu (吳佳宏) <Hermes.Wu@ite.com.tw>
> >Cc: Andrzej Hajda <andrzej.hajda@intel.com>; Neil Armstrong <neil.armstrong@linaro.org>; Robert Foss <rfoss@kernel.org>; Laurent Pinchart <Laurent.pinchart@ideasonboard.com>; Jonas Karlman <jonas@kwiboo.se>; Jernej Skrabec <jernej.skrabec@gmail.com>; Maarten Lankhorst <maarten.lankhorst@linux.intel.com>; Maxime Ripard <mripard@kernel.org>; Thomas Zimmermann <tzimmermann@suse.de>; David Airlie <airlied@gmail.com>; Simona Vetter <simona@ffwll.ch>; Pet Weng (翁玉芬) <Pet.Weng@ite.com.tw>; Kenneth Hung (洪家倫) <Kenneth.Hung@ite.com.tw>; treapking@chromium.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org
> >Subject: Re: [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP link auto training
> >
> >On Tue, Sep 16, 2025 at 12:47:43PM +0800, Hermes Wu via B4 Relay wrote:
> >> From: Hermes Wu <Hermes.wu@ite.com.tw>
> >>
> >> IT6505 supports HW link training which will write DPCD and check
> >> training status automatically.
> >>
> >> In the case that driver set link rate at 2.7G and HW fail to training,
> >> it will change link configuration and try 1.65G. And this will cause
> >> INT_VID_FIFO_ERROR triggered when link clock is changed.
> >>
> >> When video error occurs, video logic is reset and link training restart,
> >> this will cause endless auto link training.
> >>
> >> Modify link auto training with disable INT_VID_FIFO_ERROR to avoid loop
> >> and check INT_LINK_TRAIN_FAIL event to abort wait training done.
> >>
> >> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> >> ---
> >> drivers/gpu/drm/bridge/ite-it6505.c | 14 +++++++++++++-
> >> 1 file changed, 13 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> >> index 7f6227c278a51358c70a3de93454aafeef64f2bb..f9b99c70789eea6beb3c6513155c9a4ca103d219 100644
> >> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> >> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> >> @@ -1806,6 +1806,13 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
> >> struct device *dev = it6505->dev;
> >>
> >> mutex_lock(&it6505->aux_lock);
> >> +
> >> + /* Disable FIFO error interrupt trigger */
> >> + /* to prevent training fail loop issue */
> >> + it6505_set_bits(it6505, INT_MASK_03, BIT(INT_VID_FIFO_ERROR), 0);
> >> +
> >> + it6505_write(it6505, INT_STATUS_03,
> >> + BIT(INT_LINK_TRAIN_FAIL) | BIT(INT_VID_FIFO_ERROR));
> >> it6505_set_bits(it6505, REG_TRAIN_CTRL0,
> >> FORCE_CR_DONE | FORCE_EQ_DONE, 0x00);
> >> /* reset link state machine and re start training*/
> >> @@ -1818,8 +1825,10 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
> >> link_training_state = it6505_read(it6505, REG_LINK_TRAIN_STS);
> >> int03 = it6505_read(it6505, INT_STATUS_03);
> >> if (int03 & BIT(INT_LINK_TRAIN_FAIL)) {
> >> + /* Ignore INT_VID_FIFO_ERROR when auto training fail*/
> >> it6505_write(it6505, INT_STATUS_03,
> >> - BIT(INT_LINK_TRAIN_FAIL));
> >> + BIT(INT_LINK_TRAIN_FAIL) |
> >> + BIT(INT_VID_FIFO_ERROR));
> >
> >I'm really unusure about this change. Judging by the description of the
> >problem, it's fix for the issue, but the issue gets introduced in the
> >previous patch.
> In this patch serious?
>
> This patch serious fix this FIFO error issue, it change link training algorithm first then fix wrong FIFO error status.
>
> The link training process start after video status is stable, and when video FIFO error occurs,
> video stable status will also lost, link training will reset to idle and wait until video stable again.
>
> IT6505 HW auto training will process link training automatically, which include CR/EQ DPCD setting, link status check,
> and try lower link rate is the 2.7G cannot pass training.
>
> In some case, DP connect to a DP sink device which cannot pass IT6505 HW auto training.
> when link auto training fail on 2.7G and IT6505 HW change link rate to 1.65G and retry training automatically,
> at this time video FIFO error will occur because of the link rate change(chip issue), the video signal from SOC is not lost actually.
We seems to be misunderstanding each other. I pointed out that your are
fixing the code that was introduced in the previous patch. Would it make
more sense to reoder or to squash the patches?
>
>
> >>
> >> DRM_DEV_DEBUG_DRIVER(dev,
> >> "INT_LINK_TRAIN_FAIL(%x)!",
> >> @@ -1837,6 +1846,9 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
> >> timeout--;
> >> }
> >> unlock:
> >> + /* recover interrupt trigger*/
> >> + it6505_set_bits(it6505, INT_MASK_03,
> >> + BIT(INT_VID_FIFO_ERROR), BIT(INT_VID_FIFO_ERROR));
> >> mutex_unlock(&it6505->aux_lock);
> >>
> >> return state;
> >>
> >> --
> >> 2.34.1
> >>
> >>
> >
> >--
> >With best wishes
> >Dmitry
> >
> BR.
> Hermes Wu
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP link auto training
2025-09-17 13:47 ` Dmitry Baryshkov
@ 2025-09-18 2:23 ` Hermes.Wu
0 siblings, 0 replies; 14+ messages in thread
From: Hermes.Wu @ 2025-09-18 2:23 UTC (permalink / raw)
To: dmitry.baryshkov
Cc: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, Pet.Weng, Kenneth.Hung, treapking, dri-devel,
linux-kernel
>
>
>-----Original Message-----
>From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>Sent: Wednesday, September 17, 2025 9:47 PM
>To: Hermes Wu (吳佳宏) <Hermes.Wu@ite.com.tw>
>Cc: andrzej.hajda@intel.com; neil.armstrong@linaro.org; rfoss@kernel.org; Laurent.pinchart@ideasonboard.com; jonas@kwiboo.se; jernej.skrabec@gmail.com; maarten.lankhorst@linux.intel.com; mripard@kernel.org; tzimmermann@suse.de; airlied@gmail.com; simona@ffwll.ch; Pet Weng (翁玉芬) <Pet.Weng@ite.com.tw>; Kenneth Hung (洪家倫) <Kenneth.Hung@ite.com.tw>; treapking@chromium.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org
>Subject: Re: [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP link auto training
>
>On Wed, Sep 17, 2025 at 08:37:10AM +0000, Hermes.Wu@ite.com.tw wrote:
>>
>> >-----Original Message-----
>> >From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>> >Sent: Tuesday, September 16, 2025 6:49 PM
>> >To: Hermes Wu (吳佳宏) <Hermes.Wu@ite.com.tw>
>> >Cc: Andrzej Hajda <andrzej.hajda@intel.com>; Neil Armstrong <neil.armstrong@linaro.org>; Robert Foss <rfoss@kernel.org>; Laurent Pinchart <Laurent.pinchart@ideasonboard.com>; Jonas Karlman <jonas@kwiboo.se>; Jernej Skrabec <jernej.skrabec@gmail.com>; Maarten Lankhorst <maarten.lankhorst@linux.intel.com>; Maxime Ripard <mripard@kernel.org>; Thomas Zimmermann <tzimmermann@suse.de>; David Airlie <airlied@gmail.com>; Simona Vetter <simona@ffwll.ch>; Pet Weng (翁玉芬) <Pet.Weng@ite.com.tw>; Kenneth Hung (洪家倫) <Kenneth.Hung@ite.com.tw>; treapking@chromium.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org
>> >Subject: Re: [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP link auto training
>> >
>> >On Tue, Sep 16, 2025 at 12:47:43PM +0800, Hermes Wu via B4 Relay wrote:
>> >> From: Hermes Wu <Hermes.wu@ite.com.tw>
>> >>
>> >> IT6505 supports HW link training which will write DPCD and check
>> >> training status automatically.
>> >>
>> >> In the case that driver set link rate at 2.7G and HW fail to training,
>> >> it will change link configuration and try 1.65G. And this will cause
>> >> INT_VID_FIFO_ERROR triggered when link clock is changed.
>> >>
>> >> When video error occurs, video logic is reset and link training restart,
>> >> this will cause endless auto link training.
>> >>
>> >> Modify link auto training with disable INT_VID_FIFO_ERROR to avoid loop
>> >> and check INT_LINK_TRAIN_FAIL event to abort wait training done.
>> >>
>> >> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
>> >> ---
>> >> drivers/gpu/drm/bridge/ite-it6505.c | 14 +++++++++++++-
>> >> 1 file changed, 13 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
>> >> index 7f6227c278a51358c70a3de93454aafeef64f2bb..f9b99c70789eea6beb3c6513155c9a4ca103d219 100644
>> >> --- a/drivers/gpu/drm/bridge/ite-it6505.c
>> >> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
>> >> @@ -1806,6 +1806,13 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
>> >> struct device *dev = it6505->dev;
>> >>
>> >> mutex_lock(&it6505->aux_lock);
>> >> +
>> >> + /* Disable FIFO error interrupt trigger */
>> >> + /* to prevent training fail loop issue */
>> >> + it6505_set_bits(it6505, INT_MASK_03, BIT(INT_VID_FIFO_ERROR), 0);
>> >> +
>> >> + it6505_write(it6505, INT_STATUS_03,
>> >> + BIT(INT_LINK_TRAIN_FAIL) | BIT(INT_VID_FIFO_ERROR));
>> >> it6505_set_bits(it6505, REG_TRAIN_CTRL0,
>> >> FORCE_CR_DONE | FORCE_EQ_DONE, 0x00);
>> >> /* reset link state machine and re start training*/
>> >> @@ -1818,8 +1825,10 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
>> >> link_training_state = it6505_read(it6505, REG_LINK_TRAIN_STS);
>> >> int03 = it6505_read(it6505, INT_STATUS_03);
>> >> if (int03 & BIT(INT_LINK_TRAIN_FAIL)) {
>> >> + /* Ignore INT_VID_FIFO_ERROR when auto training fail*/
>> >> it6505_write(it6505, INT_STATUS_03,
>> >> - BIT(INT_LINK_TRAIN_FAIL));
>> >> + BIT(INT_LINK_TRAIN_FAIL) |
>> >> + BIT(INT_VID_FIFO_ERROR));
>> >
>> >I'm really unusure about this change. Judging by the description of the
>> >problem, it's fix for the issue, but the issue gets introduced in the
>> >previous patch.
>> In this patch serious?
>>
>> This patch serious fix this FIFO error issue, it change link training algorithm first then fix wrong FIFO error status.
>>
>> The link training process start after video status is stable, and when video FIFO error occurs,
>> video stable status will also lost, link training will reset to idle and wait until video stable again.
>>
>> IT6505 HW auto training will process link training automatically, which include CR/EQ DPCD setting, link status check,
>> and try lower link rate is the 2.7G cannot pass training.
>>
>> In some case, DP connect to a DP sink device which cannot pass IT6505 HW auto training.
>> when link auto training fail on 2.7G and IT6505 HW change link rate to 1.65G and retry training automatically,
>> at this time video FIFO error will occur because of the link rate change(chip issue), the video signal from SOC is not lost actually.
>
>We seems to be misunderstanding each other. I pointed out that your are
>fixing the code that was introduced in the previous patch. Would it make
>more sense to reoder or to squash the patches?
this patch can squash to previous one. they are part of auto link training fail check.
I will update in next patch serious
>>
>> >>
>> >> DRM_DEV_DEBUG_DRIVER(dev,
>> >> "INT_LINK_TRAIN_FAIL(%x)!",
>> >> @@ -1837,6 +1846,9 @@ static bool it6505_link_start_auto_train(struct it6505 *it6505)
>> >> timeout--;
>> >> }
>> >> unlock:
>> >> + /* recover interrupt trigger*/
>> >> + it6505_set_bits(it6505, INT_MASK_03,
>> >> + BIT(INT_VID_FIFO_ERROR), BIT(INT_VID_FIFO_ERROR));
>> >> mutex_unlock(&it6505->aux_lock);
>> >>
>> >> return state;
>> >>
>> >> --
>> >> 2.34.1
>> >>
>> >>
>> >
>> >--
>> >With best wishes
>> >Dmitry
>> >
>> BR.
>> Hermes Wu
>
>--
>With best wishes
>Dmitry
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-09-18 2:23 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16 4:47 [PATCH RESEND v3 0/5] drm/bridge: it6505: fix DP link traning and improve compatibility Hermes Wu via B4 Relay
2025-09-16 4:47 ` [PATCH RESEND v3 1/5] drm/bridge: it6505: fix link training state HW register reset Hermes Wu via B4 Relay
2025-09-16 10:40 ` Dmitry Baryshkov
2025-09-16 4:47 ` [PATCH RESEND v3 2/5] drm/bridge: it6505: check INT_LINK_TRAIN_FAIL while link auto training Hermes Wu via B4 Relay
2025-09-16 10:41 ` Dmitry Baryshkov
2025-09-16 4:47 ` [PATCH RESEND v3 3/5] drm/bridge: it6505: modify DP " Hermes Wu via B4 Relay
2025-09-16 10:48 ` Dmitry Baryshkov
2025-09-17 8:37 ` Hermes.Wu
2025-09-17 13:47 ` Dmitry Baryshkov
2025-09-18 2:23 ` Hermes.Wu
2025-09-16 4:47 ` [PATCH RESEND v3 4/5] drm/bridge: it6505: modify DP link training work Hermes Wu via B4 Relay
2025-09-16 10:44 ` Dmitry Baryshkov
2025-09-16 4:47 ` [PATCH RESEND v3 5/5] drm/bridge: it6505: skip auto training when previous try fail Hermes Wu via B4 Relay
2025-09-16 10:47 ` Dmitry Baryshkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox