Commit Graph

615620 Commits

Author SHA1 Message Date
Xing Zheng
984af25ece ASoC: rk3308_codec: add some delay to wait micbias is stable
To avoid bring some noise dues to unstable micbias.

Change-Id: I0127505f0adeacda5d852ae3cefae2fb5f4ee9d2
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
2019-04-01 10:05:29 +08:00
Wyon Bi
4c520eca72 drm/rockchip: cdn-dp: Fix bus format setting
Change-Id: Id54d3dcf00dc1d535783674d3a57309469d279f3
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-03-29 14:17:53 +08:00
Xiaotan Luo
1d1098b342 arch: rockchip: dts: update PCM format from dsp_b to dsp_a
rockchip_i2s.c driver update the DSP_A & DSP_B config,
so we update the dts config.

Change-Id: Ida013540f263d082e20d65a43c3de932aca9f906
Signed-off-by: Xiaotan Luo <lxt@rock-chips.com>
2019-03-29 11:28:01 +08:00
Xiaotan Luo
acdf3e94ad ASoC: rockchip: i2s: fixed PCM DSP format
DSP_A: PCM delay 1 bit mode,L data MSB after FRM LRC
DSP_B: PCM no delay mode,L data MSB during FRM LRC

Change-Id: I198519c431815de3ca1fc154da78773ca705f0e0
Signed-off-by: Xiaotan Luo <lxt@rock-chips.com>
2019-03-29 11:26:36 +08:00
Elaine Zhang
534369dc33 clk: rockchip: rk3036: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: Ic60f491d549e030490c14ea78f4857a8cead596d
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-29 09:09:21 +08:00
Elaine Zhang
311c96cb28 clk: rockchip: rk3128: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: I7f9bc78deef60b1fa48bada5b1a6203185ddce48
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-29 09:09:21 +08:00
Elaine Zhang
cc07bb20b3 clk: rockchip: rv1108: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: Ic4efc985892cbcc5e561203fe8e00dba116439e7
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-29 09:09:21 +08:00
Elaine Zhang
03aca6529a clk: rockchip: rk3228: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: Ide2c3e8add083934672f6d22d8182bcfde046783
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-29 09:09:21 +08:00
Elaine Zhang
5210dded8f clk: rockchip: rk3288: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: I86ff4f12ed932431d131d22a307360418e2e9f40
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-29 09:09:21 +08:00
Elaine Zhang
ce80bc232d clk: rockchip: rk3368: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: I3aeeeb7f7b9240c917c18bc2d36b082003dc6370
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-29 09:09:21 +08:00
Frank Wang
07ebc201ba ARM: dts: amend rk322x-usb2phy to rk3228-usb2phy
Change-Id: If47746bf2bc1736c5c9e891829c1013c2449e1f4
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-28 19:06:34 +08:00
Frank Wang
35b8b481b8 dt-bindings: phy-rockchip-inno-usb2: amend rk322x to rk3228
Amend rk322x-usb2phy to rk3228-usb2phy, to keep consistent with
Upstream codes.

Change-Id: I8b97856c25ce61e9d8565f6c8653938e7465e4d4
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-28 19:06:34 +08:00
Frank Wang
9691e69344 phy: rockchip-inno-usb2: format rk3228 chip name
Format rk3228 chip name, to keep consistent with Upstream codes.

Change-Id: I3b49b18257485661570086be0898bdcbd016808a
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-28 19:06:34 +08:00
Frank Wang
4ca50547e8 UPSTREAM: phy: rockchip-inno-usb2: add support of usb2-phy for rv1108 SoCs
This adds support usb2-phy for rv1108 SoCs and amend phy Documentation.

Change-Id: Ib1598bf9ec25adefad798a9fe579d38007e91a39
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit fc938810d9)
2019-03-28 19:06:34 +08:00
Frank Wang
38e24d2123 UPSTREAM: dt-bindings: phy-rockchip-inno-usb2: add otg-mux interrupt
Add otg-mux property to support multiplexed interrupt in otg-port
on some Rockchip SoC (e.g RV1108).

Change-Id: I93a0d38aec9a13a7b5677d34fe87ea7330e0c2d9
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit 9c1712d5ce)
2019-03-28 19:06:34 +08:00
Frank Wang
cf46645948 UPSTREAM: phy: rockchip-inno-usb2: add support for otg-mux interrupt
The otg-id/otg-bvalid/linestate interrupts are multiplexed together
in otg-port on some Rockchip SoC (e.g RV1108), this patch add support
for it.

