Skip to content

Commit af66646

Browse files
committed
Merge tag 'devfreq-next-for-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux
Merge devfreq updates for v6.7 from Chanwoo Choi: " Detailed description for this pull request: 1. Update devfreq core - Switch to dev_pm_opp_find_freq_(ceil/floor)_indexed() APIs to support the specific device like UFS which handle the multiple clocks through OPP (Operationg Performance Point) framework. 2. Update the devfreq / devfreq-event drivers - Add perf support to the Rockchip DFI(DDR Monitor Module) devfreq-event driver. : Generalize rockchip-dfi.c to support new RK3568/RK3588 using different DDR type. : Covert devicetree bidning document format to yaml. : DFI is a unit which is suitable for measuring DDR utilization for the DDR frequency scaling driver. Add perf support feature to rockchip-dfi.c to extend DFI usage. The perf support has been tested on a RK3568 and a RK3399. - Protect the OPP handling code in critical section because the voltage of shared OPP might be changed by multiple drivers on Mediatek CCI devfreq driver. - Use device_get_match_data() on Samsung Exynos PPMU devfreq-event driver." * tag 'devfreq-next-for-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux: (26 commits) dt-bindings: devfreq: event: rockchip,dfi: Add rk3588 support dt-bindings: devfreq: event: rockchip,dfi: Add rk3568 support dt-bindings: devfreq: event: convert Rockchip DFI binding to yaml PM / devfreq: rockchip-dfi: add support for RK3588 PM / devfreq: rockchip-dfi: account for multiple DDRMON_CTRL registers PM / devfreq: rockchip-dfi: make register stride SoC specific PM / devfreq: rockchip-dfi: Add perf support PM / devfreq: rockchip-dfi: give variable a better name PM / devfreq: rockchip-dfi: Prepare for multiple users PM / devfreq: rockchip-dfi: Pass private data struct to internal functions PM / devfreq: rockchip-dfi: Handle LPDDR4X PM / devfreq: rockchip-dfi: Handle LPDDR2 correctly PM / devfreq: rockchip-dfi: Add RK3568 support PM / devfreq: rockchip-dfi: Clean up DDR type register defines PM / devfreq: rk3399_dmc,dfi: generalize DDRTYPE defines PM / devfreq: rockchip-dfi: introduce channel mask PM / devfreq: rockchip-dfi: Use free running counter PM / devfreq: mediatek: unlock on error in mtk_ccifreq_target() PM / devfreq: exynos-ppmu: Use device_get_match_data() PM / devfreq: rockchip-dfi: dfi store raw values in counter struct ...
2 parents 05d3ef8 + 8f0cd53 commit af66646

File tree

12 files changed

+854
-158
lines changed

12 files changed

+854
-158
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/devfreq/event/rockchip,dfi.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Rockchip DFI
8+
9+
maintainers:
10+
- Sascha Hauer <[email protected]>
11+
12+
properties:
13+
compatible:
14+
enum:
15+
- rockchip,rk3399-dfi
16+
- rockchip,rk3568-dfi
17+
- rockchip,rk3588-dfi
18+
19+
clocks:
20+
maxItems: 1
21+
22+
clock-names:
23+
items:
24+
- const: pclk_ddr_mon
25+
26+
interrupts:
27+
minItems: 1
28+
maxItems: 4
29+
30+
reg:
31+
maxItems: 1
32+
33+
rockchip,pmu:
34+
$ref: /schemas/types.yaml#/definitions/phandle
35+
description:
36+
Phandle to the syscon managing the "PMU general register files".
37+
38+
required:
39+
- compatible
40+
- interrupts
41+
- reg
42+
43+
if:
44+
properties:
45+
compatible:
46+
contains:
47+
enum:
48+
- rockchip,rk3399-dfi
49+
50+
then:
51+
required:
52+
- clocks
53+
- clock-names
54+
55+
additionalProperties: false
56+
57+
examples:
58+
- |
59+
#include <dt-bindings/interrupt-controller/arm-gic.h>
60+
#include <dt-bindings/clock/rk3308-cru.h>
61+
62+
bus {
63+
#address-cells = <2>;
64+
#size-cells = <2>;
65+
66+
dfi: dfi@ff630000 {
67+
compatible = "rockchip,rk3399-dfi";
68+
reg = <0x00 0xff630000 0x00 0x4000>;
69+
interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH 0>;
70+
rockchip,pmu = <&pmugrf>;
71+
clocks = <&cru PCLK_DDR_MON>;
72+
clock-names = "pclk_ddr_mon";
73+
};
74+
};

Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

