Beispiel #1
0
int
cros_ec_send_command(struct cros_ec_softc *sc, uint8_t cmd, int cmd_version,
		const void *out, int out_len, uint8_t **in, int in_len)
{
	return cros_ec_i2c_command(sc, cmd, cmd_version,
				(const uint8_t *)out, out_len, in, in_len);
}
Beispiel #2
0
static int send_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
			const void *dout, int dout_len,
			uint8_t **dinp, int din_len)
{
	int ret = -1;

	/* Handle protocol version 3 support */
	if (dev->protocol_version == 3) {
		return send_command_proto3(dev, cmd, cmd_version,
					   dout, dout_len, dinp, din_len);
	}

	switch (dev->interface) {
#ifdef CONFIG_CROS_EC_SPI
	case CROS_EC_IF_SPI:
		ret = cros_ec_spi_command(dev, cmd, cmd_version,
					(const uint8_t *)dout, dout_len,
					dinp, din_len);
		break;
#endif
#ifdef CONFIG_CROS_EC_I2C
	case CROS_EC_IF_I2C:
		ret = cros_ec_i2c_command(dev, cmd, cmd_version,
					(const uint8_t *)dout, dout_len,
					dinp, din_len);
		break;
#endif
#ifdef CONFIG_CROS_EC_LPC
	case CROS_EC_IF_LPC:
		ret = cros_ec_lpc_command(dev, cmd, cmd_version,
					(const uint8_t *)dout, dout_len,
					dinp, din_len);
		break;
#endif
	case CROS_EC_IF_NONE:
	default:
		ret = -1;
	}

	return ret;
}