summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gilles <jgilles@multitech.com>2014-03-05 16:57:07 -0600
committerJesse Gilles <jgilles@multitech.com>2014-03-05 16:57:07 -0600
commitcfd0edb58b5e6e85887ddf891305252e46d75bd2 (patch)
tree9e605998725a35844891caeccafd9606fb8bebfa
parentb2b14fac088ff79501a91a9da070d9f466c03f10 (diff)
downloadcdp-io-controller-cfd0edb58b5e6e85887ddf891305252e46d75bd2.tar.gz
cdp-io-controller-cfd0edb58b5e6e85887ddf891305252e46d75bd2.tar.bz2
cdp-io-controller-cfd0edb58b5e6e85887ddf891305252e46d75bd2.zip
mtocgd2: fix radio-power attribute
-rw-r--r--io-module/mts_io.c39
1 files changed, 9 insertions, 30 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 271857a..550b7c5 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -480,6 +480,14 @@ static struct gpio_pin gpio_pins_mtr2_0_0[] = {
.use_pullup = 0,
},
{
+ .name = "RADIO_RESET",
+ .attr_name = "radio-power",
+ .pin = AT91_PIN_PC5,
+ .direction = GPIO_DIR_OUTPUT,
+ .output_value = 1,
+ .use_pullup = 0,
+ },
+ {
.name = "DEVICE_RESET",
.attr_name = "reset",
.pin = AT91_PIN_PC4,
@@ -1537,35 +1545,6 @@ static ssize_t mts_attr_store_radio_power_telit(struct device *dev,
return count;
}
-static ssize_t mts_attr_store_radio_power(struct device *dev,
- struct device_attribute *attr, const char *buf, size_t count)
-{
- int value;
- int ret;
-
- struct gpio_pin *pin = gpio_pin_by_name("RADIO_RESET");
-
- if (!pin) {
- return -ENODEV;
- }
-
- if (sscanf(buf, "%i", &value) != 1) {
- return -EINVAL;
- }
-
- if (value == 0) {
- mutex_lock(&mts_io_mutex);
- ret = at91_set_gpio_value(pin->pin, 0);
- mutex_unlock(&mts_io_mutex);
- } else {
- mutex_lock(&mts_io_mutex);
- ret = at91_set_gpio_value(pin->pin, 1);
- mutex_unlock(&mts_io_mutex);
- }
-
- return ret;
-}
-
static int radio_reset_telit(void)
{
int ret;
@@ -1776,7 +1755,7 @@ static ssize_t mts_attr_store_radio_reset_telit(struct device *dev,
}
static DEVICE_ATTR_MTS(dev_attr_radio_power, "radio-power",
- mts_attr_show_gpio_pin, mts_attr_store_radio_power);
+ mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
static DEVICE_ATTR_MTS(dev_attr_radio_reset, "radio-reset",
mts_attr_show_gpio_pin, mts_attr_store_radio_reset);