コード例 #1
0
ファイル: scpi-cpufreq.c プロジェクト: JoonsooKim/linux
static int scpi_opp_table_ops(struct device *cpu_dev, bool remove)
{
	int idx, ret = 0;
	struct scpi_opp *opp;
	struct scpi_dvfs_info *info = scpi_get_dvfs_info(cpu_dev);

	if (IS_ERR(info))
		return PTR_ERR(info);

	if (!info->opps)
		return -EIO;

	for (opp = info->opps, idx = 0; idx < info->count; idx++, opp++) {
		if (remove)
			dev_pm_opp_remove(cpu_dev, opp->freq);
		else
			ret = dev_pm_opp_add(cpu_dev, opp->freq,
					     opp->m_volt * 1000);
		if (ret) {
			dev_warn(cpu_dev, "failed to add opp %uHz %umV\n",
				 opp->freq, opp->m_volt);
			while (idx-- > 0)
				dev_pm_opp_remove(cpu_dev, (--opp)->freq);
			return ret;
		}
	}
	return ret;
}
コード例 #2
0
ファイル: cvb.c プロジェクト: 513855417/linux
void tegra_cvb_remove_opp_table(struct device *dev,
				const struct cvb_table *table,
				unsigned long max_freq)
{
	unsigned int i;

	for (i = 0; i < MAX_DVFS_FREQS; i++) {
		const struct cvb_table_freq_entry *entry = &table->entries[i];

		if (!entry->freq || (entry->freq > max_freq))
			break;

		dev_pm_opp_remove(dev, entry->freq);
	}
}