Loading arch/arm/boot/dts/qcom/msm8996pro.dtsi +159 −55 Original line number Diff line number Diff line Loading @@ -116,24 +116,56 @@ qcom,cpr-open-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-85000) 0 0 (-25000) 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-85000) 0 0 (-25000) 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-closed-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-95000) (-25000) (-5000) (-20000) (-5000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-95000) (-25000) (-5000) (-20000) (-5000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-open-loop-voltage-adjustment = /* Speed bin 0 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>, <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-26000) (-27000) (-27000) (-28000) (-30000)>, /* Speed bin 1 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>; <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-26000) (-27000) (-27000) (-28000) (-30000)>; qcom,cpr-open-loop-voltage-min-diff = /* Speed bin 0 */ Loading @@ -144,10 +176,14 @@ qcom,cpr-closed-loop-voltage-adjustment = /* Speed bin 0 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>, <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-26000) (-27000) (-27000) (-28000) (-30000)>, /* Speed bin 1 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>; <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-26000) (-27000) (-27000) (-28000) (-30000)>; qcom,cpr-aging-max-voltage-adjustment = <15000>; qcom,cpr-aging-ref-corner = <14 14>; Loading Loading @@ -236,16 +272,44 @@ qcom,cpr-open-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-80000) 0 0 (-10000) (-50000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-80000) 0 0 (-10000) (-50000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-closed-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-85000) (-25000) 10000 (-10000) (-40000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-85000) (-25000) 10000 (-10000) (-40000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-aging-max-voltage-adjustment = <15000>; Loading Loading @@ -340,24 +404,58 @@ qcom,cpr-open-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-85000) 0 15000 (-20000) 20000 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-85000) 0 15000 (-20000) 20000 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-closed-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-95000) (-20000) 15000 (-15000) 5000 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-95000) (-20000) 15000 (-15000) 5000 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-open-loop-voltage-adjustment = /* Speed bin 0 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>, <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-25000) (-26000) (-26000) (-27000) (-27000) (-28000) (-28000) (-29000) (-29000) (-30000)>, /* Speed bin 1 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>; <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-25000) (-26000) (-26000) (-27000) (-27000) (-28000) (-28000) (-29000) (-29000) (-30000)>; qcom,cpr-open-loop-voltage-min-diff = /* Speed bin 0 */ Loading @@ -368,10 +466,16 @@ qcom,cpr-closed-loop-voltage-adjustment = /* Speed bin 0 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>, <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-25000) (-26000) (-26000) (-27000) (-27000) (-28000) (-28000) (-29000) (-29000) (-30000)>, /* Speed bin 1 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>; <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-25000) (-26000) (-26000) (-27000) (-27000) (-28000) (-28000) (-29000) (-29000) (-30000)>; qcom,cpr-aging-max-voltage-adjustment = <15000>; qcom,cpr-aging-ref-corner = <15 15>; Loading Loading @@ -798,45 +902,45 @@ cpu-to-dev-map-0 = < 307200 192000 >, < 384000 192000 >, < 460800 307200 >, < 537600 384000 >, < 614400 441600 >, < 691200 537600 >, < 768000 614400 >, < 844800 691200 >, < 902400 768000 >, < 979200 844800 >, < 1056000 902400 >, < 1132800 979200 >, < 1209600 1056000 >, < 1286400 1132800 >, < 1363200 1190400 >, < 1440000 1286400 >, < 1516800 1363200 >, < 1593600 1440000 >; < 460800 192000 >, < 537600 192000 >, < 614400 307200 >, < 691200 307200 >, < 768000 384000 >, < 844800 441600 >, < 902400 537600 >, < 979200 614400 >, < 1056000 691200 >, < 1132800 768000 >, < 1209600 844800 >, < 1286400 902400 >, < 1363200 1056000 >, < 1440000 1132800 >, < 1516800 1190400 >, < 1593600 1286400 >; cpu-to-dev-map-2 = < 307200 192000 >, < 384000 192000 >, < 460800 192000 >, < 537600 307200 >, < 614400 384000 >, < 691200 441600 >, < 748800 537600 >, < 825600 614400 >, < 902400 691200 >, < 979200 768000 >, < 1056000 844800 >, < 1132800 902400 >, < 1209600 979200 >, < 1286400 1056000 >, < 1363200 1132800 >, < 1440000 1190400 >, < 1516800 1286400 >, < 1593600 1363200 >, < 1670400 1440000 >, < 1747200 1516800 >, < 1824000 1593600 >, < 1900800 1593600 >, < 537600 192000 >, < 614400 192000 >, < 691200 307200 >, < 748800 307200 >, < 825600 384000 >, < 902400 441600 >, < 979200 537600 >, < 1056000 614400 >, < 1132800 691200 >, < 1209600 768000 >, < 1286400 844800 >, < 1363200 902400 >, < 1440000 979200 >, < 1516800 1056000 >, < 1593600 1190400 >, < 1670400 1286400 >, < 1747200 1363200 >, < 1824000 1440000 >, < 1900800 1516800 >, < 1977600 1593600 >, < 2054400 1593600 >, < 2150400 1593600 >; Loading drivers/regulator/cpr3-hmss-regulator.c +23 −26 Original line number Diff line number Diff line Loading @@ -781,19 +781,8 @@ static int cpr3_msm8996_hmss_calculate_open_loop_voltages( goto done; } /* Determine highest corner mapped to each fuse corner */ j = vreg->fuse_corner_count - 1; for (i = vreg->corner_count - 1; i >= 0; i--) { if (vreg->corner[i].cpr_fuse_corner == j) { fmax_corner[j] = i; j--; } } if (j >= 0) { cpr3_err(vreg, "invalid fuse corner mapping\n"); rc = -EINVAL; goto done; } for (i = 0; i < vreg->fuse_corner_count; i++) fmax_corner[i] = vreg->fuse_corner_map[i]; /* * Interpolation is not possible for corners mapped to the lowest fuse Loading @@ -802,6 +791,14 @@ static int cpr3_msm8996_hmss_calculate_open_loop_voltages( for (i = 0; i <= fmax_corner[0]; i++) vreg->corner[i].open_loop_volt = fuse_volt[0]; /* * Interpolation is not possible for corners mapped above the highest * fuse corner so use the fuse corner value directly. */ j = vreg->fuse_corner_count - 1; for (i = fmax_corner[j] + 1; i < vreg->corner_count; i++) vreg->corner[i].open_loop_volt = fuse_volt[j]; /* * Corner LowSVS should be skipped for voltage interpolation * since no fuse exists for it. Instead, the lowest interpolation Loading Loading @@ -969,19 +966,8 @@ static int cpr3_msm8996_hmss_calculate_target_quotients( volt_adjust, volt_adjust_fuse, ro_scale); } /* Determine highest corner mapped to each fuse corner */ j = vreg->fuse_corner_count - 1; for (i = vreg->corner_count - 1; i >= 0; i--) { if (vreg->corner[i].cpr_fuse_corner == j) { fmax_corner[j] = i; j--; } } if (j >= 0) { cpr3_err(vreg, "invalid fuse corner mapping\n"); rc = -EINVAL; goto done; } for (i = 0; i < vreg->fuse_corner_count; i++) fmax_corner[i] = vreg->fuse_corner_map[i]; /* * Interpolation is not possible for corners mapped to the lowest fuse Loading @@ -998,6 +984,17 @@ static int cpr3_msm8996_hmss_calculate_target_quotients( for (i = 0; i <= fmax_corner[CPR3_MSM8996_HMSS_FUSE_CORNER_MINSVS]; i++) vreg->corner[i].target_quot[ro] = quot; /* * Interpolation is not possible for corners mapped above the highest * fuse corner so use the fuse corner value directly. */ j = vreg->fuse_corner_count - 1; quot_adjust = cpr3_quot_adjustment(ro_scale[j], volt_adjust_fuse[j]); quot = fuse->target_quot[j] + quot_adjust; ro = fuse->ro_sel[j]; for (i = fmax_corner[j] + 1; i < vreg->corner_count; i++) vreg->corner[i].target_quot[ro] = quot; /* * The LowSVS target quotient is defined as: * (SVS target quotient) - (the unpacked SVS quotient offset) Loading drivers/regulator/cpr3-regulator.h +9 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,14 @@ struct cprh_corner_band { * @fuse_combos_supported: The number of fuse combinations supported by the * device tree configuration for this CPR3 regulator * @fuse_corner_count: Number of corners defined by fuse parameters * @fuse_corner_map: Array of length fuse_corner_count which specifies the * highest corner associated with each fuse corner. Note * that each element must correspond to a valid corner * and that element values must be strictly increasing. * Also, it is acceptable for the lowest fuse corner to map * to a corner other than the lowest. Likewise, it is * acceptable for the highest fuse corner to map to a * corner other than the highest. * @fuse_combo_corner_sum: The sum of the corner counts across all fuse combos * @fuse_combo_offset: The device tree property array offset for the selected * fuse combo Loading Loading @@ -333,6 +341,7 @@ struct cpr3_regulator { int fuse_combo; int fuse_combos_supported; int fuse_corner_count; int *fuse_corner_map; int fuse_combo_corner_sum; int fuse_combo_offset; int speed_bin_corner_sum; Loading drivers/regulator/cpr3-util.c +22 −8 Original line number Diff line number Diff line Loading @@ -528,9 +528,9 @@ int cpr3_parse_corner_band_array_property(struct cpr3_regulator *vreg, * and qcom,cpr-corner-fmax-map. * * It initializes these CPR3 regulator elements: corner, corner_count, * fuse_combos_supported, and speed_bins_supported. It initializes these * elements for each corner: ceiling_volt, floor_volt, proc_freq, and * cpr_fuse_corner. * fuse_combos_supported, fuse_corner_map, and speed_bins_supported. It * initializes these elements for each corner: ceiling_volt, floor_volt, * proc_freq, and cpr_fuse_corner. * * It requires that the following CPR3 regulator elements be initialized before * being called: fuse_corner_count, fuse_combo, and speed_bin_fuse. Loading Loading @@ -750,11 +750,19 @@ int cpr3_parse_common_corner_data(struct cpr3_regulator *vreg) } } vreg->fuse_corner_map = devm_kcalloc(ctrl->dev, vreg->fuse_corner_count, sizeof(*vreg->fuse_corner_map), GFP_KERNEL); if (!vreg->fuse_corner_map) { rc = -ENOMEM; goto free_temp; } rc = cpr3_parse_array_property(vreg, "qcom,cpr-corner-fmax-map", vreg->fuse_corner_count, temp); if (rc) goto free_temp; for (i = 0; i < vreg->fuse_corner_count; i++) { vreg->fuse_corner_map[i] = temp[i] - CPR3_CORNER_OFFSET; if (temp[i] < CPR3_CORNER_OFFSET || temp[i] > vreg->corner_count + CPR3_CORNER_OFFSET) { cpr3_err(vreg, "invalid corner value specified in qcom,cpr-corner-fmax-map: %u\n", Loading @@ -768,13 +776,11 @@ int cpr3_parse_common_corner_data(struct cpr3_regulator *vreg) goto free_temp; } } if (temp[vreg->fuse_corner_count - 1] != vreg->corner_count) { cpr3_err(vreg, "highest Fmax corner %u in qcom,cpr-corner-fmax-map does not match highest supported corner %d\n", if (temp[vreg->fuse_corner_count - 1] != vreg->corner_count) cpr3_debug(vreg, "Note: highest Fmax corner %u in qcom,cpr-corner-fmax-map does not match highest supported corner %d\n", temp[vreg->fuse_corner_count - 1], vreg->corner_count); rc = -EINVAL; goto free_temp; } for (i = 0; i < vreg->corner_count; i++) { for (j = 0; j < vreg->fuse_corner_count; j++) { if (i + CPR3_CORNER_OFFSET <= temp[j]) { Loading @@ -782,6 +788,14 @@ int cpr3_parse_common_corner_data(struct cpr3_regulator *vreg) break; } } if (j == vreg->fuse_corner_count) { /* * Handle the case where the highest fuse corner maps * to a corner below the highest corner. */ vreg->corner[i].cpr_fuse_corner = vreg->fuse_corner_count - 1; } } if (of_find_property(vreg->of_node, Loading Loading
arch/arm/boot/dts/qcom/msm8996pro.dtsi +159 −55 Original line number Diff line number Diff line Loading @@ -116,24 +116,56 @@ qcom,cpr-open-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-85000) 0 0 (-25000) 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-85000) 0 0 (-25000) 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-closed-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-95000) (-25000) (-5000) (-20000) (-5000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-95000) (-25000) (-5000) (-20000) (-5000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-open-loop-voltage-adjustment = /* Speed bin 0 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>, <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-26000) (-27000) (-27000) (-28000) (-30000)>, /* Speed bin 1 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>; <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-26000) (-27000) (-27000) (-28000) (-30000)>; qcom,cpr-open-loop-voltage-min-diff = /* Speed bin 0 */ Loading @@ -144,10 +176,14 @@ qcom,cpr-closed-loop-voltage-adjustment = /* Speed bin 0 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>, <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-26000) (-27000) (-27000) (-28000) (-30000)>, /* Speed bin 1 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>; <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-26000) (-27000) (-27000) (-28000) (-30000)>; qcom,cpr-aging-max-voltage-adjustment = <15000>; qcom,cpr-aging-ref-corner = <14 14>; Loading Loading @@ -236,16 +272,44 @@ qcom,cpr-open-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-80000) 0 0 (-10000) (-50000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-80000) 0 0 (-10000) (-50000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-closed-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-85000) (-25000) 10000 (-10000) (-40000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-85000) (-25000) 10000 (-10000) (-40000)>, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-aging-max-voltage-adjustment = <15000>; Loading Loading @@ -340,24 +404,58 @@ qcom,cpr-open-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-85000) 0 15000 (-20000) 20000 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-85000) 0 15000 (-20000) 20000 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-closed-loop-voltage-fuse-adjustment = /* Speed bin 0 */ <(-95000) (-20000) 15000 (-15000) 5000 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, /* Speed bin 1 */ <(-95000) (-20000) 15000 (-15000) 5000 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >, < 0 0 0 0 0 >; qcom,cpr-open-loop-voltage-adjustment = /* Speed bin 0 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>, <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-25000) (-26000) (-26000) (-27000) (-27000) (-28000) (-28000) (-29000) (-29000) (-30000)>, /* Speed bin 1 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>; <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-25000) (-26000) (-26000) (-27000) (-27000) (-28000) (-28000) (-29000) (-29000) (-30000)>; qcom,cpr-open-loop-voltage-min-diff = /* Speed bin 0 */ Loading @@ -368,10 +466,16 @@ qcom,cpr-closed-loop-voltage-adjustment = /* Speed bin 0 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>, <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-25000) (-26000) (-26000) (-27000) (-27000) (-28000) (-28000) (-29000) (-29000) (-30000)>, /* Speed bin 1 */ <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>; <(-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-15000) (-17000) (-19000) (-21000) (-23000) (-25000) (-25000) (-26000) (-26000) (-27000) (-27000) (-28000) (-28000) (-29000) (-29000) (-30000)>; qcom,cpr-aging-max-voltage-adjustment = <15000>; qcom,cpr-aging-ref-corner = <15 15>; Loading Loading @@ -798,45 +902,45 @@ cpu-to-dev-map-0 = < 307200 192000 >, < 384000 192000 >, < 460800 307200 >, < 537600 384000 >, < 614400 441600 >, < 691200 537600 >, < 768000 614400 >, < 844800 691200 >, < 902400 768000 >, < 979200 844800 >, < 1056000 902400 >, < 1132800 979200 >, < 1209600 1056000 >, < 1286400 1132800 >, < 1363200 1190400 >, < 1440000 1286400 >, < 1516800 1363200 >, < 1593600 1440000 >; < 460800 192000 >, < 537600 192000 >, < 614400 307200 >, < 691200 307200 >, < 768000 384000 >, < 844800 441600 >, < 902400 537600 >, < 979200 614400 >, < 1056000 691200 >, < 1132800 768000 >, < 1209600 844800 >, < 1286400 902400 >, < 1363200 1056000 >, < 1440000 1132800 >, < 1516800 1190400 >, < 1593600 1286400 >; cpu-to-dev-map-2 = < 307200 192000 >, < 384000 192000 >, < 460800 192000 >, < 537600 307200 >, < 614400 384000 >, < 691200 441600 >, < 748800 537600 >, < 825600 614400 >, < 902400 691200 >, < 979200 768000 >, < 1056000 844800 >, < 1132800 902400 >, < 1209600 979200 >, < 1286400 1056000 >, < 1363200 1132800 >, < 1440000 1190400 >, < 1516800 1286400 >, < 1593600 1363200 >, < 1670400 1440000 >, < 1747200 1516800 >, < 1824000 1593600 >, < 1900800 1593600 >, < 537600 192000 >, < 614400 192000 >, < 691200 307200 >, < 748800 307200 >, < 825600 384000 >, < 902400 441600 >, < 979200 537600 >, < 1056000 614400 >, < 1132800 691200 >, < 1209600 768000 >, < 1286400 844800 >, < 1363200 902400 >, < 1440000 979200 >, < 1516800 1056000 >, < 1593600 1190400 >, < 1670400 1286400 >, < 1747200 1363200 >, < 1824000 1440000 >, < 1900800 1516800 >, < 1977600 1593600 >, < 2054400 1593600 >, < 2150400 1593600 >; Loading
drivers/regulator/cpr3-hmss-regulator.c +23 −26 Original line number Diff line number Diff line Loading @@ -781,19 +781,8 @@ static int cpr3_msm8996_hmss_calculate_open_loop_voltages( goto done; } /* Determine highest corner mapped to each fuse corner */ j = vreg->fuse_corner_count - 1; for (i = vreg->corner_count - 1; i >= 0; i--) { if (vreg->corner[i].cpr_fuse_corner == j) { fmax_corner[j] = i; j--; } } if (j >= 0) { cpr3_err(vreg, "invalid fuse corner mapping\n"); rc = -EINVAL; goto done; } for (i = 0; i < vreg->fuse_corner_count; i++) fmax_corner[i] = vreg->fuse_corner_map[i]; /* * Interpolation is not possible for corners mapped to the lowest fuse Loading @@ -802,6 +791,14 @@ static int cpr3_msm8996_hmss_calculate_open_loop_voltages( for (i = 0; i <= fmax_corner[0]; i++) vreg->corner[i].open_loop_volt = fuse_volt[0]; /* * Interpolation is not possible for corners mapped above the highest * fuse corner so use the fuse corner value directly. */ j = vreg->fuse_corner_count - 1; for (i = fmax_corner[j] + 1; i < vreg->corner_count; i++) vreg->corner[i].open_loop_volt = fuse_volt[j]; /* * Corner LowSVS should be skipped for voltage interpolation * since no fuse exists for it. Instead, the lowest interpolation Loading Loading @@ -969,19 +966,8 @@ static int cpr3_msm8996_hmss_calculate_target_quotients( volt_adjust, volt_adjust_fuse, ro_scale); } /* Determine highest corner mapped to each fuse corner */ j = vreg->fuse_corner_count - 1; for (i = vreg->corner_count - 1; i >= 0; i--) { if (vreg->corner[i].cpr_fuse_corner == j) { fmax_corner[j] = i; j--; } } if (j >= 0) { cpr3_err(vreg, "invalid fuse corner mapping\n"); rc = -EINVAL; goto done; } for (i = 0; i < vreg->fuse_corner_count; i++) fmax_corner[i] = vreg->fuse_corner_map[i]; /* * Interpolation is not possible for corners mapped to the lowest fuse Loading @@ -998,6 +984,17 @@ static int cpr3_msm8996_hmss_calculate_target_quotients( for (i = 0; i <= fmax_corner[CPR3_MSM8996_HMSS_FUSE_CORNER_MINSVS]; i++) vreg->corner[i].target_quot[ro] = quot; /* * Interpolation is not possible for corners mapped above the highest * fuse corner so use the fuse corner value directly. */ j = vreg->fuse_corner_count - 1; quot_adjust = cpr3_quot_adjustment(ro_scale[j], volt_adjust_fuse[j]); quot = fuse->target_quot[j] + quot_adjust; ro = fuse->ro_sel[j]; for (i = fmax_corner[j] + 1; i < vreg->corner_count; i++) vreg->corner[i].target_quot[ro] = quot; /* * The LowSVS target quotient is defined as: * (SVS target quotient) - (the unpacked SVS quotient offset) Loading
drivers/regulator/cpr3-regulator.h +9 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,14 @@ struct cprh_corner_band { * @fuse_combos_supported: The number of fuse combinations supported by the * device tree configuration for this CPR3 regulator * @fuse_corner_count: Number of corners defined by fuse parameters * @fuse_corner_map: Array of length fuse_corner_count which specifies the * highest corner associated with each fuse corner. Note * that each element must correspond to a valid corner * and that element values must be strictly increasing. * Also, it is acceptable for the lowest fuse corner to map * to a corner other than the lowest. Likewise, it is * acceptable for the highest fuse corner to map to a * corner other than the highest. * @fuse_combo_corner_sum: The sum of the corner counts across all fuse combos * @fuse_combo_offset: The device tree property array offset for the selected * fuse combo Loading Loading @@ -333,6 +341,7 @@ struct cpr3_regulator { int fuse_combo; int fuse_combos_supported; int fuse_corner_count; int *fuse_corner_map; int fuse_combo_corner_sum; int fuse_combo_offset; int speed_bin_corner_sum; Loading
drivers/regulator/cpr3-util.c +22 −8 Original line number Diff line number Diff line Loading @@ -528,9 +528,9 @@ int cpr3_parse_corner_band_array_property(struct cpr3_regulator *vreg, * and qcom,cpr-corner-fmax-map. * * It initializes these CPR3 regulator elements: corner, corner_count, * fuse_combos_supported, and speed_bins_supported. It initializes these * elements for each corner: ceiling_volt, floor_volt, proc_freq, and * cpr_fuse_corner. * fuse_combos_supported, fuse_corner_map, and speed_bins_supported. It * initializes these elements for each corner: ceiling_volt, floor_volt, * proc_freq, and cpr_fuse_corner. * * It requires that the following CPR3 regulator elements be initialized before * being called: fuse_corner_count, fuse_combo, and speed_bin_fuse. Loading Loading @@ -750,11 +750,19 @@ int cpr3_parse_common_corner_data(struct cpr3_regulator *vreg) } } vreg->fuse_corner_map = devm_kcalloc(ctrl->dev, vreg->fuse_corner_count, sizeof(*vreg->fuse_corner_map), GFP_KERNEL); if (!vreg->fuse_corner_map) { rc = -ENOMEM; goto free_temp; } rc = cpr3_parse_array_property(vreg, "qcom,cpr-corner-fmax-map", vreg->fuse_corner_count, temp); if (rc) goto free_temp; for (i = 0; i < vreg->fuse_corner_count; i++) { vreg->fuse_corner_map[i] = temp[i] - CPR3_CORNER_OFFSET; if (temp[i] < CPR3_CORNER_OFFSET || temp[i] > vreg->corner_count + CPR3_CORNER_OFFSET) { cpr3_err(vreg, "invalid corner value specified in qcom,cpr-corner-fmax-map: %u\n", Loading @@ -768,13 +776,11 @@ int cpr3_parse_common_corner_data(struct cpr3_regulator *vreg) goto free_temp; } } if (temp[vreg->fuse_corner_count - 1] != vreg->corner_count) { cpr3_err(vreg, "highest Fmax corner %u in qcom,cpr-corner-fmax-map does not match highest supported corner %d\n", if (temp[vreg->fuse_corner_count - 1] != vreg->corner_count) cpr3_debug(vreg, "Note: highest Fmax corner %u in qcom,cpr-corner-fmax-map does not match highest supported corner %d\n", temp[vreg->fuse_corner_count - 1], vreg->corner_count); rc = -EINVAL; goto free_temp; } for (i = 0; i < vreg->corner_count; i++) { for (j = 0; j < vreg->fuse_corner_count; j++) { if (i + CPR3_CORNER_OFFSET <= temp[j]) { Loading @@ -782,6 +788,14 @@ int cpr3_parse_common_corner_data(struct cpr3_regulator *vreg) break; } } if (j == vreg->fuse_corner_count) { /* * Handle the case where the highest fuse corner maps * to a corner below the highest corner. */ vreg->corner[i].cpr_fuse_corner = vreg->fuse_corner_count - 1; } } if (of_find_property(vreg->of_node, Loading