Merge branch 'pm-devfreq'
* pm-devfreq: devfreq: rk3399_dmc: Don't use OPP structures outside of RCU locks devfreq: rk3399_dmc: Remove dangling rcu_read_unlock() devfreq: exynos: Don't use OPP structures outside of RCU locks PM / devfreq: rk3399_dmc: Use the resource-managed function to add devfreq dev PM / devfreq: correct comment typo. PM / devfreq: exynos-ppmu: Remove unused mutex from struct exynos_ppmu PM / devfreq: exynos-ppmu: ppmu_events array should not be NULL terminated PM / devfreq: exynos-ppmu: Fix module autoload PM / devfreq: rockchip-dfi: Fix module autoload PM / devfreq: exynos-nocp: Fix module autoload PM / devfreq: rk3399_dmc: Fix module autoload
This commit is contained in:
commit
bbc17bb8a8
@ -850,7 +850,7 @@ err_out:
|
||||
EXPORT_SYMBOL(devfreq_add_governor);
|
||||
|
||||
/**
|
||||
* devfreq_remove_device() - Remove devfreq feature from a device.
|
||||
* devfreq_remove_governor() - Remove devfreq feature from a device.
|
||||
* @governor: the devfreq governor to be removed
|
||||
*/
|
||||
int devfreq_remove_governor(struct devfreq_governor *governor)
|
||||
|
@ -190,6 +190,7 @@ static const struct of_device_id exynos_nocp_id_match[] = {
|
||||
{ .compatible = "samsung,exynos5420-nocp", },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, exynos_nocp_id_match);
|
||||
|
||||
static struct regmap_config exynos_nocp_regmap_config = {
|
||||
.reg_bits = 32,
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/suspend.h>
|
||||
@ -34,7 +33,6 @@ struct exynos_ppmu {
|
||||
unsigned int num_events;
|
||||
|
||||
struct device *dev;
|
||||
struct mutex lock;
|
||||
|
||||
struct exynos_ppmu_data ppmu;
|
||||
};
|
||||
@ -90,8 +88,6 @@ struct __exynos_ppmu_events {
|
||||
PPMU_EVENT(d1-cpu),
|
||||
PPMU_EVENT(d1-general),
|
||||
PPMU_EVENT(d1-rt),
|
||||
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
static int exynos_ppmu_find_ppmu_id(struct devfreq_event_dev *edev)
|
||||
@ -351,6 +347,7 @@ static const struct of_device_id exynos_ppmu_id_match[] = {
|
||||
},
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, exynos_ppmu_id_match);
|
||||
|
||||
static struct devfreq_event_ops *exynos_bus_get_ops(struct device_node *np)
|
||||
{
|
||||
@ -463,7 +460,6 @@ static int exynos_ppmu_probe(struct platform_device *pdev)
|
||||
if (!info)
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_init(&info->lock);
|
||||
info->dev = &pdev->dev;
|
||||
|
||||
/* Parse dt data to get resource */
|
||||
|
@ -188,6 +188,7 @@ static const struct of_device_id rockchip_dfi_id_match[] = {
|
||||
{ .compatible = "rockchip,rk3399-dfi" },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, rockchip_dfi_id_match);
|
||||
|
||||
static int rockchip_dfi_probe(struct platform_device *pdev)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ struct exynos_bus {
|
||||
unsigned int edev_count;
|
||||
struct mutex lock;
|
||||
|
||||
struct dev_pm_opp *curr_opp;
|
||||
unsigned long curr_freq;
|
||||
|
||||
struct regulator *regulator;
|
||||
struct clk *clk;
|
||||
@ -99,7 +99,7 @@ static int exynos_bus_target(struct device *dev, unsigned long *freq, u32 flags)
|
||||
{
|
||||
struct exynos_bus *bus = dev_get_drvdata(dev);
|
||||
struct dev_pm_opp *new_opp;
|
||||
unsigned long old_freq, new_freq, old_volt, new_volt, tol;
|
||||
unsigned long old_freq, new_freq, new_volt, tol;
|
||||
int ret = 0;
|
||||
|
||||
/* Get new opp-bus instance according to new bus clock */
|
||||
@ -113,8 +113,7 @@ static int exynos_bus_target(struct device *dev, unsigned long *freq, u32 flags)
|
||||
|
||||
new_freq = dev_pm_opp_get_freq(new_opp);
|
||||
new_volt = dev_pm_opp_get_voltage(new_opp);
|
||||
old_freq = dev_pm_opp_get_freq(bus->curr_opp);
|
||||
old_volt = dev_pm_opp_get_voltage(bus->curr_opp);
|
||||
old_freq = bus->curr_freq;
|
||||
rcu_read_unlock();
|
||||
|
||||
if (old_freq == new_freq)
|
||||
@ -146,7 +145,7 @@ static int exynos_bus_target(struct device *dev, unsigned long *freq, u32 flags)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
bus->curr_opp = new_opp;
|
||||
bus->curr_freq = new_freq;
|
||||
|
||||
dev_dbg(dev, "Set the frequency of bus (%lukHz -> %lukHz)\n",
|
||||
old_freq/1000, new_freq/1000);
|
||||
@ -163,9 +162,7 @@ static int exynos_bus_get_dev_status(struct device *dev,
|
||||
struct devfreq_event_data edata;
|
||||
int ret;
|
||||
|
||||
rcu_read_lock();
|
||||
stat->current_frequency = dev_pm_opp_get_freq(bus->curr_opp);
|
||||
rcu_read_unlock();
|
||||
stat->current_frequency = bus->curr_freq;
|
||||
|
||||
ret = exynos_bus_get_event(bus, &edata);
|
||||
if (ret < 0) {
|
||||
@ -226,7 +223,7 @@ static int exynos_bus_passive_target(struct device *dev, unsigned long *freq,
|
||||
}
|
||||
|
||||
new_freq = dev_pm_opp_get_freq(new_opp);
|
||||
old_freq = dev_pm_opp_get_freq(bus->curr_opp);
|
||||
old_freq = bus->curr_freq;
|
||||
rcu_read_unlock();
|
||||
|
||||
if (old_freq == new_freq)
|
||||
@ -242,7 +239,7 @@ static int exynos_bus_passive_target(struct device *dev, unsigned long *freq,
|
||||
}
|
||||
|
||||
*freq = new_freq;
|
||||
bus->curr_opp = new_opp;
|
||||
bus->curr_freq = new_freq;
|
||||
|
||||
dev_dbg(dev, "Set the frequency of bus (%lukHz -> %lukHz)\n",
|
||||
old_freq/1000, new_freq/1000);
|
||||
@ -335,6 +332,7 @@ static int exynos_bus_parse_of(struct device_node *np,
|
||||
struct exynos_bus *bus)
|
||||
{
|
||||
struct device *dev = bus->dev;
|
||||
struct dev_pm_opp *opp;
|
||||
unsigned long rate;
|
||||
int ret;
|
||||
|
||||
@ -352,22 +350,23 @@ static int exynos_bus_parse_of(struct device_node *np,
|
||||
}
|
||||
|
||||
/* Get the freq and voltage from OPP table to scale the bus freq */
|
||||
rcu_read_lock();
|
||||
ret = dev_pm_opp_of_add_table(dev);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to get OPP table\n");
|
||||
rcu_read_unlock();
|
||||
goto err_clk;
|
||||
}
|
||||
|
||||
rate = clk_get_rate(bus->clk);
|
||||
bus->curr_opp = devfreq_recommended_opp(dev, &rate, 0);
|
||||
if (IS_ERR(bus->curr_opp)) {
|
||||
|
||||
rcu_read_lock();
|
||||
opp = devfreq_recommended_opp(dev, &rate, 0);
|
||||
if (IS_ERR(opp)) {
|
||||
dev_err(dev, "failed to find dev_pm_opp\n");
|
||||
rcu_read_unlock();
|
||||
ret = PTR_ERR(bus->curr_opp);
|
||||
ret = PTR_ERR(opp);
|
||||
goto err_opp;
|
||||
}
|
||||
bus->curr_freq = dev_pm_opp_get_freq(opp);
|
||||
rcu_read_unlock();
|
||||
|
||||
return 0;
|
||||
|
@ -80,7 +80,6 @@ struct rk3399_dmcfreq {
|
||||
struct regulator *vdd_center;
|
||||
unsigned long rate, target_rate;
|
||||
unsigned long volt, target_volt;
|
||||
struct dev_pm_opp *curr_opp;
|
||||
};
|
||||
|
||||
static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq,
|
||||
@ -102,9 +101,6 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq,
|
||||
target_rate = dev_pm_opp_get_freq(opp);
|
||||
target_volt = dev_pm_opp_get_voltage(opp);
|
||||
|
||||
dmcfreq->rate = dev_pm_opp_get_freq(dmcfreq->curr_opp);
|
||||
dmcfreq->volt = dev_pm_opp_get_voltage(dmcfreq->curr_opp);
|
||||
|
||||
rcu_read_unlock();
|
||||
|
||||
if (dmcfreq->rate == target_rate)
|
||||
@ -165,7 +161,9 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq,
|
||||
if (err)
|
||||
dev_err(dev, "Cannot to set vol %lu uV\n", target_volt);
|
||||
|
||||
dmcfreq->curr_opp = opp;
|
||||
dmcfreq->rate = target_rate;
|
||||
dmcfreq->volt = target_volt;
|
||||
|
||||
out:
|
||||
mutex_unlock(&dmcfreq->lock);
|
||||
return err;
|
||||
@ -414,7 +412,6 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
|
||||
*/
|
||||
if (dev_pm_opp_of_add_table(dev)) {
|
||||
dev_err(dev, "Invalid operating-points in device tree.\n");
|
||||
rcu_read_unlock();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -431,12 +428,13 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
|
||||
rcu_read_unlock();
|
||||
return PTR_ERR(opp);
|
||||
}
|
||||
data->rate = dev_pm_opp_get_freq(opp);
|
||||
data->volt = dev_pm_opp_get_voltage(opp);
|
||||
rcu_read_unlock();
|
||||
data->curr_opp = opp;
|
||||
|
||||
rk3399_devfreq_dmc_profile.initial_freq = data->rate;
|
||||
|
||||
data->devfreq = devfreq_add_device(dev,
|
||||
data->devfreq = devm_devfreq_add_device(dev,
|
||||
&rk3399_devfreq_dmc_profile,
|
||||
"simple_ondemand",
|
||||
&data->ondemand_data);
|
||||
@ -454,6 +452,7 @@ static const struct of_device_id rk3399dmc_devfreq_of_match[] = {
|
||||
{ .compatible = "rockchip,rk3399-dmc" },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, rk3399dmc_devfreq_of_match);
|
||||
|
||||
static struct platform_driver rk3399_dmcfreq_driver = {
|
||||
.probe = rk3399_dmcfreq_probe,
|
||||
|
Loading…
Reference in New Issue
Block a user