Comment 153 for bug 1887190

Revision history for this message
wangjun (biggerchina) wrote :

struct acpi_gpio_info {
 struct acpi_device *adev;
 enum gpiod_flags flags;
 bool gpioint;
 int pin_config;
 int polarity;
 int triggering;
 unsigned int quirks;
};

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,
 GPIOD_OUT_LOW_OPEN_DRAIN = GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_OPEN_DRAIN,
 GPIOD_OUT_HIGH_OPEN_DRAIN = GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_OPEN_DRAIN,
};

#define GPIOD_FLAGS_BIT_DIR_SET BIT(0)
#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1)
#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2)
#define GPIOD_FLAGS_BIT_OPEN_DRAIN BIT(3)
#define GPIOD_FLAGS_BIT_NONEXCLUSIVE BIT(4)

at end of the body of function gpiod_configure_flags:

 /* Process flags */
 if (dflags & GPIOD_FLAGS_BIT_DIR_OUT)
  ret = gpiod_direction_output(desc,
    !!(dflags & GPIOD_FLAGS_BIT_DIR_VAL));
 else
  ret = gpiod_direction_input(desc);

 return ret;
}

if miss config,
the default value is 0, it will be GPIOD_ASIS,
then in gpiod_configure_flags ,
it will call gpiod_direction_input .

are all the above right ?