static int act8865_workaround_disable_i2c(void)
{
	unsigned char value;
	unsigned char i;

	/* Check ACT8865 I2C interface */
	if (act8865_check_i2c_disabled())
		return 0;

	/* Disable ACT8865 I2C interface */
	for (i = 0; i < ARRAY_SIZE(version_array); i++) {
		value = version_array[i].set_value;
		act8865_disable_i2c_sequence(value);
		if (act8865_check_i2c_disabled())
			break;
	}

	if (i >= ARRAY_SIZE(version_array)) {
		dbg_loud("ACT8865: Failed to disable I2C interface\n");
		return -1;
	}

	dbg_info("ACT8865: Disable ACT8865's I2C interface\n");

	return 0;
}
static int sama5d4ek_act8865_set_reg_voltage(void)
{
	unsigned char reg, value;
	int ret;

	/* Check ACT8865 I2C interface */
	if (act8865_check_i2c_disabled())
		return 0;

	/* Enable REG5 output 3.3V */
	reg = REG5_0;
	value = ACT8865_3V3;
	ret = act8865_set_reg_voltage(reg, value);
	if (ret) {
		dbg_info("ACT8865: Failed to make REG5 output 3300mV\n");
		return -1;
	}

	dbg_info("ACT8865: The REG5 output 3300mV\n");

	/* Enable REG6 output 1.8V */
	reg = REG6_0;
	value = ACT8865_1V8;
	ret = act8865_set_reg_voltage(reg, value);
	if (ret) {
		dbg_info("ACT8865: Failed to make REG6 output 1800mV\n");
		return -1;
	}

	dbg_info("ACT8865: The REG6 output 1800mV\n");

	return 0;
}
Example #3
0
int at91_board_act8865_set_reg_voltage(void)
{
	unsigned char reg, value;
	int ret;

	/* Check ACT8865 I2C interface */
	if (act8865_check_i2c_disabled())
		return 0;

	/* Enable REG2 output 1.25V */
	reg = REG2_0;
	value = ACT8865_1V25;
	ret = act8865_set_reg_voltage(reg, value);
	if (ret) {
		dbg_info("ACT8865: Failed to make REG2 output 1250mV\n");
		return -1;
	}

	dbg_info("ACT8865: The REG2 output 1250mV\n");

	/* Enable REG5 output 3.3V */
	reg = REG5_0;
	value = ACT8865_3V3;
	ret = act8865_set_reg_voltage(reg, value);
	if (ret) {
		dbg_info("ACT8865: Failed to make REG5 output 3300mV\n");
		return -1;
	}

	dbg_info("ACT8865: The REG5 output 3300mV\n");

	return 0;
}
int at91_board_act8865_set_reg_voltage(void)
{
	unsigned char reg, value;
	int ret;

	/* Check ACT8865 I2C interface */
	if (act8865_check_i2c_disabled())
		return 0;

	/* Enable REG2 output 1.2V */
	reg = REG2_1;
	value = ACT8865_1V2;
	ret = act8865_set_reg_voltage(reg, value);
	if (ret) {
		dbg_loud("ACT8865: Failed to make REG2 output 1200mV\n");
		return -1;
	}

	/* Enable REG4 output 2.5V */
	reg = REG4_0;
	value = ACT8865_2V5;
	ret = act8865_set_reg_voltage(reg, value);
	if (ret) {
		dbg_loud("ACT8865: Failed to make REG4 output 2500mV\n");
		return -1;
	}

	/* Enable REG5 output 3.3V */
	reg = REG5_0;
	value = ACT8865_3V3;
	ret = act8865_set_reg_voltage(reg, value);
	if (ret) {
		dbg_loud("ACT8865: Failed to make REG5 output 3300mV\n");
		return -1;
	}

	/* Enable REG6 output 2.5V */
	reg = REG6_0;
	value = ACT8865_2V5;
	ret = act8865_set_reg_voltage(reg, value);
	if (ret) {
		dbg_loud("ACT8865: Failed to make REG6 output 2500mV\n");
		return -1;
	}

	/* Enable REG7 output 1.8V */
	reg = REG7_0;
	value = ACT8865_1V8;
	ret = act8865_set_reg_voltage(reg, value);
	if (ret) {
		dbg_loud("ACT8865: Failed to make REG7 output 1800mV\n");
		return -1;
	}

	return 0;
}
int act8865_set_power_saving_mode(void)
{
	unsigned char mode = ACT8865_MODE_POWER_SAVING;
	unsigned char reg_list[] = {REG1_2, REG2_2, REG3_2};
	unsigned char reg;
	unsigned i;
	int ret;

	if (act8865_check_i2c_disabled())
		return 0;

	for (i = 0; i < ARRAY_SIZE(reg_list); i++) {
		reg = reg_list[i];
		ret = act8865_set_reg_mode(reg, mode);
		if (ret)
			dbg_loud("ACT8865: Failed to set Power-saving mode\n");
	}

	dbg_info("ACT8865: Set REG1/REG2/REG3 Power-saving mode\n");

	return 0;
}