From b3556e09b09136ac6b4435b2ccd1f57a13365535 Mon Sep 17 00:00:00 2001 From: Jesse Gilles Date: Tue, 27 Jul 2010 14:38:09 -0500 Subject: add extserial-dtr * Add ability to read DTR pin on external serial port --- io-module/mts_io.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'io-module') diff --git a/io-module/mts_io.c b/io-module/mts_io.c index 3609d1a..bc5db24 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -481,6 +481,33 @@ static struct device_attribute dev_attr_extserial_dsr = { .store = store_extserial_dsr, }; +static ssize_t show_extserial_dtr(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int value; + + mutex_lock(&mts_io_mutex); + + value = !at91_get_gpio_value(GPIO_DTR1); + + mutex_unlock(&mts_io_mutex); + + if (value < 0) { + return value; + } + + return sprintf(buf, "%d\n", value); +} + +static struct device_attribute dev_attr_extserial_dtr = { + .attr = { + .name = "extserial-dtr", + .mode = 0444, + }, + .show = show_extserial_dtr, +}; + static ssize_t show_led_sig1(struct device *dev, struct device_attribute *attr, char *buf) @@ -970,6 +997,7 @@ static struct attribute *platform_attributes[] = { &dev_attr_extserial_dcd.attr, &dev_attr_extserial_ri.attr, &dev_attr_extserial_dsr.attr, + &dev_attr_extserial_dtr.attr, &dev_attr_led_sig1.attr, &dev_attr_led_sdk_c.attr, &dev_attr_led_sig2.attr, -- cgit v1.2.3