platform/kernel/linux-exynos.git
6 years agogpu: arm: midgard: fix build warning in r5p0_06rel0 with arm64 63/150263/2 accepted/tizen/4.0/unified/20170920.081531 accepted/tizen/unified/20170920.081129 submit/tizen/20170920.004419 submit/tizen_4.0/20170920.004041
Seung-Woo Kim [Fri, 15 Sep 2017 02:38:02 +0000 (11:38 +0900)]
gpu: arm: midgard: fix build warning in r5p0_06rel0 with arm64

The debugfs usage in midgard r5p0_06rel0 has build warning in arm64
because of printing pointer with unsigned int. Fix the build warning
as fixed in r12p0.

It converts pointer type to 32bit unsigned int type for printing
format.

Change-Id: I10a12df503e7c2605b816ce2e1cc7fde061f4e7e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agogpu: arm: midgard: fix build error in r5p0_06rel0 with CONFIG_SYNC 62/150262/2
Seung-Woo Kim [Fri, 15 Sep 2017 02:34:26 +0000 (11:34 +0900)]
gpu: arm: midgard: fix build error in r5p0_06rel0 with CONFIG_SYNC

The fence code in midgard r5p0_06rel0 has build error with
CONFIG_SYNC because it uses old sync framework. Fix the build error
with CONFIG_SYNC as fixed in r12p0.

Change-Id: I9233a9d64a802e92b5c973c172eda01c083c2fa7
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoarm64: dts: exynos: Add support of bus frequency using VDD_MIF/INT on Exynos5433... 98/150298/1
Chanwoo Choi [Fri, 15 Sep 2017 03:05:28 +0000 (12:05 +0900)]
arm64: dts: exynos: Add support of bus frequency using VDD_MIF/INT on Exynos5433 TM2E

This patch adds the bus Device-tree nodes for both INT (Internal) and
MIF (Memory Interface) block in order to enable the bus frequency scaling.

Change-Id: If0b606b649fc9b83895f0b2c22bc8c9ff09042f4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoarm64: dts: exynos: Add support of bus frequency using VDD_MIF on Exynos5433 TM2 03/150003/3
Chanwoo Choi [Wed, 9 Aug 2017 08:28:11 +0000 (17:28 +0900)]
arm64: dts: exynos: Add support of bus frequency using VDD_MIF on Exynos5433 TM2

This patch adds the bus Device-tree nodes for MIF (Memory Interface) block
in order to enable the bus frequency scaling.

Change-Id: Id205723fcd0b678623d63bf77643ff0f41f45527
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoarm64: dts: exynos5433: Add bus dt node using VDD_MIF for Exynos5433 02/150002/2
Chanwoo Choi [Wed, 9 Aug 2017 08:27:34 +0000 (17:27 +0900)]
arm64: dts: exynos5433: Add bus dt node using VDD_MIF for Exynos5433

This patch adds the bus nodes using VDD_MIF for Exynos5433 SoC.
Exynos5433 has the following AXI buses to translate data
between DRAM and CCI, NOC and LLI.
- CCI (Cache Coherent Interconnect)
- LLI (Low Latency Interface)
- NoC (Network on Chip)

Change-Id: I33279dac16214416afc6eed2fa3e344b3dce1d4c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoBluetooth: Properly check L2CAP config option output buffer 36/150036/2
Ben Seri [Sat, 9 Sep 2017 21:15:59 +0000 (23:15 +0200)]
Bluetooth: Properly check L2CAP config option output buffer

commit e860d2c904d1a9f38a24eb44c9f34b8f915a6ea3 upstream.

Validate the output buffer length for L2CAP config requests and responses
to avoid overflowing the stack buffer used for building the option blocks.

Signed-off-by: Ben Seri <ben@armis.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[dh79.pyun: Cherry-pick from mainline to fix CVE-2017-1000251]
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
Change-Id: Ia665b17aa7bfaa6ee13d652cce494da10b19b56d

6 years agogpu: arm: midgard: r12p0_04rel0: Fix build error for power model callbacks
Chanwoo Choi [Wed, 9 Aug 2017 06:21:48 +0000 (15:21 +0900)]
gpu: arm: midgard: r12p0_04rel0: Fix build error for power model callbacks

The commit 489b687c3e1f ("devfreq_cooling: pass a pointer to devfreq
in the power model callbacks") changes the parameters for power model
callbacks. This patch fixes the build error.

Change-Id: I3cb2c9f3ecb97b0c4662009c1a7dfcff6dfc423e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agothermal: devfreq: Check OPP for errors
Viresh Kumar [Tue, 7 Feb 2017 04:10:03 +0000 (09:40 +0530)]
thermal: devfreq: Check OPP for errors

It is possible for dev_pm_opp_find_freq_exact() to return errors. It was
all fine earlier as dev_pm_opp_get_voltage() had a check within it to
check for invalid OPPs, but dev_pm_opp_put() doesn't have any similar
checks and the callers need to make sure OPP is valid before calling
them.

Also update the later dev_warn_ratelimited() to not print the error
message as the OPP is guaranteed to be valid now.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
6 years agothermal: devfreq_cooling: Replace dev_warn with dev_err
Viresh Kumar [Tue, 7 Feb 2017 04:10:02 +0000 (09:40 +0530)]
thermal: devfreq_cooling: Replace dev_warn with dev_err

There isn't much the user can do on seeing this warning, as the hardware
is actually okay. dev_err suits much better here.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
6 years agothermal: devfreq: Simplify expression
Viresh Kumar [Tue, 7 Feb 2017 04:10:01 +0000 (09:40 +0530)]
thermal: devfreq: Simplify expression

There is no need to check for IS_ERR() as we are looking for a very
particular error value here. Drop the first check.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
6 years agothermal: convert devfreq_cooling to use an IDA
Matthew Wilcox [Wed, 21 Dec 2016 17:47:06 +0000 (09:47 -0800)]
thermal: convert devfreq_cooling to use an IDA

thermal devfreq cooling does not use the ability to look up pointers by
ID, so convert it from using an IDR to the more space-efficient IDA.

Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
6 years agodevfreq_cooling: pass a pointer to devfreq in the power model callbacks
Javi Merino [Thu, 15 Sep 2016 14:44:23 +0000 (15:44 +0100)]
devfreq_cooling: pass a pointer to devfreq in the power model callbacks

When the devfreq cooling device was designed, it was an oversight not to
pass a pointer to the struct devfreq as the first parameters of the
callbacks.  The design patterns of the kernel suggest it for a good
reason.

By passing a pointer to struct devfreq, the driver can register one
function that works with multiple devices.  With the current
implementation, a driver that can work with multiple devices has to
create multiple copies of the same function with different parameters so
that each devfreq_cooling_device can use the appropriate one.  By
passing a pointer to struct devfreq, the driver can identify which
device it's referring to.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Reviewed-by: Punit Agrawal <punit.agrawal@arm.com>
Reviewed-by: Ørjan Eide <orjan.eide@arm.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
6 years agodevfreq_cooling: no need to check state with negative number
Shawn Lin [Mon, 22 Aug 2016 08:08:06 +0000 (16:08 +0800)]
devfreq_cooling: no need to check state with negative number

We could see that state is defined as unsigned type, so it
should never be less than zero. Let' remove this check.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
6 years agoPM / devfreq: Fix memory leak when fail to register device
Chanwoo Choi [Tue, 22 Aug 2017 07:16:44 +0000 (16:16 +0900)]
PM / devfreq: Fix memory leak when fail to register device

When the devfreq_add_device fails to register deivce, the memory
leak of devfreq instance happen. So, this patch fix the memory
leak issue. Before freeing the devfreq instance checks whether
devfreq instance is NULL or not because the device_unregister()
frees the devfreq instance when jumping to the 'err_init'.
It is to prevent the duplicate the kfee(devfreq).

Change-Id: Ic594e6729984fd7227a7efda50db600a6bf1be79
Cc: stable@vger.kernel.org
Fixes: ac4b281176a5 ("PM / devfreq: fix duplicated kfree on devfreq pointer")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Add dependency on PM_OPP
Chanwoo Choi [Mon, 21 Aug 2017 05:34:28 +0000 (14:34 +0900)]
PM / devfreq: Add dependency on PM_OPP

The devfreq ues the OPP library to handle the voltage and frequency
for the device basically. This patch adds the dependency on CONFIG_PM_OPP
in order to prevent either the build break or the unknow behavior.

Change-Id: I1a2b56c1653b9c1f42454b46ab45d6e1af2b069f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
6 years agoPM / devfreq: Move private devfreq_update_stats() into devfreq
Chanwoo Choi [Tue, 18 Jul 2017 14:37:04 +0000 (23:37 +0900)]
PM / devfreq: Move private devfreq_update_stats() into devfreq

THe devfreq_update_stats() updates the 'struct devfreq_dev_status'
in order to get current status of devfreq device. It is only used
for the governors.

This patch moves the devfreq_update_stats() into devfreq directory.

Change-Id: I4acc7347d4950258b1ebea4eb2371b77d8fcddb7
Signed-off-by: Chanwoo Choi <cwchoi00@gmail.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
6 years agoarm64: dts: exynos: Add support of bus frequency using VDD_INT on Exynos5433 TM2
Chanwoo Choi [Tue, 8 Aug 2017 11:03:09 +0000 (20:03 +0900)]
arm64: dts: exynos: Add support of bus frequency using VDD_INT on Exynos5433 TM2

This patch adds the bus Device-tree nodes for INT (Internal) block
and enables the bus frequency scaling.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
6 years agoarm64: dts: exynos: Add bus nodes using VDD_INT for Exynos5433
Chanwoo Choi [Tue, 8 Aug 2017 10:56:34 +0000 (19:56 +0900)]
arm64: dts: exynos: Add bus nodes using VDD_INT for Exynos5433

This patch adds the AMBA AXI bus nodes using VDD_INT for Exynos5433 SoC.

Following list specify the detailed correlation between sub-block and clock:
- CLK_ACLK_G2D_{400|266}  : Bus clock for G2D (2D graphic engine)
- CLK_ACLK_MSCL_400       : Bus clock for MSCL (Memory to memory Scaler)
- CLK_ACLK_GSCL_333       : Bus clock for GSCL (General Scaler)
- CLK_SCLK_JPEG_MSCL      : Bus clock for JPEG
- CLK_ACLK_MFC_400        : Bus clock for MFC (Multi Format Codec)
- CLK_ACLK_HEVC_400       : Bus clock for HEVC (High Efficient Video Codec)
- CLK_ACLK_BUS0_400       : NoC's (Network On Chip) 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

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
6 years agoarm64: dts: exynos5433: Remove legacy memory-bus frequency
Chanwoo Choi [Tue, 8 Aug 2017 10:53:10 +0000 (19:53 +0900)]
arm64: dts: exynos5433: Remove legacy memory-bus frequency

This patch removes the legacy memory-bus frequency
in order to apply the generic bus frequency driver
for Exynos SoC.

Change-Id: I861f312529f042b4b93359fa04a405ec78377708
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoPM / devfreq: exynos-bus: Add the detailed correlation for Exynos5433
Chanwoo Choi [Fri, 2 Dec 2016 06:29:02 +0000 (15:29 +0900)]
PM / devfreq: exynos-bus: Add the detailed correlation for Exynos5433

This patch adds the detailed corrleation between sub-blocks and VDD_INT power
line for Exynos5433. VDD_INT provided the power source to INT (Internal) block.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agoARM: dts: exynos: Add support of Bus frequency using VDD_INT for exynos5422-odroidxu3
Chanwoo Choi [Wed, 9 Aug 2017 06:53:39 +0000 (15:53 +0900)]
ARM: dts: exynos: Add support of Bus frequency using VDD_INT for exynos5422-odroidxu3

This patch adds the bus device tree nodes for INT (Internal) block
to enable the AMBA bus frequency scaling and add the NoC (Network on Chip)
Probe Device Tree node to measure the bandwidth for AMBA AXI bus.

The WCORE bus bus is parent device in INT block using VDD_INT.

Change-Id: Iddfe7f4970beca1abea9fd6d01b951021b45ba0c
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>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoARM: dts: exynos: Add bus nodes using VDD_INT for Exynos542x SoC
Chanwoo Choi [Wed, 9 Aug 2017 06:51:07 +0000 (15:51 +0900)]
ARM: dts: exynos: Add bus nodes using VDD_INT for Exynos542x SoC

This patch adds the AMBA bus nodes using VDD_INT for Exynos542x SoC.
Exynos542x has the following AMBA buses to translate data between
DRAM and sub-blocks.

Following list specifies the detailed correlation between sub-block and clock:
- CLK_DOUT_ACLK400_WCORE clock for WCORE's AXI
- CLK_DOUT_ACLK100_NOC for NoC (Network on Chip)'s AXI
- CLK_DOUT_PCLK200_FSYS for FSYS's APB
- CLK_DOUT_ACLK200_FSYS for FSYS's AXI
- CLK_DOUT_ACLK200_FSYS2 for FSYS2's AXI
- CLK_DOUT_ACLK333 for MFC's AXI
- CLK_DOUT_ACLK266 for GEN's AXI
- CLK_DOUT_ACLK66 for PERIC/PERIR's AXI
- CLK_DOUT_ACLK333_G2D for G2D's AXI
- CLK_DOUT_ACLK266_G2D for ACP's AXI
- CLK_DOUT_ACLK300_JPEG for JPEG's AXI
- CLK_DOUT_ACLK166 for JPEG's APB
- CLK_DOUT_ACLK300_DISP1 for FIMD's AXI
- CLK_DOUT_ACLK400_DISP1 for DISP1's AXI
- CLK_DOUT_ACLK300_GSCL for GSCL Scaler's AXI
- CLK_DOUT_ACLK400_MSCL for MSCL's AXI

Change-Id: I48f00b91bdd1b5f973704e67ec5e26a25850c2b8
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>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoARM: dts: exynos: Add NoC Probe dt node for Exynos542x SoC
Chanwoo Choi [Fri, 15 Apr 2016 06:32:51 +0000 (15:32 +0900)]
ARM: dts: exynos: Add NoC Probe dt node for Exynos542x SoC

This patch adds the NoCP (Network on Chip Probe) Device Tree node
to measure the bandwidth of memory and g3d in Exynos542x SoC.

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>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoARM: dts: exynos: Add support of bus frequency for exynos4412-trats/odroidu3
Chanwoo Choi [Wed, 9 Aug 2017 06:44:39 +0000 (15:44 +0900)]
ARM: dts: exynos: Add support of bus frequency for exynos4412-trats/odroidu3

This patch adds the bus device tree nodes for both MIF (Memory) and INT
(Internal) block to enable the bus frequency.

The DMC bus is parent device in MIF block using VDD_MIF and the LEFTBUS
bus is parent device in INT block using VDD_INT.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@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: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Change-Id: I29a555f3b58e557db90397063c39193174ad9f9b

6 years agoARM: dts: exynos: Expand the voltage range of buck1/3 regulator for exynos4412-odroidu3
Chanwoo Choi [Wed, 9 Aug 2017 06:41:40 +0000 (15:41 +0900)]
ARM: dts: exynos: Expand the voltage range of buck1/3 regulator for exynos4412-odroidu3

This patch expands the voltage range of buck1/3 regulator due to as following:
- MIF (Memory Interface) bus frequency needs the range of '900 - 1100 mV'.
- INT (Internal) bus frequency needs the range of '900 - 1050 mV'.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@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: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Change-Id: I62fff9334fd684b07e9f2a6fec04c8eb2ca005ae

6 years agoARM: dts: exynos: Add support of bus frequency using VDD_INT for exynos3250-rinato
Chanwoo Choi [Wed, 9 Aug 2017 07:03:28 +0000 (16:03 +0900)]
ARM: dts: exynos: Add support of bus frequency using VDD_INT for exynos3250-rinato

This patch adds the bus device-tree nodes of INT (internal) block
to enable the bus frequency scaling. The following sub-blocks share
the VDD_INT power source:
- LEFTBUS (parent device)
- RIGHTBUS
- PERIL
- LCD0
- FSYS
- MCUISP / ISP
- MFC

The LEFTBUS is parent device with devfreq ondemand governor
and the rest of devices depend on the LEFTBUS device.

Change-Id: Ia6d3aaeacbb4200ddb1eb103466e9ee880ec5537
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoARM: dts: exynos: Add exynos4412-ppmu-common dtsi to delete duplicate PPMU nodes
Chanwoo Choi [Wed, 9 Aug 2017 02:39:07 +0000 (11:39 +0900)]
ARM: dts: exynos: Add exynos4412-ppmu-common dtsi to delete duplicate PPMU nodes

This patch adds the exynos4412-ppmu-common.dtsi to remove duplicate PPMU nodes
because exynos3250-rinato/monk, exynos4412-trats2/odroidu3 has the same
PPMU device tree node.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@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: Krzysztof Kozlowski <k.kozlowski@samsung.com>
[cw00.choi: Fix merge issue and apply mainline patch]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Change-Id: Ic2609b3fbc6736bd74e68d709e74a19e6c77d0e6

6 years agoARM: dts: exynos: Add bus nodes using VDD_MIF for Exynos4210
Chanwoo Choi [Mon, 11 Apr 2016 03:57:54 +0000 (12:57 +0900)]
ARM: dts: exynos: Add bus nodes using VDD_MIF for Exynos4210

This patch adds the bus nodes for Exynos4210 SoC. Exynos4210 SoC has
one power line for all buses to translate data between DRAM and sub-blocks.

Following list specifies the detailed relation between DRAM and sub-blocks:
- DMC/ACP clock for DMC (Dynamic Memory Controller)
- ACLK200 clock for LCD0
- ACLK100 clock for PERIL/PERIR/MFC(PCLK)
- ACLK160 clock for CAM/TV/LCD0/LCD1
- ACLK133 clock for FSYS/GPS
- GDL/GDR clock for LEFTBUS/RIGHTBUS
- SCLK_MFC clock for MFC

Change-Id: I20beb1ff8315f497f75467dd9ebb967a6b1f79ce
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoARM: dts: exynos: Add bus nodes using VDD_INT for Exynos4x12
Chanwoo Choi [Mon, 11 Apr 2016 03:57:53 +0000 (12:57 +0900)]
ARM: dts: exynos: Add bus nodes using VDD_INT for Exynos4x12

This patch adds the bus nodes using VDD_INT for Exynos4x12 SoC.
Exynos4x12 has the following AXI buses to translate data between
DRAM and sub-blocks.

Following list specifies the detailed relation between DRAM and sub-blocks:
- ACLK100 clock for PERIL/PERIR/MFC(PCLK)
- ACLK160 clock for CAM/TV/LCD
: The minimum clock of ACLK160 should be over 160MHz.
  When drop the clock under 160MHz, show the broken image.
- ACLK133 clock for FSYS
- GDL clock for LEFTBUS
- GDR clock for RIGHTBUS
- SCLK_MFC clock for MFC

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@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: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Change-Id: I1fec9bafbc955cc07c82807c658e6ef34512d872

6 years agoARM: dts: exynos: Add bus nodes using VDD_MIF for Exynos4x12
Chanwoo Choi [Mon, 11 Apr 2016 03:57:52 +0000 (12:57 +0900)]
ARM: dts: exynos: Add bus nodes using VDD_MIF for Exynos4x12

This patch adds the bus nodes using VDD_MIF for Exynos4x12 SoC.
Exynos4x12 has the following AXI buses to translate data
between DRAM and DMC/ACP/C2C.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@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: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Change-Id: I54e41571a08aaaf62f48ae9258cdeac8613efc44

6 years agoARM: dts: exynos: Add bus nodes using VDD_INT for Exynos3250
Chanwoo Choi [Mon, 11 Apr 2016 03:57:51 +0000 (12:57 +0900)]
ARM: dts: exynos: Add bus nodes using VDD_INT for Exynos3250

This patch adds the bus nodes using VDD_INT for Exynos3250 SoC.
Exynos3250 has following AXI buses to translate data between
DRAM and sub-blocks.

Following list specifies the detailed relation between DRAM and sub-blocks:
- ACLK400 clock for MCUISP
- ACLK266 clock for ISP
- ACLK200 clock for FSYS
- ACLK160 clock for LCD0
- ACLK100 clock for PERIL
- GDL clock for LEFTBUS
- GDR clock for RIGHTBUS
- SCLK_MFC clock for MFC

Change-Id: I9c725e40aa03943e895d9388cd1950439dbc623f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoARM: dts: exynos: Add DMC bus frequency for exynos3250-rinato/monk
Chanwoo Choi [Wed, 9 Aug 2017 06:56:24 +0000 (15:56 +0900)]
ARM: dts: exynos: Add DMC bus frequency for exynos3250-rinato/monk

This patch adds the DMC (Dynamic Memory Controller) bus frequency node
which includes the devfreq-events and regulator properties. The bus
frequency support the DVFS (Dynamic Voltage Frequency Scaling) feature
with ondemand governor.

The devfreq-events (ppmu_dmc0*) can monitor the utilization of DMC bus
on runtime and the buck1_reg (VDD_MIF power line) supplies the power to
the DMC block.

Change-Id: If3df539c570bdf26407bd58a2ea4426d5dcd5c9d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoARM: dts: exynos: Add DMC bus node for Exynos3250
Chanwoo Choi [Mon, 11 Apr 2016 03:57:49 +0000 (12:57 +0900)]
ARM: dts: exynos: Add DMC bus node for Exynos3250

This patch adds the DMC (Dynamic Memory Controller) bus node for Exynos3250 SoC.
The DMC is an AMBA AXI-compliant slave to interface external JEDEC standard
SDRAM devices. The bus includes the OPP tables and the source clock for DMC
block.

Following list specifies the detailed relation between the clock and DMC block:
- The source clock of DMC block : div_dmc

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
6 years agoARM: dts: exynos; Remove legacy memory-bus frequency
Chanwoo Choi [Wed, 9 Aug 2017 02:23:24 +0000 (11:23 +0900)]
ARM: dts: exynos; Remove legacy memory-bus frequency

This patch removes the legacy memory-bus frequency
in order to apply the generic bus frequency driver
for Exynos SoC.

Change-Id: I30ef6102e185d9ff912680f0f912d1daa8eeb0dc
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoclk: samsung: exynos5420: Add clocks for CMU_CDREX domain
Chanwoo Choi [Wed, 13 Sep 2017 10:21:22 +0000 (19:21 +0900)]
clk: samsung: exynos5420: Add clocks for CMU_CDREX domain

This patch adds the mux/divider clocks for CMU_CDREX (DRAM Express
Controller) which generates the clocks for DRAM and NoC (Network on Chip)
bus.  There is differnet source of MUX_MX_MSPLL_CCORE between exynos5420
and exynos5422, so each MUX_MX_MSPLL_CCORE uses the different parent source
group.

Change-Id: I898ff4d5e2ef3ba4ce5b6b3ced686316a0b93f60
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoclk: samsung: Add clock IDs for the CMU_CDREX (DRAM Express Controller)
Chanwoo Choi [Wed, 13 Sep 2017 10:19:38 +0000 (19:19 +0900)]
clk: samsung: Add clock IDs for the CMU_CDREX (DRAM Express Controller)

This patch adds missing clock IDs for CMU_CDREX (DRAM Express Controller)
which generates clocks for DRAM and NoC (Network on Chip) busses.

Change-Id: I69f84fe4288fb5edcce7952b829a60042c7b29a8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoclk: samsung: exynos542x: Add the clock id for ACLK
Chanwoo Choi [Wed, 13 Sep 2017 10:04:24 +0000 (19:04 +0900)]
clk: samsung: exynos542x: Add the clock id for ACLK

This patch adds the clock id for ACLK clock which is source clock
of AMBA AXI bus. This clock should be handled in the bus frequency
scaling driver.

Change-Id: I58739711470e9bc3c7d182e5f2ac6d78fab78854
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>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agodt-bindings: clock: Add the clock id for ACLK clock of Exynos542x SoC
Chanwoo Choi [Fri, 15 Apr 2016 06:32:52 +0000 (15:32 +0900)]
dt-bindings: clock: Add the clock id for ACLK clock of Exynos542x SoC

This patch adds the clock id for ACLK clock of Exynos542x SoC.
ACLK clock means the source clock of AMBA AXI bus. This clock
id should be used for Bus frequency scaling.

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>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoPM / OPP: reuse of_parse_phandle()
Viresh Kumar [Fri, 4 Sep 2015 08:17:22 +0000 (13:47 +0530)]
PM / OPP: reuse of_parse_phandle()

We already have a better API to get the opp descriptor block's node from
cpu-node. Lets reuse that instead of creating our own routines for the
same stuff. That cleans the code a lot.

This also kills a check we had earlier (as we are using the generic API
now). Earlier we used to check if the operating-points-v2 property
contained multiple phandles instead of a single phandle.

Killing this check isn't an issue because, we only parse the first entry
with of_parse_phandle(). So, if a user passes multiple phandles, its
really his problem :)

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Return suspend_opp only if it is enabled
Viresh Kumar [Wed, 9 Sep 2015 11:28:22 +0000 (16:58 +0530)]
PM / OPP: Return suspend_opp only if it is enabled

