if (r->direction & mask) { /* * double-read the value, some registers latch after the * first read.
*/
readl_relaxed(r->reg);
val = readl_relaxed(r->reg);
} else {
val = r->out;
} return !!(val & mask);
}
if (irq >= 0 && r->irqdomain)
irq = irq_find_mapping(r->irqdomain, irq);
return irq;
}
/** * gpio_reg_init - add a fixed in/out register as gpio * @dev: optional struct device associated with this register * @base: start gpio number, or -1 to allocate * @num: number of GPIOs, maximum 32 * @label: GPIO chip label * @direction: bitmask of fixed direction, one per GPIO signal, 1 = in * @def_out: initial GPIO output value * @names: array of %num strings describing each GPIO signal or %NULL * @irqdom: irq domain or %NULL * @irqs: array of %num ints describing the interrupt mapping for each * GPIO signal, or %NULL. If @irqdom is %NULL, then this * describes the Linux interrupt number, otherwise it describes * the hardware interrupt number in the specified irq domain. * * Add a single-register GPIO device containing up to 32 GPIO signals, * where each GPIO has a fixed input or output configuration. Only * input GPIOs are assumed to be readable from the register, and only * then after a double-read. Output values are assumed not to be * readable.
*/ struct gpio_chip *gpio_reg_init(struct device *dev, void __iomem *reg, int base, int num, constchar *label, u32 direction, u32 def_out, constchar *const *names, struct irq_domain *irqdom, constint *irqs)
{ struct gpio_reg *r; int ret;
if (dev)
r = devm_kzalloc(dev, sizeof(*r), GFP_KERNEL); else
r = kzalloc(sizeof(*r), GFP_KERNEL);
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.