/* writes to a specified block of 3 registers from the TCA6424A and stores it in a specified cache variable.  */
static int write_port_regs(const struct device *dev, uint8_t reg, uint32_t value)
/* writes to a specified block of 3 registers from the TCA6424A and stores it in a specified cache variable.  */
static int write_port_regs(const struct device *dev, uint8_t reg, uint32_t value)
{
	const struct tca6424a_drv_cfg *const config = dev->config;
	uint8_t buf[4];
	int ret;
	LOG_DBG("%s: Write: REG[0x%X] = 0x%X, REG[0x%X] = 0x%X, "
		"REG[0x%X] = 0x%X",
		dev->name, reg, (value & 0xFF), (reg + 1), ((value >> 8) & 0xFF),
		(reg + 2), ((value >> 16) & 0xFF));
	buf[0] = reg;
	sys_put_le24(value, &buf[1]);
	ret = i2c_write_dt(&config->i2c_spec, buf, sizeof(buf));
	if (ret != 0) {
		LOG_ERR("%s: error writing to register 0x%X "
			"(%d)",
			dev->name, reg, ret);
	}
	return ret;
}