From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from BL0PR03CU003.outbound.protection.outlook.com (mail-eastusazon11012060.outbound.protection.outlook.com [52.101.53.60]) (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 791294ACC8F for ; Wed, 2 Sep 2026 17:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.53.60 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788369009; cv=fail; b=N/OcSgM5ol3CtIdbSoBvr3GcKkwMDN2feFDp8lbwDT/v5lZxXcaJsyGAz7sVss46DVlsskleQKjCnR/7fqPHf09zKQcrFjd+Jgsmz/Z66JaHAOo61nN3C/I9B82zXibjd7ejwCB2ZRAph+wDuwlbssoX/H8nB1nzjKzA9JwPJ5o= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788369009; c=relaxed/simple; bh=p4Lnj55ioJtcU1NfwUD+6/7wz83grL96LMfIOYmCo6E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XDiUWABmud5mO+fsD3GRqgJ8fbVzy3MhCGtt960Xm4AnIzceT9Hyjn2HH/FULL1PlpYSQ0FCFs+kHsBBw22OuxM1FcKrJcgBaUP8v+Lh8I3pjKToBb6wdFeV/KxkjPtJij7AxDo8sadBy8Jy2fO00NUsB6tAa5ebF7nRdrLnhis= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gehealthcare.com; spf=pass smtp.mailfrom=gehealthcare.com; dkim=pass (2048-bit key) header.d=gehealthcare.com header.i=@gehealthcare.com header.b=YyXP2J1/; arc=fail smtp.client-ip=52.101.53.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gehealthcare.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gehealthcare.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gehealthcare.com header.i=@gehealthcare.com header.b="YyXP2J1/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WJlWCfK4qDwrnwxe8W+4LnvDA1TIyrPKoQSS+e0QnWl9Fum/dFEuScPOl7rALYCwv9CwKCmKAzl+n3ZwQo/ILDp4CWLUQqWUq34t5Xd1QlnhhSt7RTNVP1KiyaJlXW4EH9jdQZjUgy4fQoL25a4uVHqIznZVlBflURRPr8YTLw8Ie95eDCO/PDW0Ub/bg5X0cYiBxKd8AvqIsWzxgS2CG4KtmlPIRGL1d9uxXteKDrNcHpQrNyhZZWObGMncyWxVgKwtTWyEgu1/I8IKRAMGBtPUxMUolCc/FwPRCbC2U2/ngrOhLoHFSplPDsMNK5ZqFT5Kc2Pyn/W0ZD1qJe8j1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=y2hiFY2hGnNXO1OP9idJ8z5hnLIO6tDBRKKroug1f34=; b=dyZWFUE0m73i5++Tg8MBThi8EWBUZkRFejrtFIc8RgteVc3rHCGKOne2zVwRef3jJY8RhbuEL52aKOxSzTGe2ypr8gfTcbyxX7d6qRTjA7EVJJZsiNBszmcMx8Ank9TGhrHVmghFO45AGfE2yeGnoEp6lZ+lDdthyj6YhyazQA/fCWuUWtY9MRZy0ss1IiRfq7nlBCETOv8p/aFsZmZnAmlEthgcKXL8mDJ5eSVf4vVVIIQYTiDq/6AzdE51BET1+TNti8aG975bLhI1Ngfc2j1WeCOHjbdKL6cKxXa7lbGYeC73GwC8nsjkPFfxifO5K7pH6bZPwD7v28xC4OUqiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 165.85.157.49) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=gehealthcare.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=gehealthcare.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gehealthcare.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y2hiFY2hGnNXO1OP9idJ8z5hnLIO6tDBRKKroug1f34=; b=YyXP2J1/6eA8LDP9tqcV8PqSUrFugaX6Ic0ggd9EnSPj8P5SB3ENFYR2oCy5jJoFku7nqnNF0mQsvNIiIjKB0Ey4bR6asRkyF5w9Ts4EUGtShazhuMe8oVurpvZ9VLo8ya7147b6pFi2kIiJ5T4Lk1rPJQmB8QLhN+/HtsgdB059AOOlVJh5YjFz04yCHXMUxewO1ucMvufXpXwRlSF5GsXg9sohaa/5sEjoWyUv8d4xFjF8LgCF6tfQZcVwHUxcsPogkncXYJEYAkU54VC0W9wZH0FbQy03xyizCONMOeIwsfO4eu11UKR8MxfgzxQxtbhoaBWOBQRZN63uFr7VmQ== Received: from SJ0PR05CA0020.namprd05.prod.outlook.com (2603:10b6:a03:33b::25) by SJ4PPF635D8286C.namprd22.prod.outlook.com (2603:10b6:a0f:fc02::fa5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.13; Wed, 2 Sep 2026 17:10:04 +0000 Received: from SJ1PEPF000037AF.namprd03.prod.outlook.com (2603:10b6:a03:33b:cafe::58) by SJ0PR05CA0020.outlook.office365.com (2603:10b6:a03:33b::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.382.11 via Frontend Transport; Wed, 2 Sep 2026 17:10:03 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 165.85.157.49) smtp.mailfrom=gehealthcare.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=gehealthcare.com; Received-SPF: Fail (protection.outlook.com: domain of gehealthcare.com does not designate 165.85.157.49 as permitted sender) receiver=protection.outlook.com; client-ip=165.85.157.49; helo=atlrelay1.compute.ge-healthcare.net; Received: from atlrelay1.compute.ge-healthcare.net (165.85.157.49) by SJ1PEPF000037AF.mail.protection.outlook.com (10.167.244.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.8 via Frontend Transport; Wed, 2 Sep 2026 17:10:03 +0000 Received: from zeus (zoo13.fihel.lab.ge-healthcare.net [10.168.174.111]) by builder1.fihel.lab.ge-healthcare.net (Postfix) with SMTP id 5239919244; Wed, 2 Sep 2026 20:09:57 +0300 (EEST) Date: Wed, 2 Sep 2026 20:09:57 +0300 From: Ian Ray To: Jonas Karlman Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, imx@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 20/23] drm: bridge: dw_hdmi: Rework HDP and RXSENSE interrupt handling Message-ID: References: <20260518180206.2480119-1-jonas@kwiboo.se> <20260518180206.2480119-21-jonas@kwiboo.se> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260518180206.2480119-21-jonas@kwiboo.se> X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000037AF:EE_|SJ4PPF635D8286C:EE_ X-MS-Office365-Filtering-Correlation-Id: 93ea209e-fdbf-444c-fafc-08df09150767 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|23010399003|36860700016|82310400026|10067099003|11063799006|56012099006|4143699003|6133799003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: zJLerApNgMlhpkx2DYHttAbfKOIvW12juAzLoBuHAv/TADDvBFh5ZrnNOsIPO5m6dl8/Sj5J+MxhiTRug3iITkPmdkWUVQjy0ofgByKtuzY1widqvbjcGkDf+lfxB571Y9X24SIS5NjAGjn+SEDnLzvaSNd5iad0GNBqQXkeiCPpMMCmyk7fH1H/a4vs0wJPmADjmf04XLVmr5NQlS7/ltnV9SpN8eY0OWHTj8lZdCk0wrMjUsJDohoNCpcHIq689q521WUVVLraF4LJzPn/gWJgq9ocZ/xeO1AQuwZdgoLRs20pd20RqKuk95j5Qtfhkg50Eqtkx9xYtcsISwO5biiou21dIt708uKYGPLuuZOSoyNLKltqxKqu/Sh1MPXMsNgOPA4OVE35lh6lf8FubwqwungE9fvIIj0ngexlVx7DzE6fFGvd/JDl5ggM7Z2dkkWReYsuiwc8BPpJisj0S3BtBcNO3LDwx9kh5SJIsoUslBvuNml7yJ6Zdn5wL7X3Hf7/NcVrBxwPI8m5wLtMORR3yEhJrubWGceHYS/wGg1lyU1heTkZ8VSjV84fH2ZckjCAK7cw/ly42qXFVzMi5GjmRn4F3t+6HsnmD3SXijx4H3OYdBP/tltJsHRZEsGpCJGvXHUjBwwMSYbRuRkB0FAydjZzBPw+5zM6xEIrYvoFfOXWOKgGO9NQpI70rf9+qePbf/o3Epamglg4HS97DA== X-Forefront-Antispam-Report: CIP:165.85.157.49;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:atlrelay1.compute.ge-healthcare.net;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(23010399003)(36860700016)(82310400026)(10067099003)(11063799006)(56012099006)(4143699003)(6133799003)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mhZbiTeQHcnh7Oldt/AmmDKzhQyuP88+Vu0+xjNxfNbE4DSdeAsflzg6SVQEKtbTfPYBBUOzQ5OlAVJLykriGSllMhU8Ulrmwdj+GsrNnMJvN4RvJs3rwt+W0q7/U/HJWdbcf9j5taJS9dID+Hc0wc9ehBzEPcD5byrk7AT1QdIt6Uk1B6WZCxsepRZKZsjyu4ESq2hYCBYHJLTs80a8V05K5610QdGv/fwprNhQV0oZWptbzmXVjjXEpVa67XvxGev4VBAx7SQWwADR7AXSZNDYSfWfvVSIvwM/SRsLiKN0OFGku8ckBWR61yXnIgPZGh+Jpv8f28fam5PYx+extt4YBhRqPj19vzkhdJsJqqambPJwiPr62oEV4ftU6qiCrFJwCEUcNzLqi4n1xx6QeKincfFnwB/UnHCsMtL1gKnny05l9P6Y2zSitvJRbkVM X-OriginatorOrg: gehealthcare.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2026 17:10:03.0604 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 93ea209e-fdbf-444c-fafc-08df09150767 X-MS-Exchange-CrossTenant-Id: 9a309606-d6ec-4188-a28a-298812b4bbbf X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=9a309606-d6ec-4188-a28a-298812b4bbbf;Ip=[165.85.157.49];Helo=[atlrelay1.compute.ge-healthcare.net] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-SJ1PEPF000037AF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ4PPF635D8286C On Mon, May 18, 2026 at 06:01:56PM +0000, Jonas Karlman wrote: > The commit aeac23bda87f ("drm: bridge/dw_hdmi: improve HDMI > enable/disable handling") added use of PHY RXSENSE indications to avoid > triggering a full enable/disable of the HDMI block when a sink use a HPD > low voltage level pulse to indicate changes of the EDID. > > HDMI Specification Version 1.4b chapter 8.5 mentions: > > An HDMI Sink shall indicate any change to the contents of the E-EDID > by driving a low voltage level pulse on the Hot Plug Detect pin. This > pulse shall be at least 100 msec. > > A delayed work is now used to debounce reacting on a HPD low voltage > level pulse when a sink changes the EDID. The delayed work triggers a > hotplug uevent every time the connection status or EDID has changed. > > Remove RXSENSE handling to simplify the HPD interrupt handling and > instead depend on the delayed work to detect any connection status or > EDID changes. > > This also ensures the initial HPD interrupt polarity is based on current > HPD status to avoid an unnecessary interrupt from being triggered > immediately at probe or resume when a sink is connected. > > Tested-by: Diederik de Haas # Rock64, RockPro64, Quartz64-B > Signed-off-by: Jonas Karlman Tested-by: Ian Ray # i.MX6 > --- > v7: Remove clear of STAT0_RX_SENSE in dw_hdmi_remove() added in prior > patch > v6: Update commit message, > Collect t-b tag > v5: Add comment about interrupt generation > v4: New patch > --- > drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 147 ++++------------------ > 1 file changed, 22 insertions(+), 125 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > index 270db58a0e7c..2e09bff5faf7 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > @@ -161,11 +161,7 @@ struct dw_hdmi { > struct pinctrl_state *unwedge_state; > > struct mutex mutex; /* for state below */ > - enum drm_connector_force force; /* mutex-protected force state */ > struct drm_connector *curr_conn;/* current connector (only valid when !disabled) */ > - bool disabled; /* DRM has disabled our bridge */ > - bool rxsense; /* rxsense state */ > - u8 phy_mask; /* desired phy int mask settings */ > u8 mc_clkdis; /* clock disable register */ > > spinlock_t audio_lock; > @@ -196,14 +192,6 @@ const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi) > } > EXPORT_SYMBOL_GPL(dw_hdmi_to_plat_data); > > -#define HDMI_IH_PHY_STAT0_RX_SENSE \ > - (HDMI_IH_PHY_STAT0_RX_SENSE0 | HDMI_IH_PHY_STAT0_RX_SENSE1 | \ > - HDMI_IH_PHY_STAT0_RX_SENSE2 | HDMI_IH_PHY_STAT0_RX_SENSE3) > - > -#define HDMI_PHY_RX_SENSE \ > - (HDMI_PHY_RX_SENSE0 | HDMI_PHY_RX_SENSE1 | \ > - HDMI_PHY_RX_SENSE2 | HDMI_PHY_RX_SENSE3) > - > static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset) > { > regmap_write(hdmi->regm, offset << hdmi->reg_shift, val); > @@ -1702,36 +1690,25 @@ EXPORT_SYMBOL_GPL(dw_hdmi_phy_read_hpd); > void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data, > bool force, bool disabled, bool rxsense) > { > - u8 old_mask = hdmi->phy_mask; > - > - if (force || disabled || !rxsense) > - hdmi->phy_mask |= HDMI_PHY_RX_SENSE; > - else > - hdmi->phy_mask &= ~HDMI_PHY_RX_SENSE; > - > - if (old_mask != hdmi->phy_mask) > - hdmi_writeb(hdmi, hdmi->phy_mask, HDMI_PHY_MASK0); > } > EXPORT_SYMBOL_GPL(dw_hdmi_phy_update_hpd); > > void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data) > { > /* > - * Configure the PHY RX SENSE and HPD interrupts polarities and clear > - * any pending interrupt. > + * Configure the PHY HPD interrupt polarity based on current HPD status > + * and clear any pending interrupt. > */ > - hdmi_writeb(hdmi, HDMI_PHY_HPD | HDMI_PHY_RX_SENSE, HDMI_PHY_POL0); > - hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE, > - HDMI_IH_PHY_STAT0); > + hdmi_modb(hdmi, hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD ? > + 0 : HDMI_PHY_HPD, HDMI_PHY_HPD, HDMI_PHY_POL0); > + hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0); > > /* Enable cable hot plug irq. */ > - hdmi_writeb(hdmi, hdmi->phy_mask, HDMI_PHY_MASK0); > + hdmi_writeb(hdmi, ~HDMI_PHY_HPD, HDMI_PHY_MASK0); > > /* Clear and unmute interrupts. */ > - hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE, > - HDMI_IH_PHY_STAT0); > - hdmi_writeb(hdmi, ~(HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE), > - HDMI_IH_MUTE_PHY_STAT0); > + hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0); > + hdmi_writeb(hdmi, ~HDMI_IH_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0); > } > EXPORT_SYMBOL_GPL(dw_hdmi_phy_setup_hpd); > > @@ -2395,26 +2372,6 @@ static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) > } > } > > -/* > - * Adjust the detection of RXSENSE according to whether we have a forced > - * connection mode enabled, or whether we have been disabled. There is > - * no point processing RXSENSE interrupts if we have a forced connection > - * state, or DRM has us disabled. > - * > - * We also disable rxsense interrupts when we think we're disconnected > - * to avoid floating TDMS signals giving false rxsense interrupts. > - * > - * Note: we still need to listen for HPD interrupts even when DRM has us > - * disabled so that we can detect a connect event. > - */ > -static void dw_hdmi_update_phy_mask(struct dw_hdmi *hdmi) > -{ > - if (hdmi->phy.ops->update_hpd) > - hdmi->phy.ops->update_hpd(hdmi, hdmi->phy.data, > - hdmi->force, hdmi->disabled, > - hdmi->rxsense); > -} > - > static enum drm_connector_status dw_hdmi_detect(struct dw_hdmi *hdmi) > { > enum drm_connector_status result; > @@ -2512,9 +2469,7 @@ static void dw_hdmi_connector_force(struct drm_connector *connector) > struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); > > mutex_lock(&hdmi->mutex); > - hdmi->force = connector->force; > hdmi->last_connector_result = connector->status; > - dw_hdmi_update_phy_mask(hdmi); > mutex_unlock(&hdmi->mutex); > > dw_hdmi_connector_status_update(hdmi, connector, connector->status); > @@ -2932,10 +2887,8 @@ static void dw_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, > struct dw_hdmi *hdmi = bridge->driver_private; > > mutex_lock(&hdmi->mutex); > - hdmi->disabled = true; > hdmi->curr_conn = NULL; > dw_hdmi_poweroff(hdmi); > - dw_hdmi_update_phy_mask(hdmi); > handle_plugged_change(hdmi, false); > mutex_unlock(&hdmi->mutex); > } > @@ -2954,10 +2907,8 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, > mode = &drm_atomic_get_new_crtc_state(state, crtc)->adjusted_mode; > > mutex_lock(&hdmi->mutex); > - hdmi->disabled = false; > hdmi->curr_conn = connector; > dw_hdmi_poweron(hdmi, connector, mode); > - dw_hdmi_update_phy_mask(hdmi); > handle_plugged_change(hdmi, true); > mutex_unlock(&hdmi->mutex); > } > @@ -3060,78 +3011,29 @@ static irqreturn_t dw_hdmi_hardirq(int irq, void *dev_id) > > void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) > { > - mutex_lock(&hdmi->mutex); > - > - if (!hdmi->force) { > - /* > - * If the RX sense status indicates we're disconnected, > - * clear the software rxsense status. > - */ > - if (!rx_sense) > - hdmi->rxsense = false; > - > - /* > - * Only set the software rxsense status when both > - * rxsense and hpd indicates we're connected. > - * This avoids what seems to be bad behaviour in > - * at least iMX6S versions of the phy. > - */ > - if (hpd) > - hdmi->rxsense = true; > - > - dw_hdmi_update_phy_mask(hdmi); > - } > - mutex_unlock(&hdmi->mutex); > } > EXPORT_SYMBOL_GPL(dw_hdmi_setup_rx_sense); > > static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) > { > struct dw_hdmi *hdmi = dev_id; > - u8 intr_stat, phy_int_pol, phy_pol_mask, phy_stat; > - enum drm_connector_status status = connector_status_unknown; > - > - intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); > - phy_int_pol = hdmi_readb(hdmi, HDMI_PHY_POL0); > - phy_stat = hdmi_readb(hdmi, HDMI_PHY_STAT0); > - > - phy_pol_mask = 0; > - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) > - phy_pol_mask |= HDMI_PHY_HPD; > - if (intr_stat & HDMI_IH_PHY_STAT0_RX_SENSE0) > - phy_pol_mask |= HDMI_PHY_RX_SENSE0; > - if (intr_stat & HDMI_IH_PHY_STAT0_RX_SENSE1) > - phy_pol_mask |= HDMI_PHY_RX_SENSE1; > - if (intr_stat & HDMI_IH_PHY_STAT0_RX_SENSE2) > - phy_pol_mask |= HDMI_PHY_RX_SENSE2; > - if (intr_stat & HDMI_IH_PHY_STAT0_RX_SENSE3) > - phy_pol_mask |= HDMI_PHY_RX_SENSE3; > - > - if (phy_pol_mask) > - hdmi_modb(hdmi, ~phy_int_pol, phy_pol_mask, HDMI_PHY_POL0); > + u8 intr_stat; > > /* > - * RX sense tells us whether the TDMS transmitters are detecting > - * load - in other words, there's something listening on the > - * other end of the link. Use this to decide whether we should > - * power on the phy as HPD may be toggled by the sink to merely > - * ask the source to re-read the EDID. > + * Interrupt generation is accomplished in the following way: > + * interrupt = (mask == 0) && (polarity == status) > + * All interrupts are forwarded to the Interrupt Handler sticky bit > + * register ih_phy_stat0 and muted using the register ih_mute_phy_stat0. > */ > - if (intr_stat & > - (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) { > - dw_hdmi_setup_rx_sense(hdmi, > - phy_stat & HDMI_PHY_HPD, > - phy_stat & HDMI_PHY_RX_SENSE); > + intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); > + if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { > + enum drm_connector_status status; > > - if ((intr_stat & HDMI_IH_PHY_STAT0_HPD) && > - (phy_stat & HDMI_PHY_HPD)) > - status = connector_status_connected; > + /* Set HPD interrupt polarity based on current HPD status. */ > + status = dw_hdmi_phy_read_hpd(hdmi, hdmi->phy.data); > + hdmi_modb(hdmi, status == connector_status_connected ? > + 0 : HDMI_PHY_HPD, HDMI_PHY_HPD, HDMI_PHY_POL0); > > - if (!(phy_stat & (HDMI_PHY_HPD | HDMI_PHY_RX_SENSE))) > - status = connector_status_disconnected; > - } > - > - if (status != connector_status_unknown) { > dev_dbg(hdmi->dev, "EVENT=%s\n", > status == connector_status_connected ? > "plugin" : "plugout"); > @@ -3141,8 +3043,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) > } > > hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0); > - hdmi_writeb(hdmi, ~(HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE), > - HDMI_IH_MUTE_PHY_STAT0); > + hdmi_writeb(hdmi, ~HDMI_IH_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0); > > return IRQ_HANDLED; > } > @@ -3343,9 +3244,6 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, > hdmi->dev = dev; > hdmi->sample_rate = 48000; > hdmi->channels = 2; > - hdmi->disabled = true; > - hdmi->rxsense = true; > - hdmi->phy_mask = (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE); > hdmi->mc_clkdis = 0x7f; > hdmi->last_connector_result = connector_status_disconnected; > > @@ -3599,8 +3497,7 @@ void dw_hdmi_remove(struct dw_hdmi *hdmi) > /* Free, mute and clear phy interrupts */ > devm_free_irq(hdmi->dev, irq, hdmi); > hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); > - hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE, > - HDMI_IH_PHY_STAT0); > + hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0); > > /* Cancel any pending hot plug work */ > cancel_delayed_work_sync(&hdmi->hpd_work); > -- > 2.54.0 >