华南总代 深圳市恒泰瑞 热线:13902238970 QQ与微信:398776922
https://blog.csdn.net/mike8825/article/details/80196156
SGM3140
SGM3140B
SGM3141
SGM3141B
SGM3780
SGM3781
SGM3785
高通平台
gpio方式,涉及的文件
leds-msm-gpio-flash.c
msm_led_trigger.c
&soc {
flash_SGM3780:flashlight {
compatible = “qcom,leds-gpio-flash”;
status = “okay”;
pinctrl-names = “flash_default”;
pinctrl-0 = <&SGM3780_default>;
qcom,flash-en = <&msm_gpio 31 0>;
qcom,flash-now = <&msm_gpio 32 0>;
qcom,op-seq = “flash_en”, “flash_now”;
qcom,torch-seq-val = <1 0>;
qcom,flash-seq-val = <0 1>;
linux,name = “flashlight”;
linux,default-trigger = “flashlight-trigger”;
};
led_flash0: qcom,camera-led-flash {
cell-index = <0>;
compatible = "qcom,camera-led-flash";
qcom,flash-type = <3>;
qcom,flash-source = <&flash_SGM3780>;
qcom,torch-source = <&flash_SGM3780>;
};
};
qcom,op-seq = “A”, “B”;
qcom,torch-seq-val = ;
qcom,flash-seq-val = ;
对于不同芯片而言,在相应的模式下控制引脚的电平逻辑不同
A模式 ,两个引脚状态为CE
B模式 ,两个引脚状态为DF
参考电路图如下
i2c+gpio方式,如lm3642,涉及的文件
lm3642.c
msm_led_i2c_trigger.c
&tlmm_pinmux {
lm3642-en-pin {
qcom,pins = <&gp 31>, <&gp 86>;
qcom,num-grp-pins = <2>;
label = “lm3642_en_pins”;
qcom,pin-func = <0>;
lm3642_en_default: en-default {
driver-strength = <2>;
bias-disable;
};
lm3642_en_suspend: en-suspend {
driver-strength = <2>;
bias-pull-down;
};
};
};
&i2c_0 {
flash_lm3642:qcom,led-flash@0 {
cell-index = <0>;
reg = <0x63>;
qcom,slave-id = <0xC6 0x00 0x0011>;
compatible = “ti,lm3642”;
label = “lm3642”;
qcom,flash-type = <1>;
pinctrl-names = “cam_flash_default”,“cam_flash_suspend”;
pinctrl-0 = <&lm3642_en_default>;
pinctrl-1 = <&lm3642_en_suspend>;
gpios = <&msm_gpio 86 0>,
<&msm_gpio 31 0>;
qcom,gpio-flash-en = <0>;
qcom,gpio-flash-now = <1>;
qcom,gpio-req-tbl-num = <0 1>;
qcom,gpio-req-tbl-flags = <0 0>;
qcom,gpio-req-tbl-label = “FLASH_EN”,
“FLASH_NOW”;
};
};
参考电路图如下
1flash_led_init
2flash_led_low
3flash_led_release
1、2开手电筒 3关手电筒
1flash_led_init
2flash_led_low
3flash_led_off
4flash_led_high
5flash_led_off
6flash_led_release
1打开拍照软件 2、3、4、5一次闪光灯过程 6关闭拍照软件
mtk平台,涉及的文件
kd_flashlightlist.c
Leds_strobe.c
FL_Init
FL_Enable
FLASH_IOC_SET_DUTY(设置模式)
FL_Disable
FL_Uninit
————————————————
版权声明:本文为CSDN博主「那颗流星的秘密」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/mike8825/article/details/80196156