Skip to content

Commit bc6f492

Browse files
committed
Merge tag 'devfreq-next-for-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux
Pull devfreq material for v5.14 from Chanwoo Choi: 1. Update devfreq core - Use DEVICE_ATTR_RW macro for devfreq userspace governor. - Add missing error code in devfreq_add_device(). - Fix get_target_freq() when not using required-opp. 2. Update devfreq drivers - Remove unneeded get_dev_status() and polling_ms from imx-bus.c, because imx-bus.c doesn't support simple_ondemand. - Remove unneeded DEVFREQ_GOV_SIMPLE_ONDEMAND dependecy from imx8m-ddrc.c, because it doesn't support the simple_ondemand governor. - Use tegra30-devfreq.c as thermal cooling device. - Convert dt-binding doc style to yaml and add cooling-cells property information to dt-binding doc for tegra30-devfreq.c. * tag 'devfreq-next-for-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux: PM / devfreq: passive: Fix get_target_freq when not using required-opp dt-bindings: devfreq: tegra30-actmon: Add cooling-cells dt-bindings: devfreq: tegra30-actmon: Convert to schema PM / devfreq: userspace: Use DEVICE_ATTR_RW macro PM / devfreq: imx8m-ddrc: Remove DEVFREQ_GOV_SIMPLE_ONDEMAND dependency PM / devfreq: tegra30: Support thermal cooling PM / devfreq: imx-bus: Remove imx_bus_get_dev_status PM / devfreq: Add missing error code in devfreq_add_device()
2 parents 13311e7 + 8c37d01 commit bc6f492

File tree

8 files changed

+135
-78
lines changed

8 files changed

+135
-78
lines changed

Documentation/devicetree/bindings/arm/tegra/nvidia,tegra30-actmon.txt

Lines changed: 0 additions & 57 deletions
This file was deleted.
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/devfreq/nvidia,tegra30-actmon.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: NVIDIA Tegra30 Activity Monitor
8+
9+
maintainers:
10+
- Dmitry Osipenko <[email protected]>
11+
- Jon Hunter <[email protected]>
12+
- Thierry Reding <[email protected]>
13+
14+
description: |
15+
The activity monitor block collects statistics about the behaviour of other
16+
components in the system. This information can be used to derive the rate at
17+
which the external memory needs to be clocked in order to serve all requests
18+
from the monitored clients.
19+
20+
properties:
21+
compatible:
22+
enum:
23+
- nvidia,tegra30-actmon
24+
- nvidia,tegra114-actmon
25+
- nvidia,tegra124-actmon
26+
- nvidia,tegra210-actmon
27+
28+
reg:
29+
maxItems: 1
30+
31+
clocks:
32+
maxItems: 2
33+
34+
clock-names:
35+
items:
36+
- const: actmon
37+
- const: emc
38+
39+
resets:
40+
maxItems: 1
41+
42+
reset-names:
43+
items:
44+
- const: actmon
45+
46+
interrupts:
47+
maxItems: 1
48+
49+
interconnects:
50+
minItems: 1
51+
maxItems: 12
52+
53+
interconnect-names:
54+
minItems: 1
55+
maxItems: 12
56+
description:
57+
Should include name of the interconnect path for each interconnect
58+
entry. Consult TRM documentation for information about available
59+
memory clients, see MEMORY CONTROLLER and ACTIVITY MONITOR sections.
60+
61+
operating-points-v2:
62+
description:
63+
Should contain freqs and voltages and opp-supported-hw property, which
64+
is a bitfield indicating SoC speedo ID mask.
65+
66+
"#cooling-cells":
67+
const: 2
68+
69+
required:
70+
- compatible
71+
- reg
72+
- clocks
73+
- clock-names
74+
- resets
75+
- reset-names
76+
- interrupts
77+
- interconnects
78+
- interconnect-names
79+
- operating-points-v2
80+
- "#cooling-cells"
81+
82+
additionalProperties: false
83+
84+
examples:
85+
- |
86+
#include <dt-bindings/memory/tegra30-mc.h>
87+
88+
mc: memory-controller@7000f000 {
89+
compatible = "nvidia,tegra30-mc";
90+
reg = <0x7000f000 0x400>;
91+
clocks = <&clk 32>;
92+
clock-names = "mc";
93+
94+
interrupts = <0 77 4>;
95+
96+
#iommu-cells = <1>;
97+
#reset-cells = <1>;
98+
#interconnect-cells = <1>;
99+
};
100+
101+
emc: external-memory-controller@7000f400 {
102+
compatible = "nvidia,tegra30-emc";
103+
reg = <0x7000f400 0x400>;
104+
interrupts = <0 78 4>;
105+
clocks = <&clk 57>;
106+
107+
nvidia,memory-controller = <&mc>;
108+
operating-points-v2 = <&dvfs_opp_table>;
109+
power-domains = <&domain>;
110+
111+
#interconnect-cells = <0>;
112+
};
113+
114+
actmon@6000c800 {
115+
compatible = "nvidia,tegra30-actmon";
116+
reg = <0x6000c800 0x400>;
117+
interrupts = <0 45 4>;
118+
clocks = <&clk 119>, <&clk 57>;
119+
clock-names = "actmon", "emc";
120+
resets = <&rst 119>;
121+
reset-names = "actmon";
122+
operating-points-v2 = <&dvfs_opp_table>;
123+
interconnects = <&mc TEGRA30_MC_MPCORER &emc>;
124+
interconnect-names = "cpu-read";
125+
#cooling-cells = <2>;
126+
};

