Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp578273iog; Mon, 13 Jun 2022 08:29:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxobzMCBWJPyMumQFjuJ6OaYzzsMLWEe5bm9shGN1t0e/yETMaD3VReODgNNyK1o9594AbP X-Received: by 2002:a17:902:b18d:b0:167:86f2:88c7 with SMTP id s13-20020a170902b18d00b0016786f288c7mr37940620plr.103.1655134156135; Mon, 13 Jun 2022 08:29:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655134156; cv=none; d=google.com; s=arc-20160816; b=dsYWrnvG0b4EHbS1nFusU2y0+28Xz8easHUBn0ltwHVyrvSpfZjaVpToGYoOcBHPBr n+jDsuQhOFezsHdGvEvWgtxVa1r6zUSwjaXZbOkRyq9UKcAISWzk/Z0zIlsN3Elb5X4/ qm+SlFWswuf2RgOsxmvvmNCZp+arUZbc1HfNGp3R5iQ3orfoZyJ70zzZBMP9xXROHhq5 AcUqO23Db6Mm1ll2iASHygaJBx7W+b4q09hIVpZhGzN/QnJpXx6d02cRXtA1iPODrEwd lgY2bwJt3HR7a41e9qP5K6oShigBTu4o6v45ez6Dr8hIjV50GCo3LwN7o7cuMqIVZJcD 3rxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WbhePC5EhNmDhgA6hJ2g6P3calrOYWmILFbYbP8+j10=; b=a9Rwlpcq6kBGEivtr8kfPWki3UkjOJau+s7XjqprElEtn2Sxwv6+31cEXwjgcnQhQc 1Vd1eagnFZQJJ4ysxbqhnHdPKOYapAxSAUIt0fm1izo+AoRbJPYX1RnoCT9/pfmq5vcS /rQvr/seFXYSmx1O2h20j3CAXybyeppTL/KZdZVZNKjv1kwhV6P3DiNFkxiBinb2hW1r NLCJeYnFUaOojBjCxFaM3yWTukBu6WHVbSq1QB01aKxK6rw1w9WXlkzqtVvS3ijWuPD5 c8dlxlUBzRdLSmBGp7oqULGTQbibL6FZneuLpgVK+UA7NBnxVYlhJVPmXM30ePAQMbrG He2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lqfVkHhd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a170902e88e00b00167863f828dsi12168863plg.119.2022.06.13.08.29.00; Mon, 13 Jun 2022 08:29:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lqfVkHhd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358722AbiFMMIT (ORCPT + 99 others); Mon, 13 Jun 2022 08:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358744AbiFMMEk (ORCPT ); Mon, 13 Jun 2022 08:04:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F4A750032; Mon, 13 Jun 2022 03:57:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A49A261346; Mon, 13 Jun 2022 10:57:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1E00C341C5; Mon, 13 Jun 2022 10:57:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655117871; bh=2MiGSPVt5iRNA+MRCvEt8ZV/VW9I8RfZ6xa1RC7f6sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lqfVkHhdzUDnp33pTMVLRxNbLej5DJ8az3twn3UkEXIy2JZRmxAZ9xQ1xvsRAnEq7 KzjDfHlbwvK+63LAWYcoQaczZf42U4AAgzBHqBZdM7sVSimj2Qt3q1SREW0fcZx1M7 9wfmHOxh5HGjUB9VLewYFAjA7e3YyeskvQZ7Nopw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomeu Vizoso , Brian Norris , Douglas Anderson Subject: [PATCH 4.19 162/287] drm/bridge: analogix_dp: Grab runtime PM reference for DP-AUX Date: Mon, 13 Jun 2022 12:09:46 +0200 Message-Id: <20220613094928.790591935@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094923.832156175@linuxfoundation.org> References: <20220613094923.832156175@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brian Norris commit 8fb6c44fe8468f92ac7b8bbfcca4404a4e88645f upstream. If the display is not enable()d, then we aren't holding a runtime PM reference here. Thus, it's easy to accidentally cause a hang, if user space is poking around at /dev/drm_dp_aux0 at the "wrong" time. Let's get a runtime PM reference, and check that we "see" the panel. Don't force any panel power-up, etc., because that can be intrusive, and that's not what other drivers do (see drivers/gpu/drm/bridge/ti-sn65dsi86.c and drivers/gpu/drm/bridge/parade-ps8640.c.) Fixes: 0d97ad03f422 ("drm/bridge: analogix_dp: Remove duplicated code") Cc: Cc: Tomeu Vizoso Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Signed-off-by: Douglas Anderson Link: https://patchwork.freedesktop.org/patch/msgid/20220301181107.v4.1.I773a08785666ebb236917b0c8e6c05e3de471e75@changeid Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1514,8 +1514,19 @@ static ssize_t analogix_dpaux_transfer(s struct drm_dp_aux_msg *msg) { struct analogix_dp_device *dp = to_dp(aux); + int ret; - return analogix_dp_transfer(dp, msg); + pm_runtime_get_sync(dp->dev); + + ret = analogix_dp_detect_hpd(dp); + if (ret) + goto out; + + ret = analogix_dp_transfer(dp, msg); +out: + pm_runtime_put(dp->dev); + + return ret; } struct analogix_dp_device *