arm: tegra: refactor edp parameters init
Diwakar Tundlam [Sat, 8 Jun 2013 00:33:03 +0000 (17:33 -0700)]
Move common numeric values to be macro-based to avoid duplicates

Bug 1304350

Change-Id: I470e135715a7226225b09213748783fc9dff70ae
Reviewed-on: http://git-master/r/239511
(cherry picked from commit 90326769802790cf2bac4ebdc8c6f307b0d1d1f5)
Signed-off-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-on: http://git-master/r/253746

arch/arm/mach-tegra/tegra11_edp.c
arch/arm/mach-tegra/tegra14_edp.c

index ecbbe5e..a9b2c6b 100644 (file)
@@ -115,122 +115,57 @@ static struct core_edp_entry core_edp_table[] = {
 };
 
 #ifdef CONFIG_TEGRA_EDP_LIMITS
+#define LEAKAGE_CONSTS_IJK_COMMON                                      \
+       {                                                               \
+               /* i = 0 */                                             \
+               { {  -42746668,   -5458429,   164998,  -1711, },        \
+                 {  178262421,   13375684,  -411791,   4590, },        \
+                 { -228866784,  -10482993,   331248,  -4062, },        \
+                 {   94301550,    2618719,   -85983,   1193, },        \
+               },                                                      \
+               /* i = 1 */                                             \
+               { { -256611791,   49677413, -1655785,  14917, },        \
+                 {  584675433, -132620939,  4541560, -41812, },        \
+                 { -398106336,  115987156, -4102328,  38737, },        \
+                 {   68897184,  -33030745,  1217839, -11801, },        \
+               },                                                      \
+               /* i = 2 */                                             \
+               { {  186324676,  -36019083,  1177969, -10669, },        \
+                 { -439237936,   98429131, -3276444,  30301, },        \
+                 {  315060898,  -88635036,  3004777, -28474, },        \
+                 {  -60854399,   26267188,  -907121,   8844, },        \
+               },                                                      \
+               /* i = 3 */                                             \
+               { {  -35432997,    6154621,  -202200,   1830, },        \
+                 {   87402153,  -16908683,   565152,  -5220, },        \
+                 {  -67775314,   15326770,  -521221,   4927, },        \
+                 {   15618709,   -4576116,   158401,  -1538, },        \
+               },                                                      \
+       }
+
+#define LEAKAGE_PARAMS_COMMON_PART                                     \
+       .dyn_scaled         = 1000000,                                  \
+       .dyn_consts_n       = { 1091747, 2035205, 2978661, 3922119 },   \
+       .consts_scaled      = 1000000,                                  \
+       .leakage_consts_n   = {  538991,  752463,  959441, 1150000 },   \
+       .ijk_scaled         = 100000,                                   \
+       .volt_temp_cap      = { 70, 1300 },                             \
+       .leakage_consts_ijk = LEAKAGE_CONSTS_IJK_COMMON
+
 static struct tegra_edp_cpu_leakage_params t11x_leakage_params[] = {
        {
                .cpu_speedo_id      = 0, /* A01 CPU */
-
-               .dyn_scaled         = 1000000,
-               .dyn_consts_n       = { 1091747, 2035205, 2978661, 3922119 },
-
-               .consts_scaled      = 1000000,
-               .leakage_consts_n   = {  538991,  752463,  959441, 1150000 },
-
-               .ijk_scaled         = 100000,
-               .leakage_consts_ijk = {
-                       /* i = 0 */
-                       { {  -42746668,   -5458429,   164998,  -1711, },
-                         {  178262421,   13375684,  -411791,   4590, },
-                         { -228866784,  -10482993,   331248,  -4062, },
-                         {   94301550,    2618719,   -85983,   1193, },
-                       },
-                       /* i = 1 */
-                       { { -256611791,   49677413, -1655785,  14917, },
-                         {  584675433, -132620939,  4541560, -41812, },
-                         { -398106336,  115987156, -4102328,  38737, },
-                         {   68897184,  -33030745,  1217839, -11801, },
-                       },
-                       /* i = 2 */
-                       { {  186324676,  -36019083,  1177969, -10669, },
-                         { -439237936,   98429131, -3276444,  30301, },
-                         {  315060898,  -88635036,  3004777, -28474, },
-                         {  -60854399,   26267188,  -907121,   8844, },
-                       },
-                       /* i = 3 */
-                       { {  -35432997,    6154621,  -202200,   1830, },
-                         {   87402153,  -16908683,   565152,  -5220, },
-                         {  -67775314,   15326770,  -521221,   4927, },
-                         {   15618709,   -4576116,   158401,  -1538, },
-                       },
-               },
-               .volt_temp_cap = { 70, 1300 },
+               LEAKAGE_PARAMS_COMMON_PART,
        },
        {
                .cpu_speedo_id      = 1, /* A01P+ CPU */
-
-               .dyn_scaled         = 1000000,
-               .dyn_consts_n       = { 1091747, 2035205, 2978661, 3922119 },
-
-               .consts_scaled      = 1000000,
-               .leakage_consts_n   = {  538991,  752463,  959441, 1150000 },
-
-               .ijk_scaled         = 100000,
-               .leakage_consts_ijk = {
-                       /* i = 0 */
-                       { {  -42746668,   -5458429,   164998,  -1711, },
-                         {  178262421,   13375684,  -411791,   4590, },
-                         { -228866784,  -10482993,   331248,  -4062, },
-                         {   94301550,    2618719,   -85983,   1193, },
-                       },
-                       /* i = 1 */
-                       { { -256611791,   49677413, -1655785,  14917, },
-                         {  584675433, -132620939,  4541560, -41812, },
-                         { -398106336,  115987156, -4102328,  38737, },
-                         {   68897184,  -33030745,  1217839, -11801, },
-                       },
-                       /* i = 2 */
-                       { {  186324676,  -36019083,  1177969, -10669, },
-                         { -439237936,   98429131, -3276444,  30301, },
-                         {  315060898,  -88635036,  3004777, -28474, },
-                         {  -60854399,   26267188,  -907121,   8844, },
-                       },
-                       /* i = 3 */
-                       { {  -35432997,    6154621,  -202200,   1830, },
-                         {   87402153,  -16908683,   565152,  -5220, },
-                         {  -67775314,   15326770,  -521221,   4927, },
-                         {   15618709,   -4576116,   158401,  -1538, },
-                       },
-               },
-               .safety_cap = { 1810500, 1810500, 1606500, 1606500 },
-               .volt_temp_cap = { 70, 1300 },
+               .safety_cap         = { 1810500, 1810500, 1606500, 1606500 },
+               LEAKAGE_PARAMS_COMMON_PART,
        },
        {
                .cpu_speedo_id      = 2, /* A01P+ fast CPU */
-
-               .dyn_scaled         = 1000000,
-               .dyn_consts_n       = { 1091747, 2035205, 2978661, 3922119 },
-
-               .consts_scaled      = 1000000,
-               .leakage_consts_n   = {  538991,  752463,  959441, 1150000 },
-
-               .ijk_scaled         = 100000,
-               .leakage_consts_ijk = {
-                       /* i = 0 */
-                       { {  -42746668,   -5458429,   164998,  -1711, },
-                         {  178262421,   13375684,  -411791,   4590, },
-                         { -228866784,  -10482993,   331248,  -4062, },
-                         {   94301550,    2618719,   -85983,   1193, },
-                       },
-                       /* i = 1 */
-                       { { -256611791,   49677413, -1655785,  14917, },
-                         {  584675433, -132620939,  4541560, -41812, },
-                         { -398106336,  115987156, -4102328,  38737, },
-                         {   68897184,  -33030745,  1217839, -11801, },
-                       },
-                       /* i = 2 */
-                       { {  186324676,  -36019083,  1177969, -10669, },
-                         { -439237936,   98429131, -3276444,  30301, },
-                         {  315060898,  -88635036,  3004777, -28474, },
-                         {  -60854399,   26267188,  -907121,   8844, },
-                       },
-                       /* i = 3 */
-                       { {  -35432997,    6154621,  -202200,   1830, },
-                         {   87402153,  -16908683,   565152,  -5220, },
-                         {  -67775314,   15326770,  -521221,   4927, },
-                         {   15618709,   -4576116,   158401,  -1538, },
-                       },
-               },
-               .safety_cap = { 1912500, 1912500, 1912500, 1912500 },
-               .volt_temp_cap = { 70, 1300 },
+               .safety_cap         = { 1912500, 1912500, 1912500, 1912500 },
+               LEAKAGE_PARAMS_COMMON_PART,
        },
 };
 
