From patchwork Fri Nov 27 09:23:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 333606 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp844214ejs; Fri, 27 Nov 2020 01:23:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzygVlSUfJGLdS7jxXNqDtMMGQdheVXR0JOYE6yNJKF1OPKEIsmlLzjbCQQC2Jgvx3Ibtf8 X-Received: by 2002:a17:906:851:: with SMTP id f17mr5632301ejd.392.1606469002283; Fri, 27 Nov 2020 01:23:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606469002; cv=none; d=google.com; s=arc-20160816; b=MbWBVQtek2iiqMvqfLffjdrx9VUUEmvkePl45kL0irvflzeRbu5PcGxaarBoxHbDFE 1JKv8PsYi7nsHkZR7r0OY6hTsOS7U8OJ4M5lT9+fEPuV70r83xJbULBRn9GoUxLzjo1F QyEI12hjGDAaKwgrafVTrQm9ftnK6qFfbdchei5WgmzCgLxRuX5XjkJ2hL62dIr4k6vw 4hBLIHLYmSv7QmMY88o8ou3hW07PN0H0TGRNpSY1gzDOQQU2iTeOPYqb+GYjnOyVMcfP B3otykGnAk0tQVgc+nketZZ+tYLzWy/Ks+u6R74/2E3FsklnY7qW9wLLGQsVUo/cWD95 THSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=dDVGerivDhcovGvlrg4RdGN4PhZ+oBrQSqPNlOoN/KE=; b=PeAUc7Na7JU36QXe8xelbAxVLC72utBruN9Gx0yC3joc+Jpqv40P8UyZkGkuQ0wJcf 7bR4nUSmcILEizQ05pgJ+y8QYLR3u6B9BdRxm+AhkB1hg8MB/TWPwrdumEE/NZjZpzwM EfLUiRC5H5WgxG5guLBZy4QiL2/mUwA0RTuQ+zAqsbgfon4J1x70Uqy9zjjbRBTxYdzu SQe/5LC72lN9CUtymm9kmIFPdLA67BYZVenSfwnZsMweLkIo3Bvos6O/0tYbDKQhTWwm Y+ujq5ur6vkB9nuOv5JUK7R9Be1jeznnuLAmZY23fmk/366ydIiDFKaQY+d1pjVAqtwX KXXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xXo1mpme; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k11si4511558ejb.369.2020.11.27.01.23.22; Fri, 27 Nov 2020 01:23:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xXo1mpme; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726178AbgK0JXV (ORCPT + 15 others); Fri, 27 Nov 2020 04:23:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbgK0JXU (ORCPT ); Fri, 27 Nov 2020 04:23:20 -0500 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59189C0613D1 for ; Fri, 27 Nov 2020 01:23:20 -0800 (PST) Received: by mail-lj1-x241.google.com with SMTP id f18so5172301ljg.9 for ; Fri, 27 Nov 2020 01:23:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dDVGerivDhcovGvlrg4RdGN4PhZ+oBrQSqPNlOoN/KE=; b=xXo1mpme3FQkxz7YOniDXUXLh1hheRztkvuFD0BgV002eFkuLs9/dcgDiWWCkpLt1h e1g5XSCd/9I2I221sERnEP5Fl3x2MhneduRxljWEjh4cMBhD/La7eSfE+qUnugOnZmvQ CTYXTVxuM/C5YrnndrLDTMSY/njX9IEXElhdv3mUHj9yJCDG845sHyPDxgeFGjR2Kt6B fYw7wfn1t5zKg1WL1I18oLC5Aq1lLeCDWszonc6zgKx8SDoPTC+FPtYEisuLI5e4jASN 3pFbXg6iE0k75/7eStyKP54QMo2n+JxTlPeaRbJPAhsys/nCn/ARQB+lI/K9/Yx9xU8m 29GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dDVGerivDhcovGvlrg4RdGN4PhZ+oBrQSqPNlOoN/KE=; b=o5xOyxLQ+U94YU+3JCC8wFyMIlqtD8TNjqSCoXccB8y6yz7CUfb7UJ6dRabX8yfa1G w0XCfQAv0SUjaLorQGIUMOyCG2bkLzynC+QTHLfACn/TqghwRJmQYDW+9wL+yxd2Konw K7VFx4QskkmmvZvb9ked5Kq0X7a+jXi9zAhbCIb5jXuIbHDqMZlImG0hotOqczYG6I04 DxOGtLShEHH2rdvz6BU+tyn2crG7jnmiatU6no5+uhwzQMH0nKybXJDusi1TdBsoJI1G c7nd6z914bnIrZJ/gKH72xOHTnAs/ovs3GvhdD3M/r8NU7gsRlIjzJyH9QjmtoW+inb1 8NLg== X-Gm-Message-State: AOAM533BaNUmlGRzaNa+N3enHXqk5vJ8Z9oHsZ+ZMGJnkP/kfoL56MUF EhNKLKCTz7LPX8N8jRGkpd1Z3A== X-Received: by 2002:a2e:998e:: with SMTP id w14mr3176710lji.100.1606468998738; Fri, 27 Nov 2020 01:23:18 -0800 (PST) Received: from eriador.lumag.spb.ru ([188.162.64.79]) by smtp.gmail.com with ESMTPSA id a6sm615442lfi.107.2020.11.27.01.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Nov 2020 01:23:17 -0800 (PST) From: Dmitry Baryshkov To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: Daniel Vetter , David Airlie , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Vinod Koul , Sam Ravnborg , Manivannan Sadhasivam Subject: [PATCH 1/2] drm/bridge/lontium-lt9611uxc: fix waiting for EDID to become available Date: Fri, 27 Nov 2020 12:23:15 +0300 Message-Id: <20201127092316.122246-1-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org - Call wake_up() when EDID ready event is received to wake wait_event_interruptible_timeout() - Increase waiting timeout, reading EDID can take longer than 100ms, so let's be on a safe side. - Return NULL pointer from get_edid() callback rather than ERR_PTR() pointer, as DRM code does NULL checks rather than IS_ERR(). Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c index 0c98d27f84ac..b708700e182d 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c @@ -145,8 +145,10 @@ static irqreturn_t lt9611uxc_irq_thread_handler(int irq, void *dev_id) lt9611uxc_unlock(lt9611uxc); - if (irq_status & BIT(0)) + if (irq_status & BIT(0)) { lt9611uxc->edid_read = !!(hpd_status & BIT(0)); + wake_up_all(<9611uxc->wq); + } if (irq_status & BIT(1)) { if (lt9611uxc->connector.dev) @@ -465,7 +467,7 @@ static enum drm_connector_status lt9611uxc_bridge_detect(struct drm_bridge *brid static int lt9611uxc_wait_for_edid(struct lt9611uxc *lt9611uxc) { return wait_event_interruptible_timeout(lt9611uxc->wq, lt9611uxc->edid_read, - msecs_to_jiffies(100)); + msecs_to_jiffies(500)); } static int lt9611uxc_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len) @@ -503,7 +505,10 @@ static struct edid *lt9611uxc_bridge_get_edid(struct drm_bridge *bridge, ret = lt9611uxc_wait_for_edid(lt9611uxc); if (ret < 0) { dev_err(lt9611uxc->dev, "wait for EDID failed: %d\n", ret); - return ERR_PTR(ret); + return NULL; + } else if (ret == 0) { + dev_err(lt9611uxc->dev, "wait for EDID timeout\n"); + return NULL; } return drm_do_get_edid(connector, lt9611uxc_get_edid_block, lt9611uxc);