在看显示模块的代码时看到一个函数devm_gpiod_get_optional(), 之前没接触过,它的调用如下: devm_gpiod_get_optional ->devm_gpiod_get_index_optional->//index为0devm_gpiod_get_index ->gpiod_get_index 可以看到devm_gpiod_get_optional只是对gpiod_get_index的包装而已,并且index为0。index参数后面会...
*host, if (!pwrseq) return ERR_PTR(-ENOMEM); - pwrseq->reset_gpio = gpiod_get_index(dev, "reset", 0, GPIOD_OUT_LOW); + pwrseq->reset_gpio = gpiod_get(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(pwrseq->reset_gpio)) { ret = PTR_ERR(pwrseq->reset_gpio); goto free; -...
- return devm_fwnode_get_index_gpiod_from_child(dev, con_id, 0, child, - flags, label); + return devm_fwnode_gpiod_get_index(dev, child, con_id, 0, flags, label); } #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_OF_GPIO) -- 2.23.0.162.g0b9fbb3734-goog...
在看显示模块的代码时看到一个函数devm_gpiod_get_optional(), 之前没接触过,它的调用如下: devm_gpiod_get_optional ->devm_gpiod_get_index_optional->//index为0devm_gpiod_get_index ->gpiod_get_index 可以看到devm_gpiod_get_optional只是对gpiod_get_index的包装而已,并且index为0。index参数后面会...
> The gpiod_get() function expands to gpiod_get_index() with index 0 > so it's better to use it since is easier to read and more concise. > > Signed-off-by: Javier Martinez Canillas <jav...@osg.samsung.com> Thanks, applied for next!
答:gpiod_get_index()本质上和gpio_request()是一个功能,是申请gpio的,只是它是从device tree去查找, 因此看到第二个参数”con_id”是字符串类型,也就是gpio的名字。 例如在显示驱动看到的去查找名字为”enable”的gpio panel-simple.c: panel->enable_gpio = devm_gpiod_get_optional(dev,"enable",0);...