Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1870907ybl; Thu, 5 Dec 2019 08:17:54 -0800 (PST) X-Google-Smtp-Source: APXvYqyes4hIkH6s6TfTeN599sCjb/hEsuS/SaUN8YI6F+TXkFi2cH2Vnn7oZIlhsWkd15WeIZN+ X-Received: by 2002:a05:6830:1248:: with SMTP id s8mr7161891otp.202.1575562673975; Thu, 05 Dec 2019 08:17:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575562673; cv=none; d=google.com; s=arc-20160816; b=w4+jGijDZRWHIie/pTierJRwaudKGhziEiz0q3OsgEfnA108DgTIX/2MqRjfXVisvf U6QcQSnDuOgP/O8NmHrjqzPHbgXXv63rpDByLpsLyB5C8JTSzJAgCKfQN/vD4cvY1GsQ o5Bxyg0/XESjB9lVzQuzR7NRjsCoTjEggwM/F+c04tMgc7m7ejcOor0nzWyh1eYuUuqv LJuxN9r3Ghb0vlu0DWHuTrla9WF1miOFDLhljSqLIIx3521N1n3DzYbsoqp1iDs0RMUb 3HLixP4hX74kyV14b+PrPCYKjbPZQ18kA6BDC/Zian1MbCisYr33Jn6s/npmVcFx0peq qwiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/s4H9123KM6cSQFYZYktesHNajGVy0K2OAZRf2rsEsA=; b=dg0mqVoap2RA8mzALx6LXk54YXdGy0mtS7O5hZfPNukYSBaps3zbjl3D/FaIFUV55v sdKjcOOS64rb1Pz/hmSmK/e94a5TYyUrVlCA5etfk2Dp9oHbEjhuh25ctgJJnTz4e15x 2EPShBFzscphMSCMZMr5hKSfuH7cTw1GPXIVsg1CAr7zm464O3jjaCwcNeJpZkO9mP9N y0jEy7XF1VZobaquATCR48uqmzFbTGTI+zkqr48RTWjb663Pd4cJZwi6bffntE00N90U s6ZfsGq1CXERxsJztEbJIt6aU9o1iiYWAsLSBZP8aLbFWMJtHxMe//U3LKpa8uojR/rU k2OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vc5HOWdr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10si3076484otn.12.2019.12.05.08.17.41; Thu, 05 Dec 2019 08:17:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vc5HOWdr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729928AbfLEQGO (ORCPT + 99 others); Thu, 5 Dec 2019 11:06:14 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:34867 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbfLEQGO (ORCPT ); Thu, 5 Dec 2019 11:06:14 -0500 Received: by mail-wm1-f65.google.com with SMTP id c20so2820043wmb.0 for ; Thu, 05 Dec 2019 08:06:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/s4H9123KM6cSQFYZYktesHNajGVy0K2OAZRf2rsEsA=; b=vc5HOWdrtJsCRrlTj+6bmgg9NGsYEUOJXVu2XK2vRzyVNMcyny5cQqCH/W7oG2r7OG B9VB0Jmj+VzXhvz9VhxLlRoOruinbQdlKhKUotk9hisTrs35KHHNkXRzn1ZrzoxTHsvr QLCep6vrizqHh7BM7rR3/+qL1UJFhTUwv2Q8Xmz9d4KmRgrQ2z5cXoy9cMyR8UwzGL9Y h+umO2o/9GoRtkZ/IeCTLBL+BaTaSZEnpi0OiVLyvH0j+ULA1YeR6OlfiNg5BUA07HUj eLqqIIj1xTYo8GKEYGnkSBBRF5Ht1Be3UG/1rmA8XwvA0zQVBc/KQLy8mxeQ+ka2IM/R 9fJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/s4H9123KM6cSQFYZYktesHNajGVy0K2OAZRf2rsEsA=; b=SNAX7vblW4KeF64a451rEpMfwi3vsLKjjHljQR31uj5UAiY9CKeA7riQOH5vM5qmQJ GhpdCZB45IfJ0JGHXOdqorbRRnj2wArT03fftQgPxUyeIAr0zv0nAK3u/FCFUvvaK9kp y3sbFSC4kGlhHe+XPBDVveSeSEAJLyWl/VcH31KwE0Kwulf0HgCxJ2FnnmvA0f2Zx9sa kzECwPM/K8Fx+aQnAHwpuVHDbK5pIgPcJOkTf3xYs+XQBxST5HlDChVCnwMeGUwkRFVr iY4DMwAxCBOwLOKts6Av415KYs3+vjcTQct0RUKWRJ9lxTB0iH6Da0W3AOZIIrKz5KDv gGgg== X-Gm-Message-State: APjAAAVsr7zl+gyhoEyTU9yHSzmZOabPxGDL/MZfRDfuG8kvM6ZerTy7 RBT8o4QOZRXbeEtNWSHp0Up+r/gqS/I2YK6Psh4= X-Received: by 2002:a05:600c:149:: with SMTP id w9mr5872302wmm.132.1575561972305; Thu, 05 Dec 2019 08:06:12 -0800 (PST) MIME-Version: 1.0 References: <20190619052716.16831-1-andrew.smirnov@gmail.com> <20190619052716.16831-4-andrew.smirnov@gmail.com> <0d84fa72-bc96-9b88-cd89-c04327109e0e@ti.com> In-Reply-To: <0d84fa72-bc96-9b88-cd89-c04327109e0e@ti.com> From: Andrey Smirnov Date: Thu, 5 Dec 2019 08:06:00 -0800 Message-ID: Subject: Re: [PATCH v6 03/15] drm/bridge: tc358767: Simplify polling in tc_link_training() To: Tomi Valkeinen Cc: dri-devel@lists.freedesktop.org, Andrzej Hajda , Laurent Pinchart , Andrey Gusakov , Philipp Zabel , Cory Tusar , Chris Healy , Lucas Stach , linux-kernel , Jyri Sarha Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 4, 2019 at 10:27 AM Tomi Valkeinen wrote: > > Hi Andrey, > > On 19/06/2019 08:27, Andrey Smirnov wrote: > > > @@ -748,22 +748,19 @@ static int tc_set_video_mode(struct tc_data *tc, > > > > static int tc_wait_link_training(struct tc_data *tc) > > { > > - u32 timeout = 1000; > > u32 value; > > int ret; > > > > - do { > > - udelay(1); > > - tc_read(DP0_LTSTAT, &value); > > - } while ((!(value & LT_LOOPDONE)) && (--timeout)); > > - > > - if (timeout == 0) { > > + ret = tc_poll_timeout(tc, DP0_LTSTAT, LT_LOOPDONE, > > + LT_LOOPDONE, 1, 1000); > > This seems to break DP at least with some monitors for me. I think it's just a timeout problem, as > increasing the values helps. > > Using ktime, I can see that during link training, the first call takes ~2ms, the second ~7ms. I > think this worked before, as udelay(1) takes much longer than 1 us. > > We have 1000us limit in a few other places too, which I don't see causing issues, but might need > increasing too. > > Also, 1us sleep_us may be a bit too small to be sane. If the loops take milliseconds, probably 100us > or even more would make sense. > > This didn't cause any issues with your display? > Hmm, not that I know of. Your reasoning makes sense, though. If increasing the timeout helps, I am all for it. And, yeah, I agree, this is probably not the only place that could use an increased timeout. Thanks, Andrey Smirnov