Exemple #1
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		voltdm_por_nominal_voltage_get
 * @BRIEF		return the nominal voltage to be supplied to a
 *			voltage domain, as defined in Data Manual.
 * @RETURNS		nominal voltage in micro-volt (> 0) in case of success
 *			OMAPCONF_ERR_CPU
 *			OMAPCONF_ERR_ARG
 * @param[in]		voltdm: voltage domain name (as defined in voltdm.h)
 * @param[in]		opp: OPP provided as a string (as defined in opp.h)
 * @DESCRIPTION		return the nominal voltage to be supplied to a
 *			voltage domain, as defined in Data Manual.
 *			Not read from the platform, but from internal tables.
 *//*------------------------------------------------------------------------ */
int voltdm_por_nominal_voltage_get(const char *voltdm, const char *opp)
{
	int vdd_id, opp_id;

	CHECK_NULL_ARG(voltdm, OMAPCONF_ERR_ARG);

	voltdm_init();

	vdd_id = voltdm_s2id(voltdm);
	if (vdd_id < 0)
		return OMAPCONF_ERR_ARG;

	opp_id = opp_s2id(opp);
	if (opp_id < 0)
		return opp_id;

	if (cpu_is_omap44xx()) {
		return v2uv(voltdm44xx_por_nominal_voltage_get(
			(voltdm44xx_id) vdd_id, (opp44xx_id) opp_id));
	} else if (cpu_is_omap54xx()) {
		return v2uv(voltdm54xx_por_nominal_voltage_get(
			(voltdm54xx_id) vdd_id, (opp54xx_id) opp_id));
	} else {
		fprintf(stderr,
			"omapconf: %s(): cpu not supported!!!\n", __func__);
		return OMAPCONF_ERR_CPU;
	}
}
Exemple #2
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		voltdm_voltage_get
 * @BRIEF		return the current voltage supplied to a voltage domain.
 * @RETURNS		supplied voltage in micro-volt (> 0) in case of success
 *			OMAPCONF_ERR_CPU
 *			OMAPCONF_ERR_ARG
 *			OMAPCONF_ERR_REG_ACCESS
 *			OMAPCONF_ERR_NOT_AVAILABLE
 *			OMAPCONF_ERR_INTERNAL
 * @param[in]		voltdm: voltage domain name (as defined in voltdm.h)
 * @DESCRIPTION		return the current voltage supplied to a voltage domain.
 *//*------------------------------------------------------------------------ */
int voltdm_voltage_get(const char *voltdm)
{
	int id, ret;
	double volt;

	CHECK_NULL_ARG(voltdm, OMAPCONF_ERR_ARG);

	voltdm_init();

	id = voltdm_s2id(voltdm);
	if (id < 0)
		return (double) OMAPCONF_ERR_ARG;

	if (cpu_is_omap44xx()) {
		ret = voltdm44xx_get_voltage((voltdm44xx_id) id, &volt);
		if (ret < 0)
			return (double) ret;
		else
			return v2uv(volt);
	} else if (cpu_is_omap54xx()) {
		return v2uv(voltdm54xx_voltage_get((voltdm54xx_id) id));
	} else {
		fprintf(stderr,
			"omapconf: %s(): cpu not supported!!!\n", __func__);
		return (double) OMAPCONF_ERR_CPU;
	}
}
Exemple #3
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		voltdm_nominal_voltage_get
 * @BRIEF		return the nominal voltage supplied to a voltage domain.
 * @RETURNS		nominal voltage in micro-volt (> 0) in case of success
 *			OMAPCONF_ERR_CPU
 *			OMAPCONF_ERR_ARG
 * @param[in]		voltdm: voltage domain name (as defined in voltdm.h)
 * @DESCRIPTION		return the nominal voltage supplied to a voltage domain.
 *			In case SmartReflex AVS Class3 is enabled,
 *			it may differ from the current supplied voltage.
 *//*------------------------------------------------------------------------ */
