Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3443767pxb; Sun, 26 Sep 2021 15:43:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHO3x4uRS+qO9jeo1Jgumk2XpB0jwU5NMjTwLlQUSIcCu9hO5M5fInCjOfpbwZZ8yKnQ08 X-Received: by 2002:a63:8543:: with SMTP id u64mr13821123pgd.220.1632696219032; Sun, 26 Sep 2021 15:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632696219; cv=none; d=google.com; s=arc-20160816; b=k93A30/dlQa8v0SfhMUGYgBbUVCI2iMfS5gQ8rH36bHnMBmfTiJd554Iq1UiQecGdF 6oRoPs2bfmDPiNXMs1A1caKOdfJ4JqQY7GRadtt2UNx+Qr9r/qaw+qYjvL41CYN9woZQ 7/7Z94q/2bKIhs8jExoCxUTpXJYtl/+QGPvHe1wZGMf/DpTSOvJuAJWmHirDxR1oUwfe OYXWze/+QLLRLMzDASUSYegg143OQqbnBs7t7ugrfLEWOl95cWGaKcFWbMQyFV6HrPjL Ts/tvJWjhdekh2cBrn5QAT+2qz6DfoWrCRmPxLBu2x3TTuHwjWSLbAFD8p0O1YKATWZF 656A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=b3yXsdmsWJbu2CaukGByuPBPrpPUHlzf8e1vIPRsAi8=; b=Bg9L41wXFMGlPn2tmS0fARYr6YttLoju5+ZI/N78g2XzCOueXAGecz84GQmz0E4oXc HLXls9nA1hx2KI7C3a9FmB89JTbJvTxtqD0EKsMf7ygRO7SCa1CSnfpuh3f5RtizOgkU j5QsP8lJjBsXpgh9gESw1awvh8H40NsVavljlNNF1icgf0xWryjCYFLQ50xvyeFaT2Fg AYYNwdn6tN9cZTx5ELTKJVJ42v4tXm9ielv+PN1nNzpwdGvGQcoa9ck4V1uI1Fzmj9uY R6yxtuV682lSmqcDjVNCqxJeV3vu3ub0hSV2nSfwg6gILOTa5dxkiIwLjw6EIB+cjAIJ nF4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ipithlZ1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si1756617plg.184.2021.09.26.15.43.26; Sun, 26 Sep 2021 15:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ipithlZ1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231228AbhIZWoM (ORCPT + 99 others); Sun, 26 Sep 2021 18:44:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230417AbhIZWoH (ORCPT ); Sun, 26 Sep 2021 18:44:07 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66926C061604; Sun, 26 Sep 2021 15:42:29 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id b15so67582053lfe.7; Sun, 26 Sep 2021 15:42:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=b3yXsdmsWJbu2CaukGByuPBPrpPUHlzf8e1vIPRsAi8=; b=ipithlZ1tm1MVGl7JpUknjdb7x6HalsbDPFYbcGd1ZEKet3JA9Wwn1RW3eJfFSk8tT unIyb95ZWbDM+eIcLls04SAQcrgSB23VZzJCrGqyA7dYq6lG9E1w1Q/gdqZPnMlboyP/ dKSiX8FvgteVLLaauMYVKUTE5tPww16vAzwgJkLXOkbpbRoJRs95t5DDFYKEaKqUZpCr KsuCf1uxkGD1FctrItdkb1PU0r2w5Lq0NlUWPVNh5REmgXLNIELWeU4FH5ozC8h1UPSv 7j8QB1njjZnrBGcUIV5pAChur4aZGtuCrEX0rXEma37p5JweFFEo214W+0AHEDXH2TEe 9FPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b3yXsdmsWJbu2CaukGByuPBPrpPUHlzf8e1vIPRsAi8=; b=o2ennIcWdEq4lgOColPL37hEhbmaJBJqmjdluIDRpcBw72IijoxJ0uzOOm/oP1f77y RCTPvMeiXio+BK4R8fvLFpnJFxIz8LusBz0i4M+WgnOiuZPrelbBPcbiUiVhF5lhek7O mUyaY5TT/svT7o2DDpoNU3UWdoY8524wdNncdTYVxDStzmnGRHDe757b2QIMs50VRymy xfT5Dus/G8uanhD4LxcD1iKZ6hk48wRci4SLc2aas8LYs0HlflyjmKiqInHXfJukYRU5 sSHUeWS5UsatoV28NhYXkp8b/ZC1vtMphRymGNxXA7POozyiS5d4Pph5eg+NkTD13w8d LI9Q== X-Gm-Message-State: AOAM532sKFc3Ra9QjOAACJg3krcWzRhGTkSLYeOQ97gSqQVZJFnWOadP WA9bldj2Q7jHOhFNy9gN5Go= X-Received: by 2002:a05:651c:290:: with SMTP id b16mr26341556ljo.178.1632696147847; Sun, 26 Sep 2021 15:42:27 -0700 (PDT) Received: from localhost.localdomain (46-138-80-108.dynamic.spd-mgts.ru. [46.138.80.108]) by smtp.gmail.com with ESMTPSA id m10sm1408899lfr.272.2021.09.26.15.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 15:42:27 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Ulf Hansson , Viresh Kumar , Stephen Boyd , Peter De Schrijver , Mikko Perttunen , Peter Chen , Lee Jones , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Nishanth Menon , Adrian Hunter , Michael Turquette Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-staging@lists.linux.dev, linux-pwm@vger.kernel.org, linux-mmc@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, Mark Brown , Vignesh Raghavendra , Richard Weinberger , Miquel Raynal , Lucas Stach , Stefan Agner , Mauro Carvalho Chehab , David Heidelberg Subject: [PATCH v13 02/35] soc/tegra: Add devm_tegra_core_dev_init_opp_table_common() Date: Mon, 27 Sep 2021 01:40:25 +0300 Message-Id: <20210926224058.1252-3-digetx@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210926224058.1252-1-digetx@gmail.com> References: <20210926224058.1252-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Only couple drivers need to get the -ENODEV error code and majority of drivers need to explicitly initialize the performance state. Add new common helper which sets up OPP table for these drivers. Signed-off-by: Dmitry Osipenko --- include/soc/tegra/common.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/soc/tegra/common.h b/include/soc/tegra/common.h index af41ad80ec21..5b4a042f60fb 100644 --- a/include/soc/tegra/common.h +++ b/include/soc/tegra/common.h @@ -39,4 +39,28 @@ devm_tegra_core_dev_init_opp_table(struct device *dev, } #endif +/* + * This function should be invoked with the enabled runtime PM of the device + * in order to initialize performance state properly. Most of Tegra devices + * are assumed to be suspended at a probe time and GENPD require RPM to be + * enabled to set up the rpm-resume state, otherwise device is active and + * performance state is applied immediately. Note that it will initialize + * OPP bandwidth if it's wired in a device-tree for this device, which is + * undesirable for a suspended device. + */ +static inline int +devm_tegra_core_dev_init_opp_table_common(struct device *dev) +{ + struct tegra_core_opp_params opp_params = {}; + int err; + + opp_params.init_state = true; + + err = devm_tegra_core_dev_init_opp_table(dev, &opp_params); + if (err != -ENODEV) + return err; + + return 0; +} + #endif /* __SOC_TEGRA_COMMON_H__ */ -- 2.32.0