高通SPI指纹模块driver调试



对于指纹模块,刚接手的时候觉得不就是个SPI很简单。后来发现,供应商的deamon给我埋下了好多坑。因此做此记录。

1、dts配置解析,由模块和原理图上看,得知需要配置模块reset引脚,模块irq引脚,然后就是SPI接口线路,CS,MISO,MOSI,CLK,这些信息如下

复位引脚,复位引脚特别说明一下,模块供应商给的参考就是个大坑。根据datasheet说明来看,低电平后需要输出高电平激活工作。而供应商给的参考并非如此。因此这里是我在调试过程中修改过的配置。

        fp_shutdown_active {
qcom,pins = <&gp 23>;
qcom,pin-func = <0>;
qcom,num-grp-pins = <1>;
label = "shutdown_gpio_active";

fp_shutdown_active: fp_shutdown_active {
drive-strength = <6>;
<span style="color:#ff0000;">output-high;</span>
bias-disable= <0>;
};
};
fp_shutdown_suspend {
qcom,pins = <&gp 23>;
qcom,pin-func = <0>;
qcom,num-grp-pins = <1>;
label = "shutdown_gpio_suspend";

fp_shutdown_suspend: fp_shutdown_suspend {
drive-strength = <2>;
<span style="color:#ff0000;">output-low;</span>
bias-pull-down;
};
};

中断引脚,中断引脚也存在一些问题。但不是节点本身配置的问题。而是平台供应商实际上由应用层利用JNI操作了16号引脚,因此导致驱动中配置正常,开机后查看

sys/kernel/debug/gpio中发现状态被修改!!而且是在点开设置的时候状态被修改成了输出状态。因此查找package/app/settings找到了jni操作该16号引脚的问题。直接屏蔽了。坑爹的平台供应商,问了是不是代码某个地方操作了该引脚,矢口否认。这里也是造成该driver的调试时间花费的所在。

        spi0_silead_irq_active {
/* DRDY-N/IRQ */
qcom,pins = <&gp 16>;
qcom,num-grp-pins = <1>;
qcom,pin-func = <0>;
label = "silead_irq_active";
/* active state */
silead_irq_active: active {
drive-strength = <12>; /* 12 MA */
bias-didable = <0>; /* No PULL */
};

/* suspended state */
silead_irq_suspend: suspend {
drive-strength = <2>; /* 2 MA */
bias-disable = <0>; /* No PULL */
};
};
SPI配置引脚

 <span style="white-space:pre">	</span>spi0_active {
/* MOSI, MISO, CLK */
qcom,pins = <&gp 8>, <&gp 9>, <&gp 11>;
qcom,num-grp-pins = <3>;
qcom,pin-func = <1>;
label = "spi0-active";
/* active state */
spi0_default: spi0_default {
drive-strength = <12>; /* 12 MA */
bias-disable = <0>; /* No PULL */
};
};

spi0_suspend {
/* MOSI, MISO, CLK */
qcom,pins = <&gp 8>, <&gp 9>, <&gp 11>;
qcom,num-grp-pins = <3>;
qcom,pin-func = <0>;
label = "spi0-suspend";
/* suspended state */
spi0_sleep: spi0_sleep {
drive-strength = <2>; /* 2 MA */
bias-pull-down; /* pull down */
};
};
片选引脚

                spi0_cs0_active {
/* CS */
qcom,pins = <&gp 10>;
qcom,num-grp-pins = <1>;
qcom,pin-func = <1>;
label = "spi0-cs0-active";
spi0_cs0_active: cs0_active {
drive-strength = <2>;
bias-disable = <0>;
};
};


spi0_cs0_suspend {
/* CS */
qcom,pins = <&gp 10>;
qcom,num-grp-pins = <1>;
qcom,pin-func = <0>;
label = "spi0-cs0-suspend";
spi0_cs0_sleep: cs0_sleep {
drive-strength = <2>;
bias-disable = <0>;
};
};
以上内容在xxx-pinctl.dtsi中配置

接下去是SPI功能配置

spi_0: spi@78ba000 { /* BLSP1 QUP6 */
compatible = "qcom,spi-qup-v2";
#address-cells = <1>;
#size-cells = <0>;
reg-names = "spi_physical", "spi_bam_physical";
reg = <0x78ba000 0x600>,
<0x7884000 0x23000>;
interrupt-names = "spi_irq", "spi_bam_irq";
interrupts = <0 100 0>, <0 238 0>;
spi-max-frequency = <19200000>;
pinctrl-names = "spi_default", "spi_sleep";
pinctrl-0 = <&spi0_default &spi0_cs0_active>;
pinctrl-1 = <&spi0_sleep &spi0_cs0_sleep>;
clocks = <&clock_gcc clk_gcc_blsp1_ahb_clk>,
<&clock_gcc clk_gcc_blsp1_qup6_spi_apps_clk>;
clock-names = "iface_clk", "core_clk";
qcom,infinite-mode = <0>;
qcom,use-bam;
qcom,use-pinctrl;
qcom,ver-reg-exists;
qcom,bam-consumer-pipe-index = <14>;
qcom,bam-producer-pipe-index = <15>;
qcom,master-id = <86>;
最后呢就是对应的SPI挂接设备的设置了,这里供应商也给我挖了个大坑。就是SPI-MAX-FREQUENCY的配置项,实际上drver里面并没有使用该值,而是从IOCTL的接口由应用传入设置。这点实在是不符合Linux驱动的设计标准,因此查找该BUG花费了好多时间。

                silead,spi@0 {
compatible = "silead,silead_fp";
reg = <0>;
spi-max-frequency = <4800000>;
pinctrl-names = "active","suspend";
pinctrl-0 = <&fp_shutdown_active &silead_irq_active>;
pinctrl-1 = <&fp_shutdown_suspend &silead_irq_suspend>;
shutdown_gpio = <&msm_gpio 23 0>;
silead,irq-gpio = <&msm_gpio 16 0>;
interrupt-parent = <&msm_gpio>;
interrupts = <16 0>;
interrupt-names = "sl_wake_up";
linux,wakeup;
};
最后就是framework的修改了,由于是5.1.1的Android系统。并没有支持指纹的标准架构,因此修改幅度较大。好在模块供应商有支持。这里就不在敖述了。





智能推荐

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告