Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2202865iof; Tue, 7 Jun 2022 23:05:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2FLHcCykiHdleDpIAiKHG/NDWr2CHp5xVsYM65kE6wGheo8836fKhSY9TxenUsaqXOeg+ X-Received: by 2002:a05:6a00:24c1:b0:518:c52f:f5 with SMTP id d1-20020a056a0024c100b00518c52f00f5mr33324801pfv.15.1654668344128; Tue, 07 Jun 2022 23:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668344; cv=none; d=google.com; s=arc-20160816; b=bMT/Es7jC+gUPQnlBB8hpIPUoJqIYE+JuJ+KhCJtASdRlF6AbHKrZVWeN6G6/q92FT 8bwut2ySB2+cAjCPplH3PgwUTcIgsdaJANIqi0CwbPuJf8NkVjr7Hss4S+tfFnckB+1g cuR2eJkLynesM+uUA0VXZdfwdMFCm1hdabMOhlxrqekXekEONnx1s4BiOkCKnA6j7LHF xnAv598XkxVafg75NajCWpBShVUonIGtJomlLDKjD5tY4U4kFeMVajYPAtAb7NJDzEpK lMX4KSScmi3u7isXcr8ABISaK3IhJFSlHdPEk7fHTJJzxlFiOHEy8bq3AbiTPmm/Feqo 7uEw== 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=p18pGTj1TysOUqbw6fgjiWtKESsOm1TH8KPBBtjtHs4=; b=Lgvyx/BzoV63kNZMKXadCqf7bSya9F596RlRTVPyIw69BawpykWCgi9rDTxJiCiGUX w9Hd9XyCs+CiG0lGFngqguZB92WsqWpMLp26oqJ2zTXdOTbwGfvfzJrcFTgRCrj1WV+8 AeJPP7C/2xt4s3P44JUhwuVJBHZXZpOA+RAhPsBzAcVp1gGWzyjFesoE+7/JZGSfCwwY plKDlsfNx5SNx+TBGKxYsfCFUze2RJJ+Js3K6PYq71pIwmGj+Qt2vY2dD+rKVEMTO9Ek O2SO8VxiwtuBpp+Fp4Knj5eNqoEFCdqBr0DVFZbJEEj1vUtopTfeWAiDzJIXyywnmGlc FuNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Il8VDtjZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t1-20020a17090b018100b001e30236ae86si25201420pjs.112.2022.06.07.23.05.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:05:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Il8VDtjZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2A3C31A89B5; Tue, 7 Jun 2022 22:30:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387832AbiFHB1d (ORCPT + 99 others); Tue, 7 Jun 2022 21:27:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382957AbiFGWWv (ORCPT ); Tue, 7 Jun 2022 18:22:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16C0826D242; Tue, 7 Jun 2022 12:22:26 -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 ams.source.kernel.org (Postfix) with ESMTPS id A81DEB823CC; Tue, 7 Jun 2022 19:22:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 086E4C385A5; Tue, 7 Jun 2022 19:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629733; bh=HplrpNmY7M+tguF3+6EkcKSnhuhXimBvQS/rGeEEEww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Il8VDtjZSYUi7aJ7RhxZEziTmzVupytHUIDUp8a0LuG+VAhcRijDOuFlxA3dc4es/ KqdnOocdtrxTPtpwpU511Li6qkk1j8Rd2+0emjrX0OriIsPbJGzpLqHG4I0bQXb8yP TbP03tdhcZT4Jvud3dO7AG0KGRaSzcN17WaPEiXo= 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 5.18 796/879] drm/bridge: analogix_dp: Grab runtime PM reference for DP-AUX Date: Tue, 7 Jun 2022 19:05:14 +0200 Message-Id: <20220607165025.966692713@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 @@ -1632,8 +1632,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 *