Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2324560lqo; Mon, 20 May 2024 02:08:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXrB+DcwIZVmWsk+lwN9LT3VYYbjVaZ19/9mWmuAm5nprw/yIIDcUuCDFhyB8SVM+K04fRztn+SP8nENW8pKTgsG3ATNmAzdLKgJfoKQg== X-Google-Smtp-Source: AGHT+IHLlBqUoyf/qKz10x8W05Ep+WBqNwsuuwExCqxoHJ9957oC/hRw1CslmSy9u655haISLnFm X-Received: by 2002:a17:906:4f83:b0:a59:ea34:fe0d with SMTP id a640c23a62f3a-a5a2d65ed4bmr2958498266b.47.1716196136094; Mon, 20 May 2024 02:08:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716196136; cv=pass; d=google.com; s=arc-20160816; b=tVM25JyUNJlAWI0z8ZYV4KuWJJb01ayjxZ26gx2AvmGGkndG9H4IoV9Scj8p8q/lEZ RF2V9dbkfDX618CbxDzMSLgtN6e843vgatLff3xYKY3+V4w3MQlpve8bi/6rMLSOhNTH VfQJ6zOrs1MELWxfZjHUr1W44447CsF8ekbUelh7hgdvr7UoaaDHueLy2USOTSfUPLbg Aq5QujzVNHP5y0NVd4UNyh++fQWxE/1Xn9YIwT7EpgVdnafO4c5jfoG0R9dOZmx8k7Md OCmZu8KFT9YYtDKassx2mcbVTUF1WBzrGVjzrBBfNvFSWpy9Xg2RlEZvOEUAdl64lDeP /IBQ== 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=rsXIdnEGMK6jEQXuJEcWV+3QDrgp423KVVA+wYoTsTk=; fh=sHC8Y8XsfGmUghd8Qy2U4rzl/IeY8gqBwPY2Pk57omA=; b=MOFSrL3PqO0zxmx6YT/khjXdOP3gXW7IiWafMjeKsl/yFacTwDL5piWtZqw4Fkk0+U Ht2cj4i/dsDb5O+82J9EVjYl0udPNsr6+XzM0amfu6tsMjBtJCBxR0xQY4qCwNaygD2j 44kqaYhwD/atLnxN8nw+WZCISwNnUmnVnj9M+xYon8qOXQBcHd71EDc2v4OeiO53wA8C FSu+ZSBMxkREQArCwSUukLcRE7h+DJMUZ6LXxsw0nj6b7MTruJf/lYCueg9wREEGJuvg lc7bpUww6st1aelcw30U8XkYPJTIbEJ2HlY8zmR9plxhEkLERPnEpyd2dbUBynXsxhap uBwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGzLuJOW; 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-183518-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183518-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5ce0c6607esi518141766b.4.2024.05.20.02.08.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 02:08:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183518-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGzLuJOW; 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-183518-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183518-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 am.mirrors.kernel.org (Postfix) with ESMTPS id C48A81F2104B for ; Mon, 20 May 2024 09:08:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 750461C6B7; Mon, 20 May 2024 09:08:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YGzLuJOW" Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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 E022117582 for ; Mon, 20 May 2024 09:08:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716196128; cv=none; b=VUdgI0e6HtL2sn0Gz0blBFTfXpb2Ivg5+RTMqeuWDDaK40ediozZrN5cJHgM9BrGyqdi2NUxhfJOh58HImyEgStnsPX84BN60a+tZIwYz6dut/TLtUPpw7oHGQ35AoUiZdmPcFLW3VAO56e2nZPpaTPdHC3HwXr4EOyYMCQjN0Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716196128; c=relaxed/simple; bh=rCsD98lOj+gPz0pt3osk3WseVqXh3KbKOiVTjSqIW2w=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=J2gtTeqSytTSQfs4H1kAp+37qQbi8nv4VLeDw0xVZOG9C8wVwOi/tp7Lpj3FDe8xTCfTYlIeQdSGpB92ijl0AyqKxI8vSPDM7N2rHIxrrN8qZFCvBOZsTgSqOkDHEjmm290DqTx3H8O/fNGMWoXX+hYEyCAf9/4HGP/Ct6DNBSo= 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=YGzLuJOW; arc=none smtp.client-ip=209.85.219.177 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-f177.google.com with SMTP id 3f1490d57ef6-deb654482bcso2282242276.1 for ; Mon, 20 May 2024 02:08:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716196126; x=1716800926; 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=rsXIdnEGMK6jEQXuJEcWV+3QDrgp423KVVA+wYoTsTk=; b=YGzLuJOW+arCWwh9PXPKY6tFpZ/4uwrSVkkJxR8p2GCyqteSXbOfWKSpHYV9SQJ7vs UgcDK6CHc47xAT/w3XacbTzsxDNaPKWuzU9pHadF+99u1PQbdQxDeeVN/riXVnV/ptXd B/QPquY63wq/3Pf5booKUR+op3uMR21cxmQBFNKvqHaWCK1FV/MsAPN9q5asAqgOfB47 I+Ji+MLuz2AMPEwot0oieHI5I6+Lveumn9SbndOTr3VSwYUuZZXgxgBA5zyH6aTk/LA1 933uLCj2z5JndY7C2zJ/Q+hi9HZUR8lsWGJjYC/5VXwp3mtnxTGg4bnNbiEcFlDksg5g ydhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716196126; x=1716800926; 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=rsXIdnEGMK6jEQXuJEcWV+3QDrgp423KVVA+wYoTsTk=; b=RoQAy3DJRj2a3S+mfnpTjMM0JMhQOoFPoGfDp2t56sjevYtZiTaSZiv+6hdbxKdEWx tcLLKoM6aA8G2OXfhSKQX5G6CXby3pov2fju8VuhYKpmuhXw6Vacd6u3mLPZdW5ktRjw ROjuzxL0SM4JQROUQKz39VsPqPq4Ln292itBwQpf7Utb7+yaFViyoFr/s8RLDhArEDLE y5IEiyf6qzq8x0aVotXbRtcVkYfOgYa/TmtfkWN6eayYYW9LhfH2pKpf03IhSKrQINWq AUU+vVrBvkBGJ9rpR827jlx6KNG6guhWoRnZvsLLneM2lYssoK0mVnymid3qm6uggAQi RKbg== X-Forwarded-Encrypted: i=1; AJvYcCUSUuvOoEdFPMXJmBrZfLJt/HCpyj7bsby1ifbqfolkMo6rYHYFFFh6wUZQbRKmlfN1v3iHfS0dduuIYHDwRVFh86hb1wHEPR0w/KNE X-Gm-Message-State: AOJu0Yz6qpKt483gX1ju+KXszM8K/YA/DwPzc0SCEBstkCbMJH4ibc21 DzpoXN+MCA6nEaHC6WR8M8r2bvG5Lz80jypwg+jPCfFPHXuf/Or+nstoh+r4hHHFyxGmOQ5QBeO ZZh74plrPo3y2LoFMU1kjGlF0k0kWWl8y4f/mJQ== X-Received: by 2002:a25:f403:0:b0:de5:4b1f:7e00 with SMTP id 3f1490d57ef6-dee4f2ce7bcmr24641867276.15.1716196125854; Mon, 20 May 2024 02:08:45 -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> <5efe29a7-441f-4d70-b17c-5327c0a9f600@nxp.com> In-Reply-To: <5efe29a7-441f-4d70-b17c-5327c0a9f600@nxp.com> From: Dmitry Baryshkov Date: Mon, 20 May 2024 12:08:34 +0300 Message-ID: Subject: Re: [PATCH] drm/bridge: adv7511: Exit interrupt handling when necessary To: Liu Ying Cc: 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, sui.jingfeng@linux.dev Content-Type: text/plain; charset="UTF-8" On Mon, 20 May 2024 at 06:29, Liu Ying wrote: > > 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? > > Then, adv7511_cec_irq_process() will have less chance to be called from > adv7511_irq_process() (assuming CONFIG_DRM_I2C_ADV7511_CEC is defined) > if adv7511->i2c_main->irq is zero. > > But, anyway, it seems that commit f3d9683346d6 ("drm/bridge: adv7511: > Allow IRQ to share GPIO pins") is even more broken to handle the CEC case, > as adv7511_cec_adap_enable() may enable some interrupts for CEC. > > This is a bit complicated. Thoughts? Send a revert and do it properly? > > Regards, > Liu Ying > > > > > -- With best wishes Dmitry