예제 #1
0
/*
 * FET1: Backlight on the Chromebook
 * FET6: LCD panel on the Chromebook
 */
void
tps65090_fet_enable(int fet)
{
	int i;

	if (fet < 1 || fet > NFET)
		return;

	for (i = 0; i < 10; i++) {
		if (!tps65090_fet_set(fet, 1))
			break;

		if (i != 9)
			tps65090_fet_set(fet, 0);
	}
}
예제 #2
0
파일: pmic_tps65090.c 프로젝트: mconners/r2
int tps65090_fet_enable(unsigned int fet_id)
{
	struct pmic *pmic;
	ulong start;
	int loops;
	int ret;

	ret = tps65090_check_fet(fet_id);
	if (ret)
		return ret;

	pmic = pmic_get(TPS65090_NAME);
	if (!pmic)
		return -EACCES;

	start = get_timer(0);
	for (loops = 0;; loops++) {
		ret = tps65090_fet_set(pmic, fet_id, true);
		if (!ret)
			break;

		if (get_timer(start) > 100)
			break;

		/* Turn it off and try again until we time out */
		tps65090_fet_set(pmic, fet_id, false);
	}

	if (ret)
		debug("%s: FET%d failed to power on: time=%lums, loops=%d\n",
		      __func__, fet_id, get_timer(start), loops);
	else if (loops)
		debug("%s: FET%d powered on after %lums, loops=%d\n",
		      __func__, fet_id, get_timer(start), loops);

	/*
	 * Unfortunately, there are some conditions where the power
	 * good bit will be 0, but the fet still comes up. One such
	 * case occurs with the lcd backlight. We'll just return 0 here
	 * and assume that the fet will eventually come up.
	 */
	if (ret == -EAGAIN)
		ret = 0;

	return ret;
}
예제 #3
0
void
tps65090_fet_disable(int fet)
{
	if (fet < 1 || fet > NFET)
		return;

	tps65090_fet_set(fet, 0);
}
예제 #4
0
int tps65090_fet_enable(unsigned int fet_id)
{
	int loops;
	ulong start;
	int ret = 0;

	if (tps65090_check_fet(fet_id))
		return -1;
	if (tps65090_select())
		return -1;
	start = get_timer(0);
	for (loops = 0; ; loops++) {
		ret = tps65090_fet_set(fet_id, 1);
		if (!ret)
			break;

		if (get_timer(start) > 100)
			break;

		/* Turn it off and try again until we time out */
		tps65090_fet_set(fet_id, 0);
	}
	tps65090_deselect();

	if (ret) {
		debug("%s: FET%d failed to power on: time=%lums, loops=%d\n",
	      __func__, fet_id, get_timer(start), loops);
	} else if (loops) {
		debug("%s: FET%d powered on after %lums, loops=%d\n",
		      __func__, fet_id, get_timer(start), loops);
	}
	/*
	 * Unfortunately, there are some conditions where the power
	 * good bit will be 0, but the fet still comes up. One such
	 * case occurs with the lcd backlight. We'll just return 0 here
	 * and assume that the fet will eventually come up.
	 */
	if (ret == FET_ERR_NOT_READY)
		ret = 0;

	return ret;
}
예제 #5
0
int tps65090_fet_disable(unsigned int fet_id)
{
	int ret;

	if (tps65090_check_fet(fet_id))
		return -1;
	if (tps65090_select())
		return -1;
	ret = tps65090_fet_set(fet_id, 0);
	tps65090_deselect();

	return ret;
}
예제 #6
0
파일: pmic_tps65090.c 프로젝트: mconners/r2
int tps65090_fet_disable(unsigned int fet_id)
{
	struct pmic *pmic;
	int ret;

	ret = tps65090_check_fet(fet_id);
	if (ret)
		return ret;

	pmic = pmic_get(TPS65090_NAME);
	if (!pmic)
		return -EACCES;
	ret = tps65090_fet_set(pmic, fet_id, false);

	return ret;
}