Change-Id: If1a29c950fe25a8ca4873fcd3d2d4fcbb504da95
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit 0983e2abc8)
2019-03-28 19:06:34 +08:00
Frank Wang
66817afa8a UPSTREAM: dt-bindings: phy-rockchip-inno-usb2: add rockchip,usbgrf property
Add rockchip,usbgrf property to support the registers of usb-phy
that are distributed in grf and usbgrf on some special Rockchip
SoCs (e.g RV1108).

Change-Id: Ifcec36474e6828ee90009a47dceca6174c76f45d
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit c7527e07f0)
2019-03-28 19:06:34 +08:00
Frank Wang
f646d95a5b UPSTREAM: phy: rockchip-inno-usb2: add support for rockchip,usbgrf property
The registers of usb-phy are distributed in grf and usbgrf on some
Rockchip SoCs (e.g RV1108), this patch add a new rockchip,usbgrf
property to support this companion grf design.

Change-Id: If66c03426d4ad63b285fa7132ae20ee10be1d627
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit 1543645c31)
2019-03-28 19:06:34 +08:00
Zhen Chen
5cf27d0b60 Mali: midgard: changes to enlarge BASE_JD_ATOM_COUNT to 512, for defect 184210
The source code of mali_so must be modified correspondingly.

Change-Id: I3f4bd03fa2d369d912e6bc05c53d2d3abefb92d3
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-03-28 18:03:39 +08:00
Hu Kejun
ba2207c20b media: i2c: add imx317 driver
Change-Id: Ic4d272ee4e34aad4fee1c6213ea50ed6ed0f6f7f
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-03-28 15:06:50 +08:00
Lin Jianhua
5d6cdac108 arm: dts: rockchip: rk3308-dot-rk816: enable uboot charge mode
Change-Id: Ia2262a1855f5f97f224f22a0125adeee28568e09
Signed-off-by: Lin Jianhua <linjh@rock-chips.com>
2019-03-28 15:06:16 +08:00
Matthias Kaehlcke
7d6f699ff3 UPSTREAM: PM / devfreq: Don't adjust to user limits in governors
Several governors use the user space limits df->min/max_freq to adjust
the target frequency. This is not necessary, since update_devfreq()
already takes care of this. Instead the governor can request the available
min/max frequency by setting the target frequency to DEVFREQ_MIN/MAX_FREQ
and let update_devfreq() take care of any adjustments.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit 6ff66e2a00)

Conflicts:
	drivers/devfreq/governor.h

