cpufreq: qcom-hw: Move soc_data to struct qcom_cpufreq
soc_data is a static info of the driver and thus no need to cache it inside the qcom_cpufreq_data struct which is allocated per frequency domain. So, move it inside qcom_cpufreq struct. Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
parent
7cfa8553fe
commit
4f7961706c
1 changed files with 14 additions and 13 deletions
|
@ -43,7 +43,6 @@ struct qcom_cpufreq_soc_data {
|
||||||
struct qcom_cpufreq_data {
|
struct qcom_cpufreq_data {
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
const struct qcom_cpufreq_soc_data *soc_data;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mutex to synchronize between de-init sequence and re-starting LMh
|
* Mutex to synchronize between de-init sequence and re-starting LMh
|
||||||
|
@ -63,6 +62,7 @@ struct qcom_cpufreq_data {
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
struct qcom_cpufreq_data *data;
|
struct qcom_cpufreq_data *data;
|
||||||
|
const struct qcom_cpufreq_soc_data *soc_data;
|
||||||
} qcom_cpufreq;
|
} qcom_cpufreq;
|
||||||
|
|
||||||
static unsigned long cpu_hw_rate, xo_rate;
|
static unsigned long cpu_hw_rate, xo_rate;
|
||||||
|
@ -113,7 +113,7 @@ static int qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
|
||||||
unsigned int index)
|
unsigned int index)
|
||||||
{
|
{
|
||||||
struct qcom_cpufreq_data *data = policy->driver_data;
|
struct qcom_cpufreq_data *data = policy->driver_data;
|
||||||
const struct qcom_cpufreq_soc_data *soc_data = data->soc_data;
|
const struct qcom_cpufreq_soc_data *soc_data = qcom_cpufreq.soc_data;
|
||||||
unsigned long freq = policy->freq_table[index].frequency;
|
unsigned long freq = policy->freq_table[index].frequency;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
data = policy->driver_data;
|
data = policy->driver_data;
|
||||||
soc_data = data->soc_data;
|
soc_data = qcom_cpufreq.soc_data;
|
||||||
|
|
||||||
index = readl_relaxed(data->base + soc_data->reg_perf_state);
|
index = readl_relaxed(data->base + soc_data->reg_perf_state);
|
||||||
index = min(index, LUT_MAX_ENTRIES - 1);
|
index = min(index, LUT_MAX_ENTRIES - 1);
|
||||||
|
@ -153,7 +153,7 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
|
||||||
unsigned int target_freq)
|
unsigned int target_freq)
|
||||||
{
|
{
|
||||||
struct qcom_cpufreq_data *data = policy->driver_data;
|
struct qcom_cpufreq_data *data = policy->driver_data;
|
||||||
const struct qcom_cpufreq_soc_data *soc_data = data->soc_data;
|
const struct qcom_cpufreq_soc_data *soc_data = qcom_cpufreq.soc_data;
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
|
||||||
unsigned long rate;
|
unsigned long rate;
|
||||||
int ret;
|
int ret;
|
||||||
struct qcom_cpufreq_data *drv_data = policy->driver_data;
|
struct qcom_cpufreq_data *drv_data = policy->driver_data;
|
||||||
const struct qcom_cpufreq_soc_data *soc_data = drv_data->soc_data;
|
const struct qcom_cpufreq_soc_data *soc_data = qcom_cpufreq.soc_data;
|
||||||
|
|
||||||
table = kcalloc(LUT_MAX_ENTRIES + 1, sizeof(*table), GFP_KERNEL);
|
table = kcalloc(LUT_MAX_ENTRIES + 1, sizeof(*table), GFP_KERNEL);
|
||||||
if (!table)
|
if (!table)
|
||||||
|
@ -294,10 +294,10 @@ static unsigned long qcom_lmh_get_throttle_freq(struct qcom_cpufreq_data *data)
|
||||||
{
|
{
|
||||||
unsigned int lval;
|
unsigned int lval;
|
||||||
|
|
||||||
if (data->soc_data->reg_current_vote)
|
if (qcom_cpufreq.soc_data->reg_current_vote)
|
||||||
lval = readl_relaxed(data->base + data->soc_data->reg_current_vote) & 0x3ff;
|
lval = readl_relaxed(data->base + qcom_cpufreq.soc_data->reg_current_vote) & 0x3ff;
|
||||||
else
|
else
|
||||||
lval = readl_relaxed(data->base + data->soc_data->reg_domain_state) & 0xff;
|
lval = readl_relaxed(data->base + qcom_cpufreq.soc_data->reg_domain_state) & 0xff;
|
||||||
|
|
||||||
return lval * xo_rate;
|
return lval * xo_rate;
|
||||||
}
|
}
|
||||||
|
@ -371,9 +371,9 @@ static irqreturn_t qcom_lmh_dcvs_handle_irq(int irq, void *data)
|
||||||
disable_irq_nosync(c_data->throttle_irq);
|
disable_irq_nosync(c_data->throttle_irq);
|
||||||
schedule_delayed_work(&c_data->throttle_work, 0);
|
schedule_delayed_work(&c_data->throttle_work, 0);
|
||||||
|
|
||||||
if (c_data->soc_data->reg_intr_clr)
|
if (qcom_cpufreq.soc_data->reg_intr_clr)
|
||||||
writel_relaxed(GT_IRQ_STATUS,
|
writel_relaxed(GT_IRQ_STATUS,
|
||||||
c_data->base + c_data->soc_data->reg_intr_clr);
|
c_data->base + qcom_cpufreq.soc_data->reg_intr_clr);
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
@ -528,16 +528,15 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
index = args.args[0];
|
index = args.args[0];
|
||||||
data->soc_data = of_device_get_match_data(&pdev->dev);
|
|
||||||
data = &qcom_cpufreq.data[index];
|
data = &qcom_cpufreq.data[index];
|
||||||
|
|
||||||
/* HW should be in enabled state to proceed */
|
/* HW should be in enabled state to proceed */
|
||||||
if (!(readl_relaxed(data->base + data->soc_data->reg_enable) & 0x1)) {
|
if (!(readl_relaxed(data->base + qcom_cpufreq.soc_data->reg_enable) & 0x1)) {
|
||||||
dev_err(dev, "Domain-%d cpufreq hardware not enabled\n", index);
|
dev_err(dev, "Domain-%d cpufreq hardware not enabled\n", index);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (readl_relaxed(data->base + data->soc_data->reg_dcvs_ctrl) & 0x1)
|
if (readl_relaxed(data->base + qcom_cpufreq.soc_data->reg_dcvs_ctrl) & 0x1)
|
||||||
data->per_core_dcvs = true;
|
data->per_core_dcvs = true;
|
||||||
|
|
||||||
qcom_get_related_cpus(index, policy->cpus);
|
qcom_get_related_cpus(index, policy->cpus);
|
||||||
|
@ -658,6 +657,8 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
|
||||||
if (!qcom_cpufreq.data)
|
if (!qcom_cpufreq.data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
qcom_cpufreq.soc_data = of_device_get_match_data(dev);
|
||||||
|
|
||||||
for (i = 0; i < num_domains; i++) {
|
for (i = 0; i < num_domains; i++) {
|
||||||
struct qcom_cpufreq_data *data = &qcom_cpufreq.data[i];
|
struct qcom_cpufreq_data *data = &qcom_cpufreq.data[i];
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
|
Loading…
Add table
Reference in a new issue