mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "angelogioacchino.delregno@collabora.com" 
	<angelogioacchino.delregno@collabora.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	"wenst@chromium.org" <wenst@chromium.org>,
	"kernel@collabora.com" <kernel@collabora.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"amergnat@baylibre.com" <amergnat@baylibre.com>,
	"ehristev@collabora.com" <ehristev@collabora.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"nfraprado@collabora.com" <nfraprado@collabora.com>
Subject: Re: [PATCH v7 06/11] drm/mediatek: dp: Enable event interrupt only when bridge attached
Date: Thu, 27 Jul 2023 02:53:23 +0000	[thread overview]
Message-ID: <72e40be84af796a36b51deecca2bd142f1f5cfd4.camel@mediatek.com> (raw)
In-Reply-To: <20230725073234.55892-7-angelogioacchino.delregno@collabora.com>

Hi, Angelo:

On Tue, 2023-07-25 at 09:32 +0200, AngeloGioacchino Del Regno wrote:
> It is useless and error-prone to enable the DisplayPort event
> interrupt
> before finishing to probe and install the driver, as the DP training
> cannot happen before the entire pipeline is correctly set up, as the
> interrupt handler also requires the full hardware to be initialized
> by
> mtk_dp_bridge_attach().
> 
> Anyway, depending in which state the controller is left from the
> bootloader, this may cause an interrupt storm and consequently hang
> the kernel during boot, so, avoid enabling the interrupt until we
> reach a clean state by adding the IRQ_NOAUTOEN flag before requesting
> it at probe time and manage the enablement of the ISR in the
> .attach()
> and .detach() handlers for the DP bridge.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
> Tested-by: Chen-Yu Tsai <wenst@chromium.org>
> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dp.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c
> b/drivers/gpu/drm/mediatek/mtk_dp.c
> index e8d3bf310608..83e55f8dc84a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> @@ -100,6 +100,7 @@ struct mtk_dp_efuse_fmt {
>  struct mtk_dp {
>  	bool enabled;
>  	bool need_debounce;
> +	int irq;
>  	u8 max_lanes;
>  	u8 max_linkrate;
>  	u8 rx_cap[DP_RECEIVER_CAP_SIZE];
> @@ -2141,6 +2142,8 @@ static int mtk_dp_bridge_attach(struct
> drm_bridge *bridge,
>  
>  	mtk_dp->drm_dev = bridge->dev;
>  
> +	irq_clear_status_flags(mtk_dp->irq, IRQ_NOAUTOEN);
> +	enable_irq(mtk_dp->irq);
>  	mtk_dp_hwirq_enable(mtk_dp, true);
>  
>  	return 0;
> @@ -2157,6 +2160,7 @@ static void mtk_dp_bridge_detach(struct
> drm_bridge *bridge)
>  	struct mtk_dp *mtk_dp = mtk_dp_from_bridge(bridge);
>  
>  	mtk_dp_hwirq_enable(mtk_dp, false);
> +	disable_irq(mtk_dp->irq);
>  	mtk_dp->drm_dev = NULL;
>  	mtk_dp_poweroff(mtk_dp);
>  	drm_dp_aux_unregister(&mtk_dp->aux);
> @@ -2475,7 +2479,7 @@ static int mtk_dp_probe(struct platform_device
> *pdev)
>  {
>  	struct mtk_dp *mtk_dp;
>  	struct device *dev = &pdev->dev;
> -	int ret, irq_num;
> +	int ret;
>  
>  	mtk_dp = devm_kzalloc(dev, sizeof(*mtk_dp), GFP_KERNEL);
>  	if (!mtk_dp)
> @@ -2484,9 +2488,9 @@ static int mtk_dp_probe(struct platform_device
> *pdev)
>  	mtk_dp->dev = dev;
>  	mtk_dp->data = (struct mtk_dp_data
> *)of_device_get_match_data(dev);
>  
> -	irq_num = platform_get_irq(pdev, 0);
> -	if (irq_num < 0)
> -		return dev_err_probe(dev, irq_num,
> +	mtk_dp->irq = platform_get_irq(pdev, 0);
> +	if (mtk_dp->irq < 0)
> +		return dev_err_probe(dev, mtk_dp->irq,
>  				     "failed to request dp irq
> resource\n");
>  
>  	mtk_dp->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 
> 1, 0);
> @@ -2507,7 +2511,8 @@ static int mtk_dp_probe(struct platform_device
> *pdev)
>  
>  	spin_lock_init(&mtk_dp->irq_thread_lock);
>  
> -	ret = devm_request_threaded_irq(dev, irq_num, mtk_dp_hpd_event,
> +	irq_set_status_flags(mtk_dp->irq, IRQ_NOAUTOEN);
> +	ret = devm_request_threaded_irq(dev, mtk_dp->irq,
> mtk_dp_hpd_event,
>  					mtk_dp_hpd_event_thread,
>  					IRQ_TYPE_LEVEL_HIGH,
> dev_name(dev),
>  					mtk_dp);

  reply	other threads:[~2023-07-27  2:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25  7:32 [PATCH v7 00/11] MediaTek DisplayPort: support eDP and aux-bus AngeloGioacchino Del Regno
2023-07-25  7:32 ` [PATCH v7 01/11] drm/mediatek: dp: Add missing error checks in mtk_dp_parse_capabilities AngeloGioacchino Del Regno
2023-07-27  3:36   ` CK Hu (胡俊光)
2023-07-25  7:32 ` [PATCH v7 02/11] drm/mediatek: dp: Move AUX and panel poweron/off sequence to function AngeloGioacchino Del Regno
2023-07-25  7:32 ` [PATCH v7 03/11] drm/mediatek: dp: Change logging to dev for mtk_dp_aux_transfer() AngeloGioacchino Del Regno
2023-07-25  7:32 ` [PATCH v7 04/11] drm/mediatek: dp: Use devm variant of drm_bridge_add() AngeloGioacchino Del Regno
2023-07-25  7:32 ` [PATCH v7 05/11] drm/mediatek: dp: Move AUX_P0 setting to mtk_dp_initialize_aux_settings() AngeloGioacchino Del Regno
2023-07-25  7:32 ` [PATCH v7 06/11] drm/mediatek: dp: Enable event interrupt only when bridge attached AngeloGioacchino Del Regno
2023-07-27  2:53   ` CK Hu (胡俊光) [this message]
2023-07-25  7:32 ` [PATCH v7 07/11] drm/mediatek: dp: Avoid mutex locks if audio is not supported/enabled AngeloGioacchino Del Regno
2023-07-25  7:32 ` [PATCH v7 08/11] drm/mediatek: dp: Move PHY registration to new function AngeloGioacchino Del Regno
2023-07-27  3:27   ` CK Hu (胡俊光)
2023-07-25  7:32 ` [PATCH v7 09/11] drm/mediatek: dp: Add support for embedded DisplayPort aux-bus AngeloGioacchino Del Regno
2023-08-25 12:01   ` Michael Walle
2023-08-25 14:02     ` Nícolas F. R. A. Prado
2023-08-25 15:42       ` Michael Walle
2023-08-25 20:36         ` Nícolas F. R. A. Prado
2023-08-29 13:30           ` Michael Walle
2023-08-29 18:19             ` Nícolas F. R. A. Prado
2023-08-30 11:11               ` Michael Walle
2023-08-31  7:12                 ` Chen-Yu Tsai
2023-09-01 10:00                   ` Michael Walle
2023-09-01 15:00                     ` Chen-Yu Tsai
2023-07-25  7:32 ` [PATCH v7 10/11] drm/mediatek: dp: Add .wait_hpd_asserted() for AUX bus AngeloGioacchino Del Regno
2023-07-25  7:32 ` [PATCH v7 11/11] drm/mediatek: dp: Don't register HPD interrupt handler for eDP case AngeloGioacchino Del Regno
2023-07-27  2:55   ` CK Hu (胡俊光)

Reply instructions:

You may reply publicly 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=72e40be84af796a36b51deecca2bd142f1f5cfd4.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=amergnat@baylibre.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ehristev@collabora.com \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nfraprado@collabora.com \
    --cc=wenst@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome