From patchwork Tue Aug 13 09:32:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 11095363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 09D421398 for ; Thu, 15 Aug 2019 08:39:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFCBA28842 for ; Thu, 15 Aug 2019 08:39:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E41D228868; Thu, 15 Aug 2019 08:39:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B8D828842 for ; Thu, 15 Aug 2019 08:39:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D45E6E953; Thu, 15 Aug 2019 08:38:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb3-smtp-cloud9.xs4all.net (lb3-smtp-cloud9.xs4all.net [194.109.24.30]) by gabe.freedesktop.org (Postfix) with ESMTPS id 018176E0D0 for ; Tue, 13 Aug 2019 09:32:59 +0000 (UTC) Received: from [IPv6:2001:420:44c1:2579:155e:93d7:78eb:5531] ([IPv6:2001:420:44c1:2579:155e:93d7:78eb:5531]) by smtp-cloud9.xs4all.net with ESMTPA id xTAghelkFAffAxTAkhTAWx; Tue, 13 Aug 2019 11:32:58 +0200 From: Hans Verkuil Subject: [PATCH] drm/bridge: dw-hdmi: move cec PA invalidation to dw_hdmi_setup_rx_sense() To: Maling list - DRI developers , Neil Armstrong Message-ID: <6099ff8a-e708-e466-5877-07c9102513f8@xs4all.nl> Date: Tue, 13 Aug 2019 11:32:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 Content-Language: en-US X-CMAE-Envelope: MS4wfPRY6eSbeJ04pdAM+ZonzBIN4mnfz0mHY7ST6uPv4vcZ0HClLhpgKoPpRZvizh7ibz2csXFFvW8hRzJ3Xt7XfVnSDsIxV5iCKJZaZMBysMlTl2jn8aBY tDd0rZN3/0roxe6nF3QaAFJMkx/sLVXcsaFTEEiezJz2dP4pPB1j6/lEnKshH+f/engBSs7ADI/J8MeF4cpvjSYZw3twxy6JHH9F7kkAq3tnFXFd0ShxJ/Qc 0vakVPIn6VF3k2kwCv9SDD3FUEUxm4c0xlxd7/babgXduYbHorDgQKabTQ1CG+ORjFt3OjAQVSf4seBRFvliJaePVtNyhjenMJWCWDOP/20kwV6DlUTYGpfC ebdabU6hrfePnLV5E/oxWYHpmLsoMn/by4hnNj55uzOymiNckcedBIOOGC0W+NxlaNevD/sd4+zK4rxL10AHQhaaje46ZNtaK+l9jpG0rLztTYm2+POJETuX E0py9ths/wjLKukX X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul , Laurent Pinchart , Linux Media Mailing List Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When testing CEC on the AML-S905X-CC board I noticed that the CEC physical address was not invalidated when the HDMI cable was unplugged. Some more digging showed that meson uses meson_dw_hdmi.c to handle the HPD. Both dw_hdmi_irq() and dw_hdmi_top_thread_irq() (in meson_dw_hdmi.c) call the dw_hdmi_setup_rx_sense() function. So move the code to invalidate the CEC physical address to that function, so that it is independent of where the HPD interrupt happens. Tested with both a AML-S905X-CC and a Khadas VIM2 board. Signed-off-by: Hans Verkuil --- Note: an alternative would be to make a new dw-hdmi function such as dw_hdmi_cec_phys_addr_invalidate() that is called from meson_dw_hdmi.c. I decided not to do that since this patch is minimally invasive, but that can obviously be changed if that approach is preferred. --- diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index c5a854af54f8..e899b31e1432 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2329,6 +2329,13 @@ void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); } + if (!hpd && !rx_sense) { + struct cec_notifier *notifier = READ_ONCE(hdmi->cec_notifier); + + if (notifier) + cec_notifier_phys_addr_invalidate(notifier); + } + mutex_unlock(&hdmi->mutex); } EXPORT_SYMBOL_GPL(dw_hdmi_setup_rx_sense); @@ -2369,14 +2376,6 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) dw_hdmi_setup_rx_sense(hdmi, phy_stat & HDMI_PHY_HPD, phy_stat & HDMI_PHY_RX_SENSE); - - if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) { - struct cec_notifier *notifier; - - notifier = READ_ONCE(hdmi->cec_notifier); - if (notifier) - cec_notifier_phys_addr_invalidate(notifier); - } } if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {