diff options
author | John Klug <john.klug@multitech.com> | 2020-03-10 12:05:07 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2020-03-10 12:05:07 -0500 |
commit | a11f397797b2c0e98a26ecb3b22adba833417d06 (patch) | |
tree | e28fe47342de9fb87d1b7f2e4bc9140150d5fe17 /io-module/mts-io.c | |
parent | 937d21665a614dee618e48b51389d3a1e27709bf (diff) | |
parent | 5be5a4ffc7b619b68f5542a158c810c453a19b65 (diff) | |
download | mts-io-a11f397797b2c0e98a26ecb3b22adba833417d06.tar.gz mts-io-a11f397797b2c0e98a26ecb3b22adba833417d06.tar.bz2 mts-io-a11f397797b2c0e98a26ecb3b22adba833417d06.zip |
Merge remote-tracking branch 'origin/mt100eocg'
Diffstat (limited to 'io-module/mts-io.c')
-rw-r--r-- | io-module/mts-io.c | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/io-module/mts-io.c b/io-module/mts-io.c index 73d6376..f9ce122 100644 --- a/io-module/mts-io.c +++ b/io-module/mts-io.c @@ -4,6 +4,7 @@ * Copyright (C) 2014 by Multi-Tech Systems * Copyright (C) 2016 by Multi-Tech Systems * Copyright (C) 2019 by Multi-Tech Systems + * Copyright (C) 2020 by Multi-Tech Systems * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +21,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - +#include <linux/clk.h> #include <linux/delay.h> #include <linux/ioctl.h> #include <linux/input.h> @@ -71,6 +72,11 @@ static const struct of_device_id mts_io_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, mts_io_dt_ids); +/* on-board EEPROM */ +static struct mts_id_eeprom_layout id_eeprom; + +#include "adc.c" + /* * We must call platform_set_drvdata, or else the * devres_head for the driver has junk in it, and @@ -83,7 +89,11 @@ MODULE_DEVICE_TABLE(of, mts_io_dt_ids); */ static int mts_io_probe(struct platform_device *pdev) { - return 0; + int ret = 0; + if (!DEVICE_CAPA(id_eeprom.capa, CAPA_ADC)) { + ret = mts_io_board_adc_probe(pdev); + } + return ret; } static int mts_io_remove(struct platform_device *pdev) @@ -104,8 +114,6 @@ static struct platform_driver mts_io_driver = { }; -/* on-board EEPROM */ -static struct mts_id_eeprom_layout id_eeprom; static uint8_t mts_hw_version; struct platform_device *mts_io_platform_device; EXPORT_SYMBOL(mts_io_platform_device); @@ -128,6 +136,8 @@ static time_t time_now_secs(void); /* generic GPIO support */ #include "gpio.c" +#include "spi.c" + /* generic Button support */ //#include "buttons.c" @@ -622,6 +632,7 @@ static int get_radio_model_from_product_id(void) { #include "machine/mtr.c" #include "machine/mths.c" #include "machine/mtcpm.c" +#include "machine/mt100eocg.c" /* include capabilities sub-directory support */ #include "mts_capab.c" @@ -861,11 +872,17 @@ mts_id_eeprom_load(void) log_info("detected board %s", tmp); } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTCPM_0_0, strlen(HW_VERSION_MTCPM_0_0)) == 0) { - attr_group = &mtcpm_platform_attribute_group; - gpio_pins = gpio_pins_mtcpm; - set_buttons(default_buttons); - mts_hw_version = MTCPM_0_0; - log_info("detected board %s", HW_VERSION_MTCPM_0_0); + attr_group = &mtcpm_platform_attribute_group; + gpio_pins = gpio_pins_mtcpm; + set_buttons(default_buttons); + mts_hw_version = MTCPM_0_0; + log_info("detected board %s", HW_VERSION_MTCPM_0_0); + } else if (strncmp(id_eeprom.product_id, PRODUCT_ID_MT100EOCG, strlen(PRODUCT_ID_MT100EOCG)) == 0) { + attr_group = &mt100eocg_platform_attribute_group; + gpio_pins = gpio_pins_mt100eocg_0_0; + mts_hw_version = MT100EOCG_0_0; + set_buttons(default_buttons); + log_info("detected board %s", HW_VERSION_MT100EOCG_0_0); } else { int i; @@ -1007,6 +1024,23 @@ static int __init mts_io_init(void) return ret; } + if (DEVICE_CAPA(id_eeprom.capa, CAPA_DOUT)) { + ret = spi_register_driver(&mts_spi_dout_driver); + if (ret) { + printk(KERN_ERR "mts-io:mts-io-dout: probe failed: %d\n", ret); + } + } + if (DEVICE_CAPA(id_eeprom.capa, CAPA_DIN)) { + ret = spi_register_driver(&mts_spi_din_driver); + if (ret) { + printk(KERN_ERR "mts-io:mts-io-din: probe failed: %d\n", ret); + } + } + ret = spi_register_driver(&mts_spi_board_temp_driver); + if (ret) { + printk(KERN_ERR "mts-io:mts-io-board-temp: probe failed: %d\n", ret); + } + if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA) && attr_group_lora) { mts_load_lora_port(); } @@ -1050,6 +1084,14 @@ static int __init mts_io_init(void) static void __exit mts_io_exit(void) { + if (DEVICE_CAPA(id_eeprom.capa, CAPA_DOUT)) { + spi_unregister_driver(&mts_spi_dout_driver); + } + if (DEVICE_CAPA(id_eeprom.capa, CAPA_DIN)) { + spi_unregister_driver(&mts_spi_din_driver); + } + spi_unregister_driver(&mts_spi_board_temp_driver); + struct gpio_pin *pin; /* delete radio_reset_timer */ del_timer(&radio_reset_timer); |