Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp444889iog; Mon, 13 Jun 2022 06:07:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbK6oPfmXo9P7fpvfdy7sQCIPmfK56yaQmDBfMptmQ+3SqM/aUChg6RfNcB8m9dPLPoSUX X-Received: by 2002:a17:903:22ca:b0:163:e2b6:e10a with SMTP id y10-20020a17090322ca00b00163e2b6e10amr58244056plg.32.1655125542281; Mon, 13 Jun 2022 06:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125542; cv=none; d=google.com; s=arc-20160816; b=TcLcasAUpzl4sNVDE18a6kYbRN6miZDe0Kx6G8altOUkEJpRPmztqmz3h0hsnJuAD9 gMCpH4iUN4+zMnDm5HNAIoKOrFOyqY5Xf9C4CApktpGrfOiTuGCdY3lfQb92asnkxnUn Lo/5bPZdndrAR1aQRMKf2s+3RCuYM8YUwFGN3361rGffUqqb2CzNKPrH9NsmtkZm34Tq rZEDzkyou5dY7chULEob19NxKiZtfRfV0ZPqiF+5jBEIcSrvDBsfsc8yEiwQnhZv8HgT FbXc6nXcZZUh1KAIABmR9Vg8drx79gZEFoyt9AqYriwhAR7MHBpyw3Y/BuMA2n8nna5H ztNA== 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=VlmqXsZSSpgsij02S0jm0E1Z2Y25gnI0nhmrdS2WKVY=; b=PMI2MU/9ac53WHf6InfKFSRnvKQ67R3uq0rdtrTSb/b8zHPr4nm7LLt01QqeB+gvEf JnNOofoX1cQ1Ou7+K6FrluKXLAeld/TVNfNnh1z9uFQlo2Ts4fwJr9/MBSb36zKhY35R FjvOcv4uEVPBtwJTqogKsOJBa5uKmfK5V0L5TvShTQh4BPxuiT4tVPw22uaVuhej9VEQ juq23gLygtZa964d/6zcqWFERx0uPYugx02S2p7adJQtsxFdweAcfGHuk6m/T6EFzR22 HCZPCGOrauYf3H9eKk3MlOSHmc+BdPw4INzYtfWA3kgLJnItf2GcNpPhXP4vdYTmCLOE uLgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hLPWDvOW; 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 u6-20020a63df06000000b003fda16081basi8403861pgg.265.2022.06.13.06.05.27; Mon, 13 Jun 2022 06:05:42 -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=hLPWDvOW; 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 S1348276AbiFMK4J (ORCPT + 99 others); Mon, 13 Jun 2022 06:56:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348420AbiFMKxz (ORCPT ); Mon, 13 Jun 2022 06:53:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AB9D2EA38; Mon, 13 Jun 2022 03:27:45 -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 EC1D660B8D; Mon, 13 Jun 2022 10:27:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0975FC34114; Mon, 13 Jun 2022 10:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116064; bh=t2907cHjQyT0eVrmwEvJXRT3yJc2nPQcfpezzBhaDUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hLPWDvOWOE/aUOq8ukc396YX/BzpI6cUkrv/hbcEV4yg2CoDPQgPE5QN3mjmRrLwa 3HCYNdfFJ/yke1+1NWsWMsa8lZqaDGq8L29QShpU9yRwd049/M7wOrGJwKz3c3XloB 7gglnGpNhe+Zvo8Ggl+THuYJbg7i2C13RUYgzRgc= 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.14 116/218] drm/bridge: analogix_dp: Grab runtime PM reference for DP-AUX Date: Mon, 13 Jun 2022 12:09:34 +0200 Message-Id: <20220613094924.087609732@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094908.257446132@linuxfoundation.org> References: <20220613094908.257446132@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 @@ -1279,8 +1279,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; } int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,