Guest User

Untitled

a guest
May 27th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. #include <linux/kernel.h>
  2. #include <linux/module.h>
  3. #include <linux/input.h>
  4. #include <linux/interrupt.h>
  5. #include <linux/delay.h>
  6. #include <linux/spi/spi.h>
  7. #include <linux/delay.h>
  8.  
  9. static inline int check_post(struct spi_device *spi)
  10. {
  11. u8 v;
  12.  
  13. v = spi_w8r8(spi, 0xA0 | 0x02);
  14. printk(KERN_ERR "got: 0x%x\n", v);
  15. v = spi_w8r8(spi, 0xFB);
  16. printk(KERN_ERR "got: 0x%x\n", v);
  17. v = spi_w8r8(spi, 0xFB);
  18. printk(KERN_ERR "got: 0x%x\n", v);
  19. v = spi_w8r8(spi, 0xFB);
  20. printk(KERN_ERR "got: 0x%x\n", v);
  21.  
  22. printk(KERN_ERR "status register: 0x%x\n", v);
  23.  
  24. return 0;
  25. }
  26.  
  27. static int __devinit ftc10k6_probe(struct spi_device *spi)
  28. {
  29. u8 v;
  30.  
  31. printk(KERN_ERR "ftc10k6_probe\n");
  32.  
  33. //spi->bits_per_word = 32;
  34. //spi->mode = SPI_MODE_2;
  35. spi_setup(spi);
  36.  
  37. check_post(spi);
  38.  
  39. v = spi_w8r8(spi, 0x80 | 0x4);
  40. printk(KERN_ERR "got: 0x%x\n", v);
  41.  
  42. v = spi_w8r8(spi, 0x03);
  43. printk(KERN_ERR "got: 0x%x\n", v);
  44.  
  45. v = spi_w8r8(spi, 0x80 | 0x2);
  46. printk(KERN_ERR "got: 0x%x\n", v);
  47.  
  48. v = spi_w8r8(spi, 0x00);
  49. printk(KERN_ERR "got: 0x%x\n", v);
  50.  
  51. return 0;
  52. }
  53.  
  54. static int __devexit ftc10k6_remove(struct spi_device *spi)
  55. {
  56. return 0;
  57. }
  58.  
  59. static struct spi_driver ftc10k6_driver = {
  60. .driver = {
  61. .name = "ftc10006-58",
  62. .owner = THIS_MODULE,
  63. },
  64. .probe = ftc10k6_probe,
  65. .remove = __devexit_p(ftc10k6_remove),
  66. };
  67.  
  68. static int __init ftc10k6_init(void)
  69. {
  70. return spi_register_driver(&ftc10k6_driver);
  71. }
  72. module_init(ftc10k6_init);
  73.  
  74. static void __exit ftc10k6_exit(void)
  75. {
  76. spi_unregister_driver(&ftc10k6_driver);
  77. }
  78. module_exit(ftc10k6_exit);
  79.  
  80. MODULE_AUTHOR("Richard Weinberger <rw@linutronix.de>");
  81. MODULE_DESCRIPTION("FTC10006-58 Touchscreen Driver");
  82. MODULE_LICENSE("GPL");
  83. MODULE_ALIAS("spi:ftc10006-58");
Add Comment
Please, Sign In to add comment