int voltdm_nominal_voltage_get(const char *voltdm)
{
	int id;
	int uvolt;

	CHECK_NULL_ARG(voltdm, OMAPCONF_ERR_ARG);

	voltdm_init();

	id = voltdm_s2id(voltdm);
	if (id < 0) {
		uvolt = OMAPCONF_ERR_ARG;
	} else if (cpu_is_omap44xx()) {
		uvolt = v2uv(voltdm44xx_nominal_voltage_get(
			(voltdm44xx_id) id));
	} else if (cpu_is_omap54xx()) {
		uvolt = v2uv(voltdm54xx_nominal_voltage_get(
			(voltdm54xx_id) id));
	} else {
		fprintf(stderr,
			"omapconf: %s(): cpu not supported!!!\n", __func__);
		uvolt = OMAPCONF_ERR_CPU;
	}

	dprintf("%s(%s) = %duV\n", __func__, voltdm, uvolt);
	return uvolt;
}
Exemple #4
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		temp_sensor_voltdm2sensor
 * @BRIEF		convert generic voltage domain name
 *			into generic temperature sensor name.
 * @RETURNS		temperature sensor name
 *			NULL if not available or in case of error
 * @param[in]		voltdm: voltage domain name
 * @DESCRIPTION		convert generic voltage domain name
 *			into generic temperature sensor name.
 *			To be used to generically retrieve the temperature
 *			sensor of a given voltage domain.
 *//*------------------------------------------------------------------------ */
const char *temp_sensor_voltdm2sensor(const char *voltdm)
{
	int vdd_id;
	const char *sensor;

	CHECK_NULL_ARG(voltdm, NULL);

	vdd_id = voltdm_s2id(voltdm);
	if (vdd_id < 0) {
		sensor = NULL;
	} else if (cpu_is_omap44xx()) {
		switch (vdd_id) {
		case OMAP4_VDD_MPU:
			sensor = TEMP_SENSOR_HOTSPOT_MPU;
			break;
		case OMAP4_VDD_CORE:
			sensor = TEMP_SENSOR_BANDGAP;
			break;
		default:
			sensor = NULL;

		}
	} else if (cpu_is_omap54xx()) {
		switch (vdd_id) {
		case VDD54XX_MPU:
			sensor = TEMP_SENSOR_MPU;
			break;
		case VDD54XX_MM:
			sensor = TEMP_SENSOR_GPU;
			break;
		case VDD54XX_CORE:
			sensor = TEMP_SENSOR_CORE;
			break;
		default:
			sensor = NULL;

		}
	} else {
		fprintf(stderr,
			"omapconf: %s(): cpu not supported!!!\n", __func__);
		sensor = NULL;
	}

	dprintf("%s(%s) = %s\n", __func__, voltdm, sensor);
	return sensor;
}
Exemple #5
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		opp_count_get
 * @BRIEF		return the number of OPP(s) of a given voltage domain
 * @RETURNS		number of OPP(s) (> 0) in case of success
 *			OMAPCONF_ERR_CPU
 *			OMAPCONF_ERR_ARG
 * @param[in]		voltdm: voltage domain name (as defined in voltdm.h)
 * @DESCRIPTION		return the number of OPP(s) of a given voltage domain
 *//*------------------------------------------------------------------------ */
int opp_count_get(const char *voltdm)
{
	int vdd_id;

	CHECK_NULL_ARG(voltdm, OMAPCONF_ERR_ARG);

	opp_init();

	vdd_id = voltdm_s2id(voltdm);
	if (vdd_id < 0)
		return OMAPCONF_ERR_ARG;

	if (cpu_is_omap44xx()) {
		return opp44xx_count_get((voltdm44xx_id) vdd_id);
	} else if (cpu_is_omap54xx()) {
		return opp54xx_count_get((voltdm54xx_id) vdd_id);
	} else {
		fprintf(stderr,
			"omapconf: %s(): cpu not supported!!!\n", __func__);
		return OMAPCONF_ERR_CPU;
	}
}
Exemple #6
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		opp_list_get
 * @BRIEF		return the list of OPP of a given voltage domain
 * @RETURNS		list of OPP of a given voltage domain in case of success
 *			NULL in case of error
 * @param[in]		voltdm: voltage domain name (as defined in voltdm.h)
 * @DESCRIPTION		return the list of OPP of a given voltage domain
 *//*------------------------------------------------------------------------ */
