• Home
  • Raw
  • Download

Lines Matching full:corner

213 struct corner {  struct
234 struct corner *corner; argument
243 struct corner *corners;
305 static void cpr_ctl_enable(struct cpr_drv *drv, struct corner *corner) in cpr_ctl_enable() argument
318 corner->save_ctl); in cpr_ctl_enable()
319 cpr_irq_set(drv, corner->save_irq); in cpr_ctl_enable()
321 if (cpr_is_allowed(drv) && corner->max_uV > corner->min_uV) in cpr_ctl_enable()
358 static void cpr_corner_save(struct cpr_drv *drv, struct corner *corner) in cpr_corner_save() argument
360 corner->save_ctl = cpr_read(drv, REG_RBCPR_CTL); in cpr_corner_save()
361 corner->save_irq = cpr_read(drv, REG_RBIF_IRQ_EN(0)); in cpr_corner_save()
364 static void cpr_corner_restore(struct cpr_drv *drv, struct corner *corner) in cpr_corner_restore() argument
367 struct fuse_corner *fuse = corner->fuse_corner; in cpr_corner_restore()
373 gcnt |= fuse->quot - corner->quot_adjust; in cpr_corner_restore()
385 ctl = corner->save_ctl; in cpr_corner_restore()
387 irq = corner->save_irq; in cpr_corner_restore()
412 struct fuse_corner *prev_fuse_corner = drv->corner->fuse_corner; in cpr_pre_voltage()
424 struct fuse_corner *prev_fuse_corner = drv->corner->fuse_corner; in cpr_post_voltage()
432 static int cpr_scale_voltage(struct cpr_drv *drv, struct corner *corner, in cpr_scale_voltage() argument
436 struct fuse_corner *fuse_corner = corner->fuse_corner; in cpr_scale_voltage()
458 return drv->corner ? drv->corner - drv->corners + 1 : 0; in cpr_get_cur_perf_state()
465 struct corner *corner; in cpr_scale() local
475 corner = drv->corner; in cpr_scale()
481 last_uV = corner->last_uV; in cpr_scale()
495 if (last_uV >= corner->max_uV) { in cpr_scale()
515 new_uV = min(new_uV, corner->max_uV); in cpr_scale()
532 if (last_uV <= corner->min_uV) { in cpr_scale()
552 new_uV = max(new_uV, corner->min_uV); in cpr_scale()
559 ret = cpr_scale_voltage(drv, corner, new_uV, dir); in cpr_scale()
564 drv->corner->last_uV = new_uV; in cpr_scale()
636 /* Save register values for the corner */ in cpr_irq_handler()
637 cpr_corner_save(drv, drv->corner); in cpr_irq_handler()
655 if (cpr_is_allowed(drv) && drv->corner) { in cpr_enable()
657 cpr_corner_restore(drv, drv->corner); in cpr_enable()
658 cpr_ctl_enable(drv, drv->corner); in cpr_enable()
684 struct corner *corner; in cpr_config() local
731 corner = &drv->corners[i]; in cpr_config()
732 corner->save_ctl = val; in cpr_config()
733 corner->save_irq = CPR_INT_DEFAULT; in cpr_config()
749 struct corner *corner, *end; in cpr_set_performance_state() local
759 * Determine new corner we're going to. in cpr_set_performance_state()
762 corner = drv->corners + state - 1; in cpr_set_performance_state()
764 if (corner > end || corner < drv->corners) { in cpr_set_performance_state()
770 if (drv->corner > corner) in cpr_set_performance_state()
772 else if (drv->corner < corner) in cpr_set_performance_state()
778 new_uV = corner->last_uV; in cpr_set_performance_state()
780 new_uV = corner->uV; in cpr_set_performance_state()
785 ret = cpr_scale_voltage(drv, corner, new_uV, dir); in cpr_set_performance_state()
791 if (drv->corner != corner) in cpr_set_performance_state()
792 cpr_corner_restore(drv, corner); in cpr_set_performance_state()
793 cpr_ctl_enable(drv, corner); in cpr_set_performance_state()
796 drv->corner = corner; in cpr_set_performance_state()
926 * Allow the highest fuse corner's PVS voltage to in cpr_fuse_corner_init()
927 * define the ceiling voltage for that corner in order in cpr_fuse_corner_init()
951 * Restrict all fuse corner PVS voltages based upon per corner in cpr_fuse_corner_init()
965 "min uV: %d (fuse corner: %d) not supported by regulator\n", in cpr_fuse_corner_init()
975 "max uV: %d (fuse corner: %d) not supported by regulator\n", in cpr_fuse_corner_init()
981 "fuse corner %d: [%d %d %d] RO%hhu quot %d squot %d\n", in cpr_fuse_corner_init()
992 const struct corner *corner) in cpr_calculate_scaling() argument
1000 fuse = corner->fuse_corner; in cpr_calculate_scaling()
1020 static int cpr_interpolate(const struct corner *corner, int step_volt, in cpr_interpolate() argument
1028 fuse = corner->fuse_corner; in cpr_interpolate()
1035 f_diff = fuse->max_freq - corner->freq; in cpr_interpolate()
1042 if (f_high <= f_low || uV_high <= uV_low || f_high <= corner->freq) in cpr_interpolate()
1043 return corner->uV; in cpr_interpolate()
1117 struct corner *corner, *end; in cpr_corner_init() local
1129 corner = drv->corners; in cpr_corner_init()
1130 end = &corner[drv->num_corners - 1]; in cpr_corner_init()
1139 * Store maximum frequency for each fuse corner based on the frequency in cpr_corner_init()
1174 * QUOT(corner_N): quotient read from fuse for fuse corner N in cpr_corner_init()
1175 * QUOT(corner_N-1): quotient read from fuse for fuse corner (N - 1) in cpr_corner_init()
1176 * freq(corner_N): max frequency in MHz supported by fuse corner N in cpr_corner_init()
1177 * freq(corner_N-1): max frequency in MHz supported by fuse corner in cpr_corner_init()
1180 * Then walk through the corners mapped to each fuse corner in cpr_corner_init()
1186 * freq_max: max frequency in MHz supported by the fuse corner in cpr_corner_init()
1187 * freq_corner: frequency in MHz corresponding to the corner in cpr_corner_init()
1201 * corner corner in cpr_corner_init()
1203 * c = corner in cpr_corner_init()
1204 * f = fuse corner in cpr_corner_init()
1207 for (apply_scaling = false, i = 0; corner <= end; corner++, i++) { in cpr_corner_init()
1217 corner->fuse_corner = fuse; in cpr_corner_init()
1218 corner->freq = cdata[i].freq; in cpr_corner_init()
1219 corner->uV = fuse->uV; in cpr_corner_init()
1223 fdata, corner); in cpr_corner_init()
1228 } else if (corner->freq == fuse->max_freq) { in cpr_corner_init()
1229 /* This is a fuse corner; don't scale anything */ in cpr_corner_init()
1234 freq_diff = fuse->max_freq - corner->freq; in cpr_corner_init()
1236 corner->quot_adjust = scaling * freq_diff_mhz / 1000; in cpr_corner_init()
1238 corner->uV = cpr_interpolate(corner, step_volt, fdata); in cpr_corner_init()
1241 corner->max_uV = fuse->max_uV; in cpr_corner_init()
1242 corner->min_uV = fuse->min_uV; in cpr_corner_init()
1243 corner->uV = clamp(corner->uV, corner->min_uV, corner->max_uV); in cpr_corner_init()
1244 corner->last_uV = corner->uV; in cpr_corner_init()
1247 if (desc->reduce_to_corner_uV && corner->uV < corner->max_uV) in cpr_corner_init()
1248 corner->max_uV = corner->uV; in cpr_corner_init()
1249 else if (desc->reduce_to_fuse_uV && fuse->uV < corner->max_uV) in cpr_corner_init()
1250 corner->max_uV = max(corner->min_uV, fuse->uV); in cpr_corner_init()
1252 dev_dbg(drv->dev, "corner %d: [%d %d %d] quot %d\n", i, in cpr_corner_init()
1253 corner->min_uV, corner->uV, corner->max_uV, in cpr_corner_init()
1254 fuse->quot - corner->quot_adjust); in cpr_corner_init()
1335 const struct corner *end; in cpr_find_initial_corner()
1336 struct corner *iter; in cpr_find_initial_corner()
1363 drv->corner = iter; in cpr_find_initial_corner()
1367 drv->corner = iter; in cpr_find_initial_corner()
1370 if (!drv->corner) { in cpr_find_initial_corner()
1371 dev_err(drv->dev, "boot up corner not found\n"); in cpr_find_initial_corner()
1397 /* fuse corner 0 */
1410 /* fuse corner 1 */
1423 /* fuse corner 2 */
1526 * the maximum frequency for each fuse corner, and this is only in cpr_pd_attach_dev()
1529 * frequency associated with each fuse corner. in cpr_pd_attach_dev()
1596 struct corner *corner; in cpr_debug_info_show() local
1598 corner = drv->corner; in cpr_debug_info_show()
1599 fuse_corner = corner->fuse_corner; in cpr_debug_info_show()
1601 seq_printf(s, "corner, current_volt = %d uV\n", in cpr_debug_info_show()
1602 corner->last_uV); in cpr_debug_info_show()