2010-05-29 10:32:21 -06:00
|
|
|
/*
|
|
|
|
* OMAP3/OMAP4 Voltage Management Routines
|
|
|
|
*
|
|
|
|
* Author: Thara Gopinath <thara@ti.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Texas Instruments, Inc.
|
|
|
|
* Rajendra Nayak <rnayak@ti.com>
|
|
|
|
* Lesly A M <x0080970@ti.com>
|
|
|
|
*
|
2011-03-10 22:17:45 -07:00
|
|
|
* Copyright (C) 2008, 2011 Nokia Corporation
|
2010-05-29 10:32:21 -06:00
|
|
|
* Kalle Jokiniemi
|
2011-03-10 22:17:45 -07:00
|
|
|
* Paul Walmsley
|
2010-05-29 10:32:21 -06:00
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Texas Instruments, Inc.
|
|
|
|
* Thara Gopinath <thara@ti.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/err.h>
|
2011-07-31 14:17:29 -06:00
|
|
|
#include <linux/export.h>
|
2010-05-29 10:32:21 -06:00
|
|
|
#include <linux/debugfs.h>
|
|
|
|
#include <linux/slab.h>
|
2011-04-04 18:22:28 -06:00
|
|
|
#include <linux/clk.h>
|
2010-05-29 10:32:21 -06:00
|
|
|
|
2011-11-10 14:45:17 -07:00
|
|
|
#include "common.h"
|
2010-05-29 10:32:21 -06:00
|
|
|
|
|
|
|
#include "prm-regbits-34xx.h"
|
2010-12-10 10:45:23 -07:00
|
|
|
#include "prm-regbits-44xx.h"
|
|
|
|
#include "prm44xx.h"
|
|
|
|
#include "prcm44xx.h"
|
|
|
|
#include "prminst44xx.h"
|
2010-05-29 10:32:21 -06:00
|
|
|
#include "control.h"
|
|
|
|
|
2011-02-25 15:54:33 -07:00
|
|
|
#include "voltage.h"
|
2011-03-16 17:13:15 -06:00
|
|
|
#include "powerdomain.h"
|
2011-02-25 15:54:33 -07:00
|
|
|
|
2011-03-10 22:17:45 -07:00
|
|
|
#include "vc.h"
|
|
|
|
#include "vp.h"
|
|
|
|
|
2011-03-16 15:25:45 -06:00
|
|
|
static LIST_HEAD(voltdm_list);
|
2010-05-29 10:32:21 -06:00
|
|
|
|
|
|
|
/* Public functions */
|
|
|
|
/**
|
2011-07-15 17:05:12 -06:00
|
|
|
* voltdm_get_voltage() - Gets the current non-auto-compensated voltage
|
|
|
|
* @voltdm: pointer to the voltdm for which current voltage info is needed
|
2010-05-29 10:32:21 -06:00
|
|
|
*
|
2011-07-15 17:05:12 -06:00
|
|
|
* API to get the current non-auto-compensated voltage for a voltage domain.
|
|
|
|
* Returns 0 in case of error else returns the current voltage.
|
2010-05-29 10:32:21 -06:00
|
|
|
*/
|
2011-07-15 17:05:12 -06:00
|
|
|
unsigned long voltdm_get_voltage(struct voltagedomain *voltdm)
|
2010-05-29 10:32:21 -06:00
|
|
|
{
|
|
|
|
if (!voltdm || IS_ERR(voltdm)) {
|
|
|
|
pr_warning("%s: VDD specified does not exist!\n", __func__);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-04-05 17:55:22 -06:00
|
|
|
return voltdm->nominal_volt;
|
2010-05-29 10:32:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-04-05 17:27:21 -06:00
|
|
|
* voltdm_scale() - API to scale voltage of a particular voltage domain.
|
|
|
|
* @voltdm: pointer to the voltage domain which is to be scaled.
|
|
|
|
* @target_volt: The target voltage of the voltage domain
|
2010-05-29 10:32:21 -06:00
|
|
|
*
|
|
|
|
* This API should be called by the kernel to do the voltage scaling
|
2011-04-05 17:27:21 -06:00
|
|
|
* for a particular voltage domain during DVFS.
|
2010-05-29 10:32:21 -06:00
|
|
|
*/
|
2011-04-05 17:27:21 -06:00
|
|
|
int voltdm_scale(struct voltagedomain *voltdm,
|
|
|
|
unsigned long target_volt)
|
2010-05-29 10:32:21 -06:00
|
|
|
{
|
2012-03-02 15:08:57 -07:00
|
|
|
int ret, i;
|
|
|
|
unsigned long volt = 0;
|
2011-07-15 17:05:12 -06:00
|
|
|
|
2010-05-29 10:32:21 -06:00
|
|
|
if (!voltdm || IS_ERR(voltdm)) {
|
|
|
|
pr_warning("%s: VDD specified does not exist!\n", __func__);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2011-07-14 12:12:32 -06:00
|
|
|
if (!voltdm->scale) {
|
2010-05-29 10:32:21 -06:00
|
|
|
pr_err("%s: No voltage scale API registered for vdd_%s\n",
|
|
|
|
__func__, voltdm->name);
|
|
|
|
return -ENODATA;
|
|
|
|
}
|
|
|
|
|
2012-03-02 15:08:57 -07:00
|
|
|
/* Adjust voltage to the exact voltage from the OPP table */
|
|
|
|
for (i = 0; voltdm->volt_data[i].volt_nominal != 0; i++) {
|
|
|
|
if (voltdm->volt_data[i].volt_nominal >= target_volt) {
|
|
|
|
volt = voltdm->volt_data[i].volt_nominal;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!volt) {
|
|
|
|
pr_warning("%s: not scaling. OPP voltage for %lu, not found.\n",
|
|
|
|
__func__, target_volt);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = voltdm->scale(voltdm, volt);
|
2011-07-18 17:24:17 -06:00
|
|
|
if (!ret)
|
2012-03-02 15:08:57 -07:00
|
|
|
voltdm->nominal_volt = volt;
|
2011-07-18 17:24:17 -06:00
|
|
|
|
|
|
|
return ret;
|
2010-05-29 10:32:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-04-05 17:27:21 -06:00
|
|
|
* voltdm_reset() - Resets the voltage of a particular voltage domain
|
|
|
|
* to that of the current OPP.
|
|
|
|
* @voltdm: pointer to the voltage domain whose voltage is to be reset.
|
2010-05-29 10:32:21 -06:00
|
|
|
*
|
|
|
|
* This API finds out the correct voltage the voltage domain is supposed
|
2011-03-30 19:57:33 -06:00
|
|
|
* to be at and resets the voltage to that level. Should be used especially
|
2010-05-29 10:32:21 -06:00
|
|
|
* while disabling any voltage compensation modules.
|
|
|
|
*/
|
2011-04-05 17:27:21 -06:00
|
|
|
void voltdm_reset(struct voltagedomain *voltdm)
|
2010-05-29 10:32:21 -06:00
|
|
|
{
|
2011-04-05 17:27:21 -06:00
|
|
|
unsigned long target_volt;
|
2010-05-29 10:32:21 -06:00
|
|
|
|
|
|
|
if (!voltdm || IS_ERR(voltdm)) {
|
|
|
|
pr_warning("%s: VDD specified does not exist!\n", __func__);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-07-15 17:05:12 -06:00
|
|
|
target_volt = voltdm_get_voltage(voltdm);
|
2011-04-05 17:27:21 -06:00
|
|
|
if (!target_volt) {
|
2010-05-29 10:32:21 -06:00
|
|
|
pr_err("%s: unable to find current voltage for vdd_%s\n",
|
|
|
|
__func__, voltdm->name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-04-05 17:27:21 -06:00
|
|
|
voltdm_scale(voltdm, target_volt);
|
2010-05-29 10:32:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* omap_voltage_get_volttable() - API to get the voltage table associated with a
|
|
|
|
* particular voltage domain.
|
|
|
|
* @voltdm: pointer to the VDD for which the voltage table is required
|
|
|
|
* @volt_data: the voltage table for the particular vdd which is to be
|
|
|
|
* populated by this API
|
|
|
|
*
|
|
|
|
* This API populates the voltage table associated with a VDD into the
|
|
|
|
* passed parameter pointer. Returns the count of distinct voltages
|
|
|
|
* supported by this vdd.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void omap_voltage_get_volttable(struct voltagedomain *voltdm,
|
2011-07-14 12:29:06 -06:00
|
|
|
struct omap_volt_data **volt_data)
|
2010-05-29 10:32:21 -06:00
|
|
|
{
|
|
|
|
if (!voltdm || IS_ERR(voltdm)) {
|
|
|
|
pr_warning("%s: VDD specified does not exist!\n", __func__);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-07-14 12:29:06 -06:00
|
|
|
*volt_data = voltdm->volt_data;
|
2010-05-29 10:32:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* omap_voltage_get_voltdata() - API to get the voltage table entry for a
|
|
|
|
* particular voltage
|
|
|
|
* @voltdm: pointer to the VDD whose voltage table has to be searched
|
|
|
|
* @volt: the voltage to be searched in the voltage table
|
|
|
|
*
|
|
|
|
* This API searches through the voltage table for the required voltage
|
|
|
|
* domain and tries to find a matching entry for the passed voltage volt.
|
|
|
|
* If a matching entry is found volt_data is populated with that entry.
|
|
|
|
* This API searches only through the non-compensated voltages int the
|
|
|
|
* voltage table.
|
|
|
|
* Returns pointer to the voltage table entry corresponding to volt on
|
2011-03-30 19:57:33 -06:00
|
|
|
* success. Returns -ENODATA if no voltage table exisits for the passed voltage
|
2010-05-29 10:32:21 -06:00
|
|
|
* domain or if there is no matching entry.
|
|
|
|
*/
|
|
|
|
struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
|
2011-07-14 12:29:06 -06:00
|
|
|
unsigned long volt)
|
2010-05-29 10:32:21 -06:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!voltdm || IS_ERR(voltdm)) {
|
|
|
|
pr_warning("%s: VDD specified does not exist!\n", __func__);
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
}
|
|
|
|
|
2011-07-14 12:29:06 -06:00
|
|
|
if (!voltdm->volt_data) {
|
2010-05-29 10:32:21 -06:00
|
|
|
pr_warning("%s: voltage table does not exist for vdd_%s\n",
|
|
|
|
__func__, voltdm->name);
|
|
|
|
return ERR_PTR(-ENODATA);
|
|
|
|
}
|
|
|
|
|
2011-07-14 12:29:06 -06:00
|
|
|
for (i = 0; voltdm->volt_data[i].volt_nominal != 0; i++) {
|
|
|
|
if (voltdm->volt_data[i].volt_nominal == volt)
|
|
|
|
return &voltdm->volt_data[i];
|
2010-05-29 10:32:21 -06:00
|
|
|
}
|
|
|
|
|
2012-07-26 00:54:26 -06:00
|
|
|
pr_notice("%s: Unable to match the current voltage with the voltage table for vdd_%s\n",
|
|
|
|
__func__, voltdm->name);
|
2010-05-29 10:32:21 -06:00
|
|
|
|
|
|
|
return ERR_PTR(-ENODATA);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* omap_voltage_register_pmic() - API to register PMIC specific data
|
|
|
|
* @voltdm: pointer to the VDD for which the PMIC specific data is
|
|
|
|
* to be registered
|
2011-03-30 12:01:10 -06:00
|
|
|
* @pmic: the structure containing pmic info
|
2010-05-29 10:32:21 -06:00
|
|
|
*
|
|
|
|
* This API is to be called by the SOC/PMIC file to specify the
|
2011-03-30 12:01:10 -06:00
|
|
|
* pmic specific info as present in omap_voltdm_pmic structure.
|
2010-05-29 10:32:21 -06:00
|
|
|
*/
|
|
|
|
int omap_voltage_register_pmic(struct voltagedomain *voltdm,
|
2011-03-30 12:01:10 -06:00
|
|
|
struct omap_voltdm_pmic *pmic)
|
2010-05-29 10:32:21 -06:00
|
|
|
{
|
|
|
|
if (!voltdm || IS_ERR(voltdm)) {
|
|
|
|
pr_warning("%s: VDD specified does not exist!\n", __func__);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2011-03-30 12:01:10 -06:00
|
|
|
voltdm->pmic = pmic;
|
2010-05-29 10:32:21 -06:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* omap_change_voltscale_method() - API to change the voltage scaling method.
|
|
|
|
* @voltdm: pointer to the VDD whose voltage scaling method
|
|
|
|
* has to be changed.
|
|
|
|
* @voltscale_method: the method to be used for voltage scaling.
|
|
|
|
*
|
|
|
|
* This API can be used by the board files to change the method of voltage
|
|
|
|
* scaling between vpforceupdate and vcbypass. The parameter values are
|
|
|
|
* defined in voltage.h
|
|
|
|
*/
|
|
|
|
void omap_change_voltscale_method(struct voltagedomain *voltdm,
|
2011-07-14 12:12:32 -06:00
|
|
|
int voltscale_method)
|
2010-05-29 10:32:21 -06:00
|
|
|
{
|
|
|
|
if (!voltdm || IS_ERR(voltdm)) {
|
|
|
|
pr_warning("%s: VDD specified does not exist!\n", __func__);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (voltscale_method) {
|
|
|
|
case VOLTSCALE_VPFORCEUPDATE:
|
2011-07-14 12:12:32 -06:00
|
|
|
voltdm->scale = omap_vp_forceupdate_scale;
|
2010-05-29 10:32:21 -06:00
|
|
|
return;
|
|
|
|
case VOLTSCALE_VCBYPASS:
|
2011-07-14 12:12:32 -06:00
|
|
|
voltdm->scale = omap_vc_bypass_scale;
|
2010-05-29 10:32:21 -06:00
|
|
|
return;
|
|
|
|
default:
|
2012-07-26 00:54:26 -06:00
|
|
|
pr_warn("%s: Trying to change the method of voltage scaling to an unsupported one!\n",
|
|
|
|
__func__);
|
2010-05-29 10:32:21 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* omap_voltage_late_init() - Init the various voltage parameters
|
|
|
|
*
|
|
|
|
* This API is to be called in the later stages of the
|
|
|
|
* system boot to init the voltage controller and
|
|
|
|
* voltage processors.
|
|
|
|
*/
|
|
|
|
int __init omap_voltage_late_init(void)
|
|
|
|
{
|
2011-03-16 15:25:45 -06:00
|
|
|
struct voltagedomain *voltdm;
|
2010-05-29 10:32:21 -06:00
|
|
|
|
2011-03-16 15:25:45 -06:00
|
|
|
if (list_empty(&voltdm_list)) {
|
2010-05-29 10:32:21 -06:00
|
|
|
pr_err("%s: Voltage driver support not added\n",
|
|
|
|
__func__);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2011-03-16 15:25:45 -06:00
|
|
|
list_for_each_entry(voltdm, &voltdm_list, node) {
|
2011-04-04 18:22:28 -06:00
|
|
|
struct clk *sys_ck;
|
|
|
|
|
2011-03-23 18:00:21 -06:00
|
|
|
if (!voltdm->scalable)
|
|
|
|
continue;
|
|
|
|
|
2011-04-04 18:22:28 -06:00
|
|
|
sys_ck = clk_get(NULL, voltdm->sys_clk.name);
|
|
|
|
if (IS_ERR(sys_ck)) {
|
|
|
|
pr_warning("%s: Could not get sys clk.\n", __func__);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
voltdm->sys_clk.rate = clk_get_rate(sys_ck);
|
|
|
|
WARN_ON(!voltdm->sys_clk.rate);
|
|
|
|
clk_put(sys_ck);
|
|
|
|
|
2011-07-18 16:48:22 -06:00
|
|
|
if (voltdm->vc) {
|
2011-07-14 12:12:32 -06:00
|
|
|
voltdm->scale = omap_vc_bypass_scale;
|
2011-03-22 17:14:57 -06:00
|
|
|
omap_vc_init_channel(voltdm);
|
2011-07-18 16:48:22 -06:00
|
|
|
}
|
2011-03-22 17:14:57 -06:00
|
|
|
|
2011-07-14 12:29:06 -06:00
|
|
|
if (voltdm->vp) {
|
|
|
|
voltdm->scale = omap_vp_forceupdate_scale;
|
2011-03-21 15:29:13 -06:00
|
|
|
omap_vp_init(voltdm);
|
2011-03-16 15:25:45 -06:00
|
|
|
}
|
2010-05-29 10:32:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-03-16 15:25:45 -06:00
|
|
|
static struct voltagedomain *_voltdm_lookup(const char *name)
|
2010-05-29 10:32:21 -06:00
|
|
|
{
|
2011-03-16 15:25:45 -06:00
|
|
|
struct voltagedomain *voltdm, *temp_voltdm;
|
|
|
|
|
|
|
|
voltdm = NULL;
|
|
|
|
|
|
|
|
list_for_each_entry(temp_voltdm, &voltdm_list, node) {
|
|
|
|
if (!strcmp(name, temp_voltdm->name)) {
|
|
|
|
voltdm = temp_voltdm;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return voltdm;
|
|
|
|
}
|
|
|
|
|
2011-03-16 17:13:15 -06:00
|
|
|
/**
|
|
|
|
* voltdm_add_pwrdm - add a powerdomain to a voltagedomain
|
|
|
|
* @voltdm: struct voltagedomain * to add the powerdomain to
|
|
|
|
* @pwrdm: struct powerdomain * to associate with a voltagedomain
|
|
|
|
*
|
|
|
|
* Associate the powerdomain @pwrdm with a voltagedomain @voltdm. This
|
|
|
|
* enables the use of voltdm_for_each_pwrdm(). Returns -EINVAL if
|
|
|
|
* presented with invalid pointers; -ENOMEM if memory could not be allocated;
|
|
|
|
* or 0 upon success.
|
|
|
|
*/
|
|
|
|
int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm)
|
|
|
|
{
|
|
|
|
if (!voltdm || !pwrdm)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2012-07-26 00:54:26 -06:00
|
|
|
pr_debug("voltagedomain: %s: associating powerdomain %s\n",
|
|
|
|
voltdm->name, pwrdm->name);
|
2011-03-16 17:13:15 -06:00
|
|
|
|
|
|
|
list_add(&pwrdm->voltdm_node, &voltdm->pwrdm_list);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* voltdm_for_each_pwrdm - call function for each pwrdm in a voltdm
|
|
|
|
* @voltdm: struct voltagedomain * to iterate over
|
|
|
|
* @fn: callback function *
|
|
|
|
*
|
|
|
|
* Call the supplied function @fn for each powerdomain in the
|
|
|
|
* voltagedomain @voltdm. Returns -EINVAL if presented with invalid
|
|
|
|
* pointers; or passes along the last return value of the callback
|
|
|
|
* function, which should be 0 for success or anything else to
|
|
|
|
* indicate failure.
|
|
|
|
*/
|
|
|
|
int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
|
|
|
|
int (*fn)(struct voltagedomain *voltdm,
|
|
|
|
struct powerdomain *pwrdm))
|
|
|
|
{
|
|
|
|
struct powerdomain *pwrdm;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (!fn)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
list_for_each_entry(pwrdm, &voltdm->pwrdm_list, voltdm_node)
|
|
|
|
ret = (*fn)(voltdm, pwrdm);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* voltdm_for_each - call function on each registered voltagedomain
|
|
|
|
* @fn: callback function *
|
|
|
|
*
|
|
|
|
* Call the supplied function @fn for each registered voltagedomain.
|
|
|
|
* The callback function @fn can return anything but 0 to bail out
|
|
|
|
* early from the iterator. Returns the last return value of the
|
|
|
|
* callback function, which should be 0 for success or anything else
|
|
|
|
* to indicate failure; or -EINVAL if the function pointer is null.
|
|
|
|
*/
|
|
|
|
int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
|
|
|
|
void *user)
|
|
|
|
{
|
|
|
|
struct voltagedomain *temp_voltdm;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (!fn)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
list_for_each_entry(temp_voltdm, &voltdm_list, node) {
|
|
|
|
ret = (*fn)(temp_voltdm, user);
|
|
|
|
if (ret)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-03-16 15:25:45 -06:00
|
|
|
static int _voltdm_register(struct voltagedomain *voltdm)
|
|
|
|
{
|
|
|
|
if (!voltdm || !voltdm->name)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2011-03-16 17:13:15 -06:00
|
|
|
INIT_LIST_HEAD(&voltdm->pwrdm_list);
|
2011-03-16 15:25:45 -06:00
|
|
|
list_add(&voltdm->node, &voltdm_list);
|
|
|
|
|
|
|
|
pr_debug("voltagedomain: registered %s\n", voltdm->name);
|
|
|
|
|
2010-05-29 10:32:21 -06:00
|
|
|
return 0;
|
|
|
|
}
|
2011-03-16 15:25:45 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* voltdm_lookup - look up a voltagedomain by name, return a pointer
|
|
|
|
* @name: name of voltagedomain
|
|
|
|
*
|
|
|
|
* Find a registered voltagedomain by its name @name. Returns a pointer
|
|
|
|
* to the struct voltagedomain if found, or NULL otherwise.
|
|
|
|
*/
|
|
|
|
struct voltagedomain *voltdm_lookup(const char *name)
|
|
|
|
{
|
|
|
|
struct voltagedomain *voltdm ;
|
|
|
|
|
|
|
|
if (!name)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
voltdm = _voltdm_lookup(name);
|
|
|
|
|
|
|
|
return voltdm;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* voltdm_init - set up the voltagedomain layer
|
|
|
|
* @voltdm_list: array of struct voltagedomain pointers to register
|
|
|
|
*
|
|
|
|
* Loop through the array of voltagedomains @voltdm_list, registering all
|
|
|
|
* that are available on the current CPU. If voltdm_list is supplied
|
|
|
|
* and not null, all of the referenced voltagedomains will be
|
|
|
|
* registered. No return value.
|
|
|
|
*/
|
|
|
|
void voltdm_init(struct voltagedomain **voltdms)
|
|
|
|
{
|
|
|
|
struct voltagedomain **v;
|
|
|
|
|
|
|
|
if (voltdms) {
|
|
|
|
for (v = voltdms; *v; v++)
|
|
|
|
_voltdm_register(*v);
|
|
|
|
}
|
|
|
|
}
|