Documentation/devicetree/bindings/memory-controllers/rockchip,rk3399-dmc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ properties:
1818
$ref: /schemas/types.yaml#/definitions/phandle
1919
description:
2020
Node to get DDR loading. Refer to
21-
Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt.
21+
Documentation/devicetree/bindings/devfreq/event/rockchip,dfi.yaml.
2222

2323
clocks:
2424
maxItems: 1

drivers/devfreq/devfreq.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static unsigned long find_available_min_freq(struct devfreq *devfreq)
8888
struct dev_pm_opp *opp;
8989
unsigned long min_freq = 0;
9090

91-
opp = dev_pm_opp_find_freq_ceil(devfreq->dev.parent, &min_freq);
91+
opp = dev_pm_opp_find_freq_ceil_indexed(devfreq->dev.parent, &min_freq, 0);
9292
if (IS_ERR(opp))
9393
min_freq = 0;
9494
else
@@ -102,7 +102,7 @@ static unsigned long find_available_max_freq(struct devfreq *devfreq)
102102
struct dev_pm_opp *opp;
103103
unsigned long max_freq = ULONG_MAX;
104104

105-
opp = dev_pm_opp_find_freq_floor(devfreq->dev.parent, &max_freq);
105+
opp = dev_pm_opp_find_freq_floor_indexed(devfreq->dev.parent, &max_freq, 0);
106106
if (IS_ERR(opp))
107107
max_freq = 0;
108108
else
@@ -196,7 +196,7 @@ static int set_freq_table(struct devfreq *devfreq)
196196
return -ENOMEM;
197197

198198
for (i = 0, freq = 0; i < devfreq->max_state; i++, freq++) {
199-
opp = dev_pm_opp_find_freq_ceil(devfreq->dev.parent, &freq);
199+
opp = dev_pm_opp_find_freq_ceil_indexed(devfreq->dev.parent, &freq, 0);
200200
if (IS_ERR(opp)) {
201201
devm_kfree(devfreq->dev.parent, devfreq->freq_table);
202202
return PTR_ERR(opp);
@@ -2036,18 +2036,18 @@ struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
20362036

20372037
if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) {
20382038
/* The freq is an upper bound. opp should be lower */
2039-
opp = dev_pm_opp_find_freq_floor(dev, freq);
2039+
opp = dev_pm_opp_find_freq_floor_indexed(dev, freq, 0);
20402040

20412041
/* If not available, use the closest opp */
20422042
if (opp == ERR_PTR(-ERANGE))
2043-
opp = dev_pm_opp_find_freq_ceil(dev, freq);
2043+
opp = dev_pm_opp_find_freq_ceil_indexed(dev, freq, 0);
20442044
} else {
20452045
/* The freq is an lower bound. opp should be higher */
2046-
opp = dev_pm_opp_find_freq_ceil(dev, freq);
2046+
opp = dev_pm_opp_find_freq_ceil_indexed(dev, freq, 0);
20472047

20482048
/* If not available, use the closest opp */
20492049
if (opp == ERR_PTR(-ERANGE))
2050-
opp = dev_pm_opp_find_freq_floor(dev, freq);
2050+
opp = dev_pm_opp_find_freq_floor_indexed(dev, freq, 0);
20512051
}
20522052

20532053
return opp;

drivers/devfreq/event/exynos-ppmu.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#include <linux/io.h>
1313
#include <linux/kernel.h>
1414
#include <linux/module.h>
15-
#include <linux/of_address.h>
16-
#include <linux/of_device.h>
15+
#include <linux/of.h>
1716
#include <linux/platform_device.h>
17+
#include <linux/property.h>
1818
#include <linux/regmap.h>
1919
#include <linux/suspend.h>
2020
#include <linux/devfreq-event.h>
@@ -507,7 +507,6 @@ static int of_get_devfreq_events(struct device_node *np,
507507
struct device *dev = info->dev;
508508
struct device_node *events_np, *node;
509509
int i, j, count;
510-
const struct of_device_id *of_id;
511510
int ret;
512511

513512
events_np = of_get_child_by_name(np, "events");
@@ -525,13 +524,7 @@ static int of_get_devfreq_events(struct device_node *np,
525524
}
526525
info->num_events = count;
527526

528-
of_id = of_match_device(exynos_ppmu_id_match, dev);
529-
if (of_id)
530-
info->ppmu_type = (enum exynos_ppmu_type)of_id->data;
531-
else {
532-
of_node_put(events_np);
533-
return -EINVAL;
534-
}
527+
info->ppmu_type = (enum exynos_ppmu_type)device_get_match_data(dev);
535528

536529
j = 0;
537530
for_each_child_of_node(events_np, node) {

0 commit comments

Comments
 (0)