There is no point returning suspend_opp, if it is disabled by the core.
As we can't use it at all. Fix it.

Fixes: 4eafbd15b6c8 ("PM / OPP: add dev_pm_opp_get_suspend_opp() helper")
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: add dev_pm_opp_get_suspend_opp() helper
Bartlomiej Zolnierkiewicz [Tue, 8 Sep 2015 16:41:01 +0000 (18:41 +0200)]
PM / OPP: add dev_pm_opp_get_suspend_opp() helper

Add dev_pm_opp_get_suspend_opp() helper to obtain suspend opp.

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Drop unlikely before IS_ERR(_OR_NULL)
Viresh Kumar [Wed, 12 Aug 2015 10:29:39 +0000 (15:59 +0530)]
PM / OPP: 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.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Fix static checker warning (broken 64bit big endian systems)
Viresh Kumar [Mon, 17 Aug 2015 13:50:20 +0000 (19:20 +0530)]
PM / OPP: Fix static checker warning (broken 64bit big endian systems)

Dan Carpenter reported (generated with static checker):

drivers/base/power/opp.c:949 _opp_add_static_v2()
warn: passing casted pointer '&new_opp->clock_latency_ns' to
'of_property_read_u32()' 64 vs 32.

This code will break on 64 bit, big endian machines.

