* [PATCH 0/2] devfreq: Add sysfs node for representing frequency transition information.
@ 2012-08-16 6:49 Jonghwa Lee
2012-08-16 6:49 ` [PATCH 1/2] " Jonghwa Lee
2012-08-16 6:49 ` [PATCH 2/2] devfreq: exynos4: Support initialization of freq_table and max_state of devfreq's profile Jonghwa Lee
0 siblings, 2 replies; 8+ messages in thread
From: Jonghwa Lee @ 2012-08-16 6:49 UTC (permalink / raw)
To: linux-kernel, linux-pm
Cc: Kyungmin Park, MyungJoo Ham, Mike Turquette, Rafael J. Wysocki,
Xiaoguang Chen, Jonghwa Lee
This patchset adds sysfs node to devfreq's frame work to measure trasition of frequency on runtime.
It will be created under '/sys/class/devfreq/<device name>/' as the name of 'trans_state'.
It contains transition table which represents total number of transition of each frerquency state to
others and also time spent the state.
--- example for device having 3 frequency levels ----------------------------------------------------
<freq level #1> <freq level #2> <freq level #3> time_spent
* <freq level #1> # of freq1 to freq2 # of freq1 to freq3 t1
<freq level #2> # of freq2 to freq1 # of freq2 to freq3 t2
<freq level #3> # of freq3 to freq1 # of freq3 to freq2 t3
total transition : N
-----------------------------------------------------------------------------------------------------
('*' represents last frequency changed at the time you inspect the node.)
Patch 1: Make sysfs node to DEVFREQ frame work.
Patch 2: Initialize freq_table and max_state in exynos4 devfreq driver to be
used for frequency trnasition measurement.
Jonghwa Lee (2):
devfreq: Add sysfs node for representing frequency transition
information.
devfreq: exynos4: Support initialization of freq_table and max_state
of devfreq's profile.
drivers/devfreq/devfreq.c | 89 +++++++++++++++++++++++++++++++++++++++++
drivers/devfreq/exynos4_bus.c | 30 +++++++++++++-
include/linux/devfreq.h | 9 ++++
3 files changed, 127 insertions(+), 1 deletions(-)
--
1.7.4.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] devfreq: Add sysfs node for representing frequency transition information. 2012-08-16 6:49 [PATCH 0/2] devfreq: Add sysfs node for representing frequency transition information Jonghwa Lee @ 2012-08-16 6:49 ` Jonghwa Lee 2012-08-23 22:21 ` Rafael J. Wysocki 2012-08-16 6:49 ` [PATCH 2/2] devfreq: exynos4: Support initialization of freq_table and max_state of devfreq's profile Jonghwa Lee 1 sibling, 1 reply; 8+ messages in thread From: Jonghwa Lee @ 2012-08-16 6:49 UTC (permalink / raw) To: linux-kernel, linux-pm Cc: Kyungmin Park, MyungJoo Ham, Mike Turquette, Rafael J. Wysocki, Xiaoguang Chen, Jonghwa Lee This patch adds sysfs node which can be used to get information of frequency transition. It represents transition table which contains total number of transition of each freqeuncy state and time spent. It is inspired CPUFREQ's status driver. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> --- drivers/devfreq/devfreq.c | 89 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/devfreq.h | 9 +++++ 2 files changed, 98 insertions(+), 0 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 70c31d4..8b53eaf 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -72,6 +72,41 @@ static struct devfreq *find_device_devfreq(struct device *dev) return ERR_PTR(-ENODEV); } +int devfreq_get_freq_level(struct devfreq *devfreq, unsigned long freq) +{ + int lev; + + for (lev = 0; lev < devfreq->profile->max_state; lev++) + if (freq == devfreq->profile->freq_table[lev]) + return lev; + + return -EINVAL; +} + +int devfreq_update_status(struct devfreq *devfreq, unsigned long freq) +{ + int lev, prev_lev; + unsigned long cur_time; + + lev = devfreq_get_freq_level(devfreq, freq); + if (lev < 0) + return lev; + + cur_time = jiffies; + devfreq->time_in_state[lev] += + cur_time - devfreq->last_stat_updated; + if (freq != devfreq->previous_freq) { + prev_lev = devfreq_get_freq_level(devfreq, + devfreq->previous_freq); + devfreq->trans_table[(prev_lev * + devfreq->profile->max_state) + lev]++; + devfreq->total_trans++; + } + devfreq->last_stat_updated = cur_time; + + return 0; +} + /** * update_devfreq() - Reevaluate the device and configure frequency. * @devfreq: the devfreq instance. @@ -115,6 +150,10 @@ int update_devfreq(struct devfreq *devfreq) err = devfreq->profile->target(devfreq->dev.parent, &freq, flags); if (err) return err; + if (devfreq->profile->freq_table) + if (devfreq_update_status(devfreq, freq)) + dev_err(&devfreq->dev, + "Couldn't update frequency transition information.\n"); devfreq->previous_freq = freq; return err; @@ -390,6 +429,15 @@ struct devfreq *devfreq_add_device(struct device *dev, = msecs_to_jiffies(devfreq->profile->polling_ms); devfreq->nb.notifier_call = devfreq_notifier_call; + devfreq->trans_table = devm_kzalloc(dev, sizeof(unsigned int) * + devfreq->profile->max_state * + devfreq->profile->max_state, + GFP_KERNEL); + devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned int) * + devfreq->profile->max_state, + GFP_KERNEL); + devfreq->last_stat_updated = jiffies; + dev_set_name(&devfreq->dev, dev_name(dev)); err = device_register(&devfreq->dev); if (err) { @@ -587,6 +635,46 @@ static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr, return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq); } +static ssize_t show_trans_table(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct devfreq *devfreq = to_devfreq(dev); + ssize_t len; + int i, j, err; + + err = devfreq_update_status(devfreq, devfreq->previous_freq); + if (err) + return 0; + + len = sprintf(buf, " From : To\n"); + len += sprintf(buf + len, " :"); + for (i = 0; i < devfreq->profile->max_state; i++) + len += sprintf(buf + len, "%8u", + devfreq->profile->freq_table[i]); + + len += sprintf(buf + len, " time(ms)\n"); + + for (i = 0; i < devfreq->profile->max_state; i++) { + if (devfreq->profile->freq_table[i] + == devfreq->previous_freq) { + len += sprintf(buf + len, "*"); + } else { + len += sprintf(buf + len, " "); + } + len += sprintf(buf + len, "%8u:", + devfreq->profile->freq_table[i]); + for (j = 0; j < devfreq->profile->max_state; j++) + len += sprintf(buf + len, "%8u", + devfreq->trans_table[(i * 3) + j]); + len += sprintf(buf + len, "%10u\n", + jiffies_to_msecs(devfreq->time_in_state[i])); + } + + len += sprintf(buf + len, "Total transition : %u\n", + devfreq->total_trans); + return len; +} + static struct device_attribute devfreq_attrs[] = { __ATTR(governor, S_IRUGO, show_governor, NULL), __ATTR(cur_freq, S_IRUGO, show_freq, NULL), @@ -595,6 +683,7 @@ static struct device_attribute devfreq_attrs[] = { store_polling_interval), __ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq), __ATTR(max_freq, S_IRUGO | S_IWUSR, show_max_freq, store_max_freq), + __ATTR(trans_stat, S_IRUGO, show_trans_table, NULL), { }, }; diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 281c72a..30dc0d8 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -80,6 +80,9 @@ struct devfreq_dev_profile { int (*get_dev_status)(struct device *dev, struct devfreq_dev_status *stat); void (*exit)(struct device *dev); + + unsigned int *freq_table; + unsigned int max_state; }; /** @@ -164,6 +167,12 @@ struct devfreq { unsigned long min_freq; unsigned long max_freq; + + /* information for device freqeuncy transition */ + unsigned int total_trans; + unsigned int *trans_table; + unsigned long *time_in_state; + unsigned long last_stat_updated; }; #if defined(CONFIG_PM_DEVFREQ) -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] devfreq: Add sysfs node for representing frequency transition information. 2012-08-16 6:49 ` [PATCH 1/2] " Jonghwa Lee @ 2012-08-23 22:21 ` Rafael J. Wysocki 2012-08-24 1:23 ` jonghwa3.lee 0 siblings, 1 reply; 8+ messages in thread From: Rafael J. Wysocki @ 2012-08-23 22:21 UTC (permalink / raw) To: Jonghwa Lee Cc: linux-kernel, linux-pm, Kyungmin Park, MyungJoo Ham, Mike Turquette, Xiaoguang Chen On Thursday, August 16, 2012, Jonghwa Lee wrote: > This patch adds sysfs node which can be used to get information of frequency > transition. It represents transition table which contains total number of transition of > each freqeuncy state and time spent. It is inspired CPUFREQ's status driver. First off, please add kerneldoc comments to the new functions. It would be good to know what they are intended to do. Second, multiline files in sysfs are generally not welcome. Perhaps this should go into debugfs instead? Rafael > Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> > --- > drivers/devfreq/devfreq.c | 89 +++++++++++++++++++++++++++++++++++++++++++++ > include/linux/devfreq.h | 9 +++++ > 2 files changed, 98 insertions(+), 0 deletions(-) > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index 70c31d4..8b53eaf 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -72,6 +72,41 @@ static struct devfreq *find_device_devfreq(struct device *dev) > return ERR_PTR(-ENODEV); > } > > +int devfreq_get_freq_level(struct devfreq *devfreq, unsigned long freq) > +{ > + int lev; > + > + for (lev = 0; lev < devfreq->profile->max_state; lev++) > + if (freq == devfreq->profile->freq_table[lev]) > + return lev; > + > + return -EINVAL; > +} > + > +int devfreq_update_status(struct devfreq *devfreq, unsigned long freq) > +{ > + int lev, prev_lev; > + unsigned long cur_time; > + > + lev = devfreq_get_freq_level(devfreq, freq); > + if (lev < 0) > + return lev; > + > + cur_time = jiffies; > + devfreq->time_in_state[lev] += > + cur_time - devfreq->last_stat_updated; > + if (freq != devfreq->previous_freq) { > + prev_lev = devfreq_get_freq_level(devfreq, > + devfreq->previous_freq); > + devfreq->trans_table[(prev_lev * > + devfreq->profile->max_state) + lev]++; > + devfreq->total_trans++; > + } > + devfreq->last_stat_updated = cur_time; > + > + return 0; > +} > + > /** > * update_devfreq() - Reevaluate the device and configure frequency. > * @devfreq: the devfreq instance. > @@ -115,6 +150,10 @@ int update_devfreq(struct devfreq *devfreq) > err = devfreq->profile->target(devfreq->dev.parent, &freq, flags); > if (err) > return err; > + if (devfreq->profile->freq_table) > + if (devfreq_update_status(devfreq, freq)) > + dev_err(&devfreq->dev, > + "Couldn't update frequency transition information.\n"); > > devfreq->previous_freq = freq; > return err; > @@ -390,6 +429,15 @@ struct devfreq *devfreq_add_device(struct device *dev, > = msecs_to_jiffies(devfreq->profile->polling_ms); > devfreq->nb.notifier_call = devfreq_notifier_call; > > + devfreq->trans_table = devm_kzalloc(dev, sizeof(unsigned int) * > + devfreq->profile->max_state * > + devfreq->profile->max_state, > + GFP_KERNEL); > + devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned int) * > + devfreq->profile->max_state, > + GFP_KERNEL); > + devfreq->last_stat_updated = jiffies; > + > dev_set_name(&devfreq->dev, dev_name(dev)); > err = device_register(&devfreq->dev); > if (err) { > @@ -587,6 +635,46 @@ static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr, > return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq); > } > > +static ssize_t show_trans_table(struct device *dev, struct device_attribute *attr, > + char *buf) > +{ > + struct devfreq *devfreq = to_devfreq(dev); > + ssize_t len; > + int i, j, err; > + > + err = devfreq_update_status(devfreq, devfreq->previous_freq); > + if (err) > + return 0; > + > + len = sprintf(buf, " From : To\n"); > + len += sprintf(buf + len, " :"); > + for (i = 0; i < devfreq->profile->max_state; i++) > + len += sprintf(buf + len, "%8u", > + devfreq->profile->freq_table[i]); > + > + len += sprintf(buf + len, " time(ms)\n"); > + > + for (i = 0; i < devfreq->profile->max_state; i++) { > + if (devfreq->profile->freq_table[i] > + == devfreq->previous_freq) { > + len += sprintf(buf + len, "*"); > + } else { > + len += sprintf(buf + len, " "); > + } > + len += sprintf(buf + len, "%8u:", > + devfreq->profile->freq_table[i]); > + for (j = 0; j < devfreq->profile->max_state; j++) > + len += sprintf(buf + len, "%8u", > + devfreq->trans_table[(i * 3) + j]); > + len += sprintf(buf + len, "%10u\n", > + jiffies_to_msecs(devfreq->time_in_state[i])); > + } > + > + len += sprintf(buf + len, "Total transition : %u\n", > + devfreq->total_trans); > + return len; > +} > + > static struct device_attribute devfreq_attrs[] = { > __ATTR(governor, S_IRUGO, show_governor, NULL), > __ATTR(cur_freq, S_IRUGO, show_freq, NULL), > @@ -595,6 +683,7 @@ static struct device_attribute devfreq_attrs[] = { > store_polling_interval), > __ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq), > __ATTR(max_freq, S_IRUGO | S_IWUSR, show_max_freq, store_max_freq), > + __ATTR(trans_stat, S_IRUGO, show_trans_table, NULL), > { }, > }; > > diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h > index 281c72a..30dc0d8 100644 > --- a/include/linux/devfreq.h > +++ b/include/linux/devfreq.h > @@ -80,6 +80,9 @@ struct devfreq_dev_profile { > int (*get_dev_status)(struct device *dev, > struct devfreq_dev_status *stat); > void (*exit)(struct device *dev); > + > + unsigned int *freq_table; > + unsigned int max_state; > }; > > /** > @@ -164,6 +167,12 @@ struct devfreq { > > unsigned long min_freq; > unsigned long max_freq; > + > + /* information for device freqeuncy transition */ > + unsigned int total_trans; > + unsigned int *trans_table; > + unsigned long *time_in_state; > + unsigned long last_stat_updated; > }; > > #if defined(CONFIG_PM_DEVFREQ) > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] devfreq: Add sysfs node for representing frequency transition information. 2012-08-23 22:21 ` Rafael J. Wysocki @ 2012-08-24 1:23 ` jonghwa3.lee 0 siblings, 0 replies; 8+ messages in thread From: jonghwa3.lee @ 2012-08-24 1:23 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Jonghwa Lee, linux-kernel, linux-pm, Kyungmin Park, MyungJoo Ham, Mike Turquette, Xiaoguang Chen Hi, Rafael. On 2012년 08월 24일 07:21, Rafael J. Wysocki wrote: > On Thursday, August 16, 2012, Jonghwa Lee wrote: >> This patch adds sysfs node which can be used to get information of frequency >> transition. It represents transition table which contains total number of transition of >> each freqeuncy state and time spent. It is inspired CPUFREQ's status driver. > First off, please add kerneldoc comments to the new functions. > It would be good to know what they are intended to do. Okay, I'll add document for describing what it'll be used to . > Second, multiline files in sysfs are generally not welcome. Perhaps this > should go into debugfs instead? > > Rafael Yes, you're right. I didn't know the sysfs constraints until I checked debugfs kerneldoc. I'll update it either. > >> Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> >> --- >> drivers/devfreq/devfreq.c | 89 +++++++++++++++++++++++++++++++++++++++++++++ >> include/linux/devfreq.h | 9 +++++ >> 2 files changed, 98 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c >> index 70c31d4..8b53eaf 100644 >> --- a/drivers/devfreq/devfreq.c >> +++ b/drivers/devfreq/devfreq.c >> @@ -72,6 +72,41 @@ static struct devfreq *find_device_devfreq(struct device *dev) >> return ERR_PTR(-ENODEV); >> } >> >> +int devfreq_get_freq_level(struct devfreq *devfreq, unsigned long freq) >> +{ >> + int lev; >> + >> + for (lev = 0; lev < devfreq->profile->max_state; lev++) >> + if (freq == devfreq->profile->freq_table[lev]) >> + return lev; >> + >> + return -EINVAL; >> +} >> + >> +int devfreq_update_status(struct devfreq *devfreq, unsigned long freq) >> +{ >> + int lev, prev_lev; >> + unsigned long cur_time; >> + >> + lev = devfreq_get_freq_level(devfreq, freq); >> + if (lev < 0) >> + return lev; >> + >> + cur_time = jiffies; >> + devfreq->time_in_state[lev] += >> + cur_time - devfreq->last_stat_updated; >> + if (freq != devfreq->previous_freq) { >> + prev_lev = devfreq_get_freq_level(devfreq, >> + devfreq->previous_freq); >> + devfreq->trans_table[(prev_lev * >> + devfreq->profile->max_state) + lev]++; >> + devfreq->total_trans++; >> + } >> + devfreq->last_stat_updated = cur_time; >> + >> + return 0; >> +} >> + >> /** >> * update_devfreq() - Reevaluate the device and configure frequency. >> * @devfreq: the devfreq instance. >> @@ -115,6 +150,10 @@ int update_devfreq(struct devfreq *devfreq) >> err = devfreq->profile->target(devfreq->dev.parent, &freq, flags); >> if (err) >> return err; >> + if (devfreq->profile->freq_table) >> + if (devfreq_update_status(devfreq, freq)) >> + dev_err(&devfreq->dev, >> + "Couldn't update frequency transition information.\n"); >> >> devfreq->previous_freq = freq; >> return err; >> @@ -390,6 +429,15 @@ struct devfreq *devfreq_add_device(struct device *dev, >> = msecs_to_jiffies(devfreq->profile->polling_ms); >> devfreq->nb.notifier_call = devfreq_notifier_call; >> >> + devfreq->trans_table = devm_kzalloc(dev, sizeof(unsigned int) * >> + devfreq->profile->max_state * >> + devfreq->profile->max_state, >> + GFP_KERNEL); >> + devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned int) * >> + devfreq->profile->max_state, >> + GFP_KERNEL); >> + devfreq->last_stat_updated = jiffies; >> + >> dev_set_name(&devfreq->dev, dev_name(dev)); >> err = device_register(&devfreq->dev); >> if (err) { >> @@ -587,6 +635,46 @@ static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr, >> return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq); >> } >> >> +static ssize_t show_trans_table(struct device *dev, struct device_attribute *attr, >> + char *buf) >> +{ >> + struct devfreq *devfreq = to_devfreq(dev); >> + ssize_t len; >> + int i, j, err; >> + >> + err = devfreq_update_status(devfreq, devfreq->previous_freq); >> + if (err) >> + return 0; >> + >> + len = sprintf(buf, " From : To\n"); >> + len += sprintf(buf + len, " :"); >> + for (i = 0; i < devfreq->profile->max_state; i++) >> + len += sprintf(buf + len, "%8u", >> + devfreq->profile->freq_table[i]); >> + >> + len += sprintf(buf + len, " time(ms)\n"); >> + >> + for (i = 0; i < devfreq->profile->max_state; i++) { >> + if (devfreq->profile->freq_table[i] >> + == devfreq->previous_freq) { >> + len += sprintf(buf + len, "*"); >> + } else { >> + len += sprintf(buf + len, " "); >> + } >> + len += sprintf(buf + len, "%8u:", >> + devfreq->profile->freq_table[i]); >> + for (j = 0; j < devfreq->profile->max_state; j++) >> + len += sprintf(buf + len, "%8u", >> + devfreq->trans_table[(i * 3) + j]); >> + len += sprintf(buf + len, "%10u\n", >> + jiffies_to_msecs(devfreq->time_in_state[i])); >> + } >> + >> + len += sprintf(buf + len, "Total transition : %u\n", >> + devfreq->total_trans); >> + return len; >> +} >> + >> static struct device_attribute devfreq_attrs[] = { >> __ATTR(governor, S_IRUGO, show_governor, NULL), >> __ATTR(cur_freq, S_IRUGO, show_freq, NULL), >> @@ -595,6 +683,7 @@ static struct device_attribute devfreq_attrs[] = { >> store_polling_interval), >> __ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq), >> __ATTR(max_freq, S_IRUGO | S_IWUSR, show_max_freq, store_max_freq), >> + __ATTR(trans_stat, S_IRUGO, show_trans_table, NULL), >> { }, >> }; >> >> diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h >> index 281c72a..30dc0d8 100644 >> --- a/include/linux/devfreq.h >> +++ b/include/linux/devfreq.h >> @@ -80,6 +80,9 @@ struct devfreq_dev_profile { >> int (*get_dev_status)(struct device *dev, >> struct devfreq_dev_status *stat); >> void (*exit)(struct device *dev); >> + >> + unsigned int *freq_table; >> + unsigned int max_state; >> }; >> >> /** >> @@ -164,6 +167,12 @@ struct devfreq { >> >> unsigned long min_freq; >> unsigned long max_freq; >> + >> + /* information for device freqeuncy transition */ >> + unsigned int total_trans; >> + unsigned int *trans_table; >> + unsigned long *time_in_state; >> + unsigned long last_stat_updated; >> }; >> >> #if defined(CONFIG_PM_DEVFREQ) >> > -- > To unsubscribe from this list: send the line "unsubscribe linux-pm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] devfreq: exynos4: Support initialization of freq_table and max_state of devfreq's profile. 2012-08-16 6:49 [PATCH 0/2] devfreq: Add sysfs node for representing frequency transition information Jonghwa Lee 2012-08-16 6:49 ` [PATCH 1/2] " Jonghwa Lee @ 2012-08-16 6:49 ` Jonghwa Lee 2012-08-23 22:22 ` Rafael J. Wysocki 1 sibling, 1 reply; 8+ messages in thread From: Jonghwa Lee @ 2012-08-16 6:49 UTC (permalink / raw) To: linux-kernel, linux-pm Cc: Kyungmin Park, MyungJoo Ham, Mike Turquette, Rafael J. Wysocki, Xiaoguang Chen, Jonghwa Lee This patch initializes freq_table and max_state of devfreq's profile. They will be used for creating transition table. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> --- drivers/devfreq/exynos4_bus.c | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/drivers/devfreq/exynos4_bus.c b/drivers/devfreq/exynos4_bus.c index 88ddc77..9c08855 100644 --- a/drivers/devfreq/exynos4_bus.c +++ b/drivers/devfreq/exynos4_bus.c @@ -985,7 +985,8 @@ static __devinit int exynos4_busfreq_probe(struct platform_device *pdev) struct busfreq_data *data; struct opp *opp; struct device *dev = &pdev->dev; - int err = 0; + int err = 0, i; + unsigned int *freq_table; data = kzalloc(sizeof(struct busfreq_data), GFP_KERNEL); if (data == NULL) { @@ -1042,6 +1043,33 @@ static __devinit int exynos4_busfreq_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); + switch (data->type) { + case TYPE_BUSF_EXYNOS4210: + freq_table = devm_kzalloc(&pdev->dev, sizeof(unsigned int) * EX4210_LV_NUM, + GFP_KERNEL); + + for (i = 0; i < EX4210_LV_NUM; i++) + freq_table[i] = exynos4210_busclk_table[i].clk; + + exynos4_devfreq_profile.max_state = EX4210_LV_NUM; + break; + case TYPE_BUSF_EXYNOS4x12: + freq_table = devm_kzalloc(&pdev->dev, sizeof(unsigned int) * EX4x12_LV_NUM, + GFP_KERNEL); + + for (i = 0; i < EX4x12_LV_NUM; i++) + freq_table[i] = exynos4x12_mifclk_table[i].clk; + + exynos4_devfreq_profile.max_state = EX4x12_LV_NUM; + break; + default: + dev_err(dev, "Cannot determine the device id %d\n", data->type); + err = -EINVAL; + goto err_opp_add; + } + + exynos4_devfreq_profile.freq_table = freq_table; + busfreq_mon_reset(data); data->devfreq = devfreq_add_device(dev, &exynos4_devfreq_profile, -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] devfreq: exynos4: Support initialization of freq_table and max_state of devfreq's profile. 2012-08-16 6:49 ` [PATCH 2/2] devfreq: exynos4: Support initialization of freq_table and max_state of devfreq's profile Jonghwa Lee @ 2012-08-23 22:22 ` Rafael J. Wysocki 2012-08-24 1:28 ` jonghwa3.lee 0 siblings, 1 reply; 8+ messages in thread From: Rafael J. Wysocki @ 2012-08-23 22:22 UTC (permalink / raw) To: Jonghwa Lee Cc: linux-kernel, linux-pm, Kyungmin Park, MyungJoo Ham, Mike Turquette, Xiaoguang Chen On Thursday, August 16, 2012, Jonghwa Lee wrote: > This patch initializes freq_table and max_state of devfreq's profile. > They will be used for creating transition table. > > Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Does that depend on [1/2]? Rafael > --- > drivers/devfreq/exynos4_bus.c | 30 +++++++++++++++++++++++++++++- > 1 files changed, 29 insertions(+), 1 deletions(-) > > diff --git a/drivers/devfreq/exynos4_bus.c b/drivers/devfreq/exynos4_bus.c > index 88ddc77..9c08855 100644 > --- a/drivers/devfreq/exynos4_bus.c > +++ b/drivers/devfreq/exynos4_bus.c > @@ -985,7 +985,8 @@ static __devinit int exynos4_busfreq_probe(struct platform_device *pdev) > struct busfreq_data *data; > struct opp *opp; > struct device *dev = &pdev->dev; > - int err = 0; > + int err = 0, i; > + unsigned int *freq_table; > > data = kzalloc(sizeof(struct busfreq_data), GFP_KERNEL); > if (data == NULL) { > @@ -1042,6 +1043,33 @@ static __devinit int exynos4_busfreq_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, data); > > + switch (data->type) { > + case TYPE_BUSF_EXYNOS4210: > + freq_table = devm_kzalloc(&pdev->dev, sizeof(unsigned int) * EX4210_LV_NUM, > + GFP_KERNEL); > + > + for (i = 0; i < EX4210_LV_NUM; i++) > + freq_table[i] = exynos4210_busclk_table[i].clk; > + > + exynos4_devfreq_profile.max_state = EX4210_LV_NUM; > + break; > + case TYPE_BUSF_EXYNOS4x12: > + freq_table = devm_kzalloc(&pdev->dev, sizeof(unsigned int) * EX4x12_LV_NUM, > + GFP_KERNEL); > + > + for (i = 0; i < EX4x12_LV_NUM; i++) > + freq_table[i] = exynos4x12_mifclk_table[i].clk; > + > + exynos4_devfreq_profile.max_state = EX4x12_LV_NUM; > + break; > + default: > + dev_err(dev, "Cannot determine the device id %d\n", data->type); > + err = -EINVAL; > + goto err_opp_add; > + } > + > + exynos4_devfreq_profile.freq_table = freq_table; > + > busfreq_mon_reset(data); > > data->devfreq = devfreq_add_device(dev, &exynos4_devfreq_profile, > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] devfreq: exynos4: Support initialization of freq_table and max_state of devfreq's profile. 2012-08-23 22:22 ` Rafael J. Wysocki @ 2012-08-24 1:28 ` jonghwa3.lee 0 siblings, 0 replies; 8+ messages in thread From: jonghwa3.lee @ 2012-08-24 1:28 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Jonghwa Lee, linux-kernel, linux-pm, Kyungmin Park, MyungJoo Ham, Mike Turquette, Xiaoguang Chen On 2012년 08월 24일 07:22, Rafael J. Wysocki wrote: > On Thursday, August 16, 2012, Jonghwa Lee wrote: >> This patch initializes freq_table and max_state of devfreq's profile. >> They will be used for creating transition table. >> >> Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> > Does that depend on [1/2]? > > Rafael Not exactly, but it shows that required procedure for using function included in patch[1/2]. Thanks. > >> --- >> drivers/devfreq/exynos4_bus.c | 30 +++++++++++++++++++++++++++++- >> 1 files changed, 29 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/devfreq/exynos4_bus.c b/drivers/devfreq/exynos4_bus.c >> index 88ddc77..9c08855 100644 >> --- a/drivers/devfreq/exynos4_bus.c >> +++ b/drivers/devfreq/exynos4_bus.c >> @@ -985,7 +985,8 @@ static __devinit int exynos4_busfreq_probe(struct platform_device *pdev) >> struct busfreq_data *data; >> struct opp *opp; >> struct device *dev = &pdev->dev; >> - int err = 0; >> + int err = 0, i; >> + unsigned int *freq_table; >> >> data = kzalloc(sizeof(struct busfreq_data), GFP_KERNEL); >> if (data == NULL) { >> @@ -1042,6 +1043,33 @@ static __devinit int exynos4_busfreq_probe(struct platform_device *pdev) >> >> platform_set_drvdata(pdev, data); >> >> + switch (data->type) { >> + case TYPE_BUSF_EXYNOS4210: >> + freq_table = devm_kzalloc(&pdev->dev, sizeof(unsigned int) * EX4210_LV_NUM, >> + GFP_KERNEL); >> + >> + for (i = 0; i < EX4210_LV_NUM; i++) >> + freq_table[i] = exynos4210_busclk_table[i].clk; >> + >> + exynos4_devfreq_profile.max_state = EX4210_LV_NUM; >> + break; >> + case TYPE_BUSF_EXYNOS4x12: >> + freq_table = devm_kzalloc(&pdev->dev, sizeof(unsigned int) * EX4x12_LV_NUM, >> + GFP_KERNEL); >> + >> + for (i = 0; i < EX4x12_LV_NUM; i++) >> + freq_table[i] = exynos4x12_mifclk_table[i].clk; >> + >> + exynos4_devfreq_profile.max_state = EX4x12_LV_NUM; >> + break; >> + default: >> + dev_err(dev, "Cannot determine the device id %d\n", data->type); >> + err = -EINVAL; >> + goto err_opp_add; >> + } >> + >> + exynos4_devfreq_profile.freq_table = freq_table; >> + >> busfreq_mon_reset(data); >> >> data->devfreq = devfreq_add_device(dev, &exynos4_devfreq_profile, >> > -- > To unsubscribe from this list: send the line "unsubscribe linux-pm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] devfreq: exynos4: Support initialization of freq_table and max_state of devfreq's profile. @ 2012-08-23 10:44 MyungJoo Ham 0 siblings, 0 replies; 8+ messages in thread From: MyungJoo Ham @ 2012-08-23 10:44 UTC (permalink / raw) To: 이종화, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: 박경민, Mike Turquette, Rafael J. Wysocki, Xiaoguang Chen [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 2189 bytes --] > This patch initializes freq_table and max_state of devfreq's profile. > They will be used for creating transition table. > > Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> > --- > drivers/devfreq/exynos4_bus.c | 30 +++++++++++++++++++++++++++++- > 1 files changed, 29 insertions(+), 1 deletions(-) > > diff --git a/drivers/devfreq/exynos4_bus.c b/drivers/devfreq/exynos4_bus.c > index 88ddc77..9c08855 100644 > --- a/drivers/devfreq/exynos4_bus.c > +++ b/drivers/devfreq/exynos4_bus.c > @@ -985,7 +985,8 @@ static __devinit int exynos4_busfreq_probe(struct platform_device *pdev) > struct busfreq_data *data; > struct opp *opp; > struct device *dev = &pdev->dev; > - int err = 0; > + int err = 0, i; > + unsigned int *freq_table; > > data = kzalloc(sizeof(struct busfreq_data), GFP_KERNEL); > if (data == NULL) { > @@ -1042,6 +1043,33 @@ static __devinit int exynos4_busfreq_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, data); > > + switch (data->type) { > + case TYPE_BUSF_EXYNOS4210: > + freq_table = devm_kzalloc(&pdev->dev, sizeof(unsigned int) * EX4210_LV_NUM, > + GFP_KERNEL); > + > + for (i = 0; i < EX4210_LV_NUM; i++) > + freq_table[i] = exynos4210_busclk_table[i].clk; > + > + exynos4_devfreq_profile.max_state = EX4210_LV_NUM; > + break; > + case TYPE_BUSF_EXYNOS4x12: > + freq_table = devm_kzalloc(&pdev->dev, sizeof(unsigned int) * EX4x12_LV_NUM, > + GFP_KERNEL); > + > + for (i = 0; i < EX4x12_LV_NUM; i++) > + freq_table[i] = exynos4x12_mifclk_table[i].clk; > + > + exynos4_devfreq_profile.max_state = EX4x12_LV_NUM; > + break; > + default: > + dev_err(dev, "Cannot determine the device id %d\n", data->type); > + err = -EINVAL; > + goto err_opp_add; > + } > + > + exynos4_devfreq_profile.freq_table = freq_table; > + > busfreq_mon_reset(data); > > data->devfreq = devfreq_add_device(dev, &exynos4_devfreq_profile, > -- > 1.7.4.1 > > > > > > > > ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥ ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-08-24 1:28 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-08-16 6:49 [PATCH 0/2] devfreq: Add sysfs node for representing frequency transition information Jonghwa Lee 2012-08-16 6:49 ` [PATCH 1/2] " Jonghwa Lee 2012-08-23 22:21 ` Rafael J. Wysocki 2012-08-24 1:23 ` jonghwa3.lee 2012-08-16 6:49 ` [PATCH 2/2] devfreq: exynos4: Support initialization of freq_table and max_state of devfreq's profile Jonghwa Lee 2012-08-23 22:22 ` Rafael J. Wysocki 2012-08-24 1:28 ` jonghwa3.lee -- strict thread matches above, loose matches on Subject: below -- 2012-08-23 10:44 MyungJoo Ham
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox