Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2024226rwe; Fri, 2 Sep 2022 07:30:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR4gCivnuUc+wX/s6lMbynznq2hYpV56zoyhuMJDg3J4KUUPcbRsbn5u7Hlx27KWOm6FrtLf X-Received: by 2002:a05:6402:268b:b0:446:381d:7b45 with SMTP id w11-20020a056402268b00b00446381d7b45mr33163089edd.372.1662129006338; Fri, 02 Sep 2022 07:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662129006; cv=none; d=google.com; s=arc-20160816; b=hOFU5REz16Dz/z3S0w/RfCBl2OlpT/siWlB9CeSUGpZCorucdc+5yDCoIcgZR08zZT VP/WR3cVWVn0200UrNpN6XqNMa1tvGv3+3+1bxGIVYHlQX032vrVuAaELdQh9jnYVLXC kYG637IPFNx06IgQ6n63e+SZcIxNxZ11HySx2NIGc/tGW7pt2sO/dYqozKFqfDMx4voD w6iVZ2ixhadPx5bXSC7cfJ/HegWpO5/pDfKCIRqO/N+dNb2VlFR9t30J1AYVAMqlNO8I ivl8q4BGUs9bh/gn52h4xc/1PJBlIJLR4OOr7WyKG/KQr5VFLxGt5E2+t4qR3IH4/UZw oecA== 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=8i23uji2ZnQJwdjcge0Hh/bXZRxyLQ9I/pj3Ijppmu0=; b=okVap7DT+pGlWzGS/djuureme7eY5BGl9+XasbrYKoxZZxqkxQQTzdhxECjR6GE3vK TZeq4jyIAJoQxOj/Wu+ua08ZntgDGLVQYweLyAQa0q8Y6tShldmSXNnWsd4kZFK229NU 9+EaCsWLzxS3nzFRwKy/6Oo1COpm35C3I7udTdJejSzrVTE4BxNUdCbv7Jm3GZvRXA0N sDIhp8y1VQPNPtKxzoHd/LD4U5RxIg31JebNFBfoka/ni+IKGaVpdzPd5NxG+TCJuPsq ORNGvrdqmK0ZLofZqyxFOzrmh7Weu+UIpgzuI5tuNT796PKZHiLqiEG1bIxTt3/o/LTi yjSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SY5pNXNM; 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 qp9-20020a170907206900b00730abba3122si1802231ejb.467.2022.09.02.07.29.18; Fri, 02 Sep 2022 07:30:06 -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=SY5pNXNM; 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 S236542AbiIBNgQ (ORCPT + 99 others); Fri, 2 Sep 2022 09:36:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237164AbiIBNfp (ORCPT ); Fri, 2 Sep 2022 09:35:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E48E72B273; Fri, 2 Sep 2022 06:15:04 -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 436C8621D6; Fri, 2 Sep 2022 12:34:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4169CC433D7; Fri, 2 Sep 2022 12:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662122087; bh=Tkld2hdUhq4Rk9Ykapn2qM+q61m0Rq78GrQiEInBD68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SY5pNXNMoT93dqK98Pw7wywaYCPIctvJXDAyw8bYLzJ9MjR2zPrKVlk0wRvjK/Un6 WYiri5yENeZnAX8tMCFsWbmRlUjtd/rqp07Ot+ebpxVMiZB3EFSLE8lz28RTdXKC1Q 6vZXY9hhaYAdrlSGVja9CmkslQKQli6stp6pHIlA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Stefan Wahren , Maxime Ripard , "Sudip Mukherjee (Codethink)" Subject: [PATCH 5.19 01/72] drm/vc4: hdmi: Rework power up Date: Fri, 2 Sep 2022 14:18:37 +0200 Message-Id: <20220902121404.816237715@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121404.772492078@linuxfoundation.org> References: <20220902121404.772492078@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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: Maxime Ripard commit 258e483a4d5e97a6a8caa74381ddc1f395ac1c71 upstream. The current code tries to handle the case where CONFIG_PM isn't selected by first calling our runtime_resume implementation and then properly report the power state to the runtime_pm core. This allows to have a functionning device even if pm_runtime_get_* functions are nops. However, the device power state if CONFIG_PM is enabled is RPM_SUSPENDED, and thus our vc4_hdmi_write() and vc4_hdmi_read() calls in the runtime_pm hooks will now report a warning since the device might not be properly powered. Even more so, we need CONFIG_PM enabled since the previous RaspberryPi have a power domain that needs to be powered up for the HDMI controller to be usable. The previous patch has created a dependency on CONFIG_PM, now we can just assume it's there and only call pm_runtime_resume_and_get() to make sure our device is powered in bind. Link: https://lore.kernel.org/r/20220629123510.1915022-39-maxime@cerno.tech Acked-by: Thomas Zimmermann Tested-by: Stefan Wahren Signed-off-by: Maxime Ripard (cherry picked from commit 53565c28e6af2cef6bbf438c34250135e3564459) Signed-off-by: Maxime Ripard Cc: "Sudip Mukherjee (Codethink)" Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/vc4/vc4_hdmi.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -2992,17 +2992,15 @@ static int vc4_hdmi_bind(struct device * vc4_hdmi->disable_4kp60 = true; } + pm_runtime_enable(dev); + /* - * We need to have the device powered up at this point to call - * our reset hook and for the CEC init. + * We need to have the device powered up at this point to call + * our reset hook and for the CEC init. */ - ret = vc4_hdmi_runtime_resume(dev); + ret = pm_runtime_resume_and_get(dev); if (ret) - goto err_put_ddc; - - pm_runtime_get_noresume(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); + goto err_disable_runtime_pm; if ((of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi0") || of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi1")) && @@ -3048,6 +3046,7 @@ err_destroy_conn: err_destroy_encoder: drm_encoder_cleanup(encoder); pm_runtime_put_sync(dev); +err_disable_runtime_pm: pm_runtime_disable(dev); err_put_ddc: put_device(&vc4_hdmi->ddc->dev);