i2c节点中其他引脚的设备树绑定

时间:2018-10-12 12:47:27

标签: linux linux-kernel linux-device-driver embedded-linux device-tree

我正在尝试向我一直在使用的i2c设备添加复位引脚。似乎该属性的获取结果返回null。可以通过这种方式处理GPIO吗?

设备树定义看起来像THI

static int goodix_get_gpio_config(struct goodix_ts_data *ts)
{
    int error;
    struct device *dev;
    struct gpio_desc *gpiod;

    if (!ts->client)
        return -EINVAL;
    dev = &ts->client->dev;
    struct device_node *np = &dev->of_node;


    /* Get the interrupt GPIO pin number */
    gpiod = of_get_property(dev->of_node, "interrupts", NULL);
    if (IS_ERR(gpiod)) {
        error = PTR_ERR(gpiod);
        if (error != -EPROBE_DEFER)
            dev_dbg(dev, "Failed to get %s GPIO: %d\n",
                GOODIX_GPIO_INT_NAME, error);
        return error;
    }

    ts->int_pin = gpiod;

    /* Get the reset line GPIO pin number */
    gpiod = of_get_property(dev->of_node, "reset-gpios", NULL);
    if (IS_ERR(gpiod)) {
        error = PTR_ERR(gpiod);
        if (error != -EPROBE_DEFER)
            dev_dbg(dev, "Failed to get %s GPIO: %d\n",
                GOODIX_GPIO_RST_NAME, error);
        return error;
    }

    ts->reset_pin = gpiod;
return 0;
}

源看起来像这样。其他有效但省略的组件,例如reg info等。这是我努力奋斗的大头针。

create or replace function get_saldo(
P_saldo in konto.saldo%type,
p_knr in konto.knr%type)
return varchar2
as
v_saldo varchar2(20);
begin
select count(knr)
into v_saldo
from konto
where knr = p_knr
and saldo = p_saldo
and  p_knr = p_saldo;
return  v_saldo;
end;
/

这是正确的方法还是应该调用其他函数?

1 个答案:

答案 0 :(得分:0)

问题是在reset-gpios属性中不需要GPIO_NO()函数。一旦将其删除,属性就会加载。