staticint panfrost_read_speedbin(struct device *dev)
{
u32 val; int ret;
ret = nvmem_cell_read_variable_le_u32(dev, "speed-bin", &val); if (ret) { /* * -ENOENT means that this platform doesn't support speedbins * as it didn't declare any speed-bin nvmem: in this case, we * keep going without it; any other error means that we are * supposed to read the bin value, but we failed doing so.
*/ if (ret != -ENOENT && ret != -EOPNOTSUPP) {
DRM_DEV_ERROR(dev, "Cannot read speed-bin (%d).", ret); return ret;
}
if (pfdev->comp->num_supplies > 1) { /* * GPUs with more than 1 supply require platform-specific handling: * continue without devfreq
*/
DRM_DEV_INFO(dev, "More than 1 supply is not supported yet\n"); return 0;
}
ret = panfrost_read_speedbin(dev); if (ret) return ret;
ret = devm_pm_opp_set_regulators(dev, pfdev->comp->supply_names); if (ret) { /* Continue if the optional regulator is missing */ if (ret != -ENODEV) { if (ret != -EPROBE_DEFER)
DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n"); return ret;
}
}
ret = devm_pm_opp_of_add_table(dev); if (ret) { /* Optional, continue without devfreq */ if (ret == -ENODEV)
ret = 0; return ret;
}
pfdevfreq->opp_of_table_added = true;
spin_lock_init(&pfdevfreq->lock);
panfrost_devfreq_reset(pfdevfreq);
cur_freq = clk_get_rate(pfdev->clock);
opp = devfreq_recommended_opp(dev, &cur_freq, 0); if (IS_ERR(opp)) return PTR_ERR(opp);
panfrost_devfreq_profile.initial_freq = cur_freq;
/* * We could wait until panfrost_devfreq_target() to set this value, but * since the simple_ondemand governor works asynchronously, there's a * chance by the time someone opens the device's fdinfo file, current * frequency hasn't been updated yet, so let's just do an early set.
*/
pfdevfreq->current_frequency = cur_freq;
/* * Set the recommend OPP this will enable and configure the regulator * if any and will avoid a switch off by regulator_late_cleanup()
*/
ret = dev_pm_opp_set_opp(dev, opp);
dev_pm_opp_put(opp); if (ret) {
DRM_DEV_ERROR(dev, "Couldn't set recommended OPP\n"); return ret;
}
/* Find the fastest defined rate */
opp = dev_pm_opp_find_freq_floor(dev, &freq); if (IS_ERR(opp)) return PTR_ERR(opp);
pfdevfreq->fast_rate = freq;
dev_pm_opp_put(opp);
/* * Setup default thresholds for the simple_ondemand governor. * The values are chosen based on experiments.
*/
pfdevfreq->gov_data.upthreshold = 45;
pfdevfreq->gov_data.downdifferential = 5;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.