platform/kernel/linux-exynos.git
6 years agoPM / devfreq: exynos-ppmu: Staticize event list
Krzysztof Kozlowski [Wed, 7 Jun 2017 18:12:28 +0000 (20:12 +0200)]
PM / devfreq: exynos-ppmu: Staticize event list

The ppmu_events array is accessed only in this compilation unit so it
can be made static.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos-nocp: Handle return value of clk_prepare_enable
Arvind Yadav [Fri, 19 May 2017 10:50:35 +0000 (16:20 +0530)]
PM / devfreq: exynos-nocp: Handle return value of clk_prepare_enable

clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Move struct devfreq_governor to devfreq directory
Chanwoo Choi [Thu, 6 Apr 2017 04:19:35 +0000 (13:19 +0900)]
PM / devfreq: Move struct devfreq_governor to devfreq directory

This patch moves the struct devfreq_governor from header file
to the devfreq directory because this structure is private data
and it have to be only accessed by the devfreq core.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Modify the device name as devfreq(X) for sysfs
Chanwoo Choi [Tue, 31 Jan 2017 07:47:57 +0000 (16:47 +0900)]
PM / devfreq: Modify the device name as devfreq(X) for sysfs

This patch modifies the device name as devfreq(X) for sysfs by using the 'devfreq'
prefix word instead of separate device name. On user-space aspect, user would
find the some devfreq drvier with 'devfreq(X)' pattern. So, this patch modify the
device name as following:
- /sys/class/devfreq/[non-standard device name] -> /sys/class/devfreq/devfreq(X)

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Simplify the sysfs name of devfreq-event device
Chanwoo Choi [Tue, 31 Jan 2017 07:47:56 +0000 (16:47 +0900)]
PM / devfreq: Simplify the sysfs name of devfreq-event device

This patch just removes '.' character from the sysfs name of devfreq-event
device as following. Usually, the subsystem uses the similiar naming style
such as {framework name}{Number}.
- old : /sys/class/devfreq-event/event.(X)
- new : /sys/class/devfreq-event/event(X)

And this patch initializes the value of 'event_no' with -1
in order to remove the unneeded operation (-1) when calling
the atomic_inc_return(&event_no).

Lastly, this patch adds the ABI document for devfreq-event class.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Remove unnecessary separate _remove_devfreq()
Chanwoo Choi [Tue, 31 Jan 2017 06:38:18 +0000 (15:38 +0900)]
PM / devfreq: Remove unnecessary separate _remove_devfreq()

The _remove_devfreq() releases the all resources of the devfreq
device. This function is only called in the devfreq_dev_release().
For that reason, the devfreq core doesn't need to leave the
_remove_devfreq() separately. This patch releases the all
resources in the devfreq_dev_release() and then removes the
_remove_devfreq().

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Fix wrong trans_stat of passive devfreq device
Chanwoo Choi [Tue, 31 Jan 2017 06:38:17 +0000 (15:38 +0900)]
PM / devfreq: Fix wrong trans_stat of passive devfreq device

Until now, the trans_stat information of passive devfreq is not updated.
This patch updates the trans_stat information after setting the target
frequency of passive devfreq device.

Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
Cc: stable@vger.kernel.org
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Fix available_governor sysfs
Chanwoo Choi [Tue, 31 Jan 2017 06:38:16 +0000 (15:38 +0900)]
PM / devfreq: Fix available_governor sysfs

The devfreq using passive governor is not able to change the governor.
So, the user can not change the governor through 'available_governor' sysfs
entry. Also, the devfreq which don't use the passive governor is not able to
change to 'passive' governor on the fly.

Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
Cc: stable@vger.kernel.org
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos-ppmu: Show the registred device for ppmu device
Chanwoo Choi [Mon, 16 Jan 2017 12:26:05 +0000 (21:26 +0900)]
PM / devfreq: exynos-ppmu: Show the registred device for ppmu device

This patch just adds the simple log to show the PPMU device's registration
during the kernel booting.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Javier Martinez Canillas <javier@osg.samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Fix the wrong description for userspace governor
Chanwoo Choi [Mon, 16 Jan 2017 12:26:04 +0000 (21:26 +0900)]
PM / devfreq: Fix the wrong description for userspace governor

This patch fixes the wrong description of governor_userspace.c
and removes the unneeded blank line.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Fix the checkpatch warnings
Chanwoo Choi [Sat, 19 Nov 2016 13:47:36 +0000 (22:47 +0900)]
PM / devfreq: Fix the checkpatch warnings

This patch just fixes the checkpatch warnings.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos-bus: Print the real clock rate of bus
Chanwoo Choi [Thu, 1 Dec 2016 10:42:17 +0000 (19:42 +0900)]
PM / devfreq: exynos-bus: Print the real clock rate of bus

This patch shows the real clock rate after calling clk_set_rate()
to debug it.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Don't delete sysfs group twice
Chris Diamand [Thu, 12 Jan 2017 14:57:41 +0000 (14:57 +0000)]
PM / devfreq: Don't delete sysfs group twice

The 'userspace' governor adds a sysfs entry, which is removed when
the governor is changed, or the devfreq device is released. However,
when the latter occurs via device_unregister(), device_del() is
called first, which removes the sysfs entries recursively and deletes
the kobject.

This means we get an Oops when the governor calls
sysfs_remove_group() on the deleted kobject. Fix this by only doing
the call when kobj *hasn't* been kobject_del()'d.

Note that we can't just remove the call to sysfs_remove_group()
entirely - it's needed for when the governor is changed to one which
doesn't need a sysfs entry.

Signed-off-by: Chris Diamand <chris.diamand@arm.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos-bus: Fix the wrong return value
Chanwoo Choi [Wed, 28 Dec 2016 11:52:36 +0000 (20:52 +0900)]
PM / devfreq: exynos-bus: Fix the wrong return value

This patch fixes the wrong return value. If devfreq driver requires the wrong
and non-available governor, it is fail. So, this patch returns the error
insead of -EPROBE_DEFER.

Fixes: 403e0689d2a9 (PM / devfreq: exynos: Add support of bus frequency of sub-blocks using passive governor)
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / devfreq: Fix the bug of devfreq_add_device when governor is NULL
Chanwoo Choi [Wed, 28 Dec 2016 11:52:35 +0000 (20:52 +0900)]
PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL

This patch fixes the bug of devfreq_add_device(). The devfreq device must
have the default governor. If find_devfreq_governor() returns error,
devfreq_add_device() fail to add the devfreq instance.

Fixes: 1b5c1be2c88e (PM / devfreq: map devfreq drivers to governor using name)
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agodevfreq: exynos: Don't use OPP structures outside of RCU locks
Viresh Kumar [Thu, 1 Dec 2016 10:25:40 +0000 (15:55 +0530)]
devfreq: exynos: Don't use OPP structures outside of RCU locks

The OPP structures are abused to the best here, without understanding
how the OPP core and RCU locks work.

In short, the OPP pointer saved 'struct exynos_bus' can become invalid
under your nose, as the OPP core may free it.

