Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2400525lqo; Mon, 20 May 2024 05:00:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXK14xn8Bqb4MB9nz0xJgJbKNkm4W3k+jyPzYYcHa6SxdETcQcz1x3thpPyKGNFfyive/aZykvlMYePDmlpk/S6mk40oMmDE2S1ZfMDOA== X-Google-Smtp-Source: AGHT+IFd1cyoLWQpn9frdqF86a2DyAQlXI0o8x7lnQw2Zv7WlfLIc1/YPWfJG+GhjW281A+4opyZ X-Received: by 2002:a17:902:ec81:b0:1f2:fab9:a0a2 with SMTP id d9443c01a7336-1f2fab9aa58mr49278785ad.1.1716206457495; Mon, 20 May 2024 05:00:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716206457; cv=pass; d=google.com; s=arc-20160816; b=oTp8nt34yhuBXUzV/cV0CcUp3b8ELSO91Vj9PPpZU5h7dLwLzoVChKjWcWFCzzSsw5 JwQQZCYvp2eYjeEhbRdy5EWzglibeN2vDz2hBlwQgAthrOEzlDvNvegaA7CfH5THf+H4 QX/Md/E/if3oLKvVKg5YfxfJafVlzfvwsJgcVAtvn8dYWyQo7yb4BGCW/vylKob/Ow6Q HTU2F/IUgHSBGLUnwuYCQFBokPsKL+eWs4kV3FUJwpVmHkuYPTCKNexWOy/o61VhQCwc d6T7xUVqrj2F3k7Z8a+tRGxS8Xj0DSQI8aiGld6unksKimNQB73nyNo0N8mzSQzr0bnG I5Hw== 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=qVN4sbNkbDEnW1RK7cK93DMtRTTOozrAuE7GvJdhEvI=; fh=3EUuvRPoidbUc5EG8PXMuaTeYkgRLj4WDTaMs9TJaMo=; b=XMR5gHQ5xp4zRAQjKO4SV+E2oooEVpvYDtt9CSLQUgsvzOFAF3HygSac0WmeXXwj3s Z1URvk3A1FFOQMeFY8qKlYEZ2jUNo/65Ea8rWX/HmKx0/8YuJJAFKiJR1DzHrV7X7exx dVdq0SxB4PHacK7y80OXWxavN+vRNl/iA6pWwrnnYYIxiC5MHJUmf/9y3Sp84yED3Y8N 6cyIJtsorgvq+T16mm011jaGDL/zm9hp9dB0D43gjHJOt7kbEJ71bIAq5AFp0TBrHct8 rc4Qrz72S/ZWs6EJt0ykdVxDceXt5aqGfLPjwVRHdIl5+fWwXt6pyG3gFo5sNlj/A4oN hSMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LFBhvF8a; 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-183708-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183708-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f30a19a61asi1052335ad.629.2024.05.20.05.00.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 05:00:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183708-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LFBhvF8a; 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-183708-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183708-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 3544BB21801 for ; Mon, 20 May 2024 12:00:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F2EB53E02; Mon, 20 May 2024 12:00:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LFBhvF8a" Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) (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 A03F723AD for ; Mon, 20 May 2024 12:00:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716206445; cv=none; b=pI1xZ2XUzERO7IrjlzTcGKOJjJFbW12e2JlBAPsvqzh9yn3nUIzwpX6JKRTBjufACJaRb1coxyXJyge0WN4AOGqLdeBK2gvxzevdi4IkJpZNb14+kNjXsvHBAqnv0VRi1g/K8GsMOUVEWs+O52QbNDH21WHed0PgHGtko9nYo+4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716206445; c=relaxed/simple; bh=qSyJg1K2HZQFIhiik8XiCt7hClMpffIhiGP+ct5XPUk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=HkEONpjlum2gsE25wRfxC5vm/Or3loalwyUO7mPtj3JuwmjCEblYfUNwLqyOokQ6FYaY3aQUE8Uf1lE5Hx4JLbGdtyXCXDiZpRlDyoe+sJ05FdBujP8Q4AUdfEZgtWN/jMluQUesDwbvN176mmyR1dGV9TlBWjyfkD/yYC9IpdA= 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=LFBhvF8a; arc=none smtp.client-ip=209.85.128.174 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-yw1-f174.google.com with SMTP id 00721157ae682-61e0c2b5cd2so14083357b3.1 for ; Mon, 20 May 2024 05:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716206442; x=1716811242; 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=qVN4sbNkbDEnW1RK7cK93DMtRTTOozrAuE7GvJdhEvI=; b=LFBhvF8a7mYZlk0qAT3X733hSEyTmqwZfbmu54Wke6BnZiqroATVBc9TidMgPvpRSN Mv0jIf9j70q/kkhG5GQXZWS6tNfmO3ri4ryNVi+bDUtxxOas2pdSFdi+Uyc3du2/tUR/ CTaNj0FOr87fKhkAH0TY3CLUpSomxwpO2SvWUKLSD2AqaE7MC4Y7NV0J2zB4NMsvcp9X kUOmgQRKMPZusx0v2716g0bTk2jUFC0ENSxZ+LWq8p7bkLAVDtuV51Y5Y9HOcPxYHCh5 fNQN6RG0YTlwPI//5hjd7SEBMqP9uyJ6Bs8foe1isYM51iqzeDYO+/dtzhlXv7mEhPw5 +i3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716206442; x=1716811242; 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=qVN4sbNkbDEnW1RK7cK93DMtRTTOozrAuE7GvJdhEvI=; b=DMksXpzG8HceGq+4nRmcI2+1OP3Ee42pomniuzvtShIZjOMlcPUEUgs/zhT8EgfTqa 7FG5itfjQc8behfYMKHUlHiQtdQ8l0zf6xpp1diSJMNB8U1xviNM9SOZh9njzH0Wv/LD 0c0uxWh0v3kZeUc5OAlSaKiXGoxHndBL33aBa4+EMxlrqscpAGrMlZ/mKaogAQDWXdKG L96t8Q91xPH43KQX9rXRnuIa06oSm5t0qN7+nMPbZmvqkBAaY6D26ocp9moS6aXl0NKB OVsWqosHJ/F+Is6wmaCnNzVRiheW+8ubGaf6N/cyrkPARJv64RUKqpoo2O6np3WcNOwA CWkQ== X-Forwarded-Encrypted: i=1; AJvYcCX/Z45duUfYlwAs++unqYLRVmIdbYFsKHUw8Nxnw0kmvXH/DT+9khb7sn+pH5yMYPYk3zZPUVOwol2ugzmsqkzuuv8FwDNjds5L+X+G X-Gm-Message-State: AOJu0YyxxBvgFB30m2ef5ldoitVJPdeAoPVEN12Jy8TSheyRNbtkUhoA BFRqj+/etmJvGsy1jxJSQXkw3vD+MDX0AjX2eYhp+iUfCX0alQ3ZT41rQa2GY1vcZWldNTea8fI I493acnE9RSuZ7AmchK1UWvKLDIwPGJvksQXrVBeE6dPPO8Pn X-Received: by 2002:a05:690c:7442:b0:622:f7df:aa0a with SMTP id 00721157ae682-627972d3d56mr36406697b3.22.1716206442502; Mon, 20 May 2024 05:00:42 -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 15:00:30 +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:48, Sui Jingfeng wrote: > > Hi, > > > On 5/20/24 19:13, Dmitry Baryshkov wrote: > > 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. > > But there may has other things need to do in the adv7511_irq_process() > function. But the function returns anyway. So, we know that the condition is broken. > > > So instead of continuing > > the execution when we know that IRQ bits are not set, > > Even when IRQ bits are not set, it just means that there is no HPD > and no EDID ready-to-read signal. HDMI CEC interrupts still need > to process. Yes. Let's get the CEC fixed. Then maybe we won't need this commit at all. > > > > it's better to > > ignore -ENODATA in the calling code and go on with msleep(). > > > > So, It's confusing to ignore the -ENODATA here. [BTW: you had quotation levels wrong in two places, I've fixed them] -- With best wishes Dmitry