struct bd71815_gpio { /* chip.parent points the MFD which provides DT node and regmap */ struct gpio_chip chip; /* dev points to the platform device for devm and prints */ struct device *dev; struct regmap *regmap;
};
/* * Sigh. The BD71815 and BD71817 were originally designed to support two GPO * pins. At some point it was noticed the second GPO pin which is the E5 pin * located at the center of IC is hard to use on PCB (due to the location). It * was decided to not promote this second GPO and the pin is marked as GND in * the datasheet. The functionality is still there though! I guess driving a GPO * connected to the ground is a bad idea. Thus we do not support it by default. * OTOH - the original driver written by colleagues at Embest did support * controlling this second GPO. It is thus possible this is used in some of the * products. * * This driver does not by default support configuring this second GPO * but allows using it by providing the DT property * "rohm,enable-hidden-gpo".
*/ staticint bd71815_init_valid_mask(struct gpio_chip *gc, unsignedlong *valid_mask, unsignedint ngpios)
{ if (ngpios != 2) return 0;
/* * Bind devm lifetime to this platform device => use dev for devm. * also the prints should originate from this device.
*/
dev = &pdev->dev; /* The device-tree and regmap come from MFD => use parent for that */
parent = dev->parent;
g = devm_kzalloc(dev, sizeof(*g), GFP_KERNEL); if (!g) return -ENOMEM;
g->chip = bd71815gpo_chip;
/* * FIXME: As writing of this the sysfs interface for GPIO control does * not respect the valid_mask. Do not trust it but rather set the ngpios * to 1 if "rohm,enable-hidden-gpo" is not given. * * This check can be removed later if the sysfs export is fixed and * if the fix is backported. * * For now it is safest to just set the ngpios though.
*/ if (device_property_present(parent, "rohm,enable-hidden-gpo"))
g->chip.ngpio = 2; else
g->chip.ngpio = 1;
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.