/* There's still some voodoo going on here, but it's a lot better than in the first incarnation of the driver where all we had was the raw numbers from the initialization sequence.  */
static int ltv350qv_write_reg(struct ltv350qv *lcd, u8 reg, u16 val)
/* There's still some voodoo going on here, but it's a lot better than in the first incarnation of the driver where all we had was the raw numbers from the initialization sequence.  */
static int ltv350qv_write_reg(struct ltv350qv *lcd, u8 reg, u16 val)
{
	struct spi_message msg;
	struct spi_transfer index_xfer = {
		.len		= 3,
		.cs_change	= 1,
	};
	struct spi_transfer value_xfer = {
		.len		= 3,
	};
	spi_message_init(&msg);
	lcd->buffer[0] = LTV_OPC_INDEX;
	lcd->buffer[1] = 0x00;
	lcd->buffer[2] = reg & 0x7f;
	index_xfer.tx_buf = lcd->buffer;
	spi_message_add_tail(&index_xfer, &msg);
	lcd->buffer[4] = LTV_OPC_DATA;
	lcd->buffer[5] = val >> 8;
	lcd->buffer[6] = val;
	value_xfer.tx_buf = lcd->buffer + 4;
	spi_message_add_tail(&value_xfer, &msg);
	return spi_sync(lcd->spi, &msg);
}