MSM8998(高通835处理器)外接指纹识别传感器linux驱动如何与设备树进行匹配

驱动名称:fpc1020.c

平台:msm8998

描述指纹传感器设备的结构:

 
  1. struct fpc1020_data {

  2. struct device *dev;

  3. struct wake_lock ttw_wl;

  4. int irq_gpio;

  5. int rst_gpio; //复位gpio号

  6. int irq_num; //中断号

  7. struct mutex lock;

  8. bool prepared;

  9.  
  10. struct pinctrl *ts_pinctrl;

  11. struct pinctrl_state *gpio_state_active;

  12. struct pinctrl_state *gpio_state_suspend;

  13.  
  14. #ifdef ONEPLUS_EDIT

  15. int EN_VDD_gpio;

  16. int id0_gpio;

  17. int id1_gpio;

  18. int id2_gpio;

  19. struct input_dev *input_dev;

  20. int screen_state; //状态 : 1: on 0:off

  21. int sensor_version; //传感器的版本号:0x01:fpc1245 0x02:fpc1263

  22. #endif

  23. #if defined(CONFIG_FB)

  24. struct notifier_block fb_notif;

  25. #endif

  26. struct work_struct pm_work;

  27. int proximity_state; /* 0:far 1:near */

  28. bool irq_enabled;

  29. spinlock_t irq_lock;

  30. struct completion irq_sent;

  31. };

fpc1020驱动使用platform总线匹配硬件设备,驱动如下:

 
  1. static struct of_device_id fpc1020_of_match[] = {

  2. { .compatible = "fpc,fpc1020", }, //设备树匹配的属性

  3. {}

  4. };

  5. MODULE_DEVICE_TABLE(of, fpc1020_of_match);

  6.  
  7. static struct platform_driver fpc1020_driver = {

  8. .driver = {

  9. .name = "fpc1020",

  10. .owner = THIS_MODULE,

  11. .of_match_table = fpc1020_of_match, //设备树match函数

  12. },

  13. .probe = fpc1020_probe, //匹配函数

  14. };

  15. module_platform_driver(fpc1020_driver);

匹配的设备树信息如下:


 

猜你喜欢

转载自blog.csdn.net/lilifang_2011/article/details/112845579