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

驱动名称:fpc1020.c

平台:msm8998

 

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

 

struct fpc1020_data {
	struct device *dev;
        struct wake_lock ttw_wl;
	int irq_gpio;
	int rst_gpio;               //复位gpio号
	int irq_num;                 //中断号
	struct mutex lock;
	bool prepared;

	struct pinctrl         *ts_pinctrl;
	struct pinctrl_state   *gpio_state_active;
	struct pinctrl_state   *gpio_state_suspend;

#ifdef ONEPLUS_EDIT
        int EN_VDD_gpio;
        int id0_gpio;
        int id1_gpio;
        int id2_gpio;
        struct input_dev	*input_dev;
        int screen_state;                  //状态 : 1: on 0:off
        int sensor_version;               //传感器的版本号:0x01:fpc1245 0x02:fpc1263
#endif
#if defined(CONFIG_FB)
	struct notifier_block fb_notif;
#endif
	struct work_struct pm_work;
	int proximity_state;              /* 0:far 1:near */
	bool irq_enabled;
	spinlock_t irq_lock;
	struct completion irq_sent;
};

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

 

static struct of_device_id fpc1020_of_match[] = {
	{ .compatible = "fpc,fpc1020", },    //设备树匹配的属性
	{}
};
MODULE_DEVICE_TABLE(of, fpc1020_of_match);

static struct platform_driver fpc1020_driver = {
	.driver = {
		.name		= "fpc1020",
		.owner		= THIS_MODULE,
		.of_match_table = fpc1020_of_match,  //设备树match函数
	},
	.probe = fpc1020_probe,    //匹配函数
}; 
module_platform_driver(fpc1020_driver);

匹配的设备树信息如下:

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


 

 

 

 

 

你可能感兴趣的:(linux-底层驱动)