if (delay) {
ddata->pullup_duration = delay;
} else { if (ddata->pullup_duration) { /* * This will OVERRIDE open drain emulation and force-pull * the line high for some time.
*/
gpiod_set_raw_value(ddata->gpiod, 1);
msleep(ddata->pullup_duration); /* * This will simply set the line as input since we are doing * open drain emulation in the GPIO library.
*/
gpiod_set_value(ddata->gpiod, 1);
}
ddata->pullup_duration = 0;
}
ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); if (!ddata) return -ENOMEM;
/* * This parameter means that something else than the gpiolib has * already set the line into open drain mode, so we should just * driver it high/low like we are in full control of the line and * open drain will happen transparently.
*/ if (device_property_present(dev, "linux,open-drain"))
gflags = GPIOD_OUT_LOW;
master = devm_kzalloc(dev, sizeof(*master), GFP_KERNEL); if (!master) return -ENOMEM;
/* * If we are using open drain emulation from the GPIO library, * we need to use this pullup function that hammers the line * high using a raw accessor to provide pull-up for the w1 * line.
*/ if (gflags == GPIOD_OUT_LOW_OPEN_DRAIN)
master->set_pullup = w1_gpio_set_pullup;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.