Change-Id: Ide444eaf2a0d7c5f20d8521786749e8dbb1b1632
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Matthias Kaehlcke
638f27a59e UPSTREAM: PM / devfreq: Fix handling of min/max_freq == 0
Commit ab8f58ad72 ("PM / devfreq: Set min/max_freq when adding the
devfreq device") initializes df->min/max_freq with the min/max OPP when
the device is added. Later commit f1d981eaec ("PM / devfreq: Use the
available min/max frequency") adds df->scaling_min/max_freq and the
following to the frequency adjustment code:

  max_freq = MIN(devfreq->scaling_max_freq, devfreq->max_freq);

With the current handling of min/max_freq this is incorrect:

Even though df->max_freq is now initialized to a value != 0 user space
can still set it to 0, in this case max_freq would be 0 instead of
df->scaling_max_freq as intended. In consequence the frequency adjustment
is not performed:

  if (max_freq && freq > max_freq) {
	freq = max_freq;

To fix this set df->min/max freq to the min/max OPP in max/max_freq_store,
when the user passes a value of 0. This also prevents df->max_freq from
being set below the min OPP when df->min_freq is 0, and similar for
min_freq. Since it is now guaranteed that df->min/max_freq can't be 0 the
checks for this case can be removed.

Fixes: f1d981eaec ("PM / devfreq: Use the available min/max frequency")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit df5cf4a361)

Change-Id: Ib8e2def7d3bf605dba81cf75bab89a23a39ca6f3
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Bjorn Andersson
f1be83ba38 UPSTREAM: PM / devfreq: Drop custom MIN/MAX macros
Drop the custom MIN/MAX macros in favour of the standard min/max from
kernel.h

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit d0e464205b)

Change-Id: I15d97eb81276cef6a440449e7db62d866e5b7e26
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Matthias Kaehlcke
e4bc938072 UPSTREAM: PM / devfreq: Init user limits from OPP limits, not viceversa
Commit ab8f58ad72 ("PM / devfreq: Set min/max_freq when adding
the devfreq device") introduced the initialization of the user
limits min/max_freq from the lowest/highest available OPPs. Later
commit f1d981eaec ("PM / devfreq: Use the available min/max
frequency") added scaling_min/max_freq, which actually represent
the frequencies of the lowest/highest available OPP. scaling_min/
max_freq are initialized with the values from min/max_freq, which
is totally correct in the context, but a bit awkward to read.

Swap the initialization and assign scaling_min/max_freq with the
OPP freqs and then the user limts min/max_freq with scaling_min/
max_freq.

Needless to say that this change is a NOP, intended to improve
readability.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit 2c2cb1e6b0)

Change-Id: I002271f08a076d89c44305ef8c8d5d06cb9818cf
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Arvind Yadav
733ad67627 UPSTREAM: PM / devfreq: use put_device() instead of kfree()
Never directly free @dev after calling device_register() or
device_unregister(), even if device_register() returned an error.
Always use put_device() to give up the reference initialized.

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>
(cherry picked from commit 2d803dc8f7)

Change-Id: Ida1b076e7207854dc8567a3a635e1a638a5789c7
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Gustavo A. R. Silva
fb22d5a078 UPSTREAM: PM / devfreq: Fix potential NULL pointer dereference in governor_store
df->governor is being dereferenced before it is null checked,
hence there is a potential null pointer dereference.

Notice that df->governor is being null checked at line 1004:
if (df->governor) {, which implies it might be null.

Fix this by null checking df->governor before dereferencing it.

Addresses-Coverity-ID: 1401988 ("Dereference before null check")
Fixes: bcf23c79c4 ("PM / devfreq: Fix available_governor sysfs")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit 63f1e05f7f)

Change-Id: I9f30f3bb6e1f6b4342c63e505d48103c752b9b28
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
b19a778913 UPSTREAM: PM / devfreq: Remove unneeded conditional statement
The freq_table array of each devfreq device is always not NULL.
In result, it is unneeded to check whether profile->freq_table
is NULL or not.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit ccc4c3bcbb)

Change-Id: I1efaeec81f6b65c920b57e3d0e7051c5d6d7299b
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
50a615e028 BACKPORT: PM / devfreq: Show the all available frequencies
The commit a76caf55e5 ("thermal: Add devfreq cooling") allows
the devfreq device to use the cooling device. When the cooling down
are required, the devfreq_cooling.c disables the OPP entry with
the dev_pm_opp_disable(). In result, 'available_frequencies'[1]
sysfs node never came to show the all available frequencies.
[1] /sys/class/devfreq/.../available_frequencies

So, this patch uses the 'freq_table' in the 'struct devfreq_dev_profile'
in order to show the all available frequencies.
- If 'freq_table' is NULL, devfreq core initializes them by using OPP values.
- If 'freq_table' is initialized, devfreq core just uses the 'freq_table'.

And this patch adds some comment about the sort way of 'freq_table'.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit 416b46a262)

Conflicts:
	drivers/devfreq/devfreq.c

Change-Id: I87c7f1d241032f203a300944cd2d5db4532bf8dc
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
043afc11d8 BACKPORT: PM / devfreq: Change return type of devfreq_set_freq_table()
This patch changes the return type of devfreq_set_freq_table()
from 'void' to 'int' in order to check whether it fails or not.

And This patch just removes the 'devfreq' prefix and the description
of function. Because the helper functions are only used by the devfreq.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit ea572f8160)

Conflicts:
	drivers/devfreq/devfreq.c

Change-Id: I74aa57cda55ae6f4fe92a3e1a4e8d0fa6d9bb70a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
95ead85c3b UPSTREAM: PM / devfreq: Use the available min/max frequency
The commit a76caf55e5 ("thermal: Add devfreq cooling") is able
to disable OPP as a cooling device. In result, both update_devfreq()
and {min|max}_freq_show() have to consider the 'opp->available'
status of each OPP.

So, this patch adds the 'scaling_{min|max}_freq' to struct devfreq
in order to indicate the available mininum and maximum frequency
by adjusting OPP interface such as dev_pm_opp_{disable|enable}().
The 'scaling_{min|max}_freq' are used for on both update_devfreq()
and {min|max}_freq_show().

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit f1d981eaec)

Change-Id: I8cd8ac51268758c8d33e73298e8e1e350011c66c
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
d9c63e0c4c BACKPORT: PM / devfreq: Set min/max_freq when adding the devfreq device
Prior to that, the min/max_freq of the devfreq device are always zero
before the user changes the min/max_freq through sysfs entries.
It might make the confusion for the min/max_freq.

This patch initializes the available min/max_freq by using the OPP
during adding the devfreq device.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit ab8f58ad72)

