Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp250928lqs; Tue, 5 Mar 2024 00:20:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVL8AGXgxsGfOSPZRd3j5Gt5k+lYBZ5gPYJJLat4JzsXO8mRz4HeRl10dPHPmINFN8IUYPazq8EndrFTObXHEfJ24ZcG9SfOjG41mS5Yw== X-Google-Smtp-Source: AGHT+IGFa+E7ks98OdGTn3UmZ+ILsb112QHg971T/UjfJhoacDEVp3Id/X2y2lK44CYDRfdxciEI X-Received: by 2002:a2e:6e04:0:b0:2d3:93dd:a192 with SMTP id j4-20020a2e6e04000000b002d393dda192mr739088ljc.45.1709626801778; Tue, 05 Mar 2024 00:20:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709626801; cv=pass; d=google.com; s=arc-20160816; b=P5o3nnzHadVUv6MlrKiBq+EekKwRpxPHyYoJSOS+vageLUO5N6FpnSwSLl7Pjn3S1h FGvKusO42WUT7ROk98x+hG/qf5Y2StSSxtmf4ypRyQp5VJ4tCnmp27R0nFGb8ih53p95 jBXPirkTrbM5ZwXuwvAcC7btXm+AasIcaNCWZ15VoeRtWQYnoHfGjMWry2pMCRzfkrzn m1QKnl06iEDjTyN1dBdzNUTJiWFlSCx10IvXVcktUQ5yiuxjAOr+CMgLGogxVTy551be M186YOpDp2uE5I73r11za/kCsjYZaCHXCpp6hNHJcP1JbPYM9ex1otpk5YiqJZI2/hX3 cuEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=l9wA6naQZRK38FXL1EOjK6RFTPaKagpwY4JDUiYSNu4=; fh=9fpbw/bXNPCRHd6PQ/eqWviG6CdzQXuwPZaU09DuBb8=; b=e0fCfijSZxQkHBZlmRyUtnVbOPmopBeSx8hwvs/quXRQpZDFalkbARX7vhFc7n8Rh7 tEcmqpsgRANg1uYZR+nv41+vCrl88LEAcGF6Pr5hCzLogRel3GwYgXWjnzO634RDNNz6 xrSjwNgXdFxpLx874bVBS29AF24IkjdrtIZ3bXeJW6FVK0BwnbavLZPkIxTKNf2bmlyw 7KeWj8Vdo65hKzD/5Ps0f9NpTmxdJvz1E2Q72mqBuaEq6W2zGbmQpipxHgADj8Gn1XHC zUaq3V1ghXfmhVn7QGJBirTj4+Tcy/H2F5okGMsG7aytf/h04qjaYA1DfBtfB9uo1RIE mfow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Urje1p8L; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-91896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91896-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v1-20020aa7d9c1000000b00564e0137b02si4840870eds.483.2024.03.05.00.20.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:20:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Urje1p8L; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-91896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91896-linux.lists.archive=gmail.com@vger.kernel.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 7D8C71F22102 for ; Tue, 5 Mar 2024 08:20:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57A367FBD3; Tue, 5 Mar 2024 08:18:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Urje1p8L" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 291037FBBF; Tue, 5 Mar 2024 08:18:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709626699; cv=none; b=KreqF+HZY8HWBKHE4bZSJSNlTZq625+QJAuHssYko4a4uiXqlcEQPhk3amG8joaGQbA7E1Z6QjG0bEIJU7sf2QG0p81sgYp/Youc3nz7AfaVXOy7ohpvf9YwjKJYXNn5BoPiyp1VWEA7DKNkAi+ejyMAoIeZnfNhkTWEUOSsdPY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709626699; c=relaxed/simple; bh=aQlT/8nL6oz1JmEwS10Qg0k/nHJTXACjpqXGIT3caBU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bZ8cp5C1n0t8zFreinY9bQQyLeuQeHF30zRPsFekCsDSPPURj9lVE4T/KlxxAGxAhNuh31Ux72zCFnyDow6Za2ZXppn9DQwzw3KGfgXAhPK9d6GlPSAV+9usJLpCZPZgdQ5clzbp/luC32nCR9b5Sq7GC/Vc++SOsugrUZeyHaE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Urje1p8L; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi [89.27.53.110]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5A953CC8; Tue, 5 Mar 2024 09:17:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1709626678; bh=aQlT/8nL6oz1JmEwS10Qg0k/nHJTXACjpqXGIT3caBU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Urje1p8LiZLNSbDKARBxr0QGiU3RlKppsKJF+hofYjbP14x2FaJ7Y8MvSLps3tpmR Nbznjt+clMtw1BdjRtNfYoaTCCLxilbA6GMu51xWpXbn9eQDd8VgLdTfPGfha4AYho r8O2g3CTQKa2BjNe+rKfuV9sS3EKLAb6DGGWuRdk= Date: Tue, 5 Mar 2024 10:18:16 +0200 From: Laurent Pinchart To: Adam Ford Cc: dri-devel@lists.freedesktop.org, aford@beaconembedded.com, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 1/2] drm/bridge: adv7511: Allow IRQ to share GPIO pins Message-ID: <20240305081816.GF12503@pendragon.ideasonboard.com> References: <20240305004859.201085-1-aford173@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240305004859.201085-1-aford173@gmail.com> Hello Adam, Thank you for the patch. On Mon, Mar 04, 2024 at 06:48:57PM -0600, Adam Ford wrote: > The IRQ registration currently assumes that the GPIO is dedicated > to it, but that may not necessarily be the case. If the board has > another device sharing the GPIO, it won't be registered and the > hot-plug detect fails to function. > > Currently, the handler reads two registers and blindly > assumes one of them caused the interrupt and returns IRQ_HANDLED > unless there is an error. In order to properly do this, the IRQ > handler needs to check if it needs to handle the IRQ and return > IRQ_NONE if there is nothing to handle. With the check added > and the return code properly indicating whether or not it there > was an IRQ, the IRQF_SHARED can be set to share a GPIO IRQ. > > Signed-off-by: Adam Ford Reviewed-by: Laurent Pinchart > --- > V2: Add check to see if there is IRQ data to handle > > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > index b5518ff97165..f3b4616a8fb6 100644 > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > @@ -477,6 +477,11 @@ static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd) > if (ret < 0) > return ret; > > + /* If there is no IRQ to handle, exit indicating no IRQ data */ > + if (!(irq0 & (ADV7511_INT0_HPD | ADV7511_INT0_EDID_READY)) && > + !(irq1 & ADV7511_INT1_DDC_ERROR)) > + return -ENODATA; > + > regmap_write(adv7511->regmap, ADV7511_REG_INT(0), irq0); > regmap_write(adv7511->regmap, ADV7511_REG_INT(1), irq1); > > @@ -1318,7 +1323,8 @@ static int adv7511_probe(struct i2c_client *i2c) > > ret = devm_request_threaded_irq(dev, i2c->irq, NULL, > adv7511_irq_handler, > - IRQF_ONESHOT, dev_name(dev), > + IRQF_ONESHOT | IRQF_SHARED, > + dev_name(dev), > adv7511); > if (ret) > goto err_unregister_audio; -- Regards, Laurent Pinchart