index d4499de..0a79392 100644 (file)
@@ -195,88 +195,53 @@ static struct core_edp_entry core_edp_table[] = {
 };
 
 #ifdef CONFIG_TEGRA_EDP_LIMITS
+#define LEAKAGE_CONSTS_IJK_COMMON                                      \
+       {                                                               \
+               /* i = 0 */                                             \
+               { {    564982,  -1353469,    309283,    -20862, },      \
+                 {  -1866916,   4500931,  -1026666,     68669, },      \
+                 {   1965934,  -4869757,   1107682,    -73554, },      \
+                 {   -637854,   1715497,   -388916,     25621, },      \
+               },                                                      \
+               /* i = 1 */                                             \
+               { {  -7341396,   7706464,  -1729662,    114105, },      \
+                 {  24249928, -25178676,   5651247,   -370322, },      \
+                 { -26109261,  26794485,  -6018513,    392722, },      \
+                 {   9127986,  -9288224,   2091707,   -135487, },      \
+               },                                                      \
+               /* i = 2 */                                             \
+               { {   9830061,  -9444047,   2035950,   -132842, },      \
+                 { -31837469,  30412491,  -6571344,    428173, },      \
+                 {  33645736, -31974811,   6933186,   -452148, },      \
+                 { -11561204,  11000249,  -2395570,    156270, },      \
+               },                                                      \
+               /* i = 3 */                                             \
+               { {  -2848862,   2437747,   -500201,     31386, },      \
+                 {   9160903,  -7785587,   1605160,   -100724, },      \
+                 {  -9619266,   8124245,  -1686232,    106069, },      \
+                 {   3291191,  -2777151,    581139,    -36610, },      \
+               },                                                      \
+       }
+
+#define LEAKAGE_PARAMS_COMMON_PART                                     \
+       .temp_scaled        = 10,                                       \
+       .dyn_scaled         = 1000000,                                  \
+       .dyn_consts_n       = {  376000,  638000,  916000, 1203000 },   \
+       .consts_scaled      = 1000000,                                  \
+       .leakage_consts_n   = {  489500,  730600,  867600, 1000000 },   \
+       .ijk_scaled         = 1000,                                     \
+       .leakage_min        = 30,                                       \
+       /* .volt_temp_cap = { 70, 1240 }, - TODO for T148 */            \
+       .leakage_consts_ijk = LEAKAGE_CONSTS_IJK_COMMON
+
 static struct tegra_edp_cpu_leakage_params t14x_leakage_params[] = {
        {
                .cpu_speedo_id      = 0, /* A01 CPU */
-
-               .temp_scaled        = 10,
-
-               .dyn_scaled         = 1000000,
-               .dyn_consts_n       = {  376000,  638000,  916000, 1203000 },
-
-               .consts_scaled      = 1000000,
-               .leakage_consts_n   = {  489500,  730600,  867600, 1000000 },
-
-               .ijk_scaled         = 1000,
-               .leakage_consts_ijk = {
-                       /* i = 0 */
-                       { {    564982,  -1353469,    309283,    -20862, },
-                         {  -1866916,   4500931,  -1026666,     68669, },
-                         {   1965934,  -4869757,   1107682,    -73554, },
-                         {   -637854,   1715497,   -388916,     25621, },
-                       },
-                       /* i = 1 */
-                       { {  -7341396,   7706464,  -1729662,    114105, },
-                         {  24249928, -25178676,   5651247,   -370322, },
-                         { -26109261,  26794485,  -6018513,    392722, },
-                         {   9127986,  -9288224,   2091707,   -135487, },
-                       },
-                       /* i = 2 */
-                       { {   9830061,  -9444047,   2035950,   -132842, },
-                         { -31837469,  30412491,  -6571344,    428173, },
-                         {  33645736, -31974811,   6933186,   -452148, },
-                         { -11561204,  11000249,  -2395570,    156270, },
-                       },
-                       /* i = 3 */
-                       { {  -2848862,   2437747,   -500201,     31386, },
-                         {   9160903,  -7785587,   1605160,   -100724, },
-                         {  -9619266,   8124245,  -1686232,    106069, },
-                         {   3291191,  -2777151,    581139,    -36610, },
-                       },
-               },
-               .leakage_min = 30,
-               /* .volt_temp_cap = { 70, 1240 }, - TODO for T148 */
+               LEAKAGE_PARAMS_COMMON_PART,
        },
        {
                .cpu_speedo_id      = 1, /* SKU 0x3 CPU */
-
-               .temp_scaled        = 10,
-
-               .dyn_scaled         = 1000000,
-               .dyn_consts_n       = {  376000,  638000,  916000, 1203000 },
-
-               .consts_scaled      = 1000000,
-               .leakage_consts_n   = {  489500,  730600,  867600, 1000000 },
-
-               .ijk_scaled         = 1000,
-               .leakage_consts_ijk = {
-                       /* i = 0 */
-                       { {    564982,  -1353469,    309283,    -20862, },
-                         {  -1866916,   4500931,  -1026666,     68669, },
-                         {   1965934,  -4869757,   1107682,    -73554, },
-                         {   -637854,   1715497,   -388916,     25621, },
-                       },
-                       /* i = 1 */
-                       { {  -7341396,   7706464,  -1729662,    114105, },
-                         {  24249928, -25178676,   5651247,   -370322, },
-                         { -26109261,  26794485,  -6018513,    392722, },
-                         {   9127986,  -9288224,   2091707,   -135487, },
-                       },
-                       /* i = 2 */
-                       { {   9830061,  -9444047,   2035950,   -132842, },
-                         { -31837469,  30412491,  -6571344,    428173, },
-                         {  33645736, -31974811,   6933186,   -452148, },
-                         { -11561204,  11000249,  -2395570,    156270, },
-                       },
-                       /* i = 3 */
-                       { {  -2848862,   2437747,   -500201,     31386, },
-                         {   9160903,  -7785587,   1605160,   -100724, },
-                         {  -9619266,   8124245,  -1686232,    106069, },
-                         {   3291191,  -2777151,    581139,    -36610, },
-                       },
-               },
-               .leakage_min = 30,
-               /* .volt_temp_cap = { 70, 1240 }, - TODO for T148 */
+               LEAKAGE_PARAMS_COMMON_PART,
        },
 };