Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2379349lqo; Mon, 20 May 2024 04:13:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWkUXZmQMR1p2h8+ZrSuUiZBvcIk2bJFZMgpighqcGf/m+X98TnIfuo5CW7MhEpAWGDoQu9nh/sCsEZfkLrU/UkWgqnrdOLioiSk5Oxgg== X-Google-Smtp-Source: AGHT+IGjPoit2uW0wcO5k0xSm/tGp84p/n1g+ON7xhjo22wLazXXiF4/rfCqvBfeA7bq68iHRw// X-Received: by 2002:a05:620a:843:b0:793:18f8:2213 with SMTP id af79cd13be357-79318f822a1mr796080885a.69.1716203606754; Mon, 20 May 2024 04:13:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716203606; cv=pass; d=google.com; s=arc-20160816; b=KXjHusrOQV72T3tF2wXH+nmPdHCHhDaN2DcdkP8sr7rs8DN95wNk6eFhyqCK8+Nrau fidGUM8hFv3jPbQHw/OoAs98UII/3qveIVIe5wncvdR7/FtQno+o9+6AzoSLYQJbWmVK ILBtpaYIPoaVpaamNKytdJ7AnbkUtUhGtDOMOwPGCJvXQ7axQzwTq5+ictkwm9IaF3lR 3oHHOz/gbeCSIQLdQiwfMnq8CqOCMz4iZsb6L7cpd5pzrLqtOQlVQzW7jzNM+rwOx6Iy 0dUFfAaonG1Z7fbqYs5ZB2HE2MfVfIfXOZl4Mda2zjypGUMk0bdPEJpOnmwDHPEKgk5N xEhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=O5jh8Q3/PtVQ/wHNrcuIbE1MuAYfpZQK0CvL7Pv+jlo=; fh=W+XEKaIORTxsp+56FsKTQkx+EYpJD1XIbOttE0RqhT0=; b=R6dDa8phZfmwTvWQFzLQLc7BTqDFbcWQM8G2Ngf2NFyXOtkyGt4b1valPC2ykpvKbg WXvcx4wudAxsR4BdjkStKR6RzR3UfJ0Zwdz38czUoo1AE3J49RFOz8xsL1sKa8G0TD8j DO1mpijzXjEf4pWWmGswI/r54Uqe0dPGCUE/DNhLBf/Szoaj4us4UyimntfS+eRIwqGJ Oxh8UX9xmQkqyF84Qr/WYHeJx7X6fTbvNgEhi32xffVAI0nvHv6v7Rbo9G4/vW/D/ag4 usRb5iB35V80aMBotsKKNVy0RbNyHA0C0B/IpgiQK2I2JkLac8Ukke9vBAVayaHCPI/A anaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wafdUty1; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-183647-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183647-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792bf2807e2si2476206485a.165.2024.05.20.04.13.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 04:13:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183647-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wafdUty1; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-183647-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183647-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 797671C21D87 for ; Mon, 20 May 2024 11:13:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DFD9D53390; Mon, 20 May 2024 11:13:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wafdUty1" Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76D4F182DF for ; Mon, 20 May 2024 11:13:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716203601; cv=none; b=dR+i/N8jlUqI0jzTgTpJ1dDBKYG1z8z8kh7+XsB37xk6tOk5AteHtQ3TQ+OVR4hSV9ZaIf6m7WC16YVZ5f3w27YkJgLneAM4BQkwYf33t/DWh5FrZe2DvYW3kldgg6uBMUhgjx95v+8LR/BP1SsxbPfeoHU9DxbhdfFsfRmjHuM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716203601; c=relaxed/simple; bh=BwJI/vqR/Vf+YTatfUGzhpZo0KGpHV1810YIo5sFMss=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Lr66gJALAi5F46pCwhNfwoAuyRXWCSrwqNRlh7o9kimeI+yBJn2x19omA8C3oMXj219EpCa/hRS/GSbY1QQGJvVzCeO+M1HixE9MGLtcQhOwNkGd88cB7iw6TRAVKIgVTJUmR5a1dPd76tViMRfp9CNOz6j55tEpuJiMGEZdXv8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wafdUty1; arc=none smtp.client-ip=209.85.219.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-de462979e00so2640319276.3 for ; Mon, 20 May 2024 04:13:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716203598; x=1716808398; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=O5jh8Q3/PtVQ/wHNrcuIbE1MuAYfpZQK0CvL7Pv+jlo=; b=wafdUty1KBK9CRkOIEDnJ2G275QipBnHhbDQsf9Kx2uySr/LDXW2Ny4CYUUBNR46qE zCTOv/VzgTOoNJDxfPPIj9IFgrugP4fwi1hz7Mno4kUWeCKhR5bvpVsVBo33kacu45Gn G+DJ+z20adO2ioVN1y8wtC7fWErscDa7WzU14USN6zxQoeuEEJKl1HJ7JJEX1eH7MPbd 9kVJQgW4wG4RAPn99Pr5ONtjOOJkowBJ1t5zssqGSjvKdOS1yc7CL+z6KcBmn9lvZoIq gk7is1X5VVEEK4wr5H3SwiMx+xFOqRpJesWd1fpX9KNAlM+r3NhBAGAWqYN3yROTs89b uc2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716203598; x=1716808398; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=O5jh8Q3/PtVQ/wHNrcuIbE1MuAYfpZQK0CvL7Pv+jlo=; b=Hqqha/MRfnj76qYiKc2j1Yrh/XMw0feBq3wlEjAW0+UifPqDdu+TGm6ks+ouVyNUOe SwLE+VfAn+dcOjgyUbq5gMvJmcA1AM9Ae3K5zwV1w0WgqBx7HaMq1tFs/VbUdO8NfQ4Q Ww2K7Uz8NkhEZdzAnY0O6X+sGfl2GWOGfvdlftG121UIjDSx569iz/mp024eaBYce7LN 9yhezzh7QzN8KKqpvfMqk4VtdeoJZsbF1nTZ0GQckLhXe4ijK3fwQBEv0pw1k2vGxSd4 qNSSVjU+Po4qySdtaDZyJeu9GI/SFS4sLX5HPcUC5ZXI3XJM7WpugJugCENYkhP952vR XQUg== X-Forwarded-Encrypted: i=1; AJvYcCXlpIaxbWWmg0uhRJtxaS5AFm+s8uKJrRsxbRNuZo+tqHtAMpnfFte6EJHiDxsX4LF5Za32LF6WxTVe74SiYhYbRDHllPbOYeixpl7F X-Gm-Message-State: AOJu0Yy7nR7XZoubRGJtSHGD0jLK3p6kcnxK/NNnzI7AnOUF0DFClCou 5rUqtNdiluz+TfMfqSyzXeWyAer+RVCCkXLsQ06tfoRxHPF7rRLoPxYk8+3V4LwHE1osh+Hjt9Y DZBzZZus2/raPIRCWsF0c1olpI6Yk08Dw4CQr/A== X-Received: by 2002:a25:ae18:0:b0:dee:607c:3528 with SMTP id 3f1490d57ef6-dee607c3793mr25911507276.3.1716203598470; Mon, 20 May 2024 04:13:18 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240516101006.2388767-1-victor.liu@nxp.com> In-Reply-To: From: Dmitry Baryshkov Date: Mon, 20 May 2024 14:13:07 +0300 Message-ID: Subject: Re: [PATCH] drm/bridge: adv7511: Exit interrupt handling when necessary To: Sui Jingfeng Cc: Liu Ying , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, 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, daniel@ffwll.ch, biju.das.jz@bp.renesas.com, u.kleine-koenig@pengutronix.de, aford173@gmail.com, jani.nikula@intel.com, bli@bang-olufsen.dk Content-Type: text/plain; charset="UTF-8" On Mon, 20 May 2024 at 14:11, Sui Jingfeng wrote: > > Hi, > > On 5/20/24 06:11, Dmitry Baryshkov wrote: > > On Thu, May 16, 2024 at 06:10:06PM +0800, Liu Ying wrote: > >> Commit f3d9683346d6 ("drm/bridge: adv7511: Allow IRQ to share GPIO pins") > >> fails to consider the case where adv7511->i2c_main->irq is zero, i.e., > >> no interrupt requested at all. > >> > >> Without interrupt, adv7511_wait_for_edid() could return -EIO sometimes, > >> because it polls adv7511->edid_read flag by calling adv7511_irq_process() > >> a few times, but adv7511_irq_process() happens to refuse to handle > >> interrupt by returning -ENODATA. Hence, EDID retrieval fails randomly. > >> > >> Fix the issue by checking adv7511->i2c_main->irq before exiting interrupt > >> handling from adv7511_irq_process(). > >> > >> Fixes: f3d9683346d6 ("drm/bridge: adv7511: Allow IRQ to share GPIO pins") > >> Signed-off-by: Liu Ying > >> --- > >> drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 ++- > >> 1 file changed, 2 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > >> index 6089b0bb9321..2074fa3c1b7b 100644 > >> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > >> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > >> @@ -479,7 +479,8 @@ static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd) > >> return ret; > >> > >> /* If there is no IRQ to handle, exit indicating no IRQ data */ > >> - if (!(irq0 & (ADV7511_INT0_HPD | ADV7511_INT0_EDID_READY)) && > >> + if (adv7511->i2c_main->irq && > >> + !(irq0 & (ADV7511_INT0_HPD | ADV7511_INT0_EDID_READY)) && > >> !(irq1 & ADV7511_INT1_DDC_ERROR)) > >> return -ENODATA; > > > > I think it might be better to handle -ENODATA in adv7511_wait_for_edid() > > instead. WDYT? > > > > I think this is may deserve another patch. My point is that the IRQ handler is fine to remove -ENODATA here, there is no pending IRQ that can be handled. So instead of continuing the execution when we know that IRQ bits are not set, it's better to ignore -ENODATA in the calling code and go on with msleep(). -- With best wishes Dmitry