Linux-Media Archive on lore.kernel.org
 help / color / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
	Neil Armstrong <narmstrong@baylibre.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sean Paul <seanpaul@chromium.org>,
	Dariusz Marcinkiewicz <darekm@google.com>
Subject: Re: [PATCH] drm/bridge: dw-hdmi: move cec PA invalidation to dw_hdmi_setup_rx_sense()
Date: Tue, 13 Aug 2019 11:34:01 +0200
Message-ID: <60547c6d-e8a1-0b2c-b8ae-acb2f4643be8@xs4all.nl> (raw)
In-Reply-To: <6099ff8a-e708-e466-5877-07c9102513f8@xs4all.nl>

CC Dariusz as well, since this issue was discovered when testing his
CEC patches.

Regards,

	Hans

On 8/13/19 11:32 AM, Hans Verkuil wrote:
> 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 <hverkuil-cisco@xs4all.nl>
> ---
> 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) {
> 


  reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13  9:32 Hans Verkuil
2019-08-13  9:34 ` Hans Verkuil [this message]
2019-08-13 10:18   ` Jonas Karlman
2019-08-13 10:49     ` Hans Verkuil
2019-08-13 11:27     ` Hans Verkuil
2019-08-13 11:41       ` Jonas Karlman
2019-08-13 11:43 ` Hans Verkuil
2019-08-13 11:56   ` Neil Armstrong

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60547c6d-e8a1-0b2c-b8ae-acb2f4643be8@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=a.hajda@samsung.com \
    --cc=darekm@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=seanpaul@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Media Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-media/0 linux-media/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-media linux-media/ https://lore.kernel.org/linux-media \
		linux-media@vger.kernel.org linux-media@archiver.kernel.org
	public-inbox-index linux-media


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-media


AGPL code for this site: git clone https://public-inbox.org/ public-inbox