const genlist *opp_list_get(const char *voltdm)
{
	int vdd_id;

	CHECK_NULL_ARG(voltdm, NULL);

	opp_init();

	vdd_id = voltdm_s2id(voltdm);
	if (vdd_id < 0)
		return NULL;

	if (cpu_is_omap44xx()) {
		return opp44xx_list_get((voltdm44xx_id) vdd_id);
	} else if (cpu_is_omap54xx()) {
		return opp54xx_list_get((voltdm54xx_id) vdd_id);
	} else {
		fprintf(stderr,
			"omapconf: %s(): cpu not supported!!!\n", __func__);
		return NULL;
	}
}
Exemple #7
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		voltdm_voltage_set
 * @BRIEF		set the voltage supplied to a voltage domain.
 * @RETURNS		0 in case of success
 *			OMAPCONF_ERR_CPU
 *			OMAPCONF_ERR_ARG
 *			OMAPCONF_ERR_REG_ACCESS
 *			OMAPCONF_ERR_NOT_AVAILABLE
 *			OMAPCONF_ERR_UNEXPECTED
 *			OMAPCONF_ERR_INTERNAL
 * @param[in]		voltdm: voltage domain name (as defined in voltdm.h)
 * @param[in]		uv: new voltage to be set (in micro-volt)
 * @DESCRIPTION		return the current voltage supplied to a voltage domain.
 *//*------------------------------------------------------------------------ */
int voltdm_voltage_set(const char *voltdm, int uv)
{
	int id;

	CHECK_NULL_ARG(voltdm, OMAPCONF_ERR_ARG);

	voltdm_init();

	id = voltdm_s2id(voltdm);
	if (id < 0)
		return (double) OMAPCONF_ERR_ARG;

	if (cpu_is_omap44xx()) {
		return sr44xx_voltage_set(
			(unsigned int) id, (unsigned long) uv);
	} else if (cpu_is_omap54xx()) {
		return voltdm54xx_voltage_set(
			(voltdm54xx_id) id, (unsigned long) uv);
	} else {
		fprintf(stderr,
			"omapconf: %s(): cpu not supported!!!\n", __func__);
		return OMAPCONF_ERR_CPU;
	}
}
Exemple #8
0
/* ------------------------------------------------------------------------*//**
 * @FUNCTION		opp_by_rate_get
 * @BRIEF		return the current voltage domain OPP name,
 *			searched by clock rates.
 * @RETURNS		current voltage domain OPP name (as defined in opp.h)
 *			NULL pointer in case of error
 * @param[in]		voltdm: voltage domain name (as defined in voltdm.h)
 * @param[in]		quiet: if == 0, print warning message when OPP
 *			could not be found
 * @DESCRIPTION		return the current voltage domain OPP,
 *			searched by clock rates.
 *//*------------------------------------------------------------------------ */
const char *opp_by_rate_get(const char *voltdm, unsigned short quiet)
{
	const char *opp = NULL;
	int vdd_id;

	CHECK_NULL_ARG(voltdm, NULL);

	opp_init();

	vdd_id = voltdm_s2id(voltdm);
	if (vdd_id < 0)
		return NULL;

	if (cpu_is_omap44xx()) {
		opp = opp44xx_by_rate_get(vdd_id);
	} else if (cpu_is_omap54xx()) {
		opp = opp54xx_by_rate_get(vdd_id);
	} else {
		fprintf(stderr, "omapconf: %s(): cpu not supported!!!\n",
			__func__);
		opp = NULL;
	}

	if ((quiet == 0) && (opp == NULL))
		fprintf(stdout,
			"omapconf: warning: no matching rate for %s OPP. Please check rates against Data Manual recommendations.\n",
			voltdm);

	#ifdef OPP_DEBUG
	if (opp != NULL)
		printf("%s(%s): found %s OPP\n", __func__, voltdm, opp);
	else
		printf("%s(%s): OPP not found!\n", __func__, voltdm);
	#endif
	return opp;
}