Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1478459
| From | Richard Genoud <richard.genoud@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts |
| Date | 2016-09-07 18:20 +0200 |
| Message-ID | <seNJT-22q-1@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
This function returns true if CTS and RTS are used as GPIOs.
Some drivers (like atmel_serial) needs to know if the flow control is
handled by the controller or by GPIOs.
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
drivers/tty/serial/serial_mctrl_gpio.c | 8 ++++++++
drivers/tty/serial/serial_mctrl_gpio.h | 9 +++++++++
2 files changed, 17 insertions(+)
diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c
index d2da6aa7f27d..93bed8c99796 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.c
+++ b/drivers/tty/serial/serial_mctrl_gpio.c
@@ -17,6 +17,7 @@
#include <linux/err.h>
#include <linux/device.h>
#include <linux/irq.h>
+#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/termios.h>
#include <linux/serial_core.h>
@@ -72,6 +73,13 @@ struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios,
}
EXPORT_SYMBOL_GPL(mctrl_gpio_to_gpiod);
+bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios)
+{
+ return !IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(gpios, UART_GPIO_CTS)) &&
+ !IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(gpios, UART_GPIO_RTS));
+}
+EXPORT_SYMBOL_GPL(mctrl_gpio_use_rtscts);
+
unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl)
{
enum mctrl_gpio_idx i;
diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h
index fa000bcff217..5d423b7f1e1c 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.h
+++ b/drivers/tty/serial/serial_mctrl_gpio.h
@@ -101,6 +101,11 @@ void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios);
*/
void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios);
+/*
+ * Return true if both CTS and RTS are used with GPIOs
+ */
+bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios);
+
#else /* GPIOLIB */
static inline
@@ -152,6 +157,10 @@ static inline void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios)
{
}
+static inline bool mctrl_gpio_use_rtscts(struct mctrl_gpios *gpios)
+{
+}
+
#endif /* GPIOLIB */
#endif
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts Richard Genoud <richard.genoud@gmail.com> - 2016-09-07 18:20 +0200
[PATCH 3/3] tty/serial: at91: fix hardware handshake when DMA is not used Richard Genoud <richard.genoud@gmail.com> - 2016-09-07 18:20 +0200
Re: [PATCH 3/3] tty/serial: at91: fix hardware handshake when DMA is not used Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-09-07 19:00 +0200
Re: [PATCH 3/3] tty/serial: at91: fix hardware handshake when DMA is not used Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-09-07 19:30 +0200
[PATCH 2/3] tty/serial: at91: fix hardware handshake with GPIOs Richard Genoud <richard.genoud@gmail.com> - 2016-09-07 18:20 +0200
Re: [PATCH 2/3] tty/serial: at91: fix hardware handshake with GPIOs Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-09-07 19:50 +0200
Re: [PATCH 1/3] serial: mctrl_gpio: implement mctrl_gpio_use_rtscts kbuild test robot <lkp@intel.com> - 2016-09-07 20:40 +0200
csiph-web