Fix various abuses around OPP structures and calls.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / devfreq: correct comment typo.
MyungJoo Ham [Wed, 9 Nov 2016 01:29:14 +0000 (10:29 +0900)]
PM / devfreq: correct comment typo.

The function name in the comment was incorrect.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoPM / devfreq: exynos-ppmu: Remove unused mutex from struct exynos_ppmu
Axel Lin [Fri, 21 Oct 2016 01:09:09 +0000 (09:09 +0800)]
PM / devfreq: exynos-ppmu: Remove unused mutex from struct exynos_ppmu

The mutex is not used at all, remove it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos-ppmu: ppmu_events array should not be NULL terminated
Axel Lin [Fri, 21 Oct 2016 01:09:08 +0000 (09:09 +0800)]
PM / devfreq: exynos-ppmu: ppmu_events array should not be NULL terminated

The rest of the code uses ARRAY_SIZE to count the number of entries in
ppmu_events array. The NULL terminated entry makes ARRAY_SIZE return
off-by-one value.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos-ppmu: Fix module autoload
Javier Martinez Canillas [Wed, 19 Oct 2016 21:06:27 +0000 (18:06 -0300)]
PM / devfreq: exynos-ppmu: Fix module autoload

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/devfreq/event/exynos-ppmu.ko | grep alias
$

After this patch:

$ modinfo drivers/devfreq/event/exynos-ppmu.ko | grep alias
alias:          of:N*T*Csamsung,exynos-ppmu-v2C*
alias:          of:N*T*Csamsung,exynos-ppmu-v2
alias:          of:N*T*Csamsung,exynos-ppmuC*
alias:          of:N*T*Csamsung,exynos-ppmu

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos-nocp: Fix module autoload
Javier Martinez Canillas [Wed, 19 Oct 2016 21:06:25 +0000 (18:06 -0300)]
PM / devfreq: exynos-nocp: Fix module autoload

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/devfreq/event/exynos-nocp.ko | grep alias
$

After this patch:

$ modinfo drivers/devfreq/event/exynos-nocp.ko | grep alias
alias:          of:N*T*Csamsung,exynos5420-nocpC*
alias:          of:N*T*Csamsung,exynos5420-nocp

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Skip status update on uninitialized previous_freq
Tobias Jakobi [Thu, 29 Sep 2016 12:36:36 +0000 (14:36 +0200)]
PM / devfreq: Skip status update on uninitialized previous_freq

In case devfreq->previous_freq is still uninitialized in
devfreq_update_status(), i.e. it has value '0', the lookups in
that function fail, eventually leading to some error message:
[    3.041292] devfreq bus_dmc: Couldn't update frequency transition information.

Just skip the statup update in this situation.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / devfreq: Add proper locking around list_del()
Axel Lin [Thu, 29 Sep 2016 02:13:28 +0000 (10:13 +0800)]
PM / devfreq: Add proper locking around list_del()

Use devfreq_list_lock around list_del() to prevent list corruption.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / devfreq: exynos-nocp: Remove redundant code
Axel Lin [Sun, 25 Sep 2016 12:13:58 +0000 (20:13 +0800)]
PM / devfreq: exynos-nocp: Remove redundant code