Fix this by reading the value in a u32 type variable first and then
assigning it to the unsigned long variable.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Free resources and properly return error on failure
Viresh Kumar [Wed, 12 Aug 2015 11:00:18 +0000 (16:30 +0530)]
PM / OPP: Free resources and properly return error on failure

_of_init_opp_table_v2() isn't freeing up resources on some errors and
the error values returned are also not correct always.

This fixes following problems:
- Return -ENOENT, if no entries are found in the table.
- Use IS_ERR() to properly check return value of _find_device_opp().
- Return error value with PTR_ERR() in above case.
- Free table if _find_device_opp() fails.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: add dev_pm_opp_is_turbo() helper
Bartlomiej Zolnierkiewicz [Thu, 9 Jul 2015 15:43:35 +0000 (17:43 +0200)]
PM / OPP: add dev_pm_opp_is_turbo() helper

Add dev_pm_opp_is_turbo() helper to verify if an opp is to be used only
for turbo mode or not.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Add helpers for initializing CPU OPPs
Viresh Kumar [Fri, 12 Jun 2015 11:40:38 +0000 (17:10 +0530)]
PM / OPP: Add helpers for initializing CPU OPPs

With "operating-points-v2" its possible to tell which devices share
OPPs. We already have infrastructure to decode that information.

