dts:
lt8912@48 {
compatible = "qcom,lt8912";
reg = <0x48>;
power-gpios = <&tlmm 2 0x0>;
instance_id = <0>;
//lt,enable-audio;
pinctrl-names = "pmx_lt8912_active","pmx_lt8912_suspend";
pinctrl-0 = <<8912_int_active <8912_rst_active>;
pinctrl-1 = <<8912_int_suspend <8912_rst_suspend>;
lt,irq-gpio = <&tlmm 65 0x2002>;
lt,rst-gpio = <&tlmm 87 0x2002>;
}
driver:
ret = of_get_named_gpio_flags(np, "power-gpios", 0, &pdata->power_gpio);
if (ret) {
printk(KERN_ALERT "qyc , power-gpios parsed failed\n");
goto: end;
}
--------------
问题1:
驱动里的名字要与dsti里面一致,不然驱动出现解析不了,在tp驱动里也出现过,驱动里名字未对应dtsi就解析不了。感觉是dtsi节点名字固定了一样,比如vdd改为vcc,即使驱动和dtsi对应上了,kernel里也报错..
问题2:
既然有reset-gpios = <&tlmm 8 0x0>这种简单写节点方式,为什么有的还要写pinctrl控制io的这种呢(最后都是gpio_direction_input/output来控制,相对来说pinctl在dtsi里面要写的繁琐一些)
&i2c_2 {
goodix@5d {
compatible = "goodix,gt9xx_second";
reg = <0x5d>;
interrupt-parent = <&tlmm>;
interrupts = <9 0x2>;
reset-gpios = <&tlmm 8 0x0>;
interrupt-gpios = <&tlmm 9 0x2008>;
power-gpios = <&tlmm 0 0x0>;
vdd-supply = <&pm8953_l10>;
vcc_i2c-supply = <&pm8953_l6>;
goodix,panel-coords = <0 0 719 1405>;
goodix,display-coords = <0 0 719 1279>;
goodix,button-map= <139 172 158>;
-----------------------------2019/12/4更新------------------------
今天调敦泰的tp驱动,从驱动代码的注释上看的,说的是vdd和vcc_i2c的问题
focaltech_core.c:
949 /*****************************************************************************
950 * Name: fts_power_source_init
951 * Brief: Init regulator power:vdd/vcc_io(if have), generally, no vcc_io
952 * vdd---->vdd-supply in dts, kernel will auto add "-supply" to parse
953 * Must be call after fts_gpio_configure() execute,because this function
954 * will operate reset-gpio which request gpio in fts_gpio_configure()
955 * Input:
956 * Output:
957 * Return: return 0 if init power successfully, otherwise return error code
958 *****************************************************************************/
static int fts_power_source_init(struct fts_ts_data *ts_data)
{
...
}
//敦泰给的驱动代码,dts上没有配置这两路电,实际测量i2c有电,但是vdd没电。
vdd-supply = <&pm8953_l10>;
vcc_i2c-supply = <&pm8953_l6>;
加上后都有电。
--------------------------------------
目前想的一个问题是,dts里面给了两种gpio控制方式,一个是通过tlmm/msm_gpio这种方式,一种是pinctrl这种方式,实际应该都可以,但是这两种区别是什么,两种具体引用是不是有不同的影响。