Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/input.h>
- #include <linux/interrupt.h>
- #include <linux/delay.h>
- #include <linux/spi/spi.h>
- #include <linux/delay.h>
- static inline int check_post(struct spi_device *spi)
- {
- u8 v;
- v = spi_w8r8(spi, 0xA0 | 0x02);
- printk(KERN_ERR "got: 0x%x\n", v);
- v = spi_w8r8(spi, 0xFB);
- printk(KERN_ERR "got: 0x%x\n", v);
- v = spi_w8r8(spi, 0xFB);
- printk(KERN_ERR "got: 0x%x\n", v);
- v = spi_w8r8(spi, 0xFB);
- printk(KERN_ERR "got: 0x%x\n", v);
- printk(KERN_ERR "status register: 0x%x\n", v);
- return 0;
- }
- static int __devinit ftc10k6_probe(struct spi_device *spi)
- {
- u8 v;
- printk(KERN_ERR "ftc10k6_probe\n");
- //spi->bits_per_word = 32;
- //spi->mode = SPI_MODE_2;
- spi_setup(spi);
- check_post(spi);
- v = spi_w8r8(spi, 0x80 | 0x4);
- printk(KERN_ERR "got: 0x%x\n", v);
- v = spi_w8r8(spi, 0x03);
- printk(KERN_ERR "got: 0x%x\n", v);
- v = spi_w8r8(spi, 0x80 | 0x2);
- printk(KERN_ERR "got: 0x%x\n", v);
- v = spi_w8r8(spi, 0x00);
- printk(KERN_ERR "got: 0x%x\n", v);
- return 0;
- }
- static int __devexit ftc10k6_remove(struct spi_device *spi)
- {
- return 0;
- }
- static struct spi_driver ftc10k6_driver = {
- .driver = {
- .name = "ftc10006-58",
- .owner = THIS_MODULE,
- },
- .probe = ftc10k6_probe,
- .remove = __devexit_p(ftc10k6_remove),
- };
- static int __init ftc10k6_init(void)
- {
- return spi_register_driver(&ftc10k6_driver);
- }
- module_init(ftc10k6_init);
- static void __exit ftc10k6_exit(void)
- {
- spi_unregister_driver(&ftc10k6_driver);
- }
- module_exit(ftc10k6_exit);
- MODULE_AUTHOR("Richard Weinberger <rw@linutronix.de>");
- MODULE_DESCRIPTION("FTC10006-58 Touchscreen Driver");
- MODULE_LICENSE("GPL");
- MODULE_ALIAS("spi:ftc10006-58");
Add Comment
Please, Sign In to add comment