devm_gpiod_get usage to get the gpio num

Raul Piper raulpblooper at gmail.com
Tue Aug 16 06:28:53 EDT 2016


Hi,
 devm_gpiod_get method takes 3 params after kernel 3.16 .

struct gpio_desc *gpiod;

gpiod = devm_gpiod_get(dev, "data-pin",GPIOD_OUT_HIGH)

where data-pin defintion in the device tree is :

data-pin = <&gpio2 51 GPIO_ACTIVE_HIGH>;

But this on inserting ht module givees "failed to parse DT (-2)

GPIOD_OUT_HIGH is one of the gpiod flags :

  enum gpiod_flags {
         GPIOD_ASIS      = 0,
          GPIOD_IN        = GPIOD_FLAGS_BIT_DIR_SET,
        GPIOD_OUT_LOW   = GPIOD_FLAGS_BIT_DIR_SET |
GPIOD_FLAGS_BIT_DIR_OUT,
          GPIOD_OUT_HIGH  = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT |
                           GPIOD_FLAGS_BIT_DIR_VAL,
 };

what is wrong here?I just want to extract the gpio number for the dt parser.

Thanks and Rgds,
Rp



More information about the Kernelnewbies mailing list