summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2018-10-17 12:08:37 -0500
committerJohn Klug <john.klug@multitech.com>2018-10-17 12:08:37 -0500
commitccc7738ae4f4db3c6ff0903858542ead7fd75207 (patch)
treeeb5769a63deaf49641121c6bf85ac854b82ee4bf
parent48eac9a86c87b88ec8a05352b09407c0cf19733c (diff)
downloadmts-io-3.0.2.tar.gz
mts-io-3.0.2.tar.bz2
mts-io-3.0.2.zip
Remove duplicate pin definitions in mts-io.c3.0.2
-rw-r--r--io-module/mts-io.c487
-rw-r--r--io-module/mts_io_module.h2
2 files changed, 4 insertions, 485 deletions
diff --git a/io-module/mts-io.c b/io-module/mts-io.c
index da02ce8..7726b34 100644
--- a/io-module/mts-io.c
+++ b/io-module/mts-io.c
@@ -47,25 +47,17 @@
#include "mts_io_module.h"
#include "mts_io.h"
-/*
-#include "mtac.h"
-*/
#include "buttons.h"
#define PLATFORM_NAME "mts-io"
#define LED_LS_CONTROLLABLE 0
-int mtsio_reread_eeprom = 0;
-module_param(mtsio_reread_eeprom, int, S_IRUSR | S_IRGRP | S_IROTH);
-MODULE_PARM_DESC(mtsio_reread_eeprom, "Non-zero means re-read EEPROM");
-
/* on-board EEPROM */
extern uint8_t mts_id_eeprom[512];
static struct mts_id_eeprom_layout id_eeprom;
-uint8_t mts_hw_version;
-
+static uint8_t mts_hw_version;
struct platform_device *mts_io_platform_device;
EXPORT_SYMBOL(mts_io_platform_device);
@@ -459,7 +451,6 @@ static DEVICE_ATTR_MTS(dev_attr_led_d_gpio, "led-d",
static DEVICE_ATTR_MTS(dev_attr_led_e_gpio, "led-e",
mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
-
/* eeprom info */
static ssize_t mts_attr_show_product_info(struct device *dev,
struct device_attribute *attr,
@@ -562,478 +553,8 @@ static int get_radio_model_from_product_id(void) {
/* include on-board lora peripheral */
#include "mts_lora.c"
-/* Start of mtcdt.c */
-/*
- * Within a struct gpio_pin, there is only one
- * occurance of each pin, so there is only one
- * pin label set for each gpio pin.
- */
-static struct gpio_pin gpio_pins_mtcdt_0_0[] = {
- {
- .name = "RADIO_RESET",
- .pin = {
- .gpio = AT91_PIN_PC3,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "radio-reset",
- },
- },
- {
- .name = "RADIO_RESET",
- .pin = {
- .gpio = AT91_PIN_PC3,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "radio-power",
- },
- },
- {
- .name = "DEVICE_RESET",
- .pin = {
- .gpio = AT91_PIN_PC2,
- .flags = GPIOF_IN,
- .label = "reset",
- },
- .active_low = 1,
- },
- {
- .name = "ETH_RESET",
- .pin = {
- .gpio = AT91_PIN_PC4,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "eth-reset",
- }
- },
- {
- .name = "LS_LED", /* LED7 */
- .pin = {
- .gpio = AT91_PIN_PA14,
-#if LED_LS_CONTROLLABLE
- .flags = GPIOF_OUT_INIT_HIGH,
-#else
- .flags = GPIOF_IN,
-#endif
- .label = "led-ls",
- },
- .active_low = 1,
- },
- {
- .name = "STATUS_LED", /* LED2 */
- .pin = {
- .gpio = AT91_PIN_PA24,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "led-status",
- },
- .active_low = 1,
- },
- {
- .name = "LED5",
- .pin = {
- .gpio = AT91_PIN_PA25,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-cd",
- },
- .active_low = 1,
- },
- {
- .name = "LED5",
- .pin = {
- .gpio = AT91_PIN_PA25,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-a",
- },
- .active_low = 1,
- },
- {
- .name = "LED1",
- .pin = {
- .gpio = AT91_PIN_PA26,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-sig1",
- },
- .active_low = 1,
- },
- {
- .name = "LED1",
- .pin = {
- .gpio = AT91_PIN_PA26,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-b",
- },
- .active_low = 1,
- },
- {
- .name = "LED4",
- .pin = {
- .gpio = AT91_PIN_PA27,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-sig2",
- },
- .active_low = 1,
- },
- {
- .name = "LED4",
- .pin = {
- .gpio = AT91_PIN_PA27,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-c",
- },
- .active_low = 1,
- },
- {
- .name = "LED3",
- .pin = {
- .gpio = AT91_PIN_PA28,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-sig3",
- },
- .active_low = 1,
- },
- {
- .name = "LED3",
- .pin = {
- .gpio = AT91_PIN_PA28,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-d",
- },
- .active_low = 1,
- },
-};
-
-
-static struct gpio_pin gpio_pins_mtcdt_0_1[] = {
- {
- .name = "RADIO_RESET",
- .pin = {
- .gpio = AT91_PIN_PC3,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "radio-reset",
- },
- },
- {
- .name = "RADIO_RESET",
- .pin = {
- .gpio = AT91_PIN_PC3,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "radio-power",
- },
- },
- {
- .name = "DEVICE_RESET",
- .pin = {
- .gpio = AT91_PIN_PC2,
- .flags = GPIOF_IN,
- .label = "reset",
- },
- .active_low = 1,
- },
- {
- .name = "LS_LED", /* LED7 */
- .pin = {
- .gpio = AT91_PIN_PA14,
-#if LED_LS_CONTROLLABLE
- .flags = GPIOF_OUT_INIT_HIGH,
-#else
- .flags = GPIOF_IN,
-#endif
- .label = "led-ls",
- },
- .active_low = 1,
- },
- {
- .name = "STATUS_LED", /* LED2 */
- .pin = {
- .gpio = AT91_PIN_PA24,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "led-status",
- },
- .active_low = 1,
- },
- {
- .name = "LED5",
- .pin = {
- .gpio = AT91_PIN_PA25,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-cd",
- },
- .active_low = 1,
- },
- {
- .name = "LED5",
- .pin = {
- .gpio = AT91_PIN_PA25,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-a",
- },
- .active_low = 1,
- },
- {
- .name = "LED1",
- .pin = {
- .gpio = AT91_PIN_PA26,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-sig1",
- },
- .active_low = 1,
- },
- {
- .name = "LED1",
- .pin = {
- .gpio = AT91_PIN_PA26,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-b",
- },
- .active_low = 1,
- },
- {
- .name = "LED4",
- .pin = {
- .gpio = AT91_PIN_PA27,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-sig2",
- },
- .active_low = 1,
- },
- {
- .name = "LED4",
- .pin = {
- .gpio = AT91_PIN_PA27,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-c",
- },
- .active_low = 1,
- },
- {
- .name = "LED3",
- .pin = {
- .gpio = AT91_PIN_PA28,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-sig3",
- },
- .active_low = 1,
- },
- {
- .name = "LED3",
- .pin = {
- .gpio = AT91_PIN_PA28,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "led-d",
- },
- .active_low = 1,
- },
- {
- .name = "WIFI_BT_ULPWKUP",
- .pin = {
- .gpio = AT91_PIN_PA0,
- .flags = GPIOF_IN,
- .label = "wifi-bt-ulpwkup",
- },
- .capability = CAPA_WIFI,
- },
- {
- .name = "WIFI_BT_LPWKUP",
- .pin = {
- .gpio = AT91_PIN_PA6,
- .flags = GPIOF_IN,
- .label = "wifi-bt-lpwkup",
- },
- .capability = CAPA_WIFI,
- },
- {
- .name = "WIFI_BT_INT",
- .pin = {
- .gpio = AT91_PIN_PB11,
- .flags = GPIOF_IN,
- .label = "wifi-bt-int",
- },
- .capability = CAPA_WIFI,
- },
- {
- .name = "WIFI_BT_RESET",
- .pin = {
- .gpio = AT91_PIN_PD14,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "wifi-bt-reset",
- },
- .capability = CAPA_WIFI,
- },
- {
- .name = "GNSS_RESET",
- .pin = {
- .gpio = AT91_PIN_PD15,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "gnss-reset",
- },
- .capability = CAPA_GPS,
- },
- {
- .name = "SECURE_RESET",
- .pin = {
- .gpio = AT91_PIN_PD16,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "secure-reset",
- }
- },
- {
- .name = "MTQ_RESET",
- .pin = {
- .gpio = AT91_PIN_PD17,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "mtq-reset",
- }
- },
- {
- .name = "USBHUB_RESET",
- .pin = {
- .gpio = AT91_PIN_PD18,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "usbhub-reset",
- }
- },
- {
- .name = "GNSS_INT",
- .pin = {
- .gpio = AT91_PIN_PD19,
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "gnss-int",
- },
- .capability = CAPA_GPS,
- },
- {
- .name = "WIFI_BT_LPMODE",
- .pin = {
- .gpio = AT91_PIN_PD20,
- .flags = GPIOF_IN,
- .label = "wifi-bt-lpmode",
- },
- .capability = CAPA_WIFI,
- },
- { },
-};
-
-static DEVICE_ATTR_MTS(dev_attr_wifi_bt_lpwkup, "wifi-bt-lpwkup",
- mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
-static DEVICE_ATTR_MTS(dev_attr_wifi_bt_ulpwkup, "wifi-bt-ulpwkup",
- mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
-static DEVICE_ATTR_MTS(dev_attr_wifi_bt_reset, "wifi-bt-reset",
- mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
-static DEVICE_ATTR_RO_MTS(dev_attr_wifi_bt_lpmode, "wifi-bt-lpmode",
- mts_attr_show_gpio_pin);
-static DEVICE_ATTR_RO_MTS(dev_attr_wifi_bt_int, "wifi-bt-int",
- mts_attr_show_gpio_pin);
-static DEVICE_ATTR_MTS(dev_attr_gnss_reset, "gnss-reset",
- mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
-static DEVICE_ATTR_MTS(dev_attr_usbhub_reset, "usbhub-reset",
- mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
-static DEVICE_ATTR_MTS(dev_attr_eth_reset, "eth-reset",
- mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
-static DEVICE_ATTR_MTS(dev_attr_gnss_int, "gnss-int",
- mts_attr_show_gpio_pin, mts_attr_store_gpio_pin);
-
-
-
-static struct attribute *mtcdt_platform_attributes[] = {
- &dev_attr_vendor_id.attr,
- &dev_attr_product_id.attr,
- &dev_attr_device_id.attr,
- &dev_attr_uuid.attr,
- &dev_attr_hw_version.attr,
- &dev_attr_imei.attr,
- &dev_attr_eth_mac.attr,
- &dev_attr_has_radio.attr,
- &dev_attr_reset.attr,
- &dev_attr_reset_monitor.attr,
- &dev_attr_reset_monitor_intervals.attr,
-
- &dev_attr_led_status.attr,
- &dev_attr_led_cd_gpio.attr,
- &dev_attr_led_sig1_gpio.attr,
- &dev_attr_led_sig2_gpio.attr,
- &dev_attr_led_sig3_gpio.attr,
-
- &dev_attr_led_a_gpio.attr,
- &dev_attr_led_b_gpio.attr,
- &dev_attr_led_c_gpio.attr,
- &dev_attr_led_d_gpio.attr,
- &dev_attr_eth_reset.attr,
-
- &dev_attr_radio_power.attr,
- &dev_attr_radio_reset.attr,
-
- &dev_attr_radio_reset_backoffs.attr,
- &dev_attr_radio_reset_backoff_index.attr,
- &dev_attr_radio_reset_backoff_seconds.attr,
- NULL,
-};
-
-static struct attribute *mtcdt_0_1_platform_attributes[] = {
- &dev_attr_vendor_id.attr,
- &dev_attr_product_id.attr,
- &dev_attr_device_id.attr,
- &dev_attr_uuid.attr,
- &dev_attr_hw_version.attr,
- &dev_attr_imei.attr,
- &dev_attr_eth_mac.attr,
- &dev_attr_has_radio.attr,
- &dev_attr_reset.attr,
- &dev_attr_reset_monitor.attr,
- &dev_attr_reset_monitor_intervals.attr,
-
- &dev_attr_led_status.attr,
- &dev_attr_led_cd_gpio.attr,
- &dev_attr_led_sig1_gpio.attr,
- &dev_attr_led_sig2_gpio.attr,
- &dev_attr_led_sig3_gpio.attr,
-
- &dev_attr_led_a_gpio.attr,
- &dev_attr_led_b_gpio.attr,
- &dev_attr_led_c_gpio.attr,
- &dev_attr_led_d_gpio.attr,
-
- &dev_attr_usbhub_reset.attr,
- &dev_attr_eth_reset.attr,
-
- // radio feature is last to be able to
- // easily remove radio.
- // is_radio_power_attr_mtcdt() searches
- // for this for truncation.
- &dev_attr_radio_power.attr, /* Must be first radio attribute */
- &dev_attr_radio_reset.attr,
-
- &dev_attr_radio_reset_backoffs.attr,
- &dev_attr_radio_reset_backoff_index.attr,
- &dev_attr_radio_reset_backoff_seconds.attr,
-
- NULL,
-};
-
-static struct attribute *mtcdt_0_1_wifi_bt_attributes[] = {
- &dev_attr_wifi_bt_lpwkup.attr,
- &dev_attr_wifi_bt_ulpwkup.attr,
- &dev_attr_wifi_bt_reset.attr,
- &dev_attr_wifi_bt_lpmode.attr,
- &dev_attr_wifi_bt_int.attr,
-};
-
-static struct attribute *mtcdt_0_1_gnss_attributes[] = {
- &dev_attr_gnss_reset.attr,
- &dev_attr_gnss_int.attr,
-};
-
-
-static struct attribute_group mtcdt_platform_attribute_group = {
- .attrs = mtcdt_platform_attributes
-};
-static struct attribute_group mtcdt_0_1_platform_attribute_group = {
- .attrs = mtcdt_0_1_platform_attributes
-};
-
-
-static int
-is_radio_power_attr_mtcdt(struct attribute *attr)
-{
- return (attr == &dev_attr_radio_power.attr);
-}
-/* End of mths.c */
-
+/* include per-device pins and attributes */
+#include "mtcdt.c"
#include "mtcap.c"
#include "mtr.c"
#include "mths.c"
@@ -1041,7 +562,6 @@ is_radio_power_attr_mtcdt(struct attribute *attr)
/* include capabilities sub-directory support */
#include "mts_capab.c"
-
struct attribute **freelater = NULL; // Storage to free when driver is unloaded.
static int
@@ -1320,7 +840,6 @@ mts_id_eeprom_load(void)
static void cleanup(void)
{
log_info("cleaning up....");
-
if (mts_io_platform_device) {
platform_device_unregister(mts_io_platform_device);
}
diff --git a/io-module/mts_io_module.h b/io-module/mts_io_module.h
index 08c1b84..006aba4 100644
--- a/io-module/mts_io_module.h
+++ b/io-module/mts_io_module.h
@@ -5,7 +5,7 @@
* MTAC cards.
*/
-#define DRIVER_VERSION "v3.0.1"
+#define DRIVER_VERSION "v3.0.2"
#define DRIVER_AUTHOR "James Maki <jmaki@multitech.com>"
#define DRIVER_DESC "MTS-IO Controller"
#define DRIVER_NAME "mts-io"