12 #include <linux/kernel.h>
13 #include <linux/module.h>
14 #include <linux/types.h>
17 #define READ_CMD (1 << 7)
24 return (status < 0) ? status : status >> 8;
30 u16 cmd = (val << 8) | reg;
32 return spi_write(spi, (
const u8 *)&cmd, 2);
39 for (i = 0; i <
length; i++) {
40 ret = spi_reg_read(stmpe, reg + i);
49 static int spi_block_write(
struct stmpe *stmpe,
u8 reg,
u8 length,
54 for (i = length; i > 0; i--, reg++) {
55 ret = spi_reg_write(stmpe, reg, *(values + i - 1));
63 static void spi_init(
struct stmpe *stmpe)
70 if (stmpe->
variant->id_val == 0x0811)
78 .read_byte = spi_reg_read,
79 .write_byte = spi_reg_write,
80 .read_block = spi_block_read,
81 .write_block = spi_block_write,
130 .probe = stmpe_spi_probe,
132 .id_table = stmpe_spi_id,
135 static int __init stmpe_init(
void)
141 static void __exit stmpe_exit(
void)
143 spi_unregister_driver(&stmpe_spi_driver);