On Tue, Mar 18, 2025 at 04:32:10PM +0800, Hermes Wu wrote: > 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. > > 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...@ite.com.tw> > --- > drivers/gpu/drm/bridge/ite-it6505.c | 35 ++++++++++++++++------------------- > 1 file changed, 16 insertions(+), 19 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/ite-it6505.c > b/drivers/gpu/drm/bridge/ite-it6505.c > index > dc1179c8338e27866f6adda4ef8fb2950336221b..11231a642bbe185c4f36bf5f2a0b115fa056213b > 100644 > --- a/drivers/gpu/drm/bridge/ite-it6505.c > +++ b/drivers/gpu/drm/bridge/ite-it6505.c > @@ -666,7 +666,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]; > @@ -2472,7 +2472,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); > @@ -2480,26 +2480,23 @@ 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; > - } > + retry = it6505->auto_train_retry;
Should you also drop auto_train_retry from the structure and assign AUTO_TRAIN_RETRY here instead? > + do { > + 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, auto_train_retry: %d", > + 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); > + if (ret) { > + it6505_link_train_ok(it6505); > + return; > + } > + } while (retry--); > > - if (ret) { > - it6505->auto_train_retry = AUTO_TRAIN_RETRY; > - it6505_link_train_ok(it6505); > - } else { > - it6505->auto_train_retry--; > - it6505_dump(it6505); > - } > + /*After HW auto training fail, try link training step by step*/ > + it6505_link_step_train_process(it6505); > > } > > > -- > 2.34.1 > -- With best wishes Dmitry