Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
Merge pull request torvalds#166 from Radxa-Alvin/linux-5.10-gen-rkr4.1
Browse files Browse the repository at this point in the history
Adjust opp-table for rk356x-t.

Signed-off-by: Stephen Chen <[email protected]>
  • Loading branch information
RadxaStephen authored Jul 26, 2023
2 parents 6323681 + e73d650 commit 769be3c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 6 deletions.
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/rockchip/rk3566-radxa-zero-3w.dts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
regulator-name = "vdd_cpu";
regulator-min-microvolt = <712500>;
regulator-max-microvolt = <1390000>;
regulator-init-microvolt = <900000>;
regulator-init-microvolt = <1000000>;
regulator-ramp-delay = <2300>;
fcs,suspend-voltage-selector = <1>;
regulator-boot-on;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/rockchip/rk3566-rock-3c.dts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
regulator-name = "vdd_cpu";
regulator-min-microvolt = <712500>;
regulator-max-microvolt = <1390000>;
regulator-init-microvolt = <900000>;
regulator-init-microvolt = <1000000>;
regulator-ramp-delay = <2300>;
fcs,suspend-voltage-selector = <1>;
regulator-boot-on;
Expand Down
19 changes: 15 additions & 4 deletions arch/arm64/boot/dts/rockchip/rk3568.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,19 @@
opp-408000000 {
opp-hz = /bits/ 64 <408000000>;
opp-microvolt = <850000 850000 1150000>;
opp-microvolt-L3 = <900000 900000 1150000>;
clock-latency-ns = <40000>;
};
opp-600000000 {
opp-hz = /bits/ 64 <600000000>;
opp-microvolt = <850000 850000 1150000>;
opp-microvolt-L3 = <900000 900000 1150000>;
clock-latency-ns = <40000>;
};
opp-816000000 {
opp-hz = /bits/ 64 <816000000>;
opp-microvolt = <850000 850000 1150000>;
opp-microvolt-L3 = <900000 900000 1150000>;
clock-latency-ns = <40000>;
opp-suspend;
};
Expand All @@ -188,7 +191,7 @@
opp-microvolt-L0 = <900000 900000 1150000>;
opp-microvolt-L1 = <850000 850000 1150000>;
opp-microvolt-L2 = <850000 850000 1150000>;
opp-microvolt-L3 = <850000 850000 1150000>;
opp-microvolt-L3 = <900000 900000 1150000>;
clock-latency-ns = <40000>;
};
opp-1416000000 {
Expand All @@ -197,7 +200,7 @@
opp-microvolt-L0 = <1025000 1025000 1150000>;
opp-microvolt-L1 = <975000 975000 1150000>;
opp-microvolt-L2 = <950000 950000 1150000>;
opp-microvolt-L3 = <925000 925000 1150000>;
opp-microvolt-L3 = <1000000 1000000 1150000>;
clock-latency-ns = <40000>;
};
opp-1608000000 {
Expand Down Expand Up @@ -240,8 +243,8 @@

cpuinfo {
compatible = "rockchip,cpuinfo";
nvmem-cells = <&otp_id>, <&otp_cpu_version>, <&cpu_code>;
nvmem-cell-names = "id", "cpu-version", "cpu-code";
nvmem-cells = <&otp_id>, <&otp_cpu_version>, <&cpu_code>, <&performance>;
nvmem-cell-names = "id", "cpu-version", "cpu-code", "performance";
};

display_subsystem: display-subsystem {
Expand Down Expand Up @@ -1296,14 +1299,17 @@
opp-200000000 {
opp-hz = /bits/ 64 <200000000>;
opp-microvolt = <850000 850000 1000000>;
opp-microvolt-L3 = <900000 900000 1000000>;
};
opp-300000000 {
opp-hz = /bits/ 64 <300000000>;
opp-microvolt = <850000 850000 1000000>;
opp-microvolt-L3 = <900000 900000 1000000>;
};
opp-400000000 {
opp-hz = /bits/ 64 <400000000>;
opp-microvolt = <850000 850000 1000000>;
opp-microvolt-L3 = <900000 900000 1000000>;
};
opp-600000000 {
opp-hz = /bits/ 64 <600000000>;
Expand Down Expand Up @@ -1553,6 +1559,7 @@
opp-microvolt-L0 = <900000>;
opp-microvolt-L1 = <875000>;
opp-microvolt-L2 = <875000>;
opp-microvolt-L3 = <900000>;
};
opp-400000000 {
opp-hz = /bits/ 64 <400000000>;
Expand Down Expand Up @@ -2722,6 +2729,10 @@
core_pvtm:core-pvtm@2a {
reg = <0x2a 0x2>;
};
performance:performance@22 {
reg = <0x22 0x1>;
bits = <0 4>;
};
cpu_tsadc_trim_l: cpu-tsadc-trim-l@2e {
reg = <0x2e 0x1>;
};
Expand Down
13 changes: 13 additions & 0 deletions drivers/soc/rockchip/rockchip-cpuinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

unsigned long rockchip_soc_id;
EXPORT_SYMBOL(rockchip_soc_id);
extern u32 soc_is_rk3566t;

static int rockchip_cpuinfo_probe(struct platform_device *pdev)
{
Expand Down Expand Up @@ -91,6 +92,18 @@ static int rockchip_cpuinfo_probe(struct platform_device *pdev)
system_serial_high, system_serial_low);
#endif

cell = nvmem_cell_get(dev, "performance");
if (!IS_ERR(cell)) {
efuse_buf = nvmem_cell_read(cell, &len);
nvmem_cell_put(cell);
if (IS_ERR(efuse_buf))
return PTR_ERR(efuse_buf);

soc_is_rk3566t = efuse_buf[0];
dev_info(dev, "soc_is_rk3566t: %08x\n", soc_is_rk3566t);
kfree(efuse_buf);
}

return 0;
}

Expand Down
19 changes: 19 additions & 0 deletions drivers/soc/rockchip/rockchip_opp_select.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ struct otp_opp_info {

static int pvtm_value[PVTM_CH_MAX][PVTM_SUB_CH_MAX];
static int lkg_version;
u32 soc_is_rk3566t;

/*
* temp = temp * 10
Expand Down Expand Up @@ -1322,6 +1323,9 @@ void rockchip_get_scale_volt_sel(struct device *dev, char *lkg_name,
*volt_sel = bin_volt_sel;
else
*volt_sel = max(lkg_volt_sel, pvtm_volt_sel);

if (soc_is_rk3566t)
*volt_sel = 3;
}

of_node_put(np);
Expand Down Expand Up @@ -1605,6 +1609,21 @@ int rockchip_adjust_power_scale(struct device *dev, int scale)
out_np:
of_node_put(np);

if (soc_is_rk3566t) {
if (!strcmp(dev_name(dev), "cpu0")) {
dev_pm_opp_remove(dev, 1608000000);
dev_pm_opp_remove(dev, 1800000000);
dev_pm_opp_remove(dev, 1992000000);
}
if (!strcmp(dev_name(dev), "fde60000.gpu")) {
dev_pm_opp_remove(dev, 600000000);
dev_pm_opp_remove(dev, 700000000);
}
if (!strcmp(dev_name(dev), "fdf40000.rkvenc")) {
dev_pm_opp_remove(dev, 400000000);
}
}

return ret;
}
EXPORT_SYMBOL(rockchip_adjust_power_scale);
Expand Down

0 comments on commit 769be3c

Please sign in to comment.