|
@@ -3264,8 +3264,21 @@ int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id,
|
|
|
|
|
|
if (lflags & GPIO_ACTIVE_LOW)
|
|
|
set_bit(FLAG_ACTIVE_LOW, &desc->flags);
|
|
|
+
|
|
|
if (lflags & GPIO_OPEN_DRAIN)
|
|
|
set_bit(FLAG_OPEN_DRAIN, &desc->flags);
|
|
|
+ else if (dflags & GPIOD_FLAGS_BIT_OPEN_DRAIN) {
|
|
|
+ /*
|
|
|
+ * This enforces open drain mode from the consumer side.
|
|
|
+ * This is necessary for some busses like I2C, but the lookup
|
|
|
+ * should *REALLY* have specified them as open drain in the
|
|
|
+ * first place, so print a little warning here.
|
|
|
+ */
|
|
|
+ set_bit(FLAG_OPEN_DRAIN, &desc->flags);
|
|
|
+ gpiod_warn(desc,
|
|
|
+ "enforced open drain please flag it properly in DT/ACPI DSDT/board file\n");
|
|
|
+ }
|
|
|
+
|
|
|
if (lflags & GPIO_OPEN_SOURCE)
|
|
|
set_bit(FLAG_OPEN_SOURCE, &desc->flags);
|
|
|
if (lflags & GPIO_SLEEP_MAY_LOOSE_VALUE)
|