struct gpio_trig_data { struct led_classdev *led; unsigned desired_brightness; /* desired brightness when led is on */ struct gpio_desc *gpiod; /* gpio that triggers the led */
};
gpio_data = kzalloc(sizeof(*gpio_data), GFP_KERNEL); if (!gpio_data) return -ENOMEM;
/* * The generic property "trigger-sources" is followed, * and we hope that this is a GPIO.
*/
gpio_data->gpiod = gpiod_get_optional(dev, "trigger-sources", GPIOD_IN); if (IS_ERR(gpio_data->gpiod)) {
ret = PTR_ERR(gpio_data->gpiod);
kfree(gpio_data); return ret;
} if (!gpio_data->gpiod) {
dev_err(dev, "no valid GPIO for the trigger\n");
kfree(gpio_data); return -EINVAL;
}
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.