0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __SERIAL_MCTRL_GPIO__
0009 #define __SERIAL_MCTRL_GPIO__
0010
0011 #include <linux/err.h>
0012 #include <linux/device.h>
0013 #include <linux/gpio/consumer.h>
0014
0015 struct uart_port;
0016
0017 enum mctrl_gpio_idx {
0018 UART_GPIO_CTS,
0019 UART_GPIO_DSR,
0020 UART_GPIO_DCD,
0021 UART_GPIO_RNG,
0022 UART_GPIO_RI = UART_GPIO_RNG,
0023 UART_GPIO_RTS,
0024 UART_GPIO_DTR,
0025 UART_GPIO_MAX,
0026 };
0027
0028
0029
0030
0031 struct mctrl_gpios;
0032
0033 #ifdef CONFIG_GPIOLIB
0034
0035
0036
0037
0038 void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl);
0039
0040
0041
0042
0043
0044 unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl);
0045
0046
0047
0048
0049
0050 unsigned int
0051 mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl);
0052
0053
0054
0055
0056 struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios,
0057 enum mctrl_gpio_idx gidx);
0058
0059
0060
0061
0062
0063
0064
0065
0066 struct mctrl_gpios *mctrl_gpio_init(struct uart_port *port, unsigned int idx);
0067
0068
0069
0070
0071
0072
0073
0074 struct mctrl_gpios *mctrl_gpio_init_noauto(struct device *dev,
0075 unsigned int idx);
0076
0077
0078
0079
0080
0081
0082 void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios);
0083
0084
0085
0086
0087 void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios);
0088
0089
0090
0091
0092 void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios);
0093
0094
0095
0096
0097 void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios);
0098
0099
0100
0101
0102 void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios);
0103
0104 #else
0105
0106 static inline
0107 void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl)
0108 {
0109 }
0110
0111 static inline
0112 unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl)
0113 {
0114 return *mctrl;
0115 }
0116
0117 static inline unsigned int
0118 mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl)
0119 {
0120 return *mctrl;
0121 }
0122
0123 static inline
0124 struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios,
0125 enum mctrl_gpio_idx gidx)
0126 {
0127 return NULL;
0128 }
0129
0130 static inline
0131 struct mctrl_gpios *mctrl_gpio_init(struct uart_port *port, unsigned int idx)
0132 {
0133 return NULL;
0134 }
0135
0136 static inline
0137 struct mctrl_gpios *mctrl_gpio_init_noauto(struct device *dev, unsigned int idx)
0138 {
0139 return NULL;
0140 }
0141
0142 static inline
0143 void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios)
0144 {
0145 }
0146
0147 static inline void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios)
0148 {
0149 }
0150
0151 static inline void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios)
0152 {
0153 }
0154
0155 static inline void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios)
0156 {
0157 }
0158
0159 static inline void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios)
0160 {
0161 }
0162
0163 #endif
0164
0165 #endif