static ssize_t smb347_register_store(struct sys_device *dev, struct sysdev_attribute *attr, const char *buf, size_t size)
{
	int value = 0;

	if (sscanf(buf, "%x", &value) <= 0) {
		printk(KERN_ERR "Error setting the value in the register\n");
		return -EINVAL;
	}

	summit_smb347_i2c_write(smb347_reg_number, value);
	return size;
}
/* Enable/disable charging */
static void summit_smb347_enable_charging(int enable)
{
	unsigned char value = 0xff;

	summit_smb347_i2c_read(SUMMIT_SMB347_COMMAND_REG_A, &value);

	if (!enable) {
		value &= ~(0x2);
	}
	else {
		value |= 0x2;
	}

	summit_smb347_i2c_write(SUMMIT_SMB347_COMMAND_REG_A, value);
	atomic_set(&summit_smb347_charger_state, enable);
}
static void summit_smb347_init_registers(void)
{
	/* Fast charge, pre charge and charge termination */
	summit_smb347_i2c_write(SUMMIT_SMB347_CHARGE_CURRENT, 0x3B);

	/* Input current */
	summit_smb347_i2c_write(SUMMIT_SMB347_INPUT_CURR_LIMIT, 0x66);

	/* Control settings */
	summit_smb347_i2c_write(SUMMIT_SMB347_FUNCTIONS, 0xB6);

	/* Pre charge and fast charge voltage */
	summit_smb347_i2c_write(SUMMIT_SMB347_FLOAT_VOLTAGE, 0xE3);

	/* Current termination and auto recharge */
	summit_smb347_i2c_write(SUMMIT_SMB347_CHARGE_CONTROL, 0x41);

	/* Timers and status */
	summit_smb347_i2c_write(SUMMIT_SMB347_STAT_TIMERS, 0x1F);

	/* PIN and enable control */
	summit_smb347_i2c_write(SUMMIT_SMB347_ENABLE_CONTROL, 0x7B);

	/* Thermal monitor and temp thresholds */
	summit_smb347_i2c_write(SUMMIT_SMB347_THERMAL_CONTROL, 0xAF);

	/* USB 3.0 and SYSOK */
	summit_smb347_i2c_write(SUMMIT_SMB347_SYSOK_USB30, 0x8);

	/* OTG PIN polarity and low battery */
	summit_smb347_i2c_write(SUMMIT_SMB347_OTHER_CONTROL_A, 0x07);

	/* Thermal control */
	summit_smb347_i2c_write(SUMMIT_SMB347_OTG_THERM_CONTROL, 0x10);

	/* Temperature hard/soft limits */
	summit_smb347_i2c_write(SUMMIT_SMB347_CELL_TEMP, 0x18);

	/* Interrupt Control */
	summit_smb347_i2c_write(SUMMIT_SMB347_FAULT_INTERRUPT, 0xCF);
	summit_smb347_i2c_write(SUMMIT_SMB347_INTERRUPT_STAT, 0x4);

	/* Command register A */
	summit_smb347_i2c_write(SUMMIT_SMB347_COMMAND_REG_A, 0xc2);

	/* Command register B for USB */
	summit_smb347_i2c_write(SUMMIT_SMB347_COMMAND_REG_B, 0x03);
}