Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'tegra-for-5.17-soc-opp' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into drm/tegra/for-next

+40
+25
drivers/soc/tegra/common.c
··· 10 10 #include <linux/export.h> 11 11 #include <linux/of.h> 12 12 #include <linux/pm_opp.h> 13 + #include <linux/pm_runtime.h> 13 14 14 15 #include <soc/tegra/common.h> 15 16 #include <soc/tegra/fuse.h> ··· 44 43 { 45 44 unsigned long rate; 46 45 struct clk *clk; 46 + bool rpm_enabled; 47 47 int err; 48 48 49 49 clk = devm_clk_get(dev, NULL); ··· 59 57 return -EINVAL; 60 58 } 61 59 60 + /* 61 + * Runtime PM of the device must be enabled in order to set up 62 + * GENPD's performance properly because GENPD core checks whether 63 + * device is suspended and this check doesn't work while RPM is 64 + * disabled. This makes sure the OPP vote below gets cached in 65 + * GENPD for the device. Instead, the vote is done the next time 66 + * the device gets runtime resumed. 67 + */ 68 + rpm_enabled = pm_runtime_enabled(dev); 69 + if (!rpm_enabled) 70 + pm_runtime_enable(dev); 71 + 72 + /* should never happen in practice */ 73 + if (!pm_runtime_enabled(dev)) { 74 + dev_WARN(dev, "failed to enable runtime PM\n"); 75 + pm_runtime_disable(dev); 76 + return -EINVAL; 77 + } 78 + 62 79 /* first dummy rate-setting initializes voltage vote */ 63 80 err = dev_pm_opp_set_rate(dev, rate); 81 + 82 + if (!rpm_enabled) 83 + pm_runtime_disable(dev); 84 + 64 85 if (err) { 65 86 dev_err(dev, "failed to initialize OPP clock: %d\n", err); 66 87 return err;
+15
include/soc/tegra/common.h
··· 39 39 } 40 40 #endif 41 41 42 + static inline int 43 + devm_tegra_core_dev_init_opp_table_common(struct device *dev) 44 + { 45 + struct tegra_core_opp_params opp_params = {}; 46 + int err; 47 + 48 + opp_params.init_state = true; 49 + 50 + err = devm_tegra_core_dev_init_opp_table(dev, &opp_params); 51 + if (err != -ENODEV) 52 + return err; 53 + 54 + return 0; 55 + } 56 + 42 57 #endif /* __SOC_TEGRA_COMMON_H__ */