GNU Linux-libre 6.9.1-gnu
[releases.git] / drivers / gpio / gpio-i8255.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright 2022 William Breathitt Gray */
3 #ifndef _I8255_H_
4 #define _I8255_H_
5
6 struct device;
7 struct irq_domain;
8 struct regmap;
9
10 #define i8255_volatile_regmap_range(_base) regmap_reg_range(_base, _base + 0x2)
11
12 /**
13  * struct i8255_regmap_config - Configuration for the register map of an i8255
14  * @parent:     parent device
15  * @map:        regmap for the i8255
16  * @num_ppi:    number of i8255 Programmable Peripheral Interface
17  * @names:      (optional) array of names for gpios
18  * @domain:     (optional) IRQ domain if the controller is interrupt-capable
19  *
20  * Note: The regmap is expected to have cache enabled and i8255 control
21  * registers not marked as volatile.
22  */
23 struct i8255_regmap_config {
24         struct device *parent;
25         struct regmap *map;
26         int num_ppi;
27         const char *const *names;
28         struct irq_domain *domain;
29 };
30
31 int devm_i8255_regmap_register(struct device *dev,
32                                const struct i8255_regmap_config *config);
33
34 #endif /* _I8255_H_ */