|
root / base / usr / src / uts / common / sys / gpio / ltc4306.h
ltc4306.h C 73 lines 1.8 KB
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * This file and its contents are supplied under the terms of the
 * Common Development and Distribution License ("CDDL"), version 1.0.
 * You may only use this file in accordance with the terms of version
 * 1.0 of the CDDL.
 *
 * A full copy of the text of the CDDL should have accompanied this
 * source.  A copy of the CDDL is also available via the Internet at
 * http://www.illumos.org/license/CDDL.
 */

/*
 * Copyright 2025 Oxide Computer Company
 */

#ifndef _SYS_GPIO_LTC4306_H
#define	_SYS_GPIO_LTC4306_H

/*
 * LTC4306 driver GPIO attribute definitions.
 *
 * The LTC4306 supports two basic attributes in addition to the standard name
 * attribute KGPIO_ATTR_NAME.
 */

#ifdef __cplusplus
extern "C" {
#endif

/*
 * LTC4306_GPIO_ATTR_INTPUT -- ro
 *	uint32_t -- ltc4306_gpio_input_t
 */
#define	LTC4306_GPIO_ATTR_INPUT		"ltc4306:input"
typedef enum {
	LTC4306_GPIO_INPUT_LOW,
	LTC4306_GPIO_INPUT_HIGH
} ltc4306_gpio_input_t;

/*
 * LTC4306_GPIO_ATTR_OUTPUT -- rw
 *	uint32_t -- ltc4306_gpio_output_t
 *
 * This controls the GPIO's output value. If the GPIO is configured as an input,
 * modifying this will not impact anything. When the output is set to disabled,
 * then the pin is put into an input-only mode.
 */
#define	LTC4306_GPIO_ATTR_OUTPUT	"ltc4306:output"
typedef enum {
	LTC4306_GPIO_OUTPUT_DISABLED,
	LTC4306_GPIO_OUTPUT_LOW,
	LTC4306_GPIO_OUTPUT_HIGH
} ltc4306_gpio_output_t;

/*
 * LTC4306_GPIO_ATTR_OUTPUT_MODE -- rw
 *	uint32_t -- ltc4306_gpio_output_mode_t
 *
 * This controls whether the pin is configured as an open-drain pin or a
 * push-pull.
 */
#define	LTC4306_GPIO_ATTR_OUTPUT_MODE	"ltc4306:output_mode"
typedef enum {
	LTC4306_GPIO_OUTPUT_MODE_PUSH_PULL,
	LTC4306_GPIO_OUTPUT_MODE_OPEN_DRAIN
} ltc4306_gpio_output_mode_t;

#ifdef __cplusplus
}
#endif

#endif /* _SYS_GPIO_LTC4306_H */