16 #include <linux/module.h>
19 #include <linux/slab.h>
32 unsigned long spi_data = 1 << 23 | addr << 15 | *
data;
40 xfer.tx_buf = &tx_buf;
42 xfer.len =
sizeof(
unsigned long);
43 xfer.bits_per_word = 24;
45 spi_message_init(&
msg);
46 spi_message_add_tail(&xfer, &
msg);
57 unsigned long spi_data = 0 << 23 | addr << 15;
67 xfer.tx_buf = &tx_buf;
68 xfer.rx_buf = &rx_buf;
69 xfer.
len =
sizeof(
unsigned long);
70 xfer.bits_per_word = 24;
72 spi_message_init(&
msg);
73 spi_message_add_tail(&xfer, &
msg);
80 *data = (
u8) (rx_buf & 0xFF);
86 struct tps65912 *tps65912;
88 tps65912 = kzalloc(
sizeof(
struct tps65912),
GFP_KERNEL);
94 tps65912->
read = tps65912_spi_read;
95 tps65912->
write = tps65912_spi_write;
97 spi_set_drvdata(spi, tps65912);
104 struct tps65912 *tps65912 = spi_get_drvdata(spi);
111 static struct spi_driver tps65912_spi_driver = {
116 .probe = tps65912_spi_probe,
120 static int __init tps65912_spi_init(
void)
126 pr_err(
"Failed to register TPS65912 SPI driver: %d\n", ret);
133 static void __exit tps65912_spi_exit(
void)
135 spi_unregister_driver(&tps65912_spi_driver);