load_count/total_count are reset by devfreq_event_get_event(), so
remove the redundant code in exynos_nocp_get_event().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
[ rjw: Subject/changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / devfreq: exynos-nocp: Select REGMAP_MMIO
Axel Lin [Sun, 25 Sep 2016 12:13:57 +0000 (20:13 +0800)]
PM / devfreq: exynos-nocp: Select REGMAP_MMIO

This driver uses devm_regmap_init_mmio(), so select REGMAP_MMIO to avoid
build failure.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / devfreq: Add COMPILE_TEST for build coverage
Krzysztof Kozlowski [Fri, 19 Aug 2016 06:36:55 +0000 (08:36 +0200)]
PM / devfreq: Add COMPILE_TEST for build coverage

The SoC-specific devfreq and devfreq-event drivers can be build tested
on all architectures.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos-ppmu: remove unneeded of_node_put()
Wei Yongjun [Fri, 8 Jul 2016 13:44:04 +0000 (13:44 +0000)]
PM / devfreq: exynos-ppmu: remove unneeded of_node_put()

for_each_child_of_node() performs an of_node_put() on each iteration, so
putting an of_node_put() before a continue results in a double put.

Generated by: scripts/coccinelle/iterators/device_node_continue.cocci

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos-bus: add missing of_node_put after calling of_parse_phandle
Peter Chen [Fri, 1 Jul 2016 09:42:01 +0000 (17:42 +0800)]
PM / devfreq: exynos-bus: add missing of_node_put after calling of_parse_phandle

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

[Commit updated to fix an error by MyungJoo]

Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: add missing of_node_put after calling of_parse_phandle
Peter Chen [Fri, 1 Jul 2016 09:42:00 +0000 (17:42 +0800)]
PM / devfreq: add missing of_node_put after calling of_parse_phandle

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos-ppmu: fix error path in exynos_ppmu_probe()
Bartlomiej Zolnierkiewicz [Tue, 28 Jun 2016 11:21:08 +0000 (20:21 +0900)]
PM / devfreq: exynos-ppmu: fix error path in exynos_ppmu_probe()

iounmap() needs to be called in case of memory allocation
(for devfreq-event devices) failure.  Fix it.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos: fix error path in exynos_bus_probe()
Bartlomiej Zolnierkiewicz [Tue, 28 Jun 2016 11:21:09 +0000 (13:21 +0200)]
PM / devfreq: exynos: fix error path in exynos_bus_probe()

In case of exynos_bus_parse_of() failure the code shouldn't
try to remove the OPP table and disable+unprepare bus->clk
as it has been already handled in exynos_bus_parse_of().

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: make event/exynos-ppmu DEVFREQ_EVENT_EXYNOS_PPMU tristate
Paul Gortmaker [Sat, 25 Jun 2016 18:43:51 +0000 (03:43 +0900)]
PM / devfreq: make event/exynos-ppmu DEVFREQ_EVENT_EXYNOS_PPMU tristate

The Kconfig currently controlling compilation of this code is:

config DEVFREQ_EVENT_EXYNOS_PPMU
  bool "EXYNOS PPMU (Platform Performance Monitoring Unit) DEVFREQ event Driver"

...meaning that it currently is not being built as a module by anyone.

Rather than rip out the existing modular code, Chanwoo indicated
that he'd rather see the driver offered as tristate.

I don't have the hardware for runtime validation, so this change
is only validated for compile and modpost.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: make event/exynos-nocp DEVFREQ_EVENT_EXYNOS_NOCP tristate
Paul Gortmaker [Sat, 25 Jun 2016 18:43:50 +0000 (14:43 -0400)]
PM / devfreq: make event/exynos-nocp DEVFREQ_EVENT_EXYNOS_NOCP tristate

The Kconfig currently controlling compilation of this code is:

event/Kconfig:config DEVFREQ_EVENT_EXYNOS_NOCP
event/Kconfig:  bool "EXYNOS NoC (Network On Chip) Probe DEVFREQ event Driver"

...meaning that it currently is not being built as a module by anyone.

Rather than rip out the existing modular code, Chanwoo indicated
that he'd rather see the driver offered as tristate.

I don't have the hardware for runtime validation, so this change
is only validated for compile and modpost.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: make exynos-bus ARM_EXYNOS_BUS_DEVFREQ tristate
Paul Gortmaker [Sat, 25 Jun 2016 18:43:49 +0000 (03:43 +0900)]
PM / devfreq: make exynos-bus ARM_EXYNOS_BUS_DEVFREQ tristate

The Kconfig currently controlling compilation of this code is:

devfreq/Kconfig:config ARM_EXYNOS_BUS_DEVFREQ
devfreq/Kconfig:        bool "ARM EXYNOS Generic Memory Bus DEVFREQ Driver"

...meaning that it currently is not being built as a module by anyone.

Rather than rip out the existing modular code, Chanwoo indicated
that he'd rather see the driver offered as tristate.

I don't have the hardware for runtime validation, so this change
is only validated for compile and modpost.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: make devfreq-event explicitly non-modular
Paul Gortmaker [Sat, 25 Jun 2016 18:43:48 +0000 (03:43 +0900)]
PM / devfreq: make devfreq-event explicitly non-modular

The Kconfig currently controlling compilation of this code is:

menuconfig PM_DEVFREQ_EVENT
bool "DEVFREQ-Event device Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

This code wasn't using module_init, so we don't need to be concerned
with altering the initcall level here.

We don't replace module.h with init.h since the file already has that.
But we do add export.h since this file does export some symbols.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: make devfreq explicitly non-modular
Paul Gortmaker [Sat, 25 Jun 2016 18:43:47 +0000 (03:43 +0900)]
PM / devfreq: make devfreq explicitly non-modular

The Kconfig currently controlling compilation of this code is:

menuconfig PM_DEVFREQ
      bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

This code wasn't using module_init, so we don't need to be concerned
with altering the initcall level here.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We don't replace module.h with init.h since the file already has that.
But we do add export.h since this file does export some symbols.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Send the DEVFREQ_POSTCHANGE notification when target() is failed
Chanwoo Choi [Thu, 23 Jun 2016 02:18:43 +0000 (11:18 +0900)]
PM / devfreq: Send the DEVFREQ_POSTCHANGE notification when target() is failed

This patch sends the DEVFREQ_POSTCHANGE notification when
devfreq->profile->targer() is failed. The PRECHANGE/POSTCHANGE
should be paired.

Fixes: 0fe3a66410a3 (PM / devfreq: Add new DEVFREQ_TRANSITION_NOTIFIER notifier)
Reported-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / devfreq: fix initialization of current frequency in last status
Lukasz Luba [Tue, 31 May 2016 10:25:09 +0000 (11:25 +0100)]
PM / devfreq: fix initialization of current frequency in last status

Some systems need current frequency from last_status for calculation
but it is zeroed during initialization. When the device starts there is
no history, but we can assume that the last frequency was the
same as the initial frequency (which is also used in 'previous_freq').
The log shows the result of this misinterpreted value.
[    2.042847] ... Failed to get voltage for frequency 0: -34

Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Reviewed-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check
Dan Carpenter [Thu, 26 May 2016 06:45:42 +0000 (09:45 +0300)]
PM / devfreq: exynos-nocp: Remove incorrect IS_ERR() check

Smatch complains because platform_get_resource() returns NULL on error
and not an error pointer so the check is wrong.  Julia Lawall pointed
out that normally we don't check these, because devm_ioremap_resource()
has a check for NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: remove double put_device
MyungJoo Ham [Mon, 16 May 2016 02:41:57 +0000 (11:41 +0900)]
PM / devfreq: remove double put_device

When device_register() returns with error, it has already
done put_device() on the input device pointer.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: fix double call put_device
Cai Zhiyong [Sat, 14 May 2016 06:13:30 +0000 (14:13 +0800)]
PM / devfreq: fix double call put_device

1295  */
1296 void device_unregister(struct device *dev)
1297 {
1298         pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
1299         device_del(dev);
1300         put_device(dev);
1301 }
1302 EXPORT_SYMBOL_GPL(device_unregister);
1303

device_unregister is called put_device, there is no need to call
put_device(&devfreq->dev) again.

Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: fix duplicated kfree on devfreq pointer
MyungJoo Ham [Fri, 2 Oct 2015 03:48:54 +0000 (12:48 +0900)]
PM / devfreq: fix duplicated kfree on devfreq pointer

device_unregister() calls kfree already.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: devm_kzalloc to have dev pointer more precisely
MyungJoo Ham [Fri, 2 Oct 2015 03:39:23 +0000 (12:39 +0900)]
PM / devfreq: devm_kzalloc to have dev pointer more precisely

devm_kzalloc of devfreq's statistics data structure has been
using its parent device as the dev allocated for.
If a device's devfreq is disabled in run-time,
such allocated memory won't be freed.

Desginating more precisely with the devfreq device
pointer fixes the issue.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: style/typo fixes
MyungJoo Ham [Fri, 29 Apr 2016 07:13:03 +0000 (16:13 +0900)]
PM / devfreq: style/typo fixes

- Typo in comments fixed
- Unnecessary return statement removed

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos: Add the detailed correlation for Exynos5422 bus
Chanwoo Choi [Fri, 27 Nov 2015 04:03:59 +0000 (13:03 +0900)]
PM / devfreq: exynos: Add the detailed correlation for Exynos5422 bus

This patch adds the detailed corrleation between sub-blocks and power line
for Exynos5422.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: event: Find the instance of devfreq-event device by using phandle
Chanwoo Choi [Thu, 14 Apr 2016 05:37:12 +0000 (14:37 +0900)]
PM / devfreq: event: Find the instance of devfreq-event device by using phandle

This patch use the phandle to find the instance of devfreq-event device in
Device Tree when calling the devfreq_event_get_edev_by_phandle() because there
is two type devfreq-event devices as following:

First case, exynos-ppmu.c driver provides the maximum four event of each PPMU.
So, when getting the instance of devfreq-event device, using the unique name of
struct devfreq_event_desc.

Second case, exynos-nocp.c driver provide the only one event of each NoC Probe
device. So, when getting the instance of devfreq-event device, using the
phandle of each NoC probe device.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: event: Add new Exynos NoC probe driver
Chanwoo Choi [Thu, 7 Apr 2016 02:29:11 +0000 (11:29 +0900)]
PM / devfreq: event: Add new Exynos NoC probe driver

This patch adds NoC (Network on Chip) Probe driver which provides
the primitive values to get the performance data. The packets that the Network
on Chip (NoC) probes detects are transported over the network infrastructure.
Exynos542x bus has multiple NoC probes to provide bandwidth information about
behavior of the SoC that you can use while analyzing system performance.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Markus Reichl <m.reichl@fivetechno.de>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoPM / devfreq: exynos: Remove unused exynos4/5 busfreq driver
Chanwoo Choi [Mon, 23 Nov 2015 14:58:17 +0000 (23:58 +0900)]
PM / devfreq: exynos: Remove unused exynos4/5 busfreq driver

This patch removes the unused exynos4/5 busfreq driver. Instead,
generic exynos-bus frequency driver support the all Exynos SoCs.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoPM / devfreq: exynos: Add the detailed correlation between sub-blocks and power line
Chanwoo Choi [Fri, 27 Nov 2015 03:55:23 +0000 (12:55 +0900)]
PM / devfreq: exynos: Add the detailed correlation between sub-blocks and power line

This patch adds the detailed correlation between sub-blocks and power line
for Exynos3250, Exynos4210 and Exynos4x12.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoPM / devfreq: exynos: Update documentation for bus devices using passive governor
Chanwoo Choi [Mon, 23 Nov 2015 14:18:52 +0000 (23:18 +0900)]
PM / devfreq: exynos: Update documentation for bus devices using passive governor

This patch updates the documentation for passive bus devices and adds the
detailed example of Exynos3250.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoPM / devfreq: exynos: Add support of bus frequency of sub-blocks using passive governor
Chanwoo Choi [Thu, 5 Nov 2015 09:29:27 +0000 (18:29 +0900)]
PM / devfreq: exynos: Add support of bus frequency of sub-blocks using passive governor

This patch adds the support of bus frequency feature for sub-blocks which share
the one power line. If each bus depends on the power line, each bus is not able
to change the voltage by oneself. To optimize the power-consumption on runtime,
some buses using the same power line should change the source clock and
regulator at the same time. So, this patch uses the passive governor to support
the bus frequency for all buses which sharing the one power line.

For example,

Exynos3250 include the two power line for AXI buses as following:
: VDD_MIF : MIF (Memory Interface) provide the DMC (Dynamic Memory Controller)
  with the power (regulator).
: VDD_INT : INT (Internal) provide the various sub-blocks with the power
  (regulator).

Each bus is included in as follwoing block. In the case of VDD_MIF, only DMC bus
use the power line. So, there is no any depencency between buese. But, in the
case of VDD_INT, various buses share the one power line of VDD_INT. We need to
make the depenency between buses. When using passive governor, there is no
problem to support the bus frequency as DVFS for all buses. One bus should be
operated as the parent bus device which gathering the current load of INT block
and then decides the new frequency with some governors except of passive
governor. After deciding the new frequency by the parent bus device, the rest
bus devices will change the each source clock according to new frequency of the
parent bus device.

- MIF (Memory Interface) block
: VDD_MIF |--- DMC

- INT (Internal) block
: VDD_INT |--- LEFTBUS (parent)
          |--- PERIL
          |--- MFC
          |--- G3D
          |--- RIGHTBUS
          |--- FSYS
          |--- LCD0
          |--- PERIR
          |--- ISP
          |--- CAM

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
[tjakobi: Reported debugfs error during booting and cw00.choi fix it.]
Reported-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoPM / devfreq: Add new passive governor
Chanwoo Choi [Tue, 22 Mar 2016 04:44:03 +0000 (13:44 +0900)]
PM / devfreq: Add new passive governor

This patch adds the new passive governor for DEVFREQ framework. The following
governors are already present and used for DVFS (Dynamic Voltage and Frequency
Scaling) drivers. The following governors are independently used for one device
driver which don't give the influence to other device drviers and also don't
receive the effect from other device drivers.
- ondemand / performance / powersave / userspace

The passive governor depends on operation of parent driver with specific
governos extremely and is not able to decide the new frequency by oneself.
According to the decided new frequency of parent driver with governor,
the passive governor uses it to decide the appropriate frequency for own
device driver. The passive governor must need the following information
from device tree:
- the source clock and OPP tables
- the instance of parent device

For exameple,
there are one more devfreq device drivers which need to change their source
clock according to their utilization on runtime. But, they share the same
power line (e.g., regulator). So, specific device driver is operated as parent
with ondemand governor and then the rest device driver with passive governor
is influenced by parent device.

Suggested-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
[tjakobi: Reported RCU locking issue and cw00.choi fix it]
Reported-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
[linux.amoon: Reported possible recursive locking and cw00.choi fix it]
Reported-by: Anand Moon <linux.amoon@gmail.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoPM / devfreq: Add new DEVFREQ_TRANSITION_NOTIFIER notifier
Chanwoo Choi [Tue, 26 Jan 2016 04:21:26 +0000 (13:21 +0900)]
PM / devfreq: Add new DEVFREQ_TRANSITION_NOTIFIER notifier

This patch adds the new DEVFREQ_TRANSITION_NOTIFIER notifier to send
the notification when the frequency of device is changed.
This notifier has two state as following:
- DEVFREQ_PRECHANGE  : Notify it before chaning the frequency of device
- DEVFREQ_POSTCHANGE : Notify it after changed the frequency of device

And this patch adds the resourced-managed function to release the resource
automatically when error happen.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
[m.reichl and linux.amoon: Tested it on exynos4412-odroidu3 board]
Tested-by: Markus Reichl <m.reichl@fivetechno.de>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoPM / devfreq: Add devfreq_get_devfreq_by_phandle()
Chanwoo Choi [Tue, 10 Nov 2015 11:31:07 +0000 (20:31 +0900)]
PM / devfreq: Add devfreq_get_devfreq_by_phandle()

This patch adds the new devfreq_get_devfreq_by_phandle() OF helper function
which can find the instance of devfreq device by using phandle ("devfreq").

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
[m.reichl and linux.amoon: Tested it on exynos4412-odroidu3 board]
Tested-by: Markus Reichl <m.reichl@fivetechno.de>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoPM / devfreq: exynos: Add documentation for generic exynos bus frequency driver
Chanwoo Choi [Wed, 4 Nov 2015 01:52:45 +0000 (10:52 +0900)]
PM / devfreq: exynos: Add documentation for generic exynos bus frequency driver

This patch adds the documentation for generic exynos bus frequency
driver.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: exynos: Add generic exynos bus frequency driver
Chanwoo Choi [Tue, 3 Nov 2015 10:04:16 +0000 (19:04 +0900)]
PM / devfreq: exynos: Add generic exynos bus frequency driver

This patch adds the generic exynos bus frequency driver for AMBA AXI bus
of sub-blocks in exynos SoC with DEVFREQ framework. The Samsung Exynos SoC
have the common architecture for bus between DRAM and sub-blocks in SoC.
This driver can support the generic bus frequency driver for Exynos SoCs.

In devicetree, Each bus block has a bus clock, regulator, operation-point
and devfreq-event devices which measure the utilization of each bus block.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
[m.reichl and linux.amoon: Tested it on exynos4412-odroidu3 board]
Tested-by: Markus Reichl <m.reichl@fivetechno.de>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoPM / devfreq: Spelling s/frequnecy/frequency/
Geert Uytterhoeven [Mon, 14 Mar 2016 15:29:02 +0000 (16:29 +0100)]
PM / devfreq: Spelling s/frequnecy/frequency/

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / devfreq: Do not show statistics if it's not ready.
MyungJoo Ham [Mon, 23 Nov 2015 06:45:36 +0000 (15:45 +0900)]
PM / devfreq: Do not show statistics if it's not ready.

Before this patch for a device without statistics support,

$ cat trans_stat
    From  :   To
          :   time(ms)
Total transitions : 0
$

After this patch applied for such a device,

$ cat trans_stat
Not Supported.
$

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Modify the indentation of trans_stat sysfs for readability
Chanwoo Choi [Thu, 19 Nov 2015 07:28:46 +0000 (16:28 +0900)]
PM / devfreq: Modify the indentation of trans_stat sysfs for readability

This patch modifies the indentation of 'trans_stat' sysfs to improve readability.
The 1GHz is 1000,000,000. So it needs the least 10 position to show the GHz unit.

- Before apply this patch,
-sh-3.2# cat trans_stat
   From  :   To
         :50000000100000000133000000200000000400000000   time(ms)
*50000000:       0       0       0       0       7   1817635
 100000000:       4       0       0       0       4      1590
 133000000:       1       4       0       0       7       975
 200000000:       2       2       7       0       1      2655
 400000000:       0       2       5      12       0      1860
Total transition : 58

- After apply this patch,
-sh-3.2# cat trans_stat
     From  :   To
           :  50000000 100000000 133000000 200000000 400000000   time(ms)
*  50000000:         0         0         0         0         7     14405
  100000000:         4         0         0         0         3      2015
  133000000:         2         3         0         0         7      1020
  200000000:         1         2         7         0         0      2970
  400000000:         0         2         5        10         0      1575
Total transition : 53

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Set the freq_table of devfreq device
Chanwoo Choi [Wed, 18 Nov 2015 05:49:02 +0000 (14:49 +0900)]
PM / devfreq: Set the freq_table of devfreq device

This patch initialize the freq_table array of each devfreq device by using
the devfreq_set_freq_table(). If freq_table is NULL, the devfreq framework
is not able to support the frequency transtion information through sysfs.

The OPP core uses the integer type for the number of opps in the opp list
and uses the 'unsigned long' type for each frequency. So, this patch
modifies the type of some variable as following:
- the type of freq_table : unsigned int -> unsigned long
- the type of max_state  : unsigned int -> int

- Corrected types, format strings, mutex usages by MyungJoo

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Add show_one macro to delete the duplicate code
Chanwoo Choi [Fri, 13 Nov 2015 10:25:28 +0000 (19:25 +0900)]
PM / devfreq: Add show_one macro to delete the duplicate code

This patch adds the 'show_one' macro to simplify the duplicate code
of both max_freq_show() and min_freq_show().

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: event: Fix the error and warning from script/checkpatch.pl
Chanwoo Choi [Thu, 19 Nov 2015 08:03:44 +0000 (17:03 +0900)]
PM / devfreq: event: Fix the error and warning from script/checkpatch.pl

This patch just fixes following error and warning by using
scripts/checkpatch.pl.

- Follwoing issue from checkpatch.pl:
ERROR: space prohibited before that close parenthesis ')'
+ if (count < 0 ) {

WARNING: line over 80 characters
+ ptr = devres_alloc(devm_devfreq_event_release, sizeof(*ptr), GFP_KERNEL);

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: event: Remove the error log of devfreq_event_get_edev_by_phandle()
Chanwoo Choi [Tue, 17 Nov 2015 05:25:06 +0000 (14:25 +0900)]
PM / devfreq: event: Remove the error log of devfreq_event_get_edev_by_phandle()

This patch just removes the error log when
devfreq_event_get_edev_by_phandle() fail to get the instance of
devfreq-event device. It is related to sequence of the probe() of each
driver. So, this error log might show the always during kernel booting.
Each driver using this function can show the appropriate error log.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: fix double kfree
Geliang Tang [Thu, 1 Oct 2015 14:18:19 +0000 (22:18 +0800)]
PM / devfreq: fix double kfree

When device_register() fails, kfree(devfreq) is called already in
devfreq_dev_release(), hence there is no need to call kfree(devfreq)
in err_dev again.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Fix governor_store()
Tobias Jakobi [Mon, 21 Sep 2015 18:23:52 +0000 (20:23 +0200)]
PM / devfreq: Fix governor_store()

Writing the currently set governor into sysfs currently
seems to fail.
Fix this by setting the return code to zero before
leaving governor_store().

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Fix incorrect type issue.
Xiaolong Ye [Fri, 11 Sep 2015 03:05:23 +0000 (11:05 +0800)]
PM / devfreq: Fix incorrect type issue.

time_in_state in struct devfreq is defined as unsigned long, so
devm_kzalloc should use sizeof(unsigned long) as argument instead
of sizeof(unsigned int), otherwise it will cause unexpected result
in 64bit system.

Signed-off-by: Xiaolong Ye <yexl@marvell.com>
Signed-off-by: Kevin Liu <kliu5@marvell.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: comments for get_dev_status usage updated
MyungJoo Ham [Tue, 18 Aug 2015 04:45:49 +0000 (13:45 +0900)]
PM / devfreq: comments for get_dev_status usage updated

With the introduction of devfreq_update_stats(), governors
are not recommended to use get_dev_status() directly.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
[jy0922.shim: apply mainline patch]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
6 years agoPM / devfreq: drop comment about thermal setting max_freq
Javi Merino [Fri, 14 Aug 2015 17:57:00 +0000 (18:57 +0100)]
PM / devfreq: drop comment about thermal setting max_freq

The thermal infrastructure should use the devfreq cooling device, which
uses the OPP library to disable OPPs as necessary.

Fix a couple of typos in the same comment while we are at it.

Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: cache the last call to get_dev_status()
Javi Merino [Fri, 14 Aug 2015 17:56:56 +0000 (18:56 +0100)]
PM / devfreq: cache the last call to get_dev_status()

The return value of get_dev_status() can be reused.  Cache it so that
other parts of the kernel can reuse it instead of having to call the
same function again.

Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Drop unlikely before IS_ERR(_OR_NULL)
Viresh Kumar [Mon, 10 Aug 2015 06:12:25 +0000 (11:42 +0530)]
PM / devfreq: Drop unlikely before IS_ERR(_OR_NULL)

IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and there
is no need to do that again from its callers. Drop it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoRevert "PM / devfreq: exynos: Add documentation for generic exynos memory bus frequen...
Chanwoo Choi [Wed, 9 Aug 2017 02:48:33 +0000 (11:48 +0900)]
Revert "PM / devfreq: exynos: Add documentation for generic exynos memory bus frequency driver"

This reverts commit 2dea71417b1b164cd8f4a4e8b8cbcfd1e2d50b3d.

6 years agoRevert "PM / devfreq: exynos: Add generic exynos memory bus frequency driver"
Chanwoo Choi [Tue, 8 Aug 2017 08:17:04 +0000 (17:17 +0900)]
Revert "PM / devfreq: exynos: Add generic exynos memory bus frequency driver"

This reverts commit 81e71993f7d397915a664706f9e84e61b4c43c76.

6 years agoRevert "PM / devfreq: exynos: Remove unused exynos4 memory busfreq driver"
Chanwoo Choi [Tue, 8 Aug 2017 08:16:55 +0000 (17:16 +0900)]
Revert "PM / devfreq: exynos: Remove unused exynos4 memory busfreq driver"

This reverts commit c77ebcc61f5b84ddba67898bf7c1c491fcce9221.

6 years agoRevert "PM / devfreq: cache the last call to get_dev_status()"
Chanwoo Choi [Tue, 8 Aug 2017 07:54:15 +0000 (16:54 +0900)]
Revert "PM / devfreq: cache the last call to get_dev_status()"

This reverts commit f97b42f9e6fd63101ded5bb5c4d37cce59920ff5.

6 years agoRevert "PM / devfreq: comments for get_dev_status usage updated"
Chanwoo Choi [Tue, 8 Aug 2017 07:54:05 +0000 (16:54 +0900)]
Revert "PM / devfreq: comments for get_dev_status usage updated"

This reverts commit 9b75a7414e3cf606b15b1c67c5ad486af73bcf30.

6 years agopackaging: Disable UBSan build 71/146271/3 accepted/tizen/unified/20170828.164523 submit/tizen/20170828.023313
Denis Khalikov [Fri, 25 Aug 2017 13:11:14 +0000 (16:11 +0300)]
packaging: Disable UBSan build

UBSan build on kernel will cause build error because kernel has its own
sanitizer build options. So, dislable UBSan build from packaging spec.

Change-Id: Ie06197677c9949eb8ed9537af6fc366d20d3a000
Signed-off-by: Denis Khalikov <d.khalikov@partner.samsung.com>
6 years agofimc-is: Remove BUG() from fimc_is_itf_s_param() 07/145207/1 accepted/tizen/4.0/unified/20170829.020507 accepted/tizen/unified/20170822.023852 submit/tizen/20170822.003618 submit/tizen_4.0/20170828.100004
Sylwester Nawrocki [Mon, 21 Aug 2017 16:19:50 +0000 (18:19 +0200)]
fimc-is: Remove BUG() from fimc_is_itf_s_param()

The condition being tested for that BUG() invocation is often
recoverable, so replace BUG() with a WARN_ON() and return EINVAL.
This prevents specific user space call sequences crashing the kernel,
which should never happen.
The callers of fimc_is_itf_s_param() function will be updated in
subsequent patches if necessary, to prevent any further possible
crashes.

Change-Id: I90a08278baa0cee85a4a69fa1b278e28e5c6764a
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agofimc-is: Remove F/W log dump at ISP video node close 46/145146/2
Sylwester Nawrocki [Mon, 21 Aug 2017 11:29:21 +0000 (13:29 +0200)]
fimc-is: Remove F/W log dump at ISP video node close

The fimc_is_hw_logdump() call was added for debug purpose,
it slows down the camera close sequence by few seconds
so remove that function call.

Change-Id: If0ce3ab16550130be9233c8a5aae4e5874065247
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agodrm/exynos/gsc: Fix check pos size and allocated memory size 22/145122/2
Hoegeun Kwon [Mon, 21 Aug 2017 01:08:53 +0000 (10:08 +0900)]
drm/exynos/gsc: Fix check pos size and allocated memory size

It will not allow to use various resolutions if we allow to use only
resolution with multiple of 16.
Therefore the pos size changed by a multiple of 16 is compared with
the allocated memory without error handling for multiples of resolution.

Change-Id: I6ce5f059baa23dd06b56ecf780261fad349e2314
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
6 years agodrm/exynos/gsc: Fix the multiple of resolution to 16 21/145121/1
Hoegeun Kwon [Mon, 21 Aug 2017 01:06:34 +0000 (10:06 +0900)]
drm/exynos/gsc: Fix the multiple of resolution to 16

There is a problem that multiples of 4, 8 are considered only for
certain format. Change to a multiple of 16 to accommodate all formats.

Change-Id: I56a664ea85bc136ad424dfb40e29d20e4225c481
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
6 years agodrm/exynos/gsc: Fix check multiples of source resolution 97/144997/1
Hoegeun Kwon [Fri, 18 Aug 2017 04:28:52 +0000 (13:28 +0900)]
drm/exynos/gsc: Fix check multiples of source resolution

The destination resolution is not related to multiples of 4, 8.
Therefore check only the source resolution.

Change-Id: I1fca3718ccd176522e6016f0efe08a00a55975aa
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
6 years agopackaging: Add kernel devel package to odroid spec 30/142330/4 accepted/tizen/unified/20170811.071716 submit/tizen/20170811.021835
Alexander Aksenov [Thu, 27 Jul 2017 12:51:55 +0000 (15:51 +0300)]
packaging: Add kernel devel package to odroid spec

Add kernel devel package to odroid spec to build out-of-tree kernel
modules.

Change-Id: I2e28ee5b6bec342b0d1d5c3e3409ff1f4aac8c7a
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
6 years agopackaging: Remove symbolic link in a devel package 05/143505/5
Jaechul Lee [Thu, 10 Aug 2017 02:03:58 +0000 (11:03 +0900)]
packaging: Remove symbolic link in a devel package

The symbolic link to kernel-devel-tizen-dev doesn't need anymore because
those who want to build SWAP-DA will use the absolute package name for
building respectively on the several kernels.

The out-of-tree kernel module build uses absolute devel package name to
bulid SWAP-DA. It should be left out to prevent a conflict between
each kernel devel packages.

Change-Id: I5eb1182500c1f9201420b958b1ad0617ec167f04
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
6 years agosensors: brcm: Remove wake_lock to fix the suspend issue 77/143477/1
Chanwoo Choi [Thu, 10 Aug 2017 05:33:47 +0000 (14:33 +0900)]
sensors: brcm: Remove wake_lock to fix the suspend issue

Even if TM2 doesn't use the wake_lock feature, the brcm sensor
drivers used the wake_lock and the the count of GPS interrupt
of brcm sensor is too much. The too much interrupt causes the
pending of reading the 'sys/power/wakeup_count' and then failed
to enter the suspend state by user-process.

This patch removes the wake_lock code to fix the suspend issue.

Change-Id: Ibd161a7a53adc4398f145e482a90efa35febbdb6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agodrm/exynos/gsc: Add resolution check and error handling 27/140227/10
Hoegeun Kwon [Thu, 20 Jul 2017 04:25:49 +0000 (13:25 +0900)]
drm/exynos/gsc: Add resolution check and error handling

If the gscaler device tries to rotate the screen with a resolution
other than a multiple of 4 and 8, a kernel panic [1] occurs because of
referring unallocated memory areas. The cause of this problem is that
multiples of the resolution must be a multiple of 4, 8 each
horizontally and vertically. It is related to the hardware limit of
gscaler.

Add error handling to check that each horizontal and vertical
resolution is not a multiple of 4 and 8.

[1]
   BUG: failure at drivers/iommu/exynos-iommu.c:425/exynos_sysmmu_irq()!
   Kernel panic - not syncing: BUG!
   CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.1.36-00004-gfbfeb5b-dirty #215
   Hardware name: Samsung TM2 board (DT)
   Call trace:
   [<ffffffc00008a008>] dump_backtrace+0x0/0x12c
   [<ffffffc00008a148>] show_stack+0x14/0x1c
   [<ffffffc000a5c818>] dump_stack+0x84/0xa8
   [<ffffffc000a589d4>] panic+0xf0/0x234
   [<ffffffc00045c4c0>] exynos_sysmmu_irq+0x68/0x78
   [<ffffffc0000e8ab4>] handle_irq_event_percpu+0x78/0x290
   [<ffffffc0000e8d18>] handle_irq_event+0x4c/0x78
   [<ffffffc0000eb9c0>] handle_fasteoi_irq+0xe4/0x198
   [<ffffffc0000e8050>] generic_handle_irq+0x34/0x4c
   [<ffffffc0000e83a4>] __handle_domain_irq+0x88/0xf0
   [<ffffffc000082418>] gic_handle_irq+0x34/0x84
   Exception stack(0xffffffc001097da0 to 0xffffffc001097ed0)
   7da0: 010a1000 ffffffc0 00000000 00000080 01097ef0 ffffffc0 00086974 ffffffc0
   7dc0: 00000000 00000000 01097f00 ffffffc0 00000001 00000000 00000000 00000000
   7de0: 00000000 00000000 98e93c98 ffffffc0 6abd3580 00000018 99087c98 ffffffc0
   7e00: 010af230 ffffffc0 01097e40 ffffffc0 ffffb3a1 00000000 00a72988 ffffffc0
   7e20: f1efd6f4 00000000 f1efd708 00000000 f1efe290 00000000 00000000 00000000
   7e40: 0010cfa0 ffffffc0 00000000 00000000 00000000 00000000 010a1000 ffffffc0
   7e60: 0122a000 ffffffc0 00a71000 ffffffc0 00000000 00000000 00000000 00000000
   7e80: 010891b0 ffffffc0 0108a740 ffffffc0 01083be0 ffffffc0 00f54000 ffffffc0
   7ea0: 00000000 00000000 01097ef0 ffffffc0 00086970 ffffffc0 01097ef0 ffffffc0
   7ec0: 00086974 ffffffc0 60000145 00000000
   [<ffffffc000085700>] el1_irq+0x80/0xf8
   [<ffffffc0000d9d50>] cpu_startup_entry+0x290/0x458
   [<ffffffc000a5702c>] rest_init+0x84/0x8c
   [<ffffffc000fe9984>] start_kernel+0x398/0x3ac

Change-Id: I5e81a5217a0eaa12e8645cbe4fe118661decc037
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
6 years agoclk: samsung: exynos5433: Correct typos in SoC name 71/143171/2
Marek Szyprowski [Wed, 9 Aug 2017 00:38:47 +0000 (09:38 +0900)]
clk: samsung: exynos5433: Correct typos in SoC name

This patch fixes simple typos in Exynos5433 clocks driver. The SoC name
was referred a few times as '5443' instead of '5433'.

Change-Id: Ie0507e195a323b134af0cb0c775637755b128df7
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
[cw00.choi: Apply mainline patch as backporting]
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoclk: samsung: exynos5433: Add data for 250MHz and 278MHz PLL rates 70/143170/2
Marek Szyprowski [Thu, 26 Jan 2017 12:37:53 +0000 (13:37 +0100)]
clk: samsung: exynos5433: Add data for 250MHz and 278MHz PLL rates

Default clock configuration applied by the bootloader for TM2 and TM2e
boards includes 250MHz and 278MHz rate for DISP PLL clock. To ensure
such configuration for those boards with 'assigned-clock-*' properties,
parameters for those two additional rates are needed.

Change-Id: I637f105f7141bb5854f1f78cacc215eb7c447621
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[cw00.choi: Apply mainline patch as backporting]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoclk: samsung: exynos5433: Add IDs for PHYCLK_MIPIDPHY0_* clocks 69/143169/2
Marek Szyprowski [Wed, 9 Aug 2017 00:36:41 +0000 (09:36 +0900)]
clk: samsung: exynos5433: Add IDs for PHYCLK_MIPIDPHY0_* clocks

Add missing identifiers for phyclk_mipidphy0_bitclkdiv8_phy and
phyclk_mipidphy0_rxclkesc0_phy clocks. Access to those clocks is needed
to setup initial clock configuration for display subsystem in device tree
in order to avoid dependency on the configuration left by the bootloader.

Change-Id: I808ec0e89d38e55e6ca5839bf365dce7b694af27
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[cw00.choi: Apply mainline patch as backporting]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoclk: samsung: exynos5433: Set NoC (Network On Chip) clocks as critical 68/143168/1
Chanwoo Choi [Thu, 8 Dec 2016 04:58:07 +0000 (13:58 +0900)]
clk: samsung: exynos5433: Set NoC (Network On Chip) clocks as critical

The ACLK_BUS0/1/2 are used for NoC (Network on Chip). If NoC's clocks are
disabled, the system halt happens. Following clocks must be always enabled:
 - CLK_ACLK_BUS0_400 : NoC's bus clock for PERIC/PERIS/FSYS/MSCL,
 - CLK_ACLK_BUS1_400 : NoC's bus clock for MFC/HEVC/G3D,
 - CLK_ACLK_BUS2_400 : NoC's bus clock for GSCL/DISP/G2D/CAM0/CAM1/ISP.

This patch also adds the CLK_SET_RATE_PARENT flag to the CLK_SCLK_JPEG_MSCL
because this clock should be used for bus frequency scaling. This clock need
to be changed on the fly with CLK_SET_RATE_PARENT flag.

Change-Id: I37661bb8c4d8c36d96464df6eeb2927be1065a2a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[cw00.choi: Apply mainline patch as backporting]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoclk: exynos5433: Mark some clocks as critical 67/143167/1
Marek Szyprowski [Fri, 18 Nov 2016 10:04:18 +0000 (11:04 +0100)]
clk: exynos5433: Mark some clocks as critical

Some parent clocks of the Exynos5433 CMUs must be always enabled to access
any register in the given CMU or devices connected to it. For the time
being, until a proper solution based on runtime PM is applied, mark those
clocks as critical (instead of ignore unused) to prevent disabling them.

Change-Id: Icf0955a6a357acd90865512d326da04974ba9ed9
Reported-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[cw00.choi: Apply mainline patch as backporting]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoclk: exynos5433: Fix parent clocks for FSYS block 66/143166/1
Marek Szyprowski [Thu, 17 Nov 2016 11:42:52 +0000 (12:42 +0100)]
clk: exynos5433: Fix parent clocks for FSYS block

The proper parent clock for FSYS block is "aclk_fsys_200"
according to the Exynos5433 reference manual.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[cw00.choi: Apply mainline patch as backporting]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Change-Id: I02f8fad8004de987d0f85fae6269af0a7b71225a

6 years agoclk: WARN_ON about to disable a critical clock 65/143165/1
Lee Jones [Wed, 9 Aug 2017 00:50:03 +0000 (09:50 +0900)]
clk: WARN_ON about to disable a critical clock

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1455225554-13267-3-git-send-email-mturquette@baylibre.com
[cw00.choi: Fix the merge conflict and apply mainline patch]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Change-Id: Ibf56e2d41935224629097b50c7856e19349c82ad

6 years agoclk: Allow clocks to be marked as CRITICAL 64/143164/1
Lee Jones [Wed, 9 Aug 2017 00:47:55 +0000 (09:47 +0900)]
clk: Allow clocks to be marked as CRITICAL

Critical clocks are those which must not be gated, else undefined
or catastrophic failure would occur.  Here we have chosen to
ensure the prepare/enable counts are correctly incremented, so as
not to confuse users with enabled clocks with no visible users.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1455225554-13267-2-git-send-email-mturquette@baylibre.com
[cw00.choi: Fix the merge conflict and apply the mainline patch]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Change-Id: Ic4ec2959426dc4a424bf71bdc6b725dd9022616c

6 years agoRevert "Revert "usb: core: lpm: set lpm_capable for root hub device"" 15/125315/11 accepted/tizen/unified/20170807.152205 submit/tizen/20170807.013143
Dongwoo Lee [Fri, 14 Apr 2017 03:36:30 +0000 (12:36 +0900)]
Revert "Revert "usb: core: lpm: set lpm_capable for root hub device""

This reverts commit 'dc463ecea9d0 ("Revert "usb: core: lpm: set lpm_capable
for root hub device"")'

The original commit was reverted because it makes the USB port is not
working on Odroid-XU4. But now PHY tuning resolves this problem, so it
will be restored.

Change-Id: I59cdd3a6bf2f0fce06dce88a4f7844a82ed1eab5
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
6 years agousb: host: xhci-plat: Tune PHY after xhci reset 14/125314/10
Dongwoo Lee [Tue, 11 Apr 2017 05:32:44 +0000 (14:32 +0900)]
usb: host: xhci-plat: Tune PHY after xhci reset

It tunes PHY to enable USB 3.0 super-speed mode.

Since xhci reset clears PHY CR port settings, PHY should be re-tuned
after xhci reset completes.

Change-Id: I1ab574c592d1a64b2735773b387687997647d89a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
6 years agophy: exynos5-usbdrd: Add USB 3.0 super-speed mode tune 13/125313/9
Dongwoo Lee [Wed, 22 Mar 2017 04:54:50 +0000 (13:54 +0900)]
phy: exynos5-usbdrd: Add USB 3.0 super-speed mode tune

It implements PHY tune operation to activate USB 3.0 super-speed mode.

Change-Id: I56971effacc2d3383b1fc55c2e73f76f54d603a0
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
6 years agophy: core: Add PHY tune operation 12/125312/6
Dongwoo Lee [Fri, 7 Apr 2017 06:22:18 +0000 (15:22 +0900)]
phy: core: Add PHY tune operation

PHY framework currently provides phy_init to set initial state of
registers, powers and clocks but it is always called before xhci is
probed. However, some PHYs might need to adjust their configuration
during its operation because of h/w characteristics (or problem).
To resolve this problem, it provides tune operation to generic PHY
framework.

Change-Id: I74b0104d6ecada8c4274036c69497b9368e7f38a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
7 years agoarm64: dts: exynos5433: Enable exynos-avs on the tm2 and tm2e boards 75/136275/3
Wook Song [Wed, 28 Jun 2017 08:57:08 +0000 (17:57 +0900)]
arm64: dts: exynos5433: Enable exynos-avs on the tm2 and tm2e boards

This patch adds the exynos-avs device nodes to the exynos5433-tm2 and
exynos5433-tm2e board dts files. The vdd-supply property required by
each exynos-avs device is also added to the corresponding device node.

Change-Id: Ia4ae2bd0624bb97d98157820fdae93bf4dace6a0
Signed-off-by: Wook Song <wook16.song@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoarm64: dts: exynos5433: Add exynos-avs device node 74/136274/3
Wook Song [Wed, 28 Jun 2017 06:18:06 +0000 (15:18 +0900)]
arm64: dts: exynos5433: Add exynos-avs device node

This patch adds exynos AVS device tree node for Exynos5433. Since the
AVS device driver for Exynos5433 requries the phandle of the syscon node
for chipid register set, this patch also adds the "syscon" compatible
property to the exynos-chipid binding node.

Change-Id: Icef5aba65fac3864553ebdac233181015bb2f393
Signed-off-by: Wook Song <wook16.song@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoPM / AVS: exynos-avs: Add Adaptive Voltage Scaling (AVS) device driver 50/111950/11
Wook Song [Tue, 24 Jan 2017 08:10:54 +0000 (17:10 +0900)]
PM / AVS: exynos-avs: Add Adaptive Voltage Scaling (AVS) device driver

In Exynos SoC, Adaptive Supply Voltage (ASV) is a technique, which
provides sets of voltage values optimized to the SoC revision variations
for given operating frequencies of devices such as CPU, GPU, and BUS.
For each given operating frequency of the device, there is an ASV group
number, which indicates the SoC revision variaion. By using the ASV
group number, it is possible to identify which one is the most suitable
set of voltages. In general, the ASV group numbers are decided at the
manufactoring time and we can get these numbers by reading specific
memory addresses mapped to a special read-only region.

This patch adds a dt-based common device driver for ASV support in
Exynos SoC. Since the ASV technique can be also viewed as a Adaptive
Voltage Scaling (AVS) feature, we let this device driver be included in
drivers/power/avs directory. This common device driver supports basic
operations to read the ASV group number and replace the OPP table of the
device with the optimized one by using the ASV group number.

In the current version of the AVS common device driver, instead of
supporting all the resource types, CPU-related resource types are
supported. It will be extended to support other types of resources such
as GPU and BUS.

For the specific SoC support by using this common device driver, this
patch also adds a device driver for Exynos5433 SoC. In the case of
Exynos5433 SoC, there are four vesions of the OPP tables for each
resource. Since each OPP table contains 16 sets of voltages for 16 ASV
groups, 64 sets of operating points are required to only support the
Little cluster. Therefore, in the current implementation, this
Exynos5433-specific device driver only supports the optimized OPP table
for the ASV group number of 8 in version 2 of the OPP table (which is
the latest version). It will be also extended to supprot all of the 16
ASV groups in the OPP table version 2 soon.

Change-Id: Ie4d7e810a42c1cbcad7c6af9a77cce0964e104bb
Signed-off-by: Wook Song <wook16.song@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>