static void lcdPrepareRead(void) { PIN_IN(LCD_D0); PIN_IN(LCD_D1); PIN_IN(LCD_D2); PIN_IN(LCD_D3); PIN_IN(LCD_D4); PIN_IN(LCD_D5); PIN_IN(LCD_D6); PIN_IN(LCD_D7); CMD_READ(); }
static int __read_reg(struct tps6524x *hw, int reg) { int error = 0; u16 cmd = CMD_READ(reg), in; u8 status; struct spi_message m; struct spi_transfer t[3]; spi_message_init(&m); memset(t, 0, sizeof(t)); t[0].tx_buf = &cmd; t[0].len = 2; t[0].bits_per_word = 12; spi_message_add_tail(&t[0], &m); t[1].rx_buf = ∈ t[1].len = 2; t[1].bits_per_word = 16; spi_message_add_tail(&t[1], &m); t[2].rx_buf = &status; t[2].len = 1; t[2].bits_per_word = 4; spi_message_add_tail(&t[2], &m); error = spi_sync(hw->spi, &m); if (error < 0) return error; dev_dbg(hw->dev, "read reg %d, data %x, status %x\n", reg, in, status); if (!(status & STAT_CLK) || (status & STAT_WRITE)) return -EIO; if (status & STAT_INVALID) return -EINVAL; return in; }