2017年06月28日 15:50:41
阅读数:212
-
参考 chipsailing_MTK_6.0_2.0_移植包 里面的文档
-
一、将MTK_6.0_2.0_移植包\kernel-3.18\drivers\input\chipsailing的驱动文件
-
拷贝到kernel-3.18\drivers\input \目录下(具体的存放路径可以自定义);
-
并修改驱动的文件夹所在的Makefile文件,
-
在其中加入:obj-y += chipsailing/ ;
-
使得编译能编译到驱动代码;
-
二、参考MTK_6.0_2.0_移植包\kernel-3.18\arch\arm\boot\dt\len6735_66_m0.dts文件,
-
在调试实际的项目.dts文件中添加如下的内容:请注意加入内容的位置,不然会编译错误。
-
以下的步骤都可以通过搜索“chipsailing”关键字搜索到所需要添加的内容。
-
每一段内容都是以“add by chipsailing start”开头,以” add by chipsailing end”为结束,
-
即所需加入的代码。
-
1.将MTK_6.0_2.0_移植包\kernel-3.18\arch\arm\boot\dt\len6735_66_m0.dts文件的第8行到第18行的如下代码加到 具体实际项目的.dts文件中根节点 ”/{ “ 前添加:
-
/*add by chipsailing start FINGERPRINT GPIO standardization*/
-
#define __CS_FINGERPRINT_EINT_EN_PIN_NUM__ 61 // 这些引脚需要查看硬件原理图
-
#define __CS_FINGERPRINT_EINT_PIN__ PINMUX_GPIO61__FUNC_GPIO61
-
#define __CS_FINGERPRINT_RESET_PIN__ PINMUX_GPIO64__FUNC_GPIO64
-
#define __CS_FINGERPRINT_MO_PIN__ PINMUX_GPIO68__FUNC_SPI_MOA
-
#define __CS_FINGERPRINT_MI_PIN__ PINMUX_GPIO67__FUNC_SPI_MIA
-
#define __CS_FINGERPRINT_CLK_PIN__ PINMUX_GPIO66__FUNC_SPI_CKA
-
#define __CS_FINGERPRINT_CS_PIN__ PINMUX_GPIO65__FUNC_SPI_CSA
-
/*add by chipsailing end */
-
这些内容是添加实际的GIPO配置管脚信息。
-
2. 将MTK_6.0_2.0_移植包\kernel-3.18\arch\arm\boot\dt\len6735_66_m0.dts文件的第40行到第68行的如下代码加到 具体实际项目的.dts文件中,注意它的位置是在跟目录里面。
-
/*add by chipsailing start sunwei for v7 prj*/
-
cs_finger:cs_finger {
-
compatible = "mediatek,cs_finger";
-
pinctrl-names="cs_finger_pins_default", "cs_finger_reset_en0","cs_finger_reset_en1","cs_finger_spi0_mi_as_spi0_mi","cs_finger_spi0_mi_as_gpio", "cs_finger_spi0_mo_as_spi0_mo","cs_finger_spi0_mo_as_gpio","cs_finger_spi0_clk_as_spi0_clk","cs_finger_spi0_clk_as_gpio","cs_finger_spi0_cs_as_spi0_cs",
-
"cs_finger_spi0_cs_as_gpio","cs_finger_int_as_int","cs_finger_eint_pull_down","cs_finger_eint_pull_disable","cs_finger_pwr_off", "cs_finger_pwr_on";
-
pinctrl-0 = <&cs_finger_pins_default>;
-
pinctrl-1 = <&cs_finger_reset_en0>;
-
pinctrl-2 = <&cs_finger_reset_en1>;
-
pinctrl-3 = <&cs_finger_spi0_mi_as_spi0_mi>;
-
pinctrl-4 = <&cs_finger_spi0_mi_as_gpio>;
-
pinctrl-5 = <&cs_finger_spi0_mo_as_spi0_mo>;
-
pinctrl-6 = <&cs_finger_spi0_mo_as_gpio>;
-
pinctrl-7 = <&cs_finger_spi0_clk_as_spi0_clk>;
-
pinctrl-8= <&cs_finger_spi0_clk_as_gpio>;
-
pinctrl-9= <&cs_finger_spi0_cs_as_spi0_cs>;
-
pinctrl-10= <&cs_finger_spi0_cs_as_gpio>;
-
pinctrl-11= <&cs_finger_int_as_int>;
-
pinctrl-12= <&cs_finger_eint_pull_down>;
-
pinctrl-13= <&cs_finger_eint_pull_disable>;
-
pinctrl-14= <&cs_finger_pwr_off>;
-
pinctrl-15= <&cs_finger_pwr_on>;
-
//gpios = <&pio 125 0>;
-
interrupt-parent = <&eintc>;
-
interrupts = <__CS_FINGERPRINT_EINT_EN_PIN_NUM__ IRQ_TYPE_EDGE_RISING>;
-
debounce = <__CS_FINGERPRINT_EINT_EN_PIN_NUM__ 0>;
-
};
-
// add by chipsailing end
-
这些内容是GPIO的一些初始化配置。
-
3. 将MTK_6.0_2.0_移植包kernel-3.18\arch\arm\boot\dt\len6735_66_m0.dts文件的第173行到第318行的如下代码加到 具体实际项目的.dts文件中,注意它的位置跟其他的&pio是并行的。
-
/* add by chipsailing start GPIO standardization */
-
&pio {
-
cs_finger_pwr_off: cs_finger_pwr_off {
-
pins_cmd_dat {
-
pins = <PINMUX_GPIO78__FUNC_GPIO78>;
-
slew-rate = <1>;
-
output-low;
-
};
-
};
-
cs_finger_pwr_on: cs_finger_pwr_on {
-
pins_cmd_dat {
-
pins = <PINMUX_GPIO78__FUNC_GPIO78>;
-
slew-rate = <1>;
-
output-high;
-
};
-
};
-
cs_finger_pins_default:cs_finger_pins_default{
-
pins_cmd_dat {
-
pins = <PINMUX_GPIO65__FUNC_SPI_CSA>;
-
};
-
pins_cmd2_dat {
-
pins = <PINMUX_GPIO66__FUNC_SPI_CKA>;
-
};
-
pins_cmd3_dat {
-
pins = <PINMUX_GPIO67__FUNC_SPI_MIA>;
-
};
-
pins_cmd4_dat {
-
pins = <PINMUX_GPIO68__FUNC_SPI_MOA>;
-
};
-
};
-
cs_finger_reset_en0:cs_finger_reset_en@0{
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_RESET_PIN__>;
-
slew-rate = <1>;
-
output-low;
-
};
-
};
-
cs_finger_reset_en1:cs_finger_reset_en@1{
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_RESET_PIN__>;
-
slew-rate = <1>;
-
output-high;
-
};
-
};
-
cs_finger_spi0_mi_as_spi0_mi:cs_finger_spi0_mi_as_spi0_mi@0{
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_MI_PIN__>;
-
slew-rate = <0>;
-
bias-disable;
-
output-low;
-
input-schmitt-enable = <0>;
-
};
-
};
-
cs_finger_spi0_mi_as_gpio:cs_finger_spi0_mi_as_gpio@0{
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_MI_PIN__>;
-
slew-rate = <0>;
-
output-low;
-
input-schmitt-enable = <0>;
-
};
-
};
-
cs_finger_spi0_mo_as_spi0_mo:cs_finger_spi0_mo_as_spi0_mo@0{
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_MO_PIN__>;
-
slew-rate = <1>;
-
bias-disable;
-
output-low;
-
input-schmitt-enable = <0>;
-
};
-
};
-
cs_finger_spi0_mo_as_gpio:cs_finger_spi0_mo_as_gpio@0{
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_MO_PIN__>;
-
slew-rate = <1>;
-
output-low;
-
input-schmitt-enable = <0>;
-
};
-
};
-
cs_finger_spi0_clk_as_spi0_clk:cs_finger_spi0_clk_as_spi0_clk@0{
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_CLK_PIN__>;
-
slew-rate = <1>;
-
bias-disable;
-
output-low;
-
input-schmitt-enable = <0>;
-
};
-
};
-
cs_finger_spi0_clk_as_gpio:cs_finger_spi0_clk_as_gpio@0{
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_CLK_PIN__>;
-
slew-rate = <1>;
-
output-low;
-
input-schmitt-enable = <0>;
-
};
-
};
-
cs_finger_spi0_cs_as_spi0_cs:cs_finger_spi0_cs_as_spi0_cs@0{
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_CS_PIN__>;
-
slew-rate = <1>;
-
bias-disable;
-
output-low;
-
input-schmitt-enable = <0>;
-
};
-
};
-
cs_finger_spi0_cs_as_gpio:cs_finger_spi0_cs_as_gpio@0{
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_CS_PIN__>;
-
slew-rate = <1>;
-
output-low;
-
input-schmitt-enable = <0>;
-
};
-
};
-
cs_finger_int_as_int: cs_finger_int_as_int@0{
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_EINT_PIN__>;
-
slew-rate = <0>;
-
bias-pull-up = <00>;
-
};
-
};
-
cs_finger_eint_pull_down: cs_finger_eint_pull_down {
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_EINT_PIN__>;
-
slew-rate = <0>;
-
bias-pull-down = <00>;
-
};
-
};
-
cs_finger_eint_pull_disable: cs_finger_eint_pull_disable {
-
pins_cmd_dat {
-
pins = <__CS_FINGERPRINT_EINT_PIN__>;
-
slew-rate = <0>;
-
bias-disable;
-
};
-
};
-
};
-
/*******************add by chipsailing end****************/
-
三、添加权限
-
1.添加字符节点权限:
-
参考MTK_6.0_2.0_移植包\device\lentek\len6735_66_m0\init.project.rc文件,在实际调试的项目文件
-
device\lentek\len6737m_35_m0\init.project.rc中添加节点权限:
-
注意: 加在on init 之前
-
#[chipsailing fingerprint begin]
-
# fingerprint
-
chown system system /dev/cs_spi
-
chmod 0777 /dev/cs_spi
-
#[chipsailing fingerprint end]
-
2.参考MTK_6.0_2.0_移植包\device\mediatek\common\sepolicy\目录下面的文件,对应在实际调试的项目对应的文件
-
device\mediatek\common\sepolicy中添加内容,添加的内容一一如下:
-
注意: 加在末尾
-
1.device.te文件添加:
-
# For CHIPSAILING fingerprint
-
type csfinger_device, dev_type;
-
2. file_contexts文件添加:
-
#For CHIPSAILING FP
-
/dev/cs_spi u:object_r:csfinger_device:s0
-
3. fingerprintd.te文件:
-
直接把此文件复制到\device\mediatek\common\sepolicy\目录下面(路径以实际为准)。
-
4. system_app.te文件添加:
-
#For CHIPSAILING FP
-
allow system_app csfinger_device:file rw_file_perms;
-
5. system_server.te文件添加:
-
#For CHIPSAILING FP
-
allow system_server csfinger_device:file rw_file_perms;
-
allow system_server csfinger_device:chr_file{read write open};
-
6. untrusted_app.te文件添加:
-
# For CHIPSAILING FP
-
allow untrusted_app csfinger_device:chr_file{read write ioctl open};
-
3.参考MTK_6.0_2.0_移植包\system\core\rootdir\init.rc, 对应在实际调试的项目对应的文件
-
system\core\rootdir\init.rc中添加内容,添加的内容一一如下:
-
注意: 加在末尾
-
# add by chipsailing start
-
service fingerprintd /system/bin/fingerprintd
-
class late_start
-
user system
-
# add by chipsailing end
-
这是添加指纹服务启动的代码
-
四、系统适配部分:
-
1.添加so库
-
参考MTK_6.0_2.0_移植包\vendor\cs_fp_so\,把cs_finger_so文件夹复制到客户vendor目录下,
-
cs_fp_so文件夹下面有32位和64位的库,根据系统的实际位数选择库,复制之后,
-
参考MTK_6.0_2.0_移植包\device\mediatek\mt6735\device.mk文件,在实际调试的项目的device.mk文件
-
device\mediatek\mt6735\device.mk中添加:
-
注意: 加在末尾
-
# add by cipsailing start
-
PRODUCT_PACKAGES += fingerprintd
-
PRODUCT_COPY_FILES+= vendor/cs_fp_so/32bit/fingerprint.default.so:system/lib/hw/fingerprint.default.so
-
PRODUCT_COPY_FILES += vendor/cs_fp_so/32bit/libCSAlgDll.so:system/lib/libCSAlgDll.so
-
# add by cipsailing end
-
注意:上面的标有红色的部分是实际的so所存放的实际路径(只做一个参考);
-
说明:
-
1.libCSAlgDll.so是算法库;