Linux Audio

Check our new training course

Loading...
v6.2
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/* Copyright 2022 William Breathitt Gray */
 3#ifndef _I8255_H_
 4#define _I8255_H_
 5
 6#include <linux/spinlock.h>
 7#include <linux/types.h>
 
 8
 9/**
10 * struct i8255 - Intel 8255 register structure
11 * @port:	Port A, B, and C
12 * @control:	Control register
13 */
14struct i8255 {
15	u8 port[3];
16	u8 control;
17};
18
19/**
20 * struct i8255_state - Intel 8255 state structure
21 * @lock:		synchronization lock for accessing device state
22 * @control_state:	Control register state
 
 
 
 
 
 
23 */
24struct i8255_state {
25	spinlock_t lock;
26	u8 control_state;
 
 
 
27};
28
29void i8255_direction_input(struct i8255 __iomem *ppi, struct i8255_state *state,
30			   unsigned long offset);
31void i8255_direction_output(struct i8255 __iomem *ppi,
32			    struct i8255_state *state, unsigned long offset,
33			    unsigned long value);
34int i8255_get(struct i8255 __iomem *ppi, unsigned long offset);
35int i8255_get_direction(const struct i8255_state *state, unsigned long offset);
36void i8255_get_multiple(struct i8255 __iomem *ppi, const unsigned long *mask,
37			unsigned long *bits, unsigned long ngpio);
38void i8255_mode0_output(struct i8255 __iomem *const ppi);
39void i8255_set(struct i8255 __iomem *ppi, struct i8255_state *state,
40	       unsigned long offset, unsigned long value);
41void i8255_set_multiple(struct i8255 __iomem *ppi, struct i8255_state *state,
42			const unsigned long *mask, const unsigned long *bits,
43			unsigned long ngpio);
44void i8255_state_init(struct i8255_state *const state, unsigned long nbanks);
45
46#endif /* _I8255_H_ */
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/* Copyright 2022 William Breathitt Gray */
 3#ifndef _I8255_H_
 4#define _I8255_H_
 5
 6struct device;
 7struct irq_domain;
 8struct 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 */
23struct 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
31int devm_i8255_regmap_register(struct device *dev,
32			       const struct i8255_regmap_config *config);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
34#endif /* _I8255_H_ */