summaryrefslogtreecommitdiff
path: root/io-module/mts_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io-module/mts_io.c')
-rw-r--r--io-module/mts_io.c56
1 files changed, 19 insertions, 37 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 1f641d9..e578941 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -212,29 +212,13 @@ static DEVICE_ATTR_MTS(dev_attr_reset_monitor, "reset-monitor",
mts_attr_show_reset_monitor, mts_attr_store_reset_monitor);
static DEVICE_ATTR_RO_MTS(dev_attr_reset, "reset", mts_attr_show_gpio_pin);
-/* generic peripheral reset functions */
-static int radio_reset(void)
-{
- struct gpio_pin *pin = gpio_pin_by_name("RADIO_RESET");
-
- if (!pin) {
- return -ENODEV;
- }
-
- gpio_set_value(pin->pin.gpio, 0);
-
- mdelay(250);
-
- gpio_set_value(pin->pin.gpio, 1);
-
- return 0;
-}
-
+/* active-low socket modem reset */
static ssize_t mts_attr_store_radio_reset(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
int value;
int err;
+ struct gpio_pin *pin;
if (sscanf(buf, "%i", &value) != 1) {
return -EINVAL;
@@ -243,9 +227,16 @@ static ssize_t mts_attr_store_radio_reset(struct device *dev,
return -EINVAL;
}
+ pin = gpio_pin_by_name("RADIO_RESET");
+
+ if (!pin) {
+ return -ENODEV;
+ }
+
mutex_lock(&mts_io_mutex);
- err = radio_reset();
+ // 250ms low reset
+ err = reset_gpio_pin(pin, 250, 0);
mutex_unlock(&mts_io_mutex);
@@ -256,28 +247,12 @@ static ssize_t mts_attr_store_radio_reset(struct device *dev,
return count;
}
-static int ndc_reset(void)
-{
- struct gpio_pin *pin = gpio_pin_by_name("NDC_RESET");
-
- if (!pin) {
- return -ENODEV;
- }
-
- gpio_set_value(pin->pin.gpio, 0);
-
- mdelay(1);
-
- gpio_set_value(pin->pin.gpio, 1);
-
- return 0;
-}
-
static ssize_t mts_attr_store_ndc_reset(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
int value;
int err;
+ struct gpio_pin *pin;
if (sscanf(buf, "%i", &value) != 1) {
return -EINVAL;
@@ -286,9 +261,16 @@ static ssize_t mts_attr_store_ndc_reset(struct device *dev,
return -EINVAL;
}
+ pin = gpio_pin_by_name("NDC_RESET");
+
+ if (!pin) {
+ return -ENODEV;
+ }
+
mutex_lock(&mts_io_mutex);
- err = ndc_reset();
+ // 1ms low reset
+ err = reset_gpio_pin(pin, 1, 0);
mutex_unlock(&mts_io_mutex);