From patchwork Sun Jul 18 21:27:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 479723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A971BC636CE for ; Sun, 18 Jul 2021 21:28:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9182960FEA for ; Sun, 18 Jul 2021 21:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233095AbhGRVbI (ORCPT ); Sun, 18 Jul 2021 17:31:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232904AbhGRVbH (ORCPT ); Sun, 18 Jul 2021 17:31:07 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AAA5C061765; Sun, 18 Jul 2021 14:28:08 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id h9so23016715ljm.5; Sun, 18 Jul 2021 14:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/2TaNdcasZkobL90Ag9/S0mipkwZ8znoNlAL9mBQuBo=; b=Bl6ZnkL0X44oiMQCqgLnNGPKYslyWc50Wznp85cs5sA6oaW3AniVEtBW8NZBPOTHO6 Bs6RlOCO8FqcWVnODZn5H/W6apfnKJ4i6cXEeCFuELlZ9Rbyd4PtzTh7Wj/x+Ff0qYiZ tfOf1PVdNsslm3kavU8oPl5zciUL/rVCvDM7LOBcqhvCRSuxOfqSxWO9MWiVqezyN1ie kh8FQaTU8vdqaKvIAMXiXPMtPh87hhnIl17YneXTIa/SoQc0wsJGkjlzyMlzn1QwfpEx 7gRwhpoSacl4MUCs3yPbVd3Yp/iGwP+37zty6HhQ//l19r+855Xj9FeAHKye1S2rJFz/ DBDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/2TaNdcasZkobL90Ag9/S0mipkwZ8znoNlAL9mBQuBo=; b=MS15VfirGEEa90dQIthavMpyf9LelHsGwoV4RAG4tMZ7E+4sMecutaysqDKxu7lDUJ QqAixiJx4YcGn3lb4qzR3p23QeIJD4XLbx8f6wPa0rVf8iTNok2k8+0SGTehbzrZ8mbQ u6OCIm02v7mNK5AfQ/zzQorSy4jP9/pPBSPJAxyHPUk2lQBKAjRDobbGhdB12JrZMWch nr2+WFi9BcVMM7s975Z3IAg5ZDSlShRDuiCjvaqPqBpTrYkT1KvZPqET7TJMPVDlbRb/ 1oJJLkZd/Sj9CABNn4c4VRTuAM3BkC7y28hotUGXdyTfHUsytKjL9/X4N2cfjPb2UhAC sBJA== X-Gm-Message-State: AOAM531FjyjCR3T1M2E767Ajfg1C3irFsT/dCQFjjW82Y2jqer51jjGh O4dWN3oAFVUPiTXrkfIqxJ4= X-Google-Smtp-Source: ABdhPJwyuF0ScQBajAY8wqquTubQrcfSm3HIoBpZ4sqQwDoxZnLamhQ052JBJbIxTiy1kzGI9g7srA== X-Received: by 2002:a05:651c:10a2:: with SMTP id k2mr19254126ljn.89.1626643686869; Sun, 18 Jul 2021 14:28:06 -0700 (PDT) Received: from localhost.localdomain (46-138-17-53.dynamic.spd-mgts.ru. [46.138.17.53]) by smtp.gmail.com with ESMTPSA id c10sm1229062lfv.10.2021.07.18.14.28.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jul 2021 14:28:06 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , "Rafael J. Wysocki" , Daniel Lezcano Cc: linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/2] cpuidle: tegra: Check whether PMC is ready Date: Mon, 19 Jul 2021 00:27:06 +0300 Message-Id: <20210718212706.21659-3-digetx@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210718212706.21659-1-digetx@gmail.com> References: <20210718212706.21659-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Check whether PMC is ready before proceeding with the cpuidle registration. This fixes racing with the PMC driver probe order, which results in a disabled deepest CC6 idling state if cpuidle driver is probed before the PMC. Signed-off-by: Dmitry Osipenko Acked-by: Daniel Lezcano --- drivers/cpuidle/cpuidle-tegra.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c index 508bd9f23792..9845629aeb6d 100644 --- a/drivers/cpuidle/cpuidle-tegra.c +++ b/drivers/cpuidle/cpuidle-tegra.c @@ -337,6 +337,9 @@ static void tegra_cpuidle_setup_tegra114_c7_state(void) static int tegra_cpuidle_probe(struct platform_device *pdev) { + if (tegra_pmc_get_suspend_mode() == TEGRA_SUSPEND_NOT_READY) + return -EPROBE_DEFER; + /* LP2 could be disabled in device-tree */ if (tegra_pmc_get_suspend_mode() < TEGRA_SUSPEND_LP2) tegra_cpuidle_disable_state(TEGRA_CC6);