This patch adds following APIs:
 - of_get_cpus_sharing_opps: Returns cpumask of CPUs sharing OPPs (only
   valid with v2 bindings).
 - of_cpumask_init_opp_table: Initializes OPPs for all CPUs present in
   cpumask.
 - of_cpumask_free_opp_table: Frees OPPs for all CPUs present in cpumask.

 - set_cpus_sharing_opps: Sets which CPUs share OPPs (only valid with old
   OPP bindings, as this information isn't present in DT).

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Add support for opp-suspend
Viresh Kumar [Sat, 13 Jun 2015 09:40:21 +0000 (15:10 +0530)]
PM / OPP: Add support for opp-suspend

With "operating-points-v2" bindings, it's possible to specify the OPP to
which the device must be switched, before suspending.

This patch adds support for getting that information.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Add OPP sharing information to OPP library
Viresh Kumar [Wed, 29 Jul 2015 10:53:04 +0000 (16:23 +0530)]
PM / OPP: Add OPP sharing information to OPP library

An opp can be shared by multiple devices, for example its very common
for CPUs to share the OPPs, i.e. when they share clock/voltage rails.

This patch adds support of shared OPPs to the OPP library.

Instead of a single device, dev_opp will now contain a list of devices
that use it. It also senses if the device (we are trying to initialize
OPPs for) shares OPPs with a device added earlier and in that case we
update the list of devices managed by OPPs instead of duplicating OPPs
again.

The same infrastructure will be used for the old OPP bindings, with
later patches.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Add clock-latency-ns support
Viresh Kumar [Wed, 29 Jul 2015 10:53:03 +0000 (16:23 +0530)]
PM / OPP: Add clock-latency-ns support

With "operating-points-v2" bindings, clock-latency is defined per OPP.
Users of this value expect a single value which defines the latency to
switch to any clock rate. Find maximum clock-latency-ns from the OPP
table to service requests from such users.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Add support to parse "operating-points-v2" bindings
Viresh Kumar [Wed, 29 Jul 2015 10:53:02 +0000 (16:23 +0530)]
PM / OPP: Add support to parse "operating-points-v2" bindings

This adds support in OPP library to parse and create list of OPPs from
operating-points-v2 bindings. It takes care of most of the properties of
new bindings (except shared-opp, which will be handled separately).

For backward compatibility, we keep supporting earlier bindings. We try
to search for the new bindings first, in case they aren't present we
look for the old deprecated ones.

There are few things marked as TODO:
- Support for multiple OPP tables
- Support for multiple regulators

They should be fixed separately.

Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Break _opp_add_dynamic() into smaller functions
Viresh Kumar [Wed, 29 Jul 2015 10:53:01 +0000 (16:23 +0530)]
PM / OPP: Break _opp_add_dynamic() into smaller functions

Later commits would add support for new OPP bindings and this would be
required then. So, lets do it in a separate patch to make it easily
reviewable.

Another change worth noticing is INIT_LIST_HEAD(&opp->node). We weren't
doing it earlier as we never tried to delete a list node before it is
added to list. But this wouldn't be the case anymore. We might try to
delete a node (just to reuse the same code paths), without it being
getting added to the list.

Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Allocate dev_opp from _add_device_opp()
Viresh Kumar [Wed, 29 Jul 2015 10:53:00 +0000 (16:23 +0530)]
PM / OPP: Allocate dev_opp from _add_device_opp()

There is no need to complicate _opp_add_dynamic() with allocation of
dev_opp as well. Allocate it from _add_device_opp() instead.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Create _remove_device_opp() for freeing dev_opp
Viresh Kumar [Wed, 29 Jul 2015 10:52:59 +0000 (16:22 +0530)]
PM / OPP: Create _remove_device_opp() for freeing dev_opp

This will be used from multiple places later. Lets create a separate
routine for that.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / OPP: Relocate few routines
Viresh Kumar [Wed, 29 Jul 2015 10:52:58 +0000 (16:22 +0530)]
PM / OPP: Relocate few routines

In order to prepare for the later commits, this relocates few routines
towards the top as they will be used earlier in the code.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 years agoPM / devfreq: exynos-bus: Fix build error
Chanwoo Choi [Tue, 8 Aug 2017 11:10:41 +0000 (20:10 +0900)]
PM / devfreq: exynos-bus: Fix build error

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoPM / devfreq: constify attribute_group structures.
Arvind Yadav [Mon, 3 Jul 2017 10:10:04 +0000 (15:40 +0530)]
PM / devfreq: constify attribute_group structures.

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work with const
attribute_group. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
    621     176       0     797     31d drivers/devfreq/governor_userspace.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   670     144       0     814     32e drivers/devfreq/governor_userspace.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
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>