···1010#include <linux/export.h>1111#include <linux/of.h>1212#include <linux/pm_opp.h>1313+#include <linux/pm_runtime.h>13141415#include <soc/tegra/common.h>1516#include <soc/tegra/fuse.h>···4443{4544 unsigned long rate;4645 struct clk *clk;4646+ bool rpm_enabled;4747 int err;48484949 clk = devm_clk_get(dev, NULL);···5957 return -EINVAL;6058 }61596060+ /*6161+ * Runtime PM of the device must be enabled in order to set up6262+ * GENPD's performance properly because GENPD core checks whether6363+ * device is suspended and this check doesn't work while RPM is6464+ * disabled. This makes sure the OPP vote below gets cached in6565+ * GENPD for the device. Instead, the vote is done the next time6666+ * the device gets runtime resumed.6767+ */6868+ rpm_enabled = pm_runtime_enabled(dev);6969+ if (!rpm_enabled)7070+ pm_runtime_enable(dev);7171+7272+ /* should never happen in practice */7373+ if (!pm_runtime_enabled(dev)) {7474+ dev_WARN(dev, "failed to enable runtime PM\n");7575+ pm_runtime_disable(dev);7676+ return -EINVAL;7777+ }7878+6279 /* first dummy rate-setting initializes voltage vote */6380 err = dev_pm_opp_set_rate(dev, rate);8181+8282+ if (!rpm_enabled)8383+ pm_runtime_disable(dev);8484+6485 if (err) {6586 dev_err(dev, "failed to initialize OPP clock: %d\n", err);6687 return err;