From cfd0edb58b5e6e85887ddf891305252e46d75bd2 Mon Sep 17 00:00:00 2001 From: Jesse Gilles Date: Wed, 5 Mar 2014 16:57:07 -0600 Subject: mtocgd2: fix radio-power attribute --- io-module/mts_io.c | 39 +++++++++------------------------------ 1 file 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 @@ -479,6 +479,14 @@ static struct gpio_pin gpio_pins_mtr2_0_0[] = { .output_value = 1, .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", @@ -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); -- cgit v1.2.3