mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
OPP: Pass index to _of_init_opp_table()
This is a preparatory patch required for the next commit which will start using OPP table's node pointer in _of_init_opp_table(), which requires the index in order to read the OPP table's phandle. This commit adds the index argument in the call chains in order to get it delivered to _of_init_opp_table(). Tested-by: Niklas Cassel <niklas.cassel@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
parent
3d2556992a
commit
eb7c8743d6
4 changed files with 30 additions and 11 deletions
|
@ -785,7 +785,7 @@ struct opp_device *_add_opp_dev(const struct device *dev,
|
||||||
return opp_dev;
|
return opp_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct opp_table *_allocate_opp_table(struct device *dev)
|
static struct opp_table *_allocate_opp_table(struct device *dev, int index)
|
||||||
{
|
{
|
||||||
struct opp_table *opp_table;
|
struct opp_table *opp_table;
|
||||||
struct opp_device *opp_dev;
|
struct opp_device *opp_dev;
|
||||||
|
@ -808,7 +808,7 @@ static struct opp_table *_allocate_opp_table(struct device *dev)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_of_init_opp_table(opp_table, dev);
|
_of_init_opp_table(opp_table, dev, index);
|
||||||
|
|
||||||
/* Find clk for the device */
|
/* Find clk for the device */
|
||||||
opp_table->clk = clk_get(dev, NULL);
|
opp_table->clk = clk_get(dev, NULL);
|
||||||
|
@ -833,7 +833,7 @@ void _get_opp_table_kref(struct opp_table *opp_table)
|
||||||
kref_get(&opp_table->kref);
|
kref_get(&opp_table->kref);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct opp_table *dev_pm_opp_get_opp_table(struct device *dev)
|
static struct opp_table *_opp_get_opp_table(struct device *dev, int index)
|
||||||
{
|
{
|
||||||
struct opp_table *opp_table;
|
struct opp_table *opp_table;
|
||||||
|
|
||||||
|
@ -844,15 +844,26 @@ struct opp_table *dev_pm_opp_get_opp_table(struct device *dev)
|
||||||
if (!IS_ERR(opp_table))
|
if (!IS_ERR(opp_table))
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
opp_table = _allocate_opp_table(dev);
|
opp_table = _allocate_opp_table(dev, index);
|
||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
mutex_unlock(&opp_table_lock);
|
mutex_unlock(&opp_table_lock);
|
||||||
|
|
||||||
return opp_table;
|
return opp_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct opp_table *dev_pm_opp_get_opp_table(struct device *dev)
|
||||||
|
{
|
||||||
|
return _opp_get_opp_table(dev, 0);
|
||||||
|
}
|
||||||
EXPORT_SYMBOL_GPL(dev_pm_opp_get_opp_table);
|
EXPORT_SYMBOL_GPL(dev_pm_opp_get_opp_table);
|
||||||
|
|
||||||
|
struct opp_table *dev_pm_opp_get_opp_table_indexed(struct device *dev,
|
||||||
|
int index)
|
||||||
|
{
|
||||||
|
return _opp_get_opp_table(dev, index);
|
||||||
|
}
|
||||||
|
|
||||||
static void _opp_table_kref_release(struct kref *kref)
|
static void _opp_table_kref_release(struct kref *kref)
|
||||||
{
|
{
|
||||||
struct opp_table *opp_table = container_of(kref, struct opp_table, kref);
|
struct opp_table *opp_table = container_of(kref, struct opp_table, kref);
|
||||||
|
|
|
@ -52,7 +52,8 @@ static struct opp_table *_managed_opp(const struct device_node *np)
|
||||||
return managed_table;
|
return managed_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _of_init_opp_table(struct opp_table *opp_table, struct device *dev)
|
void _of_init_opp_table(struct opp_table *opp_table, struct device *dev,
|
||||||
|
int index)
|
||||||
{
|
{
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
|
|
||||||
|
@ -378,7 +379,8 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initializes OPP tables based on new bindings */
|
/* Initializes OPP tables based on new bindings */
|
||||||
static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np)
|
static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np,
|
||||||
|
int index)
|
||||||
{
|
{
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
struct opp_table *opp_table;
|
struct opp_table *opp_table;
|
||||||
|
@ -393,7 +395,7 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np)
|
||||||
goto put_opp_table;
|
goto put_opp_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
opp_table = dev_pm_opp_get_opp_table(dev);
|
opp_table = dev_pm_opp_get_opp_table_indexed(dev, index);
|
||||||
if (!opp_table)
|
if (!opp_table)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -526,7 +528,7 @@ int dev_pm_opp_of_add_table(struct device *dev)
|
||||||
return _of_add_opp_table_v1(dev);
|
return _of_add_opp_table_v1(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = _of_add_opp_table_v2(dev, opp_np);
|
ret = _of_add_opp_table_v2(dev, opp_np, 0);
|
||||||
of_node_put(opp_np);
|
of_node_put(opp_np);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -574,7 +576,7 @@ int dev_pm_opp_of_add_table_indexed(struct device *dev, int index)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = _of_add_opp_table_v2(dev, opp_np);
|
ret = _of_add_opp_table_v2(dev, opp_np, index);
|
||||||
of_node_put(opp_np);
|
of_node_put(opp_np);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -200,9 +200,9 @@ void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of, in
|
||||||
struct opp_table *_add_opp_table(struct device *dev);
|
struct opp_table *_add_opp_table(struct device *dev);
|
||||||
|
|
||||||
#ifdef CONFIG_OF
|
#ifdef CONFIG_OF
|
||||||
void _of_init_opp_table(struct opp_table *opp_table, struct device *dev);
|
void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, int index);
|
||||||
#else
|
#else
|
||||||
static inline void _of_init_opp_table(struct opp_table *opp_table, struct device *dev) {}
|
static inline void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, int index) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
#ifdef CONFIG_DEBUG_FS
|
||||||
|
|
|
@ -79,6 +79,7 @@ struct dev_pm_set_opp_data {
|
||||||
#if defined(CONFIG_PM_OPP)
|
#if defined(CONFIG_PM_OPP)
|
||||||
|
|
||||||
struct opp_table *dev_pm_opp_get_opp_table(struct device *dev);
|
struct opp_table *dev_pm_opp_get_opp_table(struct device *dev);
|
||||||
|
struct opp_table *dev_pm_opp_get_opp_table_indexed(struct device *dev, int index);
|
||||||
void dev_pm_opp_put_opp_table(struct opp_table *opp_table);
|
void dev_pm_opp_put_opp_table(struct opp_table *opp_table);
|
||||||
|
|
||||||
unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
|
unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
|
||||||
|
@ -136,6 +137,11 @@ static inline struct opp_table *dev_pm_opp_get_opp_table(struct device *dev)
|
||||||
return ERR_PTR(-ENOTSUPP);
|
return ERR_PTR(-ENOTSUPP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct opp_table *dev_pm_opp_get_opp_table_indexed(struct device *dev, int index)
|
||||||
|
{
|
||||||
|
return ERR_PTR(-ENOTSUPP);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void dev_pm_opp_put_opp_table(struct opp_table *opp_table) {}
|
static inline void dev_pm_opp_put_opp_table(struct opp_table *opp_table) {}
|
||||||
|
|
||||||
static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
|
static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
|
||||||
|
|
Loading…
Reference in a new issue