drivers/devfreq/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ config ARM_IMX8M_DDRC_DEVFREQ
103103
tristate "i.MX8M DDRC DEVFREQ Driver"
104104
depends on (ARCH_MXC && HAVE_ARM_SMCCC) || \
105105
(COMPILE_TEST && HAVE_ARM_SMCCC)
106-
select DEVFREQ_GOV_SIMPLE_ONDEMAND
107106
select DEVFREQ_GOV_USERSPACE
108107
help
109108
This adds the DEVFREQ driver for the i.MX8M DDR Controller. It allows

drivers/devfreq/devfreq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
823823
if (devfreq->profile->timer < 0
824824
|| devfreq->profile->timer >= DEVFREQ_TIMER_NUM) {
825825
mutex_unlock(&devfreq->lock);
826+
err = -EINVAL;
826827
goto err_dev;
827828
}
828829

drivers/devfreq/governor_passive.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,15 @@ static int devfreq_passive_get_target_freq(struct devfreq *devfreq,
6565
dev_pm_opp_put(p_opp);
6666

6767
if (IS_ERR(opp))
68-
return PTR_ERR(opp);
68+
goto no_required_opp;
6969

7070
*freq = dev_pm_opp_get_freq(opp);
7171
dev_pm_opp_put(opp);
7272

7373
return 0;
7474
}
7575

76+
no_required_opp:
7677
/*
7778
* Get the OPP table's index of decided frequency by governor
7879
* of parent device.

drivers/devfreq/governor_userspace.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ static int devfreq_userspace_func(struct devfreq *df, unsigned long *freq)
3131
return 0;
3232
}
3333

34-
static ssize_t store_freq(struct device *dev, struct device_attribute *attr,
35-
const char *buf, size_t count)
34+
static ssize_t set_freq_store(struct device *dev, struct device_attribute *attr,
35+
const char *buf, size_t count)
3636
{
3737
struct devfreq *devfreq = to_devfreq(dev);
3838
struct userspace_data *data;
@@ -52,8 +52,8 @@ static ssize_t store_freq(struct device *dev, struct device_attribute *attr,
5252
return err;
5353
}
5454

55-
static ssize_t show_freq(struct device *dev, struct device_attribute *attr,
56-
char *buf)
55+
static ssize_t set_freq_show(struct device *dev,
56+
struct device_attribute *attr, char *buf)
5757
{
5858
struct devfreq *devfreq = to_devfreq(dev);
5959
struct userspace_data *data;
@@ -70,7 +70,7 @@ static ssize_t show_freq(struct device *dev, struct device_attribute *attr,
7070
return err;
7171
}
7272

73-
static DEVICE_ATTR(set_freq, 0644, show_freq, store_freq);
73+
static DEVICE_ATTR_RW(set_freq);
7474
static struct attribute *dev_entries[] = {
7575
&dev_attr_set_freq.attr,
7676
NULL,

drivers/devfreq/imx-bus.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,6 @@ static int imx_bus_get_cur_freq(struct device *dev, unsigned long *freq)
4545
return 0;
4646
}
4747

48-
static int imx_bus_get_dev_status(struct device *dev,
49-
struct devfreq_dev_status *stat)
50-
{
51-
struct imx_bus *priv = dev_get_drvdata(dev);
52-
53-
stat->busy_time = 0;
54-
stat->total_time = 0;
55-
stat->current_frequency = clk_get_rate(priv->clk);
56-
57-
return 0;
58-
}
59-
6048
static void imx_bus_exit(struct device *dev)
6149
{
6250
struct imx_bus *priv = dev_get_drvdata(dev);
@@ -129,9 +117,7 @@ static int imx_bus_probe(struct platform_device *pdev)
129117
return ret;
130118
}
131119

132-
priv->profile.polling_ms = 1000;
133120
priv->profile.target = imx_bus_target;
134-
priv->profile.get_dev_status = imx_bus_get_dev_status;
135121
priv->profile.exit = imx_bus_exit;
136122
priv->profile.get_cur_freq = imx_bus_get_cur_freq;
137123
priv->profile.initial_freq = clk_get_rate(priv->clk);

drivers/devfreq/tegra30-devfreq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ static struct devfreq_dev_profile tegra_devfreq_profile = {
688688
.polling_ms = ACTMON_SAMPLING_PERIOD,
689689
.target = tegra_devfreq_target,
690690
.get_dev_status = tegra_devfreq_get_dev_status,
691+
.is_cooling_device = true,
691692
};
692693

693694
static int tegra_governor_get_target(struct devfreq *devfreq,

0 commit comments

Comments
 (0)