Conflicts:
      drivers/devfreq/devfreq.c
        place dev_pm_opp_find_freq_floor/ceil() inside rcu_read_lock/unlock()
        instead of releasing the OPP with dev_pm_opp_put(), which was introduced
        later.

Change-Id: I98689db4823d93e7689182bc0c5909695a3d4841
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
ff50c9c922 UPSTREAM: 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).

Cc: stable@vger.kernel.org
Fixes: ac4b281176 ("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>
(cherry picked from commit 9e14de1077)

Change-Id: I79f0ab2e7f407a28258a9d5448826937514c4cb9
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
6ad71024b9 UPSTREAM: 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>
(cherry picked from commit 29b6968b05)

Change-Id: I5d5b4cc6fcaed5003a05cb5b164322910958eefb
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
9bec3ceb7a UPSTREAM: 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: 996133119f ("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>
(cherry picked from commit 30582c25a4)

Conflicts:
	drivers/devfreq/governor_passive.c

Change-Id: I20522ecf5e397bf0ee2274a95fa41af12ca40515
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
dd540e5f2d UPSTREAM: 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: 996133119f ("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>
(cherry picked from commit bcf23c79c4)

Conflicts:
	drivers/devfreq/governor_passive.c

Change-Id: I70b888c018eb624f3ef5b500381ad1d227712352
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
fc4bd8b342 UPSTREAM: 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>
(cherry picked from commit 9d0109be48)

Change-Id: I0c50b27b909d1b0779b245bfa0a264820cd595a9
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Viresh Kumar
8bc82dbbf9 UPSTREAM: PM / OPP: Don't expose srcu_head to register notifiers
Let the OPP core provide helpers to register notifiers for any device,
instead of exposing srcu_head outside of the core.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit dc2c9ad52a)

Conflicts:
	include/linux/pm_opp.h

Change-Id: I7ee3645be8b4f855a89833fbb9d37cad5d7bb4f4
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
c5fd4234c7 UPSTREAM: 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: 1b5c1be2c8 (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>
(cherry picked from commit 73613b16cb)

Change-Id: I78346499677ab55dc35341f6b9ef0569699f7261
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
MyungJoo Ham
799eb9bfa2 UPSTREAM: 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>
(cherry picked from commit bafeb42bd8)

Change-Id: Ifd1f0c68c49acec5227a1a803824e72fe5227ac5
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Tobias Jakobi
71d498ce3a UPSTREAM: 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>
(cherry picked from commit d0563a039c)

Change-Id: Ie5cb810ec30d816a234c9ad6160be120ee755d4d
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Axel Lin
c30b838b6e UPSTREAM: 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>
(cherry picked from commit 0f376c9cd8)

Change-Id: Id81fb28b982a5c6e08c163948365e11aff1d86b9
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Paul Gortmaker
265b567fad UPSTREAM: 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>
(cherry picked from commit 417dc4bb6b)

Change-Id: Ia691d91eaee8a04700d9c8e5c9340cc85175cd3a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Lukasz Luba
a24e7b7f89 UPSTREAM: 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>
(cherry picked from commit 8d39fc085d)

Change-Id: I81f1addcd483df1d23f2cde0cf671494a37e64f3
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
MyungJoo Ham
13212d4532 UPSTREAM: 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>
(cherry picked from commit 67ffdb529b)

Change-Id: Id1398a975f208f1942d4b1b1503e5255379f41cc
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Cai Zhiyong
5f1cab9d14 UPSTREAM: 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>
(cherry picked from commit a5e9b937fa)

Change-Id: I5c835132c5df339ccc54d5c979527f2ab4b10b25
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
MyungJoo Ham
633c4ee859 UPSTREAM: PM / devfreq: fix duplicated kfree on devfreq pointer
device_unregister() calls kfree already.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit ac4b281176)

Change-Id: Id86a63c8c85e40b290f6ad72c3c273da835f6b52
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
MyungJoo Ham
5166a7f5e4 UPSTREAM: 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>
(cherry picked from commit 3e1d7fb0d2)

Change-Id: I657d7d43e6b7e82cce1c57267ee81b0ab45c0965
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
MyungJoo Ham
5809cdffe4 UPSTREAM: 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>
(cherry picked from commit 34bd322070)

Change-Id: Iae8a0e839cdd9b6d2e1c5c1332d85796b928f535
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00
Chanwoo Choi
33233041f0 UPSTREAM: 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>
(cherry picked from commit d7df1e4647)

Change-Id: I76a9b61a3b46b43584056d8e5e8ae052c00d5361
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-03-28 14:53:57 +08:00