xref: /illumos-gate/usr/src/uts/common/sys/gpio/ltc4306.h (revision a3ebb524df668b0fc3a38f33d0049380f5f11ec1)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2025 Oxide Computer Company
14  */
15 
16 #ifndef _SYS_GPIO_LTC4306_H
17 #define	_SYS_GPIO_LTC4306_H
18 
19 /*
20  * LTC4306 driver GPIO attribute definitions.
21  *
22  * The LTC4306 supports two basic attributes in addition to the standard name
23  * attribute KGPIO_ATTR_NAME.
24  */
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /*
31  * LTC4306_GPIO_ATTR_INTPUT -- ro
32  *	uint32_t -- ltc4306_gpio_input_t
33  */
34 #define	LTC4306_GPIO_ATTR_INPUT		"ltc4306:input"
35 typedef enum {
36 	LTC4306_GPIO_INPUT_LOW,
37 	LTC4306_GPIO_INPUT_HIGH
38 } ltc4306_gpio_input_t;
39 
40 /*
41  * LTC4306_GPIO_ATTR_OUTPUT -- rw
42  *	uint32_t -- ltc4306_gpio_output_t
43  *
44  * This controls the GPIO's output value. If the GPIO is configured as an input,
45  * modifying this will not impact anything. When the output is set to disabled,
46  * then the pin is put into an input-only mode.
47  */
48 #define	LTC4306_GPIO_ATTR_OUTPUT	"ltc4306:output"
49 typedef enum {
50 	LTC4306_GPIO_OUTPUT_DISABLED,
51 	LTC4306_GPIO_OUTPUT_LOW,
52 	LTC4306_GPIO_OUTPUT_HIGH
53 } ltc4306_gpio_output_t;
54 
55 /*
56  * LTC4306_GPIO_ATTR_OUTPUT_MODE -- rw
57  *	uint32_t -- ltc4306_gpio_output_mode_t
58  *
59  * This controls whether the pin is configured as an open-drain pin or a
60  * push-pull.
61  */
62 #define	LTC4306_GPIO_ATTR_OUTPUT_MODE	"ltc4306:output_mode"
63 typedef enum {
64 	LTC4306_GPIO_OUTPUT_MODE_PUSH_PULL,
65 	LTC4306_GPIO_OUTPUT_MODE_OPEN_DRAIN
66 } ltc4306_gpio_output_mode_t;
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif /* _SYS_GPIO_LTC4306_H */
73