}; /* end of / */
&CPU0 {
- /*set differents table cpufreq max*/
- diff_tables_supply;
- hispeed_cpufreq_max = <2100>;
- medspeed_cpufreq_max = <1908>;
- lospeed_cpufreq_max = <1800>;
+ /*set multi table cpufreq max*/
+ multi_tables_available;
operating-points-v2 = <&cpu_opp_table0>,
<&cpu_opp_table1>,
<&cpu_opp_table2>;
};
&CPU1 {
- /*set differents table cpufreq max*/
- diff_tables_supply;
- hispeed_cpufreq_max = <2100>;
- medspeed_cpufreq_max = <1908>;
- lospeed_cpufreq_max = <1800>;
+ /*set multi table cpufreq max*/
+ multi_tables_available;
operating-points-v2 = <&cpu_opp_table0>,
<&cpu_opp_table1>,
<&cpu_opp_table2>;
};
&CPU2 {
- /*set differents table cpufreq max*/
- diff_tables_supply;
- hispeed_cpufreq_max = <2100>;
- medspeed_cpufreq_max = <1908>;
- lospeed_cpufreq_max = <1800>;
+ /*set multi table cpufreq max*/
+ multi_tables_available;
operating-points-v2 = <&cpu_opp_table0>,
<&cpu_opp_table1>,
<&cpu_opp_table2>;
};
&CPU3 {
- /*set differents table cpufreq max*/
- diff_tables_supply;
- hispeed_cpufreq_max = <2100>;
- medspeed_cpufreq_max = <1908>;
- lospeed_cpufreq_max = <1800>;
+ /*set multi table cpufreq max*/
+ multi_tables_available;
operating-points-v2 = <&cpu_opp_table0>,
<&cpu_opp_table1>,
<&cpu_opp_table2>;
};
opp11 {
opp-hz = /bits/ 64 <1908000000>;
- opp-microvolt = <1000000>;
+ opp-microvolt = <970000>;
+ };
+ };
+
+ cpu_opp_table1: cpu_opp_table1 {
+ compatible = "operating-points-v2";
+ opp-shared;
+
+ opp00 {
+ opp-hz = /bits/ 64 <100000000>;
+ opp-microvolt = <760000>;
+ };
+ opp01 {
+ opp-hz = /bits/ 64 <250000000>;
+ opp-microvolt = <760000>;
+ };
+ opp02 {
+ opp-hz = /bits/ 64 <500000000>;
+ opp-microvolt = <760000>;
+ };
+ opp03 {
+ opp-hz = /bits/ 64 <667000000>;
+ opp-microvolt = <780000>;
+ };
+ opp04 {
+ opp-hz = /bits/ 64 <1000000000>;
+ opp-microvolt = <800000>;
+ };
+ opp05 {
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <810000>;
+ };
+ opp06 {
+ opp-hz = /bits/ 64 <1404000000>;
+ opp-microvolt = <820000>;
+ };
+ opp07 {
+ opp-hz = /bits/ 64 <1500000000>;
+ opp-microvolt = <830000>;
+ };
+ opp08 {
+ opp-hz = /bits/ 64 <1608000000>;
+ opp-microvolt = <860000>;
+ };
+ opp09 {
+ opp-hz = /bits/ 64 <1704000000>;
+ opp-microvolt = <900000>;
+ };
+ opp10 {
+ opp-hz = /bits/ 64 <1800000000>;
+ opp-microvolt = <910000>;
+ };
+ opp11 {
+ opp-hz = /bits/ 64 <1908000000>;
+ opp-microvolt = <910000>;
+ };
+ };
+
+ cpu_opp_table2: cpu_opp_table2 {
+ compatible = "operating-points-v2";
+ opp-shared;
+
+ opp00 {
+ opp-hz = /bits/ 64 <100000000>;
+ opp-microvolt = <760000>;
+ };
+ opp01 {
+ opp-hz = /bits/ 64 <250000000>;
+ opp-microvolt = <760000>;
+ };
+ opp02 {
+ opp-hz = /bits/ 64 <500000000>;
+ opp-microvolt = <760000>;
+ };
+ opp03 {
+ opp-hz = /bits/ 64 <667000000>;
+ opp-microvolt = <780000>;
+ };
+ opp04 {
+ opp-hz = /bits/ 64 <1000000000>;
+ opp-microvolt = <800000>;
+ };
+ opp05 {
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <810000>;
+ };
+ opp06 {
+ opp-hz = /bits/ 64 <1404000000>;
+ opp-microvolt = <820000>;
+ };
+ opp07 {
+ opp-hz = /bits/ 64 <1500000000>;
+ opp-microvolt = <830000>;
+ };
+ opp08 {
+ opp-hz = /bits/ 64 <1608000000>;
+ opp-microvolt = <860000>;
+ };
+ opp09 {
+ opp-hz = /bits/ 64 <1704000000>;
+ opp-microvolt = <860000>;
+ };
+ opp10 {
+ opp-hz = /bits/ 64 <1800000000>;
+ opp-microvolt = <860000>;
+ };
+ opp11 {
+ opp-hz = /bits/ 64 <1908000000>;
+ opp-microvolt = <860000>;
};
};
}; /* end of / */
+&CPU0 {
+ /*set differents table cpufreq max*/
+ multi_tables_available;
+ operating-points-v2 = <&cpu_opp_table0>,
+ <&cpu_opp_table1>,
+ <&cpu_opp_table2>;
+};
+
+&CPU1 {
+ /*set differents table cpufreq max*/
+ multi_tables_available;
+ operating-points-v2 = <&cpu_opp_table0>,
+ <&cpu_opp_table1>,
+ <&cpu_opp_table2>;
+};
+
+&CPU2 {
+ /*set differents table cpufreq max*/
+ multi_tables_available;
+ operating-points-v2 = <&cpu_opp_table0>,
+ <&cpu_opp_table1>,
+ <&cpu_opp_table2>;
+};
+
+&CPU3 {
+ /*set differents table cpufreq max*/
+ multi_tables_available;
+ operating-points-v2 = <&cpu_opp_table0>,
+ <&cpu_opp_table1>,
+ <&cpu_opp_table2>;
+};
+
&meson_fb {
status = "okay";
display_size_default = <1920 1080 1920 2160 32>;
}; /* end of / */
&CPU0 {
- /*set differents table cpufreq max*/
- diff_tables_supply;
- hispeed_cpufreq_max = <2100>;
- medspeed_cpufreq_max = <1908>;
- lospeed_cpufreq_max = <1800>;
+ /*set multi table cpufreq max*/
+ multi_tables_available;
operating-points-v2 = <&cpu_opp_table0>,
<&cpu_opp_table1>,
<&cpu_opp_table2>;
};
&CPU1 {
- /*set differents table cpufreq max*/
- diff_tables_supply;
- hispeed_cpufreq_max = <2100>;
- medspeed_cpufreq_max = <1908>;
- lospeed_cpufreq_max = <1800>;
+ /*set multi table cpufreq max*/
+ multi_tables_available;
operating-points-v2 = <&cpu_opp_table0>,
<&cpu_opp_table1>,
<&cpu_opp_table2>;
};
&CPU2 {
- /*set differents table cpufreq max*/
- diff_tables_supply;
- hispeed_cpufreq_max = <2100>;
- medspeed_cpufreq_max = <1908>;
- lospeed_cpufreq_max = <1800>;
+ /*set multi table cpufreq max*/
+ multi_tables_available;
operating-points-v2 = <&cpu_opp_table0>,
<&cpu_opp_table1>,
<&cpu_opp_table2>;
};
&CPU3 {
- /*set differents table cpufreq max*/
- diff_tables_supply;
- hispeed_cpufreq_max = <2100>;
- medspeed_cpufreq_max = <1908>;
- lospeed_cpufreq_max = <1800>;
+ /*set multi table cpufreq max*/
+ multi_tables_available;
operating-points-v2 = <&cpu_opp_table0>,
<&cpu_opp_table1>,
<&cpu_opp_table2>;
};
opp11 {
opp-hz = /bits/ 64 <1908000000>;
- opp-microvolt = <1000000>;
+ opp-microvolt = <970000>;
+ };
+ };
+
+ cpu_opp_table1: cpu_opp_table1 {
+ compatible = "operating-points-v2";
+ opp-shared;
+
+ opp00 {
+ opp-hz = /bits/ 64 <100000000>;
+ opp-microvolt = <760000>;
+ };
+ opp01 {
+ opp-hz = /bits/ 64 <250000000>;
+ opp-microvolt = <760000>;
+ };
+ opp02 {
+ opp-hz = /bits/ 64 <500000000>;
+ opp-microvolt = <760000>;
+ };
+ opp03 {
+ opp-hz = /bits/ 64 <667000000>;
+ opp-microvolt = <780000>;
+ };
+ opp04 {
+ opp-hz = /bits/ 64 <1000000000>;
+ opp-microvolt = <800000>;
+ };
+ opp05 {
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <810000>;
+ };
+ opp06 {
+ opp-hz = /bits/ 64 <1404000000>;
+ opp-microvolt = <820000>;
+ };
+ opp07 {
+ opp-hz = /bits/ 64 <1500000000>;
+ opp-microvolt = <830000>;
+ };
+ opp08 {
+ opp-hz = /bits/ 64 <1608000000>;
+ opp-microvolt = <860000>;
+ };
+ opp09 {
+ opp-hz = /bits/ 64 <1704000000>;
+ opp-microvolt = <900000>;
+ };
+ opp10 {
+ opp-hz = /bits/ 64 <1800000000>;
+ opp-microvolt = <910000>;
+ };
+ opp11 {
+ opp-hz = /bits/ 64 <1908000000>;
+ opp-microvolt = <910000>;
+ };
+ };
+
+ cpu_opp_table2: cpu_opp_table2 {
+ compatible = "operating-points-v2";
+ opp-shared;
+
+ opp00 {
+ opp-hz = /bits/ 64 <100000000>;
+ opp-microvolt = <760000>;
+ };
+ opp01 {
+ opp-hz = /bits/ 64 <250000000>;
+ opp-microvolt = <760000>;
+ };
+ opp02 {
+ opp-hz = /bits/ 64 <500000000>;
+ opp-microvolt = <760000>;
+ };
+ opp03 {
+ opp-hz = /bits/ 64 <667000000>;
+ opp-microvolt = <780000>;
+ };
+ opp04 {
+ opp-hz = /bits/ 64 <1000000000>;
+ opp-microvolt = <800000>;
+ };
+ opp05 {
+ opp-hz = /bits/ 64 <1200000000>;
+ opp-microvolt = <810000>;
+ };
+ opp06 {
+ opp-hz = /bits/ 64 <1404000000>;
+ opp-microvolt = <820000>;
+ };
+ opp07 {
+ opp-hz = /bits/ 64 <1500000000>;
+ opp-microvolt = <830000>;
+ };
+ opp08 {
+ opp-hz = /bits/ 64 <1608000000>;
+ opp-microvolt = <860000>;
+ };
+ opp09 {
+ opp-hz = /bits/ 64 <1704000000>;
+ opp-microvolt = <860000>;
+ };
+ opp10 {
+ opp-hz = /bits/ 64 <1800000000>;
+ opp-microvolt = <860000>;
+ };
+ opp11 {
+ opp-hz = /bits/ 64 <1908000000>;
+ opp-microvolt = <860000>;
};
};
}; /* end of / */
+&CPU0 {
+ /*set multi table cpufreq max*/
+ multi_tables_available;
+ operating-points-v2 = <&cpu_opp_table0>,
+ <&cpu_opp_table1>,
+ <&cpu_opp_table2>;
+};
+
+&CPU1 {
+ /*set multi table cpufreq max*/
+ multi_tables_available;
+ operating-points-v2 = <&cpu_opp_table0>,
+ <&cpu_opp_table1>,
+ <&cpu_opp_table2>;
+};
+
+&CPU2 {
+ /*set multi table cpufreq max*/
+ multi_tables_available;
+ operating-points-v2 = <&cpu_opp_table0>,
+ <&cpu_opp_table1>,
+ <&cpu_opp_table2>;
+};
+
+&CPU3 {
+ /*set multi table cpufreq max*/
+ multi_tables_available;
+ operating-points-v2 = <&cpu_opp_table0>,
+ <&cpu_opp_table1>,
+ <&cpu_opp_table2>;
+};
+
&meson_fb {
status = "okay";
display_size_default = <1920 1080 1920 2160 32>;
#include <linux/amlogic/scpi_protocol.h>
#include "../../base/power/opp/opp.h"
#include "meson-cpufreq.h"
+#include <linux/arm-smccc.h>
+
+static unsigned int get_cpufreq_table_index(u64 function_id,
+ u64 arg0, u64 arg1, u64 arg2)
+{
+ struct arm_smccc_res res;
+
+ arm_smccc_smc((unsigned long)function_id,
+ (unsigned long)arg0,
+ (unsigned long)arg1,
+ (unsigned long)arg2,
+ 0, 0, 0, 0, &res);
+ return res.a0;
+}
static unsigned int meson_cpufreq_get_rate(unsigned int cpu)
{
return max_freq;
}
-int get_cpufreq_tables_efuse(u32 cur_cluster)
-{
- int ret, efuse_info;
- u32 freq, vol;
-
- efuse_info = scpi_get_cpuinfo(cur_cluster, &freq, &vol);
- if (efuse_info)
- pr_err("%s,get invalid efuse_info = %d by mailbox!\n",
- __func__, efuse_info);
-
- pr_info("%s:efuse info for cpufreq = %u\n", __func__, freq);
- BUG_ON(freq && freq < EFUSE_CPUFREQ_MIN);
- freq = DIV_ROUND_UP(freq, CLK_DIV) * CLK_DIV;
- pr_info("%s:efuse adjust cpufreq = %u\n", __func__, freq);
- if (freq >= hispeed_cpufreq_max)
- ret = HISPEED_INDEX;
- else if (freq >= medspeed_cpufreq_max && freq < hispeed_cpufreq_max)
- ret = MEDSPEED_INDEX;
- else
- ret = LOSPEED_INDEX;
-
- return ret;
-}
-
int choose_cpufreq_tables_index(const struct device_node *np, u32 cur_cluster)
{
int ret = 0;
- cpufreq_tables_supply = of_property_read_bool(np, "diff_tables_supply");
+ cpufreq_tables_supply = of_property_read_bool(np,
+ "multi_tables_available");
if (cpufreq_tables_supply) {
/*choose appropriate cpufreq tables according efuse info*/
- if (of_property_read_u32(np, "hispeed_cpufreq_max",
- &hispeed_cpufreq_max)) {
- pr_err("%s:don't find the node <dynamic_cpufreq_max>\n",
- __func__);
- hispeed_cpufreq_max = 0;
- return ret;
- }
-
- if (of_property_read_u32(np, "medspeed_cpufreq_max",
- &medspeed_cpufreq_max)) {
- pr_err("%s:don't find the node <medspeed_cpufreq_max>\n",
- __func__);
- medspeed_cpufreq_max = 0;
- return ret;
- }
-
- if (of_property_read_u32(np, "lospeed_cpufreq_max",
- &lospeed_cpufreq_max)) {
- pr_err("%s:don't find the node <lospeed_cpufreq_max>\n",
- __func__);
- lospeed_cpufreq_max = 0;
- return ret;
- }
-
- ret = get_cpufreq_tables_efuse(cur_cluster);
- pr_info("%s:hispeed_max %u,medspeed_max %u,lospeed_max %u,tables_index %u\n",
- __func__, hispeed_cpufreq_max,
- medspeed_cpufreq_max, lospeed_cpufreq_max, ret);
-
+ ret = get_cpufreq_table_index(GET_DVFS_TABLE_INDEX,
+ cur_cluster, 0, 0);
+ pr_info("%s:tables_index %u\n", __func__, ret);
}
return ret;
unsigned int gp1_clk_target;
/*whether use different tables or not*/
bool cpufreq_tables_supply;
-static unsigned int hispeed_cpufreq_max;
-static unsigned int medspeed_cpufreq_max;
-static unsigned int lospeed_cpufreq_max;
-enum cpufreq_index {
- LOSPEED_INDEX,
- MEDSPEED_INDEX,
- HISPEED_INDEX
-};
+#define GET_DVFS_TABLE_INDEX 0x82000088
struct meson_cpufreq_driver_data {
struct device *cpu_dev;
u32 cur_cluster, u32 rate);
static int meson_regulator_set_volate(struct regulator *regulator, int old_uv,
int new_uv, int tol_uv);
-int get_cpufreq_tables_efuse(u32 cur_cluster);
int choose_cpufreq_tables_index(const struct device_node *np, u32 cur_cluster);
#endif /* __MESON_CPUFREQ_H */