Example #1
0
File: gk20a.c Project: 168519/linux
static int
gk20a_volt_set_id(struct nvkm_volt *volt, u8 id, int condition)
{
	struct gk20a_volt_priv *priv = (void *)volt;
	int prev_uv = regulator_get_voltage(priv->vdd);
	int target_uv = volt->vid[id].uv;
	int ret;

	nv_debug(volt, "prev=%d, target=%d, condition=%d\n",
			prev_uv, target_uv, condition);
	if (!condition ||
		(condition < 0 && target_uv < prev_uv) ||
		(condition > 0 && target_uv > prev_uv)) {
		ret = gk20a_volt_vid_set(volt, volt->vid[id].vid);
	} else {
		ret = 0;
	}

	return ret;
}
Example #2
0
File: gk20a.c Project: 020gzh/linux
int
gk20a_volt_set_id(struct nvkm_volt *base, u8 id, int condition)
{
	struct gk20a_volt *volt = gk20a_volt(base);
	struct nvkm_subdev *subdev = &volt->base.subdev;
	int prev_uv = regulator_get_voltage(volt->vdd);
	int target_uv = volt->base.vid[id].uv;
	int ret;

	nvkm_debug(subdev, "prev=%d, target=%d, condition=%d\n",
		   prev_uv, target_uv, condition);
	if (!condition ||
		(condition < 0 && target_uv < prev_uv) ||
		(condition > 0 && target_uv > prev_uv)) {
		ret = gk20a_volt_vid_set(&volt->base, volt->base.vid[id].vid);
	} else {
		ret = 0;
	}

	return ret;
}