diff options
author | Thanh Tran <ttran@multitech.com> | 2011-09-14 15:25:54 -0500 |
---|---|---|
committer | Thanh Tran <ttran@multitech.com> | 2011-09-14 15:25:54 -0500 |
commit | dc0ed7ea45a2bd0bab2eba12a39c6fc148d00fee (patch) | |
tree | 73bacb4e760a69fc95b0b0408339b4356a714bd1 | |
parent | 39b92baf372e0f9dbb4198e5338d261b995ecf6e (diff) | |
download | cdp-io-controller-dc0ed7ea45a2bd0bab2eba12a39c6fc148d00fee.tar.gz cdp-io-controller-dc0ed7ea45a2bd0bab2eba12a39c6fc148d00fee.tar.bz2 cdp-io-controller-dc0ed7ea45a2bd0bab2eba12a39c6fc148d00fee.zip |
Making IO signals logic the same as the stand-alone CDP box.v0.5.0
-rw-r--r-- | io-module/mts_io.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c index 8c1251b..438e98c 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -1005,10 +1005,19 @@ static ssize_t mts_attr_store_dout(struct device *dev, mutex_lock(&spi_dout_mutex); - if (value) { - spi_dout_value &= ~bit; - } else { - spi_dout_value |= bit; + if (!strcmp(id_eeprom.product_id, PRODUCT_ID_MT100ECDP)) { + if (!value) { + spi_dout_value &= ~bit; + } else { + spi_dout_value |= bit; + } + } + else { + if (value) { + spi_dout_value &= ~bit; + } else { + spi_dout_value |= bit; + } } spi_writen(spi_dout_dev, &spi_dout_value, 1); @@ -1052,7 +1061,12 @@ static ssize_t mts_attr_show_dout(struct device *dev, mutex_lock(&spi_dout_mutex); - value = spi_dout_value & bit ? 0 : 1; + if (!strcmp(id_eeprom.product_id, PRODUCT_ID_MT100ECDP)) { + value = spi_dout_value & bit ? 1 : 0; + } + else { + value = spi_dout_value & bit ? 0 : 1; + } mutex_unlock(&spi_dout_mutex); @@ -1769,7 +1783,7 @@ static ssize_t mts_attr_show_gpio11(struct device *dev, return value; } - return sprintf(buf, "%d\n", !value); + return sprintf(buf, "%d\n", value); } static ssize_t mts_attr_store_gpio11(struct device *dev, @@ -1789,7 +1803,7 @@ static ssize_t mts_attr_store_gpio11(struct device *dev, mutex_lock(&mts_io_mutex); - err = at91_set_gpio_value(pin->pin, !value); + err = at91_set_gpio_value(pin->pin, value); mutex_unlock(&mts_io_mutex); @@ -1816,7 +1830,7 @@ static ssize_t mts_attr_show_gpio12(struct device *dev, return value; } - return sprintf(buf, "%d\n", !value); + return sprintf(buf, "%d\n", value); } static ssize_t mts_attr_store_gpio12(struct device *dev, @@ -1836,7 +1850,7 @@ static ssize_t mts_attr_store_gpio12(struct device *dev, mutex_lock(&mts_io_mutex); - err = at91_set_gpio_value(pin->pin, !value); + err = at91_set_gpio_value(pin->pin, value); mutex_unlock(&mts_io_mutex); |